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;
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;
}
static ObjectName createFixedThreadPool(
- ConfigTransactionJMXClient transaction)
+ final ConfigTransactionJMXClient transaction)
throws InstanceAlreadyExistsException, InstanceNotFoundException {
transaction.assertVersion(0, 1);
}
- private void testValidation(ConfigTransactionClient transaction)
+ private static void testValidation(final ConfigTransactionClient transaction)
throws InstanceAlreadyExistsException, ReflectionException,
InstanceNotFoundException, MBeanException, ConflictingVersionException {
ObjectName fixed1names = transaction.createModule(
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());
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
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
}
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
try {
platformMBeanServer.getMBeanInfo(on);
fail();
- } catch (Exception e) {
+ } catch (final Exception e) {
assertTrue(e instanceof InstanceNotFoundException);
}
}
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++) {
}
// 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);
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());
}
}
try {
transaction1.commit();
fail();
- } catch (ConflictingVersionException e) {
+ } catch (final ConflictingVersionException e) {
assertEquals(
"Optimistic lock failed. Expected parent version 2, was 0",
e.getMessage());
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());