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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 20 00:40:58 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-08-20 00:40:58 -0400 (Wed, 20 Aug 2008)
New Revision: 77220

Modified:
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
Update testDeploymentNames to be more precise

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2008-08-20 03:57:58 UTC (rev 77219)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2008-08-20 04:40:58 UTC (rev 77220)
@@ -27,6 +27,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.HashMap;
+import java.util.TreeSet;
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
 
@@ -122,51 +123,65 @@
       assertTrue("keys contains default", keys.contains(defaultKey));
    }
 
+   /**
+    * Validate some of the expected deployment names. This test will have
+    * to be updated as the profile repository format evolves, and descriptors
+    * change.
+    * @throws Exception
+    */
    public void testDeploymentNames()
       throws Exception
    {
       ManagementView mgtView = getManagementView();
       Set<String> names = mgtView.getDeploymentNames();
       log.info("getDeploymentNames, "+names);
-      // Build a set of the simple deployment names
+      /* Build a set of the simple deployment names with their immeadiate
+       * parent directory
+       */
       HashSet<String> simpleNames = new HashSet<String>();
       for (String name : names)
       {
-    	  int index = -1;
-        if (name.endsWith("/"))
-           index = name.lastIndexOf('/', name.length()-2);
-        else
-           index = name.lastIndexOf('/');
-    	  String sname = name.substring(index+1);
-    	  simpleNames.add(sname);
+         String[] paths = name.split("/");
+         // Add back in any trailing '/'
+         if(name.endsWith("/"))
+            paths[paths.length - 1] += "/";
+         String sname = paths[paths.length - 2] + "/" + paths[paths.length - 1];
+    	   simpleNames.add(sname);
       }
       log.info("Deployment simple names: "+simpleNames);
       // Validate some well known deployments
       String[] expectedNames = {
-         "jboss-service.xml",
-         "jbossweb.deployer/",
-    		"ear-deployer-jboss-beans.xml",
-    		"jbossws.deployer/",
-    		"ejb-deployer-jboss-beans.xml",
-    		"ejb3.deployer/",
-    		"jboss-aop-jboss5.deployer/",
-    		"security-deployer-jboss-beans.xml",
-    		"jboss-jca.deployer/",
-    		"hsqldb-ds.xml",
-    		"jboss-local-jdbc.rar",
-    		"jboss-xa-jdbc.rar",
-    		"jbossjca-service.xml",
-    		"jbossws.sar/",
-//    		"jms-ds.xml",
-    		"jms-ra.rar",
-    		"jmx-console.war/",
-    		"jmx-invoker-service.xml",
-    		"jmx-remoting.sar/",
-    		"jsr88-service.xml",
-    		"mail-service.xml"
+         // TODO: JBAS-5689 "conf/bootstrap.xml", 
+         "conf/jboss-service.xml",
+         "deployers/jbossweb.deployer/",
+    		"deployers/ear-deployer-beans.xml",
+    		"deployers/jbossws.deployer/",
+    		"deployers/ejb-deployer-beans.xml",
+    		"deployers/ejb3.deployer/",
+    		"deployers/jboss-aop-jboss5.deployer/",
+    		"deployers/security-deployer-beans.xml",
+    		"deployers/jboss-jca.deployer/",
+    		"deploy/hsqldb-ds.xml",
+    		"deploy/jboss-local-jdbc.rar",
+    		"deploy/jboss-xa-jdbc.rar",
+    		"deploy/jbossjca-service.xml",
+    		"deploy/jbossws.sar/",
+    		"messaging/jms-ds.xml",
+    		"messaging/messaging-beans.xml",
+    		"deploy/jms-ra.rar",
+    		"deploy/jmx-console.war/",
+    		"deploy/jmx-invoker-service.xml",
+    		"deploy/jmx-remoting.sar/",
+    		"deploy/jsr88-service.xml",
+    		"deploy/mail-service.xml"
       };
+      TreeSet<String> missingNames = new TreeSet<String>();
       for (String name : expectedNames)
-    	  assertTrue(name, simpleNames.contains(name));
+      {
+         if(simpleNames.contains(name) == false)
+            missingNames.add(name);
+      }
+      assertEquals("There are no missing names: "+missingNames, 0, missingNames.size());
    }
 
    public void testTemplateNames()




More information about the jboss-cvs-commits mailing list