use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiImplementationCase method testInitialiseWithCredentials.
@Test
public void testInitialiseWithCredentials() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
PasProducer producer = new PasProducer().withTopic(topicName);
;
StandardJndiImplementation jv = createVendorImplementation();
JmsConnection c = activeMqBroker.getJndiPasConnection(jv, false, queueName, topicName);
jv.getJndiParams().addKeyValuePair(new KeyValuePair("UserName", RequiresCredentialsBroker.DEFAULT_USERNAME));
jv.getJndiParams().addKeyValuePair(new KeyValuePair("Password", RequiresCredentialsBroker.DEFAULT_PASSWORD));
StandaloneProducer standaloneProducer = new StandaloneProducer(c, producer);
try {
LifecycleHelper.init(standaloneProducer);
} finally {
LifecycleHelper.close(standaloneProducer);
}
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiImplementationCase method testInitialiseWithEncryptedPasswordNotSupported.
@Test
public void testInitialiseWithEncryptedPasswordNotSupported() throws Exception {
RequiresCredentialsBroker broker = new RequiresCredentialsBroker();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
PasProducer producer = new PasProducer().withTopic(queueName);
StandardJndiImplementation jv = createVendorImplementation();
JmsConnection c = broker.getJndiPasConnection(jv, false, queueName, topicName);
jv.getJndiParams().addKeyValuePair(new KeyValuePair("UserName", RequiresCredentialsBroker.DEFAULT_USERNAME));
jv.getJndiParams().addKeyValuePair(new KeyValuePair("Password", Password.encode(RequiresCredentialsBroker.DEFAULT_PASSWORD, Password.PORTABLE_PASSWORD)));
StandaloneProducer standaloneProducer = new StandaloneProducer(c, producer);
try {
broker.start();
LifecycleHelper.init(standaloneProducer);
fail("Encrypted password should not be supported, as not explicitly configured");
} catch (Exception e) {
// expected
} finally {
broker.destroy();
}
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiImplementationCase method testInitialiseWithEncryptedPassword_viaEncodedPasswordKeys.
@Test
public void testInitialiseWithEncryptedPassword_viaEncodedPasswordKeys() throws Exception {
RequiresCredentialsBroker broker = new RequiresCredentialsBroker();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
PasProducer producer = new PasProducer().withTopic(queueName);
StandardJndiImplementation jv = createVendorImplementation();
JmsConnection c = broker.getJndiPasConnection(jv, false, queueName, topicName);
jv.getJndiParams().addKeyValuePair(new KeyValuePair("UserName", RequiresCredentialsBroker.DEFAULT_USERNAME));
jv.getJndiParams().addKeyValuePair(new KeyValuePair("Password", Password.encode(RequiresCredentialsBroker.DEFAULT_PASSWORD, Password.PORTABLE_PASSWORD)));
jv.setEncodedPasswordKeys("Password");
StandaloneProducer standaloneProducer = new StandaloneProducer(c, producer);
try {
broker.start();
LifecycleHelper.init(standaloneProducer);
} finally {
LifecycleHelper.close(standaloneProducer);
broker.destroy();
}
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiPasProducerCase method testProduceAndConsume_ExtraConfig.
@Test
public void testProduceAndConsume_ExtraConfig() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
SimpleFactoryConfiguration sfc = new SimpleFactoryConfiguration();
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("ClientID", "testProduceAndConsume_ExtraConfig"));
kvps.add(new KeyValuePair("UseCompression", "true"));
sfc.setProperties(kvps);
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
sendVendorImp.setExtraFactoryConfiguration(sfc);
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPasConnection(recvVendorImp, false, queueName, topicName), new PasConsumer().withTopic(topicName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, false, queueName, topicName), new PasProducer().withTopic(topicName));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.jms.jndi.StandardJndiImplementation in project interlok by adaptris.
the class JndiPasProducerCase method testProduceAndConsume.
@Test
public void testProduceAndConsume() throws Exception {
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPasConnection(recvVendorImp, false, queueName, topicName), new PasConsumer().withTopic(topicName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, false, queueName, topicName), new PasProducer().withTopic(topicName));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
Aggregations