use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class JmsHttpPostIssueTest method testJmsInOnlyHttpPostIssue.
@Test
public void testJmsInOnlyHttpPostIssue() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenCompleted(1).from("jms*").create();
template.sendBody("jms:queue:in", "Hello World");
assertTrue("Should complete the JMS route", notify.matchesMockWaitTime());
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class SpringTarFileDataFormatTest method testTarToFileWithoutFileName.
@Test
public void testTarToFileWithoutFileName() 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:tarToFile", TEXT);
assertMockEndpointsSatisfied();
// use builder to ensure the exchange is fully done before we check for file exists
assertTrue(notify.matches(5, TimeUnit.SECONDS));
Exchange exchange = mock.getReceivedExchanges().get(0);
File file = new File(TEST_DIR, exchange.getIn().getMessageId() + ".tar");
assertTrue(file.exists());
assertArrayEquals(getTaredText(exchange.getIn().getMessageId()), getBytes(file));
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class SpringTarFileDataFormatTest method testTarToFileWithFileName.
@Test
public void testTarToFileWithFileName() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
MockEndpoint mock = getMockEndpoint("mock:tarToFile");
mock.expectedMessageCount(1);
File file = new File(TEST_DIR, "poem.txt.tar");
assertFalse(file.exists());
template.sendBodyAndHeader("direct:tarToFile", TEXT, FILE_NAME, "poem.txt");
// just make sure the file is created
mock.assertIsSatisfied();
// use builder to ensure the exchange is fully done before we check for file exists
assertTrue(notify.matches(5, TimeUnit.SECONDS));
assertTrue(file.exists());
assertArrayEquals(getTaredText("poem.txt"), getBytes(file));
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class TarFileDataFormatTest method testTarToFileWithFileName.
@Test
public void testTarToFileWithFileName() throws Exception {
NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
MockEndpoint mock = getMockEndpoint("mock:tarToFile");
mock.expectedMessageCount(1);
File file = new File(TEST_DIR, "poem.txt.tar");
assertFalse(file.exists());
template.sendBodyAndHeader("direct:tarToFile", TEXT, FILE_NAME, "poem.txt");
// just make sure the file is created
mock.assertIsSatisfied();
// use builder to ensure the exchange is fully done before we check for file exists
assertTrue(notify.matches(5, TimeUnit.SECONDS));
assertTrue(file.exists());
assertTrue(ObjectHelper.equalByteArray(getTaredText("poem.txt"), getBytes(file)));
}
use of org.apache.camel.builder.NotifyBuilder in project camel by apache.
the class TarFileDataFormatTest method testTarToFileWithoutFileName.
@Test
public void testTarToFileWithoutFileName() 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:tarToFile", TEXT);
assertMockEndpointsSatisfied();
// use builder to ensure the exchange is fully done before we check for file exists
assertTrue(notify.matches(5, TimeUnit.SECONDS));
Exchange exchange = mock.getReceivedExchanges().get(0);
File file = new File(TEST_DIR, exchange.getIn().getMessageId() + ".tar");
assertTrue(file.exists());
assertTrue(ObjectHelper.equalByteArray(getTaredText(exchange.getIn().getMessageId()), getBytes(file)));
}
Aggregations