Search in sources :

Example 21 with StandardJndiImplementation

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

the class JndiPtpProducerCase 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.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) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) PtpProducer(com.adaptris.core.jms.PtpProducer) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 22 with StandardJndiImplementation

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

the class DefaultEventHandlerTest method retrieveObjectForSampleConfig.

/**
 * @see com.adaptris.core.ExampleConfigCase#retrieveObjectForSampleConfig()
 */
@Override
protected Object retrieveObjectForSampleConfig() {
    Adapter result = null;
    try {
        AdaptrisMessageProducer p = new PtpProducer().withQueue("publishEventsTo");
        DefaultEventHandler eh = new DefaultEventHandler();
        eh.setConnection(new JmsConnection(new StandardJndiImplementation("MyConnectionFactoryName")));
        eh.setProducer(p);
        eh.setMarshaller(DefaultMarshaller.getDefaultMarshaller());
        result = new Adapter();
        result.setChannelList(new ChannelList());
        result.setEventHandler(eh);
        result.setUniqueId(UUID.randomUUID().toString());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return result;
}
Also used : StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) PtpProducer(com.adaptris.core.jms.PtpProducer) JmsConnection(com.adaptris.core.jms.JmsConnection)

Example 23 with StandardJndiImplementation

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

the class JmsAsyncProducerTest method createArtemisConnection.

protected JmsConnection createArtemisConnection() {
    StandardJndiImplementation jndiImplementation = new StandardJndiImplementation();
    jndiImplementation.setJndiName("ConnectionFactory");
    jndiImplementation.getJndiParams().addKeyValuePair(new KeyValuePair("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"));
    jndiImplementation.getJndiParams().addKeyValuePair(new KeyValuePair("java.naming.provider.url", "tcp://localhost:61616?type=CF"));
    return new JmsConnection(jndiImplementation);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation)

Example 24 with StandardJndiImplementation

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

the class SharedComponentListTest method createPtpConnection.

private JmsConnection createPtpConnection(String uniqueId) throws PasswordException {
    JmsConnection c = new JmsConnection();
    StandardJndiImplementation jndi = new StandardJndiImplementation();
    jndi.setJndiName("Connection_Factory_To_Lookup");
    KeyValuePairSet kvps = jndi.getJndiParams();
    kvps.addKeyValuePair(new KeyValuePair(Context.SECURITY_PRINCIPAL, "Administrator"));
    kvps.addKeyValuePair(new KeyValuePair(Context.SECURITY_CREDENTIALS, "Administrator"));
    kvps.addKeyValuePair(new KeyValuePair("com.sonicsw.jndi.mfcontext.domain", "Domain1"));
    kvps.addKeyValuePair(new KeyValuePair(Context.INITIAL_CONTEXT_FACTORY, "com.sonicsw.jndi.mfcontext.MFContextFactory"));
    jndi.getJndiParams().addKeyValuePair(new KeyValuePair(Context.PROVIDER_URL, "tcp://localhost:2506"));
    c.setVendorImplementation(jndi);
    if (!isEmpty(uniqueId)) {
        c.setUniqueId(uniqueId);
    }
    return c;
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) JmsConnection(com.adaptris.core.jms.JmsConnection) KeyValuePairSet(com.adaptris.util.KeyValuePairSet)

Example 25 with StandardJndiImplementation

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

the class RetryingServiceWrapperTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    JmsConnection connection = new JmsConnection();
    connection.setVendorImplementation(new StandardJndiImplementation("MyConnectionFactory"));
    StandaloneProducer wrappedService = new StandaloneProducer();
    wrappedService.setConnection(connection);
    wrappedService.setProducer(new PtpProducer().withQueue(("MyQueueName")));
    RetryingServiceWrapper service = new RetryingServiceWrapper();
    service.setUniqueId("Retrying Service Wrapper");
    service.setNumRetries(10);
    service.setRestartOnFailure(true);
    service.setDelayBetweenRetries(new TimeInterval(10L, TimeUnit.SECONDS));
    service.setService(wrappedService);
    return service;
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) JmsConnection(com.adaptris.core.jms.JmsConnection) PtpProducer(com.adaptris.core.jms.PtpProducer) StandaloneProducer(com.adaptris.core.StandaloneProducer)

Aggregations

StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)28 Test (org.junit.Test)20 StandaloneProducer (com.adaptris.core.StandaloneProducer)16 JmsConnection (com.adaptris.core.jms.JmsConnection)14 PasProducer (com.adaptris.core.jms.PasProducer)11 KeyValuePair (com.adaptris.util.KeyValuePair)11 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)7 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)7 PtpProducer (com.adaptris.core.jms.PtpProducer)6 TimeInterval (com.adaptris.util.TimeInterval)6 KeyValuePairSet (com.adaptris.util.KeyValuePairSet)5 PasConsumer (com.adaptris.core.jms.PasConsumer)4 PtpConsumer (com.adaptris.core.jms.PtpConsumer)3 RequiresCredentialsBroker (com.adaptris.core.jms.activemq.RequiresCredentialsBroker)3 MockChannel (com.adaptris.core.stubs.MockChannel)3 ProduceException (com.adaptris.core.ProduceException)2 FailoverJmsConnection (com.adaptris.core.jms.FailoverJmsConnection)2 SimpleFactoryConfiguration (com.adaptris.core.jms.jndi.SimpleFactoryConfiguration)2 ActiveJmsConnectionErrorHandler (com.adaptris.core.jms.ActiveJmsConnectionErrorHandler)1 JmsConnectionErrorHandler (com.adaptris.core.jms.JmsConnectionErrorHandler)1