use of com.adaptris.core.stubs.MockMessageProducer in project interlok by adaptris.
the class BasicMessageSplitterServiceTest method testDoServiceWithoutCopyMetadata.
@Test
public void testDoServiceWithoutCopyMetadata() throws Exception {
MockMessageProducer producer = new MockMessageProducer();
MessageSplitterServiceImp service = createServiceImpl(new SimpleRegexpMessageSplitter("\\|"), producer);
AdaptrisMessage msg = createMessage(REGEXP_DATA);
((SimpleRegexpMessageSplitter) service.getSplitter()).setCopyMetadata(false);
ExampleServiceCase.execute(service, msg);
List<AdaptrisMessage> producedMessages = producer.getMessages();
assertTrue(producedMessages.size() == 4);
assertEquals("splitCount metadata", 4, Integer.parseInt(msg.getMetadataValue(MessageSplitterServiceImp.KEY_SPLIT_MESSAGE_COUNT)));
int count = 0;
for (AdaptrisMessage m : producedMessages) {
count++;
assertTrue(null == m.getMetadataValue(METADATA_KEY));
assertEquals(count, Integer.parseInt(m.getMetadataValue(KEY_CURRENT_SPLIT_MESSAGE_COUNT)));
}
}
use of com.adaptris.core.stubs.MockMessageProducer in project interlok by adaptris.
the class XpathDocumentCopierTest method setUp.
@Before
public void setUp() throws Exception {
producer = new MockMessageProducer();
service = createBasic(new XpathDocumentCopier(XPATH_DOCUMENT_COUNT));
service.setProducer(producer);
}
use of com.adaptris.core.stubs.MockMessageProducer in project interlok by adaptris.
the class XpathSplitterTest method setUp.
@Before
public void setUp() throws Exception {
producer = new MockMessageProducer();
service = createBasic(new XpathMessageSplitter(ENVELOPE_DOCUMENT, ENCODING_UTF8));
service.setProducer(producer);
}
use of com.adaptris.core.stubs.MockMessageProducer in project interlok by adaptris.
the class ExampleEventHandlerCase method doAssertions.
protected void doAssertions(T eh, int msgCount, Class expectedEventClass) throws Exception {
AdaptrisMarshaller cm = DefaultMarshaller.getDefaultMarshaller();
MockMessageProducer producer = getProducer(eh);
waitForMessages(producer, msgCount);
assertEquals("Should have " + msgCount + " produced message", msgCount, producer.getMessages().size());
for (Iterator i = producer.getMessages().iterator(); i.hasNext(); ) {
AdaptrisMessage m = (AdaptrisMessage) i.next();
Object o = cm.unmarshal(m.getContent());
assertEquals("Classname", expectedEventClass, o.getClass());
}
}
use of com.adaptris.core.stubs.MockMessageProducer in project interlok by adaptris.
the class FailedMessageRetrierCase method createWorkflow.
protected StandardWorkflow createWorkflow(String uniqueId) throws Exception {
AdaptrisMessageConsumer consumer = new MockMessageConsumer();
AdaptrisMessageProducer producer = new MockMessageProducer();
StandardWorkflow workflow = new StandardWorkflow();
workflow.setUniqueId(uniqueId);
workflow.setConsumer(consumer);
workflow.setProducer(producer);
Channel channel = new MockChannel();
channel.setUniqueId(null);
channel.getWorkflowList().add(workflow);
channel.prepare();
return workflow;
}
Aggregations