use of com.adaptris.util.URLString in project interlok by adaptris.
the class AdapterRegistryTest method testCreateAdapter_URL.
@Test
public void testCreateAdapter_URL() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
File filename = deleteLater(adapter);
DefaultMarshaller.getDefaultMarshaller().marshal(adapter, filename);
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
int expectedCount = myAdapterRegistry.getAdapters().size() + 1;
ObjectName objName = myAdapterRegistry.createAdapter(new URLString(filename));
assertNotNull(objName);
assertTrue(mBeanServer.isRegistered(objName));
AdapterManagerMBean manager = JMX.newMBeanProxy(mBeanServer, objName, AdapterManagerMBean.class);
assertNotNull(manager);
assertEquals(ClosedState.getInstance(), manager.getComponentState());
assertEquals(expectedCount, myAdapterRegistry.getAdapters().size());
}
use of com.adaptris.util.URLString in project interlok by adaptris.
the class AdapterRegistryTest method testProxy_RemoveConfigurationURL.
@Test
public void testProxy_RemoveConfigurationURL() throws Exception {
AdapterRegistry adapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
AdapterRegistryMBean registry = JMX.newMBeanProxy(mBeanServer, adapterRegistry.createObjectName(), AdapterRegistryMBean.class);
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
File filename = deleteLater(adapter);
DefaultMarshaller.getDefaultMarshaller().marshal(adapter, filename);
URLString expectedURL = new URLString(filename);
ObjectName objName = registry.createAdapter(expectedURL);
assertNotNull(objName);
assertTrue(mBeanServer.isRegistered(objName));
assertEquals(expectedURL, registry.getConfigurationURL(objName));
assertTrue(registry.removeConfigurationURL(objName));
assertNull(registry.getConfigurationURL(objName));
assertNull(adapterRegistry.getConfigurationURL(objName));
assertFalse(registry.removeConfigurationURL(objName));
}
use of com.adaptris.util.URLString in project interlok by adaptris.
the class AdapterRegistryTest method testRemoveConfigurationURL.
@Test
public void testRemoveConfigurationURL() throws Exception {
AdapterRegistry adapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
File filename = deleteLater(adapter);
DefaultMarshaller.getDefaultMarshaller().marshal(adapter, filename);
URLString expectedURL = new URLString(filename);
ObjectName objName = adapterRegistry.createAdapter(expectedURL);
assertNotNull(objName);
assertTrue(mBeanServer.isRegistered(objName));
assertEquals(expectedURL, adapterRegistry.getConfigurationURL(objName));
assertTrue(adapterRegistry.removeConfigurationURL(objName));
assertNull(adapterRegistry.getConfigurationURL(objName));
assertFalse(adapterRegistry.removeConfigurationURL(objName));
}
use of com.adaptris.util.URLString in project interlok by adaptris.
the class AdapterRegistryTest method testDestroy_With_GetConfigurationURL.
@Test
public void testDestroy_With_GetConfigurationURL() throws Exception {
AdapterRegistry adapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
File filename = deleteLater(adapter);
DefaultMarshaller.getDefaultMarshaller().marshal(adapter, filename);
URLString expectedURL = new URLString(filename);
ObjectName objName = adapterRegistry.createAdapter(expectedURL);
assertNotNull(objName);
assertTrue(mBeanServer.isRegistered(objName));
assertEquals(expectedURL, adapterRegistry.getConfigurationURL(objName));
adapterRegistry.destroyAdapter(objName);
assertEquals(expectedURL, adapterRegistry.getConfigurationURL(objName));
}
use of com.adaptris.util.URLString in project interlok by adaptris.
the class AdapterRegistryTest method testProxy_PersistAdapter_ObjectName_To_URL.
@Test
public void testProxy_PersistAdapter_ObjectName_To_URL() throws Exception {
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
AdapterRegistryMBean registry = JMX.newMBeanProxy(mBeanServer, myAdapterRegistry.createObjectName(), AdapterRegistryMBean.class);
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
File filename = deleteLater(adapter);
String xml = DefaultMarshaller.getDefaultMarshaller().marshal(adapter);
ObjectName objName = registry.createAdapter(xml);
registry.persistAdapter(objName, new URLString(filename));
Adapter marshalledAdapter = (Adapter) DefaultMarshaller.getDefaultMarshaller().unmarshal(filename);
assertRoundtripEquality(adapter, marshalledAdapter);
}
Aggregations