Search in sources :

Example 1 with MockProducer

use of com.adaptris.interlok.junit.scaffolding.jms.MockProducer in project interlok by adaptris.

the class OnMessageHandlerTest method testOnMessageHandlerProducerFailsRollback.

@Test
public void testOnMessageHandlerProducerFailsRollback() throws Exception {
    when(mockSession.getTransacted()).thenReturn(true);
    JmsTransactedWorkflow jmsTransactedWorkflow = new JmsTransactedWorkflow();
    jmsTransactedWorkflow.setConsumer(new NullMessageConsumer());
    jmsTransactedWorkflow.setProducer(new MockProducer());
    jmsTransactedWorkflow.setStrict(true);
    jmsTransactedWorkflow.registerChannel(mockChannel);
    config.setCorrelationIdSource(mockCorrelationSourceId);
    config.setMessageTranslator(mockTranslator);
    config.registerAdaptrisMessageListener(jmsTransactedWorkflow);
    handler = new OnMessageHandler(config);
    handler.onMessage(jmsMessage);
    verify(mockSession).rollback();
}
Also used : MockProducer(com.adaptris.interlok.junit.scaffolding.jms.MockProducer) NullMessageConsumer(com.adaptris.core.NullMessageConsumer) Test(org.junit.Test)

Aggregations

NullMessageConsumer (com.adaptris.core.NullMessageConsumer)1 MockProducer (com.adaptris.interlok.junit.scaffolding.jms.MockProducer)1 Test (org.junit.Test)1