You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2019/09/20 18:45:53 UTC

[camel] 11/12: CAMEL-13965: Fixed an issue where a test with @EnableRouteCoverage had JMX disabled because of a previous test without @EnableRouteCoverage

This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch CAMEL-13965
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 66212710cde8d09459a8a4614ac70422f2bb0c70
Author: aldettinger <al...@gmail.com>
AuthorDate: Wed Sep 18 16:23:13 2019 +0200

    CAMEL-13965: Fixed an issue where a test with @EnableRouteCoverage had JMX disabled because of a previous test without @EnableRouteCoverage
---
 .../apache/camel/test/spring/junit5/CamelSpringTestContextLoader.java | 4 +++-
 .../test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java   | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelSpringTestContextLoader.java b/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelSpringTestContextLoader.java
index 037babb..50c0be2 100644
--- a/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelSpringTestContextLoader.java
+++ b/components/camel-test-spring-junit5/src/main/java/org/apache/camel/test/spring/junit5/CamelSpringTestContextLoader.java
@@ -274,9 +274,11 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader {
                 System.clearProperty(JmxSystemPropertyKeys.DISABLED);
             }
         } else if (!testClass.isAnnotationPresent(EnableRouteCoverage.class)) {
-            // route coverage need JMX so do not disable it by default
             LOG.info("Disabling Camel JMX globally for tests by default.  Use the DisableJMX annotation to override the default setting.");
             System.setProperty(JmxSystemPropertyKeys.DISABLED, "true");
+        } else {
+            LOG.info("Enabling Camel JMX as DisableJmx annotation was NOT found but EnableRouteCoverage annotation was found.");
+            System.clearProperty(JmxSystemPropertyKeys.DISABLED);
         }
     }
 
diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java
index 8ef5fbe..e49fa8d 100644
--- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java
+++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java
@@ -22,7 +22,6 @@ import org.apache.camel.management.JmxManagementStrategy;
 import org.apache.camel.test.junit5.TestSupport;
 import org.apache.camel.test.spring.junit5.EnableRouteCoverage;
 import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -39,7 +38,6 @@ public class CamelSpringRouteProcessorDumpRouteCoverageTest extends CamelSpringP
 
     @Override
     @Test
-    @Disabled("@TODO: This test passes standalone but fail when run among other. Fix in a dedicated commit.")
     public void testJmx() {
         // JMX is enabled with route coverage
         assertEquals(JmxManagementStrategy.class, camelContext.getManagementStrategy().getClass());