use of com.adaptris.core.jms.PtpProducer in project interlok by adaptris.
the class AdvancedActiveMqProducerTest method testQueueProduceAndConsumeWithRedeliveryPolicy.
@Test
public void testQueueProduceAndConsumeWithRedeliveryPolicy() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl(createRedelivery(), null)), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl(createRedelivery(), null)), new PtpProducer().withQueue((getName())));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testQueue_ProduceWhenConsumerStopped.
@Test
public void testQueue_ProduceWhenConsumerStopped() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandardWorkflow workflow = new StandardWorkflow();
MockMessageProducer producer = new MockMessageProducer();
workflow.setConsumer(consumer);
workflow.setProducer(producer);
Channel channel = createChannel(activeMqBroker.getJmsConnection(createVendorImpl()), workflow);
try {
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue((getName())));
channel.requestStart();
workflow.requestStop();
start(standaloneProducer);
AdaptrisMessage msg = createMessage(null);
standaloneProducer.produce(msg);
Thread.sleep(250);
assertEquals(0, producer.messageCount());
stop(standaloneProducer);
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.jms.PtpProducer 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.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqImplementationTest method testRfc6167_Basic.
@Test
public void testRfc6167_Basic() throws Exception {
StandaloneProducer producer = null;
try {
BasicActiveMqImplementation vendorImp = create();
PtpProducer ptp = new PtpProducer().withQueue((testName.getMethodName()));
producer = new StandaloneProducer(activeMqBroker.getJmsConnection(vendorImp), ptp);
start(producer);
// Send a message so that the session is correct.
producer.doService(AdaptrisMessageFactory.getDefaultInstance().newMessage("abcde"));
JmsDestination jmsDest = vendorImp.createDestination("jms:queue:myQueueName", ptp);
assertNotNull(jmsDest.getDestination());
assertTrue(javax.jms.Queue.class.isAssignableFrom(jmsDest.getDestination().getClass()));
assertNull(jmsDest.deliveryMode());
assertNull(jmsDest.getReplyToDestination());
assertNull(jmsDest.priority());
assertNull(jmsDest.timeToLive());
assertNull(jmsDest.subscriptionId());
assertFalse(jmsDest.noLocal());
} finally {
stop(producer);
}
}
use of com.adaptris.core.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqImplementationTest method testRfc6167_WithParams.
@Test
public void testRfc6167_WithParams() throws Exception {
StandaloneProducer producer = null;
try {
BasicActiveMqImplementation vendorImp = create();
PtpProducer ptp = new PtpProducer().withQueue((testName.getMethodName()));
producer = new StandaloneProducer(activeMqBroker.getJmsConnection(vendorImp), ptp);
start(producer);
// Send a message so that the session is correct.
producer.doService(AdaptrisMessageFactory.getDefaultInstance().newMessage("abcde"));
JmsDestination jmsDest = vendorImp.createDestination("jms:queue:MyQueueName?replyToName=StaticReplyTo&priority=1&deliveryMode=NON_PERSISTENT&timeToLive=1000", ptp);
assertNotNull(jmsDest.getDestination());
assertTrue(javax.jms.Queue.class.isAssignableFrom(jmsDest.getDestination().getClass()));
assertNotNull(jmsDest.getReplyToDestination());
assertTrue(javax.jms.Queue.class.isAssignableFrom(jmsDest.getReplyToDestination().getClass()));
assertNotNull(jmsDest.deliveryMode());
assertEquals("NON_PERSISTENT", jmsDest.deliveryMode());
assertNotNull(jmsDest.priority());
assertEquals(Integer.valueOf(1), jmsDest.priority());
assertNotNull(jmsDest.timeToLive());
assertEquals(Long.valueOf(1000), jmsDest.timeToLive());
assertNull(jmsDest.subscriptionId());
assertFalse(jmsDest.noLocal());
} finally {
stop(producer);
}
}
Aggregations