use of com.adaptris.core.NullMessageConsumer in project interlok by adaptris.
the class OnMessageHandlerTest method testOnMessageHandlerTranslatorFailsRollback.
@Test
public void testOnMessageHandlerTranslatorFailsRollback() throws Exception {
when(mockSession.getTransacted()).thenReturn(true);
doThrow(new JMSException("Expected")).when(jmsMessage).getPropertyNames();
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).rollback();
}
use of com.adaptris.core.NullMessageConsumer in project interlok by adaptris.
the class OnMessageHandlerTest method testOnMessageHandlerCommitRollbackFailsCaughtExceptions.
@Test
public void testOnMessageHandlerCommitRollbackFailsCaughtExceptions() throws Exception {
when(mockSession.getTransacted()).thenReturn(true);
doThrow(new JMSException("Expected")).when(mockSession).commit();
doThrow(new JMSException("Expected")).when(mockSession).rollback();
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();
}
use of com.adaptris.core.NullMessageConsumer in project interlok by adaptris.
the class OnMessageHandlerTest method testOnMessageHandlerSuccessTransactedCommit.
@Test
public void testOnMessageHandlerSuccessTransactedCommit() throws Exception {
when(mockSession.getTransacted()).thenReturn(true);
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();
}
use of com.adaptris.core.NullMessageConsumer 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;
}
use of com.adaptris.core.NullMessageConsumer in project interlok by adaptris.
the class DeprecatedConfigurationCheckerTest method createAdapterConfig.
private Adapter createAdapterConfig(boolean validates, boolean channels) throws Exception {
Adapter adapter = new Adapter();
// have a unique-id
adapter.setUniqueId("MyAdapter");
AddTimestampMetadataService atms = new AddTimestampMetadataService();
atms.setUniqueId("valid-add-timestamp-service");
adapter.getSharedComponents().addService(atms);
if (!validates) {
// Add a deprecated service
DeprecatedService ds = new DeprecatedService();
adapter.getSharedComponents().addService(ds);
// Add a service with deprecated member
DeprecatedMemberService dms = new DeprecatedMemberService();
dms.setDeprecated("value");
adapter.getSharedComponents().addService(dms);
}
if (channels) {
Channel c = new Channel();
StandardWorkflow w = new StandardWorkflow();
if (!validates) {
NullMessageConsumer consumer = new NullMessageConsumer();
w.setConsumer(consumer);
w.getServiceCollection().add(new DeprecatedService());
}
c.getWorkflowList().add(w);
adapter.getChannelList().add(c);
}
return adapter;
}
Aggregations