Search in sources :

Example 1 with RequiresCredentialsBroker

use of com.adaptris.core.jms.activemq.RequiresCredentialsBroker 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();
    }
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) RequiresCredentialsBroker(com.adaptris.core.jms.activemq.RequiresCredentialsBroker) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) PasProducer(com.adaptris.core.jms.PasProducer) JmsConnection(com.adaptris.core.jms.JmsConnection) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 2 with RequiresCredentialsBroker

use of com.adaptris.core.jms.activemq.RequiresCredentialsBroker 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();
    }
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) RequiresCredentialsBroker(com.adaptris.core.jms.activemq.RequiresCredentialsBroker) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) PasProducer(com.adaptris.core.jms.PasProducer) JmsConnection(com.adaptris.core.jms.JmsConnection) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 3 with RequiresCredentialsBroker

use of com.adaptris.core.jms.activemq.RequiresCredentialsBroker 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();
    }
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) RequiresCredentialsBroker(com.adaptris.core.jms.activemq.RequiresCredentialsBroker) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) PasProducer(com.adaptris.core.jms.PasProducer) JmsConnection(com.adaptris.core.jms.JmsConnection) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Aggregations

StandaloneProducer (com.adaptris.core.StandaloneProducer)3 JmsConnection (com.adaptris.core.jms.JmsConnection)3 PasProducer (com.adaptris.core.jms.PasProducer)3 RequiresCredentialsBroker (com.adaptris.core.jms.activemq.RequiresCredentialsBroker)3 StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)3 KeyValuePair (com.adaptris.util.KeyValuePair)3 Test (org.junit.Test)3