Examples of expectedMessageCount()


Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

*/
public class UnmarshalThenMarshalTest extends ContextTestSupport {
    public void testSendXmlAndUnmarshal() throws Exception {

        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
        resultEndpoint.expectedMessageCount(1);

        PurchaseOrder expectedBody = new PurchaseOrder();
        expectedBody.setAmount(20.0);
        expectedBody.setName("Wine");
        expectedBody.setPrice(5.0);
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

    private static final String RESULT_QUEUE = "mock:result";
    private static final String ERROR_QUEUE = "mock:error";

    public void testHandledException() throws Exception {
        MockEndpoint result = getMockEndpoint(RESULT_QUEUE);
        result.expectedMessageCount(0);
        MockEndpoint mock = getMockEndpoint(ERROR_QUEUE);
        mock.expectedMessageCount(1);
        mock.expectedHeaderReceived(MESSAGE_INFO, "Handled exchange with NullPointerException");

        template.sendBody("direct:a", "Hello NPE");
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

    public void testHandledException() throws Exception {
        MockEndpoint result = getMockEndpoint(RESULT_QUEUE);
        result.expectedMessageCount(0);
        MockEndpoint mock = getMockEndpoint(ERROR_QUEUE);
        mock.expectedMessageCount(1);
        mock.expectedHeaderReceived(MESSAGE_INFO, "Handled exchange with NullPointerException");

        template.sendBody("direct:a", "Hello NPE");
        MockEndpoint.assertIsSatisfied(result, mock);
    }
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

        MockEndpoint.assertIsSatisfied(result, mock);
    }

    public void testHandledExceptionWithExpression() throws Exception {
        MockEndpoint result = getMockEndpoint(RESULT_QUEUE);
        result.expectedMessageCount(0);
        MockEndpoint mock = getMockEndpoint(ERROR_QUEUE);
        mock.expectedMessageCount(1);
        mock.expectedHeaderReceived(MESSAGE_INFO, "Handled exchange with IOException");

        template.sendBodyAndHeader("direct:a", "Hello IOE", "foo", "bar");
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

    public void testHandledExceptionWithExpression() throws Exception {
        MockEndpoint result = getMockEndpoint(RESULT_QUEUE);
        result.expectedMessageCount(0);
        MockEndpoint mock = getMockEndpoint(ERROR_QUEUE);
        mock.expectedMessageCount(1);
        mock.expectedHeaderReceived(MESSAGE_INFO, "Handled exchange with IOException");

        template.sendBodyAndHeader("direct:a", "Hello IOE", "foo", "bar");
        MockEndpoint.assertIsSatisfied(result, mock);
    }
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

        MockEndpoint.assertIsSatisfied(result, mock);
    }

    public void testUnhandledException() throws Exception {
        MockEndpoint result = getMockEndpoint(RESULT_QUEUE);
        result.expectedMessageCount(0);
        MockEndpoint mock = getMockEndpoint(ERROR_QUEUE);
        mock.expectedMessageCount(1);
        mock.expectedHeaderReceived(MESSAGE_INFO, "Handled exchange with IOException");
       
        try {
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

    public void testUnhandledException() throws Exception {
        MockEndpoint result = getMockEndpoint(RESULT_QUEUE);
        result.expectedMessageCount(0);
        MockEndpoint mock = getMockEndpoint(ERROR_QUEUE);
        mock.expectedMessageCount(1);
        mock.expectedHeaderReceived(MESSAGE_INFO, "Handled exchange with IOException");
       
        try {
            template.sendBodyAndHeader("direct:a", "Hello IOE", "foo", "something that does not match");
            fail("Should have thrown a IOException");
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

        assertExpectedCount(1);
    }

    protected void assertExpectedCount(int expectedCount) throws InterruptedException {
        MockEndpoint endpoint = getCamelContext().getEndpoint("mock:results", MockEndpoint.class);
        endpoint.expectedMessageCount(expectedCount);
        endpoint.assertIsSatisfied();
    }

}
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

    public void test() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        sendBody("direct:start", "<test>Hello World!</test>");
        assertTrue("Should have been handled", handled);
        mock.expectedMessageCount(0);
        mock.assertIsSatisfied();
    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
View Full Code Here

Examples of org.apache.camel.component.mock.MockEndpoint.expectedMessageCount()

    }

    @Test
    public void testSendA19() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:a19");
        mock.expectedMessageCount(1);
        mock.message(0).body().isInstanceOf(Message.class);

        String line1 = "MSH|^~\\&|MYSENDER|MYSENDERAPP|MYCLIENT|MYCLIENTAPP|200612211200||QRY^A19|1234|P|2.4";
        String line2 = "QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||";
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.