Search in sources :

Example 1 with CommitStatus

use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.

the class NetconfTestImplModuleTest method testDependencyList.

@Test
public void testDependencyList() throws Exception {
    ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
    final ObjectName on = createInstance(transaction, this.instanceName, 4);
    transaction.validateConfig();
    final CommitStatus status1 = transaction.commit();
    assertBeanCount(1, this.factory.getImplementationName());
    assertBeanCount(4 + 1, DepTestImplModuleFactory.NAME);
    assertStatus(status1, 1 + 4 + 1, 0, 0);
    transaction = this.configRegistryClient.createTransaction();
    final NetconfTestImplModuleMXBean proxy = transaction.newMXBeanProxy(ObjectNameUtil.withoutTransactionName(on), NetconfTestImplModuleMXBean.class);
    proxy.getComplexList();
    final List<ObjectName> testingDeps = proxy.getTestingDeps();
    final ObjectName testingDep = proxy.getTestingDep();
    assertEquals(TESTING_DEP_PREFIX, ObjectNameUtil.getInstanceName(testingDep));
    assertTestingDeps(testingDeps, 4);
    transaction.abortConfig();
    // check that reuse logic works - equals on list of dependencies.
    transaction = this.configRegistryClient.createTransaction();
    final CommitStatus status2 = transaction.commit();
    assertStatus(status2, 0, 0, 6);
    // replace single dependency
    transaction = this.configRegistryClient.createTransaction();
    final String instanceName1 = TESTING_DEP_PREFIX + 1;
    transaction.destroyModule(DepTestImplModuleFactory.NAME, instanceName1);
    transaction.createModule(DepTestImplModuleFactory.NAME, instanceName1);
    final CommitStatus status3 = transaction.commit();
    assertStatus(status3, 1, 1, 4);
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) ObjectName(javax.management.ObjectName) Test(org.junit.Test) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest)

Example 2 with CommitStatus

use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.

the class ITTest method testCreateBean.

@Test
public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createModule(transaction, instanceName);
    transaction.validateConfig();
    CommitStatus status = transaction.commit();
    assertBeanCount(1, factory.getImplementationName());
    assertStatus(status, 1, 0, 0);
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) Test(org.junit.Test) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest)

Example 3 with CommitStatus

use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.

the class ITTest method testReusingOldInstance.

@Test
public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createModule(transaction, instanceName);
    transaction.commit();
    assertBeanCount(1, factory.getImplementationName());
    transaction = configRegistryClient.createTransaction();
    CommitStatus status = transaction.commit();
    assertBeanCount(1, factory.getImplementationName());
    assertStatus(status, 0, 0, 1);
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) Test(org.junit.Test) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest)

Example 4 with CommitStatus

use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.

the class ImmediateEventExecutorModuleTest method testReusingOldInstance.

@Test
public void testReusingOldInstance() throws InstanceAlreadyExistsException, ConflictingVersionException, ValidationException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createInstance(transaction, instanceName);
    transaction.commit();
    transaction = configRegistryClient.createTransaction();
    assertBeanCount(1, factory.getImplementationName());
    CommitStatus status = transaction.commit();
    assertBeanCount(1, factory.getImplementationName());
    assertStatus(status, 0, 0, 1);
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest) Test(org.junit.Test)

Example 5 with CommitStatus

use of org.opendaylight.controller.config.api.jmx.CommitStatus in project controller by opendaylight.

the class NettyThreadgroupModuleTest method testCreateBean.

@Test
public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createInstance(transaction, instanceName, 2);
    createInstance(transaction, instanceName + 2, null);
    transaction.validateConfig();
    CommitStatus status = transaction.commit();
    assertBeanCount(2, factory.getImplementationName());
    assertStatus(status, 2, 0, 0);
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) Test(org.junit.Test) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest)

Aggregations

CommitStatus (org.opendaylight.controller.config.api.jmx.CommitStatus)23 Test (org.junit.Test)15 ConfigTransactionJMXClient (org.opendaylight.controller.config.util.ConfigTransactionJMXClient)15 AbstractConfigTest (org.opendaylight.controller.config.manager.impl.AbstractConfigTest)13 ObjectName (javax.management.ObjectName)8 ConflictingVersionException (org.opendaylight.controller.config.api.ConflictingVersionException)2 ValidationException (org.opendaylight.controller.config.api.ValidationException)2 TestingFixedThreadPoolConfigMXBean (org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolConfigMXBean)2 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 GuardedBy (javax.annotation.concurrent.GuardedBy)1 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 Before (org.junit.Before)1 ModuleIdentifier (org.opendaylight.controller.config.api.ModuleIdentifier)1 RuntimeBeanRegistratorAwareModule (org.opendaylight.controller.config.api.RuntimeBeanRegistratorAwareModule)1 ServiceInterfaceAnnotation (org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation)1 DestroyedModule (org.opendaylight.controller.config.manager.impl.dependencyresolver.DestroyedModule)1 ModuleInternalTransactionalInfo (org.opendaylight.controller.config.manager.impl.dependencyresolver.ModuleInternalTransactionalInfo)1 DynamicReadableWrapper (org.opendaylight.controller.config.manager.impl.dynamicmbean.DynamicReadableWrapper)1