use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testBlobProduceAndConsumeWithFileMessageFactory.
@Test
public void testBlobProduceAndConsumeWithFileMessageFactory() throws Exception {
if (!ExternalResourcesHelper.isExternalServerAvailable()) {
log.debug("Blob Server not available; skipping test");
return;
}
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BlobMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
PtpProducer producer = new PtpProducer().withQueue((getName()));
producer.setMessageTranslator(new BlobMessageTranslator("blobUrl"));
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
execute(standaloneConsumer, standaloneProducer, addBlobUrlRef(createMessage(new FileBackedMessageFactory()), "blobUrl"), jms);
assertMessages(jms, 1, false);
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueProduceAndConsumeWrongType.
@Test
public void testQueueProduceAndConsumeWrongType() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BytesMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue((getName())));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicProduceAndConsume_DurableSubscriber_Legacy.
@Test
public void testTopicProduceAndConsume_DurableSubscriber_Legacy() throws Exception {
String subscriptionId = GUID.safeUUID();
String clientId = GUID.safeUUID();
PasConsumer consumer = new PasConsumer().withTopic(getName());
consumer.setSubscriptionId(subscriptionId);
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
JmsConnection conn = activeMqBroker.getJmsConnection(createVendorImpl(), true);
conn.setClientId(clientId);
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(conn, consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
// Start it once to get some durable Action.
start(standaloneConsumer);
stop(standaloneConsumer);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
int count = 10;
for (int i = 0; i < count; i++) {
ExampleServiceCase.execute(standaloneProducer, createMessage());
}
start(standaloneConsumer);
waitForMessages(jms, count);
assertMessages(jms, 10);
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class BasicActiveMqProducerTest method testBlobProduceConsume.
@Test
public void testBlobProduceConsume() throws Exception {
if (!ExternalResourcesHelper.isExternalServerAvailable()) {
log.debug("Blob Server not available; skipping test");
return;
}
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BlobMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
PtpProducer producer = new PtpProducer().withQueue((getName()));
producer.setMessageTranslator(new BlobMessageTranslator("blobUrl"));
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
execute(standaloneConsumer, standaloneProducer, addBlobUrlRef(EmbeddedActiveMq.createMessage(null), "blobUrl"), jms);
assertMessages(jms, 1, false);
}
use of com.adaptris.core.stubs.MockMessageListener in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicProduceAndConsumeWrongType.
@Test
public void testTopicProduceAndConsumeWrongType() throws Exception {
PasConsumer consumer = new PasConsumer().withTopic(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BytesMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
Aggregations