use of com.spotify.apollo.AppInit in project apollo by spotify.
the class HttpServiceTest method testCreateWithAppInit.
@Test
public void testCreateWithAppInit() throws Exception {
final InstanceWaiter waiter = new InstanceWaiter();
final CountDownLatch closed = new CountDownLatch(1);
final AppInit appInit = env -> {
counter.incrementAndGet();
env.closer().register(closed::countDown);
};
new Thread(() -> {
try {
HttpService.boot(appInit, "test", waiter, "run", "foo");
} catch (LoadingException e) {
e.printStackTrace();
fail(e.getMessage());
}
}).start();
final Service.Instance instance = waiter.waitForInstance();
instance.getSignaller().signalShutdown();
instance.waitForShutdown();
closed.await(5000, TimeUnit.SECONDS);
assertEquals(1, counter.get());
}
Aggregations