[jboss-cvs] JBossAS SVN: r91287 - in projects/webbeans-ri-int/trunk/deployer/src/test: java/org/jboss/test/deployers/support and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 15 08:17:41 EDT 2009
Author: alesj
Date: 2009-07-15 08:17:40 -0400 (Wed, 15 Jul 2009)
New Revision: 91287
Added:
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/earwithutil/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/earwithutil/META-INF/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/earwithutil/META-INF/application.properties
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarinear/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarinear/META-INF/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarinear/META-INF/application.properties
Removed:
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockBootDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockCoreIntegrationDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockFacesIntegrationDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockJBWMDDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWarClassLoaderDeployer.java
Modified:
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml
Log:
[WBINT-15]; test CL isolation.
Modified: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -27,6 +27,7 @@
import org.jboss.test.deployers.test.BootDeployerTestCase;
import org.jboss.test.deployers.test.PostDeployersTestCase;
import org.jboss.test.deployers.test.WBDiscoveryEnvTestCase;
+import org.jboss.test.deployers.test.CLIsolationTestCase;
/**
* VFS deployers tests.
@@ -47,6 +48,7 @@
suite.addTest(WBDiscoveryEnvTestCase.suite());
suite.addTest(PostDeployersTestCase.suite());
suite.addTest(BootDeployerTestCase.suite());
+ suite.addTest(CLIsolationTestCase.suite());
return suite;
}
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockBootDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockBootDeployer.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockBootDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -1,110 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.support;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.beans.metadata.spi.builder.ParameterMetaDataBuilder;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.jboss.webbeans.integration.deployer.DeployersUtils;
-import org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryEnvironment;
-import org.jboss.dependency.spi.ControllerState;
-
-/**
- * Mock wb boot deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class MockBootDeployer extends AbstractSimpleRealDeployer<WebBeanDiscoveryEnvironment>
-{
- public MockBootDeployer()
- {
- super(WebBeanDiscoveryEnvironment.class);
- setTopLevelOnly(true);
- setStage(DeploymentStages.PRE_REAL);
- addOutput(BeanMetaData.class);
- }
-
- public void deploy(DeploymentUnit unit, WebBeanDiscoveryEnvironment env) throws DeploymentException
- {
- String unitName = unit.getName();
- String envName = unitName + "_JBossWebBeanDiscovery";
- BeanMetaDataBuilder envWrapper = BeanMetaDataBuilder.createBuilder(envName, "org.jboss.test.deployers.support.WBDEWrapper");
- envWrapper.addConstructorParameter(WebBeanDiscoveryEnvironment.class.getName(), env);
- unit.addAttachment(envName + "_" + BeanMetaData.class.getSimpleName(), envWrapper.getBeanMetaData());
-
- String bootstrapName = DeployersUtils.getBootstrapBeanName(unit);
- BeanMetaDataBuilder bootstrap = BeanMetaDataBuilder.createBuilder(bootstrapName, "org.jboss.test.deployers.support.MockWBBootstrap");
- bootstrap.addPropertyMetaData("webBeanDiscovery", bootstrap.createInject(envName));
- ValueMetaData ejbServicesValue = createEjbConnector("JBossEjbServices", "org.jboss.test.deployers.support.MockEjbServices", unit);
- bootstrap.addPropertyMetaData("ejbServices", ejbServicesValue);
- bootstrap.addPropertyMetaData("transactionServices", bootstrap.createInject("JBossTransactionServices"));
- bootstrap.addPropertyMetaData("applicationContext", createBeanStore());
- bootstrap.setCreate("initialize");
- bootstrap.setStart("boot");
- bootstrap.setDestroy("shutdown");
- bootstrap.addDependency("RealTransactionManager"); // so we know TM is present in JBossTransactionServices
- // call dynamic dependency creator for EJBs
- ParameterMetaDataBuilder install = bootstrap.addInstallWithParameters("createDepenencies", "DynamicDependencyCreator", null, ControllerState.CONFIGURED);
- install.addParameterMetaData(Object.class.getName(), bootstrapName);
- install.addParameterMetaData(Iterable.class.getName(), bootstrap.createInject(ejbServicesValue.getUnderlyingValue(), "ejbContainerNames"));
- install.addParameterMetaData(String.class.getName(), "Start");
- install.addParameterMetaData(String.class.getName(), "Start");
-
- unit.addAttachment(bootstrapName + "_" + BeanMetaData.class.getSimpleName(), bootstrap.getBeanMetaData());
- }
-
- /**
- * Create new bean store.
- *
- * @return the bean store instance
- */
- protected BeanStore createBeanStore()
- {
- return new ConcurrentHashMapBeanStore();
- }
-
- /**
- * Create ejb connector.
- *
- * @param name the connector name
- * @param bean the bean to create
- * @param unit the deployment unit
- * @return new inject metadata
- */
- protected ValueMetaData createEjbConnector(String name, String bean, DeploymentUnit unit)
- {
- String beanName = unit.getName() + "_" + name;
- BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, bean);
- builder.setFactory(name);
- builder.setFactoryMethod("createBean");
- builder.addPropertyMetaData("deploymentUnit", unit);
- unit.addAttachment(beanName + "_" + BeanMetaData.class.getSimpleName(), builder.getBeanMetaData());
- return builder.createInject(beanName);
- }
-}
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockCoreIntegrationDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockCoreIntegrationDeployer.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockCoreIntegrationDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.support;
-
-import java.net.URL;
-import java.security.CodeSource;
-import java.security.ProtectionDomain;
-import java.util.Collections;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.webbeans.integration.deployer.DeployersUtils;
-
-/**
- * Mock adding webbeans-core.jar to classpath.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class MockCoreIntegrationDeployer extends PathUrlIntegrationDeployer<JBossWebMetaData>
-{
- public MockCoreIntegrationDeployer()
- {
- super(JBossWebMetaData.class);
- setTopLevelOnly(true);
- setIntegrationURLs(getURLs());
- }
-
- @Override
- protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
- {
- return DeployersUtils.checkForWebBeansFiles(unit);
- }
-
- protected Set<URL> getURLs()
- {
- ProtectionDomain pd = getClass().getProtectionDomain();
- CodeSource cs = pd.getCodeSource();
- return Collections.singleton(cs.getLocation());
- }
-}
\ No newline at end of file
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockFacesIntegrationDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockFacesIntegrationDeployer.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockFacesIntegrationDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.support;
-
-import java.net.URL;
-import java.security.CodeSource;
-import java.security.ProtectionDomain;
-import java.util.Collections;
-import java.util.Set;
-
-import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-
-/**
- * Mock adding webbeans-core.jar to classpath.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class MockFacesIntegrationDeployer extends PathUrlIntegrationDeployer<JBossWebMetaData>
-{
- public MockFacesIntegrationDeployer()
- {
- super(JBossWebMetaData.class);
- setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
- setIntegrationURLs(getURLs());
- }
-
- protected Set<URL> getURLs()
- {
- ProtectionDomain pd = getClass().getProtectionDomain();
- CodeSource cs = pd.getCodeSource();
- return Collections.singleton(cs.getLocation());
- }
-}
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockJBWMDDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockJBWMDDeployer.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockJBWMDDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.support;
-
-import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Mock JBWMD parsing deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class MockJBWMDDeployer extends AbstractVFSParsingDeployer<JBossWebMetaData>
-{
- public MockJBWMDDeployer()
- {
- super(JBossWebMetaData.class);
- setName("web.xml");
- }
-
- protected JBossWebMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWebMetaData root) throws Exception
- {
- return new JBossWebMetaData();
- }
-}
\ No newline at end of file
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWarClassLoaderDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWarClassLoaderDeployer.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWarClassLoaderDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.support;
-
-import java.io.ByteArrayInputStream;
-import java.util.Properties;
-import java.util.Set;
-
-import org.jboss.classloader.spi.filter.ClassFilter;
-import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.ExportAll;
-import org.jboss.classloading.spi.version.Version;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.metadata.common.jboss.LoaderRepositoryConfigMetaData;
-import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-
-/**
- * Mock war classloader deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class MockWarClassLoaderDeployer extends AbstractSimpleVFSRealDeployer<JBossWebMetaData>
-{
- /** The parent class loader first model flag */
- private boolean java2ClassLoadingCompliance = false;
-
- /** Package names that should be ignored for class loading */
- private String filteredPackages;
-
- /**
- * Create a new WarClassLoaderDeployer.
- */
- public MockWarClassLoaderDeployer()
- {
- super(JBossWebMetaData.class);
- setStage(DeploymentStages.POST_PARSE);
- addInput(ClassLoadingMetaData.class);
- setOutput(ClassLoadingMetaData.class);
- }
-
- public boolean isJava2ClassLoadingCompliance()
- {
- return java2ClassLoadingCompliance;
- }
-
- public void setJava2ClassLoadingCompliance(boolean flag)
- {
- this.java2ClassLoadingCompliance = flag;
- }
-
- public String getFilteredPackages()
- {
- return filteredPackages;
- }
- public void setFilteredPackages(String pkgs)
- {
- this.filteredPackages = pkgs;
- }
-
- @Override
- public void deploy(VFSDeploymentUnit unit, JBossWebMetaData metaData) throws DeploymentException
- {
- // Ignore if it already has classloading
- if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
- return;
-
- // The default domain name is the unit name
- String domainName = unit.getName();
-
- // The default classloading compliance is on the deployer
- boolean j2seClassLoadingCompliance = java2ClassLoadingCompliance;
-
- // Do we have a legacy classloading element?
- org.jboss.metadata.web.jboss.ClassLoadingMetaData webCLMD = metaData.getClassLoading();
- if (webCLMD != null)
- {
- // Was the complince set?
- if (webCLMD.wasJava2ClassLoadingComplianceSet())
- j2seClassLoadingCompliance = webCLMD.isJava2ClassLoadingCompliance();
-
- // Does it have a loader repository
- LoaderRepositoryMetaData lrmd = webCLMD.getLoaderRepository();
- if (lrmd != null)
- {
- // Use the trimmed repository name as the domain
- String repositoryName = lrmd.getName();
- if (repositoryName != null)
- {
- repositoryName = repositoryName.trim();
- if (repositoryName != null)
- {
- domainName = repositoryName;
-
- // If there was no compliance set see if the loader repository has one
- if (webCLMD.wasJava2ClassLoadingComplianceSet() == false)
- {
- Set<LoaderRepositoryConfigMetaData> configs = lrmd.getLoaderRepositoryConfig();
- if (configs != null && configs.isEmpty() == false)
- {
- LoaderRepositoryConfigMetaData lrcmd = configs.iterator().next();
-
- Properties props = new Properties();
- String config = lrcmd.getConfig();
- try
- {
- if (config != null)
- {
- ByteArrayInputStream bais = new ByteArrayInputStream(config.getBytes());
- props.load(bais);
- }
- }
- catch (Exception e)
- {
- throw DeploymentException.rethrowAsDeploymentException("Error parsing repository config " + config, e);
- }
- String java2ParentDelegation = props.getProperty("java2ParentDelegation");
- if( java2ParentDelegation == null )
- {
- // Check for previous mis-spelled property name
- java2ParentDelegation = props.getProperty("java2ParentDelegaton", "false");
- }
- j2seClassLoadingCompliance = Boolean.valueOf(java2ParentDelegation);
- }
- }
- }
- }
- }
- }
-
- // Create a classloading metadata
- // NOTE: Don't explicitly set the parentDomain otherwise it will create a top level classloader
- // for subdeployments rather than a classloader hanging off the main deployment's classloader
- ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
- classLoadingMetaData.setName(unit.getName());
- classLoadingMetaData.setDomain(domainName);
- classLoadingMetaData.setExportAll(ExportAll.NON_EMPTY);
- classLoadingMetaData.setImportAll(true);
- classLoadingMetaData.setVersion(Version.DEFAULT_VERSION);
- classLoadingMetaData.setJ2seClassLoadingCompliance(j2seClassLoadingCompliance);
- if (filteredPackages != null)
- {
- ClassFilter filter = RecursivePackageClassFilter.createRecursivePackageClassFilterFromString(filteredPackages);
- classLoadingMetaData.setExcluded(filter);
- }
- unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
- }
-}
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java (from rev 91223, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockBootDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockBootDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.support.deployer;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.beans.metadata.spi.builder.ParameterMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.webbeans.integration.deployer.DeployersUtils;
+import org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryEnvironment;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Mock wb boot deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockBootDeployer extends AbstractSimpleRealDeployer<WebBeanDiscoveryEnvironment>
+{
+ public MockBootDeployer()
+ {
+ super(WebBeanDiscoveryEnvironment.class);
+ setTopLevelOnly(true);
+ setStage(DeploymentStages.PRE_REAL);
+ addOutput(BeanMetaData.class);
+ }
+
+ public void deploy(DeploymentUnit unit, WebBeanDiscoveryEnvironment env) throws DeploymentException
+ {
+ String unitName = unit.getName();
+ String envName = unitName + "_JBossWebBeanDiscovery";
+ BeanMetaDataBuilder envWrapper = BeanMetaDataBuilder.createBuilder(envName, "org.jboss.test.deployers.support.WBDEWrapper");
+ envWrapper.addConstructorParameter(WebBeanDiscoveryEnvironment.class.getName(), env);
+ unit.addAttachment(envName + "_" + BeanMetaData.class.getSimpleName(), envWrapper.getBeanMetaData());
+
+ String bootstrapName = DeployersUtils.getBootstrapBeanName(unit);
+ BeanMetaDataBuilder bootstrap = BeanMetaDataBuilder.createBuilder(bootstrapName, "org.jboss.test.deployers.support.MockWBBootstrap");
+ bootstrap.addPropertyMetaData("webBeanDiscovery", bootstrap.createInject(envName));
+ ValueMetaData ejbServicesValue = createEjbConnector("JBossEjbServices", "org.jboss.test.deployers.support.MockEjbServices", unit);
+ bootstrap.addPropertyMetaData("ejbServices", ejbServicesValue);
+ bootstrap.addPropertyMetaData("transactionServices", bootstrap.createInject("JBossTransactionServices"));
+ bootstrap.addPropertyMetaData("applicationContext", createBeanStore());
+ bootstrap.setCreate("initialize");
+ bootstrap.setStart("boot");
+ bootstrap.setDestroy("shutdown");
+ bootstrap.addDependency("RealTransactionManager"); // so we know TM is present in JBossTransactionServices
+ // call dynamic dependency creator for EJBs
+ ParameterMetaDataBuilder install = bootstrap.addInstallWithParameters("createDepenencies", "DynamicDependencyCreator", null, ControllerState.CONFIGURED);
+ install.addParameterMetaData(Object.class.getName(), bootstrapName);
+ install.addParameterMetaData(Iterable.class.getName(), bootstrap.createInject(ejbServicesValue.getUnderlyingValue(), "ejbContainerNames"));
+ install.addParameterMetaData(String.class.getName(), "Start");
+ install.addParameterMetaData(String.class.getName(), "Start");
+
+ unit.addAttachment(bootstrapName + "_" + BeanMetaData.class.getSimpleName(), bootstrap.getBeanMetaData());
+ }
+
+ /**
+ * Create new bean store.
+ *
+ * @return the bean store instance
+ */
+ protected BeanStore createBeanStore()
+ {
+ return new ConcurrentHashMapBeanStore();
+ }
+
+ /**
+ * Create ejb connector.
+ *
+ * @param name the connector name
+ * @param bean the bean to create
+ * @param unit the deployment unit
+ * @return new inject metadata
+ */
+ protected ValueMetaData createEjbConnector(String name, String bean, DeploymentUnit unit)
+ {
+ String beanName = unit.getName() + "_" + name;
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, bean);
+ builder.setFactory(name);
+ builder.setFactoryMethod("createBean");
+ builder.addPropertyMetaData("deploymentUnit", unit);
+ unit.addAttachment(beanName + "_" + BeanMetaData.class.getSimpleName(), builder.getBeanMetaData());
+ return builder.createInject(beanName);
+ }
+}
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java (from rev 91223, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCopyJBossDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.support.deployer;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+
+/**
+ * Copy ejb-jar md to jboss md.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockCopyJBossDeployer extends AbstractSimpleRealDeployer<EjbJarMetaData>
+{
+ public MockCopyJBossDeployer()
+ {
+ super(EjbJarMetaData.class);
+ addOutput(JBossMetaData.class);
+ setStage(DeploymentStages.POST_PARSE);
+ }
+
+ public void deploy(DeploymentUnit unit, EjbJarMetaData deployment) throws DeploymentException
+ {
+ JBossMetaData jbmd = new JBossMetaData();
+ jbmd.merge(null, deployment);
+ unit.addAttachment(JBossMetaData.class, jbmd);
+ }
+}
\ No newline at end of file
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java (from rev 91223, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockCoreIntegrationDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockCoreIntegrationDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.support.deployer;
+
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.webbeans.integration.deployer.DeployersUtils;
+
+/**
+ * Mock adding webbeans-core.jar to classpath.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockCoreIntegrationDeployer extends PathUrlIntegrationDeployer<JBossWebMetaData>
+{
+ public MockCoreIntegrationDeployer()
+ {
+ super(JBossWebMetaData.class);
+ setTopLevelOnly(true);
+ setIntegrationURLs(getURLs());
+ }
+
+ @Override
+ protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
+ {
+ return DeployersUtils.checkForWebBeansFiles(unit);
+ }
+
+ protected Set<URL> getURLs()
+ {
+ ProtectionDomain pd = getClass().getProtectionDomain();
+ CodeSource cs = pd.getCodeSource();
+ return Collections.singleton(cs.getLocation());
+ }
+}
\ No newline at end of file
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java (from rev 91223, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockFacesIntegrationDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockFacesIntegrationDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.support.deployer;
+
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Mock adding webbeans-core.jar to classpath.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockFacesIntegrationDeployer extends PathUrlIntegrationDeployer<JBossWebMetaData>
+{
+ public MockFacesIntegrationDeployer()
+ {
+ super(JBossWebMetaData.class);
+ setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
+ setIntegrationURLs(getURLs());
+ }
+
+ protected Set<URL> getURLs()
+ {
+ ProtectionDomain pd = getClass().getProtectionDomain();
+ CodeSource cs = pd.getCodeSource();
+ return Collections.singleton(cs.getLocation());
+ }
+}
Modified: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -37,6 +37,7 @@
public MockJBossAppDeployer()
{
super(JBossAppMetaData.class);
+ setTopLevelOnly(true);
setName("application.properties");
}
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java (from rev 91223, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWarClassLoaderDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.support.deployer;
+
+import java.io.ByteArrayInputStream;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jboss.classloader.spi.filter.ClassFilter;
+import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.common.jboss.LoaderRepositoryConfigMetaData;
+import org.jboss.metadata.common.jboss.LoaderRepositoryMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Mock war classloader deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockWarClassLoaderDeployer extends AbstractSimpleVFSRealDeployer<JBossWebMetaData>
+{
+ /** The parent class loader first model flag */
+ private boolean java2ClassLoadingCompliance = false;
+
+ /** Package names that should be ignored for class loading */
+ private String filteredPackages;
+
+ /**
+ * Create a new WarClassLoaderDeployer.
+ */
+ public MockWarClassLoaderDeployer()
+ {
+ super(JBossWebMetaData.class);
+ setStage(DeploymentStages.POST_PARSE);
+ addInput(ClassLoadingMetaData.class);
+ setOutput(ClassLoadingMetaData.class);
+ }
+
+ public boolean isJava2ClassLoadingCompliance()
+ {
+ return java2ClassLoadingCompliance;
+ }
+
+ public void setJava2ClassLoadingCompliance(boolean flag)
+ {
+ this.java2ClassLoadingCompliance = flag;
+ }
+
+ public String getFilteredPackages()
+ {
+ return filteredPackages;
+ }
+ public void setFilteredPackages(String pkgs)
+ {
+ this.filteredPackages = pkgs;
+ }
+
+ @Override
+ public void deploy(VFSDeploymentUnit unit, JBossWebMetaData metaData) throws DeploymentException
+ {
+ // Ignore if it already has classloading
+ if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
+ return;
+
+ // The default domain name is the unit name
+ String domainName = unit.getName();
+
+ // The default classloading compliance is on the deployer
+ boolean j2seClassLoadingCompliance = java2ClassLoadingCompliance;
+
+ // Do we have a legacy classloading element?
+ org.jboss.metadata.web.jboss.ClassLoadingMetaData webCLMD = metaData.getClassLoading();
+ if (webCLMD != null)
+ {
+ // Was the complince set?
+ if (webCLMD.wasJava2ClassLoadingComplianceSet())
+ j2seClassLoadingCompliance = webCLMD.isJava2ClassLoadingCompliance();
+
+ // Does it have a loader repository
+ LoaderRepositoryMetaData lrmd = webCLMD.getLoaderRepository();
+ if (lrmd != null)
+ {
+ // Use the trimmed repository name as the domain
+ String repositoryName = lrmd.getName();
+ if (repositoryName != null)
+ {
+ repositoryName = repositoryName.trim();
+ if (repositoryName != null)
+ {
+ domainName = repositoryName;
+
+ // If there was no compliance set see if the loader repository has one
+ if (webCLMD.wasJava2ClassLoadingComplianceSet() == false)
+ {
+ Set<LoaderRepositoryConfigMetaData> configs = lrmd.getLoaderRepositoryConfig();
+ if (configs != null && configs.isEmpty() == false)
+ {
+ LoaderRepositoryConfigMetaData lrcmd = configs.iterator().next();
+
+ Properties props = new Properties();
+ String config = lrcmd.getConfig();
+ try
+ {
+ if (config != null)
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(config.getBytes());
+ props.load(bais);
+ }
+ }
+ catch (Exception e)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Error parsing repository config " + config, e);
+ }
+ String java2ParentDelegation = props.getProperty("java2ParentDelegation");
+ if( java2ParentDelegation == null )
+ {
+ // Check for previous mis-spelled property name
+ java2ParentDelegation = props.getProperty("java2ParentDelegaton", "false");
+ }
+ j2seClassLoadingCompliance = Boolean.valueOf(java2ParentDelegation);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Create a classloading metadata
+ // NOTE: Don't explicitly set the parentDomain otherwise it will create a top level classloader
+ // for subdeployments rather than a classloader hanging off the main deployment's classloader
+ ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
+ classLoadingMetaData.setName(unit.getName());
+ classLoadingMetaData.setDomain(domainName);
+ classLoadingMetaData.setExportAll(ExportAll.NON_EMPTY);
+ classLoadingMetaData.setImportAll(true);
+ classLoadingMetaData.setVersion(Version.DEFAULT_VERSION);
+ classLoadingMetaData.setJ2seClassLoadingCompliance(j2seClassLoadingCompliance);
+ if (filteredPackages != null)
+ {
+ ClassFilter filter = RecursivePackageClassFilter.createRecursivePackageClassFilterFromString(filteredPackages);
+ classLoadingMetaData.setExcluded(filter);
+ }
+ unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
+ }
+}
Modified: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -115,8 +115,13 @@
protected AssembledDirectory createTopLevelWithUtil() throws Exception
{
+ return createTopLevelWithUtil("/webbeans/simple");
+ }
+
+ protected AssembledDirectory createTopLevelWithUtil(String path) throws Exception
+ {
AssembledDirectory topLevel = createAssembledDirectory("top-level.ear", "top-level.ear");
- addPath(topLevel, "/webbeans/simple", "META-INF");
+ addPath(topLevel, path, "META-INF");
AssembledDirectory earLib = topLevel.mkdir("lib");
@@ -143,4 +148,34 @@
return ear;
}
+
+ protected AssembledDirectory createJarInEar() throws Exception
+ {
+ AssembledDirectory ear = createAssembledDirectory("jar-in-ear.ear", "jar-in-ear.ear");
+ addPath(ear, "/webbeans/jarinear", "META-INF");
+
+ AssembledDirectory jar = ear.mkdir("simple.jar");
+ addPackage(jar, PlainJavaBean.class);
+ addPath(jar, "/webbeans/simple/jar", "META-INF");
+
+ return ear;
+ }
+
+ protected AssembledDirectory createWar(String warName, Class<?> reference) throws Exception
+ {
+ AssembledDirectory war = createAssembledDirectory(warName, warName);
+ AssembledDirectory webinf = war.mkdir("WEB-INF");
+ AssembledDirectory classes = webinf.mkdir("classes");
+ addPackage(classes, reference);
+ addPath(war, "/webbeans/simple/web", "WEB-INF");
+ return war;
+ }
+
+ protected AssembledDirectory createEjbJar(String jarName, Class<?> reference) throws Exception
+ {
+ AssembledDirectory jar = createAssembledDirectory(jarName, jarName);
+ addPackage(jar, reference);
+ addPath(jar, "/webbeans/simple/ejb", "META-INF");
+ return jar;
+ }
}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.test;
+
+import junit.framework.Test;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.test.deployers.support.jsf.NotWBJsfBean;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+
+/**
+ * CL isolation tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class CLIsolationTestCase extends AbstractWebBeansTest
+{
+ public CLIsolationTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(CLIsolationTestCase.class);
+ }
+
+ protected void assertClassNotFound(String className, DeploymentUnit unit) throws Exception
+ {
+ ClassLoader cl = unit.getClassLoader();
+ try
+ {
+ Class<?> clazz = cl.loadClass(className);
+ fail("Should not be here: " + clazz.getClassLoader());
+ }
+ catch (ClassNotFoundException ignore)
+ {
+ }
+ }
+
+ protected void testIsolation(VirtualFile fst, String inFst, VirtualFile snd, String inSnd) throws Exception
+ {
+ Deployment deployment1 = createVFSDeployment(fst);
+ Deployment deployment2 = createVFSDeployment(snd);
+
+ DeployerClient mainDeployer = getDeployerClient();
+ mainDeployer.addDeployment(deployment1);
+ mainDeployer.addDeployment(deployment2);
+ mainDeployer.process();
+ try
+ {
+ DeploymentUnit du1 = getMainDeployerStructure().getDeploymentUnit(deployment1.getName());
+ assertLoadClass(inFst, du1.getClassLoader());
+ assertClassNotFound(inSnd, du1);
+
+ DeploymentUnit du2 = getMainDeployerStructure().getDeploymentUnit(deployment2.getName());
+ assertLoadClass(inSnd, du2.getClassLoader());
+ assertClassNotFound(inFst, du2);
+ }
+ finally
+ {
+ mainDeployer.removeDeployment(deployment2);
+ mainDeployer.removeDeployment(deployment1);
+ mainDeployer.process();
+ }
+
+ }
+
+ public void testTwoEars() throws Exception
+ {
+ VirtualFile ear1 = createTopLevelWithUtil("/webbeans/earwithutil");
+ VirtualFile ear2 = createJarInEar();
+ testIsolation(ear1, "org.jboss.test.deployers.support.util.SomeUtil", ear2, "org.jboss.test.deployers.support.jar.PlainJavaBean");
+ }
+
+ public void testTwoWars() throws Exception
+ {
+ VirtualFile war1 = createWar("w1.war", ServletWebBean.class);
+ VirtualFile war2 = createWar("w2.war", NotWBJsfBean.class);
+ testIsolation(war1, ServletWebBean.class.getName(), war2, NotWBJsfBean.class.getName());
+ }
+
+ public void testTwoJars() throws Exception
+ {
+ VirtualFile jar1 = createEjbJar("j1.jar", ServletWebBean.class);
+ VirtualFile jar2 = createEjbJar("j2.jar", NotWBJsfBean.class);
+ testIsolation(jar1, ServletWebBean.class.getName(), jar2, NotWBJsfBean.class.getName());
+ }
+
+ public void testWarEar() throws Exception
+ {
+ VirtualFile ear = createJarInEar();
+ VirtualFile war = createWar("w1.war", ServletWebBean.class);
+ testIsolation(ear, "org.jboss.test.deployers.support.jar.PlainJavaBean", war, ServletWebBean.class.getName());
+ }
+
+ public void testJarEar() throws Exception
+ {
+ VirtualFile ear = createJarInEar();
+ VirtualFile jar = createEjbJar("j1.jar", ServletWebBean.class);
+ testIsolation(ear, "org.jboss.test.deployers.support.jar.PlainJavaBean", jar, ServletWebBean.class.getName());
+ }
+
+ public void testJarWar() throws Exception
+ {
+ VirtualFile jar = createEjbJar("j1.jar", PlainJavaBean.class);
+ VirtualFile war = createWar("w1.war", ServletWebBean.class);
+ testIsolation(jar, PlainJavaBean.class.getName(), war, ServletWebBean.class.getName());
+ }
+}
Modified: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml 2009-07-15 09:54:00 UTC (rev 91286)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml 2009-07-15 12:17:40 UTC (rev 91287)
@@ -13,11 +13,11 @@
</constructor>
</bean>
- <bean name="JBWMDDeployer" class="org.jboss.test.deployers.support.MockJBWMDDeployer"/>
- <bean name="WarCLDeployer" class="org.jboss.test.deployers.support.MockWarClassLoaderDeployer"/>
- <bean name="MockUrlIntDeployer" class="org.jboss.test.deployers.support.MockCoreIntegrationDeployer"/>
+ <bean name="JBWMDDeployer" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+ <bean name="WarCLDeployer" class="org.jboss.test.deployers.support.deployer.MockWarClassLoaderDeployer"/>
+ <bean name="MockUrlIntDeployer" class="org.jboss.test.deployers.support.deployer.MockCoreIntegrationDeployer"/>
- <bean name="BootDeployer" class="org.jboss.test.deployers.support.MockBootDeployer"/>
+ <bean name="BootDeployer" class="org.jboss.test.deployers.support.deployer.MockBootDeployer"/>
<!-- Mock EJB utils -->
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml (from rev 91223, projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1,19 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+ <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+ <bean name="JWBMDDeployer" class="org.jboss.webbeans.integration.deployer.ext.JBossWebBeansMetaDataDeployer"/>
+ <bean name="WBFilesDeployer" class="org.jboss.webbeans.integration.deployer.metadata.WebBeansFilesDeployer"/>
+
+ <bean name="EarCLIsolationDeployer" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossAppMetadataDeployer"/>
+ <bean name="JarCLIsolationDeployer" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossMetadataDeployer"/>
+ <bean name="WarCLIsolationDeployer" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossWebMetadataDeployer"/>
+
+ <bean name="JBAppMDDeployer" class="org.jboss.test.deployers.support.deployer.MockJBossAppDeployer"/>
+ <bean name="JBWMDDeployer" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+ <bean name="EjbJarDeployer" class="org.jboss.test.deployers.support.deployer.MockEjbJarDeployer"/>
+ <bean name="EjbMergeDeployer" class="org.jboss.test.deployers.support.deployer.MockCopyJBossDeployer"/>
+ <bean name="WarCLDeployer" class="org.jboss.test.deployers.support.deployer.MockWarClassLoaderDeployer"/>
+
+</deployment>
Added: projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/earwithutil/META-INF/application.properties
===================================================================
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarinear/META-INF/application.properties (from rev 91223, projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warinear/META-INF/application.properties)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarinear/META-INF/application.properties (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarinear/META-INF/application.properties 2009-07-15 12:17:40 UTC (rev 91287)
@@ -0,0 +1 @@
+jar-module=simple.jar
More information about the jboss-cvs-commits
mailing list