[jboss-cvs] JBossAS SVN: r79960 - in trunk: testsuite/src/main/org/jboss/test/profileservice/test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 23 04:32:27 EDT 2008


Author: emuckenhuber
Date: 2008-10-23 04:32:27 -0400 (Thu, 23 Oct 2008)
New Revision: 79960

Modified:
   trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
   trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
Log:
- fix errors at startup and for modified deployments in the profileservice target 
- update the testcase to check that directories are not considered as parent


Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java	2008-10-23 08:15:06 UTC (rev 79959)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java	2008-10-23 08:32:27 UTC (rev 79960)
@@ -505,14 +505,14 @@
          if( apps != null )
          {
             Iterator<VFSDeployment> iter = apps.iterator();
+            int ignoreFlags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.DISABLED;
             while( iter.hasNext() )
             {
                VFSDeployment ctx = iter.next();
                VirtualFile root = ctx.getRoot();
                String name = root.getPathName();
                // Ignore locked or disabled applications
-               int flags = DeploymentContentFlags.LOCKED | DeploymentContentFlags.DISABLED;
-               if(this.hasDeploymentContentFlags(name, DeploymentPhase.APPLICATION, flags))
+               if(this.hasDeploymentContentFlags(name, DeploymentPhase.APPLICATION, ignoreFlags))
                {
                   if(trace)
                      log.trace("Ignoring locked application: "+root);
@@ -546,19 +546,20 @@
             for (File applicationDir : applicationDirs)
             {
                VirtualFile deployDir = getCachedApplicationVF(applicationDir);
-               List<VirtualFile> children = deployDir.getChildren();
-               for(VirtualFile vf : children)
+               ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
+               addedDeployments(added, deployDir);
+               for(VirtualFile vf : added)
                {
-                  String key = vf.toURI().toString();
-                  if( applicationCtxs.containsKey(key) == false )
+                  if(this.hasDeploymentContentFlags(vf.getPathName(), DeploymentPhase.APPLICATION, ignoreFlags))
                   {
-                     VFSDeployment ctx = loadDeploymentData(vf);
-                     ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
-                     modified.add(info);
-                     if(key.startsWith("test"))
-                        log.error("Should not see a test... key");
-                     applicationCtxs.put(key, ctx);
+                     if(trace)
+                        log.trace("Ignoring locked application: "+ vf);
+                     continue;
                   }
+                  VFSDeployment ctx = loadDeploymentData(vf);
+                  ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
+                  modified.add(info);
+                  applicationCtxs.put(ctx.getName(), ctx);
                }
             }
          }
@@ -1001,10 +1002,11 @@
     * @throws IOException
     */
    private void loadApplications(VirtualFile applicationDir)
-      throws IOException
+      throws Exception
    {
-      List<VirtualFile> children = applicationDir.getChildren();
-      for(VirtualFile vf : children)
+      ArrayList<VirtualFile> added = new ArrayList<VirtualFile>();
+      addedDeployments(added, applicationDir);
+      for (VirtualFile vf : added)
       {
          VFSDeployment vfCtx = loadDeploymentData(vf);
          applicationCtxs.put(vfCtx.getName(), vfCtx);
@@ -1012,6 +1014,40 @@
    }
 
    /**
+    * Added deployments for DeploymentPhase.APPLICATION.
+    * 
+    * @param list
+    * @param root
+    * @throws Exception
+    */
+   private void addedDeployments(List<VirtualFile> list, VirtualFile root)
+      throws Exception
+   {
+      List<VirtualFile> components = root.getChildren();
+
+      for (VirtualFile component : components)
+      {
+         String key = component.toURI().toString();
+         if (applicationCtxs.containsKey(key) == true)
+            continue;
+
+         if (component.isLeaf())
+         {
+            list.add(component);
+         }
+         else if (component.getName().indexOf('.') == -1)
+         {
+            // recurse if not '.' in name and recursive search is enabled
+            addedDeployments(list, component);
+         }
+         else
+         {
+            list.add(component);
+         }
+      }
+   }
+
+   /**
     * TODO: this could be dropped since the serialize aspect loads the data
     * @param file
     * @return the deployment

Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2008-10-23 08:15:06 UTC (rev 79959)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ProfileServiceUnitTestCase.java	2008-10-23 08:32:27 UTC (rev 79960)
@@ -30,10 +30,12 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+
 import javax.naming.InitialContext;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
+
 import org.jboss.deployers.spi.management.KnownComponentTypes;
 import org.jboss.deployers.spi.management.KnownDeploymentTypes;
 import org.jboss.deployers.spi.management.ManagementView;
@@ -41,17 +43,16 @@
 import org.jboss.managed.api.DeploymentTemplateInfo;
 import org.jboss.managed.api.ManagedComponent;
 import org.jboss.managed.api.ManagedDeployment;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.managed.api.ManagedObject;
 import org.jboss.managed.api.ManagedOperation;
 import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
 import org.jboss.managed.api.annotation.ManagementProperty;
 import org.jboss.managed.api.annotation.ViewUse;
 import org.jboss.metatype.api.types.SimpleMetaType;
 import org.jboss.metatype.api.values.GenericValue;
 import org.jboss.metatype.api.values.MapCompositeValueSupport;
 import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
 import org.jboss.metatype.api.values.SimpleValueSupport;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.ProfileKey;
@@ -139,20 +140,20 @@
       HashSet<String> simpleNames = new HashSet<String>();
       for (String name : names)
       {
-         String[] paths = name.split("/");
-         if (paths.length < 2)
+         // Look for /server/profileservice/
+         String serverName = "/server/" + getProfileName() + "/";
+         int index = name.indexOf(serverName);
+         if (index == -1)
          {
-            // TODO - fix name inconsistency; JBAS-5883
+            // name inconsistency; JBAS-5883
             log.warn("Inconsistent name: " + name);
             continue;
          }
 
-         // 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);
+         String sname = name.substring(index + serverName.length(), name.length());
+         simpleNames.add(sname);
       }
+      
       log.info("Deployment simple names: " + simpleNames);
       // Validate some well known deployments
       String[] expectedNames = {
@@ -171,7 +172,8 @@
     		"deploy/jboss-xa-jdbc.rar",
     		"deploy/jbossjca-service.xml",
     		"deploy/jbossws.sar/",
-    		"deploy/messaging/",
+            "deploy/messaging/connection-factories-service.xml",
+            "deploy/messaging/destinations-service.xml",
     		"deploy/jms-ra.rar",
     		"deploy/jmx-console.war/",
     		"deploy/jmx-invoker-service.xml",




More information about the jboss-cvs-commits mailing list