use of com.adaptris.core.Adapter in project interlok by adaptris.
the class ChannelManagerTest method testAdapterStarted_StartChannel.
@Test
public void testAdapterStarted_StartChannel() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel c1 = createChannel(getName() + "_1");
Channel c2 = createChannel(getName() + "_2");
ChannelManager child1 = new ChannelManager(c1, adapterManager);
ChannelManager child2 = new ChannelManager(c2, adapterManager);
ObjectName adapterObj = adapterManager.createObjectName();
ObjectName channelObj = child1.createObjectName();
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
mBeans.add(adapterManager);
mBeans.addAll(adapterManager.getAllDescendants());
try {
register(mBeans);
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
adapterManager.requestStart();
channelManagerProxy.requestStart();
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Adapter in project interlok by adaptris.
the class ChannelManagerTest method testAddChildRuntimeComponent.
@Test
public void testAddChildRuntimeComponent() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel c1 = createChannel(getName() + "_1");
ChannelManager channelManager = new ChannelManager(c1, adapterManager);
assertTrue(channelManager.addChildJmxComponent(new ChannelChild(channelManager)));
assertEquals(1, channelManager.getChildRuntimeInfoComponents().size());
assertEquals(1, channelManager.getAllDescendants().size());
}
use of com.adaptris.core.Adapter in project interlok by adaptris.
the class ChannelManagerTest method testGetState.
@Test
public void testGetState() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel c1 = createChannel(getName() + "_1");
Channel c2 = createChannel(getName() + "_2");
ChannelManager child1 = new ChannelManager(c1, adapterManager);
ChannelManager child2 = new ChannelManager(c2, adapterManager);
ObjectName adapterObj = adapterManager.createObjectName();
ObjectName channelObj = child1.createObjectName();
try {
adapterManager.registerMBean();
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
assertEquals(ClosedState.getInstance(), channelManagerProxy.getComponentState());
} finally {
adapterManager.requestClose();
adapterManager.unregisterMBean();
}
}
use of com.adaptris.core.Adapter in project interlok by adaptris.
the class ChannelManagerTest method testMBean_AddWorkflow_InvalidState.
@Test
public void testMBean_AddWorkflow_InvalidState() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel newChannel = createChannel(getName() + "_1");
ObjectName adapterObj = adapterManager.createObjectName();
ChannelManager channelManager = new ChannelManager(newChannel, adapterManager);
ObjectName channelObj = channelManager.createObjectName();
StandardWorkflow newWorkflow = createWorkflow(getName() + "_1");
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>();
mBeans.add(adapterManager);
mBeans.addAll(adapterManager.getAllDescendants());
try {
adapterManager.registerMBean();
adapterManager.requestStart();
AdapterManagerMBean adapterManagerProxy = JMX.newMBeanProxy(mBeanServer, adapterObj, AdapterManagerMBean.class);
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
try {
ObjectName workflowObj = channelManagerProxy.addWorkflow(DefaultMarshaller.getDefaultMarshaller().marshal(newWorkflow));
fail();
} catch (IllegalStateException e) {
}
} finally {
adapterManager.requestClose();
}
}
use of com.adaptris.core.Adapter in project interlok by adaptris.
the class ChannelManagerTest method testStop.
@Test
public void testStop() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel c1 = createChannel(getName() + "_1");
Channel c2 = createChannel(getName() + "_2");
ChannelManager child1 = new ChannelManager(c1, adapterManager);
ChannelManager child2 = new ChannelManager(c2, adapterManager);
ObjectName adapterObj = adapterManager.createObjectName();
ObjectName channelObj = child1.createObjectName();
try {
adapterManager.registerMBean();
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
adapterManager.requestStart();
channelManagerProxy.requestStop();
assertEquals(StoppedState.getInstance(), channelManagerProxy.getComponentState());
} finally {
adapterManager.requestClose();
adapterManager.unregisterMBean();
}
}
Aggregations