Author: davsclaus
Date: Tue Mar 23 07:09:25 2010
New Revision: 926480

URL: http://svn.apache.org/viewvc?rev=926480&view=rev
Log:
Disabled JMX when testing by default to speedup unit testing.

Modified:
    
camel/trunk/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosEventNotifierTest.java
    
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
    
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java

Modified: 
camel/trunk/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosEventNotifierTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosEventNotifierTest.java?rev=926480&r1=926479&r2=926480&view=diff
==============================================================================
--- 
camel/trunk/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosEventNotifierTest.java
 (original)
+++ 
camel/trunk/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosEventNotifierTest.java
 Tue Mar 23 07:09:25 2010
@@ -34,6 +34,11 @@ public class NagiosEventNotifierTest ext
 
     private NagiosNscaStub nagios;
 
+    @Override
+    protected boolean useJmx() {
+        return true;
+    }
+
     @Before
     @Override
     public void setUp() throws Exception {

Modified: 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java?rev=926480&r1=926479&r2=926480&view=diff
==============================================================================
--- 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
 (original)
+++ 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/CamelTestSupport.java
 Tue Mar 23 07:09:25 2010
@@ -79,6 +79,12 @@ public abstract class CamelTestSupport e
 
     @Override
     protected void setUp() throws Exception {
+        if (!useJmx()) {
+            disableJMX();
+        } else {
+            enableJMX();
+        }
+
         context = createCamelContext();
         assertValidContext(context);
 
@@ -117,6 +123,15 @@ public abstract class CamelTestSupport e
     }
     
     /**
+     * Whether or not JMX should be used during testing.
+     *
+     * @return <tt>false</tt> by default.
+     */
+    protected boolean useJmx() {
+        return false;
+    }
+
+    /**
      * Lets post process this test instance to process any Camel annotations.
      * Note that using Spring Test or Guice is a more powerful approach.
      */

Modified: 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java?rev=926480&r1=926479&r2=926480&view=diff
==============================================================================
--- 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
 (original)
+++ 
camel/trunk/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java
 Tue Mar 23 07:09:25 2010
@@ -81,6 +81,12 @@ public abstract class CamelTestSupport e
 
     @Before
     public void setUp() throws Exception {
+        if (!useJmx()) {
+            disableJMX();
+        } else {
+            enableJMX();
+        }
+
         context = createCamelContext();
         assertValidContext(context);
 
@@ -121,6 +127,15 @@ public abstract class CamelTestSupport e
     }
 
     /**
+     * Whether or not JMX should be used during testing.
+     *
+     * @return <tt>false</tt> by default.
+     */
+    protected boolean useJmx() {
+        return false;
+    }
+
+    /**
      * Lets post process this test instance to process any Camel annotations.
      * Note that using Spring Test or Guice is a more powerful approach.
      */


Reply via email to