use of com.consol.citrus.condition.AbstractCondition in project camelinaction2 by camelinaction.
the class CitrusIT method stopAndWaitForGracefulShutdown.
/**
* Stop and wait for graceful shutdown of Camel context before closing the test.
*/
private void stopAndWaitForGracefulShutdown() {
// stop the Camel context with custom test action.
action(new AbstractTestAction() {
@Override
public void doExecute(TestContext context) {
try {
orderService.stop();
} catch (Exception e) {
throw new CitrusRuntimeException("Failed to stop Camel context");
}
}
});
waitFor().condition(new AbstractCondition() {
@Override
public boolean isSatisfied(TestContext context) {
return orderService.isStopped();
}
@Override
public String getSuccessMessage(TestContext context) {
return "Successfully stopped Camel context";
}
@Override
public String getErrorMessage(TestContext context) {
return "Failed to stop Camel context";
}
});
}
Aggregations