use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testReloadFromVersionControl_NoVCS.
@Test
public void testReloadFromVersionControl_NoVCS() throws Exception {
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
try {
myAdapterRegistry.reloadFromVersionControl();
fail();
} catch (CoreException expected) {
assertEquals("No Runtime Version Control", expected.getMessage());
}
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testPutConfigurationUrl.
@Test
public void testPutConfigurationUrl() throws Exception {
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
URLString url = new URLString("http://localhost/1234");
myAdapterRegistry.putConfigurationURL(myAdapterRegistry.createObjectName(), url);
assertEquals(url, myAdapterRegistry.getConfigurationURL(myAdapterRegistry.createObjectName()));
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testAddAdapterMBean_ExistingObjectName.
@Test
public void testAddAdapterMBean_ExistingObjectName() throws Exception {
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
AdapterManager adapterManager = new AdapterManager(adapter);
ObjectName adapterObjectName = adapterManager.createObjectName();
adapterManager.registerMBean();
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
int expectedCount = myAdapterRegistry.getAdapters().size() + 1;
myAdapterRegistry.addAdapter(adapterManager);
assertEquals(ClosedState.getInstance(), adapterManager.getComponentState());
assertEquals(expectedCount, myAdapterRegistry.getAdapters().size());
try {
myAdapterRegistry.addAdapter(adapterManager);
fail();
} catch (CoreException expected) {
assertTrue(expected.getMessage().contains("already exists in the registry, remove it first"));
}
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testProxy_PersistAdapter_Bean_to_URL.
@Test
public void testProxy_PersistAdapter_Bean_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);
assertNotNull(objName);
AdapterManagerMBean manager = JMX.newMBeanProxy(mBeanServer, objName, AdapterManagerMBean.class);
registry.persistAdapter(manager, new URLString(filename));
Adapter marshalledAdapter = (Adapter) DefaultMarshaller.getDefaultMarshaller().unmarshal(filename);
assertRoundtripEquality(adapter, marshalledAdapter);
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testClassDescriptionGetSubTypes.
@Test
public void testClassDescriptionGetSubTypes() throws Exception {
Properties custom = new Properties();
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(custom));
String adapterRegistryTestJsonDef = myAdapterRegistry.getClassDefinition(ReformatMetadata.class.getCanonicalName());
ClassDescriptor adapterRegistryTestDef = (ClassDescriptor) new XStreamJsonMarshaller().unmarshal(adapterRegistryTestJsonDef);
assertTrue(adapterRegistryTestDef.getSubTypes().size() > 0);
assertTrue(adapterRegistryTestDef.getSubTypes().contains(ReformatDateService.class.getName()));
}
Aggregations