Package org.apache.camel.component.mock

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


    public void testSortTerm() throws Exception {
        Mailbox mailbox = Mailbox.get("bill@localhost");
        assertEquals(3, mailbox.size());

        // This one has search term *not* set
        MockEndpoint mockAsc = getMockEndpoint("mock:resultAscending");
        mockAsc.expectedBodiesReceived("Earlier date", "Later date");

        // This one has search term set
        MockEndpoint mockDesc = getMockEndpoint("mock:resultDescending");
        mockDesc.expectedBodiesReceived("Even later date", "Later date", "Earlier date");

        // This one has search term set
        MockEndpoint mockDescImap = getMockEndpoint("mock:resultDescendingImap");
        mockDescImap.expectedBodiesReceived("Even later date", "Later date", "Earlier date");

        assertMockEndpointsSatisfied();
    }
View Full Code Here


        return jndi;
    }

    @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

        assertMockEndpointsSatisfied();
    }

    @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

        assertMockEndpointsSatisfied();
    }

    @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

    private final ReentrantLock lock = new ReentrantLock();
    private Condition cond1 = lock.newCondition();
   
    @Test
    public void testRouteJpa() throws Exception {
        MockEndpoint mock1 = getMockEndpoint("mock:result1");
        mock1.expectedMessageCount(2);
        MockEndpoint mock2 = getMockEndpoint("mock:result2");
        mock2.expectedMessageCount(2);

        template.sendBody("jpa://" + VersionedItem.class.getName(), new VersionedItem("one"));
        template.sendBody("jpa://" + VersionedItem.class.getName(), new VersionedItem("two"));
        template.sendBody("jpa://" + VersionedItem.class.getName(), new VersionedItem("three"));
        template.sendBody("jpa://" + VersionedItem.class.getName(), new VersionedItem("four"));
View Full Code Here

    }

    @Test
    public void testPlainString() throws Exception {
        // START SNIPPET: e1
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("Bye World");

        // send plain hello world as String
        Object out = template.requestBody("mina2:tcp://127.0.0.1:" + getPort() + "?sync=true&codec=#hl7codec", "Hello World", String.class);

        assertMockEndpointsSatisfied();
View Full Code Here

        runChmodCheck("666", "rw-rw-rw-");
    }


    private void runChmodCheck(String routeSuffix, String expectedPermissions) throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:chmod" + routeSuffix);
        mock.expectedMessageCount(1);
        String testFileName = "chmod" + routeSuffix + ".txt";
        String fullTestFileName = TEST_DIRECTORY + testFileName;
        String testFileContent = "Writing file with chmod " + routeSuffix + " option at " + new Date();
        mock.expectedFileExists(fullTestFileName, testFileContent);

        template.sendBodyAndHeader("direct:write" + routeSuffix, testFileContent, Exchange.FILE_NAME, testFileName);

        File f = new File(fullTestFileName);
        Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(f.toPath(), LinkOption.NOFOLLOW_LINKS);
View Full Code Here

    /**
     * Write a file without chmod set, should work normally and not throw an exception for invalid chmod value
     * @throws Exception
     */
    public void testWriteNoChmod() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:noChmod");
        mock.expectedMessageCount(1);
        String testFileName = "noChmod.txt";
        String fullTestFileName = TEST_DIRECTORY + testFileName;
        String testFileContent = "Writing file with no chmod option at " + new Date();
        mock.expectedFileExists(fullTestFileName, testFileContent);
        template.sendBodyAndHeader("direct:writeNoChmod", testFileContent, Exchange.FILE_NAME, testFileName);
        assertMockEndpointsSatisfied();
    }
View Full Code Here

        };
    }

    @Test
    public void emptyAtStartupTest() throws Exception {
        MockEndpoint mockResultEndpoint = getMockEndpoint("mock:result");
       
        mockResultEndpoint.expectedMessageCount(0);

        mockResultEndpoint.assertIsSatisfied();
    }
View Full Code Here

    }


    @Test
    public void singleIssueTest() throws Exception {
        MockEndpoint mockResultEndpoint = getMockEndpoint("mock:result");

        MockJiraRestClient client = (MockJiraRestClient) factory.getClient();
        MockSearchRestClient restClient = (MockSearchRestClient) client.getSearchClient();
        BasicIssue issue1 = restClient.addIssue();

        mockResultEndpoint.expectedBodiesReceived(issue1);
       
        mockResultEndpoint.assertIsSatisfied();
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.component.mock.MockEndpoint

Copyright © 2018 www.massapicom. 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.