use of com.adaptris.core.stubs.MockSkipProducerService in project interlok by adaptris.
the class ActiveMqJmsTransactedWorkflowTest method testWorkflow_SkipProducer.
@Test
public void testWorkflow_SkipProducer() throws Exception {
int msgCount = 10;
String destination = createSafeUniqueId(new Object());
Channel channel = createStartableChannel(activeMqBroker, true, "testWorkflow_SkipProducer", destination);
JmsTransactedWorkflow workflow = (JmsTransactedWorkflow) channel.getWorkflowList().get(0);
MockMessageProducer serviceProducer = new MockMessageProducer();
workflow.getServiceCollection().addAll(Arrays.asList(new Service[] { new StandaloneProducer(serviceProducer), new MockSkipProducerService() }));
MockMessageProducer workflowProducer = (MockMessageProducer) workflow.getProducer();
try {
channel.requestStart();
StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new PtpProducer().withQueue((destination)));
send(sender, msgCount);
waitForMessages(serviceProducer, msgCount);
assertEquals(msgCount, serviceProducer.messageCount());
assertEquals(0, workflowProducer.messageCount());
} finally {
channel.requestClose();
}
assertEquals(0, activeMqBroker.messagesOnQueue(destination));
}
use of com.adaptris.core.stubs.MockSkipProducerService in project interlok by adaptris.
the class MultiProducerWorkflowTest method testOnMessage_SkipProducer.
@Test
public void testOnMessage_SkipProducer() throws Exception {
MockMessageProducer mock1 = new MockMessageProducer();
MockMessageProducer mock2 = new MockMessageProducer();
MockMessageProducer workflowProducer = new MockMessageProducer();
MockMessageProducer serviceProducer = new MockMessageProducer();
MockChannel channel = createChannel(Arrays.asList(new AdaptrisMessageProducer[] { mock1, mock2 }), Arrays.asList(new Service[] { new StandaloneProducer(serviceProducer), new MockSkipProducerService() }));
try {
MultiProducerWorkflow workflow = (MultiProducerWorkflow) channel.getWorkflowList().get(0);
workflow.setProducer(workflowProducer);
workflow.setUseProcessedMessage(false);
channel.prepare();
channel.requestStart();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(ORIGINAL_PAYLOAD);
workflow.onAdaptrisMessage(msg);
assertEquals(1, mock1.messageCount());
assertEquals(1, mock2.messageCount());
assertEquals(1, serviceProducer.messageCount());
assertEquals(0, workflowProducer.messageCount());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.stubs.MockSkipProducerService in project interlok by adaptris.
the class PoolingWorkflowTest method testOnMessage_SkipProducer.
@Test
public void testOnMessage_SkipProducer() throws Exception {
StaticMockMessageProducer serviceProducer = new StaticMockMessageProducer();
serviceProducer.getMessages().clear();
MockChannel channel = createAndPrepareChannel(Arrays.asList(new Service[] { createService(), new StandaloneProducer(serviceProducer), new MockSkipProducerService() }));
try {
PoolingWorkflow workflow = (PoolingWorkflow) channel.getWorkflowList().get(0);
MockMessageProducer workflowProducer = (MockMessageProducer) workflow.getProducer();
start(channel);
submitMessages(workflow, 10);
waitForMessages(serviceProducer, 10);
// assertEquals(10, serviceProducer.messageCount());
assertEquals(0, workflowProducer.messageCount());
} finally {
stop(channel);
}
}
use of com.adaptris.core.stubs.MockSkipProducerService in project interlok by adaptris.
the class StandardWorkflowTest method testOnMessage_SkipProducer.
@Test
public void testOnMessage_SkipProducer() throws Exception {
MockMessageProducer producer = new MockMessageProducer();
MockMessageProducer serviceProducer = new MockMessageProducer();
MockChannel channel = createChannel(producer, Arrays.asList(new Service[] { new StandaloneProducer(serviceProducer), new MockSkipProducerService() }));
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(PAYLOAD_1);
StandardWorkflow workflow = (StandardWorkflow) channel.getWorkflowList().get(0);
try {
start(channel);
workflow.onAdaptrisMessage(msg);
assertEquals(1, serviceProducer.messageCount());
assertEquals(0, producer.messageCount());
} finally {
stop(channel);
}
}
use of com.adaptris.core.stubs.MockSkipProducerService in project interlok by adaptris.
the class ThreadContextWorkflowTest method testOnMessage_SkipProducer.
@Test
public void testOnMessage_SkipProducer() throws Exception {
MockMessageProducer producer = new MockMessageProducer();
StaticMockMessageProducer serviceProducer = new StaticMockMessageProducer();
serviceProducer.getMessages().clear();
MockChannel channel = createChannel(producer, Arrays.asList(new Service[] { new StandaloneProducer(serviceProducer), new MockSkipProducerService() }));
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(PAYLOAD_1);
ThreadContextWorkflow workflow = (ThreadContextWorkflow) channel.getWorkflowList().get(0);
try {
start(channel);
workflow.onAdaptrisMessage(msg);
assertEquals(1, serviceProducer.messageCount());
assertEquals(0, producer.messageCount());
} finally {
stop(channel);
}
}
Aggregations