use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class ErrorHandlerSupportTest method testTwoPolicyChildFirst.
public void testTwoPolicyChildFirst() {
ErrorHandlerSupport support = new ShuntErrorHandlerSupport();
support.addExceptionPolicy(null, new OnExceptionDefinition(ChildException.class));
support.addExceptionPolicy(null, new OnExceptionDefinition(ParentException.class));
assertEquals(ChildException.class, getExceptionPolicyFor(support, new ChildException(), 0));
assertEquals(ParentException.class, getExceptionPolicyFor(support, new ParentException(), 0));
}
use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class ErrorHandlerSupportTest method testOnePolicyChildLast.
public void testOnePolicyChildLast() {
List<Class<? extends Throwable>> exceptions = new ArrayList<Class<? extends Throwable>>();
exceptions.add(ParentException.class);
exceptions.add(ChildException.class);
ErrorHandlerSupport support = new ShuntErrorHandlerSupport();
support.addExceptionPolicy(null, new OnExceptionDefinition(exceptions));
assertEquals(ChildException.class, getExceptionPolicyFor(support, new ChildException(), 1));
assertEquals(ParentException.class, getExceptionPolicyFor(support, new ParentException(), 0));
}
use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class ErrorHandlerSupportTest method testTwoPolicyChildLast.
public void testTwoPolicyChildLast() {
ErrorHandlerSupport support = new ShuntErrorHandlerSupport();
support.addExceptionPolicy(null, new OnExceptionDefinition(ParentException.class));
support.addExceptionPolicy(null, new OnExceptionDefinition(ChildException.class));
assertEquals(ChildException.class, getExceptionPolicyFor(support, new ChildException(), 0));
assertEquals(ParentException.class, getExceptionPolicyFor(support, new ParentException(), 0));
}
use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class DefaultExceptionPolicyStrategyTest method setupPoliciesCausedBy.
private void setupPoliciesCausedBy() {
strategy = new DefaultExceptionPolicyStrategy();
policies = new HashMap<ExceptionPolicyKey, OnExceptionDefinition>();
type1 = new OnExceptionDefinition(FileNotFoundException.class);
type2 = new OnExceptionDefinition(ConnectException.class);
type3 = new OnExceptionDefinition(IOException.class);
policies.put(new ExceptionPolicyKey(null, FileNotFoundException.class, null), type1);
policies.put(new ExceptionPolicyKey(null, IOException.class, null), type2);
policies.put(new ExceptionPolicyKey(null, ConnectException.class, null), type3);
}
use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class DefaultExceptionPolicyStrategyTest method testDirectMatch2.
public void testDirectMatch2() {
setupPolicies();
OnExceptionDefinition result = strategy.getExceptionPolicy(policies, null, new Exception(""));
assertEquals(type2, result);
}
Aggregations