use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testClose.
@Test
public void testClose() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
Workflow workflow = createWorkflow("w1");
WorkflowManager realWorkflowManager = new WorkflowManager(workflow, channelManager);
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
adapterManager.createObjectName();
ObjectName workflowObj = realWorkflowManager.createObjectName();
mBeans.add(adapterManager);
mBeans.addAll(adapterManager.getAllDescendants());
try {
register(mBeans);
WorkflowManagerMBean workflowManagerProxy = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
adapterManager.requestStart();
assertEquals(StartedState.getInstance(), workflowManagerProxy.getComponentState());
workflowManagerProxy.requestClose(TIMEOUT_MILLIS);
assertEquals(ClosedState.getInstance(), workflowManagerProxy.getComponentState());
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testChannelClosed_StartWorkflow.
@Test
public void testChannelClosed_StartWorkflow() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
Workflow workflow = createWorkflow("w1");
WorkflowManager realWorkflowManager = new WorkflowManager(workflow, channelManager);
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
adapterManager.createObjectName();
ObjectName workflowObj = realWorkflowManager.createObjectName();
ObjectName channelObj = channelManager.createObjectName();
mBeans.add(adapterManager);
mBeans.addAll(adapterManager.getAllDescendants());
try {
register(mBeans);
WorkflowManagerMBean workflowManagerProxy = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
adapterManager.requestStart();
channelManagerProxy.requestClose(TIMEOUT_MILLIS);
try {
workflowManagerProxy.requestStart(TIMEOUT_MILLIS);
fail();
} catch (CoreException e) {
assertEquals(createErrorMessageString(ClosedState.getInstance(), StartedState.getInstance()), e.getMessage());
}
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testGetConfiguration.
@Test
public void testGetConfiguration() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
Workflow workflow = createWorkflow("w1");
WorkflowManager workflowManager = new WorkflowManager(workflow, channelManager);
Workflow marshalledWorkflow = (Workflow) new XStreamMarshaller().unmarshal(workflowManager.getConfiguration());
assertRoundtripEquality(workflow, marshalledWorkflow);
Channel marshalledChannel = (Channel) new XStreamMarshaller().unmarshal(channelManager.getConfiguration());
assertRoundtripEquality(channel, marshalledChannel);
Adapter marshalledAdapter = (Adapter) new XStreamMarshaller().unmarshal(adapterManager.getConfiguration());
assertRoundtripEquality(adapter, marshalledAdapter);
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testMessageCounter_Enabled.
@Test
public void testMessageCounter_Enabled() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
Workflow workflow = createWorkflow("w1");
new WorkflowManager(workflow, channelManager);
assertEquals(2, workflow.getInterceptors().size());
assertEquals(MessageMetricsInterceptor.class, workflow.getInterceptors().get(0).getClass());
assertEquals(InFlightWorkflowInterceptor.class, workflow.getInterceptors().get(1).getClass());
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testChannelClosed_CloseWorkflow.
@Test
public void testChannelClosed_CloseWorkflow() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
Workflow workflow = createWorkflow("w1");
WorkflowManager realWorkflowManager = new WorkflowManager(workflow, channelManager);
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
adapterManager.createObjectName();
ObjectName workflowObj = realWorkflowManager.createObjectName();
ObjectName channelObj = channelManager.createObjectName();
mBeans.add(adapterManager);
mBeans.addAll(adapterManager.getAllDescendants());
try {
register(mBeans);
WorkflowManagerMBean workflowManagerProxy = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
adapterManager.requestStart();
channelManagerProxy.requestClose(TIMEOUT_MILLIS);
workflowManagerProxy.requestClose(TIMEOUT_MILLIS);
} finally {
adapter.requestClose();
}
}
Aggregations