use of com.adaptris.core.stubs.CheckComponentStateService in project interlok by adaptris.
the class ServiceListTest method testBug2055.
@Test
public void testBug2055() throws Exception {
String name = Thread.currentThread().getName();
Thread.currentThread().setName("testBug2055");
final ServiceList services = new ServiceList();
MarkerService marker = new MarkerService();
services.addService(marker);
services.addService(new WaitService(new TimeInterval(3L, TimeUnit.SECONDS)));
services.addService(new CheckComponentStateService());
start(services);
final ExceptionContainer c = new ExceptionContainer();
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
services.doService(msg);
} catch (ServiceException e) {
c.setException(e);
}
}
});
t.start();
while (!marker.hasTriggered) {
Thread.sleep(10);
}
stop(services);
t.join();
if (c.getException() != null) {
fail("Services failed, " + c.getException().getMessage());
}
Thread.currentThread().setName(name);
}
Aggregations