use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class DefaultExceptionPolicyStrategyTest method setupPoliciesNoTopLevelException.
private void setupPoliciesNoTopLevelException() {
// without the top level exception that can be used as fallback
strategy = new DefaultExceptionPolicyStrategy();
policies = new HashMap<ExceptionPolicyKey, OnExceptionDefinition>();
type1 = new OnExceptionDefinition(CamelExchangeException.class);
type3 = new OnExceptionDefinition(IOException.class);
policies.put(new ExceptionPolicyKey(null, CamelExchangeException.class, null), type1);
policies.put(new ExceptionPolicyKey(null, IOException.class, null), type3);
}
use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class DefaultExceptionPolicyStrategyTest method setupPolicies.
private void setupPolicies() {
strategy = new DefaultExceptionPolicyStrategy();
policies = new HashMap<ExceptionPolicyKey, OnExceptionDefinition>();
type1 = new OnExceptionDefinition(CamelExchangeException.class);
type2 = new OnExceptionDefinition(Exception.class);
type3 = new OnExceptionDefinition(IOException.class);
policies.put(new ExceptionPolicyKey(null, CamelExchangeException.class, null), type1);
policies.put(new ExceptionPolicyKey(null, Exception.class, null), type2);
policies.put(new ExceptionPolicyKey(null, IOException.class, null), type3);
}
use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class DefaultExceptionPolicyStrategyTest method testCausedByNotConnected.
public void testCausedByNotConnected() {
setupPoliciesCausedBy();
IOException ioe = new IOException("Damm");
ioe.initCause(new ConnectException("Not connected"));
OnExceptionDefinition result = strategy.getExceptionPolicy(policies, null, ioe);
assertEquals(type3, result);
}
use of org.apache.camel.model.OnExceptionDefinition in project camel by apache.
the class DefaultExceptionPolicyStrategyTest method testCausedBy.
public void testCausedBy() {
setupPoliciesCausedBy();
IOException ioe = new IOException("Damm");
ioe.initCause(new FileNotFoundException("Somefile not found"));
OnExceptionDefinition result = strategy.getExceptionPolicy(policies, null, ioe);
assertEquals(type1, result);
}
Aggregations