config-manager: final parameters
[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 javax.management.InstanceAlreadyExistsException;
11 import javax.management.ObjectName;
12 import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
13 import org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPConfigMXBean;
14 import org.opendaylight.controller.config.manager.testingservices.parallelapsp.TestingParallelAPSPModuleFactory;
15 import org.opendaylight.controller.config.manager.testingservices.threadpool.TestingFixedThreadPoolConfigMXBean;
16 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
17
18 public abstract class AbstractParallelAPSPTest extends AbstractConfigTest {
19     protected final String fixed1 = "fixed1";
20     protected final String apsp1 = "apsp-parallel";
21
22     protected abstract String getThreadPoolImplementationName();
23
24     protected ObjectName createParallelAPSP(
25             final ConfigTransactionJMXClient transaction, final ObjectName threadPoolON)
26             throws InstanceAlreadyExistsException {
27         ObjectName apspName = transaction.createModule(
28                 TestingParallelAPSPModuleFactory.NAME, apsp1);
29         TestingParallelAPSPConfigMXBean parallelAPSPConfigProxy = transaction
30                 .newMXBeanProxy(apspName, TestingParallelAPSPConfigMXBean.class);
31         parallelAPSPConfigProxy.setSomeParam("ahoj");
32         parallelAPSPConfigProxy.setThreadPool(threadPoolON);
33         return apspName;
34     }
35
36     protected ObjectName createFixed1(final ConfigTransactionJMXClient transaction,
37             final int numberOfThreads) throws InstanceAlreadyExistsException {
38
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 }