[jboss-cvs] JBossAS SVN: r97076 - in projects/profileservice/trunk/core/src: main/java/org/jboss/profileservice/profile/metadata and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Nov 27 07:08:59 EST 2009
Author: emuckenhuber
Date: 2009-11-27 07:08:58 -0500 (Fri, 27 Nov 2009)
New Revision: 97076
Added:
projects/profileservice/trunk/core/src/test/resources/repository/org/jboss/web/
projects/profileservice/trunk/core/src/test/resources/repository/org/jboss/web/jboss-web-service/
projects/profileservice/trunk/core/src/test/resources/repository/org/jboss/web/jbossweb/
projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
Removed:
projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
Modified:
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualFileArtifact.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java
projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/VirtualMavenArtifactMetaData.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java
Log:
[JBPROFILE-2] update meta-inf location.
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/bootstrap/BootstrapProfileMetaData.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -33,7 +33,6 @@
import org.jboss.profileservice.profile.metadata.BasicSubProfileMetaData;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
-import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
@@ -46,7 +45,7 @@
{
/** The profile source. */
- private ProfileSourceMetaData source;
+ private BasicProfileSourceMetaData source;
/** The deployments. */
private List<BasicProfileDeploymentMetaData> deployments;
@@ -121,12 +120,12 @@
}
@XmlElement(name = "profile-source", type = BasicProfileSourceMetaData.class)
- public ProfileSourceMetaData getSource()
+ public BasicProfileSourceMetaData getSource()
{
return this.source;
}
- public void setSource(ProfileSourceMetaData source)
+ public void setSource(BasicProfileSourceMetaData source)
{
this.source = source;
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/metadata/BasicProfileMetaData.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -33,7 +33,6 @@
import org.jboss.profileservice.spi.metadata.ProfileDeploymentMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaData;
import org.jboss.profileservice.spi.metadata.ProfileMetaDataVisitor;
-import org.jboss.profileservice.spi.metadata.ProfileSourceMetaData;
import org.jboss.profileservice.spi.metadata.SubProfileMetaData;
import org.jboss.profileservice.spi.metadata.helpers.AbstractProfileMetaData;
@@ -48,7 +47,7 @@
{
/** The profile source. */
- private ProfileSourceMetaData source;
+ private BasicProfileSourceMetaData source;
/** The deployments. */
private List<ProfileDeploymentMetaData> deployments;
@@ -127,12 +126,12 @@
}
@XmlElement(name = "profile-source", type = BasicProfileSourceMetaData.class)
- public ProfileSourceMetaData getSource()
+ public BasicProfileSourceMetaData getSource()
{
return this.source;
}
- public void setSource(ProfileSourceMetaData source)
+ public void setSource(BasicProfileSourceMetaData source)
{
this.source = source;
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -32,6 +32,9 @@
public class BasicRepositoryConfiguration implements ArtifactRepositoryConfiguration
{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8415309101407938475L;
+
/** The repository type. */
private String type;
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -26,6 +26,8 @@
import org.jboss.profileservice.repository.artifact.AbstractArtifactId;
/**
+ * The file artifact.
+ *
* @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -36,62 +36,33 @@
public abstract class AbstractVirtualAssemblyContext implements VirtualAssemblyContext
{
- /** The meta data locations. */
- private final List<String> metaDataLocations = new ArrayList<String>();
+ /** The roots. */
+ private final List<String> roots = new ArrayList<String>();
- /** The class path entries. */
- private final List<String> classPathEntries = new ArrayList<String>();
-
/** The child contexts. */
private final List<VirtualDeploymentAssemblyContext> childs = new ArrayList<VirtualDeploymentAssemblyContext>();
-
- protected List<String> getClassPathLocations()
- {
- return this.classPathEntries;
- }
- protected List<String> getMetaDataLocations()
- {
- return this.metaDataLocations;
- }
-
protected List<VirtualDeploymentAssemblyContext> getChildren()
{
return this.childs;
}
- protected void addClassPathEntry(String entry)
+ public List<String> getRoots()
{
- if(entry != null)
- getClassPathLocations().add(entry);
+ return roots;
}
- protected void addClassEntries(List<String> entries)
+ protected void addRoot(String root)
{
- if(entries != null && entries.isEmpty() == false)
- {
- getClassPathLocations().addAll(entries);
- }
+ this.roots.add(root);
}
- protected void addMetaDataLocation(String location)
- {
- if(location != null)
- getMetaDataLocations().add(location);
- }
-
- protected void addMetaDataLocations(List<String> locations)
- {
- if(locations != null && locations.isEmpty() == false)
- {
- getMetaDataLocations().addAll(locations);
- }
- }
-
protected void addChild(VirtualDeploymentAssemblyContext ctx)
{
if(ctx != null)
+ {
getChildren().add(ctx);
+ }
}
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -22,14 +22,12 @@
package org.jboss.profileservice.virtual.assembly;
import java.io.IOException;
-import java.net.URL;
import org.jboss.profileservice.spi.repository.ArtifactId;
import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
import org.jboss.profileservice.spi.virtual.VirtualDeployment;
import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
@@ -194,31 +192,6 @@
}
return null;
}
-
- /**
- * Get a VirtualFile root.
- *
- * @param url string representation of the URL
- * @return the virtual file
- * @throws IOException
- */
- protected VirtualFile getVirtualFile(String url) throws IOException
- {
- URL rootURL = new URL(url);
- return getVirtualFile(rootURL);
- }
- /**
- * Get a VirtualFile root.
- *
- * @param rootURL the root URL
- * @return the virtual file
- * @throws IOException
- */
- protected VirtualFile getVirtualFile(URL rootURL) throws IOException
- {
- return VFS.getRoot(rootURL);
- }
-
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -22,11 +22,9 @@
package org.jboss.profileservice.virtual.assembly;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.jboss.logging.Logger;
import org.jboss.profileservice.spi.virtual.PathRestriction;
import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
import org.jboss.profileservice.spi.virtual.VirtualDeployment;
@@ -43,15 +41,15 @@
implements VirtualDeploymentAssemblyContext
{
+ /** The meta-inf name. */
+ public static final String META_INF = "META-INF";
+
/** The assembled directory. */
private final AssembledDirectory root;
/** The virtual deployment assembly. */
private final AbstractVirtualDeploymentAssembly assembly;
- /** The logger. */
- private static final Logger log = Logger.getLogger(BasicVirtualAssemblyContext.class);
-
public BasicVirtualAssemblyContext(AssembledDirectory root, AbstractVirtualDeploymentAssembly assembly)
{
if(root == null)
@@ -64,8 +62,15 @@
}
this.root = root;
this.assembly = assembly;
+ initialize();
}
+ protected void initialize()
+ {
+ // initialize the META-INF
+ getRoot().mkdir(META_INF);
+ }
+
@Override
public AssembledDirectory getRoot()
{
@@ -136,45 +141,50 @@
{
throw new IllegalArgumentException("null artifact");
}
- VirtualFile vf = createPath(artifact);
- Collection<String> paths = addVirtualPath(vf, artifact);
- // TODO
- if(artifact.isMetaDataPath())
+ // Create
+ boolean addChildsToRoots = true;
+ VirtualFile vf = resolvePath(artifact);
+ AssembledDirectory directory = getRoot();
+ String targetPath = artifact.getTargetPath();
+ if(targetPath != null)
{
- getMetaDataLocations().addAll(paths);
+ targetPath = targetPath.trim();
+ if(targetPath.isEmpty() == false)
+ {
+ directory = (AssembledDirectory) getRoot().getChild(targetPath);
+ if(directory == null)
+ {
+ directory = getRoot().mkdir(targetPath);
+ addRoots(targetPath);
+ }
+ addChildsToRoots = false;
+ }
}
- else
- {
- getClassPathLocations().addAll(paths);
- }
+ addVirtualPath(directory, vf, artifact.getIncludes(), artifact.getExcludes(), addChildsToRoots);
}
- protected VirtualFile createPath(VirtualArtifactMetaData path) throws IOException
+ protected VirtualFile resolvePath(VirtualArtifactMetaData path) throws IOException
{
return assembly.getVirtualFile(path);
}
- protected Collection<String> addVirtualPath(VirtualFile location, VirtualArtifactMetaData path) throws IOException
- {
- return addVirtualPath(location, path.getIncludes(), path.getExcludes());
- }
-
/**
* Visit a virtual file and add the children based on includes, excludes.
*
* The used filer is similar to the one used in the AssembledDirectory, except that not
* defined includes mean we accept everything.
*
+ * @param directory the assembled directory
* @param location the file to visit
* @param includes the includes
* @param excludes the excludes
- * @param the relative path names
+ * @param addToClasspath add to classpath
* @throws IOException
*/
- protected Collection<String> addVirtualPath(final VirtualFile location, final Collection<PathRestriction> includes,
- final Collection<PathRestriction> excludes) throws IOException
+ protected void addVirtualPath(final AssembledDirectory directory,
+ final VirtualFile location, final Collection<PathRestriction> includes,
+ final Collection<PathRestriction> excludes, boolean addToClasspath) throws IOException
{
- final List<String> included = new ArrayList<String>();
// Create the filter
final VirtualFileFilter recurseFilter = new VirtualFileFilter()
{
@@ -213,9 +223,7 @@
};
// Process files
- recurse(location, recurseFilter, included);
-
- return included;
+ recurse(directory, location, recurseFilter, addToClasspath);
}
/**
@@ -225,20 +233,23 @@
* need better control when to recurse into a archive and when
* not.
*
+ * @param directory the assembled directory
* @param location the virtual file
* @param filter the accept filter
- * @param included collection where included files are added
+ * @param add2Classpath add to classpath
* @throws IOException
*/
- protected void recurse(VirtualFile location, VirtualFileFilter filter, Collection<String> included) throws IOException
+ protected void recurse(AssembledDirectory directory, VirtualFile location, VirtualFileFilter filter, boolean addToClasspath) throws IOException
{
if(isLeaf(location) && filter.accepts(location))
{
- VirtualFile assembled = getRoot().mkdirs(location.getPathName()).addChild(location, location.getName());
- included.add(assembled.getName());
+ VirtualFile assembled = directory.mkdirs(location.getPathName()).addChild(location, location.getName());
+ if(addToClasspath)
+ {
+ addRoots(assembled.getName());
+ }
return;
}
-
List<VirtualFile> children = location.getChildren();
for(VirtualFile vf : children)
{
@@ -246,17 +257,31 @@
{
if(filter.accepts(vf))
{
- VirtualFile assembled = getRoot().mkdirs(vf.getPathName()).addChild(vf, vf.getName());
- included.add(assembled.getName());
+ VirtualFile assembled = directory.mkdirs(vf.getPathName()).addChild(vf, vf.getName());
+ if(addToClasspath)
+ {
+ addRoots(assembled.getName());
+ }
}
}
else
{
- recurse(vf, filter, included);
+ recurse(directory, vf, filter, addToClasspath);
}
}
}
+ protected void addRoots(String pathName)
+ {
+ if(META_INF.equals(pathName) == false)
+ {
+ if(getRoots().contains(pathName) == false)
+ {
+ getRoots().add(pathName);
+ }
+ }
+ }
+
/**
* Check if the file is a leaf. We also consider archives
* as leaves, as we don't care about their contents.
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -22,6 +22,7 @@
package org.jboss.profileservice.virtual.assembly;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.jboss.deployers.client.spi.Deployment;
@@ -50,8 +51,9 @@
// Create the structure meta data
if(ctx != null)
+ {
createStructureMetaData(target, "", ctx);
-
+ }
return target;
}
@@ -66,7 +68,7 @@
protected ContextInfo createStructureMetaData(Deployment deployment, String path, BasicVirtualAssemblyContext ctx)
{
- List<String> metaDataLocations = getMetaDataLocations(ctx);
+ List<String> metaDataLocations = Collections.singletonList(BasicVirtualAssemblyContext.META_INF);
List<ClassPathEntry> classPathEntries = getClassPathEntries(ctx);
ContextInfo info = deploymentFactory.addContext(deployment, path, metaDataLocations, classPathEntries);
@@ -78,22 +80,18 @@
createStructureMetaData(deployment, childPath, child);
}
}
-
return info;
}
- protected List<String> getMetaDataLocations(BasicVirtualAssemblyContext ctx)
- {
- return ctx.getMetaDataLocations();
- }
-
protected List<ClassPathEntry> getClassPathEntries(BasicVirtualAssemblyContext ctx)
{
List<ClassPathEntry> entries = new ArrayList<ClassPathEntry>();
- if(ctx.getClassPathLocations() != null && ctx.getClassPathLocations().isEmpty() == false)
+ if(ctx.getRoots() != null && ctx.getRoots().isEmpty() == false)
{
- for(String s : ctx.getClassPathLocations())
+ for(String s : ctx.getRoots())
+ {
entries.add(VFSDeploymentFactory.createClassPathEntry(s));
+ }
}
return entries;
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualFileArtifact.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualFileArtifact.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualFileArtifact.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -52,6 +52,15 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getTargetPath()
+ {
+ return null;
+ }
+
+ /**
* Get the includes.
*
* @return the includes
@@ -94,12 +103,6 @@
}
@Override
- public boolean isMetaDataPath()
- {
- return false;
- }
-
- @Override
public String toString()
{
StringBuffer buffer = new StringBuffer();
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -21,7 +21,10 @@
*/
package org.jboss.profileservice.virtual.deployment;
+import javax.xml.bind.annotation.XmlTransient;
+
import org.jboss.profileservice.spi.virtual.VirtualArtifactMetaData;
+import org.jboss.profileservice.virtual.assembly.BasicVirtualAssemblyContext;
/**
* The meta data location meta data.
@@ -32,10 +35,16 @@
public class MetaDataLocationMetaData extends AbstractVirtualFileArtifact implements VirtualArtifactMetaData
{
+ public MetaDataLocationMetaData()
+ {
+ super();
+ }
+
@Override
- public boolean isMetaDataPath()
+ @XmlTransient
+ public String getTargetPath()
{
- return true;
+ return BasicVirtualAssemblyContext.META_INF;
}
}
Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/VirtualMavenArtifactMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/VirtualMavenArtifactMetaData.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/VirtualMavenArtifactMetaData.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -24,6 +24,7 @@
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jboss.profileservice.repository.artifact.maven.MavenArtifactReference;
@@ -48,6 +49,17 @@
private List<PathRestriction> excludes;
/**
+ * {@inheritDoc}
+ */
+ @Override
+ @XmlTransient
+ public String getTargetPath()
+ {
+ // Just add to the root
+ return null;
+ }
+
+ /**
* Get the includes.
*
* @return the includes
@@ -88,12 +100,6 @@
{
this.excludes = excludes;
}
-
- @Override
- public boolean isMetaDataPath()
- {
- return false;
- }
}
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/metadata/test/BasicMetaDataUnitTestCase.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -66,7 +66,7 @@
ProfileMetaData basic = map.get("basic");
assertNotNull(basic);
assertTrue(basic instanceof BasicProfileMetaData);
- assertNotNull(basic.getSource().getSources());
+ assertNotNull(((BasicProfileMetaData)basic).getSource().getSources());
// Test custom wildcard
ProfileMetaData custom = map.get("custom");
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.profileservice.virtual.test;
-import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -58,14 +57,24 @@
protected ArtifactRepository<ArtifactId> createLocalFileArtifactRepo(String name) throws Exception
{
- URL rootURL = getResource(name);
- return (ArtifactRepository) new LocalFileArtifactRepository(rootURL.toURI());
+ return (ArtifactRepository) new LocalFileArtifactRepository(getResource(name).toURI());
}
protected void assertIncluded(VirtualFile vf, String... children) throws Exception
{
+ assertIncluded(vf, null, children);
+ }
+
+ protected void assertIncluded(VirtualFile vf, String target, String... children) throws Exception
+ {
+ if(target != null)
+ {
+ vf = vf.getChild(target);
+ }
for(String child : children)
- assertNotNull(child, vf.getChild(child));
+ {
+ assertNotNull(child + " available " + vf.getChildren(), vf.getChild(child));
+ }
}
protected void asssertExcluded(VirtualFile vf, String... children) throws Exception
@@ -73,6 +82,18 @@
for(String child : children)
assertNull(child, vf.getChild(child));
}
+
+ protected void asssertExcluded(VirtualFile vf, String target, String... children) throws Exception
+ {
+ if(target != null)
+ {
+ vf = vf.getChild(target);
+ }
+ for(String child : children)
+ {
+ assertNull(child, vf.getChild(child));
+ }
+ }
protected Map<String, VirtualDeployment> mapDeployments(VirtualRepositoryMetaData metaData)
{
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -82,8 +82,7 @@
ProfileDeployment deployer = createProfileDeployment(deployerVD);
StructureMetaData deployerStructure = createStructureMetaData(deployer);
assertNotNull("null deployer structure", deployerStructure);
- assertMetaDataLocations(deployerStructure.getContext(""), new String[]
- {"test.xml", "test1.xml", "include.xml"});
+ assertMetaDataLocations(deployerStructure.getContext(""));
assertClassPathEntries(deployerStructure.getContext(""), new String[]
{"deployer.jar", "fake.jar", "fake2.jar"});
@@ -92,24 +91,21 @@
ProfileDeployment deployment = createProfileDeployment(deploymentVD);
StructureMetaData deploymentStructure = createStructureMetaData(deployment);
assertNotNull("null deployment structure", deploymentStructure);
- assertMetaDataLocations(deploymentStructure.getContext(""), new String[]
- {"jboss-beans.xml"});
+ assertMetaDataLocations(deploymentStructure.getContext(""));
assertClassPathEntries(deploymentStructure.getContext(""),
new String[] {"deployment.jar"});
// Check sub deployment ctx
assertNotNull("test sub deployment", deploymentStructure.getContext("test-sub-deployment"));
- assertMetaDataLocations(deploymentStructure.getContext("test-sub-deployment"),
- new String[] {"jboss-beans.xml"});
+ assertMetaDataLocations(deploymentStructure.getContext("test-sub-deployment"));
assertClassPathEntries(deploymentStructure.getContext("test-sub-deployment"),
new String[] {"test.jar"});
}
- protected void assertMetaDataLocations(ContextInfo info, String... locations)
+ protected void assertMetaDataLocations(ContextInfo info)
{
assertNotNull("null meta data path", info.getMetaDataPath());
- List<String> metaDataLocations = Arrays.asList(locations);
- assertEquals("same size", metaDataLocations.size(), info.getMetaDataPath().size());
- assertTrue(info.getMetaDataPath().containsAll(metaDataLocations));
+ assertEquals("same size", info.getMetaDataPath().size(), 1);
+ assertTrue(info.getMetaDataPath().contains("META-INF"));
}
protected void assertClassPathEntries(ContextInfo info, String... paths)
@@ -119,7 +115,7 @@
List<String> generated = new ArrayList<String>();
for(ClassPathEntry entry : info.getClassPath())
generated.add(entry.getPath());
- assertEquals("same size", original.size(), generated.size());
+ assertEquals("same size" + generated, original.size(), generated.size());
assertTrue(generated.containsAll(original));
}
Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java 2009-11-27 12:08:58 UTC (rev 97076)
@@ -69,8 +69,9 @@
AbstractVirtualDeployment deployerVD = (AbstractVirtualDeployment) deployments.get("test.deployer");
ProfileDeployment deployer = factory.createDeployment(deployerVD);
assertTrue(deployer.getRoot() instanceof AssembledDirectory);
+
// Check meta data includes/excludes
- assertIncluded(deployer.getRoot(), new String[] {
+ assertIncluded(deployer.getRoot(), "META-INF", new String[] {
"test.xml", "test1.xml", "include.xml"});
asssertExcluded(deployer.getRoot(), new String[] {"exclude-beans.xml"});
// Check class path includes/excludes
@@ -90,7 +91,8 @@
VirtualFile subDeploymentRoot = deployment.getRoot().getChild("test-sub-deployment");
assertNotNull(subDeploymentRoot);
// Check the sub deployments files
- assertIncluded(subDeploymentRoot, new String[] {"jboss-beans.xml", "test.jar"} );
+ assertIncluded(subDeploymentRoot, "META-INF", new String[] {"jboss-beans.xml"});
+ assertIncluded(subDeploymentRoot, new String[] {"test.jar"});
// Check requirement
resolves(deployerVD, deploymentVD.getRequires().get(0));
Deleted: projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml 2009-11-27 09:56:58 UTC (rev 97075)
+++ projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml 2009-11-27 12:08:58 UTC (rev 97076)
@@ -1,29 +0,0 @@
-<profiles xmlns="urn:jboss:profileservice:profiles:1.0"
- name="profiles">
-
-<!--
- <profile name="simple-deployer">
- <virtual-deployment-artifact name="simple.deployer"
- groupId="org.jboss.test" artifactId="jboss-simple-deployer" from="1.0.0" to="1.1.0" />
- </profile>
- -->
- <profile name="test-deployer">
- <virtual-deployment name="test-deployer">
- <meta-inf path="test.deployer/meta-inf" />
- <artifact groupId="org.jboss.test" artifactId="test-common" from="2.0.0" to="2.1.0" />
- </virtual-deployment>
- </profile>
-
- <profile name="test-deployment">
- <virtual-deployment name="test-deployment">
- <meta-inf path="test-deployment/META-INF" />
- <classpath path="test-deployment/lib" />
-
- <virtual-deployment name="test-sub-deployment">
- <meta-inf path="test-deployment/child/META-INF" />
- <artifact groupId="org.jboss.test" artifactId="test-library" from="2.0.0" to="2.2.0" />
- </virtual-deployment>
- </virtual-deployment>
- </profile>
-
-</profiles>
\ No newline at end of file
Added: projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/repository/profiles.xml 2009-11-27 12:08:58 UTC (rev 97076)
@@ -0,0 +1,29 @@
+<profiles xmlns="urn:jboss:profileservice:profiles:1.0"
+ name="profiles">
+
+<!--
+ <profile name="simple-deployer">
+ <virtual-deployment-artifact name="simple.deployer"
+ groupId="org.jboss.test" artifactId="jboss-simple-deployer" from="1.0.0" to="1.1.0" />
+ </profile>
+ -->
+ <profile name="test-deployer">
+ <virtual-deployment name="test-deployer">
+ <meta-inf path="test.deployer/meta-inf" />
+ <artifact groupId="org.jboss.test" artifactId="test-common" from="2.0.0" to="2.1.0" />
+ </virtual-deployment>
+ </profile>
+
+ <profile name="test-deployment">
+ <virtual-deployment name="test-deployment">
+ <meta-inf path="test-deployment/META-INF" />
+ <classpath path="test-deployment/lib" />
+
+ <virtual-deployment name="test-sub-deployment">
+ <meta-inf path="test-deployment/child/META-INF" />
+ <artifact groupId="org.jboss.test" artifactId="test-library" from="2.0.0" to="2.2.0" />
+ </virtual-deployment>
+ </virtual-deployment>
+ </profile>
+
+</profiles>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list