use of com.adaptris.core.Channel in project interlok by adaptris.
the class ChannelManagerTest method testEqualityHashCode.
@Test
public void testEqualityHashCode() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
AdapterManager am1 = new AdapterManager(createAdapter(adapterName));
AdapterManager am2 = new AdapterManager(createAdapter(adapterName));
AdapterManager fam = new AdapterManager(createAdapter(adapterName));
Channel channel = createChannel("c1");
Channel channel2 = createChannel("c1");
ChannelManager cm1 = new ChannelManager(channel, am1);
ChannelManager cm2 = new ChannelManager(channel2, am2);
ChannelManager fcm = new FailingChannelManager(channel, fam);
ChannelManager cm3 = new ChannelManager(createChannel("c3"), am1);
assertEquals(cm1, cm1);
assertEquals(cm1, cm2);
assertNotSame(cm1, cm3);
assertFalse(cm1.equals(fcm));
assertFalse(cm1.equals(new Object()));
assertFalse(cm1.equals(null));
assertEquals(cm1.hashCode(), cm2.hashCode());
assertNotSame(cm1.hashCode(), cm3.hashCode());
}
use of com.adaptris.core.Channel in project interlok by adaptris.
the class ChannelManagerTest method testGetChildren.
@Test
public void testGetChildren() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel c1 = createChannel(getName() + "_1", 2);
// Add a WF with no ID... which should mean we have a workflow that is unmanaged.
c1.getWorkflowList().add(new StandardWorkflow());
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 {
assertEquals(2, child1.getChildren().size());
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Channel in project interlok by adaptris.
the class ChannelManagerTest method testInitialise.
@Test
public void testInitialise() 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();
adapterManager.requestStart();
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
channelManagerProxy.requestClose();
assertEquals(ClosedState.getInstance(), channelManagerProxy.getComponentState());
channelManagerProxy.requestInit();
assertEquals(InitialisedState.getInstance(), channelManagerProxy.getComponentState());
} finally {
adapterManager.requestClose();
adapterManager.unregisterMBean();
}
}
use of com.adaptris.core.Channel in project interlok by adaptris.
the class ChannelManagerTest method testGetParent.
@Test
public void testGetParent() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
Adapter adapter2 = createAdapter(adapterName);
Channel channel = createChannel(getName(), 0);
try {
AdapterManager adapterManager = new AdapterManager(adapter);
AdapterManager adapterManager_2 = new AdapterManager(adapter2);
ChannelManager channelManager = new ChannelManager(channel, adapterManager);
assertEquals(adapterManager, channelManager.getParent());
assertTrue(adapterManager == channelManager.getParent());
assertEquals(adapterManager_2, channelManager.getParent());
assertFalse(adapterManager_2 == channelManager.getParent());
} finally {
adapter.requestClose();
}
}
use of com.adaptris.core.Channel in project interlok by adaptris.
the class ChannelManagerTest method testChannelManager_HasRetryMonitor.
@Test
public void testChannelManager_HasRetryMonitor() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName);
AdapterManager adapterManager = new AdapterManager(adapter);
Channel c1 = createChannel(getName() + "_1");
c1.setMessageErrorHandler(new RetryMessageErrorHandler(getName()));
ChannelManager cm1 = new ChannelManager(c1, adapterManager);
ObjectName channelObj = cm1.createObjectName();
List<BaseComponentMBean> mBeans = new ArrayList<BaseComponentMBean>(Arrays.asList(new BaseComponentMBean[] { adapterManager, cm1 }));
try {
register(mBeans);
ObjectName handlerObjectName = ObjectName.getInstance(JMX_RETRY_MONITOR_TYPE + cm1.createObjectHierarchyString() + ID_PREFIX + getName());
ChannelManagerMBean channelManagerProxy = JMX.newMBeanProxy(mBeanServer, channelObj, ChannelManagerMBean.class);
assertTrue(channelManagerProxy.getChildRuntimeInfoComponents().contains(handlerObjectName));
RetryMessageErrorHandlerMonitorMBean monitor = JMX.newMBeanProxy(mBeanServer, handlerObjectName, RetryMessageErrorHandlerMonitorMBean.class);
} finally {
adapter.requestClose();
}
}
Aggregations