Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/663#discussion_r114291567
  
    --- Diff: 
core/src/test/java/org/apache/brooklyn/core/config/DeferredConfigTest.java ---
    @@ -30,32 +29,51 @@
     import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
     import org.apache.brooklyn.core.test.entity.TestApplication;
     import org.apache.brooklyn.util.guava.Maybe;
    +import org.apache.brooklyn.util.time.Duration;
    +import org.apache.brooklyn.util.time.Time;
    +import org.testng.Assert;
     import org.testng.annotations.Test;
     
     import com.google.common.collect.ImmutableList;
     import com.google.common.collect.Iterables;
     import com.google.common.reflect.TypeToken;
     
    -public class ConfigTypeCoercionTest extends BrooklynAppUnitTestSupport {
    +public class DeferredConfigTest extends BrooklynAppUnitTestSupport {
         private static ConfigKey<Object> SENSORS_UNTYPED = 
ConfigKeys.newConfigKey(Object.class, "sensors");
         @SuppressWarnings("serial")
         private static ConfigKey<List<? extends Sensor<?>>> SENSORS = 
ConfigKeys.newConfigKey(new TypeToken<List<? extends Sensor<?>>>() {}, 
"sensors");
         
         @Test
    -    public void testSshConfigFromDefault() throws Exception {
    +    public void testDeferredConfigInListWhenAvailable() throws Exception {
    +        doTestDeferredConfigInList(false);
    +    }
    +    
    +    @Test
    +    public void testDeferredConfigInListNotAvailable() throws Exception {
    +        doTestDeferredConfigInList(true);
    +    }
    +    
    +    void doTestDeferredConfigInList(final boolean delay) throws Exception {
             // Simulate a deferred value
             Task<Sensor<?>> sensorFuture = 
app.getExecutionContext().submit(new Callable<Sensor<?>>() {
                 @Override
                 public Sensor<?> call() throws Exception {
    +                if (delay) Time.sleep(Duration.FIVE_SECONDS);
                     return TestApplication.MY_ATTRIBUTE;
                 }
             });
             app.config().set(SENSORS_UNTYPED, 
(Object)ImmutableList.of(sensorFuture));
     
    +        if (!delay) sensorFuture.get(Duration.ONE_SECOND);
    --- End diff --
    
    it shouldn't take more than a millisecond on most machines but on a slow 
machine the 1s gives it plenty of time


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to