use of org.apache.camel.impl.ConditionSupport in project camel by apache.
the class DebugTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
breakpoint = new BreakpointSupport() {
public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
String body = exchange.getIn().getBody(String.class);
logs.add("Breakpoint at " + definition + " with body: " + body);
}
public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
String body = exchange.getIn().getBody(String.class);
logs.add("Breakpoint event " + event.getClass().getSimpleName() + " with body: " + body);
}
};
camelCondition = new ConditionSupport() {
public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
return body().contains("Camel").matches(exchange);
}
};
mockCondition = new ConditionSupport() {
public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
// match when sending to mocks
if (definition instanceof ToDefinition) {
ToDefinition to = (ToDefinition) definition;
return to.getUriOrRef().startsWith("mock");
}
return false;
}
};
doneCondition = new ConditionSupport() {
@Override
public boolean matchEvent(Exchange exchange, EventObject event) {
return event instanceof ExchangeCompletedEvent;
}
};
}
use of org.apache.camel.impl.ConditionSupport in project camel by apache.
the class DebugExceptionBreakpointTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
breakpoint = new BreakpointSupport() {
@Override
public void afterProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition, long timeTaken) {
Exception e = exchange.getException();
logs.add("Breakpoint at " + definition.getShortName() + " caused by: " + e.getClass().getSimpleName() + "[" + e.getMessage() + "]");
}
};
exceptionCondition = new ConditionSupport() {
@Override
public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
return exchange.getException() != null;
}
};
}
use of org.apache.camel.impl.ConditionSupport in project camel by apache.
the class DebugExceptionEventBreakpointTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
breakpoint = new BreakpointSupport() {
public void onEvent(Exchange exchange, EventObject event, ProcessorDefinition<?> definition) {
AbstractExchangeEvent aee = (AbstractExchangeEvent) event;
Exception e = aee.getExchange().getException();
logs.add("Breakpoint at " + definition + " caused by: " + e.getClass().getSimpleName() + "[" + e.getMessage() + "]");
}
};
exceptionCondition = new ConditionSupport() {
public boolean matchEvent(Exchange exchange, EventObject event) {
return event instanceof ExchangeFailedEvent;
}
};
}
use of org.apache.camel.impl.ConditionSupport in project camel by apache.
the class DebugSingleStepConditionTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
breakpoint = new BreakpointSupport() {
public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
String body = exchange.getIn().getBody(String.class);
logs.add("Single stepping at " + definition.getLabel() + " with body: " + body);
}
};
beerCondition = new ConditionSupport() {
public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) {
return "beer".equals(exchange.getFromRouteId());
}
};
}
Aggregations