Package org.apache.camel.component.mock

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


    public void testForwardingAMessageAcrossJMSKeepingCustomJMSHeaders() throws Exception {
        MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);

        resultEndpoint.expectedBodiesReceived(expectedBody);
        AssertionClause firstMessageExpectations = resultEndpoint.message(0);
        firstMessageExpectations.header("cheese").isEqualTo(123);
        firstMessageExpectations.header("JMSReplyTo").isEqualTo(replyQueue);
        firstMessageExpectations.header("JMSCorrelationID").isEqualTo(correlationID);
        firstMessageExpectations.header("JMSType").isEqualTo(messageType);
View Full Code Here


    @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||";

        StringBuilder in = new StringBuilder();
View Full Code Here

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

        String line1 = "MSH|^~\\&|MYSENDER|MYSENDERAPP|MYCLIENT|MYCLIENTAPP|200612211200||ADT^A01|123|P|2.4";
        String line2 = "PID|||123456||Doe^John";

        StringBuilder in = new StringBuilder();
View Full Code Here

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

        String line1 = "MSH|^~\\&|MYSENDER|MYSENDERAPP|MYCLIENT|MYCLIENTAPP|200612211200||ADT^A02|1234|P|2.4";
        String line2 = "PID|||123456||Doe^John";

        StringBuilder in = new StringBuilder();
View Full Code Here

        InputStream inStream = getClass().getResourceAsStream("testMessage1.xml");
        String in = context.getTypeConverter().convertTo(String.class, inStream);

        MockEndpoint mockJSON = getMockEndpoint("mock:json");
        mockJSON.expectedMessageCount(1);
        mockJSON.message(0).body().isInstanceOf(byte[].class);

        MockEndpoint mockXML = getMockEndpoint("mock:xml");
        mockXML.expectedMessageCount(1);
        mockXML.message(0).body().isInstanceOf(String.class);
View Full Code Here

        mockJSON.expectedMessageCount(1);
        mockJSON.message(0).body().isInstanceOf(byte[].class);

        MockEndpoint mockXML = getMockEndpoint("mock:xml");
        mockXML.expectedMessageCount(1);
        mockXML.message(0).body().isInstanceOf(String.class);

        Object json = template.requestBody("direct:marshal", in);
        String jsonString = context.getTypeConverter().convertTo(String.class, json);
        JSONObject obj = (JSONObject) JSONSerializer.toJSON(jsonString);
        assertEquals("JSONObject doesn't contain 7 keys", 7, obj.entrySet().size());
View Full Code Here

        String in = context.getTypeConverter().convertTo(String.class, inStream);
        JSON json = JSONSerializer.toJSON(in);

        MockEndpoint mockXML = getMockEndpoint("mock:xml");
        mockXML.expectedMessageCount(1);
        mockXML.message(0).body().isInstanceOf(String.class);

        Object marshalled = template.requestBody("direct:unmarshal", json);
        Document document = context.getTypeConverter().convertTo(Document.class, marshalled);
        assertEquals("The XML document has an unexpected root node", "o", document.getDocumentElement().getLocalName());
View Full Code Here

        InputStream inStream = getClass().getResourceAsStream("testMessage1.xml");
        String in = context.getTypeConverter().convertTo(String.class, inStream);

        MockEndpoint mockJSON = getMockEndpoint("mock:jsonInline");
        mockJSON.expectedMessageCount(1);
        mockJSON.message(0).body().isInstanceOf(byte[].class);

        MockEndpoint mockXML = getMockEndpoint("mock:xmlInline");
        mockXML.expectedMessageCount(1);
        mockXML.message(0).body().isInstanceOf(String.class);
View Full Code Here

        mockJSON.expectedMessageCount(1);
        mockJSON.message(0).body().isInstanceOf(byte[].class);

        MockEndpoint mockXML = getMockEndpoint("mock:xmlInline");
        mockXML.expectedMessageCount(1);
        mockXML.message(0).body().isInstanceOf(String.class);

        Object json = template.requestBody("direct:marshalInline", in);
        String jsonString = context.getTypeConverter().convertTo(String.class, json);
        JSONObject obj = (JSONObject) JSONSerializer.toJSON(jsonString);
        assertEquals("JSONObject doesn't contain 7 keys", 7, obj.entrySet().size());
View Full Code Here

        InputStream inStream = getClass().getResourceAsStream("testMessage2-namespaces.xml");
        String in = context.getTypeConverter().convertTo(String.class, inStream);

        MockEndpoint mockJSON = getMockEndpoint("mock:jsonInlineOptions");
        mockJSON.expectedMessageCount(1);
        mockJSON.message(0).body().isInstanceOf(byte[].class);

        Object json = template.requestBody("direct:marshalInlineOptions", in);
        String jsonString = context.getTypeConverter().convertTo(String.class, json);
        JSONObject obj = (JSONObject) JSONSerializer.toJSON(jsonString);
        assertEquals("JSON must contain 1 top-level element", 1, obj.entrySet().size());
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.