Search in sources :

Example 1 with TestingParallelAPSPModule

use of org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModule in project controller by opendaylight.

the class DynamicWritableWrapperTest method testObjectNameSetterWithONContainingTransaction_shouldBeTranslatedToReadOnlyON.

/*
     * Try to call setter with ObjectName containing transaction name. Verify that
     * ObjectName without transaction name was actually passed on the config bean.
     */
@Test
public void testObjectNameSetterWithONContainingTransaction_shouldBeTranslatedToReadOnlyON() throws Exception {
    TestingParallelAPSPModuleFactory testingParallelAPSPConfigBeanFactory = new TestingParallelAPSPModuleFactory();
    TestingParallelAPSPModule apspConfigBean = testingParallelAPSPConfigBeanFactory.createModule("", null, null);
    ModuleIdentifier moduleIdentifier2 = new ModuleIdentifier("apsp", "parallel");
    ObjectName dynON2 = ObjectNameUtil.createReadOnlyModuleON(moduleIdentifier2);
    AbstractDynamicWrapper dyn = getDynamicWrapper(apspConfigBean, moduleIdentifier2);
    platformMBeanServer.registerMBean(dyn, dynON2);
    try {
        TestingParallelAPSPConfigMXBean proxy = JMX.newMBeanProxy(platformMBeanServer, dynON2, TestingParallelAPSPConfigMXBean.class);
        ObjectName withTransactionName = ObjectNameUtil.createTransactionModuleON("transaction1", "moduleName", "instanceName");
        proxy.setThreadPool(withTransactionName);
        ObjectName withoutTransactionName = ObjectNameUtil.withoutTransactionName(withTransactionName);
        assertEquals(withoutTransactionName, proxy.getThreadPool());
    } finally {
        platformMBeanServer.unregisterMBean(dynON2);
    }
}
Also used : TestingParallelAPSPModule(org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModule) TestingParallelAPSPModuleFactory(org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModuleFactory) ModuleIdentifier(org.opendaylight.controller.config.api.ModuleIdentifier) ObjectName(javax.management.ObjectName) TestingParallelAPSPConfigMXBean(org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPConfigMXBean) Test(org.junit.Test)

Aggregations

ObjectName (javax.management.ObjectName)1 Test (org.junit.Test)1 ModuleIdentifier (org.opendaylight.controller.config.api.ModuleIdentifier)1 TestingParallelAPSPConfigMXBean (org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPConfigMXBean)1 TestingParallelAPSPModule (org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModule)1 TestingParallelAPSPModuleFactory (org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModuleFactory)1