Examples of expectedMessageCount()


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

    }

    @Test
    public void testXmlArraysToJson() throws Exception {
        MockEndpoint mockJSON = getMockEndpoint("mock:jsonInlineOptionsArray");
        mockJSON.expectedMessageCount(1);
        mockJSON.message(0).body().isInstanceOf(byte[].class);

        Object json = template.requestBody("direct:marshalInlineOptionsArray", "<ar><el>1</el><el>2</el><el>3</el><el>4</el></ar>");
        String jsonString = context.getTypeConverter().convertTo(String.class, json);
        JSONArray array = (JSONArray) JSONSerializer.toJSON(jsonString);
View Full Code Here

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

    @Test
    public void testMalformedXML() throws Exception {
        String in = "<noRoot>abc</noRoot><noRoot>abc</noRoot>";

        MockEndpoint mockJSON = getMockEndpoint("mock:json");
        mockJSON.expectedMessageCount(0);

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

        try {
View Full Code Here

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

        MockEndpoint mockJSON = getMockEndpoint("mock:json");
        mockJSON.expectedMessageCount(0);

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

        try {
            template.requestBody("direct:marshal", in);
            fail("Exception expected");
        } catch (CamelExecutionException e) {
View Full Code Here

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

    @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 {
View Full Code Here

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

        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) {
View Full Code Here

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

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

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

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

        try {
View Full Code Here

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

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

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

        try {
            template.requestBody("direct:unmarshal", in);
            fail("Exception expected");
        } catch (CamelExecutionException e) {
View Full Code Here

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

    private void doSendMessages(int files, int poolSize, final String endpointURI, String resourceURI) throws Exception {
        MockEndpoint mockJSON = getMockEndpoint("mock:json");
        MockEndpoint mockXML = getMockEndpoint("mock:xml");
        mockJSON.expectedMessageCount(files);
        mockXML.expectedMessageCount(files);

        InputStream inStream = getClass().getClassLoader().getResourceAsStream(resourceURI);
        final String in = context.getTypeConverter().convertTo(String.class, inStream);

        ExecutorService executor = Executors.newFixedThreadPool(poolSize);
View Full Code Here

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

        when(client.reserve(anyInt()))
                .thenThrow(new BeanstalkException("test"))
                .thenReturn(jobMock);

        MockEndpoint result = getMockEndpoint("mock:result");
        result.expectedMessageCount(1);
        result.expectedBodiesReceived(testMessage);
        result.expectedHeaderReceived(Headers.JOB_ID, jobId);
        result.message(0).header(Headers.JOB_ID).isEqualTo(jobId);
        result.assertIsSatisfied(100);
View Full Code Here

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

        when(client.reserve(anyInt()))
                .thenReturn(jobMock)
                .thenReturn(null);

        MockEndpoint result = getMockEndpoint("mock:result");
        result.expectedMessageCount(1);
        result.expectedBodiesReceived(testMessage);
        result.expectedHeaderReceived(Headers.JOB_ID, jobId);
        result.message(0).header(Headers.JOB_ID).isEqualTo(jobId);
        result.assertIsSatisfied(100);
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.