use of org.opendaylight.controller.config.api.ModuleIdentifier in project controller by opendaylight.
the class ConfigRegistryImplLookupTest method registerRuntimeBean.
private static void registerRuntimeBean(final RuntimeBean object, final BaseJMXRegistrator baseJMXRegistrator, final ObjectName runtimeON) throws InstanceAlreadyExistsException {
String factoryName = ObjectNameUtil.getFactoryName(runtimeON);
String instanceName = ObjectNameUtil.getInstanceName(runtimeON);
Map<String, String> properties = ObjectNameUtil.getAdditionalPropertiesOfRuntimeBeanName(runtimeON);
RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator = baseJMXRegistrator.createRuntimeBeanRegistrator(new ModuleIdentifier(factoryName, instanceName));
assertThat(properties.isEmpty(), is(true));
runtimeBeanRegistrator.registerRoot(object);
}
use of org.opendaylight.controller.config.api.ModuleIdentifier in project controller by opendaylight.
the class TestingScheduledThreadPoolModuleFactory method createModule.
@Override
public Module createModule(final String instanceName, final DependencyResolver dependencyResolver, final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception {
TestingScheduledThreadPoolImpl oldInstance;
try {
oldInstance = (TestingScheduledThreadPoolImpl) old.getInstance();
} catch (final ClassCastException e) {
// happens after OSGi update
oldInstance = null;
}
TestingScheduledThreadPoolModule configBean = new TestingScheduledThreadPoolModule(new ModuleIdentifier(NAME, instanceName), old.getInstance(), oldInstance);
// copy attributes
configBean.setRecreate((Boolean) old.getAttribute("Recreate"));
return configBean;
}
use of org.opendaylight.controller.config.api.ModuleIdentifier in project controller by opendaylight.
the class TestingParallelAPSPModuleFactory method createModule.
@Override
public TestingParallelAPSPModule createModule(final String instanceName, final DependencyResolver dependencyResolver, final DynamicMBeanWithInstance old, final BundleContext context) throws Exception {
TestingParallelAPSPImpl oldInstance;
try {
oldInstance = (TestingParallelAPSPImpl) old.getInstance();
} catch (final ClassCastException e) {
oldInstance = null;
}
TestingParallelAPSPModule result = new TestingParallelAPSPModule(new ModuleIdentifier(NAME, instanceName), dependencyResolver, old.getInstance(), oldInstance);
// copy attributes
String someParam = (String) old.getAttribute("SomeParam");
result.setSomeParam(someParam);
ObjectName threadPool = (ObjectName) old.getAttribute("ThreadPool");
result.setThreadPool(threadPool);
return result;
}
use of org.opendaylight.controller.config.api.ModuleIdentifier in project controller by opendaylight.
the class BlankTransactionServiceTrackerTest method testValidationException.
@Test
public void testValidationException() throws Exception {
IllegalArgumentException argumentException = new IllegalArgumentException();
ValidationException validationException = ValidationException.createForSingleException(new ModuleIdentifier("m", "i"), argumentException);
doThrow(validationException).when(blankTx).hit();
tracker.addingService(getMockServiceReference());
verify(blankTx, times(10)).hit();
}
use of org.opendaylight.controller.config.api.ModuleIdentifier in project controller by opendaylight.
the class TestingFixedThreadPoolModuleFactory method createModule.
@Override
public Module createModule(final String instanceName, final DependencyResolver dependencyResolver, final DynamicMBeanWithInstance old, final BundleContext bundleContext) throws Exception {
int threadCount = (Integer) old.getAttribute("ThreadCount");
// is the instance compatible?
TestingFixedThreadPool oldInstance;
try {
// reconfigure existing instance
oldInstance = (TestingFixedThreadPool) old.getInstance();
} catch (final ClassCastException e) {
// old instance will be closed, new needs to be created
oldInstance = null;
}
TestingFixedThreadPoolModule result = new TestingFixedThreadPoolModule(new ModuleIdentifier(NAME, instanceName), old.getInstance(), oldInstance);
result.setThreadCount(threadCount);
return result;
}
Aggregations