Search in sources :

Example 6 with NullMessageProducer

use of com.adaptris.core.NullMessageProducer in project interlok by adaptris.

the class ExampleChannelCase method configureWorkflow.

protected Workflow configureWorkflow(WorkflowImp impl) throws CoreException {
    impl.setUniqueId(UUID.randomUUID().toString());
    AdaptrisMessageConsumer consumer = new NullMessageConsumer();
    impl.setConsumer(consumer);
    impl.setProducer(new NullMessageProducer());
    impl.setServiceCollection(createServiceCollection());
    return impl;
}
Also used : AdaptrisMessageConsumer(com.adaptris.core.AdaptrisMessageConsumer) NullMessageProducer(com.adaptris.core.NullMessageProducer) NullMessageConsumer(com.adaptris.core.NullMessageConsumer)

Example 7 with NullMessageProducer

use of com.adaptris.core.NullMessageProducer in project interlok by adaptris.

the class SharedConnectionConfigurationCheckerTest method createAdapterConfig.

private static String createAdapterConfig(AdaptrisConnection sharedComponent, AdaptrisConnection consumeConnection, AdaptrisConnection produceConnection, AdaptrisConnection serviceConnection) throws Exception {
    Adapter adapter = new Adapter();
    if (sharedComponent != null) {
        adapter.getSharedComponents().addConnection(sharedComponent);
    }
    Channel channel = new Channel();
    if (consumeConnection != null) {
        channel.setConsumeConnection(consumeConnection);
    }
    if (produceConnection != null) {
        channel.setProduceConnection(produceConnection);
    }
    if (serviceConnection != null) {
        StandardWorkflow standardWorkflow = new StandardWorkflow();
        StandaloneProducer sp = new StandaloneProducer(serviceConnection, new NullMessageProducer());
        standardWorkflow.getServiceCollection().add(sp);
        channel.getWorkflowList().add(standardWorkflow);
    }
    adapter.getChannelList().add(channel);
    return DefaultMarshaller.getDefaultMarshaller().marshal(adapter);
}
Also used : StandardWorkflow(com.adaptris.core.StandardWorkflow) Channel(com.adaptris.core.Channel) Adapter(com.adaptris.core.Adapter) StandaloneProducer(com.adaptris.core.StandaloneProducer) NullMessageProducer(com.adaptris.core.NullMessageProducer)

Example 8 with NullMessageProducer

use of com.adaptris.core.NullMessageProducer in project interlok by adaptris.

the class BasicMessageSplitterServiceTest method testInit.

@Test
public void testInit() throws Exception {
    BasicMessageSplitterService service = new BasicMessageSplitterService();
    try {
        service.init();
        fail();
    } catch (CoreException expected) {
    }
    service.setConnection(new NullConnection());
    service.setSplitter(new LineCountSplitter());
    service.setProducer(new NullMessageProducer());
    service.init();
}
Also used : CoreException(com.adaptris.core.CoreException) NullConnection(com.adaptris.core.NullConnection) NullMessageProducer(com.adaptris.core.NullMessageProducer) Test(org.junit.Test)

Example 9 with NullMessageProducer

use of com.adaptris.core.NullMessageProducer in project interlok by adaptris.

the class SplitterCase method createBasic.

static BasicMessageSplitterService createBasic(MessageSplitter ms) {
    BasicMessageSplitterService service = new BasicMessageSplitterService();
    service.setConnection(new NullConnection());
    service.setProducer(new NullMessageProducer());
    service.setSplitter(ms);
    return service;
}
Also used : NullConnection(com.adaptris.core.NullConnection) NullMessageProducer(com.adaptris.core.NullMessageProducer)

Example 10 with NullMessageProducer

use of com.adaptris.core.NullMessageProducer in project interlok by adaptris.

the class OnMessageHandlerTest method testOnMessageHandlerCommitFailsThenRollback.

@Test
public void testOnMessageHandlerCommitFailsThenRollback() throws Exception {
    when(mockSession.getTransacted()).thenReturn(true);
    doThrow(new JMSException("Expected")).when(mockSession).commit();
    JmsTransactedWorkflow jmsTransactedWorkflow = new JmsTransactedWorkflow();
    jmsTransactedWorkflow.setConsumer(new NullMessageConsumer());
    jmsTransactedWorkflow.setProducer(new NullMessageProducer());
    jmsTransactedWorkflow.registerChannel(mockChannel);
    config.setCorrelationIdSource(mockCorrelationSourceId);
    config.setMessageTranslator(mockTranslator);
    config.registerAdaptrisMessageListener(jmsTransactedWorkflow);
    handler = new OnMessageHandler(config);
    handler.onMessage(jmsMessage);
    verify(mockSession).commit();
    verify(mockSession).rollback();
}
Also used : JMSException(javax.jms.JMSException) NullMessageProducer(com.adaptris.core.NullMessageProducer) NullMessageConsumer(com.adaptris.core.NullMessageConsumer) Test(org.junit.Test)

Aggregations

NullMessageProducer (com.adaptris.core.NullMessageProducer)12 Test (org.junit.Test)7 NullMessageConsumer (com.adaptris.core.NullMessageConsumer)5 StandaloneProducer (com.adaptris.core.StandaloneProducer)5 NullConnection (com.adaptris.core.NullConnection)3 MockAllowsRetriesConnection (com.adaptris.core.stubs.MockAllowsRetriesConnection)3 JMSException (javax.jms.JMSException)3 MetadataElement (com.adaptris.core.MetadataElement)2 ServiceList (com.adaptris.core.ServiceList)2 StatelessServiceWrapper (com.adaptris.core.services.StatelessServiceWrapper)2 JdbcServiceList (com.adaptris.core.services.jdbc.JdbcServiceList)2 AddMetadataService (com.adaptris.core.services.metadata.AddMetadataService)2 ArrayList (java.util.ArrayList)2 Adapter (com.adaptris.core.Adapter)1 AdaptrisMessageConsumer (com.adaptris.core.AdaptrisMessageConsumer)1 Channel (com.adaptris.core.Channel)1 CoreException (com.adaptris.core.CoreException)1 SharedConnection (com.adaptris.core.SharedConnection)1 StandardWorkflow (com.adaptris.core.StandardWorkflow)1