[jboss-cvs] JBossAS SVN: r91220 - in projects/webbeans-ri-int/trunk: deployer/src/main/assembly/resources/META-INF and 21 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 14 11:07:39 EDT 2009
Author: alesj
Date: 2009-07-14 11:07:37 -0400 (Tue, 14 Jul 2009)
New Revision: 91220
Added:
projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansCoreIntegrationDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansFacesIntegrationDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/
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/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java
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/MockEjbServices.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/MockTransactionServices.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWBBootstrap.java
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/WBDEWrapper.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.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/support/deployer/MockJBossDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java
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/MockWebDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/
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/BootDeployerTestCase.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/
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/PostDeployersTestCase.xml
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.xml
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warinear/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warinear/META-INF/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warinear/META-INF/application.properties
Removed:
projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebUrlIntegrationDeployer.java
projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/VFSTestSuite.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/support/
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/AbstractWebBeansTest.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.java
projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/webbeans/
Modified:
projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml
projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansUrlIntegrationDeployer.java
projects/webbeans-ri-int/trunk/pom.xml
Log:
[WBINT-16]; fix war in ear classloading.
Split core and faces integration.
Moving pckgs due to automatic exclusion of test classes from domain.
Modified: projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml 2009-07-14 15:00:09 UTC (rev 91219)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml 2009-07-14 15:07:37 UTC (rev 91220)
@@ -23,9 +23,12 @@
<!-- Responsible for booting Web Beans -->
<bean name="WebBeansBootstrapDeployer" class="org.jboss.webbeans.integration.deployer.env.WebBeansBootstrapDeployer"/>
- <!-- Responsible for pushing the Web Beans RI onto the application classpath -->
- <bean name="WebBeansWebUrlIntegrationDeployer" class="org.jboss.webbeans.integration.deployer.cl.WebBeansWebUrlIntegrationDeployer"/>
+ <!-- Responsible for pushing the JSF onto the application classpath -->
+ <bean name="WebBeansWebUrlIntegrationDeployer" class="org.jboss.webbeans.integration.deployer.cl.WebBeansFacesIntegrationDeployer"/>
+ <!-- Responsible for pushing the WB RI onto the application classpath -->
+ <bean name="WebBeansWebUrlIntegrationDeployer" class="org.jboss.webbeans.integration.deployer.cl.WebBeansCoreIntegrationDeployer"/>
+
<!-- Responsible for inserting the Web Beans RI EJB interceptor -->
<bean name="PostEjbJarMetadataDeployer" class="org.jboss.webbeans.integration.deployer.metadata.WBEjbInterceptorMetadataDeployer"/>
Copied: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansCoreIntegrationDeployer.java (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansUrlIntegrationDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansCoreIntegrationDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansCoreIntegrationDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,33 @@
+package org.jboss.webbeans.integration.deployer.cl;
+
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.webbeans.integration.deployer.DeployersUtils;
+import org.jboss.webbeans.integration.deployer.ext.JBossWebBeansMetaData;
+
+/**
+ * Web Beans RI core integration deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WebBeansCoreIntegrationDeployer extends WebBeansUrlIntegrationDeployer<JBossWebBeansMetaData>
+{
+ protected WebBeansCoreIntegrationDeployer()
+ {
+ super(JBossWebBeansMetaData.class);
+ setTopLevelOnly(true); // only top level, as that's where Bootstrap bean is gonna be
+ setInputs(DeployersUtils.WEB_BEANS_FILES);
+ setIntegrationURLs(getURLs());
+ }
+
+ @Override // we override this, as we want any beans.xml
+ protected boolean isIntegrationDeployment(VFSDeploymentUnit unit)
+ {
+ return DeployersUtils.checkForWebBeansFiles(unit);
+ }
+
+ protected String getShortLibName()
+ {
+ return "webbeans-core.jar";
+ }
+}
\ No newline at end of file
Copied: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansFacesIntegrationDeployer.java (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebUrlIntegrationDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansFacesIntegrationDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansFacesIntegrationDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,24 @@
+package org.jboss.webbeans.integration.deployer.cl;
+
+
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+
+/**
+ * Web Beans RI integration deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class WebBeansFacesIntegrationDeployer extends WebBeansUrlIntegrationDeployer<JBossWebMetaData>
+{
+ public WebBeansFacesIntegrationDeployer()
+ {
+ super(JBossWebMetaData.class); // we only look at wars
+ setDisableOptional(true); // it needs to be web deployment, or why would you use JSF?
+ setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
+ }
+
+ protected String getShortLibName()
+ {
+ return "faces";
+ }
+}
\ No newline at end of file
Modified: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansUrlIntegrationDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansUrlIntegrationDeployer.java 2009-07-14 15:00:09 UTC (rev 91219)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansUrlIntegrationDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -3,7 +3,7 @@
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.HashSet;
+import java.util.Collections;
import java.util.Set;
import org.jboss.deployers.vfs.plugins.classloader.PathUrlIntegrationDeployer;
@@ -21,11 +21,16 @@
{
super(input);
setIntegrationURLs(getURLs());
- setFiles(new String[]{"META-INF/beans.xml", "WEB-INF/beans.xml"});
}
/**
- * Get the WebBeans integration urls.
+ * Get the short name.
+ * @return
+ */
+ protected abstract String getShortLibName();
+
+ /**
+ * Get the WebBeans core integration urls.
*
* @return the webbeans jbossas integration urls
*/
@@ -35,11 +40,7 @@
{
String libOpt = getServerHome() + getOptionalLib();
libOpt = StringPropertyReplacer.replaceProperties(libOpt);
-
- Set<URL> urls = new HashSet<URL>(2);
- urls.add(new URL(libOpt + "webbeans-core.jar"));
- urls.add(new URL(libOpt + "faces"));
- return urls;
+ return Collections.singleton(new URL(libOpt + getShortLibName()));
}
catch (MalformedURLException e)
{
Deleted: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebUrlIntegrationDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebUrlIntegrationDeployer.java 2009-07-14 15:00:09 UTC (rev 91219)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/cl/WebBeansWebUrlIntegrationDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -1,18 +0,0 @@
-package org.jboss.webbeans.integration.deployer.cl;
-
-
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-
-/**
- * Web Beans RI integration deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class WebBeansWebUrlIntegrationDeployer extends WebBeansUrlIntegrationDeployer<JBossWebMetaData>
-{
- public WebBeansWebUrlIntegrationDeployer()
- {
- // we only look at wars
- super(JBossWebMetaData.class);
- }
-}
\ No newline at end of file
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers/VFSTestSuite.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -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;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+import org.jboss.test.deployers.test.BootDeployerTestCase;
+import org.jboss.test.deployers.test.PostDeployersTestCase;
+import org.jboss.test.deployers.test.WBDiscoveryEnvTestCase;
+
+/**
+ * VFS deployers tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class VFSTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("Deployers WebBeans Tests");
+
+ suite.addTest(WBDiscoveryEnvTestCase.suite());
+ suite.addTest(PostDeployersTestCase.suite());
+ suite.addTest(BootDeployerTestCase.suite());
+
+ return suite;
+ }
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/CheckableBootstrap.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,36 @@
+/*
+ * 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.webbeans.bootstrap.api.Bootstrap;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface CheckableBootstrap extends Bootstrap
+{
+ boolean isInit();
+
+ boolean isBoot();
+
+ boolean isShutdown();
+}
Added: 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 (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockBootDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -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;
+
+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);
+ }
+}
Added: 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 (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockCoreIntegrationDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -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;
+
+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
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,80 @@
+/*
+ * 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.util.Collections;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.webbeans.ejb.api.SessionObjectReference;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+import org.jboss.webbeans.ejb.spi.EjbServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockEjbServices implements EjbServices
+{
+ public void setDeploymentUnit(DeploymentUnit unit)
+ {
+ }
+
+ public Object resolveEjb(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public Object resolvePersistenceContext(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public Object resolveResource(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public void removeEjb(Object instance)
+ {
+ }
+
+ public SessionObjectReference resolveEjb(EjbDescriptor<?> descriptor)
+ {
+ return null;
+ }
+
+ public Iterable<EjbDescriptor<?>> discoverEjbs()
+ {
+ return Collections.emptySet();
+ }
+
+ public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
+ {
+ return null;
+ }
+
+ public Iterable<String> getEjbContainerNames()
+ {
+ return Collections.singleton("EjbContainer#1");
+ }
+}
Added: 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 (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockFacesIntegrationDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -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;
+
+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());
+ }
+}
Added: 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 (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockJBWMDDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,46 @@
+/*
+ * 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
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockTransactionServices.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,41 @@
+/*
+ * 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 javax.transaction.Synchronization;
+
+import org.jboss.webbeans.transaction.spi.TransactionServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockTransactionServices implements TransactionServices
+{
+ public boolean isTransactionActive()
+ {
+ return false;
+ }
+
+ public void registerSynchronization(Synchronization synchronizedObserver)
+ {
+ }
+}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWBBootstrap.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWBBootstrap.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWBBootstrap.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,76 @@
+/*
+ * 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.webbeans.bootstrap.api.helpers.AbstractBootstrap;
+import org.jboss.webbeans.manager.api.WebBeansManager;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockWBBootstrap extends AbstractBootstrap implements CheckableBootstrap
+{
+ private boolean init;
+ private boolean boot;
+ private boolean shutdown;
+
+ public MockWBBootstrap()
+ {
+ System.out.println(">>>>>>>>>>>>>>>>>> " + getClass());
+ System.out.println(">>>>>>>>>>>>>>>>>> " + getClass().getClassLoader());
+ }
+
+ public void initialize()
+ {
+ init = true;
+ }
+
+ public WebBeansManager getManager()
+ {
+ return null;
+ }
+
+ public void boot()
+ {
+ boot = true;
+ }
+
+ public void shutdown()
+ {
+ shutdown = true;
+ }
+
+ public boolean isInit()
+ {
+ return init;
+ }
+
+ public boolean isBoot()
+ {
+ return boot;
+ }
+
+ public boolean isShutdown()
+ {
+ return shutdown;
+ }
+}
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockWarClassLoaderDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -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;
+
+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);
+ }
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WBDEWrapper.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WBDEWrapper.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/WBDEWrapper.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,50 @@
+/*
+ * 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 org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryEnvironment;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WBDEWrapper implements WebBeanDiscovery
+{
+ protected final WebBeanDiscoveryEnvironment environment;
+
+ public WBDEWrapper(WebBeanDiscoveryEnvironment environment)
+ {
+ this.environment = environment;
+ }
+
+ public Iterable<Class<?>> discoverWebBeanClasses()
+ {
+ return environment.getWebBeanClasses();
+ }
+
+ public Iterable<URL> discoverWebBeansXml()
+ {
+ return environment.getWebBeansXml();
+ }
+}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/crm/CrmWebBean.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,29 @@
+/*
+ * 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.crm;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class CrmWebBean
+{
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockEjbJarDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,47 @@
+/*
+ * 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.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock ejb-jar.xml parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockEjbJarDeployer extends AbstractVFSParsingDeployer<EjbJarMetaData>
+{
+ public MockEjbJarDeployer()
+ {
+ super(EjbJarMetaData.class);
+ setName("ejb-jar.xml");
+ }
+
+ protected EjbJarMetaData parse(VFSDeploymentUnit unit, VirtualFile file, EjbJarMetaData root) throws Exception
+ {
+ return new EjbJar30MetaData();
+ }
+}
Added: 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 (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossAppDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,47 @@
+/*
+ * 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.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ear.jboss.JBoss50AppMetaData;
+import org.jboss.metadata.ear.jboss.JBossAppMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock application.properties parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJBossAppDeployer extends AbstractVFSParsingDeployer<JBossAppMetaData>
+{
+ public MockJBossAppDeployer()
+ {
+ super(JBossAppMetaData.class);
+ setName("application.properties");
+ }
+
+ protected JBossAppMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossAppMetaData root) throws Exception
+ {
+ return new JBoss50AppMetaData();
+ }
+}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,46 @@
+/*
+ * 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.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Mock jboss.xml parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJBossDeployer extends AbstractVFSParsingDeployer<JBossMetaData>
+{
+ public MockJBossDeployer()
+ {
+ super(JBossMetaData.class);
+ setName("jboss.xml");
+ }
+
+ protected JBossMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossMetaData root) throws Exception
+ {
+ return new JBossMetaData();
+ }
+}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockJBossWebDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,46 @@
+/*
+ * 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.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 jboss-web.xml parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockJBossWebDeployer extends AbstractVFSParsingDeployer<JBossWebMetaData>
+{
+ public MockJBossWebDeployer()
+ {
+ super(JBossWebMetaData.class);
+ setName("jboss-web.xml");
+ }
+
+ protected JBossWebMetaData parse(VFSDeploymentUnit unit, VirtualFile file, JBossWebMetaData root) throws Exception
+ {
+ return new JBossWebMetaData();
+ }
+}
\ No newline at end of file
Added: 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/MockMergeJBossDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockMergeJBossDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -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;
+
+/**
+ * Mock merge ejbjar md --> jboss md deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockMergeJBossDeployer extends AbstractSimpleRealDeployer<EjbJarMetaData>
+{
+ public MockMergeJBossDeployer()
+ {
+ super(EjbJarMetaData.class);
+ addOutput(JBossMetaData.class);
+ setStage(DeploymentStages.POST_CLASSLOADER);
+ }
+
+ public void deploy(DeploymentUnit unit, EjbJarMetaData deployment) throws DeploymentException
+ {
+ JBossMetaData jbmd = new JBossMetaData();
+ jbmd.merge(null, deployment);
+ unit.addAttachment(JBossMetaData.class, jbmd);
+ }
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWebDeployer.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,46 @@
+/*
+ * 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.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 web.xml parser.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockWebDeployer extends AbstractVFSParsingDeployer<JBossWebMetaData>
+{
+ public MockWebDeployer()
+ {
+ 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
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/BusinessInterface.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,30 @@
+/*
+ * 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.ejb;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface BusinessInterface
+{
+ int add(int x, int y);
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ejb/MySLSBean.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,33 @@
+/*
+ * 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.ejb;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MySLSBean implements BusinessInterface
+{
+ public int add(int x, int y)
+ {
+ return x + y;
+ }
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ext/ExternalWebBean.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,29 @@
+/*
+ * 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.ext;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ExternalWebBean
+{
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jar/PlainJavaBean.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,29 @@
+/*
+ * 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.jar;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PlainJavaBean
+{
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/jsf/NotWBJsfBean.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,29 @@
+/*
+ * 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.jsf;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class NotWBJsfBean
+{
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/ui/UIWebBean.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,29 @@
+/*
+ * 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.ui;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class UIWebBean
+{
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/util/SomeUtil.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,29 @@
+/*
+ * 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.util;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SomeUtil
+{
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/web/ServletWebBean.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,29 @@
+/*
+ * 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.web;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ServletWebBean
+{
+}
Added: 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 (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,146 @@
+/*
+ * 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 java.lang.reflect.Method;
+import java.util.Set;
+
+import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
+import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.test.deployers.support.crm.CrmWebBean;
+import org.jboss.test.deployers.support.ejb.MySLSBean;
+import org.jboss.test.deployers.support.ext.ExternalWebBean;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.test.deployers.support.jsf.NotWBJsfBean;
+import org.jboss.test.deployers.support.ui.UIWebBean;
+import org.jboss.test.deployers.support.util.SomeUtil;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.virtual.AssembledDirectory;
+
+/**
+ * AbstractWebBeansTest.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractWebBeansTest extends BootstrapDeployersTest
+{
+ protected AbstractWebBeansTest(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ // excluding class that knows hot to load from system classloader
+ Set<Class<?>> excluded = AbstractJDKChecker.getExcluded();
+ excluded.add(BeanMetaDataFactoryVisitor.class);
+
+ super.setUp();
+ }
+
+ protected void assertInstanceOf(Object target, String className, ClassLoader cl) throws Exception
+ {
+ Class<?> clazz = cl.loadClass(className);
+ assertTrue(clazz.isInstance(target));
+ }
+
+ protected boolean invoke(Object target, String name) throws Exception
+ {
+ Method m = target.getClass().getMethod("is" + name);
+ return (Boolean)m.invoke(target);
+ }
+
+ protected AssembledDirectory createBasicEar() throws Exception
+ {
+ AssembledDirectory ear = createTopLevelWithUtil();
+
+ AssembledDirectory jar = ear.mkdir("simple.jar");
+ addPackage(jar, PlainJavaBean.class);
+ addPath(jar, "/webbeans/simple/jar", "META-INF");
+
+ AssembledDirectory ejbs = ear.mkdir("ejbs.jar");
+ addPackage(ejbs, MySLSBean.class);
+ addPath(ejbs, "/webbeans/simple/ejb", "META-INF");
+
+ AssembledDirectory war = ear.mkdir("simple.war");
+ AssembledDirectory webinf = war.mkdir("WEB-INF");
+ AssembledDirectory classes = webinf.mkdir("classes");
+ addPackage(classes, ServletWebBean.class);
+ addPath(war, "/webbeans/simple/web", "WEB-INF");
+
+ AssembledDirectory lib = webinf.mkdir("lib");
+
+ AssembledDirectory uijar = lib.mkdir("ui.jar");
+ addPackage(uijar, UIWebBean.class);
+ addPath(uijar, "/webbeans/simple/ui", "META-INF");
+
+ // war w/o beans.xml
+
+ war = ear.mkdir("crm.war");
+ webinf = war.mkdir("WEB-INF");
+ classes = webinf.mkdir("classes");
+ addPackage(classes, NotWBJsfBean.class);
+
+ lib = webinf.mkdir("lib");
+
+ uijar = lib.mkdir("crm.jar");
+ addPackage(uijar, CrmWebBean.class);
+ addPath(uijar, "/webbeans/simple/crm", "META-INF");
+
+ enableTrace("org.jboss.deployers");
+
+ return ear;
+ }
+
+ protected AssembledDirectory createTopLevelWithUtil() throws Exception
+ {
+ AssembledDirectory topLevel = createAssembledDirectory("top-level.ear", "top-level.ear");
+ addPath(topLevel, "/webbeans/simple", "META-INF");
+
+ AssembledDirectory earLib = topLevel.mkdir("lib");
+
+ AssembledDirectory util = earLib.mkdir("util.jar");
+ addPackage(util, SomeUtil.class);
+
+ AssembledDirectory ext = earLib.mkdir("ext.jar");
+ addPackage(ext, ExternalWebBean.class);
+ addPath(ext, "/webbeans/simple/ext", "META-INF");
+
+ return topLevel;
+ }
+
+ protected AssembledDirectory createWarInEar() throws Exception
+ {
+ AssembledDirectory ear = createAssembledDirectory("war-in-ear.ear", "war-in-ear.ear");
+ addPath(ear, "/webbeans/warinear", "META-INF");
+
+ AssembledDirectory war = ear.mkdir("simple.war");
+ AssembledDirectory webinf = war.mkdir("WEB-INF");
+ AssembledDirectory classes = webinf.mkdir("classes");
+ addPackage(classes, ServletWebBean.class);
+ addPath(war, "/webbeans/simple/web", "WEB-INF");
+
+ return ear;
+ }
+}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/BootDeployerTestCase.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,100 @@
+/*
+ * 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.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webbeans.integration.deployer.DeployersUtils;
+
+/**
+ * Test boot deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class BootDeployerTestCase extends AbstractWebBeansTest
+{
+ public BootDeployerTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(BootDeployerTestCase.class);
+ }
+
+ protected void testBootstrap(VirtualFile ear) throws Exception
+ {
+ Object bootstrap;
+ Deployment deployment = createVFSDeployment(ear);
+ DeployerClient mainDeployer = getDeployerClient();
+ mainDeployer.addDeployment(deployment);
+ mainDeployer.process();
+ try
+ {
+ DeploymentUnit earDU = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
+ String bootName = DeployersUtils.getBootstrapBeanName(earDU);
+ bootstrap = getBean(bootName, null);
+ assertInstanceOf(bootstrap, "org.jboss.test.deployers.support.CheckableBootstrap", earDU.getClassLoader());
+ // waiting on ejb
+ assertTrue(invoke(bootstrap, "Init"));
+ assertFalse(invoke(bootstrap, "Boot")); // not yet booted
+ assertFalse(invoke(bootstrap, "Shutdown"));
+ // install ejb
+ KernelControllerContext ejb = deploy(new AbstractBeanMetaData("EjbContainer#1", Object.class.getName()));
+ try
+ {
+ assertTrue(ejb.getState().equals(ControllerState.INSTALLED));
+ /// check boot
+ assertTrue(invoke(bootstrap, "Init"));
+ assertTrue(invoke(bootstrap, "Boot"));
+ assertFalse(invoke(bootstrap, "Shutdown"));
+ }
+ finally
+ {
+ undeploy(ejb);
+ }
+ }
+ finally
+ {
+ mainDeployer.removeDeployment(deployment);
+ mainDeployer.process();
+ }
+ assertTrue(invoke(bootstrap, "Shutdown"));
+ }
+
+ public void testEar() throws Exception
+ {
+ testBootstrap(createBasicEar());
+ }
+
+ public void testWarInEar() throws Exception
+ {
+ testBootstrap(createWarInEar());
+ }
+}
\ No newline at end of file
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/PostDeployersTestCase.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,197 @@
+/*
+ * 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 java.util.List;
+
+import junit.framework.Test;
+
+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.structure.spi.DeploymentUnit;
+import org.jboss.metadata.common.ejb.IEjbJarMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
+import org.jboss.metadata.web.jboss.JBossWebMetaData;
+import org.jboss.metadata.web.spec.ListenerMetaData;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Test post deployers.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class PostDeployersTestCase extends AbstractWebBeansTest
+{
+ public PostDeployersTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(PostDeployersTestCase.class);
+ }
+
+ public void testSimpleJar() throws Exception
+ {
+ testJar("simple", false);
+ }
+
+ public void testPostJar() throws Exception
+ {
+ testJar("post", true);
+ }
+
+ public void testSimpleWar() throws Exception
+ {
+ testWar("simple", false, true);
+ }
+
+ public void testPostWar() throws Exception
+ {
+ testWar("post", true, false);
+ }
+
+ public void testEar() throws Exception
+ {
+ VirtualFile ear = createBasicEar();
+ DeploymentUnit earDU = assertDeploy(ear);
+ try
+ {
+ assertClassLoading(true, earDU);
+
+ DeploymentUnit jarDU = assertChild(earDU, "ejbs.jar");
+ assertWBInterceptor(jarDU);
+
+ DeploymentUnit webDU = assertChild(earDU, "simple.war");
+ assertWBListener(webDU);
+ }
+ finally
+ {
+ undeploy(earDU);
+ }
+ }
+
+ public void testWarWithNoWBFile() throws Exception
+ {
+ AssembledDirectory ear = createAssembledDirectory("top-level.ear", "top-level.ear");
+ addPath(ear, "/webbeans/warwowb", "META-INF");
+
+ AssembledDirectory war = ear.mkdir("simple.war");
+ addPath(war, "/webbeans/warwowb/web", "WEB-INF");
+
+ AssembledDirectory ejbs = ear.mkdir("ejbs.jar");
+ addPath(ejbs, "/webbeans/warwowb/ejb", "META-INF");
+
+ DeploymentUnit topDU = assertDeploy(ear);
+ try
+ {
+ DeploymentUnit ejbDU = assertChild(topDU, "ejbs.jar");
+ assertWBInterceptor(ejbDU);
+
+ DeploymentUnit webDU = assertChild(topDU, "simple.war");
+ assertWBListener(webDU);
+ }
+ finally
+ {
+ undeploy(topDU);
+ }
+ }
+
+ protected void testJar(String type, boolean testCL) throws Exception
+ {
+ AssembledDirectory topLevel = createAssembledDirectory("ejbs.jar", "ejbs.jar");
+ addPath(topLevel, "/webbeans/" + type + "/ejb", "META-INF");
+
+ DeploymentUnit topDU = assertDeploy(topLevel);
+ try
+ {
+ assertClassLoading(testCL, topDU);
+ assertWBInterceptor(topDU);
+ }
+ finally
+ {
+ undeploy(topDU);
+ }
+ }
+
+ protected void testWar(String type, boolean testCL, boolean testListner) throws Exception
+ {
+ AssembledDirectory topLevel = createAssembledDirectory("web.war", "web.war");
+ addPath(topLevel, "/webbeans/" + type + "/web", "WEB-INF");
+
+ DeploymentUnit topDU = assertDeploy(topLevel);
+ try
+ {
+ if (testCL)
+ assertClassLoading(testCL, topDU);
+ if (testListner)
+ assertWBListener(topDU);
+ }
+ finally
+ {
+ undeploy(topDU);
+ }
+ }
+
+ protected void assertClassLoading(boolean equals, DeploymentUnit unit)
+ {
+ ClassLoadingMetaData clmd = unit.getAttachment(ClassLoadingMetaData.class);
+ assertNotNull(clmd);
+
+ ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
+ classLoadingMetaData.setName(unit.getName());
+ classLoadingMetaData.setDomain(clmd.getDomain()); // hack, get domain from clmd
+ classLoadingMetaData.setExportAll(ExportAll.NON_EMPTY);
+ classLoadingMetaData.setImportAll(true);
+ classLoadingMetaData.setVersion(Version.DEFAULT_VERSION);
+ classLoadingMetaData.setJ2seClassLoadingCompliance(false);
+
+ assertEquals(equals, clmd.equals(classLoadingMetaData));
+ }
+
+ protected void assertWBInterceptor(DeploymentUnit unit)
+ {
+ IEjbJarMetaData ejbmd = unit.getAttachment(JBossMetaData.class);
+ assertNotNull(ejbmd);
+ InterceptorsMetaData interceptors = ejbmd.getInterceptors();
+ assertNotNull(interceptors);
+ InterceptorMetaData imd = interceptors.get("org.jboss.webbeans.ejb.SessionBeanInterceptor");
+ assertNotNull(imd);
+ }
+
+ protected void assertWBListener(DeploymentUnit unit)
+ {
+ JBossWebMetaData jbwmd = unit.getAttachment(JBossWebMetaData.class);
+ assertNotNull(jbwmd);
+ List<ListenerMetaData> listeners = jbwmd.getListeners();
+ assertNotNull(listeners);
+ assertEquals(1, listeners.size());
+ ListenerMetaData lmd = listeners.get(0);
+ assertNotNull(lmd);
+ assertEquals("org.jboss.webbeans.servlet.WebBeansListener", lmd.getListenerClass());
+ }
+}
Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.java (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,128 @@
+/*
+ * 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 java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.deployers.support.crm.CrmWebBean;
+import org.jboss.test.deployers.support.ejb.BusinessInterface;
+import org.jboss.test.deployers.support.ejb.MySLSBean;
+import org.jboss.test.deployers.support.ext.ExternalWebBean;
+import org.jboss.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.test.deployers.support.ui.UIWebBean;
+import org.jboss.test.deployers.support.web.ServletWebBean;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryEnvironment;
+
+/**
+ * WebBeansDiscovery env test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WBDiscoveryEnvTestCase extends AbstractWebBeansTest
+{
+ public WBDiscoveryEnvTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(WBDiscoveryEnvTestCase.class);
+ }
+
+ public void testSimpleUsage() throws Exception
+ {
+ VirtualFile ear = createBasicEar();
+ VFSDeploymentUnit topUnit = assertDeploy(ear);
+ try
+ {
+ WebBeanDiscoveryEnvironment wbDiscovery = topUnit.getAttachment(WebBeanDiscoveryEnvironment.class);
+ assertNotNull("Null WBDiscoveryEnv.", wbDiscovery);
+
+ Set<String> expected = new HashSet<String>();
+ addExpectedResource(expected, "ejbs.jar");
+ addExpectedResource(expected, "ext.jar");
+ addExpectedResource(expected, "simple.jar");
+ addExpectedResource(expected, "ui.jar");
+ addExpectedResource(expected, "crm.jar");
+ addExpectedResource(expected, "simple.war", "/WEB-INF/beans.xml");
+
+ for (URL url : wbDiscovery.getWebBeansXml())
+ {
+ boolean found = false;
+ Iterator<String> iter = expected.iterator();
+ while (iter.hasNext())
+ {
+ String expectedURL = iter.next();
+ if (url.toExternalForm().contains(expectedURL))
+ {
+ iter.remove();
+ found = true;
+ break;
+ }
+ }
+ assertTrue("Unexpected wb url: " + url, found);
+ }
+
+ assertEmpty("Should be emtpy, missing " + expected, expected);
+
+ addExpectedClass(expected, BusinessInterface.class);
+ addExpectedClass(expected, MySLSBean.class);
+ addExpectedClass(expected, ExternalWebBean.class);
+ addExpectedClass(expected, PlainJavaBean.class);
+ addExpectedClass(expected, UIWebBean.class);
+ addExpectedClass(expected, ServletWebBean.class);
+ addExpectedClass(expected, CrmWebBean.class);
+
+ for (Class<?> clazz : wbDiscovery.getWebBeanClasses())
+ assertTrue(expected.remove(clazz.getName()));
+
+ assertEmpty("Should be emtpy, missing " + expected, expected);
+ }
+ finally
+ {
+ undeploy(topUnit);
+ }
+ }
+
+ private static void addExpectedResource(Set<String> expected, String unit)
+ {
+ addExpectedResource(expected, unit, "/META-INF/beans.xml");
+ }
+
+ private static void addExpectedResource(Set<String> expected, String unit, String suffix)
+ {
+ expected.add(unit + suffix);
+ }
+
+ private static void addExpectedClass(Set<String> expected, Class<?> clazz)
+ {
+ expected.add(clazz.getName());
+ }
+}
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers)
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/VFSTestSuite.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers/VFSTestSuite.java 2009-07-13 15:17:46 UTC (rev 91168)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/VFSTestSuite.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -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.webbeans.deployers;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-import org.jboss.test.webbeans.deployers.test.BootDeployerTestCase;
-import org.jboss.test.webbeans.deployers.test.PostDeployersTestCase;
-import org.jboss.test.webbeans.deployers.test.WBDiscoveryEnvTestCase;
-
-/**
- * VFS deployers tests.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class VFSTestSuite extends TestSuite
-{
- public static void main(String[] args)
- {
- TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("Deployers WebBeans Tests");
-
- suite.addTest(WBDiscoveryEnvTestCase.suite());
- suite.addTest(PostDeployersTestCase.suite());
- suite.addTest(BootDeployerTestCase.suite());
-
- return suite;
- }
-}
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/AbstractWebBeansTest.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers/test/AbstractWebBeansTest.java 2009-07-13 15:17:46 UTC (rev 91168)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/AbstractWebBeansTest.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -1,105 +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.webbeans.deployers.test;
-
-import org.jboss.test.deployers.BootstrapDeployersTest;
-import org.jboss.test.webbeans.deployers.support.crm.CrmWebBean;
-import org.jboss.test.webbeans.deployers.support.ejb.MySLSBean;
-import org.jboss.test.webbeans.deployers.support.ext.ExternalWebBean;
-import org.jboss.test.webbeans.deployers.support.jar.PlainJavaBean;
-import org.jboss.test.webbeans.deployers.support.jsf.NotWBJsfBean;
-import org.jboss.test.webbeans.deployers.support.ui.UIWebBean;
-import org.jboss.test.webbeans.deployers.support.util.SomeUtil;
-import org.jboss.test.webbeans.deployers.support.web.ServletWebBean;
-import org.jboss.virtual.AssembledDirectory;
-
-/**
- * AbstractWebBeansTest.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class AbstractWebBeansTest extends BootstrapDeployersTest
-{
- protected AbstractWebBeansTest(String name)
- {
- super(name);
- }
-
- protected AssembledDirectory createBasicEar() throws Exception
- {
- AssembledDirectory ear = createTopLevelWithUtil();
-
- AssembledDirectory jar = ear.mkdir("simple.jar");
- addPackage(jar, PlainJavaBean.class);
- addPath(jar, "/webbeans/simple/jar", "META-INF");
-
- AssembledDirectory ejbs = ear.mkdir("ejbs.jar");
- addPackage(ejbs, MySLSBean.class);
- addPath(ejbs, "/webbeans/simple/ejb", "META-INF");
-
- AssembledDirectory war = ear.mkdir("simple.war");
- AssembledDirectory webinf = war.mkdir("WEB-INF");
- AssembledDirectory classes = webinf.mkdir("classes");
- addPackage(classes, ServletWebBean.class);
- addPath(war, "/webbeans/simple/web", "WEB-INF");
-
- AssembledDirectory lib = webinf.mkdir("lib");
-
- AssembledDirectory uijar = lib.mkdir("ui.jar");
- addPackage(uijar, UIWebBean.class);
- addPath(uijar, "/webbeans/simple/ui", "META-INF");
-
- // war w/o beans.xml
-
- war = ear.mkdir("crm.war");
- webinf = war.mkdir("WEB-INF");
- classes = webinf.mkdir("classes");
- addPackage(classes, NotWBJsfBean.class);
-
- lib = webinf.mkdir("lib");
-
- uijar = lib.mkdir("crm.jar");
- addPackage(uijar, CrmWebBean.class);
- addPath(uijar, "/webbeans/simple/crm", "META-INF");
-
- enableTrace("org.jboss.deployers");
-
- return ear;
- }
-
- protected AssembledDirectory createTopLevelWithUtil() throws Exception
- {
- AssembledDirectory topLevel = createAssembledDirectory("top-level.ear", "top-level.ear");
- addPath(topLevel, "/webbeans/simple", "META-INF");
-
- AssembledDirectory earLib = topLevel.mkdir("lib");
-
- AssembledDirectory util = earLib.mkdir("util.jar");
- addPackage(util, SomeUtil.class);
-
- AssembledDirectory ext = earLib.mkdir("ext.jar");
- addPackage(ext, ExternalWebBean.class);
- addPath(ext, "/webbeans/simple/ext", "META-INF");
-
- return topLevel;
- }
-}
\ No newline at end of file
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.java 2009-07-13 15:17:46 UTC (rev 91168)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -1,85 +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.webbeans.deployers.test;
-
-import junit.framework.Test;
-import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.test.webbeans.deployers.support.CheckableBootstrap;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.webbeans.integration.deployer.DeployersUtils;
-
-/**
- * Test boot deployer.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class BootDeployerTestCase extends AbstractWebBeansTest
-{
- public BootDeployerTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(BootDeployerTestCase.class);
- }
-
- public void testEar() throws Exception
- {
- CheckableBootstrap bootstrap;
- VirtualFile ear = createBasicEar();
- Deployment deployment = createVFSDeployment(ear);
- DeployerClient mainDeployer = getDeployerClient();
- mainDeployer.addDeployment(deployment);
- mainDeployer.process();
- try
- {
- DeploymentUnit earDU = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
- String bootName = DeployersUtils.getBootstrapBeanName(earDU);
- Object boot = getBean(bootName, null);
- bootstrap = assertInstanceOf(boot, CheckableBootstrap.class, false);
- // waiting on ejb
- assertTrue(bootstrap.isInit());
- assertFalse(bootstrap.isBoot()); // not yet booted
- assertFalse(bootstrap.isShutdown());
- // install ejb
- KernelControllerContext ejb = deploy(new AbstractBeanMetaData("EjbContainer#1", Object.class.getName()));
- assertTrue(ejb.getState().equals(ControllerState.INSTALLED));
- /// check boot
- assertTrue(bootstrap.isInit());
- assertTrue(bootstrap.isBoot());
- assertFalse(bootstrap.isShutdown());
- }
- finally
- {
- mainDeployer.removeDeployment(deployment);
- mainDeployer.process();
- }
- assertTrue(bootstrap.isShutdown());
- }
-}
\ No newline at end of file
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.xml)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,30 @@
+<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="WBDiscoveryDeployer" class="org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryDeployer"/>
+
+ <bean name="DynamicDependencyCreator" class="org.jboss.webbeans.integration.deployer.env.DynamicDependencyCreator">
+ <constructor>
+ <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
+ </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="BootDeployer" class="org.jboss.test.deployers.support.MockBootDeployer"/>
+
+ <!-- Mock EJB utils -->
+
+ <beanfactory name="JBossEjbServices" class="org.jboss.test.deployers.support.MockEjbServices"/>
+
+ <bean name="JBossTransactionServices" class="org.jboss.test.deployers.support.MockTransactionServices"/>
+
+ <bean name="RealTransactionManager" class="java.lang.Object"/>
+
+</deployment>
Property changes on: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/BootDeployerTestCase.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers/test/PostDeployersTestCase.java 2009-07-13 15:17:46 UTC (rev 91168)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -1,197 +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.webbeans.deployers.test;
-
-import java.util.List;
-
-import junit.framework.Test;
-
-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.structure.spi.DeploymentUnit;
-import org.jboss.metadata.common.ejb.IEjbJarMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.spec.InterceptorMetaData;
-import org.jboss.metadata.ejb.spec.InterceptorsMetaData;
-import org.jboss.metadata.web.jboss.JBossWebMetaData;
-import org.jboss.metadata.web.spec.ListenerMetaData;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Test post deployers.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class PostDeployersTestCase extends AbstractWebBeansTest
-{
- public PostDeployersTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(PostDeployersTestCase.class);
- }
-
- public void testSimpleJar() throws Exception
- {
- testJar("simple", false);
- }
-
- public void testPostJar() throws Exception
- {
- testJar("post", true);
- }
-
- public void testSimpleWar() throws Exception
- {
- testWar("simple", false, true);
- }
-
- public void testPostWar() throws Exception
- {
- testWar("post", true, false);
- }
-
- public void testEar() throws Exception
- {
- VirtualFile ear = createBasicEar();
- DeploymentUnit earDU = assertDeploy(ear);
- try
- {
- assertClassLoading(true, earDU);
-
- DeploymentUnit jarDU = assertChild(earDU, "ejbs.jar");
- assertWBInterceptor(jarDU);
-
- DeploymentUnit webDU = assertChild(earDU, "simple.war");
- assertWBListener(webDU);
- }
- finally
- {
- undeploy(earDU);
- }
- }
-
- public void testWarWithNoWBFile() throws Exception
- {
- AssembledDirectory ear = createAssembledDirectory("top-level.ear", "top-level.ear");
- addPath(ear, "/webbeans/warwowb", "META-INF");
-
- AssembledDirectory war = ear.mkdir("simple.war");
- addPath(war, "/webbeans/warwowb/web", "WEB-INF");
-
- AssembledDirectory ejbs = ear.mkdir("ejbs.jar");
- addPath(ejbs, "/webbeans/warwowb/ejb", "META-INF");
-
- DeploymentUnit topDU = assertDeploy(ear);
- try
- {
- DeploymentUnit ejbDU = assertChild(topDU, "ejbs.jar");
- assertWBInterceptor(ejbDU);
-
- DeploymentUnit webDU = assertChild(topDU, "simple.war");
- assertWBListener(webDU);
- }
- finally
- {
- undeploy(topDU);
- }
- }
-
- protected void testJar(String type, boolean testCL) throws Exception
- {
- AssembledDirectory topLevel = createAssembledDirectory("ejbs.jar", "ejbs.jar");
- addPath(topLevel, "/webbeans/" + type + "/ejb", "META-INF");
-
- DeploymentUnit topDU = assertDeploy(topLevel);
- try
- {
- assertClassLoading(testCL, topDU);
- assertWBInterceptor(topDU);
- }
- finally
- {
- undeploy(topDU);
- }
- }
-
- protected void testWar(String type, boolean testCL, boolean testListner) throws Exception
- {
- AssembledDirectory topLevel = createAssembledDirectory("web.war", "web.war");
- addPath(topLevel, "/webbeans/" + type + "/web", "WEB-INF");
-
- DeploymentUnit topDU = assertDeploy(topLevel);
- try
- {
- if (testCL)
- assertClassLoading(testCL, topDU);
- if (testListner)
- assertWBListener(topDU);
- }
- finally
- {
- undeploy(topDU);
- }
- }
-
- protected void assertClassLoading(boolean equals, DeploymentUnit unit)
- {
- ClassLoadingMetaData clmd = unit.getAttachment(ClassLoadingMetaData.class);
- assertNotNull(clmd);
-
- ClassLoadingMetaData classLoadingMetaData = new ClassLoadingMetaData();
- classLoadingMetaData.setName(unit.getName());
- classLoadingMetaData.setDomain(clmd.getDomain()); // hack, get domain from clmd
- classLoadingMetaData.setExportAll(ExportAll.NON_EMPTY);
- classLoadingMetaData.setImportAll(true);
- classLoadingMetaData.setVersion(Version.DEFAULT_VERSION);
- classLoadingMetaData.setJ2seClassLoadingCompliance(false);
-
- assertEquals(equals, clmd.equals(classLoadingMetaData));
- }
-
- protected void assertWBInterceptor(DeploymentUnit unit)
- {
- IEjbJarMetaData ejbmd = unit.getAttachment(JBossMetaData.class);
- assertNotNull(ejbmd);
- InterceptorsMetaData interceptors = ejbmd.getInterceptors();
- assertNotNull(interceptors);
- InterceptorMetaData imd = interceptors.get("org.jboss.webbeans.ejb.SessionBeanInterceptor");
- assertNotNull(imd);
- }
-
- protected void assertWBListener(DeploymentUnit unit)
- {
- JBossWebMetaData jbwmd = unit.getAttachment(JBossWebMetaData.class);
- assertNotNull(jbwmd);
- List<ListenerMetaData> listeners = jbwmd.getListeners();
- assertNotNull(listeners);
- assertEquals(1, listeners.size());
- ListenerMetaData lmd = listeners.get(0);
- assertNotNull(lmd);
- assertEquals("org.jboss.webbeans.servlet.WebBeansListener", lmd.getListenerClass());
- }
-}
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/webbeans/deployers/test/PostDeployersTestCase.xml)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,21 @@
+<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="MockEjbJar" class="org.jboss.test.deployers.support.deployer.MockEjbJarDeployer"/>
+ <bean name="MockJBossApp" class="org.jboss.test.deployers.support.deployer.MockJBossAppDeployer"/>
+ <bean name="MockJBoss" class="org.jboss.test.deployers.support.deployer.MockJBossDeployer"/>
+ <bean name="MockJBossWeb" class="org.jboss.test.deployers.support.deployer.MockJBossWebDeployer"/>
+ <bean name="MockWeb" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+ <bean name="MockMergeJBoss" class="org.jboss.test.deployers.support.deployer.MockMergeJBossDeployer"/>
+
+ <bean name="WBFiles" class="org.jboss.webbeans.integration.deployer.metadata.WebBeansFilesDeployer"/>
+
+ <bean name="PostEjbJar" class="org.jboss.webbeans.integration.deployer.metadata.WBEjbInterceptorMetadataDeployer"/>
+ <bean name="PostJBossApp" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossAppMetadataDeployer"/>
+ <bean name="PostJBoss" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossMetadataDeployer"/>
+ <bean name="PostJBossWeb" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossWebMetadataDeployer"/>
+ <bean name="PostWeb" class="org.jboss.webbeans.integration.deployer.metadata.PostWebMetadataDeployer"/>
+
+</deployment>
Property changes on: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/PostDeployersTestCase.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/webbeans/deployers/test/WBDiscoveryEnvTestCase.java 2009-07-13 15:17:46 UTC (rev 91168)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.java 2009-07-14 15:07:37 UTC (rev 91220)
@@ -1,128 +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.webbeans.deployers.test;
-
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.test.webbeans.deployers.support.crm.CrmWebBean;
-import org.jboss.test.webbeans.deployers.support.ejb.BusinessInterface;
-import org.jboss.test.webbeans.deployers.support.ejb.MySLSBean;
-import org.jboss.test.webbeans.deployers.support.ext.ExternalWebBean;
-import org.jboss.test.webbeans.deployers.support.jar.PlainJavaBean;
-import org.jboss.test.webbeans.deployers.support.ui.UIWebBean;
-import org.jboss.test.webbeans.deployers.support.web.ServletWebBean;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryEnvironment;
-
-/**
- * WebBeansDiscovery env test case.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class WBDiscoveryEnvTestCase extends AbstractWebBeansTest
-{
- public WBDiscoveryEnvTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(WBDiscoveryEnvTestCase.class);
- }
-
- public void testSimpleUsage() throws Exception
- {
- VirtualFile ear = createBasicEar();
- VFSDeploymentUnit topUnit = assertDeploy(ear);
- try
- {
- WebBeanDiscoveryEnvironment wbDiscovery = topUnit.getAttachment(WebBeanDiscoveryEnvironment.class);
- assertNotNull("Null WBDiscoveryEnv.", wbDiscovery);
-
- Set<String> expected = new HashSet<String>();
- addExpectedResource(expected, "ejbs.jar");
- addExpectedResource(expected, "ext.jar");
- addExpectedResource(expected, "simple.jar");
- addExpectedResource(expected, "ui.jar");
- addExpectedResource(expected, "crm.jar");
- addExpectedResource(expected, "simple.war", "/WEB-INF/beans.xml");
-
- for (URL url : wbDiscovery.getWebBeansXml())
- {
- boolean found = false;
- Iterator<String> iter = expected.iterator();
- while (iter.hasNext())
- {
- String expectedURL = iter.next();
- if (url.toExternalForm().contains(expectedURL))
- {
- iter.remove();
- found = true;
- break;
- }
- }
- assertTrue("Unexpected wb url: " + url, found);
- }
-
- assertEmpty("Should be emtpy, missing " + expected, expected);
-
- addExpectedClass(expected, BusinessInterface.class);
- addExpectedClass(expected, MySLSBean.class);
- addExpectedClass(expected, ExternalWebBean.class);
- addExpectedClass(expected, PlainJavaBean.class);
- addExpectedClass(expected, UIWebBean.class);
- addExpectedClass(expected, ServletWebBean.class);
- addExpectedClass(expected, CrmWebBean.class);
-
- for (Class<?> clazz : wbDiscovery.getWebBeanClasses())
- assertTrue(expected.remove(clazz.getName()));
-
- assertEmpty("Should be emtpy, missing " + expected, expected);
- }
- finally
- {
- undeploy(topUnit);
- }
- }
-
- private static void addExpectedResource(Set<String> expected, String unit)
- {
- addExpectedResource(expected, unit, "/META-INF/beans.xml");
- }
-
- private static void addExpectedResource(Set<String> expected, String unit, String suffix)
- {
- expected.add(unit + suffix);
- }
-
- private static void addExpectedClass(Set<String> expected, Class<?> clazz)
- {
- expected.add(clazz.getName());
- }
-}
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.xml (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/webbeans/deployers/test/WBDiscoveryEnvTestCase.xml)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.xml (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/WBDiscoveryEnvTestCase.xml 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1,10 @@
+<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="WBDiscoveryDeployer" class="org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryDeployer"/>
+
+</deployment>
Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warinear/META-INF/application.properties (from rev 91168, projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warwowb/META-INF/application.properties)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warinear/META-INF/application.properties (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/warinear/META-INF/application.properties 2009-07-14 15:07:37 UTC (rev 91220)
@@ -0,0 +1 @@
+web-module=simple.war
Modified: projects/webbeans-ri-int/trunk/pom.xml
===================================================================
--- projects/webbeans-ri-int/trunk/pom.xml 2009-07-14 15:00:09 UTC (rev 91219)
+++ projects/webbeans-ri-int/trunk/pom.xml 2009-07-14 15:07:37 UTC (rev 91220)
@@ -23,15 +23,15 @@
<properties>
<version.webbeans>1.0.0-SNAPSHOT</version.webbeans>
- <version.jboss.vfs>2.1.1.GA</version.jboss.vfs>
- <version.jboss.man>2.1.0.CR8</version.jboss.man>
- <version.jboss.microcontainer>2.0.5.GA</version.jboss.microcontainer>
- <version.jboss.cl>2.0.5.GA</version.jboss.cl>
- <version.jboss.deployers>2.0.6.GA</version.jboss.deployers>
- <version.jboss.common.core>2.2.13.GA</version.jboss.common.core>
+ <version.jboss.vfs>2.1.2.GA</version.jboss.vfs>
+ <version.jboss.man>2.1.0.GA</version.jboss.man>
+ <version.jboss.microcontainer>2.0.8.GA</version.jboss.microcontainer>
+ <version.jboss.cl>2.0.6.GA</version.jboss.cl>
+ <version.jboss.deployers>2.0.8.GA</version.jboss.deployers>
+ <version.jboss.common.core>2.2.14.GA</version.jboss.common.core>
<version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
<version.jboss.classloading.spi>5.0.3.GA</version.jboss.classloading.spi>
- <version.jboss.metadata>1.0.0.CR18</version.jboss.metadata>
+ <version.jboss.metadata>1.0.0.GA</version.jboss.metadata>
<version.jbossxb>2.0.1.GA</version.jbossxb>
<version.jboss.ejb3>1.0.0</version.jboss.ejb3>
<version.jboss.ejb3.endpoint>0.1.3</version.jboss.ejb3.endpoint>
More information about the jboss-cvs-commits
mailing list