use of org.opendaylight.controller.config.api.jmx.CommitStatus 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.api.jmx.CommitStatus 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.api.jmx.CommitStatus in project controller by opendaylight.
the class RuntimeBeanTest method testReuse.
@Test
public void testReuse() throws Exception {
ObjectName createdConfigBean = createScheduled();
// empty transaction
CommitStatus commitInfo = configRegistryClient.createTransaction().commit();
// check that it was reused
ObjectName readableConfigBean = ObjectNameUtil.withoutTransactionName(createdConfigBean);
List<ObjectName> newInstances = Collections.<ObjectName>emptyList();
List<ObjectName> reusedInstances = Lists.newArrayList(readableConfigBean);
List<ObjectName> recreatedInstaces = Collections.<ObjectName>emptyList();
assertEquals(new CommitStatus(newInstances, reusedInstances, recreatedInstaces), commitInfo);
checkRuntimeBeans();
}
use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.
the class ConfigSubsystemFacade method commitSilentTransaction.
public CommitStatus commitSilentTransaction() throws DocumentedException, ValidationException, ConflictingVersionException {
final CommitStatus status = this.transactionProvider.commitTransaction(configRegistryClientNoNotifications);
LOG.trace("Transaction committed successfully: {}", status);
return status;
}
use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.
the class ConfigSubsystemFacade method commitTransaction.
public CommitStatus commitTransaction() throws DocumentedException, ValidationException, ConflictingVersionException {
final CommitStatus status = this.transactionProvider.commitTransaction();
LOG.trace("Transaction committed successfully: {}", status);
return status;
}
Aggregations