[jboss-cvs] JBossAS SVN: r95572 - in projects/jboss-deployers/trunk: deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 26 12:23:34 EDT 2009


Author: alesj
Date: 2009-10-26 12:23:33 -0400 (Mon, 26 Oct 2009)
New Revision: 95572

Added:
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/NIMDeployer.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/NameIgnoreMechanismTestCase.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/empty.txt
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/fst.txt
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/qwert.tmp
   projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/snd.txt
Modified:
   projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/spi/deployer/DeploymentStages.java
   projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java
   projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java
Log:
[JBDEPLOY-220]; tests.
[JBDEPLOY-221]; new PreParse deployment stage.

Modified: projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/spi/deployer/DeploymentStages.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/spi/deployer/DeploymentStages.java	2009-10-26 15:37:16 UTC (rev 95571)
+++ projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/spi/deployer/DeploymentStages.java	2009-10-26 16:23:33 UTC (rev 95572)
@@ -25,6 +25,7 @@
  * The Standard DeploymentStages.
  * 
  * @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
  * @version $Revision: 1.1 $
  */
 public interface DeploymentStages
@@ -32,8 +33,11 @@
    /** The not installed stage - nothing is done here */
    DeploymentStage NOT_INSTALLED = new DeploymentStage("Not Installed");
 
+   /** The pre parse stage - where pre parsing stuff can be prepared; altDD, ignore, ... */
+   DeploymentStage PRE_PARSE = new DeploymentStage("PreParse", NOT_INSTALLED);
+
    /** The parse stage - where metadata is read */
-   DeploymentStage PARSE = new DeploymentStage("Parse", NOT_INSTALLED);
+   DeploymentStage PARSE = new DeploymentStage("Parse", PRE_PARSE);
 
    /** The post parse stage - where metadata can be fixed up */
    DeploymentStage POST_PARSE = new DeploymentStage("PostParse", PARSE);

Modified: projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2009-10-26 15:37:16 UTC (rev 95571)
+++ projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java	2009-10-26 16:23:33 UTC (rev 95572)
@@ -164,6 +164,7 @@
 
       // Add the standard stages
       addDeploymentStage(DeploymentStages.NOT_INSTALLED);
+      addDeploymentStage(DeploymentStages.PRE_PARSE);
       addDeploymentStage(DeploymentStages.PARSE);
       addDeploymentStage(DeploymentStages.POST_PARSE);
       addDeploymentStage(DeploymentStages.PRE_DESCRIBE);

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java	2009-10-26 15:37:16 UTC (rev 95571)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/VFSMatchersTestSuite.java	2009-10-26 16:23:33 UTC (rev 95572)
@@ -26,6 +26,7 @@
 import junit.textui.TestRunner;
 import org.jboss.test.deployers.vfs.matchers.test.FileMatchersTestCase;
 import org.jboss.test.deployers.vfs.matchers.test.JarExtensionsTestCase;
+import org.jboss.test.deployers.vfs.matchers.test.NameIgnoreMechanismTestCase;
 
 /**
  * Matchers test suite.
@@ -45,6 +46,7 @@
 
       suite.addTest(FileMatchersTestCase.suite());
       suite.addTest(JarExtensionsTestCase.suite());
+      suite.addTest(NameIgnoreMechanismTestCase.suite());
 
       return suite;
    }

Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java	2009-10-26 15:37:16 UTC (rev 95571)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/FeedbackDeployer.java	2009-10-26 16:23:33 UTC (rev 95572)
@@ -23,6 +23,7 @@
 
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.List;
 
 import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
 import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
@@ -33,11 +34,11 @@
  * 
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
  */
