use of com.adaptris.core.jms.JmsProducer in project interlok by adaptris.
the class ActiveMqJmsPollingConsumerTest method testQueue_ProduceConsume.
@Test
public void testQueue_ProduceConsume() throws Exception {
int msgCount = 5;
String rfc6167 = "jms:queue:" + testName.getMethodName();
final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
final StandaloneConsumer receiver = createStandaloneConsumer(activeMqBroker, testName.getMethodName(), rfc6167);
try {
MockMessageListener jms = new MockMessageListener();
receiver.registerAdaptrisMessageListener(jms);
// INTERLOK-3329 For coverage so the prepare() warning is executed 2x
LifecycleHelper.prepare(sender);
LifecycleHelper.prepare(receiver);
start(receiver);
start(sender);
for (int i = 0; i < msgCount; i++) {
sender.doService(createMessage());
}
waitForMessages(jms, msgCount);
assertMessages(jms, msgCount);
} finally {
shutdownQuietly(sender, receiver);
}
}
use of com.adaptris.core.jms.JmsProducer in project interlok by adaptris.
the class ActiveMqJmsSyncConsumerTest method testQueue_ProduceConsume.
@Test
public void testQueue_ProduceConsume() throws Exception {
int msgCount = 5;
String rfc6167 = "jms:queue:" + testName.getMethodName();
final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
final StandaloneConsumer receiver = createStandaloneConsumer(activeMqBroker, testName.getMethodName(), rfc6167);
try {
MockMessageListener jms = new MockMessageListener();
receiver.registerAdaptrisMessageListener(jms);
// INTERLOK-3329 For coverage so the prepare() warning is executed 2x
LifecycleHelper.prepare(sender);
LifecycleHelper.prepare(receiver);
start(receiver);
start(sender);
for (int i = 0; i < msgCount; i++) {
sender.doService(createMessage());
}
waitForMessages(jms, msgCount);
assertMessages(jms, msgCount);
} finally {
shutdownQuietly(sender, receiver);
}
}
use of com.adaptris.core.jms.JmsProducer in project interlok by adaptris.
the class SharedComponentListTest method createAdapter.
private Adapter createAdapter() throws CoreException, PasswordException {
Adapter adapter = new Adapter();
adapter.setUniqueId("upbeat_liskov");
JmsConnection jmsConnection = createPtpConnection("jms-connection");
adapter.getSharedComponents().addConnection(jmsConnection);
ServiceList serviceList = new ServiceList();
serviceList.setUniqueId("shared-service-list");
serviceList.add(new LogMessageService("log-message-service"));
adapter.getSharedComponents().addService(serviceList);
StandardWorkflow wf1 = new StandardWorkflow();
wf1.setUniqueId("reverent-edison");
wf1.setConsumer(new FsConsumer().withBaseDirectoryUrl("in-directory"));
wf1.setProducer(new FsProducer().withBaseDirectoryUrl("out-directory"));
wf1.getServiceCollection().add(new SharedService("shared-service-list"));
StandardWorkflow wf = new StandardWorkflow();
wf.setUniqueId("pedantic_brown");
wf.setConsumer(new JmsConsumer().withEndpoint("jms:queue:SampleQueue1"));
wf.setProducer(new NullMessageProducer());
wf.getServiceCollection().add(new StandaloneProducer(new SharedConnection("jms-connection"), new JmsProducer().withEndpoint("jms:topic:MyTopicName")));
Channel channel = new Channel();
channel.setUniqueId("quirky_shannon");
channel.setConsumeConnection(new SharedConnection("jms-connection"));
channel.getWorkflowList().add(wf);
channel.getWorkflowList().add(wf1);
adapter.getChannelList().add(channel);
return adapter;
}
use of com.adaptris.core.jms.JmsProducer in project interlok by adaptris.
the class ActiveMqJmsPollingConsumerTest method testTopic_ProduceConsume.
@Test
public void testTopic_ProduceConsume() throws Exception {
int msgCount = 5;
String rfc6167 = "jms:topic:" + testName.getMethodName() + "?subscriptionId=" + testName.getMethodName();
final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
Sometime poller = new Sometime();
JmsPollingConsumer consumer = createConsumer(activeMqBroker, testName.getMethodName(), rfc6167, poller);
final StandaloneConsumer receiver = new StandaloneConsumer(consumer);
try {
MockMessageListener jms = new MockMessageListener();
receiver.registerAdaptrisMessageListener(jms);
startAndStop(receiver);
start(receiver);
start(sender);
for (int i = 0; i < msgCount; i++) {
sender.doService(createMessage());
}
waitForMessages(jms, msgCount);
assertMessages(jms, msgCount);
} finally {
shutdownQuietly(sender, receiver);
}
}
use of com.adaptris.core.jms.JmsProducer in project interlok by adaptris.
the class ActiveMqJmsSyncConsumerTest method testTopic_ProduceConsume.
@Test
public void testTopic_ProduceConsume() throws Exception {
int msgCount = 5;
String rfc6167 = "jms:topic:" + testName.getMethodName() + "?subscriptionId=" + testName.getMethodName();
final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
Sometime poller = new Sometime();
JmsSyncConsumer consumer = createConsumer(testName.getMethodName(), rfc6167, poller);
final StandaloneConsumer receiver = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer);
try {
MockMessageListener jms = new MockMessageListener();
receiver.registerAdaptrisMessageListener(jms);
startAndStop(receiver);
start(receiver);
start(sender);
for (int i = 0; i < msgCount; i++) {
sender.doService(createMessage());
}
waitForMessages(jms, msgCount);
assertMessages(jms, msgCount);
} finally {
shutdownQuietly(sender, receiver);
}
}
Aggregations