[jboss-cvs] JBossAS SVN: r87432 - in branches/Branch_5_x: server/src/etc/conf/all/bootstrap and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 16 10:33:50 EDT 2009


Author: alesj
Date: 2009-04-16 10:33:50 -0400 (Thu, 16 Apr 2009)
New Revision: 87432

Added:
   branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/IncludeExcludeVisitorAttributes.java
Modified:
   branches/Branch_5_x/component-matrix/pom.xml
   branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml
   branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
Log:
Update to use the latest MC Ms.
Introduce synch checker for JBAS-6590.

Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml	2009-04-16 14:24:37 UTC (rev 87431)
+++ branches/Branch_5_x/component-matrix/pom.xml	2009-04-16 14:33:50 UTC (rev 87432)
@@ -56,13 +56,13 @@
     <version.org.jboss.aspects.transaction>1.0.0.GA</version.org.jboss.aspects.transaction>
     <version.org.jboss.cache.core>3.1.0.CR1</version.org.jboss.cache.core>
     <version.org.jboss.cache.pojo>3.0.0.GA</version.org.jboss.cache.pojo>
-    <version.org.jboss.cl>2.2.0.M3</version.org.jboss.cl>
+    <version.org.jboss.cl>2.2.0.M4</version.org.jboss.cl>
     <version.org.jboss.cluster.cache.jbc>2.0.0.CR1</version.org.jboss.cluster.cache.jbc>
     <version.org.jboss.cluster.cache.spi>2.0.0.GA</version.org.jboss.cluster.cache.spi>
     <version.org.jboss.cluster.client>1.1.1.GA</version.org.jboss.cluster.client>
     <version.org.jboss.cluster.server.api>1.1.0.GA</version.org.jboss.cluster.server.api>
     <version.org.jboss.common.core>2.2.12.GA</version.org.jboss.common.core>
-    <version.org.jboss.deployers>2.2.0.M1</version.org.jboss.deployers>
+    <version.org.jboss.deployers>2.2.0.M2</version.org.jboss.deployers>
     <version.org.jboss.ejb3.common.client>1.0.0</version.org.jboss.ejb3.common.client>
     <version.org.jboss.ejb3.core.client>1.1.4</version.org.jboss.ejb3.core.client>
     <version.org.jboss.ejb3.proxy.client>1.0.1</version.org.jboss.ejb3.proxy.client>
@@ -84,7 +84,7 @@
     <version.org.jboss.remoting>2.5.0.SP2</version.org.jboss.remoting>
     <version.org.jboss.security>2.0.3.SP1</version.org.jboss.security>
     <version.org.jboss.threads>1.0.0.CR4</version.org.jboss.threads>
-    <version.org.jboss.vfs>2.2.0.M1</version.org.jboss.vfs>
+    <version.org.jboss.vfs>2.2.0.M2</version.org.jboss.vfs>
     <version.org.jboss.xnio.metadata>1.0.0.CR1</version.org.jboss.xnio.metadata>
     <version.org.jboss.xnio>1.2.1.GA</version.org.jboss.xnio>
     <version.org.springframework>2.5.5</version.org.springframework>

Modified: branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml	2009-04-16 14:24:37 UTC (rev 87431)
+++ branches/Branch_5_x/server/src/etc/conf/all/bootstrap/profile.xml	2009-04-16 14:33:50 UTC (rev 87432)
@@ -81,7 +81,8 @@
     <destroy method="flush"/>
   </bean>
 
-  <bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
+  <!-- This just checks metadata locations -->
+  <bean name="MetaDataStructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
     <constructor>
       <parameter><inject bean="MainDeployer" /></parameter>
     </constructor>
@@ -89,6 +90,36 @@
     <property name="filter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
   </bean>
 
