-
- @Test
- public void testUsingJolokia() throws Exception {
-
- ConfigTransactionJolokiaClient transactionClient = configRegistryJolokiaClient
- .createTransaction();
- // fixed1
- ObjectName fixed1ON = transactionClient.createModule(
- getThreadPoolImplementationName(), fixed1);
- transactionClient.setAttribute(fixed1ON, "ThreadCount",
- TestingParallelAPSPImpl.MINIMAL_NUMBER_OF_THREADS);
-
- // apsp-parallel with syntetic attrib
- String threadPoolString = "ThreadPool";
- ObjectName apsp1ON = transactionClient.createModule(
- TestingParallelAPSPModuleFactory.NAME, apsp1);
- transactionClient.setAttribute(apsp1ON, threadPoolString, fixed1ON);
- // check
- assertEquals(ObjectNameUtil.withoutTransactionName(fixed1ON),
- transactionClient.getAttributeON(apsp1ON, threadPoolString));
- transactionClient.setAttribute(apsp1ON, "SomeParam", "ahoj");
-
- // commit
- transactionClient.commit();
- // check thread pool
- assertEquals(1, TestingFixedThreadPool.allExecutors.size());
- // check platform MBeanServer
- ObjectName apspReadOnlyON = ObjectNameUtil
- .withoutTransactionName(apsp1ON);
- JSONObject threadPoolONJson = (JSONObject) configRegistryJolokiaClient
- .getAttribute(apspReadOnlyON, threadPoolString);
- ObjectName fixed1ReadOnlyON = ObjectNameUtil
- .withoutTransactionName(fixed1ON);
- assertEquals(fixed1ReadOnlyON, ObjectNameUtil.createON(threadPoolONJson
- .get("objectName").toString()));
- assertEquals(fixed1ReadOnlyON,
- configRegistryJolokiaClient.getAttributeON(apspReadOnlyON,
- threadPoolString));
-
- }