[jboss-cvs] JBossAS SVN: r79139 - in projects/jboss-deployers/branches/Branch_2_0: deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 6 07:08:10 EDT 2008
Author: alesj
Date: 2008-10-06 07:08:10 -0400 (Mon, 06 Oct 2008)
New Revision: 79139
Added:
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/RequirementsIntegrationUnitTestCase.java
Modified:
projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/ModuleRequirementIntegrationDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/PackageRequirementIntegrationDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/RequirementIntegrationDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/ClassLoaderTestSuite.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/VFSClassLoaderDependenciesTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java
Log:
[JBDEPLOY-97, JBDEPLOY-98]; port changes to 2_0 branch.
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/AbstractDeployerTest.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -25,6 +25,8 @@
import org.jboss.dependency.plugins.AbstractController;
import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.client.spi.Deployment;
@@ -36,6 +38,7 @@
import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
import org.jboss.deployers.spi.deployer.Deployer;
import org.jboss.deployers.spi.deployer.Deployers;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.deployers.spi.deployer.managed.ManagedDeploymentCreator;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.structure.spi.DeploymentContext;
@@ -208,6 +211,20 @@
return factory.addContext(parent, name);
}
+ /**
+ * This stage check is impl detail.
+ *
+ * @param unit the deployment unit
+ * @param stage expected deployment stage
+ */
+ protected void assertDeploymentStage(DeploymentUnit unit, DeploymentStage stage)
+ {
+ ControllerContext context = unit.getAttachment(ControllerContext.class);
+ assertNotNull("Expecting controller context attachment: " + unit, context);
+ ControllerState state = new ControllerState(stage.getName());
+ assertEquals(state, context.getState());
+ }
+
@Override
protected void configureLogging()
{
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/ModuleRequirementIntegrationDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/ModuleRequirementIntegrationDeployer.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/ModuleRequirementIntegrationDeployer.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -45,6 +45,9 @@
protected AbstractRequirement hasIntegrationModuleRequirement(RequirementsMetaData metadata)
{
+ if (metadata == null)
+ return null;
+
List<Requirement> requirements = metadata.getRequirements();
if (requirements != null && requirements.isEmpty() == false)
{
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/PackageRequirementIntegrationDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/PackageRequirementIntegrationDeployer.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/PackageRequirementIntegrationDeployer.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -46,6 +46,9 @@
protected AbstractRequirement hasIntegrationModuleRequirement(RequirementsMetaData metadata)
{
+ if (metadata == null)
+ return null;
+
List<Requirement> requirements = metadata.getRequirements();
if (requirements != null && requirements.isEmpty() == false && packages != null && packages.isEmpty() == false)
{
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/RequirementIntegrationDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/RequirementIntegrationDeployer.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/RequirementIntegrationDeployer.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -21,6 +21,11 @@
*/
package org.jboss.deployers.vfs.plugins.classloader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaDataFactory;
import org.jboss.classloading.spi.metadata.Requirement;
@@ -41,17 +46,15 @@
*/
public abstract class RequirementIntegrationDeployer<T> extends AbstractOptionalVFSRealDeployer<T>
{
- /** The jboss integration module name */
- private String integrationModuleName;
+ /** The jboss integration module names */
+ private Set<String> integrationModuleNames;
public RequirementIntegrationDeployer(Class<T> input)
{
super(input);
-
// We have to run before the classloading is setup
setStage(DeploymentStages.DESCRIBE);
-
- // We modify the classloading "imports"/requirements
+ // We modify the classloading imports/requirements
addInput(ClassLoadingMetaData.class);
setOutput(ClassLoadingMetaData.class);
}
@@ -63,7 +66,10 @@
*/
public String getIntegrationModuleName()
{
- return integrationModuleName;
+ if (integrationModuleNames == null || integrationModuleNames.isEmpty())
+ return null;
+ else
+ return integrationModuleNames.iterator().next();
}
/**
@@ -73,24 +79,105 @@
*/
public void setIntegrationModuleName(String integrationModuleName)
{
- this.integrationModuleName = integrationModuleName;
+ if (integrationModuleNames == null)
+ this.integrationModuleNames = Collections.singleton(integrationModuleName);
+ else
+ this.integrationModuleNames.add(integrationModuleName);
}
+ /**
+ * Get integration module names.
+ *
+ * @return the integration module names
+ */
+ public Set<String> getIntegrationModuleNames()
+ {
+ return integrationModuleNames;
+ }
+
+ /**
+ * Set integration module names
+ *
+ * @param integrationModuleNames the integration modeul names
+ */
+ public void setIntegrationModuleNames(Set<String> integrationModuleNames)
+ {
+ this.integrationModuleNames = integrationModuleNames;
+ }
+
+ /**
+ * Check if integration urls exist.
+ */
+ public void start()
+ {
+ if (integrationModuleNames == null || integrationModuleNames.isEmpty())
+ throw new IllegalArgumentException("No integration module names.");
+ }
+
@Override
public void deploy(VFSDeploymentUnit unit, T metaData) throws DeploymentException
{
ClassLoadingMetaData clmd = unit.getAttachment(ClassLoadingMetaData.class);
+ if (clmd == null)
+ {
+ log.warn("Missing ClassLoadingMetaData: " + unit);
+ return;
+ }
+
RequirementsMetaData requirements = clmd.getRequirements();
AbstractRequirement integrationModule = hasIntegrationModuleRequirement(requirements);
- // If we are importing integration core then import the jboss integration at the same version
+ // If we are importing integration core then import the integration at the same version
if (integrationModule != null)
{
ClassLoadingMetaDataFactory factory = ClassLoadingMetaDataFactory.getInstance();
- Requirement integrationRequirement = factory.createRequireModule(integrationModuleName, integrationModule.getVersionRange());
- requirements.addRequirement(integrationRequirement);
+ List<Requirement> added = new ArrayList<Requirement>();
+ try
+ {
+ for (String integrationModuleName : integrationModuleNames)
+ {
+ Requirement integrationRequirement = factory.createRequireModule(integrationModuleName, integrationModule.getVersionRange());
+ requirements.addRequirement(integrationRequirement);
+ added.add(integrationModule);
+ }
+ }
+ catch (Throwable t)
+ {
+ for (int i = added.size() - 1; i >=0; i--)
+ {
+ requirements.removeRequirement(added.get(i));
+ }
+ throw DeploymentException.rethrowAsDeploymentException("Error adding integration requirement.", t);
+ }
}
}
+ @Override
+ public void undeploy(VFSDeploymentUnit unit, T deployment)
+ {
+ ClassLoadingMetaData clmd = unit.getAttachment(ClassLoadingMetaData.class);
+ if (clmd != null)
+ {
+ RequirementsMetaData requirements = clmd.getRequirements();
+ AbstractRequirement integrationModule = hasIntegrationModuleRequirement(requirements);
+ if (integrationModule != null)
+ {
+ ClassLoadingMetaDataFactory factory = ClassLoadingMetaDataFactory.getInstance();
+ for (String integrationModuleName : integrationModuleNames)
+ {
+ try
+ {
+ Requirement integrationRequirement = factory.createRequireModule(integrationModuleName, integrationModule.getVersionRange());
+ requirements.removeRequirement(integrationRequirement);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error during requirement removal: " + integrationModuleName, t);
+ }
+ }
+ }
+ }
+ }
+
/**
* Do we have integration module requirements.
*
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -21,9 +21,13 @@
*/
package org.jboss.deployers.vfs.plugins.classloader;
-import java.io.IOException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.vfs.spi.deployer.AbstractOptionalVFSRealDeployer;
@@ -42,13 +46,15 @@
public abstract class UrlIntegrationDeployer<T> extends AbstractOptionalVFSRealDeployer<T>
{
/** Location of integration jar */
- private URL integrationURL;
+ private Set<URL> integrationURLs;
public UrlIntegrationDeployer(Class<T> input)
{
super(input);
// We have to run before the classloading is setup
- setStage(DeploymentStages.POST_PARSE);
+ setStage(DeploymentStages.DESCRIBE);
+ // Keep things simple having one attachment to control the classloader processing order
+ setOutput(ClassLoadingMetaData.class);
}
/**
@@ -58,7 +64,10 @@
*/
public URL getIntegrationURL()
{
- return integrationURL;
+ if (integrationURLs == null || integrationURLs.isEmpty())
+ return null;
+ else
+ return integrationURLs.iterator().next();
}
/**
@@ -68,31 +77,106 @@
*/
public void setIntegrationURL(URL url)
{
- this.integrationURL = url;
+ if (integrationURLs == null)
+ integrationURLs = Collections.singleton(url);
+ else
+ integrationURLs.add(url);
}
+ /**
+ * Get integration urls.
+ *
+ * @return the integration urls
+ */
+ public Set<URL> getIntegrationURLs()
+ {
+ return integrationURLs;
+ }
+
+ /**
+ * Set integration urls.
+ *
+ * @param integrationURLs the integration urls
+ */
+ public void setIntegrationURLs(Set<URL> integrationURLs)
+ {
+ this.integrationURLs = integrationURLs;
+ }
+
+ /**
+ * Check if integration urls exist.
+ */
+ public void start()
+ {
+ if (integrationURLs == null || integrationURLs.isEmpty())
+ throw new IllegalArgumentException("No integration urls.");
+ }
+
@Override
public void deploy(VFSDeploymentUnit unit, T metaData) throws DeploymentException
{
- if (isIntegrationDeployment(unit))
+ if (isIntegrationDeployment(unit, metaData))
{
+ List<VirtualFile> added = new ArrayList<VirtualFile>();
try
{
- VirtualFile integration = VFS.getRoot(integrationURL);
- unit.addClassPath(integration);
+ for (URL integrationURL : integrationURLs)
+ {
+ VirtualFile integration = VFS.getRoot(integrationURL);
+ unit.addClassPath(integration);
+ added.add(integration);
+ }
}
- catch (IOException e)
+ catch (Throwable t)
{
- throw DeploymentException.rethrowAsDeploymentException("Error adding integration path.", e);
+ List<VirtualFile> classPath = unit.getClassPath();
+ for (int i = added.size() - 1; i >=0; i--)
+ {
+ classPath.remove(added.get(i));
+ }
+ throw DeploymentException.rethrowAsDeploymentException("Error adding integration path.", t);
}
}
}
+ @Override
+ public void undeploy(VFSDeploymentUnit unit, T metaData)
+ {
+ if (isIntegrationDeployment(unit, metaData))
+ {
+ List<VirtualFile> classPath = unit.getClassPath();
+ for (URL integrationURL : integrationURLs)
+ {
+ try
+ {
+ VirtualFile integration = VFS.getRoot(integrationURL);
+ classPath.remove(integration);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Error removing integration from classpath: " + integrationURL, t);
+ }
+ }
+ }
+ }
+
/**
* Is unit integration deployment unit?
*
* @param unit the deployment unit
+ * @param metaData the meta data
* @return true if the unit is integration deployment
*/
+ protected boolean isIntegrationDeployment(VFSDeploymentUnit unit, T metaData)
+ {
+ return isIntegrationDeployment(unit);
+ }
+
+ /**
+ * Is unit integration deployment unit?
+ *
+ * @param unit the deployment unit
+ * @return true if the unit is integration deployment
+ */
protected abstract boolean isIntegrationDeployment(VFSDeploymentUnit unit);
}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/ClassLoaderTestSuite.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/ClassLoaderTestSuite.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/ClassLoaderTestSuite.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -34,6 +34,7 @@
import org.jboss.test.deployers.vfs.classloader.test.VFSClassLoaderDependenciesUnitTestCase;
import org.jboss.test.deployers.vfs.classloader.test.VFSUndeployOrderClassLoaderUnitTestCase;
import org.jboss.test.deployers.vfs.classloader.test.IntegrationDeployerUnitTestCase;
+import org.jboss.test.deployers.vfs.classloader.test.RequirementsIntegrationUnitTestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -69,6 +70,7 @@
suite.addTest(NotVFSClassLoaderUnitTestCase.suite());
suite.addTest(ManifestClassLoaderUnitTestCase.suite());
suite.addTest(IntegrationDeployerUnitTestCase.suite());
+ suite.addTest(RequirementsIntegrationUnitTestCase.suite());
return suite;
}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/RequirementsIntegrationUnitTestCase.java (from rev 79138, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/RequirementsIntegrationUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/RequirementsIntegrationUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/RequirementsIntegrationUnitTestCase.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -0,0 +1,180 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.classloader.test;
+
+import java.util.Collections;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.classloader.plugins.ClassLoaderUtils;
+import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.classloader.plugins.system.DefaultClassLoaderSystem;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.deployer.Deployer;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.classloader.ModuleRequirementIntegrationDeployer;
+import org.jboss.deployers.vfs.plugins.classloader.PackageRequirementIntegrationDeployer;
+import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer;
+import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer;
+import org.jboss.test.deployers.vfs.classloader.support.TestLevelClassLoaderSystemDeployer;
+import org.jboss.test.deployers.vfs.classloader.support.a.A;
+
+/**
+ * RequirementsIntegrationUnitTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class RequirementsIntegrationUnitTestCase extends VFSClassLoaderDependenciesTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(RequirementsIntegrationUnitTestCase.class);
+ }
+
+ public RequirementsIntegrationUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected DeployerClient getMainDeployer()
+ {
+ AbstractJDKChecker.getExcluded().add(VFSClassLoaderDependenciesTest.class);
+
+ ClassLoading classLoading = new ClassLoading();
+ ClassLoaderSystem system = new DefaultClassLoaderSystem();
+ system.getDefaultDomain().setParentPolicy(ParentPolicy.BEFORE_BUT_JAVA_ONLY);
+
+ deployer1 = new VFSClassLoaderDescribeDeployer();
+ deployer1.setClassLoading(classLoading);
+
+ deployer2 = new TestLevelClassLoaderSystemDeployer();
+ deployer2.setClassLoading(classLoading);
+ deployer2.setSystem(system);
+
+ Deployer deployer3 = new VFSClassLoaderClassPathDeployer();
+
+ ModuleRequirementIntegrationDeployer<Object> moduleRequirementDeployer = new ModuleRequirementIntegrationDeployer<Object>(Object.class);
+ moduleRequirementDeployer.setModule("seam");
+ moduleRequirementDeployer.setIntegrationModuleName("jboss-seam-int");
+
+ PackageRequirementIntegrationDeployer<Object> packageRequirementDeployer = new PackageRequirementIntegrationDeployer<Object>(Object.class);
+ String pck = ClassLoaderUtils.getClassPackageName(A.class.getName());
+ packageRequirementDeployer.setPackages(Collections.singleton(pck));
+ packageRequirementDeployer.setIntegrationModuleName("jboss-seam-int");
+
+ return createMainDeployer(deployer1, deployer2, deployer3, moduleRequirementDeployer, packageRequirementDeployer);
+ }
+
+ public void testModules() throws Exception
+ {
+ DeployerClient mainDeployer = getMainDeployer();
+
+ Deployment app = createDeployment("app");
+ ClassLoadingMetaData appCLMD = addClassLoadingMetaData(app, null);
+ addRequireModule(appCLMD, "seam", null);
+ DeploymentUnit appUnit = addDeployment(mainDeployer, app);
+ try
+ {
+ assertDeploymentStage(appUnit, DeploymentStages.DESCRIBE);
+
+ Deployment seam = createDeployment("seam");
+ try
+ {
+ addClassLoadingMetaData(seam, null);
+ assertDeploy(mainDeployer, seam);
+ // still in describe, since we depend on integration
+ assertDeploymentStage(appUnit, DeploymentStages.DESCRIBE);
+
+ Deployment integration = createDeployment("jboss-seam-int");
+ try
+ {
+ addClassLoadingMetaData(integration, null);
+ assertDeploy(mainDeployer, integration);
+ // should be installed now
+ assertDeploymentStage(appUnit, DeploymentStages.INSTALLED);
+ }
+ finally
+ {
+ assertUndeploy(mainDeployer, integration);
+ }
+ }
+ finally
+ {
+ assertUndeploy(mainDeployer, seam);
+ }
+ }
+ finally
+ {
+ assertUndeploy(mainDeployer, app);
+ }
+ }
+
+ public void testPackages() throws Exception
+ {
+ DeployerClient mainDeployer = getMainDeployer();
+
+ Deployment app = createDeployment("app");
+ ClassLoadingMetaData appCLMD = addClassLoadingMetaData(app, null);
+ addRequirePackage(appCLMD, A.class, null);
+ DeploymentUnit appUnit = addDeployment(mainDeployer, app);
+ try
+ {
+ assertDeploymentStage(appUnit, DeploymentStages.DESCRIBE);
+
+ Deployment pckgA = createDeployment("pckgA");
+ try
+ {
+ addClassLoadingMetaData(pckgA, null, A.class);
+ assertDeploy(mainDeployer, pckgA);
+ // still in describe, since we depend on integration
+ assertDeploymentStage(appUnit, DeploymentStages.DESCRIBE);
+
+ Deployment integration = createDeployment("jboss-seam-int");
+ try
+ {
+ addClassLoadingMetaData(integration, null);
+ assertDeploy(mainDeployer, integration);
+ // should be installed now
+ assertDeploymentStage(appUnit, DeploymentStages.INSTALLED);
+ }
+ finally
+ {
+ assertUndeploy(mainDeployer, integration);
+ }
+ }
+ finally
+ {
+ assertUndeploy(mainDeployer, pckgA);
+ }
+ }
+ finally
+ {
+ assertUndeploy(mainDeployer, app);
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/VFSClassLoaderDependenciesTest.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/VFSClassLoaderDependenciesTest.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/VFSClassLoaderDependenciesTest.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -188,17 +188,20 @@
classLoadingMetaData.setName(name);
classLoadingMetaData.setVersion(version);
- StringBuffer included = new StringBuffer();
- boolean first = true;
- for (Class<?> pkg : packages)
+ if (packages != null)
{
- if (first)
- first = false;
- else
- included.append(",");
- included.append(pkg.getPackage().getName());
+ StringBuffer included = new StringBuffer();
+ boolean first = true;
+ for (Class<?> pkg : packages)
+ {
+ if (first)
+ first = false;
+ else
+ included.append(",");
+ included.append(pkg.getPackage().getName());
+ }
+ classLoadingMetaData.setIncludedPackages(included.toString());
}
- classLoadingMetaData.setIncludedPackages(included.toString());
CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
Capability capability = classLoadingMetaDataFactory.createModule(name, version);
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -25,19 +25,34 @@
import java.net.URL;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
import org.jboss.deployers.structure.spi.DeploymentUnit;
/**
+ * This deployer's purpose is to trigger
+ * mock impl of Facelets's Classpath class.
+ *
+ * Better deployer examples could be found elsewhere. ;-)
+ *
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
public class SearchDeployer extends AbstractDeployer
{
+ private String prefix;
+ private String suffix;
+
private URL[] urls;
- public SearchDeployer()
+ public SearchDeployer(String prefix, String suffix)
{
+ if (prefix == null)
+ throw new IllegalArgumentException("Null prefix.");
+ if (suffix == null)
+ throw new IllegalArgumentException("Null suffix.");
+
+ this.prefix = prefix;
+ this.suffix = suffix;
setStage(DeploymentStages.REAL);
}
@@ -45,11 +60,11 @@
{
try
{
- urls = Classpath.search(unit.getClassLoader(), "META-INF/", ".taglib.xml");
+ urls = Classpath.search(unit.getClassLoader(), prefix, suffix);
}
catch (IOException e)
{
- DeploymentException.rethrowAsDeploymentException("Error doing facelets search", e);
+ DeploymentException.rethrowAsDeploymentException("Error doing facelets search, prefix=" + prefix + ", suffix=" + suffix, e);
}
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java 2008-10-06 10:39:56 UTC (rev 79138)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java 2008-10-06 11:08:10 UTC (rev 79139)
@@ -49,7 +49,7 @@
*/
public class FaceletsUnitTestCase extends AbstractDeployerUnitTest
{
- private SearchDeployer deployer = new SearchDeployer();
+ private SearchDeployer deployer = new SearchDeployer("META-INF/", ".taglib.xml");
public static Test suite()
{
More information about the jboss-cvs-commits
mailing list