Examples of ExceptionType


Examples of org.apache.camel.model.ExceptionType

    private ExceptionType type3;

    private void setupPolicies() {
        strategy = new DefaultExceptionPolicyStrategy();
        policies = new HashMap<ExceptionPolicyKey, ExceptionType>();
        type1 = new ExceptionType(CamelExchangeException.class);
        type2 = new ExceptionType(Exception.class);
        type3 = new ExceptionType(IOException.class);
        policies.put(ExceptionPolicyKey.newInstance(CamelExchangeException.class), type1);
        policies.put(ExceptionPolicyKey.newInstance(Exception.class), type2);
        policies.put(ExceptionPolicyKey.newInstance(IOException.class), type3);
    }
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

    private void setupPoliciesNoTopLevelException() {
        // without the top level exception that can be used as fallback
        strategy = new DefaultExceptionPolicyStrategy();
        policies = new HashMap<ExceptionPolicyKey, ExceptionType>();
        type1 = new ExceptionType(CamelExchangeException.class);
        type3 = new ExceptionType(IOException.class);
        policies.put(ExceptionPolicyKey.newInstance(CamelExchangeException.class), type1);
        policies.put(ExceptionPolicyKey.newInstance(IOException.class), type3);
    }
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        policies.put(ExceptionPolicyKey.newInstance(IOException.class), type3);
    }

    public void testDirectMatch1() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new CamelExchangeException("", null));
        assertEquals(type1, result);
    }
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        assertEquals(type1, result);
    }

    public void testDirectMatch2() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new Exception(""));
        assertEquals(type2, result);
    }
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        assertEquals(type2, result);
    }

    public void testDirectMatch3() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new IOException(""));
        assertEquals(type3, result);
    }
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        assertEquals(type3, result);
    }

    public void testClosetMatch3() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new ConnectException(""));
        assertEquals(type3, result);

        result = strategy.getExceptionPolicy(policies, null, new SocketException(""));
        assertEquals(type3, result);
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        assertEquals(type3, result);
    }

    public void testClosetMatch2() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new ClassCastException(""));
        assertEquals(type2, result);

        result = strategy.getExceptionPolicy(policies, null, new NumberFormatException(""));
        assertEquals(type2, result);
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        assertEquals(type2, result);
    }

    public void testClosetMatch1() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new ValidationException(null, ""));
        assertEquals(type1, result);

        result = strategy.getExceptionPolicy(policies, null, new ExchangeTimedOutException(null, 0));
        assertEquals(type1, result);
    }
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        assertEquals(type1, result);
    }

    public void testNoMatch1ThenMatchingJustException() {
        setupPolicies();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new AlreadyStoppedException());
        assertEquals(type2, result);
    }
View Full Code Here

Examples of org.apache.camel.model.ExceptionType

        assertEquals(type2, result);
    }

    public void testNoMatch1ThenNull() {
        setupPoliciesNoTopLevelException();
        ExceptionType result = strategy.getExceptionPolicy(policies, null, new AlreadyStoppedException());
        assertNull("Should not find an exception policy to use", result);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.