You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "aldettinger (via GitHub)" <gi...@apache.org> on 2023/08/22 09:39:33 UTC

[GitHub] [camel-quarkus] aldettinger commented on a diff in pull request #5210: Micrometer: Message History factory and JMX MicrometerMessageHistory is not covered

aldettinger commented on code in PR #5210:
URL: https://github.com/apache/camel-quarkus/pull/5210#discussion_r1301362792


##########
integration-tests/micrometer/src/test/java/org/apache/camel/quarkus/component/micrometer/it/MicrometerTest.java:
##########
@@ -207,4 +207,46 @@ public void testJMXQuarkusDomain(String domain) throws Exception {
                 .getValue();
         assertTrue(classes > 1);
     }
+
+    @Test
+    @DisabledOnIntegrationTest("https://github.com/apache/camel-quarkus/issues/5209")
+    public void testJMXHistory() throws Exception {
+        //send a message to init history for the route with id `jmxHistory`
+        RestAssured.get("/micrometer/sendJmxHistory")
+                .then()
+                .statusCode(200);
+
+        String contextManagementName = RestAssured.get("/micrometer/getContextManagementName")
+                .then()
+                .statusCode(200)
+                .extract().body().asString();
+
+        // get the message history service using JMX
+        String name = String.format("org.apache.camel:context=%s,type=services,name=MicrometerMessageHistoryService",
+                contextManagementName);
+
+        MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
+
+        ObjectName on = ObjectName.getInstance(name);
+
+        //return json result
+        String json = (String) mBeanServer.invoke(on, "dumpStatisticsAsJson", null, null);
+
+        assertTrue(json.contains("jmxHistory"));
+
+    }
+

Review Comment:
   Is it correct reading that `testJMXHistory` is checking that the service could be accessed through JMX ?
   And that `testHistory` is ensuring that the service could be accessed through the camel context ?
   
   If yes, what about renaming both tests ala:
    + micrometerHistoryShouldBeAvailableThroughJMX
    + micrometerHistoryShouldBeAvailableThroughCamelContext
   
   If make sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org