Remove jolokia dependency from config-subsystem.
[controller.git] / opendaylight / config / config-manager / src / test / java / org / opendaylight / controller / config / manager / testingservices / parallelapsp / test / AbstractParallelAPSPTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.manager.testingservices.parallelapsp.test;
9
10 import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
11 import org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPConfigMXBean;
12 import org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModuleFactory;
13 import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolConfigMXBean;
14 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
15
16 import javax.management.InstanceAlreadyExistsException;
17 import javax.management.ObjectName;
18
19 abstract class AbstractParallelAPSPTest extends AbstractConfigTest {
20     protected final String fixed1 = "fixed1";
21     protected final String apsp1 = "apsp-parallel";
22
23     abstract String getThreadPoolImplementationName();
24
25     protected ObjectName createParallelAPSP(
26             ConfigTransactionJMXClient transaction, ObjectName threadPoolON)
27             throws InstanceAlreadyExistsException {
28         ObjectName apspName = transaction.createModule(
29                 TestingParallelAPSPModuleFactory.NAME, apsp1);
30         TestingParallelAPSPConfigMXBean parallelAPSPConfigProxy = transaction
31                 .newMXBeanProxy(apspName, TestingParallelAPSPConfigMXBean.class);
32         parallelAPSPConfigProxy.setSomeParam("ahoj");
33         parallelAPSPConfigProxy.setThreadPool(threadPoolON);
34         return apspName;
35     }
36
37     protected ObjectName createFixed1(ConfigTransactionJMXClient transaction,
38             int numberOfThreads) throws InstanceAlreadyExistsException {
39         ObjectName name = transaction.createModule(
40                 getThreadPoolImplementationName(), fixed1);
41
42         TestingFixedThreadPoolConfigMXBean fixedConfigProxy = transaction
43                 .newMXBeanProxy(name, TestingFixedThreadPoolConfigMXBean.class);
44         fixedConfigProxy.setThreadCount(numberOfThreads);
45
46         return name;
47     }
48 }