use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class RetryMessageErrorHandlerTest method testFilterStarted.
@Test
public void testFilterStarted() throws Exception {
Map<String, Workflow> workflows = new HashMap<>();
StandardWorkflow started = new StandardWorkflow();
workflows.put("1", new StandardWorkflow());
MockChannel mockChannel = LifecycleHelper.initAndStart(new MockChannel(started));
workflows.put("2", started);
Map<String, Workflow> filtered = RetryMessageErrorHandlerImp.filterStarted(workflows);
assertEquals(1, filtered.size());
for (Workflow w : workflows.values()) {
LifecycleHelper.stopAndClose(w);
}
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class QuartzCronPollerTest method testGeneratedQuartzId_NoDestination.
@Test
public void testGeneratedQuartzId_NoDestination() throws Exception {
QuartzCronPoller p1 = new QuartzCronPoller();
p1.setCronExpression("*/5 * * * * ?");
StandardWorkflow wf1 = createWorkflow(p1, new MockMessageProducer());
Channel channel = new MockChannel();
channel.getWorkflowList().add(wf1);
channel.prepare();
try {
channel.requestInit();
assertNotNull(p1.getName());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class QuartzCronPollerTest method testWithMessages_StandardThreadPool.
@Test
public void testWithMessages_StandardThreadPool() throws Exception {
MockMessageProducer mock1 = new MockMessageProducer();
MockMessageProducer mock2 = new MockMessageProducer();
StandardWorkflow wf1 = createWorkflow(new QuartzCronPoller("*/2 * * * * ?", false), mock1);
StandardWorkflow wf2 = createWorkflow(new QuartzCronPoller("0 00 00 31 * ?", false), mock2);
Channel channel = new MockChannel();
channel.getWorkflowList().add(wf1);
channel.getWorkflowList().add(wf2);
channel.prepare();
try {
channel.requestStart();
waitForMessages(mock1, 1);
} finally {
channel.requestClose();
}
assertTrue("No. Produced Messages >=1", mock1.getMessages().size() >= 1);
for (Iterator i = mock1.getMessages().iterator(); i.hasNext(); ) {
AdaptrisMessage msg = (AdaptrisMessage) i.next();
assertEquals("Payloads", PAYLOAD, msg.getContent());
}
assertEquals("No. Produced messages = 0", 0, mock2.getMessages().size());
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class QuartzCronPollerTest method testBug917.
@Test
public void testBug917() throws Exception {
QuartzCronPoller p1 = new QuartzCronPoller();
p1.setCronExpression("*/5 * * * * ?");
StandardWorkflow wf1 = createWorkflow(p1, new MockMessageProducer());
Channel channel = new MockChannel();
channel.getWorkflowList().add(wf1);
channel.prepare();
try {
channel.requestInit();
assertNotNull(p1.getName());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class QuartzCronPollerTest method testGeneratedQuartzId_hasQuartzId.
@Test
public void testGeneratedQuartzId_hasQuartzId() throws Exception {
QuartzCronPoller p1 = new QuartzCronPoller();
p1.setCronExpression("*/5 * * * * ?");
p1.setQuartzId("quartzId");
StandardWorkflow wf1 = createWorkflow(p1, new MockMessageProducer());
Channel channel = new MockChannel();
channel.getWorkflowList().add(wf1);
channel.prepare();
try {
channel.requestInit();
assertEquals("quartzId", p1.getName());
} finally {
channel.requestClose();
}
}
Aggregations