db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r634433 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management: MBeanTest.java VersionMBeanTest.java
Date Thu, 06 Mar 2008 21:53:52 GMT
Author: djd
Date: Thu Mar  6 13:53:51 2008
New Revision: 634433

URL: http://svn.apache.org/viewvc?rev=634433&view=rev
Log:
DERBY-3385 Improving the VersionMBeanTest by adding fixtures for the derbynet.jar MBean, and
brushing up some comments. 
Contributed by John H. Embretsen Email: John dot Embretsen at Sun dot com

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/VersionMBeanTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java?rev=634433&r1=634432&r2=634433&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/MBeanTest.java
Thu Mar  6 13:53:51 2008
@@ -241,8 +241,9 @@
      */
     protected ObjectName getApplicationManagementMBean() throws Exception
     {
-        // prepare the Management mbean. Use the same ObjectName that Derby uses
-        // by default, to avoid creating multiple instances of the same bean
+        /* prepare the Management mbean, which is (so far) the only MBean that
+         * can be created/registered from a JMX client, and without knowing the
+         * system identifier */
         ObjectName mgmtObjName 
                 = new ObjectName("org.apache.derby", "type", "Management");
         // create/register the MBean. If the same MBean has already been
@@ -263,7 +264,7 @@
     
     /**
      * Get the ObjectName for an MBean registered by Derby for a set of
-     * key properties. The ObjectName has the org.apache.derby and
+     * key properties. The ObjectName has the domain org.apache.derby, and
      * the key property <code>system</code> will be set to the system identifier
      * for the Derby system under test (if Derby is running).
      * @param keyProperties Set of key properties, may be modified by this call.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/VersionMBeanTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/VersionMBeanTest.java?rev=634433&r1=634432&r2=634433&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/VersionMBeanTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/management/VersionMBeanTest.java
Thu Mar  6 13:53:51 2008
@@ -21,19 +21,9 @@
 
 package org.apache.derbyTesting.functionTests.tests.management;
 
-import java.io.InputStream;
-import java.util.ArrayList;
 import java.util.Hashtable;
-
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-
 import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.derbyTesting.junit.NetworkServerTestSetup;
-import org.apache.derbyTesting.junit.SecurityManagerSetup;
-import org.apache.derbyTesting.junit.TestConfiguration;
 
 /**
  * <p>
@@ -58,19 +48,28 @@
     
     public static Test suite() {
         
+        /* The current test fixtures of this class assume that both instances
+         * of the version MBean are accessible, i.e. both for derby.jar and
+         * derbynet.jar. This means that it is assumed that the Network Server
+         * is running and that JMX is enabled. This is being handled by the
+         * super class. */
         return MBeanTest.suite(VersionMBeanTest.class, 
                                         "VersionMBeanTest");
     }
     
     /**
      * <p>
-     * Creates an object name instance for the MBean whose object name's textual
-     * representation is:</p>
-     * <pre>
-     *     org.apache.derby:type=Version,jar=derby.jar
-     * </pre>
+     * Creates an object name instance for the Derby MBean whose object name's 
+     * textual representation includes the following key properties:</p>
+     * <ul>
+     *   <li>type=Version</li>
+     *   <li>jar=derby.jar</li>
+     * </ul>
+     * <p>
+     * The object name may also include other key properties such as a system
+     * identifier (DERBY-3466).</p>
      * @return the object name representing the VersionMBean for the derby 
-     *         engine
+     *         engine in this Derby system.
      * @throws MalformedObjectNameException if the object name is not valid
      */
     private ObjectName getDerbyJarObjectName() 
@@ -83,6 +82,32 @@
         return getDerbyMBeanName(keyProps);
     }
     
