[jboss-cvs] JBossAS SVN: r78843 - in projects/jboss-deployers/trunk/deployers-vfs/src: main/java/org/jboss/deployers/vfs/plugins/structure/dir and 23 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 25 04:18:52 EDT 2008
Author: alesj
Date: 2008-09-25 04:18:52 -0400 (Thu, 25 Sep 2008)
New Revision: 78843
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/DirStructureUnitTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/RealDirStructureUnitTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/META-INF/application.properties
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/META-INF/jboss-beans.xml
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/lib/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/lib/nested/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/lib/nested/test.jar
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/META-INF/application.properties
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/META-INF/jboss-beans.xml
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/lib/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/lib/test.jar
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/META-INF/jboss-beans.xml
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/lib/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/lib/nested/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/lib/nested/test.jar
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/META-INF/jboss-beans.xml
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/lib/
projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/lib/test.jar
Log:
Initial commit for JBDEPLOY-94/JBAS-5900 legacy directory behavior.
Added: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1,103 @@
+/*
+* 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.vfs.plugins.structure.dir;
+
+import java.util.List;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
+import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Legacy directory structure.
+ * See JBAS-5900 for more details.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Deprecated
+public class DirectoryStructure extends AbstractVFSStructureDeployer
+{
+ public DirectoryStructure()
+ {
+ setRelativeOrder(Integer.MAX_VALUE);
+ }
+
+ public boolean determineStructure(StructureContext context) throws DeploymentException
+ {
+ try
+ {
+ VirtualFile file = context.getFile();
+ // jar structure should already handle top level dirs
+ if (context.isTopLevel() == false && isLeaf(file) == false && isMetadataPath(context) == false)
+ {
+ List<VirtualFile> children = file.getChildren();
+ if (children != null && children.isEmpty() == false)
+ {
+ VFSStructuralDeployers structuralDeployers = context.getDeployers();
+
+ // get top
+ while (context.getParentContext() != null)
+ context = context.getParentContext();
+
+ for (VirtualFile child : children)
+ structuralDeployers.determineStructure(child, context);
+ }
+ }
+ return false;
+ }
+ catch (Exception e)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Error determining structure.", e);
+ }
+ }
+
+ /**
+ * Is the current context already part of metadata path.
+ *
+ * @param context the current structure context
+ * @return true if already part of parent's context metadata path
+ */
+ protected boolean isMetadataPath(StructureContext context)
+ {
+ StructureContext parentContext = context.getParentContext();
+ if (parentContext == null)
+ return false;
+
+ StructureMetaData smd = parentContext.getMetaData();
+ ContextInfo info = smd.getContext("");
+ List<String> metadataPaths = info.getMetaDataPath();
+ if (metadataPaths != null && metadataPaths.isEmpty() == false)
+ {
+ String relativePath = AbstractStructureDeployer.getRelativePath(context.getParent(), context.getFile());
+ for (String path : metadataPaths)
+ if (relativePath.equalsIgnoreCase(path))
+ return true;
+ }
+
+ return false;
+ }
+}
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/DirStructureUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/DirStructureUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/DirStructureUnitTestCase.java 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1,79 @@
+/*
+* 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.dir.test;
+
+import junit.framework.Test;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.deployers.vfs.plugins.structure.jar.JARStructure;
+import org.jboss.deployers.vfs.plugins.structure.dir.DirectoryStructure;
+import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
+import org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer;
+
+/**
+ * Legacy directory structure tests.
+ * See JBAS-5900 for more information.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class DirStructureUnitTestCase extends AbstractStructureTest
+{
+ public DirStructureUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(DirStructureUnitTestCase.class);
+ }
+
+ @SuppressWarnings("deprecation")
+ protected VFSDeploymentContext determineStructure(VFSDeployment deployment) throws Exception
+ {
+ return determineStructureWithStructureDeployers(deployment, new MockEarStructureDeployer(), new JARStructure(), new DirectoryStructure());
+ }
+
+ public void testSarWithLib() throws Throwable
+ {
+ VFSDeploymentContext context = assertDeploy("/structure/dir", "test-in-lib.sar");
+ assertChildContexts(context, "lib/test.jar");
+ }
+
+ public void testSarWithNestedLib() throws Throwable
+ {
+ VFSDeploymentContext context = assertDeploy("/structure/dir", "test-in-lib-nested.sar");
+ assertChildContexts(context, "lib/nested/test.jar");
+ }
+
+ public void testEarSarWithLib() throws Throwable
+ {
+ VFSDeploymentContext context = assertDeploy("/structure/dir", "simple.ear");
+ assertChildContexts(context, "test-in-lib.sar", "test-in-lib.sar/lib/test.jar");
+ }
+
+ public void testEarSarWithNestedLib() throws Throwable
+ {
+ VFSDeploymentContext context = assertDeploy("/structure/dir", "nested.ear");
+ assertChildContexts(context, "test-in-lib-nested.sar", "test-in-lib-nested.sar/lib/nested/test.jar");
+ }
+}
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/RealDirStructureUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/RealDirStructureUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/dir/test/RealDirStructureUnitTestCase.java 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1,102 @@
+/*
+* 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.dir.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.vfs.plugins.structure.dir.DirectoryStructure;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer;
+
+/**
+ * Legacy directory structure tests.
+ * See JBAS-5900 for more information.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RealDirStructureUnitTestCase extends BootstrapDeployersTest
+{
+ public RealDirStructureUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(RealDirStructureUnitTestCase.class);
+ }
+
+ @SuppressWarnings("deprecation")
+ protected void assertDeploy(String file) throws Throwable
+ {
+ BeanMetaData earStructureBMD = new AbstractBeanMetaData("EarStructure", MockEarStructureDeployer.class.getName());
+ KernelControllerContext earContext = deploy(earStructureBMD);
+ try
+ {
+ BeanMetaData dirStructureBMD = new AbstractBeanMetaData("DirStructure", DirectoryStructure.class.getName());
+ KernelControllerContext dirContext = deploy(dirStructureBMD);
+ try
+ {
+ VFSDeploymentUnit unit = assertDeploy("/structure/dir", file);
+ try
+ {
+ assertNotNull(getBean("test:service=TestMessage"));
+ }
+ finally
+ {
+ undeploy(unit);
+ }
+ }
+ finally
+ {
+ undeploy(dirContext);
+ }
+ }
+ finally
+ {
+ undeploy(earContext);
+ }
+ }
+
+ public void testSarWithLib() throws Throwable
+ {
+ assertDeploy("test-in-lib.sar");
+ }
+
+ public void testSarWithNestedLib() throws Throwable
+ {
+ assertDeploy("test-in-lib-nested.sar");
+ }
+
+ public void testEarSarWithLib() throws Throwable
+ {
+ assertDeploy("simple.ear");
+ }
+
+ public void testEarSarWithNestedLib() throws Throwable
+ {
+ assertDeploy("nested.ear");
+ }
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/META-INF/application.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/META-INF/application.properties (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/META-INF/application.properties 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1 @@
+somesar=test-in-lib-nested.sar
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/META-INF/jboss-beans.xml 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1,7 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="test:service=TestMessage" class="test.TestMessage">
+ <property name="message">Hello World</property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/lib/nested/test.jar
===================================================================
(Binary files differ)
Property changes on: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/nested.ear/test-in-lib-nested.sar/lib/nested/test.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/META-INF/application.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/META-INF/application.properties (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/META-INF/application.properties 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1 @@
+somesar=test-in-lib.sar
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/META-INF/jboss-beans.xml 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1,7 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="test:service=TestMessage" class="test.TestMessage">
+ <property name="message">Hello World</property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/lib/test.jar
===================================================================
(Binary files differ)
Property changes on: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/simple.ear/test-in-lib.sar/lib/test.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/META-INF/jboss-beans.xml 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1,7 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="test:service=TestMessage" class="test.TestMessage">
+ <property name="message">Hello World</property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/lib/nested/test.jar
===================================================================
(Binary files differ)
Property changes on: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib-nested.sar/lib/nested/test.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/META-INF/jboss-beans.xml 2008-09-25 08:18:52 UTC (rev 78843)
@@ -0,0 +1,7 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="test:service=TestMessage" class="test.TestMessage">
+ <property name="message">Hello World</property>
+ </bean>
+
+</deployment>
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/lib/test.jar
===================================================================
(Binary files differ)
Property changes on: projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structure/dir/test-in-lib.sar/lib/test.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the jboss-cvs-commits
mailing list