import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.Executor;
-
import javax.management.ObjectName;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
ClassBasedModuleFactory mockedThreadPoolConfigFactory = new ClassBasedModuleFactory(
threadPoolImplementationName, MockedThreadPoolModule.class);
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(
+ super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext,
new TestingParallelAPSPModuleFactory(),
mockedThreadPoolConfigFactory));
}
public static class MockedThreadPoolModule implements Module,
MockedTestingThreadPoolConfigMXBean,
TestingThreadPoolServiceInterface {
- int threadCount;
- public MockedThreadPoolModule() {
- }
+ private final ModuleIdentifier moduleIdentifier;
+
+ int threadCount;
public MockedThreadPoolModule(
- DynamicMBeanWithInstance dynamicMBeanWithInstance) {
+ DynamicMBeanWithInstance dynamicMBeanWithInstance, ModuleIdentifier moduleIdentifier) {
// no reconfiguration / reuse is supported
- }
-
- @Override
- public ModuleIdentifier getName() {
- return new ModuleIdentifier("a", "b");
+ this.moduleIdentifier = moduleIdentifier;
}
@Override
}
+ @Override
+ public boolean canReuse(Module oldModule) {
+ return false;
+ }
+
@Override
public Closeable getInstance() {
return new MockedThreadPool(threadCount);
}
+
+ @Override
+ public ModuleIdentifier getIdentifier() {
+ return moduleIdentifier;
+ }
}
public static class MockedThreadPool implements TestingThreadPoolIfc,
}
@Override
- String getThreadPoolImplementationName() {
+ protected String getThreadPoolImplementationName() {
return threadPoolImplementationName;
}