Search in sources :

Example 1 with TestingRuntimeBean

use of org.opendaylight.controller.config.manager.impl.runtimembean.TestingRuntimeBean in project controller by opendaylight.

the class ConfigTransactionControllerImplTest method setUp.

@Before
public void setUp() throws Exception {
    baseJMXRegistrator = new BaseJMXRegistrator(ManagementFactory.getPlatformMBeanServer());
    transactionsMBeanServer = MBeanServerFactory.createMBeanServer();
    Map<String, Map.Entry<ModuleFactory, BundleContext>> currentlyRegisteredFactories = new HashMap<>();
    ConfigTransactionLookupRegistry txLookupRegistry = new ConfigTransactionLookupRegistry(new TransactionIdentifier(TRANSACTION_NAME123), () -> baseJMXRegistrator.createTransactionJMXRegistrator(TRANSACTION_NAME123), currentlyRegisteredFactories);
    SearchableServiceReferenceWritableRegistry writableRegistry = ServiceReferenceRegistryImpl.createSRWritableRegistry(ServiceReferenceRegistryImpl.createInitialSRLookupRegistry(), txLookupRegistry, currentlyRegisteredFactories);
    testedTxController = new ConfigTransactionControllerImpl(txLookupRegistry, 1, null, 1, currentlyRegisteredFactories, transactionsMBeanServer, ManagementFactory.getPlatformMBeanServer(), false, writableRegistry);
    TransactionModuleJMXRegistrator transactionModuleJMXRegistrator123 = testedTxController.getTxModuleJMXRegistrator();
    transactionModuleJMXRegistrator123.registerMBean(new TestingRuntimeBean(), NAME1);
    transactionModuleJMXRegistrator123.registerMBean(new TestingRuntimeBean(), NAME2);
    transactionModuleJMXRegistrator123.registerMBean(new TestingRuntimeBean(), NAME3);
    TransactionJMXRegistrator jmxRegistrator4 = baseJMXRegistrator.createTransactionJMXRegistrator(TRANSACTION_NAME4);
    jmxRegistrator4.createTransactionModuleJMXRegistrator().registerMBean(new TestingRuntimeBean(), NAME4);
}
Also used : HashMap(java.util.HashMap) TransactionJMXRegistrator(org.opendaylight.controller.config.manager.impl.jmx.TransactionJMXRegistrator) BaseJMXRegistrator(org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator) TransactionModuleJMXRegistrator(org.opendaylight.controller.config.manager.impl.jmx.TransactionModuleJMXRegistrator) TestingRuntimeBean(org.opendaylight.controller.config.manager.impl.runtimembean.TestingRuntimeBean) Before(org.junit.Before)

Example 2 with TestingRuntimeBean

use of org.opendaylight.controller.config.manager.impl.runtimembean.TestingRuntimeBean in project controller by opendaylight.

the class ConfigRegistryImplLookupTest method setUp.

@Before
public void setUp() throws Exception {
    configRegistryImpl = new ConfigRegistryImpl(null, ManagementFactory.getPlatformMBeanServer(), null);
    Field field = configRegistryImpl.getClass().getDeclaredField("baseJMXRegistrator");
    field.setAccessible(true);
    baseJMXRegistrator = (BaseJMXRegistrator) field.get(configRegistryImpl);
    registerModuleBean(new TestingRuntimeBean(), baseJMXRegistrator, NAME1);
    registerModuleBean(new TestingRuntimeBean(), baseJMXRegistrator, NAME2);
    registerModuleBean(new TestingRuntimeBean(), baseJMXRegistrator, NAME3);
    registerModuleBean(new TestingRuntimeBean(), baseJMXRegistrator, NAME4);
    registerRuntimeBean(new TestingRuntimeBean(), baseJMXRegistrator, NAME5);
    registerRuntimeBean(new TestingRuntimeBean(), baseJMXRegistrator, NAME6);
    registerRuntimeBean(new TestingRuntimeBean(), baseJMXRegistrator, NAME8);
    baseJMXRegistrator.createTransactionJMXRegistrator("transaction").createTransactionModuleJMXRegistrator().registerMBean(new TestingRuntimeBean(), NAME9);
}
Also used : Field(java.lang.reflect.Field) TestingRuntimeBean(org.opendaylight.controller.config.manager.impl.runtimembean.TestingRuntimeBean) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 TestingRuntimeBean (org.opendaylight.controller.config.manager.impl.runtimembean.TestingRuntimeBean)2 Field (java.lang.reflect.Field)1 HashMap (java.util.HashMap)1 BaseJMXRegistrator (org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator)1 TransactionJMXRegistrator (org.opendaylight.controller.config.manager.impl.jmx.TransactionJMXRegistrator)1 TransactionModuleJMXRegistrator (org.opendaylight.controller.config.manager.impl.jmx.TransactionModuleJMXRegistrator)1