use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class StoredProcedureProducerTest method testStringPayloadParamIn.
@Test
public void testStringPayloadParamIn() throws Exception {
if (areTestsEnabled()) {
JdbcStoredProcedureProducer spp = new JdbcStoredProcedureProducer();
spp.setProcedureName(("one_in"));
JdbcStringPayloadParameter inParameter = new JdbcStringPayloadParameter();
inParameter.setName("xType");
inParameter.setType(ParameterValueType.VARCHAR);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("Sold");
InParameters inParameters = new InParameters();
inParameters.add(inParameter);
spp.setInParameters(inParameters);
StandaloneProducer producer = configureForTests(spp, true);
try {
start(producer);
producer.doService(msg);
} finally {
stop(producer);
}
}
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class StoredProcedureProducerTest method testOneMetadataParamOutAndOneResultSet.
@Test
public void testOneMetadataParamOutAndOneResultSet() throws Exception {
if (areTestsEnabled()) {
JdbcStoredProcedureProducer spp = new JdbcStoredProcedureProducer();
spp.setProcedureName(("one_resultset_one_out"));
spp.setResultSetTranslator(new FirstRowMetadataTranslator());
JdbcMetadataParameter outParameter = new JdbcMetadataParameter();
outParameter.setMetadataKey("completed");
outParameter.setName("completed");
outParameter.setType(ParameterValueType.INTEGER);
OutParameters outParameters = new OutParameters();
outParameters.add(outParameter);
spp.setOutParameters(outParameters);
AdaptrisMessage message = createMessage();
assertEquals(0, message.getMetadata().size());
StandaloneProducer producer = configureForTests(spp, true);
try {
start(producer);
producer.doService(message);
assertEquals(4, message.getMetadata().size());
assertEquals("1", message.getMetadataValue("completed"));
} finally {
stop(producer);
}
}
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class JmsAsyncProducerTest method testEmbeddedSuccessHandler.
@Test
public void testEmbeddedSuccessHandler() throws Exception {
JmsAsyncProducer producer = new JmsAsyncProducer();
producer.setEndpoint("jms:topic:myTopicName?priority=4");
AdaptrisMessage message = DefaultMessageFactory.getDefaultInstance().newMessage("Some message content");
StandaloneProducer standaloneProducer = new StandaloneProducer();
try {
standaloneProducer.setConnection(activeMqBroker.getJmsConnection());
standaloneProducer.setProducer(producer);
LifecycleHelper.initAndStart(standaloneProducer);
standaloneProducer.doService(message);
} finally {
LifecycleHelper.stopAndClose(standaloneProducer);
}
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class JmsConsumerTest method testQueueConsume.
@Test
public void testQueueConsume() throws Exception {
Assume.assumeTrue(JmsConfig.jmsTestsEnabled());
String rfc6167 = "jms:queue:" + getName();
JmsConsumer consumer = new JmsConsumer().withEndpoint(rfc6167);
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer producer = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
// INTERLOK-3329 For coverage so the prepare() warning is executed 2x
LifecycleHelper.prepare(standaloneConsumer);
LifecycleHelper.prepare(producer);
execute(standaloneConsumer, producer, createMessage(null), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class JmsConsumerTest method testTopicConsume.
@Test
public void testTopicConsume() throws Exception {
Assume.assumeTrue(JmsConfig.jmsTestsEnabled());
String rfc6167 = "jms:topic:" + getName();
JmsConsumer consumer = new JmsConsumer().withEndpoint(rfc6167);
;
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
Aggregations