use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class CassandraComponentConsumerTest method testConsumeAll.
@Test
public void testConsumeAll() throws Exception {
if (!canTest()) {
return;
}
MockEndpoint mock = getMockEndpoint("mock:resultAll");
mock.expectedMinimumMessageCount(1);
mock.whenAnyExchangeReceived(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Object body = exchange.getIn().getBody();
assertTrue(body instanceof List);
}
});
mock.await(1, TimeUnit.SECONDS);
assertMockEndpointsSatisfied();
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class CassandraComponentConsumerTest method testConsumeOne.
@Test
public void testConsumeOne() throws Exception {
if (!canTest()) {
return;
}
MockEndpoint mock = getMockEndpoint("mock:resultOne");
mock.expectedMinimumMessageCount(1);
mock.whenAnyExchangeReceived(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Object body = exchange.getIn().getBody();
assertTrue(body instanceof Row);
}
});
mock.await(1, TimeUnit.SECONDS);
assertMockEndpointsSatisfied();
}
use of org.apache.camel.component.mock.MockEndpoint 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.apache.camel.component.mock.MockEndpoint 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.apache.camel.component.mock.MockEndpoint 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);
}
Aggregations