use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testProxyEquality.
@Test
public void testProxyEquality() 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);
assertEquals(realWorkflowManager, workflowManagerProxy);
assertFalse(realWorkflowManager == workflowManagerProxy);
} finally {
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testInitialise.
@Test
public void testInitialise() 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());
workflowManagerProxy.requestInit(TIMEOUT_MILLIS);
assertEquals(InitialisedState.getInstance(), workflowManagerProxy.getComponentState());
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testChannelStarted_StopWorkflow.
@Test
public void testChannelStarted_StopWorkflow() 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);
JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
adapterManager.requestStart();
workflowManagerProxy.requestStop(TIMEOUT_MILLIS);
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testChannelInitialised_InitWorkflow.
@Test
public void testChannelInitialised_InitWorkflow() 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);
JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
adapterManager.requestStart();
channelManager.requestClose();
channelManager.requestInit();
workflowManagerProxy.requestInit(TIMEOUT_MILLIS);
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testGetParentObjectName.
@Test
public void testGetParentObjectName() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
new AdapterManager(createAdapter(adapterName));
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
Workflow workflow = createWorkflow("w1");
WorkflowManager workflowManager = new WorkflowManager(workflow, channelManager);
assertEquals(channelManager, workflowManager.getParent());
assertTrue(channelManager == workflowManager.getParent());
assertEquals(channelManager.createObjectName(), workflowManager.getParentObjectName());
}
Aggregations