config-manager: final parameters
[controller.git] / opendaylight / config / config-manager / src / test / java / org / opendaylight / controller / config / manager / testingservices / threadpool / test / SimpleConfigurationTest.java
index c20d3bfc04090bafbc1b4406c03453c7c353f225..d837ffcdb481ade6eb41c7182b521c20232c08d5 100644 (file)
@@ -20,7 +20,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ThreadPoolExecutor;
-import javax.management.DynamicMBean;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
 import javax.management.MBeanException;
@@ -39,6 +38,7 @@ import org.opendaylight.controller.config.manager.impl.factoriesresolver.Hardcod
 import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPool;
 import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolConfigMXBean;
 import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolModuleFactory;
+import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingThreadPoolIfc;
 import org.opendaylight.controller.config.util.ConfigTransactionClient;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
 
@@ -96,7 +96,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
     }
 
     static ObjectName createFixedThreadPool(
-            ConfigTransactionJMXClient transaction)
+            final ConfigTransactionJMXClient transaction)
             throws InstanceAlreadyExistsException, InstanceNotFoundException {
         transaction.assertVersion(0, 1);
 
@@ -131,7 +131,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
     }
 
 
-    private void testValidation(ConfigTransactionClient transaction)
+    private static void testValidation(final ConfigTransactionClient transaction)
             throws InstanceAlreadyExistsException, ReflectionException,
             InstanceNotFoundException, MBeanException, ConflictingVersionException {
         ObjectName fixed1names = transaction.createModule(
@@ -141,7 +141,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
             platformMBeanServer.invoke(fixed1names, "validate", new Object[0],
                     new String[0]);
             fail();
-        } catch (MBeanException e) {
+        } catch (final MBeanException e) {
             Exception targetException = e.getTargetException();
             assertNotNull(targetException);
             assertEquals(ValidationException.class, targetException.getClass());
@@ -151,7 +151,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         try {
             transaction.validateBean(fixed1names);
             fail();
-        } catch (ValidationException e) {
+        } catch (final ValidationException e) {
             for (Map.Entry<String, Map<String, ExceptionMessageWithStackTrace>> exception : e
                     .getFailedValidations().entrySet()) {
                 for (Map.Entry<String, ExceptionMessageWithStackTrace> entry : exception
@@ -166,7 +166,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         try {
             transaction.validateConfig();
             fail();
-        } catch (ValidationException e) {
+        } catch (final ValidationException e) {
             for (Map.Entry<String, Map<String, ExceptionMessageWithStackTrace>> exception : e
                     .getFailedValidations().entrySet()) {
                 for (Map.Entry<String, ExceptionMessageWithStackTrace> entry : exception
@@ -179,7 +179,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         }
         try {
             transaction.commit();
-        } catch (ValidationException e) {
+        } catch (final ValidationException e) {
             for (Map.Entry<String, Map<String, ExceptionMessageWithStackTrace>> exception : e
                     .getFailedValidations().entrySet()) {
                 for (Map.Entry<String, ExceptionMessageWithStackTrace> entry : exception
@@ -249,7 +249,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         try {
             platformMBeanServer.getMBeanInfo(on);
             fail();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             assertTrue(e instanceof InstanceNotFoundException);
         }
     }
@@ -277,8 +277,8 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         checkThreadPools(1, numberOfThreads2);
     }
 
-    private void checkThreadPools(int expectedTotalNumberOfExecutors,
-            int expectedNumberOfThreadsInLastExecutor) {
+    private static void checkThreadPools(final int expectedTotalNumberOfExecutors,
+            final int expectedNumberOfThreadsInLastExecutor) {
         assertEquals(expectedTotalNumberOfExecutors,
                 TestingFixedThreadPool.allExecutors.size());
         for (int i = 0; i < expectedTotalNumberOfExecutors - 1; i++) {
@@ -310,9 +310,8 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
     }
 
     // return MBeanProxy for 'fixed1' and current transaction
-    private TestingFixedThreadPoolConfigMXBean startReconfiguringFixed1ThreadPool(
-            ConfigTransactionJMXClient transaction)
-            throws InstanceNotFoundException {
+    private static TestingFixedThreadPoolConfigMXBean startReconfiguringFixed1ThreadPool(
+            final ConfigTransactionJMXClient transaction) throws InstanceNotFoundException {
         ObjectName fixed1name = transaction.lookupConfigBean(
                 TestingFixedThreadPoolModuleFactory.NAME, fixed1);
 
@@ -332,7 +331,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         try {
             platformMBeanServer.getMBeanInfo(transaction.getObjectName());
             fail();
-        }catch(InstanceNotFoundException e){
+        }catch(final InstanceNotFoundException e){
             assertEquals("org.opendaylight.controller:TransactionName=ConfigTransaction-0-1,type=ConfigTransaction", e.getMessage());
         }
     }
@@ -348,7 +347,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         try {
             transaction1.commit();
             fail();
-        } catch (ConflictingVersionException e) {
+        } catch (final ConflictingVersionException e) {
             assertEquals(
                     "Optimistic lock failed. Expected parent version 2, was 0",
                     e.getMessage());
@@ -366,7 +365,7 @@ public class SimpleConfigurationTest extends AbstractConfigTest {
         try {
             configRegistryClient.commitConfig(transaction1.getObjectName());
             fail();
-        } catch (ConflictingVersionException e) {
+        } catch (final ConflictingVersionException e) {
             assertEquals(
                     "Optimistic lock failed. Expected parent version 2, was 0",
                     e.getMessage());