+  <!-- Synchs modifed files -->
+  <bean name="SynchAdapter" class="org.jboss.deployers.vfs.spi.structure.modified.OverrideSynchAdapter"/>
+
+  <!-- We just visit wars, but exclude classes, lib, dev dirs -->
+  <bean name="WebVisitorAttributes" class="org.jboss.system.server.profile.basic.IncludeExcludeVisitorAttributes">
+    <constructor>
+      <parameter>
+        <set>
+          <value>.war</value>
+        </set>
+      </parameter>
+      <parameter>
+        <set>
+          <value>WEB-INF/classes</value>
+          <value>WEB-INF/lib</value>
+          <value>WEB-INF/dev</value>
+        </set>
+      </parameter>
+    </constructor>
+  </bean>
+
+  <bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.SynchWrapperModificationChecker">
+    <constructor>
+      <parameter><inject bean="MetaDataStructureModificationChecker"/></parameter>
+      <parameter><inject bean="SynchAdapter"/></parameter>
+    </constructor>
+    <property name="originalAttributes"><inject bean="WebVisitorAttributes"/></property>
+    <property name="tempAttributes"><inject bean="WebVisitorAttributes"/></property>
+  </bean>
+
 	<bean name="BasicProfileFactory" class="org.jboss.system.server.profileservice.repository.BasicProfileFactory">
 		<property name="profileRepository"><inject bean="ProfileRepositoryFactory" /></property>
 	</bean>

Modified: branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml
===================================================================
--- branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml	2009-04-16 14:24:37 UTC (rev 87431)
+++ branches/Branch_5_x/server/src/etc/conf/default/bootstrap/profile.xml	2009-04-16 14:33:50 UTC (rev 87432)
@@ -72,7 +72,8 @@
     <destroy method="flush"/>
   </bean>
 
-  <bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
+  <!-- This just checks metadata locations -->
+  <bean name="MetaDataStructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker">
     <constructor>
       <parameter><inject bean="MainDeployer" /></parameter>
     </constructor>
@@ -80,6 +81,36 @@
     <property name="filter"><bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter" /></property>
   </bean>
 
+  <!-- Synchs modifed files -->
+  <bean name="SynchAdapter" class="org.jboss.deployers.vfs.spi.structure.modified.OverrideSynchAdapter"/>
+
+  <!-- We just visit wars, but exclude classes, lib, dev dirs -->
+  <bean name="WebVisitorAttributes" class="org.jboss.system.server.profile.basic.IncludeExcludeVisitorAttributes">
+    <constructor>
+      <parameter>
+        <set>
+          <value>.war</value>
+        </set>
+      </parameter>
+      <parameter>
+        <set>
+          <value>WEB-INF/classes</value>
+          <value>WEB-INF/lib</value>
+          <value>WEB-INF/dev</value>
+        </set>
+      </parameter>
+    </constructor>
+  </bean>
+
+  <bean name="StructureModificationChecker" class="org.jboss.deployers.vfs.spi.structure.modified.SynchWrapperModificationChecker">
+    <constructor>
+      <parameter><inject bean="MetaDataStructureModificationChecker"/></parameter>
+      <parameter><inject bean="SynchAdapter"/></parameter>
+    </constructor>
+    <property name="originalAttributes"><inject bean="WebVisitorAttributes"/></property>
+    <property name="tempAttributes"><inject bean="WebVisitorAttributes"/></property>
+  </bean>
+
 	<bean name="BasicProfileFactory" class="org.jboss.system.server.profileservice.repository.BasicProfileFactory">
 		<property name="profileRepository"><inject bean="ProfileRepositoryFactory" /></property>
 	</bean>

Copied: branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/IncludeExcludeVisitorAttributes.java (from rev 87422, branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/XmlIncludeVirtualFileFilter.java)
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/IncludeExcludeVisitorAttributes.java	                        (rev 0)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profile/basic/IncludeExcludeVisitorAttributes.java	2009-04-16 14:33:50 UTC (rev 87432)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.server.profile.basic;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * Include/exclude visitor attributes.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class IncludeExcludeVisitorAttributes extends VisitorAttributes
+{
+   private Logger log = Logger.getLogger(getClass());
+
+   private Set<String> includes;
+   private Set<String> excludes;
+
+   public IncludeExcludeVisitorAttributes(Set<String> includes, Set<String> excludes)
+   {
+      if (includes == null)
+         includes = Collections.emptySet();
+      if (excludes == null)
+         excludes = Collections.emptySet();
+
+      this.includes = includes;
+      this.excludes = excludes;
+
+      setIncludeRoot(false);
+      setLeavesOnly(true);
+      setRecurseFilter(new RecurseFilter());
+   }
+
+   private class RecurseFilter implements VirtualFileFilter
+   {
+      public boolean accepts(VirtualFile file)
+      {
+         try
+         {
+            URL url = file.toURL();
+            String urlString = url.toExternalForm();
+
+            for (String include : includes)
+            {
+               if (urlString.contains(include) == false)
+                  return false;
+            }
+
+            for (String exclude : excludes)
+            {
+               if (urlString.contains(exclude))
+                  return false;
+            }
+
+            return true;
+         }
+         catch (Exception e)
+         {
+            if (log.isTraceEnabled())
+               log.trace("Exception while filtering file: " + file, e);
+
+            return false;
+         }
+      }
+   }
+}
\ No newline at end of file

