use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class ProgrammaticLookupTest method sendMessageToInbound.
@Test
public void sendMessageToInbound() throws InterruptedException {
ProducerTemplate inbound = producers.select(Uri.Literal.of("direct:inbound")).get();
MockEndpoint outbound = endpoints.select(MockEndpoint.class, Uri.Literal.of("mock:outbound")).get();
outbound.expectedMessageCount(1);
outbound.expectedBodiesReceived("test");
inbound.sendBody("test");
assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class ChronicleEngineConsumerTest method testMapEvents.
@Test
public void testMapEvents() throws Exception {
final String key = UUID.randomUUID().toString();
MockEndpoint mock = getMockEndpoint("mock:map-events");
mock.expectedMessageCount(1);
mock.expectedBodiesReceived("val");
mock.expectedHeaderReceived(ChronicleEngineConstants.PATH, "/my/path");
mock.expectedHeaderReceived(ChronicleEngineConstants.KEY, key);
Map<String, String> map = client().acquireMap("/my/path", String.class, String.class);
map.put(key, "val");
mock.assertIsSatisfied();
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class ChronicleEngineConsumerTest method testMapEventsFiltering.
@Test
public void testMapEventsFiltering() throws Exception {
final String key = UUID.randomUUID().toString();
MockEndpoint mock = getMockEndpoint("mock:map-events-filtering");
mock.expectedMessageCount(2);
Map<String, String> map = client().acquireMap("/my/path", String.class, String.class);
map.put(key, "val-1");
map.put(key, "val-2");
map.remove(key);
mock.assertIsSatisfied();
assertEquals(mock.getExchanges().get(0).getIn().getHeader(ChronicleEngineConstants.MAP_EVENT_TYPE), ChronicleEngineMapEventType.INSERT);
assertEquals(mock.getExchanges().get(0).getIn().getBody(String.class), "val-1");
assertEquals(mock.getExchanges().get(1).getIn().getHeader(ChronicleEngineConstants.MAP_EVENT_TYPE), ChronicleEngineMapEventType.REMOVE);
assertEquals(mock.getExchanges().get(1).getIn().getHeader(ChronicleEngineConstants.OLD_VALUE), "val-2");
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class ChronicleEngineConsumerTest method testTopicEvents.
@Test
public void testTopicEvents() throws Exception {
final String key = UUID.randomUUID().toString();
MockEndpoint mock = getMockEndpoint("mock:topic-events");
mock.expectedMessageCount(1);
mock.expectedBodiesReceived("val");
mock.expectedHeaderReceived(ChronicleEngineConstants.PATH, "/my/path");
Map<String, String> map = client().acquireMap("/my/path", String.class, String.class);
map.put(key, "val");
mock.assertIsSatisfied();
}
use of org.apache.camel.component.mock.MockEndpoint in project camel by apache.
the class ChronicleEngineConsumerTest method testTopologicalEvents.
@Test
public void testTopologicalEvents() throws Exception {
final String key = UUID.randomUUID().toString();
MockEndpoint mock = getMockEndpoint("mock:topological-events");
mock.expectedMessageCount(1);
mock.expectedBodiesReceived((String) null);
mock.expectedHeaderReceived(ChronicleEngineConstants.PATH, "/my/path");
mock.expectedHeaderReceived(ChronicleEngineConstants.TOPOLOGICAL_EVENT_FULL_NAME, "/my/path");
Map<String, String> map = client().acquireMap("/my/path", String.class, String.class);
map.put(key, "val");
mock.assertIsSatisfied();
}
Aggregations