use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JmsConnectionErrorHandlerTest method testConnectionErrorHandlerWithJndi.
@Test
public void testConnectionErrorHandlerWithJndi() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
MockChannel channel = createChannel(activeMqBroker, activeMqBroker.getJndiPasConnection(new StandardJndiImplementation(), false, queueName, topicName), topicName, new JmsConnectionErrorHandler());
try {
channel.requestStart();
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
activeMqBroker.stop();
Thread.sleep(1000);
activeMqBroker.start();
waitForChannelToMatchState(StartedState.getInstance(), channel);
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
assertEquals(2, channel.getStartCount());
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiPasProducerCase method testProduceJndiOnlyObjectNotFound.
@Test
public void testProduceJndiOnlyObjectNotFound() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandardJndiImplementation sendVendorImp = createVendorImplementation();
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, true, queueName, topicName), new PasProducer().withTopic(this.getClass().getSimpleName()));
try {
start(standaloneProducer);
standaloneProducer.produce(createMessage(null));
fail("Expected ProduceException");
} catch (ProduceException expected) {
} finally {
stop(standaloneProducer);
}
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiPtpProducerCase method testProduceJndiOnlyObjectNotFound.
@Test
public void testProduceJndiOnlyObjectNotFound() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandardJndiImplementation sendVendorImp = createVendorImplementation();
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPtpConnection(sendVendorImp, true, queueName, topicName), new PtpProducer().withQueue((this.getClass().getSimpleName())));
try {
start(standaloneProducer);
standaloneProducer.produce(createMessage(null));
fail("Expected ProduceException");
} catch (ProduceException expected) {
} finally {
stop(standaloneProducer);
}
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiPtpProducerCase method testProduceAndConsumeUsingJndiOnly.
@Test
public void testProduceAndConsumeUsingJndiOnly() throws Exception {
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPtpConnection(recvVendorImp, true, queueName, topicName), new PtpConsumer().withQueue(queueName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPtpConnection(sendVendorImp, true, queueName, topicName), new PtpProducer().withQueue((queueName)));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms);
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiPtpProducerCase method testProduceAndConsume_ExtraConfig.
@Test
public void testProduceAndConsume_ExtraConfig() throws Exception {
SimpleFactoryConfiguration sfc = new SimpleFactoryConfiguration();
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("ClientID", "testProduceAndConsume_ExtraConfig"));
kvps.add(new KeyValuePair("UseCompression", "true"));
sfc.setProperties(kvps);
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
sendVendorImp.setExtraFactoryConfiguration(sfc);
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPtpConnection(recvVendorImp, false, queueName, topicName), new PtpConsumer().withQueue(queueName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPtpConnection(sendVendorImp, false, queueName, topicName), new PtpProducer().withQueue((queueName)));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms);
}
Aggregations