use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testGetParent.
@Test
public void testGetParent() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
AdapterManager adapterManager2 = new AdapterManager(createAdapter(adapterName));
Channel channel = createChannel("c1");
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
ChannelManager channelManager_2 = new ChannelManager(createChannel("c1"), adapterManager2);
Workflow workflow = createWorkflow("w1");
WorkflowManager workflowManager = new WorkflowManager(workflow, channelManager);
assertEquals(channelManager, workflowManager.getParent());
assertTrue(channelManager == workflowManager.getParent());
assertEquals(channelManager_2, workflowManager.getParent());
assertFalse(channelManager_2 == workflowManager.getParent());
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testChannelStopped_CloseWorkflow.
@Test
public void testChannelStopped_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);
adapterManager.createObjectName();
ObjectName workflowObj = realWorkflowManager.createObjectName();
ObjectName channelObj = channelManager.createObjectName();
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
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.requestStop();
workflowManagerProxy.requestClose(TIMEOUT_MILLIS);
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testChannelStopped_StartWorkflow.
@Test
public void testChannelStopped_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);
JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
adapterManager.requestStart();
channelManager.requestStop();
try {
workflowManagerProxy.requestStart(TIMEOUT_MILLIS);
fail();
} catch (CoreException e) {
assertEquals(createErrorMessageString(StoppedState.getInstance(), StartedState.getInstance()), e.getMessage());
}
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testLastStopTime.
@Test
public void testLastStopTime() 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);
long t1 = workflowManagerProxy.requestStopTime();
assertTrue(t1 > 0);
adapterManager.requestStart();
adapterManager.requestStop();
assertTrue(t1 <= workflowManagerProxy.requestStopTime());
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Workflow in project interlok by adaptris.
the class WorkflowManagerTest method testChannelInitialised_StopWorkflow.
@Test
public void testChannelInitialised_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();
channelManager.requestClose();
channelManager.requestInit();
try {
workflowManagerProxy.requestStop(TIMEOUT_MILLIS);
fail();
} catch (CoreException e) {
assertEquals(createErrorMessageString(InitialisedState.getInstance(), StoppedState.getInstance()), e.getMessage());
}
} finally {
adapter.requestClose();
}
}
Aggregations