use of com.adaptris.core.services.StopProcessingService in project interlok by adaptris.
the class DoWhileTest method testStopProcessingServiceCancelsLoop.
@Test
public void testStopProcessingServiceCancelsLoop() throws Exception {
when(mockCondition.evaluate(message)).thenReturn(true);
Service stopProcessingService = new StopProcessingService();
ServiceList services = new ServiceList();
services.add(stopProcessingService);
services.add(mockService);
thenService = new ThenService();
thenService.setService(services);
doWhile = new DoWhile().withThen(thenService).withCondition(mockCondition);
LifecycleHelper.init(doWhile);
LifecycleHelper.start(doWhile);
doWhile.doService(message);
// The default would loop 10 times, but the stop-processing-service should
// limit us to only a single loop and the condition will never be tested.
verify(mockCondition, times(0)).evaluate(message);
}
use of com.adaptris.core.services.StopProcessingService in project interlok by adaptris.
the class WhileTest method testStopProcessingServiceCancelsLoop.
@Test
public void testStopProcessingServiceCancelsLoop() throws Exception {
when(mockCondition.evaluate(message)).thenReturn(true);
Service stopProcessingService = new StopProcessingService();
ServiceList services = new ServiceList();
services.add(stopProcessingService);
services.add(mockService);
thenService = new ThenService();
thenService.setService(services);
logicalExpression = new While().withThen(thenService).withCondition(mockCondition);
startMe(logicalExpression);
logicalExpression.doService(message);
// The default would loop 10 times, but the stop-processing-service should limit us to only a single loop.
verify(mockCondition, times(1)).evaluate(message);
}
Aggregations