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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 22 16:34:10 EST 2008


Author: scott.stark at jboss.org
Date: 2008-02-22 16:34:10 -0500 (Fri, 22 Feb 2008)
New Revision: 70042

Modified:
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Validate that the default ds stats have non-null values

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2008-02-22 17:16:16 UTC (rev 70041)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2008-02-22 21:34:10 UTC (rev 70042)
@@ -21,6 +21,7 @@
   */
 package org.jboss.test.profileservice.test;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
@@ -381,7 +382,7 @@
       ComponentType type = new ComponentType("DataSource", "LocalTx");
       ManagedComponent hsqldb = mgtView.getComponent("DefaultDS", type);
       Map<String,ManagedProperty> props = hsqldb.getProperties();
-      boolean sawStats = false;
+      ArrayList<ManagedProperty> stats = new ArrayList<ManagedProperty>();
       for(ManagedProperty prop : props.values())
       {
          Map<String, Annotation> annotations = prop.getAnnotations();
@@ -393,12 +394,21 @@
          {
             if(use == ViewUse.STATISTIC)
             {
-               sawStats = true;
                log.info("STATISTIC: "+prop);
+               stats.add(prop);
             }
          }
       }
-      assertTrue("Saw ManagedProperty(ViewUse.STATISTIC)", sawStats);
+      assertTrue("Saw ManagedProperty(ViewUse.STATISTIC)", stats.size() > 0);
+      HashSet<String> nullStats = new HashSet<String>();
+      // These should also have non-null values
+      for(ManagedProperty stat : stats)
+      {
+         Object value = stat.getValue();
+         if(value == null)
+            nullStats.add(stat.getName());
+      }
+      assertTrue("There are no null stats: "+nullStats, nullStats.size() == 0);
    }
 
    /**




More information about the jboss-cvs-commits mailing list