use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class JndiImplementationCase method testInitialiseWithQueueConnectionFactoryNotFound.
@Test
public void testInitialiseWithQueueConnectionFactoryNotFound() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
PasProducer producer = new PasProducer().withTopic((topicName));
StandardJndiImplementation jv = createVendorImplementation();
JmsConnection c = activeMqBroker.getJndiPtpConnection(jv, false, queueName, topicName);
c.setConnectionAttempts(1);
c.setConnectionRetryInterval(new TimeInterval(100L, TimeUnit.MILLISECONDS));
jv.setJndiName("testInitialiseWithQueueConnectionFactoryNotFound");
StandaloneProducer standaloneProducer = new StandaloneProducer(c, producer);
try {
LifecycleHelper.init(standaloneProducer);
fail("Should Fail to lookup 'testInitialiseWithQueueConnectionFactoryNotFound'");
} catch (Exception e) {
// expected
}
}
use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class JndiImplementationCase method testInitialiseWithEncryptedPassword_withEnableEncodedPasswords.
@Test
public void testInitialiseWithEncryptedPassword_withEnableEncodedPasswords() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
RequiresCredentialsBroker broker = new RequiresCredentialsBroker();
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");
jv.setEnableEncodedPasswords(true);
StandaloneProducer standaloneProducer = new StandaloneProducer(c, producer);
try {
broker.start();
LifecycleHelper.init(standaloneProducer);
} finally {
LifecycleHelper.close(standaloneProducer);
broker.destroy();
}
}
Aggregations