X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Ftestingservices%2Fparallelapsp%2Ftest%2FDependentWiringTest.java;h=e6f54908643d17fe8f5206765327d6bf5dca79af;hp=fd8c8d1df0c7b1b250b0454f91c36b12d0cd1f25;hb=f43b01b81319959b1907e3e04537f5169e7f33d8;hpb=c6e3620a5b02b3993cd0ae7539f5cd0fecf4ba8d diff --git a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/test/DependentWiringTest.java b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/test/DependentWiringTest.java index fd8c8d1df0..e6f5490864 100644 --- a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/test/DependentWiringTest.java +++ b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/parallelapsp/test/DependentWiringTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -33,13 +33,11 @@ import org.opendaylight.controller.config.util.ConfigTransactionJMXClient; public class DependentWiringTest extends AbstractParallelAPSPTest { private final String fixed1 = "fixed1"; - private final String apsp1 = "apsp-parallel"; @Before public void setUp() { super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, - new TestingFixedThreadPoolModuleFactory(), - new TestingParallelAPSPModuleFactory())); + new TestingFixedThreadPoolModuleFactory(), new TestingParallelAPSPModuleFactory())); } @After @@ -56,29 +54,24 @@ public class DependentWiringTest extends AbstractParallelAPSPTest { public void testDependencies() throws Exception { ObjectName apspON; { - ConfigTransactionJMXClient transaction = configRegistryClient - .createTransaction(); + ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction(); // create fixed1 ObjectName threadPoolTransactionON = createFixed1(transaction, TestingParallelAPSPImpl.MINIMAL_NUMBER_OF_THREADS); // create apsp-parallel - ObjectName apspNameTransactionON = createParallelAPSP(transaction, - threadPoolTransactionON); - TestingParallelAPSPConfigMXBean parallelAPSPConfigProxy = transaction - .newMXBeanProxy(apspNameTransactionON, TestingParallelAPSPConfigMXBean.class); + ObjectName apspNameTransactionON = createParallelAPSP(transaction, threadPoolTransactionON); + TestingParallelAPSPConfigMXBean parallelAPSPConfigProxy = transaction.newMXBeanProxy(apspNameTransactionON, + TestingParallelAPSPConfigMXBean.class); parallelAPSPConfigProxy.setSomeParam("");// trigger validation - // failure + // failure try { transaction.validateConfig(); fail(); - } catch (ValidationException e) { - for (Map.Entry> exception : e - .getFailedValidations().entrySet()) { - for (Map.Entry entry : exception - .getValue().entrySet()) { - assertThat( - entry.getValue().getMessage(), - containsString("Parameter 'SomeParam' is blank")); + } catch (final ValidationException e) { + for (Map.Entry> exception : e.getFailedValidations() + .entrySet()) { + for (Map.Entry entry : exception.getValue().entrySet()) { + assertThat(entry.getValue().getMessage(), containsString("Parameter 'SomeParam' is blank")); } } } @@ -87,14 +80,12 @@ public class DependentWiringTest extends AbstractParallelAPSPTest { try { transaction.commit(); fail(); - } catch (ValidationException e) { - for (Map.Entry> exception : e - .getFailedValidations().entrySet()) { - for (Map.Entry entry : exception - .getValue().entrySet()) { + } catch (final ValidationException e) { + for (Map.Entry> exception : e.getFailedValidations() + .entrySet()) { + for (Map.Entry entry : exception.getValue().entrySet()) { String err = entry.getValue().getMessage(); - assertTrue("Unexpected error message: " + err, - err.contains("Parameter 'SomeParam' is blank")); + assertTrue("Unexpected error message: " + err, err.contains("Parameter 'SomeParam' is blank")); } } } @@ -102,35 +93,30 @@ public class DependentWiringTest extends AbstractParallelAPSPTest { parallelAPSPConfigProxy.setSomeParam("abc");// fix validation // failure transaction.commit(); - apspON = ObjectNameUtil - .withoutTransactionName(apspNameTransactionON); + apspON = ObjectNameUtil.withoutTransactionName(apspNameTransactionON); } // test reported apsp number of threads - TestingParallelAPSPConfigMXBean parallelAPSPRuntimeProxy = configRegistryClient - .newMXBeanProxy(apspON, TestingParallelAPSPConfigMXBean.class); - assertEquals( - (Integer) TestingParallelAPSPImpl.MINIMAL_NUMBER_OF_THREADS, + TestingParallelAPSPConfigMXBean parallelAPSPRuntimeProxy = configRegistryClient.newMXBeanProxy(apspON, + TestingParallelAPSPConfigMXBean.class); + assertEquals((Integer) TestingParallelAPSPImpl.MINIMAL_NUMBER_OF_THREADS, parallelAPSPRuntimeProxy.getMaxNumberOfThreads()); // next transaction - recreate new thread pool int newNumberOfThreads = TestingParallelAPSPImpl.MINIMAL_NUMBER_OF_THREADS * 2; { // start new transaction - ConfigTransactionJMXClient transaction = configRegistryClient - .createTransaction(); - ObjectName threadPoolNames_newTx = transaction.lookupConfigBean( - getThreadPoolImplementationName(), fixed1); + ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction(); + ObjectName threadPoolNamesNewTx = + transaction.lookupConfigBean(getThreadPoolImplementationName(), fixed1); TestingFixedThreadPoolConfigMXBean fixedConfigTransactionProxy = transaction - .newMXBeanProxy(threadPoolNames_newTx, TestingFixedThreadPoolConfigMXBean.class); + .newMXBeanProxy(threadPoolNamesNewTx, TestingFixedThreadPoolConfigMXBean.class); fixedConfigTransactionProxy.setThreadCount(newNumberOfThreads); transaction.commit(); } // new reference should be copied to apsp-parallel - assertEquals((Integer) newNumberOfThreads, - parallelAPSPRuntimeProxy.getMaxNumberOfThreads()); - + assertEquals((Integer) newNumberOfThreads, parallelAPSPRuntimeProxy.getMaxNumberOfThreads()); } @Test @@ -139,10 +125,9 @@ public class DependentWiringTest extends AbstractParallelAPSPTest { ObjectName threadPoolON = createFixed1(transaction, 10); transaction.lookupConfigBean(getThreadPoolImplementationName(), fixed1); String refName = "ref"; - ObjectName serviceReferenceON = transaction.saveServiceReference(TestingThreadPoolServiceInterface.QNAME, refName, - threadPoolON); + ObjectName serviceReferenceON = transaction.saveServiceReference(TestingThreadPoolServiceInterface.QNAME, + refName, threadPoolON); createParallelAPSP(transaction, serviceReferenceON); transaction.commit(); - } }