Search in sources :

Example 1 with TestingScheduledThreadPoolConfigBeanMXBean

use of org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolConfigBeanMXBean 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();
}
Also used : ConfigTransactionJMXClient(org.opendaylight.controller.config.util.ConfigTransactionJMXClient) CommitStatus(org.opendaylight.controller.config.api.jmx.CommitStatus) TestingScheduledThreadPoolConfigBeanMXBean(org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolConfigBeanMXBean) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Aggregations

ObjectName (javax.management.ObjectName)1 Test (org.junit.Test)1 CommitStatus (org.opendaylight.controller.config.api.jmx.CommitStatus)1 TestingScheduledThreadPoolConfigBeanMXBean (org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolConfigBeanMXBean)1 ConfigTransactionJMXClient (org.opendaylight.controller.config.util.ConfigTransactionJMXClient)1