use of org.opendaylight.controller.config.manager.testingservices.threadpool.TestingThreadPoolConfigMXBean in project controller by opendaylight.
the class TestingParallelAPSPModule method validate.
@Override
public void validate() {
checkNotNull(threadPoolON, "Parameter 'threadPool' must be set");
dependencyResolver.validateDependency(TestingThreadPoolServiceInterface.class, threadPoolON, threadPoolOnJMXAttribute);
checkState(Strings.isNullOrEmpty(someParam) == false, "Parameter 'SomeParam' is blank");
// check that calling resolveInstance fails
try {
dependencyResolver.resolveInstance(TestingThreadPoolIfc.class, threadPoolON, threadPoolOnJMXAttribute);
throw new RuntimeException("fail");
} catch (final IllegalStateException e) {
checkState("Commit was not triggered".equals(e.getMessage()), e.getMessage());
}
// test retrieving dependent module's attribute
int threadCount;
try {
threadCount = (Integer) dependencyResolver.getAttribute(threadPoolON, "ThreadCount");
} catch (final ReflectionException | InstanceNotFoundException | AttributeNotFoundException | MBeanException e) {
throw new IllegalStateException(e);
}
checkState(threadCount > 0);
TestingThreadPoolConfigMXBean proxy = dependencyResolver.newMXBeanProxy(threadPoolON, TestingThreadPoolConfigMXBean.class);
checkState(threadCount == proxy.getThreadCount());
}
Aggregations