Search in sources :

Example 46 with Workflow

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 {
    }
}
Also used : Channel(com.adaptris.core.Channel) ArrayList(java.util.ArrayList) PoolingWorkflow(com.adaptris.core.PoolingWorkflow) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 47 with Workflow

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();
    }
}
Also used : Channel(com.adaptris.core.Channel) ArrayList(java.util.ArrayList) PoolingWorkflow(com.adaptris.core.PoolingWorkflow) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 48 with Workflow

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();
    }
}
Also used : Channel(com.adaptris.core.Channel) ArrayList(java.util.ArrayList) PoolingWorkflow(com.adaptris.core.PoolingWorkflow) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 49 with Workflow

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();
    }
}
Also used : Channel(com.adaptris.core.Channel) ArrayList(java.util.ArrayList) PoolingWorkflow(com.adaptris.core.PoolingWorkflow) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 50 with Workflow

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());
}
Also used : Channel(com.adaptris.core.Channel) PoolingWorkflow(com.adaptris.core.PoolingWorkflow) StandardWorkflow(com.adaptris.core.StandardWorkflow) Workflow(com.adaptris.core.Workflow) Adapter(com.adaptris.core.Adapter) Test(org.junit.Test)

Aggregations

Workflow (com.adaptris.core.Workflow)53 StandardWorkflow (com.adaptris.core.StandardWorkflow)49 Channel (com.adaptris.core.Channel)44 PoolingWorkflow (com.adaptris.core.PoolingWorkflow)44 Test (org.junit.Test)43 Adapter (com.adaptris.core.Adapter)40 ObjectName (javax.management.ObjectName)30 ArrayList (java.util.ArrayList)27 CoreException (com.adaptris.core.CoreException)8 MockChannel (com.adaptris.core.stubs.MockChannel)5 Notification (javax.management.Notification)3 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 MessageMetricsInterceptor (com.adaptris.core.interceptor.MessageMetricsInterceptor)2 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)2 StaticMockMessageProducer (com.adaptris.core.stubs.StaticMockMessageProducer)2 TimeInterval (com.adaptris.util.TimeInterval)2 DefaultEventHandler (com.adaptris.core.DefaultEventHandler)1 NullProcessingExceptionHandler (com.adaptris.core.NullProcessingExceptionHandler)1 XStreamMarshaller (com.adaptris.core.XStreamMarshaller)1