use of com.adaptris.core.Event in project interlok by adaptris.
the class ExampleEventHandlerCase method testSendMultipleEvent.
@Test
public void testSendMultipleEvent() throws Exception {
int count = 10;
Event e = EventFactory.create(AdapterCloseEvent.class);
T eh = applyConfiguration(newEventHandler(getName()));
try {
eh.requestStart();
for (int i = 0; i < count; i++) {
eh.send(e);
}
doAssertions(eh, count, e.getClass());
} finally {
eh.requestClose();
}
}
use of com.adaptris.core.Event in project interlok by adaptris.
the class ExampleEventHandlerCase method testSendEvent_WithProperties.
@Test
public void testSendEvent_WithProperties() throws Exception {
Event e = EventFactory.create(AdapterCloseEvent.class);
T eh = applyConfiguration(newEventHandler(getName()));
Map<String, String> properties = MetadataCollection.asMap(new MetadataCollection(new MetadataElement("hello", "world")));
try {
eh.requestStart();
eh.send(e, properties);
doAssertions(eh, 1, e.getClass());
MockMessageProducer p = getProducer(eh);
AdaptrisMessage msg = p.getMessages().get(0);
assertTrue(msg.headersContainsKey("hello"));
assertEquals("world", msg.getMetadataValue("hello"));
} finally {
eh.requestClose();
}
}
use of com.adaptris.core.Event in project interlok by adaptris.
the class ExampleEventHandlerCase method testSendEvent.
@Test
public void testSendEvent() throws Exception {
Event e = EventFactory.create(AdapterCloseEvent.class);
T eh = applyConfiguration(newEventHandler(getName()));
try {
eh.requestStart();
eh.send(e);
doAssertions(eh, 1, e.getClass());
} finally {
eh.requestClose();
}
}
Aggregations