use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class NettyThreadgroupModuleTest method testReusingOldInstance.
@Test
public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
createInstance(transaction, instanceName, null);
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
assertStatus(status, 0, 0, 1);
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class MultipleDependenciesModuleTest method testDestroyModuleDependency.
@Test
public void testDestroyModuleDependency() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
ObjectName r1 = transaction.createModule(factory.getImplementationName(), "root1");
ObjectName m1 = transaction.createModule(factory.getImplementationName(), "middle1");
MultipleDependenciesModuleMXBean r1Proxy = transaction.newMXBeanProxy(r1, MultipleDependenciesModuleMXBean.class);
r1Proxy.setSingle(m1);
transaction.commit();
transaction = configRegistryClient.createTransaction();
transaction.destroyModule(factory.getImplementationName(), "middle1");
try {
transaction.commit();
fail("Validation exception expected");
} catch (ValidationException e) {
assertThat(e.getFailedValidations().keySet(), CoreMatchers.hasItem("multiple-dependencies"));
}
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class NetconfTestImplModuleTest method testNullCheckInListOfDependencies.
@Test
public void testNullCheckInListOfDependencies() throws Exception {
final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
final ObjectName on = createInstance(transaction, this.instanceName, 4);
final NetconfTestImplModuleMXBean proxy = transaction.newMXBeanProxy(on, NetconfTestImplModuleMXBean.class);
proxy.setTestingDeps(null);
assertTrue(proxy.getTestingDeps().isEmpty());
proxy.setTestingDeps(Collections.<ObjectName>emptyList());
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class RuntimeBeanTest method testRecreate.
@Test
public void testRecreate() throws Exception {
ObjectName createdConfigBean = createScheduled();
// empty transaction
ConfigTransactionJMXClient configTransaction = configRegistryClient.createTransaction();
ObjectName scheduledWritableON = configTransaction.lookupConfigBean(TestingScheduledThreadPoolModuleFactory.NAME, SCHEDULED1);
TestingScheduledThreadPoolConfigBeanMXBean scheduledWritableProxy = configTransaction.newMXBeanProxy(scheduledWritableON, TestingScheduledThreadPoolConfigBeanMXBean.class);
scheduledWritableProxy.setRecreate(true);
CommitStatus commitInfo = configTransaction.commit();
// check that it was recreated
ObjectName readableConfigBean = ObjectNameUtil.withoutTransactionName(createdConfigBean);
List<ObjectName> newInstances = Collections.<ObjectName>emptyList();
List<ObjectName> reusedInstances = Collections.<ObjectName>emptyList();
List<ObjectName> recreatedInstaces = Lists.newArrayList(readableConfigBean);
assertEquals(new CommitStatus(newInstances, reusedInstances, recreatedInstaces), commitInfo);
checkRuntimeBeans();
}
use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.
the class RuntimeBeanTest method testDestroy_shouldUnregisterRuntimeBeans.
@Test
public void testDestroy_shouldUnregisterRuntimeBeans() throws Exception {
ObjectName createdConfigBean = createScheduled();
ConfigTransactionJMXClient configTransaction = configRegistryClient.createTransaction();
configTransaction.destroyModule(ObjectNameUtil.createTransactionModuleON(configTransaction.getTransactionName(), createdConfigBean));
configTransaction.commit();
for (ObjectName on : allObjectNames) {
checkRuntimeBeanDoesNotExist(on);
}
}
Aggregations