use of com.adaptris.core.lifecycle.NonBlockingChannelStartStrategy in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testStartWithDurableSubscribers_WithNonBlockingChannelStrategy.
@Test
public void testStartWithDurableSubscribers_WithNonBlockingChannelStrategy() throws Exception {
Adapter adapter = createDurableSubsAdapter(getName(), activeMqBroker);
adapter.requestStart();
assertEquals(StartedState.getInstance(), adapter.retrieveComponentState());
adapter.requestClose();
assertEquals(ClosedState.getInstance(), adapter.retrieveComponentState());
adapter.getChannelList().setLifecycleStrategy(new NonBlockingChannelStartStrategy());
adapter.requestStart();
// Thread.sleep(1000);
Channel c = adapter.getChannelList().getChannel(0);
int maxAttempts = 100;
int attempts = 0;
while (attempts < maxAttempts && c.retrieveComponentState() != StartedState.getInstance()) {
Thread.sleep(500);
attempts++;
}
assertEquals(StartedState.getInstance(), c.retrieveComponentState());
adapter.requestClose();
}
Aggregations