Merge "Fix warnings in config-manager"
authorTony Tkacik <ttkacik@cisco.com>
Fri, 7 Nov 2014 10:03:30 +0000 (10:03 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 7 Nov 2014 10:03:30 +0000 (10:03 +0000)
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/InterfacesHelper.java
opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/OsgiRegistrationUtil.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/BlankTransactionServiceTrackerTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/BundleContextBackedModuleFactoriesResolverTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/ModuleFactoryBundleTrackerTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/RefreshingSCPModuleInfoRegistryTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/util/InterfacesHelperTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/util/OsgiRegistrationUtilTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/scheduledthreadpool/TestingScheduledThreadPoolModuleFactory.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/scheduledthreadpool/test/TwoInterfacesExportTest.java
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/threadpool/TestingFixedThreadPoolModuleFactory.java

index 4d94c6d2655650ece2f9bcb1a26a3e0b872a7d60..5cb1513d9cfa037448d24937e30dfe0ac9bc5a95 100644 (file)
@@ -7,17 +7,16 @@
  */
 package org.opendaylight.controller.config.manager.impl.util;
 
-import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
-import org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation;
-import org.opendaylight.controller.config.spi.Module;
-import org.opendaylight.controller.config.spi.ModuleFactory;
-
-import javax.management.JMX;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
+import javax.management.JMX;
+import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
+import org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation;
+import org.opendaylight.controller.config.spi.Module;
+import org.opendaylight.controller.config.spi.ModuleFactory;
 
 public class InterfacesHelper {
 
@@ -40,7 +39,7 @@ public class InterfacesHelper {
 
     }
 
-    private static Set<Class<?>> getAllSuperInterfaces(Set<Class<?>> ifcs) {
+    private static Set<Class<?>> getAllSuperInterfaces(final Set<? extends Class<?>> ifcs) {
         Set<Class<?>> interfaces = new HashSet<>(ifcs); // create copy to modify
         // each interface can extend other interfaces
         Set<Class<?>> result = new HashSet<>();
@@ -61,7 +60,7 @@ public class InterfacesHelper {
      * Get interfaces that this class is derived from that are JMX interfaces.
      */
     public static Set<Class<?>> getMXInterfaces(
-            Class<? extends Module> configBeanClass) {
+            final Class<? extends Module> configBeanClass) {
         Set<Class<?>> allInterfaces = getAllInterfaces(configBeanClass);
         Set<Class<?>> result = new HashSet<>();
         for (Class<?> clazz : allInterfaces) {
@@ -78,7 +77,7 @@ public class InterfacesHelper {
      * annotation.
      */
     public static Set<Class<?>> getServiceInterfaces(
-            Class<? extends Module> configBeanClass) {
+            final Class<? extends Module> configBeanClass) {
         Set<Class<?>> allInterfaces = getAllInterfaces(configBeanClass);
         Set<Class<?>> result = new HashSet<>();
         for (Class<?> clazz : allInterfaces) {
@@ -93,7 +92,7 @@ public class InterfacesHelper {
         return result;
     }
 
-    public static Set<Class<? extends AbstractServiceInterface>> getAllAbstractServiceClasses(Class<? extends Module> configBeanClass) {
+    public static Set<Class<? extends AbstractServiceInterface>> getAllAbstractServiceClasses(final Class<? extends Module> configBeanClass) {
 
         Set<Class<? extends AbstractServiceInterface>> foundGeneratedSIClasses = new HashSet<>();
         for (Class<?> clazz : getAllInterfaces(configBeanClass)) {
@@ -111,7 +110,7 @@ public class InterfacesHelper {
      * {@link org.opendaylight.controller.config.api.annotations.ServiceInterfaceAnnotation#osgiRegistrationType()}
      */
     public static Set<Class<?>> getOsgiRegistrationTypes(
-            Class<? extends Module> configBeanClass) {
+            final Class<? extends Module> configBeanClass) {
         Set<Class<?>> serviceInterfaces = getServiceInterfaces(configBeanClass);
         Set<Class<?>> result = new HashSet<>();
         for (Class<?> clazz : serviceInterfaces) {
@@ -122,7 +121,7 @@ public class InterfacesHelper {
         return result;
     }
 
-    public static Set<String> getQNames(Set<ServiceInterfaceAnnotation> siAnnotations) {
+    public static Set<String> getQNames(final Set<ServiceInterfaceAnnotation> siAnnotations) {
         Set<String> qNames = new HashSet<>();
         for (ServiceInterfaceAnnotation sia: siAnnotations) {
             qNames.add(sia.value());
@@ -130,12 +129,12 @@ public class InterfacesHelper {
         return Collections.unmodifiableSet(qNames);
     }
 
-    public static Set<ServiceInterfaceAnnotation> getServiceInterfaceAnnotations(ModuleFactory factory) {
+    public static Set<ServiceInterfaceAnnotation> getServiceInterfaceAnnotations(final ModuleFactory factory) {
         Set<Class<? extends AbstractServiceInterface>> implementedServiceIntefaces = Collections.unmodifiableSet(factory.getImplementedServiceIntefaces());
         return getServiceInterfaceAnnotations(implementedServiceIntefaces);
     }
 
-    private static Set<ServiceInterfaceAnnotation> getServiceInterfaceAnnotations(Set<Class<? extends AbstractServiceInterface>> implementedServiceIntefaces) {
+    private static Set<ServiceInterfaceAnnotation> getServiceInterfaceAnnotations(final Set<Class<? extends AbstractServiceInterface>> implementedServiceIntefaces) {
         Set<Class<? extends AbstractServiceInterface>> inspected = getAllAbstractServiceInterfaceClasses(implementedServiceIntefaces);
         Set<ServiceInterfaceAnnotation> result = new HashSet<>();
         // SIs can form hierarchies, inspect superclass until it does not extend AbstractSI
@@ -149,9 +148,9 @@ public class InterfacesHelper {
     }
 
     static Set<Class<? extends AbstractServiceInterface>> getAllAbstractServiceInterfaceClasses(
-            Set<Class<? extends AbstractServiceInterface>> directlyImplementedAbstractSIs) {
+            final Set<Class<? extends AbstractServiceInterface>> directlyImplementedAbstractSIs) {
 
-        Set<Class<?>> allInterfaces = getAllSuperInterfaces((Set) directlyImplementedAbstractSIs);
+        Set<Class<?>> allInterfaces = getAllSuperInterfaces(directlyImplementedAbstractSIs);
         Set<Class<? extends AbstractServiceInterface>> result = new HashSet<>();
         for(Class<?> ifc: allInterfaces){
             if (AbstractServiceInterface.class.isAssignableFrom(ifc) &&
index f839452dcadb8e1295e8a1669154ea51699af5f5..4f792e72b10ccb826acb99c3d4117b071bdeef84 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.controller.config.manager.impl.util;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.ListIterator;
@@ -27,7 +26,7 @@ public class OsgiRegistrationUtil {
     }
 
     @SafeVarargs
-    public static <T> AutoCloseable registerService(BundleContext bundleContext, T service, Class<? super T> ... interfaces) {
+    public static <T> AutoCloseable registerService(final BundleContext bundleContext, final T service, final Class<? super T> ... interfaces) {
         checkNotNull(service);
         checkNotNull(interfaces);
         List<AutoCloseable> autoCloseableList = new ArrayList<>();
@@ -48,7 +47,7 @@ public class OsgiRegistrationUtil {
         };
     }
 
-    public static AutoCloseable wrap(final BundleTracker bundleTracker) {
+    public static AutoCloseable wrap(final BundleTracker<?> bundleTracker) {
         checkNotNull(bundleTracker);
         return new AutoCloseable() {
             @Override
index 471c98a6769fdde5dffe3f9ddccd454ae9317bfa..8ceee0caf5596b798371436f0f81fc9c2294febc 100644 (file)
@@ -1,14 +1,13 @@
 package org.opendaylight.controller.config.manager.impl.osgi;
 
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertSame;
-import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
-
 import java.util.Collections;
 import javax.management.ObjectName;
 import org.junit.Before;
index dc3deddddc79dfa664232e5f540c74116844a181..44e6e9ab778fc89b063e176a13cdcfdd2ab71103 100644 (file)
@@ -1,13 +1,12 @@
 package org.opendaylight.controller.config.manager.impl.osgi;
 
-import static junit.framework.Assert.fail;
+import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.junit.matchers.JUnitMatchers.containsString;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
-
 import com.google.common.collect.Lists;
 import java.util.Map;
 import org.junit.Before;
@@ -24,8 +23,8 @@ public class BundleContextBackedModuleFactoriesResolverTest {
     @Mock
     private BundleContext bundleContext;
     private BundleContextBackedModuleFactoriesResolver resolver;
-    private ServiceReference s1;
-    private ServiceReference s2;
+    private ServiceReference<?> s1;
+    private ServiceReference<?> s2;
     private ModuleFactory f1;
     private ModuleFactory f2;
 
@@ -42,15 +41,15 @@ public class BundleContextBackedModuleFactoriesResolverTest {
         resolver = new BundleContextBackedModuleFactoriesResolver(bundleContext);
     }
 
-    private ModuleFactory getMockFactory(String name) {
+    private ModuleFactory getMockFactory(final String name) {
         ModuleFactory mock = mock(ModuleFactory.class);
         doReturn(name).when(mock).toString();
         doReturn(name).when(mock).getImplementationName();
         return mock;
     }
 
-    private ServiceReference getServiceRef() {
-        ServiceReference mock = mock(ServiceReference.class);
+    private ServiceReference<?> getServiceRef() {
+        ServiceReference<?> mock = mock(ServiceReference.class);
         doReturn("serviceRef").when(mock).toString();
         final Bundle bundle = mock(Bundle.class);
         doReturn(bundleContext).when(bundle).getBundleContext();
index 5b83412083c359b09c80b5c2caac7d78fec0a16f..25d770e6c9577b11d24651515fc3f432b87eae59 100644 (file)
@@ -1,8 +1,8 @@
 package org.opendaylight.controller.config.manager.impl.osgi;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Matchers.anyString;
@@ -11,10 +11,8 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyZeroInteractions;
-
 import java.util.Dictionary;
 import java.util.Set;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -44,7 +42,7 @@ public class ModuleFactoryBundleTrackerTest {
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
-        doAnswer(new Answer() {
+        doAnswer(new Answer<Object>() {
             @Override
             public Object answer(final InvocationOnMock invocation) throws Throwable {
                 return getClass().getClassLoader().loadClass((String) invocation.getArguments()[0]);
@@ -141,7 +139,7 @@ public class ModuleFactoryBundleTrackerTest {
     }
 
     static class WrongConstructorTestingFactory extends TestingFactory {
-        WrongConstructorTestingFactory(String randomParam) {
+        WrongConstructorTestingFactory(final String randomParam) {
         }
     }
 
index 79391d4343a7d1a6dafa413c5fd18b1e93d8103e..9edb64ac6b8c83b594d85daad5cb3f2d48e6edd7 100644 (file)
@@ -1,5 +1,9 @@
 package org.opendaylight.controller.config.manager.impl.osgi;
 
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import java.util.Dictionary;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.opendaylight.controller.config.manager.impl.osgi.mapping.RefreshingSCPModuleInfoRegistry;
@@ -10,12 +14,6 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
-import java.util.*;
-
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
 public class RefreshingSCPModuleInfoRegistryTest {
     @Test
     public void testConstructor() throws Exception {
@@ -24,8 +22,7 @@ public class RefreshingSCPModuleInfoRegistryTest {
         doReturn("string").when(prov).toString();
 
         BundleContext ctxt = mock(BundleContext.class);
-        Dictionary dict = new Hashtable();
-        ServiceRegistration servReg = mock(ServiceRegistration.class);
+        ServiceRegistration<?> servReg = mock(ServiceRegistration.class);
         doReturn(servReg).when(ctxt).registerService(Mockito.any(Class.class), Mockito.any(SchemaContextProvider.class), Mockito.any(Dictionary.class));
         doReturn(servReg).when(ctxt).registerService(Mockito.anyString(), Mockito.any(Object.class), Mockito.any(Dictionary.class));
         RefreshingSCPModuleInfoRegistry scpreg = new RefreshingSCPModuleInfoRegistry(reg, prov, ctxt);
index 220bef03bc95eab1efbbe54122e7b42cb657927e..4be40a64f5a775e008e13ce592d9d7fdefb3eacb 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.config.manager.impl.util;
 
 import static org.junit.Assert.assertEquals;
-
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Sets;
 import java.util.Collections;
 import java.util.HashSet;
@@ -92,7 +92,7 @@ public class InterfacesHelperTest {
         input.add(clazz);
         Set<Class<? extends AbstractServiceInterface>> result = InterfacesHelper.getAllAbstractServiceInterfaceClasses(input);
 
-        Set<Class<?>> expected = Sets.newHashSet((Class<?>) TestingScheduledThreadPoolServiceInterface.class,
+        Set<Class<?>> expected = ImmutableSet.of((Class<?>) TestingScheduledThreadPoolServiceInterface.class,
                 TestingThreadPoolServiceInterface.class
                 );
         assertEquals(expected, result);
index fb59e3d51554d1f69d3bdc215478daf14a2d88e2..f1efc4787dfc3320fc1017c88f6819caf9f2ad5d 100644 (file)
@@ -4,7 +4,6 @@ import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
-
 import org.junit.Test;
 import org.mockito.InOrder;
 import org.mockito.Mockito;
@@ -37,7 +36,7 @@ public class OsgiRegistrationUtilTest {
         OsgiRegistrationUtil.wrap(serviceReg).close();
         verify(serviceReg).unregister();
 
-        final BundleTracker tracker = mock(BundleTracker.class);
+        final BundleTracker<?> tracker = mock(BundleTracker.class);
         doNothing().when(tracker).close();
         OsgiRegistrationUtil.wrap(tracker).close();
         verify(tracker).close();
@@ -49,7 +48,7 @@ public class OsgiRegistrationUtilTest {
     }
 
     private ServiceRegistration<?> mockServiceRegistration() {
-        ServiceRegistration mock = mock(ServiceRegistration.class);
+        ServiceRegistration<?> mock = mock(ServiceRegistration.class);
         doNothing().when(mock).unregister();
         return mock;
     }
index e5306a4fa60272e23adac53af8f83f5454876b86..d34e73ec4723d8d1fa151b0dfe8f161ec6716b33 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool;
 
-import com.google.common.collect.Sets;
+import com.google.common.collect.ImmutableSet;
+import java.util.HashSet;
+import java.util.Set;
 import org.opendaylight.controller.config.api.DependencyResolver;
 import org.opendaylight.controller.config.api.DependencyResolverFactory;
 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
@@ -19,20 +21,16 @@ import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.osgi.framework.BundleContext;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
 public class TestingScheduledThreadPoolModuleFactory implements ModuleFactory {
     public static final String NAME = "scheduled";
 
-    private static Set<Class<? extends AbstractServiceInterface>> ifc = Collections.unmodifiableSet(Sets.newHashSet(
+    private static Set<Class<? extends AbstractServiceInterface>> ifc = ImmutableSet.of(
             (Class<? extends AbstractServiceInterface>) TestingScheduledThreadPoolServiceInterface.class,
-                    TestingThreadPoolServiceInterface.class));
+                    TestingThreadPoolServiceInterface.class);
 
     @Override
     public boolean isModuleImplementingServiceInterface(
-            Class<? extends AbstractServiceInterface> serviceInterface) {
+            final Class<? extends AbstractServiceInterface> serviceInterface) {
         return ifc.contains(serviceInterface);
     }
 
@@ -42,15 +40,15 @@ public class TestingScheduledThreadPoolModuleFactory implements ModuleFactory {
     }
 
     @Override
-    public Module createModule(String instanceName,
-            DependencyResolver dependencyResolver, BundleContext bundleContext) {
+    public Module createModule(final String instanceName,
+            final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
         return new TestingScheduledThreadPoolModule(new ModuleIdentifier(NAME,
                 instanceName), null, null);
     }
 
     @Override
-    public Module createModule(String instanceName,
-            DependencyResolver dependencyResolver, DynamicMBeanWithInstance old, BundleContext bundleContext)
+    public Module createModule(final String instanceName,
+            final DependencyResolver dependencyResolver, final DynamicMBeanWithInstance old, final BundleContext bundleContext)
             throws Exception {
         TestingScheduledThreadPoolImpl oldInstance;
         try {
@@ -68,7 +66,7 @@ public class TestingScheduledThreadPoolModuleFactory implements ModuleFactory {
     }
 
     @Override
-    public Set<Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext bundleContext) {
+    public Set<Module> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory, final BundleContext bundleContext) {
         return new HashSet<Module>();
     }
 
index ca038f1f1caac171f77c7a3538172c70c7069ed9..9c8b575fe59a799ca13bd10dd3558a2270fa8596 100644 (file)
@@ -7,38 +7,35 @@
  */
 package org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.test;
 
+import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.junit.matchers.JUnitMatchers.containsString;
-
 import javax.annotation.Nullable;
 import javax.management.DynamicMBean;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
 import javax.management.ObjectName;
-
 import org.junit.Test;
 import org.opendaylight.controller.config.api.ValidationException;
 import org.opendaylight.controller.config.api.jmx.ObjectNameUtil;
 import org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPConfigMXBean;
 import org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModuleFactory;
 import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolImpl;
-import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool
-        .TestingScheduledThreadPoolModuleFactory;
+import org.opendaylight.controller.config.manager.testingservices.scheduledthreadpool.TestingScheduledThreadPoolModuleFactory;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 
 public class TwoInterfacesExportTest extends AbstractScheduledTest {
 
-    private void assertExists(String moduleName, String instanceName)
+    private void assertExists(final String moduleName, final String instanceName)
             throws Exception {
         assertExists(null, moduleName, instanceName);
     }
 
-    private void assertExists(@Nullable ConfigTransactionJMXClient transaction,
-            String moduleName, String instanceName)
+    private void assertExists(@Nullable final ConfigTransactionJMXClient transaction,
+            final String moduleName, final String instanceName)
             throws InstanceNotFoundException {
         if (transaction != null) {
             transaction.lookupConfigBean(moduleName, instanceName);
@@ -56,13 +53,13 @@ public class TwoInterfacesExportTest extends AbstractScheduledTest {
         }
     }
 
-    private void assertNotExists(String moduleName, String instanceName) {
+    private void assertNotExists(final String moduleName, final String instanceName) {
         assertNotExists(null, moduleName, instanceName);
     }
 
     private void assertNotExists(
-            @Nullable ConfigTransactionJMXClient transaction,
-            String moduleName, String instanceName) {
+            @Nullable final ConfigTransactionJMXClient transaction,
+            final String moduleName, final String instanceName) {
 
         if (transaction != null) {
             try {
index bec28685576aba673422c32222acafc6aca34a23..d385a7db5a2d007bb6d4320f31d7247a4ecde1c1 100644 (file)
@@ -7,7 +7,9 @@
  */
 package org.opendaylight.controller.config.manager.testingservices.threadpool;
 
-import com.google.common.collect.Sets;
+import com.google.common.collect.ImmutableSet;
+import java.util.HashSet;
+import java.util.Set;
 import org.opendaylight.controller.config.api.DependencyResolver;
 import org.opendaylight.controller.config.api.DependencyResolverFactory;
 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
@@ -19,16 +21,12 @@ import org.opendaylight.controller.config.spi.Module;
 import org.opendaylight.controller.config.spi.ModuleFactory;
 import org.osgi.framework.BundleContext;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
 public class TestingFixedThreadPoolModuleFactory extends AbstractTestingFixedThreadPoolModuleFactory implements ModuleFactory {
     public static final String NAME = "fixed";
 
-    private static Set<Class<? extends AbstractServiceInterface>> ifc = Collections.unmodifiableSet(Sets.newHashSet(
+    private static final Set<Class<? extends AbstractServiceInterface>> ifc = ImmutableSet.of(
             (Class<? extends AbstractServiceInterface>) ModifiableThreadPoolServiceInterface.class,
-            TestingThreadPoolServiceInterface.class));
+            TestingThreadPoolServiceInterface.class);
 
     @Override
     public String getImplementationName() {
@@ -36,15 +34,15 @@ public class TestingFixedThreadPoolModuleFactory extends AbstractTestingFixedThr
     }
 
     @Override
-    public TestingFixedThreadPoolModule createModule(String instanceName,
-            DependencyResolver dependencyResolver, BundleContext bundleContext) {
+    public TestingFixedThreadPoolModule createModule(final String instanceName,
+            final DependencyResolver dependencyResolver, final BundleContext bundleContext) {
         return new TestingFixedThreadPoolModule(new ModuleIdentifier(NAME,
                 instanceName), null, null);
     }
 
     @Override
-    public Module createModule(String instanceName,
-            DependencyResolver dependencyResolver, DynamicMBeanWithInstance old, BundleContext bundleContext)
+    public Module createModule(final String instanceName,
+            final DependencyResolver dependencyResolver, final DynamicMBeanWithInstance old, final BundleContext bundleContext)
             throws Exception {
         int threadCount = (Integer) old.getAttribute("ThreadCount");
         // is the instance compatible?
@@ -65,12 +63,12 @@ public class TestingFixedThreadPoolModuleFactory extends AbstractTestingFixedThr
 
     @Override
     public boolean isModuleImplementingServiceInterface(
-            Class<? extends AbstractServiceInterface> serviceInterface) {
+            final Class<? extends AbstractServiceInterface> serviceInterface) {
         return ifc.contains(serviceInterface);
     }
 
     @Override
-    public Set<Module> getDefaultModules(DependencyResolverFactory dependencyResolverFactory, BundleContext bundleContext) {
+    public Set<Module> getDefaultModules(final DependencyResolverFactory dependencyResolverFactory, final BundleContext bundleContext) {
         return new HashSet<Module>();
     }