use of org.junit.Test in project camel by apache.
the class CassandraAggregationRepositoryTest method testGetNotExists.
@Test
public void testGetNotExists() {
if (!canTest()) {
return;
}
// Given
String key = "Get_NotExists";
assertFalse(exists(key));
// When
Exchange exchange2 = aggregationRepository.get(camelContext, key);
// Then
assertNull(exchange2);
}
use of org.junit.Test in project camel by apache.
the class MarshalDomainObjectTest method testMarshalDomainObjectTwice.
@Test
public void testMarshalDomainObjectTwice() throws Exception {
// some platform cannot test using Castor as it uses a SUN dependent Xerces
if (isJavaVendor("IBM")) {
return;
}
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(2);
PurchaseOrder order = new PurchaseOrder();
order.setName("Tiger");
order.setAmount(1);
order.setPrice(99.95);
template.sendBody("direct:in", order);
template.sendBody("direct:in", order);
mock.assertIsSatisfied();
String body1 = mock.getExchanges().get(0).getIn().getBody(String.class);
String body2 = mock.getExchanges().get(1).getIn().getBody(String.class);
assertEquals("The body should marshalled to the same", body1, body2);
}
use of org.junit.Test in project camel by apache.
the class SpringMarshalDomainObjectTest method testMarshalDomainObject.
@Test
public void testMarshalDomainObject() throws Exception {
// some platform cannot test using Castor as it uses a SUN dependent Xerces
if (isJavaVendor("IBM")) {
return;
}
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
PurchaseOrder order = new PurchaseOrder();
order.setName("Tiger");
order.setAmount(1);
order.setPrice(99.95);
template.sendBody("direct:in", order);
mock.assertIsSatisfied();
}
use of org.junit.Test in project camel by apache.
the class CassandraAggregationTest method testAggregationRoute.
@Test
public void testAggregationRoute() throws Exception {
if (!canTest()) {
return;
}
// Given
MockEndpoint mockOutput = getMockEndpoint("mock:output");
mockOutput.expectedMessageCount(2);
mockOutput.expectedBodiesReceivedInAnyOrder("A,C,E", "B,D");
// When
send("1", "A");
send("2", "B");
send("1", "C");
send("2", "D");
send("1", "E");
// Then
mockOutput.assertIsSatisfied(4000L);
}
use of org.junit.Test in project camel by apache.
the class CacheProducerTest method testUpdatingDataInCacheDoesFailOnEmptyBody.
@Test
public void testUpdatingDataInCacheDoesFailOnEmptyBody() throws Exception {
context.addRoutes(new RouteBuilder() {
public void configure() {
onException(CacheException.class).handled(true).to("log:LOGGER").to("mock:CacheProducerTest.cacheException");
from("direct:a").setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_UPDATE)).setHeader(CacheConstants.CACHE_KEY, constant("Ralph_Waldo_Emerson")).to("cache://TestCache1");
}
});
cacheExceptionEndpoint.expectedMessageCount(1);
context.start();
log.debug("------------Beginning CacheProducer Update Does Fail On Empty Body Test---------------");
sendEmptyBody();
cacheExceptionEndpoint.assertIsSatisfied();
}
Aggregations