+    /**
+     * <p>
+     * Creates an object name instance for the Derby MBean whose object name's 
+     * textual representation includes the following key properties:</p>
+     * <ul>
+     *   <li>type=Version</li>
+     *   <li>jar=derbynet.jar</li>
+     * </ul>
+     * <p>
+     * The object name may also include other key properties such as a system
+     * identifier (DERBY-3466).</p>
+     * @return the object name representing the VersionMBean for the Network 
+     *         Server running the Derby system represented by the system
+     *         identifier obtained from Derby's management service.
+     * @throws MalformedObjectNameException if the object name is not valid
+     */
+    private ObjectName getDerbynetJarObjectName() 
+            throws Exception {
+        
+        // get a reference to the VersionMBean instance for derbynet.jar
+        Hashtable<String, String> keyProps = new Hashtable<String, String>();
+        keyProps.put("type", "Version");
+        keyProps.put("jar", "derbynet.jar");
+        return getDerbyMBeanName(keyProps);
+    }
+    
     //
     // ---------- TEST FIXTURES ------------
     //
@@ -95,42 +120,82 @@
         checkBooleanAttributeValue(getDerbyJarObjectName(), "Alpha");
     }
     
+    public void testDerbynetJarAttributeAlpha() throws Exception {
+        checkBooleanAttributeValue(getDerbynetJarObjectName(), "Alpha");
+    }
+    
     public void testDerbyJarAttributeBeta() throws Exception {
         checkBooleanAttributeValue(getDerbyJarObjectName(), "Beta");
     }
     
+    public void testDerbynetJarAttributeBeta() throws Exception {
+        checkBooleanAttributeValue(getDerbynetJarObjectName(), "Beta");
+    }
+    
     public void testDerbyJarAttributeBuildNumber() throws Exception {
         checkStringAttributeValue(getDerbyJarObjectName(), "BuildNumber");
     }
     
-    // Will fail until the MBean is updated (MaintVersion -> MaintenanceVersion)
+    public void testDerbynetJarAttributeBuildNumber() throws Exception {
+        checkStringAttributeValue(getDerbynetJarObjectName(), "BuildNumber");
+    }
+    
     public void testDerbyJarAttributeMaintenanceVersion() throws Exception {
         checkIntAttributeValue(getDerbyJarObjectName(), "MaintenanceVersion");
     }
     
+    public void testDerbynetJarAttributeMaintenanceVersion() throws Exception {
+        checkIntAttributeValue(getDerbynetJarObjectName(), "MaintenanceVersion");
+    }
+    
     public void testDerbyJarAttributeMajorVersion() throws Exception {
         checkIntAttributeValue(getDerbyJarObjectName(), "MajorVersion");
     }
     
+    public void testDerbynetJarAttributeMajorVersion() throws Exception {
+        checkIntAttributeValue(getDerbynetJarObjectName(), "MajorVersion");
+    }
+    
     public void testDerbyJarAttributeMinorVersion() throws Exception {
         checkIntAttributeValue(getDerbyJarObjectName(), "MinorVersion");
     }
     
+    public void testDerbynetJarAttributeMinorVersion() throws Exception {
+        checkIntAttributeValue(getDerbynetJarObjectName(), "MinorVersion");
+    }
+    
     public void testDerbyJarAttributeProductName() throws Exception {
         checkStringAttributeValue(getDerbyJarObjectName(), "ProductName");
     }
     
+    public void testDerbynetJarAttributeProductName() throws Exception {
+        checkStringAttributeValue(getDerbynetJarObjectName(), "ProductName");
+    }
+    
     public void testDerbyJarAttributeProductTechnologyName() throws Exception {
         checkStringAttributeValue(getDerbyJarObjectName(), 
                                    "ProductTechnologyName");
     }
     
+    public void testDerbynetJarAttributeProductTechnologyName() throws Exception {
+        checkStringAttributeValue(getDerbynetJarObjectName(), 
+                                   "ProductTechnologyName");
+    }
+    
     public void testDerbyJarAttributeProductVendorName() throws Exception {
         checkStringAttributeValue(getDerbyJarObjectName(), "ProductVendorName");
     }
     
+    public void testDerbynetJarAttributeProductVendorName() throws Exception {
+        checkStringAttributeValue(getDerbynetJarObjectName(), "ProductVendorName");
+    }
+    
     public void testDerbyJarAttributeVersionString() throws Exception {
         checkStringAttributeValue(getDerbyJarObjectName(), "VersionString");
     }
-
+    
+    public void testDerbynetJarAttributeVersionString() throws Exception {
+        checkStringAttributeValue(getDerbynetJarObjectName(), "VersionString");
+    }
+    
 }



Mime
View raw message