-public abstract class FeedbackDeployer extends AbstractVFSParsingDeployer<Object>
+public class FeedbackDeployer extends AbstractVFSParsingDeployer<Object>
 {
    private Set<String> files = new TreeSet<String>();
 
-   protected FeedbackDeployer()
+   public FeedbackDeployer()
    {
       super(Object.class);
    }
@@ -52,4 +53,14 @@
    {
       return files;
    }
+
+   @Override
+   protected Object mergeFiles(VFSDeploymentUnit unit, Object root, List<VirtualFile> files, Set<String> missingFiles) throws Exception
+   {
+      for (VirtualFile file : files)
+      {
+         parse(unit, file, root);
+      }
+      return null;
+   }
 }

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/NIMDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/NIMDeployer.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/support/NIMDeployer.java	2009-10-26 16:23:33 UTC (rev 95572)
@@ -0,0 +1,47 @@
+/*
+ * 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.test.deployers.vfs.matchers.support;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.spi.deployer.matchers.NameIgnoreMechanism;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class NIMDeployer extends AbstractDeployer
+{
+   private NameIgnoreMechanism mechanism;
+
+   public NIMDeployer(NameIgnoreMechanism mechanism)
+   {
+      setStage(DeploymentStages.PRE_PARSE);
+      this.mechanism = mechanism;
+   }
+
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      unit.addAttachment(NameIgnoreMechanism.class, mechanism);
+   }
+}

Copied: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/NameIgnoreMechanismTestCase.java (from rev 95563, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/JarExtensionsTestCase.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/NameIgnoreMechanismTestCase.java	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/NameIgnoreMechanismTestCase.java	2009-10-26 16:23:33 UTC (rev 95572)
@@ -0,0 +1,124 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.test.deployers.vfs.matchers.test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.deployer.helpers.CollectionNameIgnoreMechanism;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.test.deployers.BaseDeployersVFSTest;
+import org.jboss.test.deployers.vfs.matchers.support.FeedbackDeployer;
+import org.jboss.test.deployers.vfs.matchers.support.NIMDeployer;
+
+/**
+ * Name ignore mechanism tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class NameIgnoreMechanismTestCase extends BaseDeployersVFSTest
+{
+   public NameIgnoreMechanismTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(NameIgnoreMechanismTestCase.class);
+   }
+
+   public void testSingleNameNoSuffix() throws Throwable
+   {
+      FeedbackDeployer fbd1 = new FeedbackDeployer();
+      fbd1.setName("empty.txt");
+      FeedbackDeployer fbd2 = new FeedbackDeployer();
+      fbd2.setName("fst.txt");
+      NIMDeployer nimd = new NIMDeployer(new CollectionNameIgnoreMechanism(Collections.singleton("fst.txt")));
+
+      DeployerClient main = createMainDeployer(fbd1, fbd2, nimd);
+      addStructureDeployer(main, new JARStructure());
+
+      Deployment deployment = createDeployment("/matchers", "ignore");
+      main.deploy(deployment);
+
+      assertFalse(fbd1.getFiles().isEmpty());
+      assertEmpty(fbd2.getFiles());
+   }
+
+   public void testMultipleNamesNoSuffix() throws Throwable
+   {
+      FeedbackDeployer fbd = new FeedbackDeployer();
+      Set<String> names = new HashSet<String>(Arrays.asList("empty.txt", "fst.txt", "snd.txt"));
+      fbd.setNames(names);
+      NIMDeployer nimd = new NIMDeployer(new CollectionNameIgnoreMechanism(Collections.singleton("fst.txt")));
+
+      DeployerClient main = createMainDeployer(fbd, nimd);
+      addStructureDeployer(main, new JARStructure());
+
+      Deployment deployment = createDeployment("/matchers", "ignore");
+      main.deploy(deployment);
+
+      assertEquals(2, fbd.getFiles().size());
+      assertFalse(fbd.getFiles().contains("fst.txt"));
+   }
+
+   public void testNoNameJustSuffix() throws Throwable
+   {
+      FeedbackDeployer fbd = new FeedbackDeployer();
+      fbd.setSuffix(".txt");
+      fbd.setAllowMultipleFiles(true);
+      NIMDeployer nimd = new NIMDeployer(new CollectionNameIgnoreMechanism(Collections.singleton("fst.txt")));
+
+      DeployerClient main = createMainDeployer(fbd, nimd);
+      addStructureDeployer(main, new JARStructure());
+
+      Deployment deployment = createDeployment("/matchers", "ignore");
+      main.deploy(deployment);
+
+      assertEquals(2, fbd.getFiles().size());
+      assertFalse(fbd.getFiles().contains("fst.txt"));
+   }
+
+   public void testNamesWithSuffix() throws Throwable
+   {
+      FeedbackDeployer fbd = new FeedbackDeployer();
+      Set<String> names = new HashSet<String>(Arrays.asList("empty.txt", "fst.txt", "snd.txt"));
+      fbd.setNames(names);
+      fbd.setSuffix(".tmp");
+      NIMDeployer nimd = new NIMDeployer(new CollectionNameIgnoreMechanism(Collections.singleton("fst.txt")));
+
+      DeployerClient main = createMainDeployer(fbd, nimd);
+      addStructureDeployer(main, new JARStructure());
+
+      Deployment deployment = createDeployment("/matchers", "ignore");
+      main.deploy(deployment);
+
+      assertEquals(3, fbd.getFiles().size());
+      assertFalse(fbd.getFiles().contains("fst.txt"));
+   }
+}
\ No newline at end of file

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/empty.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/empty.txt	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/empty.txt	2009-10-26 16:23:33 UTC (rev 95572)
@@ -0,0 +1 @@
+Empty.

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/fst.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/fst.txt	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/fst.txt	2009-10-26 16:23:33 UTC (rev 95572)
@@ -0,0 +1 @@
+First.

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/qwert.tmp
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/qwert.tmp	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/qwert.tmp	2009-10-26 16:23:33 UTC (rev 95572)
@@ -0,0 +1 @@
+Tmp file.

Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/snd.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/snd.txt	                        (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/snd.txt	2009-10-26 16:23:33 UTC (rev 95572)
@@ -0,0 +1,2 @@
+Second.
+




More information about the jboss-cvs-commits mailing list