use of com.adaptris.core.DefaultSerializableMessageTranslator in project interlok by adaptris.
the class WorkflowManager method process.
@Override
public SerializableMessage process(SerializableMessage msgToProcess) throws InterlokException {
DefaultSerializableMessageTranslator translator = new DefaultSerializableMessageTranslator();
AdaptrisMessage msg = toAdaptrisMessage(msgToProcess, translator);
if (injectInterceptor == null) {
// only create the interceptor if we need it.
this.testAndInjectCachingInterceptor();
}
managedWorkflow.onAdaptrisMessage(msg);
return translator.translate(this.waitForInjectReply(msg));
}
use of com.adaptris.core.DefaultSerializableMessageTranslator in project interlok by adaptris.
the class AdapterComponentCheckerTest method testApplyService_WithConnections_NoRewrite.
@Test
public void testApplyService_WithConnections_NoRewrite() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
adapter.getSharedComponents().addConnection(new NullConnection(getName()));
List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
ObjectName objectName = createComponentCheckerObjectName(adapterName);
register(mBeans);
AdapterComponentCheckerMBean manager = JMX.newMBeanProxy(mBeanServer, objectName, AdapterComponentCheckerMBean.class);
AdaptrisMessage msg = new DefaultSerializableMessageTranslator().translate(manager.applyService(createConnectedServices(null), createSerializableMessage(), false));
assertTrue(msg.containsKey("key"));
assertEquals("value", msg.getMetadataValue("key"));
}
use of com.adaptris.core.DefaultSerializableMessageTranslator in project interlok by adaptris.
the class AdapterComponentCheckerTest method testApplyService.
@Test
public void testApplyService() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
ObjectName objectName = createComponentCheckerObjectName(adapterName);
register(mBeans);
AdapterComponentCheckerMBean manager = JMX.newMBeanProxy(mBeanServer, objectName, AdapterComponentCheckerMBean.class);
AdaptrisMessage msg = new DefaultSerializableMessageTranslator().translate(manager.applyService(createServiceForTests(), createSerializableMessage()));
assertTrue(msg.containsKey("key"));
assertEquals("value", msg.getMetadataValue("key"));
}
use of com.adaptris.core.DefaultSerializableMessageTranslator in project interlok by adaptris.
the class DefaultFailedMessageRetrierJmxTest method testMBean_Retry_WorkflowNotStarted.
@Test
public void testMBean_Retry_WorkflowNotStarted() throws Exception {
Adapter adapter = createAdapter(getName());
Channel channel = createChannel(getName());
StandardWorkflow wf = createWorkflow(getName());
MockMessageProducer mock = new MockMessageProducer();
wf.setProducer(mock);
channel.getWorkflowList().add(wf);
adapter.getChannelList().add(channel);
DefaultFailedMessageRetrier retrier = new DefaultFailedMessageRetrier();
retrier.setShutdownWaitTime(new TimeInterval(10L, TimeUnit.SECONDS));
adapter.setFailedMessageRetrier(retrier);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
msg.addMetadata(Workflow.WORKFLOW_ID_KEY, getName() + "@" + getName());
SerializableMessage serialized = new DefaultSerializableMessageTranslator().translate(msg);
AdapterManager adapterManager = new AdapterManager(adapter);
try {
adapterManager.registerMBean();
adapterManager.requestStart();
// Close the workflow directly
wf.requestClose();
ObjectName retrierObjName = createRetrierObjectName(adapterManager);
DefaultFailedMessageRetrierJmxMBean jmxBean = JMX.newMBeanProxy(mBeanServer, retrierObjName, DefaultFailedMessageRetrierJmxMBean.class);
assertFalse(jmxBean.retryMessage(serialized));
assertEquals(0, mock.messageCount());
} finally {
adapterManager.requestClose();
adapterManager.unregisterMBean();
}
}
Aggregations