Remove yang-test
[controller.git] / opendaylight / config / config-util / src / test / java / org / opendaylight / controller / config / util / LookupTest.java
index 52e934583e4db9612e5dc423e0408b5902fff8b9..9a6f931afdd0e1ac6752e944da117bf95631ab1b 100644 (file)
@@ -10,17 +10,17 @@ package org.opendaylight.controller.config.util;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
 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 org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -28,35 +28,27 @@ 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;
 
 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<LookupRegistry, ? extends Set<? extends LookupRegistry>> 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 +60,15 @@ public class LookupTest {
         jmxTransactionClient = new ConfigTransactionJMXClient(null,
                 testingTransactionControllerON,
                 ManagementFactory.getPlatformMBeanServer());
-        jolokiaTransactionClient = new ConfigTransactionJolokiaClient(
-                jolokiaURL, testingTransactionControllerON, null);
-        HashSet<ConfigRegistryClient> registryClients = Sets.newHashSet(jmxRegistryClient, jolokiaRegistryClient);
-        HashSet<ConfigTransactionClient> configTransactionClients = Sets.newHashSet(jmxTransactionClient, jolokiaTransactionClient);
-        lookupProvidersToClients = ImmutableMap.of((LookupRegistry) testingRegistry, registryClients,                testingTransactionController, configTransactionClients);
+
+        HashSet<ConfigRegistryClient> registryClients = Sets.newHashSet(jmxRegistryClient);
+        HashSet<ConfigTransactionClient> 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 +92,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,12 +100,11 @@ 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);
     }
 
-    private void test(Method method, Object[] args) throws Exception {
+    private void test(final Method method, final Object[] args) throws Exception {
         for (Entry<LookupRegistry, ? extends Set<? extends LookupRegistry>> entry : lookupProvidersToClients
                 .entrySet()) {
             Object expected = method.invoke(entry.getKey(), args);
@@ -136,7 +125,7 @@ public class LookupTest {
                     client.lookupConfigBean(
                             InstanceNotFoundException.class.getSimpleName(), "");
                     fail(client.toString());
-                } catch (InstanceNotFoundException e) {
+                } catch (final InstanceNotFoundException e) {
 
                 }
             }