use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class BasicJmsProducerCase method testMultipleRequestorWithSession.
@Test
public void testMultipleRequestorWithSession() throws Exception {
ServiceList serviceList = new ServiceList(new Service[] { new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(getName()), new TimeInterval(1L, TimeUnit.SECONDS)), new StandaloneRequestor(activeMqBroker.getJmsConnection(), createProducer(getName()), new TimeInterval(1L, TimeUnit.SECONDS)) });
Loopback echo = createLoopback(activeMqBroker, getName());
try {
echo.start();
start(serviceList);
AdaptrisMessage msg1 = createMessage();
AdaptrisMessage msg2 = createMessage();
serviceList.doService(msg1);
serviceList.doService(msg2);
assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg1.getContent());
assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg2.getContent());
} finally {
stop(serviceList);
echo.stop();
}
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class BasicJmsProducerCase method testMultipleProducersWithSession.
@Test
public void testMultipleProducersWithSession() throws Exception {
JmsConsumerImpl consumer = createConsumer(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
ServiceList serviceList = new ServiceList(new Service[] { new StandaloneProducer(activeMqBroker.getJmsConnection(), createProducer(getName())), new StandaloneProducer(activeMqBroker.getJmsConnection(), createProducer(getName())) });
try {
start(standaloneConsumer, serviceList);
AdaptrisMessage msg1 = createMessage();
AdaptrisMessage msg2 = createMessage();
serviceList.doService(msg1);
serviceList.doService(msg2);
waitForMessages(jms, 4);
assertMessages(jms, 4);
} finally {
stop(serviceList, standaloneConsumer);
}
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class JmsProducerTest method testMultipleProducersWithSession.
@Test
public void testMultipleProducersWithSession() throws Exception {
String rfc6167 = "jms:queue:" + getName() + "";
JmsConsumerImpl consumer = createConsumer(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
ServiceList serviceList = new ServiceList(new Service[] { new StandaloneProducer(activeMqBroker.getJmsConnection(), createProducer(rfc6167)), new StandaloneProducer(activeMqBroker.getJmsConnection(), createProducer(rfc6167)) });
try {
start(standaloneConsumer, serviceList);
AdaptrisMessage msg1 = createMessage();
AdaptrisMessage msg2 = createMessage();
serviceList.doService(msg1);
serviceList.doService(msg2);
waitForMessages(jms, 4);
assertMessages(jms, 4);
} finally {
stop(serviceList, standaloneConsumer);
}
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class ServiceUtilTest method createConnectedServices.
private String createConnectedServices() throws Exception {
ServiceList nestedList = new ServiceList();
nestedList.add(new StandaloneProducer(new MockAllowsRetriesConnection(6), new NullMessageProducer()));
nestedList.add(new StatelessServiceWrapper(new StandaloneProducer()));
nestedList.add(new AddMetadataService(new ArrayList(Arrays.asList(new MetadataElement[] { new MetadataElement("key", "value") }))));
ServiceList list = new ServiceList();
list.add(nestedList);
list.add(new JdbcServiceList());
return DefaultMarshaller.getDefaultMarshaller().marshal(list);
}
use of com.adaptris.core.ServiceList in project interlok by adaptris.
the class AddTimestampMetadataServiceTest method testBug1552.
@Test
public void testBug1552() throws Exception {
AdaptrisMessage m = AdaptrisMessageFactory.getDefaultInstance().newMessage();
ServiceList sl = new ServiceList();
sl.addService(new AddTimestampMetadataService(DEFAULT_TS_FORMAT, KEY1, true));
sl.addService(new AddTimestampMetadataService("yyyy-MM-dd HH:mm:ssZ", KEY2, true));
execute(sl, m);
assertTrue(m.headersContainsKey(KEY1));
assertTrue(m.headersContainsKey(KEY2));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ");
String key2 = m.getMetadataValue(KEY2);
try {
sdf.parse(key2);
} catch (ParseException e) {
fail("Failed to parse " + key2);
}
}
Aggregations