[jboss-cvs] JBossAS SVN: r72337 - in projects/jboss-deployers/trunk: deployers-core/src/main/org/jboss/deployers/plugins/structure and 14 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 17 07:29:25 EDT 2008
Author: alesj
Date: 2008-04-17 07:29:25 -0400 (Thu, 17 Apr 2008)
New Revision: 72337
Added:
projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ModificationType.java
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/explicit/explicit.ear
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/InnerModificationUnitTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/ModificationTypeUnitTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/support/WarUnpackStructure.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java
Modified:
projects/jboss-deployers/trunk/build/pom.xml
projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java
projects/jboss-deployers/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
projects/jboss-deployers/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java
projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/altdd/test/DeployersAltDDTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
Log:
ContextInfo modification type.
Modified: projects/jboss-deployers/trunk/build/pom.xml
===================================================================
--- projects/jboss-deployers/trunk/build/pom.xml 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/build/pom.xml 2008-04-17 11:29:25 UTC (rev 72337)
@@ -29,7 +29,7 @@
<version.jboss.common.logging.log4j>2.0.4.GA</version.jboss.common.logging.log4j>
<version.jbossxb>2.0.0.CR8</version.jbossxb>
<version.jboss.aop>2.0.0.CR8</version.jboss.aop>
- <version.jboss.vfs>2.0.0.Beta10</version.jboss.vfs>
+ <version.jboss.vfs>2.0.0-SNAPSHOT</version.jboss.vfs>
<version.org.jboss.test>1.0.5.GA</version.org.jboss.test>
<version.junit>4.4</version.junit>
</properties>
Modified: projects/jboss-deployers/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-core/src/main/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -32,6 +32,7 @@
import org.jboss.deployers.spi.attachments.helpers.PredeterminedManagedObjectAttachmentsImpl;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.ModificationType;
/**
* ContextInfoImpl.
@@ -61,6 +62,9 @@
/** The comparator class name */
private String comparatorClassName;
+ /** The modification type */
+ private ModificationType modificationType;
+
/**
* Create a new ContextInfoImpl.
*/
@@ -228,6 +232,16 @@
this.relativeOrder = relativeOrder;
}
+ public ModificationType getModificationType()
+ {
+ return modificationType;
+ }
+
+ public void setModificationType(ModificationType modificationType)
+ {
+ this.modificationType = modificationType;
+ }
+
@Override
public String toString()
{
Modified: projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ContextInfo.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -111,4 +111,18 @@
* @param className the comparator class name
*/
void setComparatorClassName(String className);
+
+ /**
+ * Get the modification type.
+ *
+ * @return the modification type
+ */
+ ModificationType getModificationType();
+
+ /**
+ * Set the modification type.
+ *
+ * @param modificationType the modification type
+ */
+ void setModificationType(ModificationType modificationType);
}
Added: projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ModificationType.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ModificationType.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-core-spi/src/main/org/jboss/deployers/spi/structure/ModificationType.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -0,0 +1,51 @@
+/*
+* 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.deployers.spi.structure;
+
+/**
+ * The modification type.
+ * Unpack, UnpackRecursive, Move
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public enum ModificationType
+{
+ UNPACK,
+ UNPACK_RECURSIVE,
+ MOVE;
+
+ /**
+ * Get the modification type.
+ *
+ * @param type the type
+ * @return matching modification type
+ */
+ public static ModificationType getModificationType(String type)
+ {
+ for (ModificationType mt : values())
+ {
+ if (mt.toString().equalsIgnoreCase(type))
+ return mt;
+ }
+ throw new IllegalArgumentException("No such modification type: " + type);
+ }
+}
Modified: projects/jboss-deployers/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-structure-spi/src/main/org/jboss/deployers/structure/spi/helpers/AbstractStructureBuilder.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -61,7 +61,7 @@
DeploymentContext result;
try
{
- result = createRootDeploymentContext(deployment);
+ result = createRootDeploymentContext(deployment, metaData);
if (result == null)
throw new IllegalStateException("Root deployment context is null");
result.setDeployment(deployment);
@@ -203,9 +203,22 @@
* Create the root deployment context
*
* @param deployment the deployment
+ * @param metaData the structure meta data
* @return the deployment context
* @throws Exception for any error
*/
+ protected DeploymentContext createRootDeploymentContext(Deployment deployment, StructureMetaData metaData) throws Exception
+ {
+ return createRootDeploymentContext(deployment);
+ }
+
+ /**
+ * Create the root deployment context
+ *
+ * @param deployment the deployment
+ * @return the deployment context
+ * @throws Exception for any error
+ */
protected DeploymentContext createRootDeploymentContext(Deployment deployment) throws Exception
{
return new AbstractDeploymentContext(deployment.getName(), "");
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -154,7 +154,9 @@
parentContext = StructureMetaDataFactory.createContextInfo(relativePath, recognised.getClassPath());
else
parentContext = StructureMetaDataFactory.createContextInfo(relativePath, metaDataPath, recognised.getClassPath());
-
+
+ // copy the modification type information
+ parentContext.setModificationType(recognised.getModificationType());
structureMetaData.addContext(parentContext);
MutableAttachments attachments = (MutableAttachments) parentContext.getPredeterminedManagedObjects();
attachments.addAttachment(StructureMetaData.class, structure);
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -29,6 +29,8 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.ModificationType;
+import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
@@ -43,6 +45,7 @@
* VFSStructureBuilder.
*
* @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 class VFSStructureBuilder extends AbstractStructureBuilder
@@ -50,23 +53,24 @@
/** The log */
private static final Logger log = Logger.getLogger(VFSStructureBuilder.class);
- protected DeploymentContext createRootDeploymentContext(Deployment deployment) throws Exception
+ protected DeploymentContext createRootDeploymentContext(Deployment deployment, StructureMetaData metaData) throws Exception
{
if (deployment instanceof VFSDeployment)
{
VFSDeployment vfsDeployment = (VFSDeployment) deployment;
String name = deployment.getName();
String simpleName = deployment.getSimpleName();
+ VirtualFile root = applyModification(vfsDeployment.getRoot(), metaData.getContext(""));
if (name == null)
{
- return new AbstractVFSDeploymentContext(vfsDeployment.getRoot(), "");
+ return new AbstractVFSDeploymentContext(root, "");
}
else
{
if (simpleName == null)
- return new AbstractVFSDeploymentContext(name, name, vfsDeployment.getRoot(), "");
+ return new AbstractVFSDeploymentContext(name, name, root, "");
else
- return new AbstractVFSDeploymentContext(name, simpleName, vfsDeployment.getRoot(), "");
+ return new AbstractVFSDeploymentContext(name, simpleName, root, "");
}
}
return super.createRootDeploymentContext(deployment);
@@ -82,7 +86,7 @@
{
VirtualFile parentFile = vfsParent.getRoot();
VirtualFile file = parentFile.findChild(path); // leaving the findChild usage
- return new AbstractVFSDeploymentContext(file, path);
+ return new AbstractVFSDeploymentContext(applyModification(file, child), path);
}
catch (Throwable t)
{
@@ -92,6 +96,40 @@
return super.createChildDeploymentContext(parent, child);
}
+ /**
+ * Apply modification if it exists.
+ *
+ * @param file the file
+ * @param contextInfo the context info
+ * @return the modified file
+ * @throws Exception for any error
+ */
+ protected VirtualFile applyModification(VirtualFile file, ContextInfo contextInfo) throws Exception
+ {
+ if (contextInfo == null)
+ return file;
+
+ ModificationType modificationType = contextInfo.getModificationType();
+ if (modificationType != null)
+ {
+ boolean isSupported = (modificationType != ModificationType.UNPACK_RECURSIVE);
+
+ if (log.isTraceEnabled() && isSupported)
+ log.trace("Modifying file: " + file + ", modification type: " + modificationType);
+
+ if (ModificationType.UNPACK == modificationType)
+ file = VFSUtils.unpack(file);
+ else if (ModificationType.MOVE == modificationType)
+ file = VFSUtils.move(file);
+ else
+ log.warn("Unsupported modification type: " + modificationType);
+
+ if (log.isTraceEnabled() && isSupported)
+ log.trace("Modified file: " + file);
+ }
+ return file;
+ }
+
protected void applyContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception
{
super.applyContextInfo(context, contextInfo);
@@ -99,7 +137,8 @@
if (context instanceof VFSDeploymentContext)
{
boolean trace = log.isTraceEnabled();
- log.trace("Apply context: " + context.getName() + " " + contextInfo);
+ if (trace)
+ log.trace("Apply context: " + context.getName() + " " + contextInfo);
VFSDeploymentContext vfsContext = (VFSDeploymentContext) context;
List<String> metaDataPath = contextInfo.getMetaDataPath();
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -28,6 +28,7 @@
import org.jboss.deployers.plugins.structure.ContextInfoImpl;
import org.jboss.deployers.plugins.structure.StructureMetaDataImpl;
import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ModificationType;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
import org.xml.sax.Attributes;
@@ -36,6 +37,7 @@
* An ObjectModelFactory for the jboss-structure.xml descriptor.
*
* @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
* @version $Revision:$
*/
public class StructureMetaDataObjectFactory implements ObjectModelFactory
@@ -58,10 +60,15 @@
public Object newChild(StructureMetaDataImpl parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
- Object child = null;
if (localName.equals("context"))
- child = new ContextInfoImpl("", null);
- return child;
+ {
+ ContextInfoImpl child = new ContextInfoImpl("", null);
+ String modificationType = attrs.getValue("modification");
+ if (modificationType != null)
+ child.setModificationType(ModificationType.getModificationType(modificationType));
+ return child;
+ }
+ return null;
}
public Object newChild(ContextInfoImpl parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/explicit/explicit.ear
===================================================================
(Binary files differ)
Property changes on: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/explicit/explicit.ear
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/altdd/test/DeployersAltDDTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/altdd/test/DeployersAltDDTestCase.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/altdd/test/DeployersAltDDTestCase.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -183,6 +183,11 @@
{
return null;
}
+
+ public void replaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
+ {
+
+ }
});
return altDD;
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -156,6 +156,11 @@
{
}
+
+ public void replaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
+ {
+
+ }
};
}
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -40,11 +40,13 @@
import org.jboss.test.BaseTestCase;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSUtils;
/**
* AbstractStructureUnitTestCase.
*
* @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 abstract class AbstractStructureTest extends BaseTestCase
@@ -54,6 +56,11 @@
super(name);
}
+ protected void assertUnpacked(VirtualFile file) throws Exception
+ {
+ assertSame(file, VFSUtils.unpack(file));
+ }
+
protected void assertNoChildContexts(VFSDeploymentContext context)
{
assertChildContexts(context);
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -27,7 +27,9 @@
import org.jboss.test.deployers.vfs.structure.ear.test.EARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.ear.test.EARStructureRecognizeTestCase;
+import org.jboss.test.deployers.vfs.structure.ear.test.InnerModificationUnitTestCase;
import org.jboss.test.deployers.vfs.structure.explicit.test.DeclaredStructureUnitTestCase;
+import org.jboss.test.deployers.vfs.structure.explicit.test.ModificationTypeUnitTestCase;
import org.jboss.test.deployers.vfs.structure.file.test.CombinedFileStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.file.test.ConfiguredSuffixFileStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.file.test.FileStructureUnitTestCase;
@@ -39,11 +41,13 @@
import org.jboss.test.deployers.vfs.structure.test.TerminateStructureTestCase;
import org.jboss.test.deployers.vfs.structure.war.test.CombinedWARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.war.test.WARStructureUnitTestCase;
+import org.jboss.test.deployers.vfs.structure.war.test.WARUnpackUnitTestCase;
/**
* VFSStructureTestSuite.
*
* @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 class VFSStructureTestSuite extends TestSuite
@@ -71,6 +75,9 @@
suite.addTest(CombinedFileStructureUnitTestCase.suite());
suite.addTest(TerminateStructureTestCase.suite());
suite.addTest(StructureDeployerContextClassLoaderTestCase.suite());
+ suite.addTest(WARUnpackUnitTestCase.suite());
+ suite.addTest(ModificationTypeUnitTestCase.suite());
+ suite.addTest(InnerModificationUnitTestCase.suite());
return suite;
}
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/InnerModificationUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/InnerModificationUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/InnerModificationUnitTestCase.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -0,0 +1,69 @@
+/*
+* 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.structure.ear.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.deployers.vfs.plugins.structure.file.FileStructure;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
+import org.jboss.test.deployers.vfs.structure.support.WarUnpackStructure;
+
+/**
+ * Inner unpack, with structure deployer
+ * setting up the modification info.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class InnerModificationUnitTestCase extends AbstractStructureTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(InnerModificationUnitTestCase.class);
+ }
+
+ public InnerModificationUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ enableTrace("org.jboss.deployers");
+ }
+
+ protected VFSDeploymentContext determineStructure(VFSDeployment deployment) throws Exception
+ {
+ return determineStructureWithStructureDeployers(deployment, new JARStructure(), new WarUnpackStructure(), new FileStructure());
+ }
+
+ public void testExplicitInnerUnpack() throws Throwable
+ {
+ VFSDeploymentContext root = assertDeploy("/structure/explicit", "explicit.ear");
+ assertChildContexts(root, "inner.war");
+ assertUnpacked(root.getRoot().findChild("inner.war"));
+ }
+}
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/ModificationTypeUnitTestCase.java (from rev 72330, projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/MultipleMetadataStructureUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/ModificationTypeUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/explicit/test/ModificationTypeUnitTestCase.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -0,0 +1,69 @@
+/*
+* 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.structure.explicit.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure;
+import org.jboss.deployers.vfs.plugins.structure.file.FileStructure;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.deployers.vfs.plugins.structure.war.WARStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
+
+/**
+ * MultipleMetadataStructure deployer unit tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ModificationTypeUnitTestCase extends AbstractStructureTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(ModificationTypeUnitTestCase.class);
+ }
+
+ public ModificationTypeUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ enableTrace("org.jboss.deployers");
+ }
+
+ protected VFSDeploymentContext determineStructure(VFSDeployment deployment) throws Exception
+ {
+ return determineStructureWithStructureDeployers(deployment, new DeclaredStructure(), new JARStructure(), new WARStructure(), new FileStructure());
+ }
+
+ public void testExplicitInnerUnpack() throws Throwable
+ {
+ VFSDeploymentContext root = assertDeploy("/structure/explicit", "explicit.ear");
+ assertChildContexts(root, "inner.war");
+ assertUnpacked(root.getRoot().findChild("inner.war"));
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -205,6 +205,11 @@
{
}
+
+ public void replaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
+ {
+
+ }
};
}
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/support/WarUnpackStructure.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/support/WarUnpackStructure.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/support/WarUnpackStructure.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -0,0 +1,39 @@
+/*
+* 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.structure.support;
+
+import org.jboss.deployers.vfs.plugins.structure.war.WARStructure;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.ModificationType;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WarUnpackStructure extends WARStructure
+{
+ protected void applyContextInfo(VirtualFile root, ContextInfo result)
+ {
+ super.applyContextInfo(root, result);
+ result.setModificationType(ModificationType.UNPACK);
+ }
+}
Copied: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java (from rev 72330, projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/war/test/WARStructureUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -0,0 +1,58 @@
+/*
+* 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.structure.war.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
+import org.jboss.test.deployers.vfs.structure.support.WarUnpackStructure;
+
+/**
+ * WARUnpackUnitTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WARUnpackUnitTestCase extends AbstractStructureTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(WARUnpackUnitTestCase.class);
+ }
+
+ public WARUnpackUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected VFSDeploymentContext determineStructure(VFSDeployment deployment) throws Exception
+ {
+ return determineStructureWithStructureDeployer(deployment, new WarUnpackStructure());
+ }
+
+ public void testWarDeployerUnpack() throws Throwable
+ {
+ VFSDeploymentContext root = assertDeploy("/structure/war/simple", "simple.war");
+ assertUnpacked(root.getRoot());
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java 2008-04-17 10:47:59 UTC (rev 72336)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java 2008-04-17 11:29:25 UTC (rev 72337)
@@ -277,7 +277,7 @@
else
result = StructureMetaDataFactory.createContextInfo("", null);
- applyContextInfoOrder(root, result);
+ applyContextInfo(root, result);
structureMetaData.addContext(result);
if (trace)
@@ -286,13 +286,13 @@
}
/**
- * Apply context info order.
+ * Apply context info.
* Can be overridden for specific root.
*
* @param root the root file
* @param result the new context info
*/
- protected void applyContextInfoOrder(VirtualFile root, ContextInfo result)
+ protected void applyContextInfo(VirtualFile root, ContextInfo result)
{
if (result != null && contextInfoOrder != null)
result.setRelativeOrder(contextInfoOrder);
More information about the jboss-cvs-commits
mailing list