Examples of MockEndpoint


Examples of org.apache.camel.component.mock.MockEndpoint

    @Test
    public void testMalformedJson() throws Exception {
        String in = "{ \"a\": 123, \"b\": true, \"c\": true2 }";

        MockEndpoint mockXML = getMockEndpoint("mock:xml");
        mockXML.expectedMessageCount(0);

        MockEndpoint mockException = getMockEndpoint("mock:exception");
        mockException.expectedMessageCount(1);

        try {
            template.requestBody("direct:unmarshal", in);
            fail("Exception expected");
        } catch (CamelExecutionException e) {
            assertEquals("JSONException expected", JSONException.class, e.getCause().getClass());
        }

        List<Exchange> exchs = mockException.getExchanges();
        assertEquals("Only one exchange was expected in mock:exception", 1, exchs.size());

        Exception e = (Exception) exchs.get(0).getProperty(Exchange.EXCEPTION_CAUGHT);
        assertNotNull("Exception expected", e);
        assertEquals("JSONException expected", JSONException.class, e.getClass());
View Full Code Here

Examples of org.apache.geronimo.messaging.MockEndPoint

        assertTrue(proxy instanceof MockEndPoint);
        assertTrue(proxy instanceof EndPointProxy);
    }

    public void testInvoke() throws Exception {
        MockEndPoint actual = new MockEndPointImpl(new MockNode(), "", targets);
       
        EndPointUtil.interConnect(actual, factory);
       
        MockEndPoint endPoint = (MockEndPoint) proxy;
        Object opaque = new Object();
        endPoint.sendRawObject(opaque);
        List received = actual.getReceived();
        assertEquals(1, received.size());
        assertEquals(opaque, ((Request)received.get(0)).getParameters()[0]);
    }
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.