use of org.apache.camel.cdi.pojo.EventPayloadString in project camel by apache.
the class EventEndpointTest method sendMessagesToProducers.
@Test
public void sendMessagesToProducers() {
produceObject.sendBody("string");
EventPayload foo = new EventPayloadString("foo");
produceStringPayload.sendBody(foo);
produceObject.sendBody(1234);
produceString.sendBody("test");
EventPayload<Integer> bar = new EventPayloadInteger(2);
produceIntegerPayload.sendBody(bar);
EventPayload<Integer> baz = new EventPayloadInteger(12);
produceIntegerPayload.sendBody(baz);
produceFooQualifier.sendBody(456L);
produceBarQualifier.sendBody(495L);
produceObject.sendBody(777L);
assertThat(observer.getObjectEvents(), contains("string", foo, 1234, "test", bar, baz, 456L, 495L, 777L));
// assertThat(observer.getStringEvents(), contains("string", "test"));
assertThat(observer.getStringPayloadEvents(), contains(foo));
assertThat(observer.getIntegerPayloadEvents(), contains(bar, baz));
assertThat(observer.getDefaultQualifierEvents(), contains("string", foo, 1234, "test", bar, baz, 777L));
assertThat(observer.getFooQualifierEvents(), contains(456L));
assertThat(observer.getBarQualifierEvents(), contains(495L));
}
use of org.apache.camel.cdi.pojo.EventPayloadString in project camel by apache.
the class EventEndpointTest method sendEventsToConsumers.
@Test
public void sendEventsToConsumers() throws InterruptedException {
consumeObject.expectedMessageCount(8);
consumeObject.expectedBodiesReceived(1234, new EventPayloadString("foo"), new EventPayloadString("bar"), "test", new EventPayloadInteger(1), new EventPayloadInteger(2), 123L, 987L);
consumeString.expectedMessageCount(1);
consumeString.expectedBodiesReceived("test");
consumeStringPayload.expectedMessageCount(2);
consumeStringPayload.expectedBodiesReceived(new EventPayloadString("foo"), new EventPayloadString("bar"));
consumeIntegerPayload.expectedMessageCount(2);
consumeIntegerPayload.expectedBodiesReceived(new EventPayloadInteger(1), new EventPayloadInteger(2));
consumeFooQualifier.expectedMessageCount(1);
consumeFooQualifier.expectedBodiesReceived(123L);
consumeBarQualifier.expectedMessageCount(1);
consumeBarQualifier.expectedBodiesReceived(987L);
objectEvent.select(Integer.class).fire(1234);
objectEvent.select(EventPayloadString.class).fire(new EventPayloadString("foo"));
stringPayloadEvent.select(new BarQualifier.Literal()).fire(new EventPayloadString("bar"));
objectEvent.select(String.class).fire("test");
integerPayloadEvent.fire(new EventPayloadInteger(1));
integerPayloadEvent.fire(new EventPayloadInteger(2));
objectEvent.select(Long.class, new FooQualifier.Literal()).fire(123L);
objectEvent.select(Long.class, new BarQualifier.Literal()).fire(987L);
//assertIsSatisfied(2L, TimeUnit.SECONDS, consumeObject, consumeString, consumeStringPayload, consumeIntegerPayload, consumeFooQualifier, consumeBarQualifier);
assertIsSatisfied(2L, TimeUnit.SECONDS, consumeObject, consumeString, consumeFooQualifier, consumeBarQualifier);
}
Aggregations