Modified: branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-04-16 14:24:37 UTC (rev 87431)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/deployers/test/DeploymentManagerUnitTestCase.java	2009-04-16 14:33:50 UTC (rev 87432)
@@ -18,7 +18,7 @@
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */ 
+ */
 package org.jboss.test.deployers.test;
 
 import java.io.File;
@@ -44,7 +44,7 @@
 
 /**
  * Basic DeploymentManager test.
- * 
+ *
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
@@ -58,10 +58,10 @@
    final static String NESTED_DEPLOYMENT = "profileservice-datasource.ear";
    /** A deployment picked up by the HDScanner. */
    final static String HD_DEPLOYMENT = "hd-jboss-beans.xml";
-   
+
    /** The deployers target profile. */
    final static ProfileKey deployersKey = new ProfileKey("deployers");
-   
+
    /** The deployment manager. */
    private DeploymentManager deployMgr;
    private ManagementView mgtView;
@@ -70,10 +70,10 @@
    {
       super(name);
    }
-   
+
    /**
     * Test the available profiles.
-    * 
+    *
     * @throws Exception
     */
    public void testAvaiableProfiles() throws Exception
@@ -84,11 +84,11 @@
       keys.contains(new ProfileKey("applications"));
       keys.contains(deployersKey);
    }
-   
+
    /**
     * Test a override of the applications, without
     * removing/stopping them before.
-    * 
+    *
     * @throws Exception
     */
    public void testDistributeOverride() throws Exception
@@ -97,7 +97,7 @@
       {
          for(int i = 0; i < 5; i++)
          {
-            // 
+            //
             DeploymentProgress start = distributeAndStart(NESTED_DEPLOYMENT, true, false);
             assertComplete(start);
             
@@ -106,7 +106,7 @@
             // disable stopped check, as it was started before
             start = distributeAndStart(NESTED_DEPLOYMENT, true, false);
             assertComplete(start);
-            
+
          }
       }
       catch(Exception e)
@@ -119,23 +119,23 @@
          stopAndRemove(new String[] { NESTED_DEPLOYMENT });
       }
    }
-   
+
    /**
     * Basic copyContent test to the default location.
-    * 
+    *
     * @throws Exception
     */
    public void testCopyContent() throws Exception
    {
       try
       {
-         // failed 
+         // failed
          deployFailed(true);
          // complete
          deployEmpty(true);
          // Test redeploy
          redeployCheckComplete(EMTPY_DEPLOYMENT);
-         // TODO implement prepare 
+         // TODO implement prepare
          prepareCheckComplete(EMTPY_DEPLOYMENT);
       }
       catch(Exception e)
@@ -149,17 +149,17 @@
             { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
       }
    }
-   
+
    /**
     * Basic noCopyContent test.
-    * 
+    *
     * @throws Exception
     */
    public void testNoCopyContent() throws Exception
    {
       try
       {
-         // failed 
+         // failed
          deployFailed(false);
          // complete
          deployEmpty(false);
@@ -179,10 +179,10 @@
             { FAILING_DEPLOYMENT, EMTPY_DEPLOYMENT } );
       }
    }
-   
+
    /**
     * Test copyContent to the deployers target profile.
-    * 
+    *
     * @throws Exception
     */
    public void testDepoyersDir() throws Exception
@@ -190,7 +190,7 @@
       getDeploymentManager().loadProfile(deployersKey);
       try
       {
-         // failed 
+         // failed
          deployFailed(true);
          // complete
          deployEmpty(true);
@@ -216,13 +216,13 @@
          }
       }
    }
-   
+
    /**
     * Test the hd deployment. This deployment will get copied
     * to the deploy folder after the server is started. This
     * deployment needs to get picked up by the HDScanner and
     * should be available to the ManagementView.
-    * 
+    *
     * @throws Exception
     */
    public void testHotDeploymentBeans() throws Exception
@@ -244,7 +244,7 @@
       ManagedDeployment md = mgtView.getDeployment(HD_DEPLOYMENT);
       assertNotNull("hd-beans not deployed", md);
       assertEquals("deployment started", DeploymentState.STARTED, md.getDeploymentState());
-      
+
       stopAndRemove(new String[] { HD_DEPLOYMENT });
    }
 
