use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class PoolingWorkflowTest method testMinIdle_Changes_MaxIdle.
@Test
public void testMinIdle_Changes_MaxIdle() throws Exception {
MockChannel channel = createChannel();
PoolingWorkflow wf = (PoolingWorkflow) channel.getWorkflowList().get(0);
wf.setPoolSize(1000);
wf.setMaxIdle(10);
wf.setMinIdle(100);
wf.setThreadKeepAlive(new TimeInterval(100L, TimeUnit.MILLISECONDS));
LifecycleHelper.init(channel);
assertEquals(100, wf.maxIdle());
LifecycleHelper.close(channel);
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class PoolingWorkflowTest method testFixedPoolsizeOnStart.
@Test
public void testFixedPoolsizeOnStart() throws Exception {
MockChannel channel = createChannel();
PoolingWorkflow wf = (PoolingWorkflow) channel.getWorkflowList().get(0);
wf.setMaxIdle(DEFAULT_MAX_POOLSIZE);
wf.setMinIdle(DEFAULT_MAX_POOLSIZE);
wf.setThreadKeepAlive(new TimeInterval(100L, TimeUnit.MILLISECONDS));
try {
start(channel);
Thread.sleep(200);
assertTrue("ObjectPool >= 10", wf.currentObjectPoolCount() >= 1);
assertTrue("ObjectPool idle >= 1", wf.currentlyIdleObjects() >= 1);
} finally {
stop(channel);
}
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class PoolingWorkflowTest method testRedmine1681.
@Test
public void testRedmine1681() throws Exception {
MockChannel channel = createChannel();
PoolingWorkflow wf = (PoolingWorkflow) channel.getWorkflowList().get(0);
MockMessageProducer meh = new MockMessageProducer();
MockMessageProducer prod = (MockMessageProducer) wf.getProducer();
wf.getServiceCollection().add(new XmlRoundTripService());
channel.setMessageErrorHandler(new StandardProcessingExceptionHandler(new ServiceList(new ArrayList<Service>(Arrays.asList(new Service[] { new StandaloneProducer(meh) })))));
try {
start(channel);
submitMessages(wf, 1);
waitForMessages(prod, 1);
assertEquals(0, meh.messageCount());
assertEquals(1, prod.messageCount());
} finally {
stop(channel);
}
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class ProduceExceptionHandlerTest method testRestartProduceExceptionHandler.
@Test
public void testRestartProduceExceptionHandler() throws Exception {
MockChannel channel = new MockChannel();
MyStandardWorkflow wf = new MyStandardWorkflow();
wf.setProducer(new FailingProducer());
wf.setProduceExceptionHandler(new RestartProduceExceptionHandler());
channel.getWorkflowList().add(wf);
start(channel);
wf.onAdaptrisMessage(AdaptrisMessageFactory.getDefaultInstance().newMessage());
Thread.sleep(1000);
assertEquals(1, channel.getStartCount());
assertEquals(2, wf.getStartCount());
}
use of com.adaptris.core.stubs.MockChannel in project interlok by adaptris.
the class ProduceExceptionHandlerTest method testNullProduceExceptionHandler.
@Test
public void testNullProduceExceptionHandler() throws Exception {
MockChannel channel = new MockChannel();
MyStandardWorkflow wf = new MyStandardWorkflow();
wf.setProducer(new FailingProducer());
wf.setProduceExceptionHandler(new NullProduceExceptionHandler());
channel.getWorkflowList().add(wf);
start(channel);
wf.onAdaptrisMessage(AdaptrisMessageFactory.getDefaultInstance().newMessage());
Thread.sleep(1000);
assertEquals(1, channel.getStartCount());
}
Aggregations