Search in sources :

Example 1 with BaseJMXRegistrator

use of org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator 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 BaseJMXRegistrator

use of org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator in project controller by opendaylight.

the class AbstractConfigTest method initConfigTransactionManagerImpl.

// this method should be called in @Before
protected void initConfigTransactionManagerImpl(final ModuleFactoriesResolver resolver) {
    final MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
    this.configRegistryJMXRegistrator = new ConfigRegistryJMXRegistrator(platformMBeanServer);
    initBundleContext();
    this.baseJmxRegistrator = new BaseJMXRegistrator(platformMBeanServer);
    this.configRegistry = new ConfigRegistryImpl(resolver, platformMBeanServer, this.baseJmxRegistrator, new BindingContextProvider() {

        @Override
        public synchronized void update(final ClassLoadingStrategy classLoadingStrategy, final SchemaContextProvider ctxProvider) {
        // NOOP
        }

        @Override
        public synchronized BindingRuntimeContext getBindingContext() {
            return getBindingRuntimeContext();
        }
    });
    this.notifyingConfigRegistry = new JMXNotifierConfigRegistry(this.configRegistry, platformMBeanServer);
    try {
        this.configRegistryJMXRegistrator.registerToJMXNoNotifications(this.configRegistry);
        this.configRegistryJMXRegistrator.registerToJMX(this.notifyingConfigRegistry);
    } catch (final InstanceAlreadyExistsException e) {
        throw new RuntimeException(e);
    }
    this.configRegistryClient = new ConfigRegistryJMXClient(platformMBeanServer);
    this.currentBundleContextServiceRegistrationHandler = new RecordingBundleContextServiceRegistrationHandler();
}
Also used : JMXNotifierConfigRegistry(org.opendaylight.controller.config.manager.impl.jmx.JMXNotifierConfigRegistry) BindingContextProvider(org.opendaylight.controller.config.manager.impl.osgi.mapping.BindingContextProvider) BaseJMXRegistrator(org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ClassLoadingStrategy(org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy) SchemaContextProvider(org.opendaylight.yangtools.yang.model.api.SchemaContextProvider) ConfigRegistryJMXRegistrator(org.opendaylight.controller.config.manager.impl.jmx.ConfigRegistryJMXRegistrator) ConfigRegistryJMXClient(org.opendaylight.controller.config.util.ConfigRegistryJMXClient) MBeanServer(javax.management.MBeanServer)

Example 3 with BaseJMXRegistrator

use of org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator in project controller by opendaylight.

the class RuntimeBeanRegistratorImplTest method setUp.

@Before
public void setUp() {
    baseJMXRegistrator = new BaseJMXRegistrator(ManagementFactory.getPlatformMBeanServer());
    tested = baseJMXRegistrator.createRuntimeBeanRegistrator(moduleIdentifier);
}
Also used : BaseJMXRegistrator(org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator) Before(org.junit.Before)

Aggregations

BaseJMXRegistrator (org.opendaylight.controller.config.manager.impl.jmx.BaseJMXRegistrator)3 Before (org.junit.Before)2 HashMap (java.util.HashMap)1 InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 MBeanServer (javax.management.MBeanServer)1 ConfigRegistryJMXRegistrator (org.opendaylight.controller.config.manager.impl.jmx.ConfigRegistryJMXRegistrator)1 JMXNotifierConfigRegistry (org.opendaylight.controller.config.manager.impl.jmx.JMXNotifierConfigRegistry)1 TransactionJMXRegistrator (org.opendaylight.controller.config.manager.impl.jmx.TransactionJMXRegistrator)1 TransactionModuleJMXRegistrator (org.opendaylight.controller.config.manager.impl.jmx.TransactionModuleJMXRegistrator)1 BindingContextProvider (org.opendaylight.controller.config.manager.impl.osgi.mapping.BindingContextProvider)1 TestingRuntimeBean (org.opendaylight.controller.config.manager.impl.runtimembean.TestingRuntimeBean)1 ConfigRegistryJMXClient (org.opendaylight.controller.config.util.ConfigRegistryJMXClient)1 ClassLoadingStrategy (org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy)1 SchemaContextProvider (org.opendaylight.yangtools.yang.model.api.SchemaContextProvider)1