Search in sources :

Example 11 with CommitStatus

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;
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) ObjectName(javax.management.ObjectName)

Example 12 with CommitStatus

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);
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) TestingFixedThreadPoolConfigMXBean(org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolConfigMXBean) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest) Test(org.junit.Test)

Example 13 with 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();
}
Also used : CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 14 with CommitStatus

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;
}
Also used : CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus)

Example 15 with CommitStatus

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;
}
Also used : CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus)

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