Package org.apache.camel.component.mock

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


    }

    @Test
    public void testScanFile() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMinimumMessageCount(2);

        FileOutputStream fos = new FileOutputStream(file);
        try {
            fos.write("Hello\n".getBytes());
            Thread.sleep(150);
View Full Code Here


    }

    @Test
    public void testScanRefreshedFile() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMinimumMessageCount(3);

        FileOutputStream fos = refreshFile(null);
        try {
            fos.write("Hello\n".getBytes());
            Thread.sleep(150);
View Full Code Here

    private static final transient Log LOG = LogFactory.getLog(TimerDrivenTimePatternConverterTest.class);
   
    //Timer test
    public void testTimerInvocation() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMinimumMessageCount(2);

        assertMockEndpointsSatisfied();
    }

    public void testTimerUsingStopWatch() throws Exception {
View Full Code Here

        assertMockEndpointsSatisfied();
    }

    public void testTimerUsingStopWatch() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMinimumMessageCount(2);

        StopWatch watch = new StopWatch();
        assertMockEndpointsSatisfied();
        long interval = watch.stop();
       
View Full Code Here

        // sporadic failure on slower machines.
        String state = (String) mbeanServer.getAttribute(on, "State");
        assertEquals("Should be started", org.apache.camel.ServiceStatus.Started.name(), state);
       
        // start and we should be done in at most 3 second
        mock.expectedMinimumMessageCount(3);
        mock.setResultWaitTime(3900);

        assertMockEndpointsSatisfied();
    }
View Full Code Here

    @Test
    public void testFTPConsumerAsyncStress() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        // give some time to run on slower boxes
        mock.setResultWaitTime(30000);
        mock.expectedMinimumMessageCount(50);

        assertMockEndpointsSatisfied();
    }

    @Override
View Full Code Here

        return context;
    }

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

        resultEndpoint.assertIsSatisfied();
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
View Full Code Here

    public void testShutdownNotDeferred() throws Exception {
        // give it 20 seconds to shutdown
        context.getShutdownStrategy().setTimeout(20);

        MockEndpoint bar = getMockEndpoint("mock:bar");
        bar.expectedMinimumMessageCount(1);

        template.sendBody("seda:foo", "A");
        template.sendBody("seda:foo", "B");
        template.sendBody("seda:foo", "C");
        template.sendBody("seda:foo", "D");
View Full Code Here

    public void testShutdownCompleteCurrentTaskOnly() throws Exception {
        // give it 20 seconds to shutdown
        context.getShutdownStrategy().setTimeout(20);

        MockEndpoint bar = getMockEndpoint("mock:bar");
        bar.expectedMinimumMessageCount(1);

        assertMockEndpointsSatisfied();

        // shutdown during processing
        context.stop();
View Full Code Here

        template.sendBodyAndHeader("file://target/deletefile", body, Exchange.FILE_NAME, "hello.txt");

        MockEndpoint mock = getMockEndpoint("mock:error");
        // it could potentially retry the file on the 2nd poll and then fail again
        // so it should be minimum message count
        mock.expectedMinimumMessageCount(1);

        mock.assertIsSatisfied();

        // give time to NOT delete file
        Thread.sleep(200);
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.