Search in sources :

Example 96 with MockEndpoint

use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.

the class FromFtpNotDownloadTest method testNotDownload.

@Test
public void testNotDownload() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);
    mock.message(0).body().isNull();
    mock.message(0).header(Exchange.FILE_NAME).isEqualTo("hello.txt");
    mock.assertIsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 97 with MockEndpoint

use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.

the class FromFtpPassiveModeTest method testFtpPassiveMode.

@Test
public void testFtpPassiveMode() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");
    mock.assertIsSatisfied();
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 98 with MockEndpoint

use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.

the class FromFtpPreMoveDeleteTest method testPreMoveDelete.

@Test
public void testPreMoveDelete() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedMessageCount(1);
    mock.expectedBodiesReceived("Hello World this file will be moved");
    mock.assertIsSatisfied();
    // and file should be deleted
    Thread.sleep(1000);
    File file = new File(FTP_ROOT_DIR + "/movefile/work/hello.txt");
    assertFalse("The file should have been deleted", file.exists());
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) File(java.io.File) Test(org.junit.Test)

Example 99 with MockEndpoint

use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.

the class FromFtpRemoteFileSortByIgnoreCaseExpressionTest method testSortFilesNoCaseReverse.

@Test
public void testSortFilesNoCaseReverse() throws Exception {
    context.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from(getFtpUrl() + "&sortBy=reverse:ignoreCase:file:name").to("mock:nocasereverse");
        }
    });
    context.start();
    MockEndpoint nocasereverse = getMockEndpoint("mock:nocasereverse");
    nocasereverse.expectedBodiesReceived("Hello Paris", "Hello London", "Hello Copenhagen");
    assertMockEndpointsSatisfied();
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 100 with MockEndpoint

use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.

the class FromFtpRemoteFileSortByNestedExpressionTest method testSortFiles.

@Test
public void testSortFiles() throws Exception {
    context.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from(getFtpUrl() + "&sortBy=file:ext;file:name").to("mock:result");
        }
    });
    context.start();
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello Dublin", "Hello London", "Hello Paris", "Hello Copenhagen");
    assertMockEndpointsSatisfied();
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Aggregations

MockEndpoint (org.apache.camel.component.mock.MockEndpoint)3393 Test (org.junit.Test)2016 Exchange (org.apache.camel.Exchange)506 RouteBuilder (org.apache.camel.builder.RouteBuilder)302 Processor (org.apache.camel.Processor)148 File (java.io.File)144 HashMap (java.util.HashMap)130 ObjectName (javax.management.ObjectName)90 MBeanServer (javax.management.MBeanServer)85 Message (org.apache.camel.Message)85 InputStream (java.io.InputStream)73 ArrayList (java.util.ArrayList)63 CamelExecutionException (org.apache.camel.CamelExecutionException)63 List (java.util.List)57 CamelContext (org.apache.camel.CamelContext)57 ProducerTemplate (org.apache.camel.ProducerTemplate)51 Tx (org.nhindirect.common.tx.model.Tx)49 ByteArrayInputStream (java.io.ByteArrayInputStream)47 Map (java.util.Map)43 RuntimeCamelException (org.apache.camel.RuntimeCamelException)38