use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class TwoInterfacesExportTest method testWithAPSP_useIfcNameMismatch.
@Test
public void testWithAPSP_useIfcNameMismatch() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
ObjectName apspName = transaction.createModule(TestingParallelAPSPModuleFactory.NAME, "apsp1");
TestingParallelAPSPConfigMXBean apspProxy = transaction.newMXBeanProxy(apspName, TestingParallelAPSPConfigMXBean.class);
apspProxy.setThreadPool(ObjectNameUtil.createReadOnlyModuleON(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1));
apspProxy.setSomeParam("someParam");
transaction.validateConfig();
transaction.commit();
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class TwoInterfacesExportTest method twoInterfaceNamesAfterCreatingConfigBean.
@Test
public void twoInterfaceNamesAfterCreatingConfigBean() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
// create using TestingThreadPoolIfc:
ObjectName scheduled1name = transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
ObjectName retrievedName = transaction.lookupConfigBean(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
assertEquals(scheduled1name, retrievedName);
// getExistingConfigBean should resolve moduleName
String moduleName = TestingScheduledThreadPoolModuleFactory.NAME;
retrievedName = transaction.lookupConfigBean(moduleName, SCHEDULED1);
ObjectName expected = ObjectNameUtil.createTransactionModuleON(transaction.getTransactionName(), moduleName, SCHEDULED1);
assertEquals(expected, retrievedName);
// commit
transaction.commit();
assertEquals(1, TestingScheduledThreadPoolImpl.ALLEXECUTORS.size());
assertFalse(TestingScheduledThreadPoolImpl.ALLEXECUTORS.get(0).isTerminated());
assertEquals(0, TestingScheduledThreadPoolImpl.getNumberOfCloseMethodCalls());
assertExists(moduleName, SCHEDULED1);
// destroy using ThreadPool ifc
transaction = configRegistryClient.createTransaction();
transaction.destroyModule(ObjectNameUtil.createTransactionModuleON(transaction.getTransactionName(), moduleName, SCHEDULED1));
transaction.commit();
assertEquals(1, TestingScheduledThreadPoolImpl.ALLEXECUTORS.size());
assertTrue(TestingScheduledThreadPoolImpl.ALLEXECUTORS.get(0).isTerminated());
assertEquals(1, TestingScheduledThreadPoolImpl.getNumberOfCloseMethodCalls());
// should not be in platform:
assertNotExists(moduleName, SCHEDULED1);
transaction = configRegistryClient.createTransaction();
// should not be in transaction
assertNotExists(transaction, moduleName, SCHEDULED1);
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class TwoInterfacesExportTest method testWithAPSP_useScheduledNames.
@Test
public void testWithAPSP_useScheduledNames() throws InstanceAlreadyExistsException, ValidationException {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
ObjectName scheduledName = transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
ObjectName apspName = transaction.createModule(TestingParallelAPSPModuleFactory.NAME, "apsp1");
TestingParallelAPSPConfigMXBean apspProxy = transaction.newMXBeanProxy(apspName, TestingParallelAPSPConfigMXBean.class);
apspProxy.setThreadPool(scheduledName);
apspProxy.setSomeParam("someParam");
transaction.validateConfig();
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class ShutdownTest method setSecret.
private void setSecret(final String secret) throws InstanceNotFoundException, ValidationException, ConflictingVersionException {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
ObjectName on = transaction.lookupConfigBean(NAME, NAME);
ShutdownModuleMXBean proxy = transaction.newMXBeanProxy(on, ShutdownModuleMXBean.class);
proxy.setSecret(secret);
transaction.commit();
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class ShutdownTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
ModuleFactoriesResolver factoriesResolver = new HardcodedModuleFactoriesResolver(mockedContext, factory);
super.initConfigTransactionManagerImpl(factoriesResolver);
doReturn(mockedSysBundle).when(mockedContext).getBundle(0);
mockedContext.getBundle(0);
doNothing().when(mockedSysBundle).stop();
doReturn(mockedContext).when(mockedSysBundle).getBundleContext();
doReturn(new Bundle[] { mockedSysBundle }).when(mockedContext).getBundles();
doReturn("system bundle").when(mockedSysBundle).getSymbolicName();
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
// initialize default instance
transaction.commit();
}
Aggregations