use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testClose.
@Test
public void testClose() throws Exception {
AdapterRegistry adapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
String xml = DefaultMarshaller.getDefaultMarshaller().marshal(adapter);
int expectedCount = adapterRegistry.getAdapters().size() + 1;
ObjectName objName = adapterRegistry.createAdapter(xml);
assertEquals(expectedCount, adapterRegistry.getAdapters().size());
AdapterManagerMBean manager = JMX.newMBeanProxy(mBeanServer, objName, AdapterManagerMBean.class);
manager.requestStart();
AdapterRegistry.close(adapterRegistry.getAdapters());
assertEquals(ClosedState.getInstance(), manager.getComponentState());
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testProxy_GetConfigurationURL.
@Test
public void testProxy_GetConfigurationURL() 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);
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));
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testStart.
@Test
public void testStart() throws Exception {
AdapterRegistry adapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
String adapterName = this.getClass().getSimpleName() + "." + getName();
Adapter adapter = createAdapter(adapterName, 2, 2);
String xml = DefaultMarshaller.getDefaultMarshaller().marshal(adapter);
int expectedCount = adapterRegistry.getAdapters().size() + 1;
ObjectName objName = adapterRegistry.createAdapter(xml);
assertEquals(expectedCount, adapterRegistry.getAdapters().size());
AdapterManagerMBean manager = JMX.newMBeanProxy(mBeanServer, objName, AdapterManagerMBean.class);
AdapterRegistry.start(adapterRegistry.getAdapters());
assertEquals(StartedState.getInstance(), manager.getComponentState());
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testGetVersionControl.
@Test
public void testGetVersionControl() throws Exception {
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
assertNull(myAdapterRegistry.getVersionControl());
AdapterBuilder builder = new ArrayList<AdapterBuilder>(myAdapterRegistry.builders()).get(0);
builder.overrideRuntimeVCS(new MockRuntimeVersionControl());
assertEquals("MOCK", myAdapterRegistry.getVersionControl());
}
use of com.adaptris.core.stubs.JunitBootstrapProperties in project interlok by adaptris.
the class AdapterRegistryTest method testValidateConfig_InvalidXML.
@Test
public void testValidateConfig_InvalidXML() throws Exception {
String xml = "<adapter><hello-world/></adapter>";
AdapterRegistry myAdapterRegistry = (AdapterRegistry) AdapterRegistry.findInstance(new JunitBootstrapProperties(new Properties()));
try {
myAdapterRegistry.validateConfig(xml);
fail();
} catch (CoreException expected) {
System.err.println(expected.getMessage());
}
}
Aggregations