Search in sources :

Example 66 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class ZipFileDataFormatTest method testZipToFileWithoutFileName.

@Test
public void testZipToFileWithoutFileName() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
    String[] files = TEST_DIR.list();
    assertTrue(files == null || files.length == 0);
    MockEndpoint mock = getMockEndpoint("mock:intercepted");
    mock.expectedMessageCount(1);
    template.sendBody("direct:zipToFile", TEXT);
    assertMockEndpointsSatisfied();
    // use builder to ensure the exchange is fully done before we check for file exists
    assertTrue("The exchange is not done in time.", notify.matches(5, TimeUnit.SECONDS));
    Exchange exchange = mock.getReceivedExchanges().get(0);
    File file = new File(TEST_DIR, exchange.getIn().getMessageId() + ".zip");
    assertTrue("The file should exist.", file.exists());
    assertArrayEquals("Get a wrong message content.", getZippedText(exchange.getIn().getMessageId()), getBytes(file));
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder) Exchange(org.apache.camel.Exchange) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) ZipFile(java.util.zip.ZipFile) File(java.io.File) Test(org.junit.Test)

Example 67 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class ZipkinTimerRouteScribe method testZipkinRoute.

@Test
public void testZipkinRoute() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).from("seda:timer").whenDone(1).create();
    template.sendBody("direct:start", "Hello Timer");
    assertTrue(notify.matches(30, TimeUnit.SECONDS));
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder) Test(org.junit.Test)

Example 68 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class ZipkinABCRouteTest method testZipkinRoute.

@Test
public void testZipkinRoute() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
    template.requestBody("direct:start", "Hello World");
    assertTrue(notify.matches(30, TimeUnit.SECONDS));
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder) Test(org.junit.Test)

Example 69 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class ZipkinABCRouteScribe method testZipkinRoute.

@Test
public void testZipkinRoute() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
    template.requestBody("direct:start", "Hello World");
    assertTrue(notify.matches(30, TimeUnit.SECONDS));
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder) Test(org.junit.Test)

Example 70 with NotifyBuilder

use of org.apache.camel.builder.NotifyBuilder in project camel by apache.

the class ZipkinMulticastRouteScribe method testZipkinRoute.

@Test
public void testZipkinRoute() throws Exception {
    NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
    template.requestBody("direct:start", "Hello World");
    assertTrue(notify.matches(30, TimeUnit.SECONDS));
}
Also used : NotifyBuilder(org.apache.camel.builder.NotifyBuilder) Test(org.junit.Test)

Aggregations

NotifyBuilder (org.apache.camel.builder.NotifyBuilder)109 Test (org.junit.Test)72 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)30 File (java.io.File)24 Exchange (org.apache.camel.Exchange)10 RouteBuilder (org.apache.camel.builder.RouteBuilder)9 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 HashSet (java.util.HashSet)4 MBeanServer (javax.management.MBeanServer)4 ObjectName (javax.management.ObjectName)4 Processor (org.apache.camel.Processor)4 StopWatch (org.apache.camel.util.StopWatch)4 ConnectException (java.net.ConnectException)3 ExecutorService (java.util.concurrent.ExecutorService)3 Ignore (org.junit.Ignore)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Future (java.util.concurrent.Future)2 ZipFile (java.util.zip.ZipFile)2