[jboss-cvs] JBossAS SVN: r68400 - trunk/testsuite/src/main/org/jboss/test/profileservice/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 19 01:01:52 EST 2007


Author: scott.stark at jboss.org
Date: 2007-12-19 01:01:52 -0500 (Wed, 19 Dec 2007)
New Revision: 68400

Modified:
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Update stats test to validate statistic managed properties exist

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-12-19 05:59:42 UTC (rev 68399)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2007-12-19 06:01:52 UTC (rev 68400)
@@ -29,6 +29,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.io.Serializable;
+import java.lang.annotation.Annotation;
+
 import javax.naming.InitialContext;
 
 import junit.framework.Test;
@@ -40,6 +42,8 @@
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment;
 import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedOperation;
 import org.jboss.managed.api.ManagedProperty;
@@ -295,7 +299,7 @@
    }
 
    /**
-    * TODO: JBAS-4658
+    * Query for the ComponentType("JMSDestination", "Queue"/"Topic") types.
     * @throws Exception
     */
    public void testJmsDestinationComponents()
@@ -343,6 +347,35 @@
       // TODO: Query the profile service repository for the overriden data
    }
 
+   public void testDefaultDSStats()
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+      ComponentType type = new ComponentType("DataSource", "LocalTx");
+      ManagedComponent hsqldb = getManagedComponent(mgtView, type, "DefaultDS");
+      Set<ManagedOperation> ops = hsqldb.getOperations();
+      assertNotNull(ops);
+      Map<String,ManagedProperty> props = hsqldb.getProperties();
+      boolean sawStats = false;
+      for(ManagedProperty prop : props.values())
+      {
+         Map<String, Annotation> annotations = prop.getAnnotations();
+         if(annotations == null)
+            continue;
+         ManagementProperty mpa = (ManagementProperty) annotations.get(ManagementProperty.class.getName());
+         ViewUse[] uses = mpa.use();
+         for(ViewUse use : uses)
+         {
+            if(use == ViewUse.STATISTIC)
+            {
+               sawStats = true;
+               log.info("STATISTIC: "+prop);
+            }
+         }
+      }
+      assertTrue("Saw ManagedProperty(ViewUse.STATISTIC)", sawStats);
+   }
+
    /**
     * Validate that the DefaultDS management ops work
     * @throws Exception




More information about the jboss-cvs-commits mailing list