db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1453179 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/management/_Suite.java junit/JDBC.java
Date Wed, 06 Mar 2013 07:31:59 GMT
Author: kahatlen
Date: Wed Mar  6 07:31:59 2013
New Revision: 1453179

URL: http://svn.apache.org/r1453179
Log:
DERBY-6097: Management test suite fails when JMX is not supported

Skip the management tests if JMX is not supported.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/_Suite.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/_Suite.java?rev=1453179&r1=1453178&r2=1453179&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/_Suite.java
Wed Mar  6 07:31:59 2013
@@ -24,6 +24,7 @@ package org.apache.derbyTesting.function
 import junit.framework.Test;
 import junit.framework.TestSuite;
 import org.apache.derbyTesting.junit.BaseTestCase;
+import org.apache.derbyTesting.junit.JDBC;
 
 
 /**
@@ -51,13 +52,16 @@ public class _Suite extends BaseTestCase
 
         TestSuite suite = new TestSuite("management");
 
-        suite.addTest(JMXTest.suite());
-        suite.addTest(ManagementMBeanTest.suite());
-        suite.addTest(InactiveManagementMBeanTest.suite());
-        suite.addTest(VersionMBeanTest.suite());
-        suite.addTest(JDBCMBeanTest.suite());
-        suite.addTest(NetworkServerMBeanTest.suite());
-        suite.addTest(CustomMBeanServerBuilderTest.suite());
+        if (JDBC.vmSupportsJMX()) {
+            suite.addTest(JMXTest.suite());
+            suite.addTest(ManagementMBeanTest.suite());
+            suite.addTest(InactiveManagementMBeanTest.suite());
+            suite.addTest(VersionMBeanTest.suite());
+            suite.addTest(JDBCMBeanTest.suite());
+            suite.addTest(NetworkServerMBeanTest.suite());
+            suite.addTest(CustomMBeanServerBuilderTest.suite());
+        }
+
         return suite;
     }
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java?rev=1453179&r1=1453178&r2=1453179&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBC.java Wed Mar  6 07:31:59
2013
@@ -140,6 +140,13 @@ public class JDBC {
     }
 
     /**
+     * Is javax.management.MBeanServer available? Indicates whether the
+     * JVM supports the Java Management Extensions (JMX).
+     */
+    private static final boolean HAVE_MBEAN_SERVER =
+            haveClass("javax.management.MBeanServer");
+
+    /**
      * Can we load a specific class, use this to determine JDBC level.
      * @param className Class to attempt load on.
      * @return true if class can be loaded, false otherwise.
@@ -210,6 +217,13 @@ public class JDBC {
         return HAVE_REFERENCEABLE;
     }
 
+    /**
+     * Return true if the JVM supports the Java Management Extensions (JMX).
+     */
+    public static boolean vmSupportsJMX() {
+        return HAVE_MBEAN_SERVER;
+    }
+
 	/**
 	 * Rollback and close a connection for cleanup.
 	 * Test code that is expecting Connection.close to succeed



Mime
View raw message