use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class SimpleConfigurationTest method firstCommit.
private ObjectName firstCommit() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
ObjectName fixed1names = createFixedThreadPool(transaction);
// commit
assertEquals(1, configRegistryClient.getOpenConfigs().size());
CommitStatus commitStatus = transaction.commit();
assertEquals(0, configRegistryClient.getOpenConfigs().size());
CommitStatus expected = new CommitStatus(Arrays.asList(ObjectNameUtil.withoutTransactionName(fixed1names)), EMPTYO_NS, EMPTYO_NS);
assertEquals(expected, commitStatus);
assertEquals(1, TestingFixedThreadPool.ALL_EXECUTORS.size());
assertFalse(TestingFixedThreadPool.ALL_EXECUTORS.get(0).isShutdown());
return fixed1names;
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class SimpleConfigurationTest method testReplaceFixed1.
@Test
public void testReplaceFixed1() throws Exception {
// 1, start transaction, create new fixed thread pool
firstCommit();
// destroy and recreate with different # of threads
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
transaction.destroyModule(ObjectNameUtil.createTransactionModuleON(transaction.getTransactionName(), TestingFixedThreadPoolModuleFactory.NAME, FIXED1));
ObjectName fixed1name = transaction.createModule(TestingFixedThreadPoolModuleFactory.NAME, FIXED1);
TestingFixedThreadPoolConfigMXBean fixedConfigProxy = transaction.newMXBeanProxy(fixed1name, TestingFixedThreadPoolConfigMXBean.class);
fixedConfigProxy.setThreadCount(NUMBER_OF_THREADS2);
// commit
transaction.commit();
// check that first threadpool is closed
checkThreadPools(1, NUMBER_OF_THREADS2);
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class SimpleConfigurationTest method testTriggerRecreatingInstance.
@Test
public void testTriggerRecreatingInstance() throws Exception {
// 1, start transaction, create new fixed thread pool
firstCommit();
// switch boolean to create new instance
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
TestingFixedThreadPoolConfigMXBean fixedConfigProxy = startReconfiguringFixed1ThreadPool(transaction);
fixedConfigProxy.setTriggerNewInstanceCreation(true);
// commit
CommitStatus commitStatus = transaction.commit();
// check that new threadpool is created and old one is closed
checkThreadPools(1, NUMBER_OF_THREADS);
CommitStatus expected = new CommitStatus(EMPTYO_NS, EMPTYO_NS, FIXED1_LIST);
assertEquals(expected, commitStatus);
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class DependentWiringTest method testUsingServiceReferences.
@Test
public void testUsingServiceReferences() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
ObjectName threadPoolON = createFixed1(transaction, 10);
transaction.lookupConfigBean(getThreadPoolImplementationName(), fixed1);
String refName = "ref";
ObjectName serviceReferenceON = transaction.saveServiceReference(TestingThreadPoolServiceInterface.QNAME, refName, threadPoolON);
createParallelAPSP(transaction, serviceReferenceON);
transaction.commit();
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class RuntimeBeanTest method createScheduled.
private ObjectName createScheduled() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
// create using TestingThreadPoolIfc:
ObjectName createdConfigBean = transaction.createModule(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
// commit
transaction.commit();
return createdConfigBean;
}
Aggregations