X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Ftestingservices%2Fparallelapsp%2FTestingParallelAPSPModule.java;h=d25956b774b85ac965d68b4ce74a5cbcb6457859;hb=7ce44a14175815c85189845c918454a037f0db10;hp=df6dce124339991a50c0016d30dd87cc76168e88;hpb=4eb724db3877173d502ba38c6d83bec780b38bb2;p=controller.git diff --git a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/TestingParallelAPSPModule.java b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/TestingParallelAPSPModule.java index df6dce1243..d25956b774 100644 --- a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/TestingParallelAPSPModule.java +++ b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/TestingParallelAPSPModule.java @@ -7,32 +7,32 @@ */ package org.opendaylight.controller.config.manager.testingservices.parallelapsp; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; + import com.google.common.base.Strings; +import java.io.Closeable; +import javax.annotation.Nullable; +import javax.annotation.concurrent.NotThreadSafe; +import javax.management.ObjectName; import org.opendaylight.controller.config.api.DependencyResolver; import org.opendaylight.controller.config.api.JmxAttribute; import org.opendaylight.controller.config.api.ModuleIdentifier; import org.opendaylight.controller.config.api.annotations.RequireInterface; import org.opendaylight.controller.config.manager.testingservices.seviceinterface.TestingThreadPoolServiceInterface; +import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingThreadPoolConfigMXBean; import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingThreadPoolIfc; import org.opendaylight.controller.config.spi.Module; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nullable; -import javax.annotation.concurrent.NotThreadSafe; -import javax.management.ObjectName; -import java.io.Closeable; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - /** * Represents service that has dependency to thread pool. */ @NotThreadSafe public class TestingParallelAPSPModule implements Module, TestingParallelAPSPConfigMXBean { - private static final Logger logger = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(TestingParallelAPSPModule.class); private final DependencyResolver dependencyResolver; @@ -102,6 +102,17 @@ public class TestingParallelAPSPModule implements Module, 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 (Exception e) { + throw new IllegalStateException(e); + } + checkState(threadCount > 0); + TestingThreadPoolConfigMXBean proxy = dependencyResolver.newMXBeanProxy(threadPoolON, TestingThreadPoolConfigMXBean.class); + checkState(threadCount == proxy.getThreadCount()); } @Override @@ -114,13 +125,13 @@ public class TestingParallelAPSPModule implements Module, // changing thread pool is not supported boolean reuse = threadPoolInstance == oldInstance.getThreadPool(); if (reuse) { - logger.debug("Reusing old instance"); + LOG.debug("Reusing old instance"); instance = oldInstance; instance.setSomeParam(someParam); } } if (instance == null) { - logger.debug("Creating new instance"); + LOG.debug("Creating new instance"); if (oldCloseable != null) { try { oldCloseable.close();