// FIXME Should we support this now?
@Test(enabled=false)
    public void testGetFutureConfigBlocksUntilReady() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);
        MyPolicy policy = new MyPolicy(MutableMap.builder()
                .put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(new Callable<String>() {
                        public String call() {
                            try {
                                latch.await(); return "aval";
                            } catch (InterruptedException e) {
                                throw Exceptions.propagate(e);
                            }
                        }}))
                .build());
        app.policies().add(policy);
        Thread t = new Thread(new Runnable() {
                public void run() {
                    try {
                        Thread.sleep(10+EARLY_RETURN_GRACE); latch.countDown();
                    } catch (InterruptedException e) {
                        throw Exceptions.propagate(e);
                    }
                }});
        try {
            long starttime = System.currentTimeMillis();
            t.start();
            assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval");
            long endtime = System.currentTimeMillis();
            assertTrue((endtime - starttime) >= 10, "starttime="+starttime+"; endtime="+endtime);
        } finally {
            t.interrupt();
        }
    }
@Test(enabled=false)
public void testGetFutureConfigBlocksUntilReady() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
MyPolicy policy = new MyPolicy(MutableMap.builder()
.put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(new Callable<String>() {
public String call() {
try {
latch.await(); return "aval";
} catch (InterruptedException e) {
throw Exceptions.propagate(e);
}
}}))
.build());
app.policies().add(policy);
Thread t = new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(10+EARLY_RETURN_GRACE); latch.countDown();
} catch (InterruptedException e) {
throw Exceptions.propagate(e);
}
}});
try {
long starttime = System.currentTimeMillis();
t.start();
assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval");
long endtime = System.currentTimeMillis();
assertTrue((endtime - starttime) >= 10, "starttime="+starttime+"; endtime="+endtime);
} finally {
t.interrupt();
}
}
@Test(enabled=false)
public void testGetFutureConfigBlocksUntilReady() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
MyPolicy policy = new MyPolicy(MutableMap.builder()
.put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(new Callable<String>() {
public String call() {
try {
latch.await(); return "aval";
} catch (InterruptedException e) {
throw Exceptions.propagate(e);
}
}}))
.build());
app.policies().add(policy);
Thread t = new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(10+EARLY_RETURN_GRACE); latch.countDown();
} catch (InterruptedException e) {
throw Exceptions.propagate(e);
}
}});
try {
long starttime = System.currentTimeMillis();
t.start();
assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval");
long endtime = System.currentTimeMillis();
assertTrue((endtime - starttime) >= 10, "starttime="+starttime+"; endtime="+endtime);
} finally {
t.interrupt();
}
}
@Test(enabled=false)
public void testGetFutureConfigBlocksUntilReady() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
MyPolicy policy = new MyPolicy(MutableMap.builder()
.put(TestEntity.CONF_NAME, DependentConfiguration.whenDone(new Callable<String>() {
public String call() {
try {
latch.await(); return "aval";
} catch (InterruptedException e) {
throw Exceptions.propagate(e);
}
}}))
.build());
app.policies().add(policy);
Thread t = new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(10+EARLY_RETURN_GRACE); latch.countDown();
} catch (InterruptedException e) {
throw Exceptions.propagate(e);
}
}});
try {
long starttime = System.currentTimeMillis();
t.start();
assertEquals(policy.getConfig(TestEntity.CONF_NAME), "aval");
long endtime = System.currentTimeMillis();
assertTrue((endtime - starttime) >= 10, "starttime="+starttime+"; endtime="+endtime);
} finally {
t.interrupt();
}
}