@@ -282,26 +282,26 @@
       assertFailed(start);
       assertDeploymentState(start.getDeploymentID(), DeploymentState.FAILED);
    }
-   
+
    void deployEmpty(boolean isCopyContent) throws Exception
    {
       DeploymentProgress start = distributeAndStart(EMTPY_DEPLOYMENT, isCopyContent);
       assertComplete(start);
       assertDeploymentState(start.getDeploymentID(), DeploymentState.STARTED);
    }
-   
+
    DeploymentProgress distributeAndStart(String deploymentName, boolean copyContent) throws Exception
    {
       return distributeAndStart(deploymentName, copyContent, true);
    }
-   
+
    DeploymentProgress distributeAndStart(String deploymentName, boolean copyContent, boolean checkStopped) throws Exception
    {
       // The deployment manager
       DeploymentManager deployMgr = getDeploymentManager();
-      
+
       // Distribute
-      DeploymentProgress distribute = deployMgr.distribute(deploymentName, 
+      DeploymentProgress distribute = deployMgr.distribute(deploymentName,
             getDeployURL(deploymentName), copyContent);
       distribute.run();
       // Distribute always has to complete
@@ -309,46 +309,46 @@
       // check if the app is stopped
       if(checkStopped)
          assertDeploymentState(distribute.getDeploymentID(), DeploymentState.STOPPED);
-      
+
       // Get the repository names
       String[] uploadedNames = distribute.getDeploymentID().getRepositoryNames();
       assertNotNull(uploadedNames);
-      
+
       // Start
       DeploymentProgress start = deployMgr.start(uploadedNames);
       start.run();
       // Return the start deployment progress
       return start;
    }
-   
+
    void redeployCheckComplete(String name) throws Exception
    {
       // The deployment manager
       DeploymentManager deployMgr = getDeploymentManager();
-      
+
       // Redeploy
       DeploymentProgress redeploy = deployMgr.redeploy(name);
       redeploy.run();
       assertComplete(redeploy);
       assertDeploymentState(redeploy.getDeploymentID(), DeploymentState.STARTED);
    }
-   
+
    void prepareCheckComplete(String name) throws Exception
    {
       // The deployment manager
       DeploymentManager deployMgr = getDeploymentManager();
-      
+
       // Prepare
       DeploymentProgress prepare = deployMgr.prepare(name);
       prepare.run();
       assertComplete(prepare);
    }
-   
+
    void stopAndRemove(String[] names) throws Exception
    {
       // The deployment manager
       DeploymentManager deployMgr = getDeploymentManager();
-      
+
       try
       {
          DeploymentProgress stop = deployMgr.stop(names);
@@ -366,7 +366,7 @@
          DeploymentProgress remove = deployMgr.remove(names);
          remove.run();
          assertComplete(remove);
-         
+
          String name = remove.getDeploymentID().getNames()[0];
          ManagementView mgtView = getManagementView();
          try
@@ -380,13 +380,13 @@
          }
       }
    }
-   
+
    void assertFailed(DeploymentProgress progress) throws Exception
    {
       assertFalse(progress.getDeploymentStatus().isCompleted());
       assertTrue(progress.getDeploymentStatus().isFailed());
    }
-   
+
    void assertDeploymentState(DeploymentID DtID, DeploymentState state) throws Exception
    {
       String name = DtID.getNames()[0];
@@ -396,7 +396,7 @@
       assertEquals("deployment: " + name, state, md.getDeploymentState());
       log.debug(md.getSimpleName() + " " + md.getTypes());
    }
-   
+
    void assertComplete(DeploymentProgress progress) throws Exception
    {
       if(progress.getDeploymentStatus().isFailed())
@@ -406,7 +406,7 @@
       //
       assertTrue(progress.getDeploymentStatus().isCompleted());
    }
-   
+
    DeploymentManager getDeploymentManager() throws Exception
    {
       if(this.deployMgr == null)
@@ -415,7 +415,7 @@
       }
       return deployMgr;
    }
-   
+
    ManagementView getManagementView() throws Exception
    {
       if(this.mgtView == null)
@@ -425,11 +425,11 @@
       this.mgtView.load();
       return this.mgtView;
    }
-   
+
    ProfileService getProfileService() throws Exception
    {
       InitialContext ctx = getInitialContext();
       return (ProfileService) ctx.lookup("ProfileService");
-   } 
-   
+   }
+
 }




More information about the jboss-cvs-commits mailing list