Search in sources :

Example 1 with SimpleFactoryConfiguration

use of com.adaptris.core.jms.jndi.SimpleFactoryConfiguration 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);
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) KeyValuePair(com.adaptris.util.KeyValuePair) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) SimpleFactoryConfiguration(com.adaptris.core.jms.jndi.SimpleFactoryConfiguration) PtpProducer(com.adaptris.core.jms.PtpProducer) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 2 with SimpleFactoryConfiguration

use of com.adaptris.core.jms.jndi.SimpleFactoryConfiguration in project interlok by adaptris.

the class JndiImplementationCase method testSetExtraConfiguration.

@Test
public void testSetExtraConfiguration() throws Exception {
    BaseJndiImplementation jv = createVendorImplementation();
    assertEquals(NoOpFactoryConfiguration.class, jv.getExtraFactoryConfiguration().getClass());
    jv.setExtraFactoryConfiguration(new SimpleFactoryConfiguration());
    assertEquals(SimpleFactoryConfiguration.class, jv.getExtraFactoryConfiguration().getClass());
    try {
        jv.setExtraFactoryConfiguration(null);
        fail();
    } catch (IllegalArgumentException expected) {
    }
    assertEquals(SimpleFactoryConfiguration.class, jv.getExtraFactoryConfiguration().getClass());
}
Also used : BaseJndiImplementation(com.adaptris.core.jms.jndi.BaseJndiImplementation) SimpleFactoryConfiguration(com.adaptris.core.jms.jndi.SimpleFactoryConfiguration) Test(org.junit.Test)

Example 3 with SimpleFactoryConfiguration

use of com.adaptris.core.jms.jndi.SimpleFactoryConfiguration 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);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) PasConsumer(com.adaptris.core.jms.PasConsumer) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) SimpleFactoryConfiguration(com.adaptris.core.jms.jndi.SimpleFactoryConfiguration) PasProducer(com.adaptris.core.jms.PasProducer) KeyValuePairSet(com.adaptris.util.KeyValuePairSet) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 4 with SimpleFactoryConfiguration

use of com.adaptris.core.jms.jndi.SimpleFactoryConfiguration in project interlok by adaptris.

the class JndiExtraConfigPtpProducerTest method createJndiVendorImpExample.

static JmsConnection createJndiVendorImpExample(StandardJndiImplementation jndi, JmsConnection c) {
    JndiPtpProducerTest.createJndiVendorImpExample(jndi, c);
    SimpleFactoryConfiguration sfc = new SimpleFactoryConfiguration();
    KeyValuePairSet jndiExtras = sfc.getProperties();
    jndiExtras.add(new KeyValuePair("ConnectID", "MyConnectId"));
    jndiExtras.add(new KeyValuePair("PingInterval", "10"));
    jndi.setExtraFactoryConfiguration(sfc);
    return c;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) SimpleFactoryConfiguration(com.adaptris.core.jms.jndi.SimpleFactoryConfiguration) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Aggregations

SimpleFactoryConfiguration (com.adaptris.core.jms.jndi.SimpleFactoryConfiguration)4 KeyValuePair (com.adaptris.util.KeyValuePair)3 KeyValuePairSet (com.adaptris.util.KeyValuePairSet)3 Test (org.junit.Test)3 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)2 StandaloneProducer (com.adaptris.core.StandaloneProducer)2 StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)2 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)2 PasConsumer (com.adaptris.core.jms.PasConsumer)1 PasProducer (com.adaptris.core.jms.PasProducer)1 PtpConsumer (com.adaptris.core.jms.PtpConsumer)1 PtpProducer (com.adaptris.core.jms.PtpProducer)1 BaseJndiImplementation (com.adaptris.core.jms.jndi.BaseJndiImplementation)1