[jboss-cvs] JBossAS SVN: r70765 - in projects/jboss-deployers/trunk/deployers-vfs/src: resources/tests/structure/ear/noappxml.ear and 39 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 12 08:36:54 EDT 2008
Author: alesj
Date: 2008-03-12 08:36:54 -0400 (Wed, 12 Mar 2008)
New Revision: 70765
Added:
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/client.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/client.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/client.jar/META-INF/application-client.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/foobar.sar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/foobar.sar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/foobar.sar/META-INF/jboss-service.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/known.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/known.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/known.jar/META-INF/ejb-jar.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/mf.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/mf.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/mf.jar/META-INF/MANIFEST.MF
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/ts.rar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/ts.rar/empty.txt
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/webapp.war/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/webapp.war/WEB-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/webapp.war/WEB-INF/web.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/META-INF/jboss-application.properties
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/client.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/client.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/client.jar/META-INF/application-client.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/foobar.sar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/foobar.sar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/foobar.sar/META-INF/jboss-service.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/known.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/known.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/known.jar/META-INF/ejb-jar.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/mf.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/mf.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/mf.jar/META-INF/MANIFEST.MF
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/ts.rar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/ts.rar/empty.txt
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/webapp.war/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/webapp.war/WEB-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/webapp.war/WEB-INF/web.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/META-INF/application.properties
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/client.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/client.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/client.jar/META-INF/application-client.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/foobar.sar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/foobar.sar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/foobar.sar/META-INF/jboss-service.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/known.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/known.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/known.jar/META-INF/ejb-jar.xml
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/mf.jar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/mf.jar/META-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/mf.jar/META-INF/MANIFEST.MF
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/ts.rar/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/ts.rar/empty.txt
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/webapp.war/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/webapp.war/WEB-INF/
projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/webapp.war/WEB-INF/web.xml
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/J2eeModuleMetaData.java
Modified:
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/EARStructureUnitTestCase.java
Log:
JBDEPLOY-10; initial ear children recognision
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/client.jar/META-INF/application-client.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/foobar.sar/META-INF/jboss-service.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/known.jar/META-INF/ejb-jar.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/mf.jar/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/mf.jar/META-INF/MANIFEST.MF (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/mf.jar/META-INF/MANIFEST.MF 2008-03-12 12:36:54 UTC (rev 70765)
@@ -0,0 +1,7 @@
+Name: java/util/
+Specification-Title: "Java Utility Classes"
+Specification-Version: "1.2"
+Specification-Vendor: "Red Hat, Inc.".
+Implementation-Title: "java.util"
+Implementation-Version: "build57"
+Implementation-Vendor: "Red Hat, Inc."
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/ts.rar/empty.txt
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/noappxml.ear/webapp.war/WEB-INF/web.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/META-INF/jboss-application.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/META-INF/jboss-application.properties (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/META-INF/jboss-application.properties 2008-03-12 12:36:54 UTC (rev 70765)
@@ -0,0 +1,2 @@
+known-module=known.jar
+jca-ts=ts.rar
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/client.jar/META-INF/application-client.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/foobar.sar/META-INF/jboss-service.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/known.jar/META-INF/ejb-jar.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/mf.jar/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/mf.jar/META-INF/MANIFEST.MF (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/mf.jar/META-INF/MANIFEST.MF 2008-03-12 12:36:54 UTC (rev 70765)
@@ -0,0 +1,7 @@
+Name: java/util/
+Specification-Title: "Java Utility Classes"
+Specification-Version: "1.2"
+Specification-Vendor: "Red Hat, Inc.".
+Implementation-Title: "java.util"
+Implementation-Version: "build57"
+Implementation-Vendor: "Red Hat, Inc."
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/ts.rar/empty.txt
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/someappxml.ear/webapp.war/WEB-INF/web.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/META-INF/application.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/META-INF/application.properties (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/META-INF/application.properties 2008-03-12 12:36:54 UTC (rev 70765)
@@ -0,0 +1,2 @@
+known-module=known.jar
+jca-ts=ts.rar
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/client.jar/META-INF/application-client.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/foobar.sar/META-INF/jboss-service.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/known.jar/META-INF/ejb-jar.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/mf.jar/META-INF/MANIFEST.MF
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/mf.jar/META-INF/MANIFEST.MF (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/mf.jar/META-INF/MANIFEST.MF 2008-03-12 12:36:54 UTC (rev 70765)
@@ -0,0 +1,7 @@
+Name: java/util/
+Specification-Title: "Java Utility Classes"
+Specification-Version: "1.2"
+Specification-Vendor: "Red Hat, Inc.".
+Implementation-Title: "java.util"
+Implementation-Version: "build57"
+Implementation-Vendor: "Red Hat, Inc."
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/ts.rar/empty.txt
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/resources/tests/structure/ear/strict.ear/webapp.war/WEB-INF/web.xml
===================================================================
Added: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/J2eeModuleMetaData.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/J2eeModuleMetaData.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/J2eeModuleMetaData.java 2008-03-12 12:36:54 UTC (rev 70765)
@@ -0,0 +1,35 @@
+/*
+* 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.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface J2eeModuleMetaData
+{
+ public static final int WEB = 1;
+ public static final int CONNECTOR = 2;
+ public static final int HAR = 3;
+ public static final int SERVICE = 4;
+ public static final int CLIENT = 5;
+ public static final int EJB = 6;
+}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2008-03-12 12:08:20 UTC (rev 70764)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2008-03-12 12:36:54 UTC (rev 70765)
@@ -26,12 +26,15 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.vfs.spi.structure.VFSStructuralDeployers;
import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
+import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.VirtualFileFilter;
import org.jboss.virtual.plugins.vfs.helpers.SuffixMatchFilter;
@@ -39,7 +42,7 @@
/**
* A mock ear structure deployer that illustrates concepts involved with an ear
* type of deployer.
- *
+ *
* @author Scott.Stark at jboss.org
* @version $Revision:$
*/
@@ -63,7 +66,7 @@
/**
* Get the earLibFilter.
- *
+ *
* @return the earLibFilter.
*/
public VirtualFileFilter getEarLibFilter()
@@ -73,7 +76,7 @@
/**
* Set the earLibFilter.
- *
+ *
* @param earLibFilter the filter
* @throws IllegalArgumentException for a null filter
*/
@@ -96,24 +99,18 @@
context = createContext(file, "META-INF", metaData);
VirtualFile applicationProps = getMetaDataFile(file, "META-INF/application.properties");
+ VirtualFile jbossProps = getMetaDataFile(file, "META-INF/jboss-application.properties");
boolean scan = true;
List<EarModule> modules = new ArrayList<EarModule>();
if (applicationProps != null)
{
- // This is a simple module-name=earPath properties file
- InputStream in = applicationProps.openStream();
- Properties props = new Properties();
- props.load(in);
- in.close();
scan = false;
- for(Object key : props.keySet())
- {
- String name = (String) key;
- String fileName = props.getProperty(name);
- EarModule module = new EarModule(name, fileName);
- modules.add(module);
- }
+ readAppXml(applicationProps, modules);
}
+ if (jbossProps != null)
+ {
+ readAppXml(jbossProps, modules);
+ }
// Add the ear lib contents to the classpath
try
{
@@ -133,43 +130,38 @@
// Add the ear manifest locations?
super.addClassPath(root, file, false, true, context);
- // TODO JBMICROCONT-185 need to scan for annotationss
if (scan)
+ scanEar(file, modules);
+
+ // Create subdeployments for the ear modules
+ for (EarModule mod : modules)
{
- throw new RuntimeException("Scanning not implemented: "+file.getName());
- }
- else
- {
- // Create subdeployments for the ear modules
- for(EarModule mod : modules)
+ String fileName = mod.getFileName();
+ if (fileName != null && (fileName = fileName.trim()).length() > 0)
{
- String fileName = mod.getFileName();
- if (fileName != null && (fileName = fileName.trim()).length() > 0)
+ try
{
- try
+ VirtualFile module = file.getChild(fileName);
+ if (module == null)
{
- VirtualFile module = file.getChild(fileName);
- if (module == null)
- {
- throw new RuntimeException(fileName
- + " module listed in application.xml does not exist within .ear "
- + file.getName());
- }
- // Ask the deployers to analyze this
- if (deployers.determineStructure(root, file, module, metaData) == false)
- {
- throw new RuntimeException(fileName
- + " module listed in application.xml is not a recognized deployment, .ear: "
- + file.getName());
- }
+ throw new RuntimeException(fileName
+ + " module listed in application.xml does not exist within .ear "
+ + file.getName());
}
- catch (IOException e)
+ // Ask the deployers to analyze this
+ if (deployers.determineStructure(root, file, module, metaData) == false)
{
throw new RuntimeException(fileName
- + " module listed in application.xml does not exist within .ear "
- + file.getName(), e);
+ + " module listed in application.xml is not a recognized deployment, .ear: "
+ + file.getName());
}
}
+ catch (IOException e)
+ {
+ throw new RuntimeException(fileName
+ + " module listed in application.xml does not exist within .ear "
+ + file.getName(), e);
+ }
}
}
@@ -177,12 +169,142 @@
}
catch (Exception e)
{
- throw new RuntimeException("Error determining structure: "+ file.getName(), e);
+ throw new RuntimeException("Error determining structure: " + file.getName(), e);
}
return valid;
}
+ protected void readAppXml(VirtualFile file, List<EarModule> modules)
+ throws IOException
+ {
+ InputStream in = file.openStream();
+ try
+ {
+ Properties props = new Properties();
+ props.load(in);
+ for (Object key : props.keySet())
+ {
+ String name = (String)key;
+ String fileName = props.getProperty(name);
+ EarModule module = new EarModule(name, fileName);
+ modules.add(module);
+ }
+ }
+ finally
+ {
+ in.close();
+ }
+ }
+
+ private void scanEar(VirtualFile root, List<EarModule> modules) throws IOException
+ {
+ List<VirtualFile> archives = root.getChildren();
+ if (archives != null)
+ {
+ String earPath = root.getPathName();
+ int counter = 0;
+ for (VirtualFile vfArchive : archives)
+ {
+ String filename = earRelativePath(earPath, vfArchive.getPathName());
+ // Check if the module already exists, i.e. it is declared in jboss-app.xml
+ EarModule moduleMetaData = getModule(modules, filename);
+ int type = typeFromSuffix(filename, vfArchive);
+ if (type >= 0 && moduleMetaData == null)
+ {
+ String typeString = null;
+ switch(type)
+ {
+ case J2eeModuleMetaData.EJB:
+ typeString = "Ejb";
+ break;
+ case J2eeModuleMetaData.CLIENT:
+ typeString = "Java";
+ break;
+ case J2eeModuleMetaData.CONNECTOR:
+ typeString = "Connector";
+ break;
+ case J2eeModuleMetaData.SERVICE:
+ case J2eeModuleMetaData.HAR:
+ typeString = "Service";
+ break;
+ case J2eeModuleMetaData.WEB:
+ typeString = "Web";
+ break;
+ }
+ moduleMetaData = new EarModule(typeString + "Module" + counter, filename);
+ modules.add(moduleMetaData);
+ counter++;
+ }
+ }
+ }
+ }
+
+ private EarModule getModule(List<EarModule> modules, String filename)
+ {
+ for(EarModule em : modules)
+ if (filename.endsWith(em.getFileName()))
+ return em;
+ return null;
+ }
+
+ private int typeFromSuffix(String path, VirtualFile archive)
+ throws IOException
+ {
+ int type = -1;
+ if (path.endsWith(".war"))
+ type = J2eeModuleMetaData.WEB;
+ else if (path.endsWith(".rar"))
+ type = J2eeModuleMetaData.CONNECTOR;
+ else if (path.endsWith(".har"))
+ type = J2eeModuleMetaData.HAR;
+ else if (path.endsWith(".sar"))
+ type = J2eeModuleMetaData.SERVICE;
+ else if (path.endsWith(".jar"))
+ {
+ // Look for a META-INF/application-client.xml
+ VirtualFile mfFile = getMetaDataFile(archive, "META-INF/MANIFEST.MF");
+ VirtualFile clientXml = getMetaDataFile(archive, "META-INF/application-client.xml");
+ VirtualFile ejbXml = getMetaDataFile(archive, "META-INF/ejb-jar.xml");
+ VirtualFile jbossXml = getMetaDataFile(archive, "META-INF/jboss.xml");
+
+ if (clientXml != null)
+ {
+ type = J2eeModuleMetaData.CLIENT;
+ }
+ else if (mfFile != null)
+ {
+ Manifest mf = VFSUtils.readManifest(mfFile);
+ Attributes attrs = mf.getMainAttributes();
+ if (attrs.containsKey(Attributes.Name.MAIN_CLASS))
+ {
+ type = J2eeModuleMetaData.CLIENT;
+ }
+ else
+ {
+ type = J2eeModuleMetaData.EJB;
+ }
+ }
+ else if (ejbXml != null || jbossXml != null)
+ {
+ type = J2eeModuleMetaData.EJB;
+ }
+ else
+ {
+ type = J2eeModuleMetaData.EJB;
+ }
+ }
+
+ return type;
+ }
+
+ private String earRelativePath(String earPath, String pathName)
+ {
+ StringBuilder tmp = new StringBuilder(pathName);
+ tmp.delete(0, earPath.length());
+ return tmp.toString();
+ }
+
private VirtualFile getMetaDataFile(VirtualFile file, String path)
{
VirtualFile metaFile = null;
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/EARStructureUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/EARStructureUnitTestCase.java 2008-03-12 12:08:20 UTC (rev 70764)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/structure/ear/test/EARStructureUnitTestCase.java 2008-03-12 12:36:54 UTC (rev 70765)
@@ -57,6 +57,36 @@
}
/**
+ * Validate scanning of ear.
+ * @throws Throwable for any error
+ */
+ public void testScanEAR() throws Throwable
+ {
+ VFSDeploymentContext ear = assertDeploy("/structure/ear", "noappxml.ear");
+ assertChildContexts(ear, "client.jar", "foobar.sar", "known.jar", "mf.jar", "ts.rar", "webapp.war");
+ }
+
+ /**
+ * Validate mixed ear.
+ * @throws Throwable for any error
+ */
+ public void testMixedEAR() throws Throwable
+ {
+ VFSDeploymentContext ear = assertDeploy("/structure/ear", "someappxml.ear");
+ assertChildContexts(ear, "client.jar", "foobar.sar", "known.jar", "mf.jar", "ts.rar", "webapp.war");
+ }
+
+ /**
+ * Validate strict ear.
+ * @throws Throwable for any error
+ */
+ public void testStrictEAR() throws Throwable
+ {
+ VFSDeploymentContext ear = assertDeploy("/structure/ear", "strict.ear");
+ assertChildContexts(ear, "known.jar", "ts.rar");
+ }
+
+ /**
* Validate a basic ear with modules having no subdeployments
* @throws Throwable for any problem
*/
More information about the jboss-cvs-commits
mailing list