Search in sources :

Example 16 with JmsConnection

use of com.adaptris.core.jms.JmsConnection in project interlok by adaptris.

the class JndiImplementationCase method testInitialiseDefaultArtemisBroker.

@Test
public void testInitialiseDefaultArtemisBroker() throws Exception {
    String topicName = testName.getMethodName() + "_topic";
    PasProducer producer = new PasProducer().withTopic(topicName);
    JmsConnection c = activeMqBroker.getJmsConnection();
    StandaloneProducer standaloneProducer = new StandaloneProducer(c, producer);
    try {
        LifecycleHelper.init(standaloneProducer);
    } finally {
        LifecycleHelper.close(standaloneProducer);
    }
}
Also used : PasProducer(com.adaptris.core.jms.PasProducer) JmsConnection(com.adaptris.core.jms.JmsConnection) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 17 with JmsConnection

use of com.adaptris.core.jms.JmsConnection 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);
    }
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) 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 18 with JmsConnection

use of com.adaptris.core.jms.JmsConnection 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 19 with JmsConnection

use of com.adaptris.core.jms.JmsConnection 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 20 with JmsConnection

use of com.adaptris.core.jms.JmsConnection in project interlok by adaptris.

the class MessageTypeTranslatorCase method createProducer.

private StandaloneProducer createProducer(MessageTypeTranslator mt) throws Exception {
    PasProducer producer = new PasProducer();
    producer.withTopic(testName.getMethodName());
    producer.setMessageTranslator(mt);
    return new StandaloneProducer(new JmsConnection(), producer);
}
Also used : PasProducer(com.adaptris.core.jms.PasProducer) JmsConnection(com.adaptris.core.jms.JmsConnection) StandaloneProducer(com.adaptris.core.StandaloneProducer)

Aggregations

JmsConnection (com.adaptris.core.jms.JmsConnection)47 Test (org.junit.Test)25 StandaloneProducer (com.adaptris.core.StandaloneProducer)17 StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)14 TimeInterval (com.adaptris.util.TimeInterval)14 PasProducer (com.adaptris.core.jms.PasProducer)12 MockChannel (com.adaptris.core.stubs.MockChannel)10 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)8 PtpProducer (com.adaptris.core.jms.PtpProducer)8 KeyValuePair (com.adaptris.util.KeyValuePair)6 Adapter (com.adaptris.core.Adapter)5 PtpConsumer (com.adaptris.core.jms.PtpConsumer)5 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)5 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)4 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)4 SharedConnection (com.adaptris.core.SharedConnection)4 MessageTypeTranslatorImp (com.adaptris.core.jms.MessageTypeTranslatorImp)4 UrlVendorImplementation (com.adaptris.core.jms.UrlVendorImplementation)4 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)4 Message (javax.jms.Message)4