[jboss-cvs] JBossAS SVN: r109696 - in projects/jboss-deployers/trunk: deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 3 06:06:57 EST 2010
Author: alesj
Date: 2010-12-03 06:06:56 -0500 (Fri, 03 Dec 2010)
New Revision: 109696
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/subdep/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/subdep/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/subdep/META-INF/subfile.txt
Modified:
projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/TopNameIgnoreMechanism.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/META-INF/jboss-ignore.txt
Log:
[JBDEPLOY-267]; fix top NIM.
Modified: projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/TopNameIgnoreMechanism.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/TopNameIgnoreMechanism.java 2010-12-03 08:54:24 UTC (rev 109695)
+++ projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/TopNameIgnoreMechanism.java 2010-12-03 11:06:56 UTC (rev 109696)
@@ -21,6 +21,7 @@
*/
package org.jboss.deployers.spi.deployer.helpers;
+import org.jboss.deployers.spi.deployer.matchers.LazyPath;
import org.jboss.deployers.structure.spi.DeploymentUnit;
/**
@@ -35,4 +36,31 @@
{
return unit.getTopLevel();
}
+
+ public boolean ignorePath(DeploymentUnit unit, String path)
+ {
+ DeploymentUnit top = adjustDeploymentUnit(unit);
+ if (top != unit)
+ path = unit.getRelativePath() + path;
+ return super.ignorePath(unit, path);
+ }
+
+ public boolean ignorePath(final DeploymentUnit unit, LazyPath path)
+ {
+ DeploymentUnit top = adjustDeploymentUnit(unit);
+ if (top != unit)
+ {
+ final LazyPath lp = path;
+ path = new LazyPath()
+ {
+ public String buildPath()
+ {
+ String prefix = unit.getRelativePath();
+ String suffix = lp.buildPath();
+ return prefix + (prefix.endsWith("/") == false && suffix.startsWith("/") == false ? "/" : "") + suffix;
+ }
+ };
+ }
+ return super.ignorePath(unit, path);
+ }
}
\ No newline at end of file
Modified: 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/java/org/jboss/test/deployers/vfs/matchers/test/NameIgnoreMechanismTestCase.java 2010-12-03 08:54:24 UTC (rev 109695)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/matchers/test/NameIgnoreMechanismTestCase.java 2010-12-03 11:06:56 UTC (rev 109696)
@@ -27,6 +27,7 @@
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.deployer.helpers.TopNameIgnoreMechanism;
import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
import org.jboss.deployers.vfs.spi.deployer.AbstractIgnoreFilesDeployer;
import org.jboss.test.deployers.BaseDeployersVFSTest;
@@ -62,9 +63,15 @@
Deployment deployment = createDeployment("/matchers", "ignore");
main.deploy(deployment);
-
- assertEquals(size, fbd.getFiles().size());
- assertFalse(fbd.getFiles().contains("fst.txt"));
+ try
+ {
+ assertEquals(size, fbd.getFiles().size());
+ assertFalse(fbd.getFiles().contains("fst.txt"));
+ }
+ finally
+ {
+ main.undeploy(deployment);
+ }
}
public void testSingleNameNoSuffix() throws Throwable
@@ -100,7 +107,7 @@
fbd.setSuffix(".txt");
fbd.setAllowMultipleFiles(true);
- testNameIgnoreMechanism(fbd, 3);
+ testNameIgnoreMechanism(fbd, 4);
}
public void testNamesWithSuffix() throws Throwable
@@ -126,8 +133,39 @@
Deployment deployment = createDeployment("/matchers", "ignore");
main.deploy(deployment);
+ try
+ {
+ assertEquals(3, fbd.getFiles().size());
+ assertFalse(fbd.getFiles().contains("fst.txt"));
+ }
+ finally
+ {
+ main.undeploy(deployment);
+ }
+ }
- assertEquals(2, fbd.getFiles().size());
- assertFalse(fbd.getFiles().contains("fst.txt"));
+ public void testTopNIM() throws Throwable
+ {
+ FeedbackDeployer fbd = new FeedbackDeployer();
+ fbd.setSuffix(".txt");
+ fbd.setAllowMultipleFiles(true);
+ fbd.setNameIgnoreMechanism(new TopNameIgnoreMechanism());
+
+ AbstractIgnoreFilesDeployer nimd = new AbstractIgnoreFilesDeployer();
+
+ DeployerClient main = createMainDeployer(fbd, nimd);
+ addStructureDeployer(main, new JARStructure());
+
+ Deployment deployment = createDeployment("/matchers", "ignore");
+ main.deploy(deployment);
+ try
+ {
+ assertEquals(2, fbd.getFiles().size());
+ assertFalse(fbd.getFiles().contains("fst.txt"));
+ }
+ finally
+ {
+ main.undeploy(deployment);
+ }
}
}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/jboss-ignore.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/jboss-ignore.txt 2010-12-03 08:54:24 UTC (rev 109695)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/META-INF/jboss-ignore.txt 2010-12-03 11:06:56 UTC (rev 109696)
@@ -1,2 +1,4 @@
META-INF/jboss-ignore.txt
META-INF/fst.txt
+subdep/META-INF/subfile.txt
+
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/subdep/META-INF/subfile.txt
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/subdep/META-INF/subfile.txt (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/matchers/ignore/subdep/META-INF/subfile.txt 2010-12-03 11:06:56 UTC (rev 109696)
@@ -0,0 +1 @@
+Some sub txt.
More information about the jboss-cvs-commits
mailing list