use of com.adaptris.core.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqImplementationTest method testRfc6167_Invalid.
@Test
public void testRfc6167_Invalid() 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"));
try {
vendorImp.createDestination("hello:queue:myQueueName", ptp);
} catch (JMSException e) {
assertTrue(e.getMessage().startsWith("failed to parse"));
}
try {
vendorImp.createDestination(null, ptp);
} catch (JMSException e) {
assertTrue(e.getMessage().startsWith("failed to parse"));
}
} finally {
stop(producer);
}
}
use of com.adaptris.core.jms.PtpProducer 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.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueProduce_WithStaticReplyTo.
@Test
public void testQueueProduce_WithStaticReplyTo() throws Exception {
QueueLoopback echo = new QueueLoopback(activeMqBroker, getName());
try {
echo.start();
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue(getName()));
AdaptrisMessage msg = EmbeddedActiveMq.createMessage(null);
msg.addMetadata(JmsConstants.JMS_ASYNC_STATIC_REPLY_TO, getName() + "_reply");
ExampleServiceCase.execute(standaloneProducer, msg);
echo.waitFor(DEFAULT_TIMEOUT);
assertNotNull(echo.getLastMessage());
assertNotNull(echo.getLastMessage().getJMSReplyTo());
assertEquals("queue://" + getName() + "_reply", echo.getLastMessage().getJMSReplyTo().toString());
} finally {
echo.stop();
}
}
use of com.adaptris.core.jms.PtpProducer 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.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
JmsConnection connection = new JmsConnection();
PtpProducer producer = new PtpProducer();
producer.setQueue("queueName");
UrlVendorImplementation vendorImpl = createImpl();
vendorImpl.setBrokerUrl(BasicActiveMqImplementationTest.PRIMARY);
connection.setUserName("BrokerUsername");
connection.setPassword("BrokerPassword");
connection.setVendorImplementation(vendorImpl);
StandaloneProducer result = new StandaloneProducer();
result.setConnection(connection);
result.setProducer(producer);
return result;
}
Aggregations