use of com.adaptris.core.services.WaitService in project interlok by adaptris.
the class JmsTransactedWorkflowTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
Channel c = new Channel();
try {
c.setUniqueId(UUID.randomUUID().toString());
c.setConsumeConnection(configure(new JmsConnection()));
JmsTransactedWorkflow workflow = createWorkflow("Sample_Queue_1");
workflow.setUniqueId(UUID.randomUUID().toString());
workflow.setWaitPeriodAfterRollback(new TimeInterval(30L, TimeUnit.SECONDS.name()));
workflow.getServiceCollection().addService(new WaitService());
workflow.getServiceCollection().addService(new ThrowExceptionService(new ConfiguredException("Fail")));
workflow.setProducer(new FsProducer().withBaseDirectoryUrl("file:////path/to/directory"));
c.getWorkflowList().add(workflow);
} catch (CoreException e) {
throw new RuntimeException(e);
}
return c;
}
use of com.adaptris.core.services.WaitService in project interlok by adaptris.
the class SlowMessageNotificationTest method testNotification_SlowMessage_Success.
@Test
public void testNotification_SlowMessage_Success() throws Exception {
SlowMessageNotification notif = new SlowMessageNotification(getName(), new TimeInterval(100L, TimeUnit.MILLISECONDS), new TimeInterval(1L, TimeUnit.MINUTES));
StandardWorkflow workflow = createWorkflow(getName() + "_Workflow", notif);
workflow.getServiceCollection().add(new WaitService(new TimeInterval(1L, TimeUnit.SECONDS)));
Adapter adapter = createAdapter(getName(), workflow);
List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
BaseComponentMBean notifier = getFirstImpl(mBeans, InterceptorNotificationMBean.class);
assertNotNull(notifier);
ObjectName notifObjName = notifier.createObjectName();
SimpleNotificationListener listener = new SimpleNotificationListener();
try {
start(adapter);
register(mBeans);
mBeanServer.addNotificationListener(notifObjName, listener, null, null);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
workflow.onAdaptrisMessage(msg);
listener.waitForMessages(1);
assertEquals(1, listener.getNotifications().size());
Notification notification = listener.getNotifications().get(0);
Properties userData = (Properties) notification.getUserData();
assertEquals(msg.getUniqueId(), userData.getProperty(SlowMessageNotification.KEY_MESSAGE_ID));
// assertEquals("true", userData.getProperty(SlowMessageNotification.KEY_MESSAGE_SUCCESS));
} finally {
stop(adapter);
}
}
use of com.adaptris.core.services.WaitService in project interlok by adaptris.
the class MessagesInFlightTest method buildAdapter.
private Adapter buildAdapter(PoolingWorkflow workflow) throws Exception {
Adapter adapter = createAdapter(getName());
Channel channel = new Channel(getName());
workflow.setPoolSize(1);
workflow.setShutdownWaitTime(new TimeInterval(1L, TimeUnit.SECONDS));
workflow.addInterceptor(new InFlightWorkflowInterceptor(getName()));
workflow.getServiceCollection().add(new WaitService(new TimeInterval(5L, TimeUnit.SECONDS)));
channel.getWorkflowList().add(workflow);
adapter.getChannelList().add(channel);
return adapter;
}
use of com.adaptris.core.services.WaitService in project interlok by adaptris.
the class ServiceCollectionCase method testIndexOf.
@Test
public void testIndexOf() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
sc.addService(new NullService(UUID.randomUUID().toString()));
WaitService s = new WaitService(UUID.randomUUID().toString());
sc.addService(s);
sc.addService(new NullService(UUID.randomUUID().toString()));
assertEquals(1, sc.indexOf(s));
}
use of com.adaptris.core.services.WaitService in project interlok by adaptris.
the class ServiceCollectionCase method testGet.
@Test
public void testGet() throws Exception {
ServiceCollectionImp sc = createServiceCollection();
sc.addService(new NullService(UUID.randomUUID().toString()));
sc.addService(new WaitService(UUID.randomUUID().toString()));
sc.addService(new NullService(UUID.randomUUID().toString()));
assertEquals(WaitService.class, sc.get(1).getClass());
}
Aggregations