X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Futil%2FLookupTest.java;h=3bc362b38c8bc9d0fa9b8e8ebb48185f72f1b07d;hb=ad587084842de7086a54e57a3152bf3232a30702;hp=52e934583e4db9612e5dc423e0408b5902fff8b9;hpb=0d36679800f7476120476ba371e62d16b17509f6;p=controller.git diff --git a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java index 52e934583e..3bc362b38c 100644 --- a/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java +++ b/opendaylight/config/config-util/src/test/java/org/opendaylight/controller/config/util/LookupTest.java @@ -7,20 +7,8 @@ */ package org.opendaylight.controller.config.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.lang.management.ManagementFactory; -import java.lang.reflect.Method; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import javax.management.InstanceNotFoundException; -import javax.management.MBeanServer; -import javax.management.ObjectName; - +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Sets; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -28,35 +16,40 @@ import org.opendaylight.controller.config.api.ConfigRegistry; import org.opendaylight.controller.config.api.LookupRegistry; import org.opendaylight.controller.config.api.jmx.ConfigTransactionControllerMXBean; import org.opendaylight.controller.config.api.jmx.ObjectNameUtil; -import org.opendaylight.controller.config.util.jolokia.ConfigRegistryJolokiaClient; -import org.opendaylight.controller.config.util.jolokia.ConfigTransactionJolokiaClient; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Sets; +import javax.management.InstanceNotFoundException; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import java.lang.management.ManagementFactory; +import java.lang.reflect.Method; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; public class LookupTest { - private String jolokiaURL; private TestingConfigRegistry testingRegistry; private ObjectName testingRegistryON; private final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); - private ConfigRegistryClient jmxRegistryClient, jolokiaRegistryClient; + private ConfigRegistryClient jmxRegistryClient; private ConfigTransactionControllerMXBean testingTransactionController; private ObjectName testingTransactionControllerON; - private ConfigTransactionClient jmxTransactionClient, - jolokiaTransactionClient; + private ConfigTransactionClient jmxTransactionClient; Map> lookupProvidersToClients; @Before public void setUp() throws Exception { - jolokiaURL = JolokiaHelper.startTestingJolokia(); testingRegistry = new TestingConfigRegistry(); testingRegistryON = ConfigRegistry.OBJECT_NAME; mbs.registerMBean(testingRegistry, testingRegistryON); jmxRegistryClient = new ConfigRegistryJMXClient( ManagementFactory.getPlatformMBeanServer()); - jolokiaRegistryClient = new ConfigRegistryJolokiaClient(jolokiaURL); + testingTransactionController = new TestingConfigTransactionController(); testingTransactionControllerON = new ObjectName( @@ -68,16 +61,15 @@ public class LookupTest { jmxTransactionClient = new ConfigTransactionJMXClient(null, testingTransactionControllerON, ManagementFactory.getPlatformMBeanServer()); - jolokiaTransactionClient = new ConfigTransactionJolokiaClient( - jolokiaURL, testingTransactionControllerON, null); - HashSet registryClients = Sets.newHashSet(jmxRegistryClient, jolokiaRegistryClient); - HashSet configTransactionClients = Sets.newHashSet(jmxTransactionClient, jolokiaTransactionClient); - lookupProvidersToClients = ImmutableMap.of((LookupRegistry) testingRegistry, registryClients, testingTransactionController, configTransactionClients); + + HashSet registryClients = Sets.newHashSet(jmxRegistryClient); + HashSet configTransactionClients = Sets.newHashSet(jmxTransactionClient); + lookupProvidersToClients = ImmutableMap.of((LookupRegistry) testingRegistry, registryClients, + testingTransactionController, configTransactionClients); } @After public void cleanUp() throws Exception { - JolokiaHelper.stopJolokia(); mbs.unregisterMBean(testingRegistryON); mbs.unregisterMBean(testingTransactionControllerON); } @@ -101,8 +93,7 @@ public class LookupTest { public void testLookupConfigBeans2() throws Exception { Method method = LookupRegistry.class.getMethod("lookupConfigBeans", String.class, String.class); - Object[] args = new Object[] { TestingConfigRegistry.moduleName1, - TestingConfigRegistry.instName1 }; + Object[] args = new Object[] { TestingConfigRegistry.moduleName1, TestingConfigRegistry.instName1 }; test(method, args); } @@ -110,8 +101,7 @@ public class LookupTest { public void testLookupConfigBean() throws Exception { Method method = LookupRegistry.class.getMethod("lookupConfigBean", String.class, String.class); - Object[] args = new Object[] { TestingConfigRegistry.moduleName1, - TestingConfigRegistry.instName1 }; + Object[] args = new Object[] { TestingConfigRegistry.moduleName1, TestingConfigRegistry.instName1 }; test(method, args); }