Search in sources :

Example 26 with ConfigTransactionJMXClient

use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.

the class ITTest method testInstanceAlreadyExistsException.

@Test
public void testInstanceAlreadyExistsException() throws ConflictingVersionException, ValidationException, InstanceAlreadyExistsException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createModule(transaction, instanceName);
    transaction.commit();
    transaction = configRegistryClient.createTransaction();
    try {
        createModule(transaction, instanceName);
        fail();
    } catch (InstanceAlreadyExistsException e) {
    }
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) Test(org.junit.Test) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest)

Example 27 with ConfigTransactionJMXClient

use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.

the class GlobalEventExecutorModuleTest method testCreateBean.

@Test
public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createInstance(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 28 with ConfigTransactionJMXClient

use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.

the class GlobalEventExecutorModuleTest method testConflictingName.

@Test
public void testConflictingName() throws Exception {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    try {
        createInstance(transaction, instanceName + "x");
        fail();
    } catch (final IllegalArgumentException e) {
        assertTrue(e.getMessage() + " failure", e.getMessage().contains("only allowed name is singleton"));
    }
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) Test(org.junit.Test) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest)

Example 29 with ConfigTransactionJMXClient

use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.

the class GlobalEventExecutorModuleTest 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) Test(org.junit.Test) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest)

Example 30 with ConfigTransactionJMXClient

use of org.opendaylight.controller.config.util.ConfigTransactionJMXClient in project controller by opendaylight.

the class ImmediateEventExecutorModuleTest method testCreateBean.

@Test
public void testCreateBean() throws InstanceAlreadyExistsException, ValidationException, ConflictingVersionException {
    ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
    createInstance(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) AbstractConfigTest(org.opendaylight.controller.config.manager.impl.AbstractConfigTest) Test(org.junit.Test)

Aggregations

ConfigTransactionJMXClient (org.opendaylight.controller.config.util.ConfigTransactionJMXClient)43 Test (org.junit.Test)38 AbstractConfigTest (org.opendaylight.controller.config.manager.impl.AbstractConfigTest)26 ObjectName (javax.management.ObjectName)22 CommitStatus (org.opendaylight.controller.config.api.jmx.CommitStatus)15 TestingFixedThreadPoolConfigMXBean (org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolConfigMXBean)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 TestingParallelAPSPConfigMXBean (org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPConfigMXBean)3 Map (java.util.Map)2 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)2 InstanceNotFoundException (javax.management.InstanceNotFoundException)2 ConflictingVersionException (org.opendaylight.controller.config.api.ConflictingVersionException)2 ValidationException (org.opendaylight.controller.config.api.ValidationException)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Attribute (javax.management.Attribute)1 IntrospectionException (javax.management.IntrospectionException)1 ReflectionException (javax.management.ReflectionException)1 Before (org.junit.Before)1 IdentityAttributeRef (org.opendaylight.controller.config.api.IdentityAttributeRef)1 ExceptionMessageWithStackTrace (org.opendaylight.controller.config.api.ValidationException.ExceptionMessageWithStackTrace)1