Search in sources :

Example 1 with TestingFixedThreadPoolModuleFactory

use of org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory in project controller by opendaylight.

the class ConfigRegistryImplTest method testFailOnTwoFactoriesExportingSameImpl.

@Test
@SuppressWarnings("IllegalCatch")
public void testFailOnTwoFactoriesExportingSameImpl() {
    ModuleFactory factory = new TestingFixedThreadPoolModuleFactory();
    BundleContext context = mock(BundleContext.class);
    ConfigRegistryImpl configRegistry = null;
    try {
        ModuleFactoriesResolver resolver = new HardcodedModuleFactoriesResolver(mock(BundleContext.class), factory, factory);
        configRegistry = new ConfigRegistryImpl(resolver, ManagementFactory.getPlatformMBeanServer(), null);
        configRegistry.beginConfig();
        fail();
    } catch (final IllegalArgumentException e) {
        assertTrue(e.getMessage(), e.getMessage().startsWith("Module name is not unique. Found two conflicting factories with same name " + "'fixed':"));
        verifyZeroInteractions(context);
    } finally {
        try {
            configRegistry.close();
        } catch (final Exception e) {
            // ignore
            LOG.warn("Ignoring exception", e);
        }
    }
}
Also used : TestingFixedThreadPoolModuleFactory(org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory) ModuleFactory(org.opendaylight.controller.config.spi.ModuleFactory) TestingFixedThreadPoolModuleFactory(org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory) ModuleFactoriesResolver(org.opendaylight.controller.config.manager.impl.factoriesresolver.ModuleFactoriesResolver) HardcodedModuleFactoriesResolver(org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver) ConfigRegistryImpl(org.opendaylight.controller.config.manager.impl.ConfigRegistryImpl) HardcodedModuleFactoriesResolver(org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver) BundleContext(org.osgi.framework.BundleContext) Test(org.junit.Test) AbstractLockedPlatformMBeanServerTest(org.opendaylight.controller.config.manager.impl.AbstractLockedPlatformMBeanServerTest)

Example 2 with TestingFixedThreadPoolModuleFactory

use of org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory in project controller by opendaylight.

the class AbstractScheduledTest method setUp.

@Before
public final void setUp() {
    assertEquals(0, TestingScheduledThreadPoolImpl.getNumberOfCloseMethodCalls());
    super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new TestingScheduledThreadPoolModuleFactory(), new TestingFixedThreadPoolModuleFactory(), new TestingParallelAPSPModuleFactory()));
}
Also used : TestingFixedThreadPoolModuleFactory(org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory) TestingParallelAPSPModuleFactory(org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModuleFactory) TestingScheduledThreadPoolModuleFactory(org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory) HardcodedModuleFactoriesResolver(org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver) Before(org.junit.Before)

Example 3 with TestingFixedThreadPoolModuleFactory

use of org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory in project controller by opendaylight.

the class AbstractDynamicWrapperTest method registerToJMX.

@Before
public void registerToJMX() throws Exception {
    internalServer = MBeanServerFactory.createMBeanServer();
    TestingFixedThreadPoolModuleFactory testingFixedThreadPoolConfigBeanFactory = new TestingFixedThreadPoolModuleFactory();
    threadPoolConfigBean = testingFixedThreadPoolConfigBeanFactory.createModule("", null, null);
    threadPoolConfigBean.setThreadCount(threadCount);
    AbstractDynamicWrapper dynamicWrapper = getDynamicWrapper(threadPoolConfigBean, MODULE_IDENTIFIER);
    platformMBeanServer.registerMBean(dynamicWrapper, threadPoolDynamicWrapperON);
}
Also used : TestingFixedThreadPoolModuleFactory(org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory) Before(org.junit.Before)

Aggregations

TestingFixedThreadPoolModuleFactory (org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory)3 Before (org.junit.Before)2 HardcodedModuleFactoriesResolver (org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver)2 Test (org.junit.Test)1 AbstractLockedPlatformMBeanServerTest (org.opendaylight.controller.config.manager.impl.AbstractLockedPlatformMBeanServerTest)1 ConfigRegistryImpl (org.opendaylight.controller.config.manager.impl.ConfigRegistryImpl)1 ModuleFactoriesResolver (org.opendaylight.controller.config.manager.impl.factoriesresolver.ModuleFactoriesResolver)1 TestingParallelAPSPModuleFactory (org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModuleFactory)1 TestingScheduledThreadPoolModuleFactory (org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory)1 ModuleFactory (org.opendaylight.controller.config.spi.ModuleFactory)1 BundleContext (org.osgi.framework.BundleContext)1