[jboss-cvs] JBossAS SVN: r106396 - in trunk/weld-int: deployer-mc-int/src/main/java/org/jboss/weld/integration/deployer/mc and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 2 06:16:18 EDT 2010
Author: kabir.khan at jboss.com
Date: 2010-07-02 06:16:17 -0400 (Fri, 02 Jul 2010)
New Revision: 106396
Added:
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/AbstractWeldInAsTest.java
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/McWeldInjectionApplicationServerTestCase.java
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/SanityApplicationServerTestCase.java
Removed:
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/Kickstart.java
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/KickstartEjb.java
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/Kickstart.java
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/KickstartEjb.java
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/ApplicationServerTestCase.java
Modified:
trunk/weld-int/deployer-mc-int/src/main/java/org/jboss/weld/integration/deployer/mc/WeldBeanMetaDataDeployerPlugin.java
trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/test/McIntegrationTestCase.java
trunk/weld-int/deployer-mc-int/src/test/resources/org/jboss/test/deployers/test/McIntegrationTestCase.xml
trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
Log:
[JBAS-8106] Don't just delay bootstrap of BootstrapBean based on presence of ejb containers. Instead depend on the top-level deployment getting installed.
Remove use of MockEjbServices in standalone test case.
Remove the KickStartEjbs from the as test cases doing injection into weld non-ejb beans.
Modified: trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java
===================================================================
--- trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer/src/main/java/org/jboss/weld/integration/deployer/env/WeldBootstrapDeployer.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -21,6 +21,9 @@
*/
package org.jboss.weld.integration.deployer.env;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.ValueMetaData;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
@@ -53,6 +56,7 @@
@Override
protected void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
{
+
ValueMetaData ejbServicesValue = info.getEjbServices();
if (ejbServicesValue == null)
throw new DeploymentException("Missing ejb services: " + unit);
@@ -79,6 +83,10 @@
bootstrap.setDestroy("shutdown");
bootstrap.addDependency("RealTransactionManager"); // so we know TM is present in JBossTransactionServices
+ //Make the bootstrap depend on this deployment unit so that we know all sub deployments have been processed
+ bootstrap.addDependency(unit.getName());
+
+
// call dynamic dependency creator for EJBs
ParameterMetaDataBuilder install = bootstrap.addInstallWithParameters("createDepenencies", "DynamicDependencyCreator", null, ControllerState.CONFIGURED);
install.addParameterMetaData(Object.class.getName(), bootstrapName);
Modified: trunk/weld-int/deployer-mc-int/src/main/java/org/jboss/weld/integration/deployer/mc/WeldBeanMetaDataDeployerPlugin.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/main/java/org/jboss/weld/integration/deployer/mc/WeldBeanMetaDataDeployerPlugin.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/main/java/org/jboss/weld/integration/deployer/mc/WeldBeanMetaDataDeployerPlugin.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -33,6 +33,7 @@
import org.jboss.deployers.vfs.spi.deployer.helpers.BeanMetaDataDeployerPlugin;
import org.jboss.kernel.plugins.dependency.AbstractKernelControllerContext;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.weld.plugins.annotations.WeldEnabledBeanAnnotationPluginInitializer;
import org.jboss.weld.integration.deployer.DeployersUtils;
/**
@@ -51,6 +52,11 @@
private final int order;
+ static
+ {
+ WeldEnabledBeanAnnotationPluginInitializer.initialize();
+ }
+
//private final String[] ignoredSuffixes = new String[] {"_JBossDeployment", "_JBossEjbServices", "_WBInjector", "_JBossJpaServices", "_JBossValidationServices", "_WeldBootstrap", "_WeldBootstrapBean", "_WebCompJndiBinder", "_JavaModuleJndiBinder"};
/** Map of real bean names and intermediate bean names */
Deleted: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/Kickstart.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/Kickstart.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/Kickstart.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -1,35 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.as.support.mctoweld.weld;
-
-import javax.ejb.Local;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
- at Local
-public interface Kickstart
-{
-
-}
Deleted: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/KickstartEjb.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/KickstartEjb.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/mctoweld/weld/KickstartEjb.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -1,34 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.as.support.mctoweld.weld;
-
-import javax.ejb.Stateless;
-
-/**
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
- at Stateless
-public class KickstartEjb
-{
-
-}
Deleted: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/Kickstart.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/Kickstart.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/Kickstart.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -1,35 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.as.support.weldtomctoweld.weld;
-
-import javax.ejb.Local;
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
- at Local
-public interface Kickstart
-{
-
-}
Deleted: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/KickstartEjb.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/KickstartEjb.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/support/weldtomctoweld/weld/KickstartEjb.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -1,34 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.as.support.weldtomctoweld.weld;
-
-import javax.ejb.Stateless;
-
-/**
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
- at Stateless
-public class KickstartEjb
-{
-
-}
Added: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/AbstractWeldInAsTest.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/AbstractWeldInAsTest.java (rev 0)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/AbstractWeldInAsTest.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -0,0 +1,189 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.as.test;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.JBossTestServices;
+import org.jboss.test.deployers.as.support.HttpUtils;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractWeldInAsTest extends JBossTestCase
+{
+ private static final ArchivePath META_INF = ArchivePaths.create("META-INF");
+ private static final ArchivePath WEB_INF = ArchivePaths.create("WEB-INF");
+ private static final ArchivePath FACES_CONFIG = ArchivePaths.create(WEB_INF, "faces-config.xml");
+ private static final ArchivePath WEB_XML = ArchivePaths.create(WEB_INF, "web.xml");
+ private static final ArchivePath META_BEANS_XML = ArchivePaths.create(META_INF, "beans.xml");
+ private static final ArchivePath WEB_BEANS_XML = ArchivePaths.create(WEB_INF, "beans.xml");
+ private static final ArchivePath JBOSS_BEANS_XML = ArchivePaths.create(META_INF, "jboss-beans.xml");
+
+ public static AbstractTestDelegate getDelegate(Class<?> clazz)
+ {
+ return new JBossTestServices(clazz);
+ }
+
+ public AbstractWeldInAsTest(String name)
+ {
+ super(name);
+ }
+
+ protected WebArchive createWebArchive(String name)
+ {
+ WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test-weld.war");
+ webArchive
+ .addResource("org/jboss/test/deployers/as/support/webapp/" + name + ".xhtml", "/" + name + ".xhtml")
+ .addResource("org/jboss/test/deployers/as/support/webapp/WEB-INF/web.xml", WEB_XML)
+ .addResource("org/jboss/test/deployers/as/support/webapp/WEB-INF/faces-config.xml", FACES_CONFIG);
+
+
+
+ getLog().debug(webArchive.toString(true));
+
+ return webArchive;
+ }
+
+ protected JavaArchive createWeldArchive(Class<?>...classes)
+ {
+ JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, "weld.jar")
+ .addClasses(classes)
+ .addResource("org/jboss/test/deployers/as/support/weld/META-INF/beans.xml", META_BEANS_XML);
+
+ getLog().debug(javaArchive.toString(true));
+ return javaArchive;
+ }
+
+ protected JavaArchive createMcArchive(String packageFragment, Class<?>...classes)
+ {
+
+ JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, "mc.jar")
+ .addClasses(classes)
+ .addResource("org/jboss/test/deployers/as/support/" + packageFragment + "/META-INF/jboss-beans.xml", JBOSS_BEANS_XML);
+
+ getLog().debug(javaArchive.toString(true));
+ return javaArchive;
+ }
+
+ protected URL createAndDeployWar(String name, Class<?>...classes) throws Exception
+ {
+ WebArchive webArchive = createWebArchive(name)
+ .addResource("org/jboss/test/deployers/as/support/weld/META-INF/beans.xml", WEB_BEANS_XML)
+ .addClasses(classes);
+
+ return explodeArchiveAndDeploy(webArchive);
+ }
+
+ protected URL createAndDeployWar(String name, String mcDescriptorPackageFragment, Class<?>...classes) throws Exception
+ {
+ WebArchive webArchive = createWebArchive(name)
+ .addResource("org/jboss/test/deployers/as/support/weld/META-INF/beans.xml", WEB_BEANS_XML)
+ .addResource("org/jboss/test/deployers/as/support/" + mcDescriptorPackageFragment + "/META-INF/jboss-beans.xml", JBOSS_BEANS_XML)
+ .addClasses(classes);
+
+ return explodeArchiveAndDeploy(webArchive);
+ }
+
+ protected URL createAndDeployEar(Archive<?>...archives) throws Exception
+ {
+ EnterpriseArchive enterpriseArchive = ShrinkWrap.create("simple.ear", EnterpriseArchive.class);
+ for (Archive<?> archive : archives)
+ enterpriseArchive.add(archive, "/");
+
+ return explodeArchiveAndDeploy(enterpriseArchive);
+ }
+
+ private URL explodeArchiveAndDeploy(Archive<?> archive) throws Exception
+ {
+ URL url = createExplodedArchive(archive);
+
+ getLog().debug(archive.toString(true));
+
+ undeploy(url.toString());
+ try
+ {
+ deploy(url.toString());
+ }
+ catch(Exception e)
+ {
+ undeploy(url.toString());
+ throw(e);
+ }
+
+ return url;
+ }
+
+ protected void accessWebApp(String urlPath, String...tokens) throws Exception
+ {
+ HttpMethodBase request = HttpUtils.accessURL(new URL(HttpUtils.getBaseURL() + urlPath));
+ String body = request.getResponseBodyAsString();
+
+ assertTrue("Body was not transformed to html:\n" + body, body.indexOf("<h:") < 0);
+
+ System.out.println(body);
+
+
+ for (String token : tokens)
+ assertTrue("Could not find '" + token + "' in body:\n" + body, body.indexOf(token) >= 0);
+ }
+
+ private URL createExplodedArchive(Archive<?> archive) throws Exception
+ {
+ File file = new File("target/lib");
+ if (file.exists())
+ deleteFile(file);
+ file.mkdir();
+ File ear = new File(file, archive.getName());
+ if (ear.exists())
+ deleteFile(file);
+ file = archive.as(ExplodedExporter.class).exportExploded(file);
+
+ return file.toURI().toURL();
+ }
+
+ private void deleteFile(File file)
+ {
+ if (file.isDirectory())
+ {
+ for (String name : file.list())
+ deleteFile(new File(file, name));
+ }
+
+ file.delete();
+ }
+
+}
Deleted: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/ApplicationServerTestCase.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/ApplicationServerTestCase.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/ApplicationServerTestCase.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -1,569 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, 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.as.test;
-
-import java.io.File;
-import java.net.URL;
-
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.jboss.shrinkwrap.api.Archive;
-import org.jboss.shrinkwrap.api.ArchivePath;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
-import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.test.AbstractTestDelegate;
-import org.jboss.test.JBossTestCase;
-import org.jboss.test.JBossTestServices;
-import org.jboss.test.deployers.as.support.Blue;
-import org.jboss.test.deployers.as.support.HttpUtils;
-import org.jboss.test.deployers.as.support.Red;
-import org.jboss.test.deployers.as.support.mctoweld.mc.BlueMcBeanNoDependencies;
-import org.jboss.test.deployers.as.support.mctoweld.mc.McBeanNoDependencies;
-import org.jboss.test.deployers.as.support.mctoweld.mc.RedMcBeanNoDependencies;
-import org.jboss.test.deployers.as.support.mctoweld.weld.Kickstart;
-import org.jboss.test.deployers.as.support.mctoweld.weld.KickstartEjb;
-import org.jboss.test.deployers.as.support.mctoweld.weld.McToWeldLocalInterface;
-import org.jboss.test.deployers.as.support.mctoweld.weld.WeldWithMcBean;
-import org.jboss.test.deployers.as.support.mctoweld.weld.WeldWithMcEjb;
-import org.jboss.test.deployers.as.support.weld.simple.BlueWeldDependency;
-import org.jboss.test.deployers.as.support.weld.simple.RedWeldDependency;
-import org.jboss.test.deployers.as.support.weld.simple.SimpleLocalInterface;
-import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldBeanNoInjection;
-import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldBeanWeldInjection;
-import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldEjbNoInjection;
-import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldEjbWeldInjection;
-import org.jboss.test.deployers.as.support.weld.simple.WeldDependency;
-import org.jboss.test.deployers.as.support.weldtomctoweld.mc.BlueMcBeanWeldDependencies;
-import org.jboss.test.deployers.as.support.weldtomctoweld.mc.McBeanWeldDependencies;
-import org.jboss.test.deployers.as.support.weldtomctoweld.mc.RedMcBeanWeldDependencies;
-import org.jboss.test.deployers.as.support.weldtomctoweld.weld.BlueWeldMcDependency;
-import org.jboss.test.deployers.as.support.weldtomctoweld.weld.RedWeldMcDependency;
-import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldMcDependency;
-import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldToMcToWeldLocalInterface;
-import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldWithMcWithWeldBean;
-import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldWithMcWithWeldEjb;
-
-
-/**
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class ApplicationServerTestCase extends JBossTestCase
-{
- private final static ArchivePath META_INF = ArchivePaths.create("META-INF");
- private final static ArchivePath WEB_INF = ArchivePaths.create("WEB-INF");
- private final static ArchivePath FACES_CONFIG = ArchivePaths.create(WEB_INF, "faces-config.xml");
- private final static ArchivePath WEB_XML = ArchivePaths.create(WEB_INF, "web.xml");
- private final static ArchivePath META_BEANS_XML = ArchivePaths.create(META_INF, "beans.xml");
- private final static ArchivePath WEB_BEANS_XML = ArchivePaths.create(WEB_INF, "beans.xml");
- private final static ArchivePath JBOSS_BEANS_XML = ArchivePaths.create(META_INF, "jboss-beans.xml");
-
- public ApplicationServerTestCase(String name)
- {
- super(name);
- }
-
- public static AbstractTestDelegate getDelegate(Class<?> clazz)
- {
- return new JBossTestServices(clazz);
- }
-
- /////////////////////////////////////////////////////////////////
- //These first tests are just "sanity" tests to make sure we
- //are deploying things the right way and that weld itself
- //works as expected
-
- public void testSimpleWeldBeanNoInjectionWar() throws Throwable
- {
- URL url = createAndDeployWar("simpleWeldBeanNoInjection", SimpleWeldBeanNoInjection.class);
- try
- {
- accessWebApp("test-weld/simpleWeldBeanNoInjection.jsf", "SimpleWeldBeanNoInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testSimpleWeldBeanNoInjectionEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("simpleWeldBeanNoInjection"),
- createWeldArchive(SimpleWeldBeanNoInjection.class));
- try
- {
- accessWebApp("test-weld/simpleWeldBeanNoInjection.jsf", "SimpleWeldBeanNoInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testSimpleWeldEjbNoInjectionWar() throws Throwable
- {
- URL url = createAndDeployWar("simpleWeldEjbNoInjection",
- SimpleWeldEjbNoInjection.class,
- SimpleLocalInterface.class);
- try
- {
- accessWebApp("test-weld/simpleWeldEjbNoInjection.jsf", "SimpleWeldEjbNoInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testSimpleWeldEjbNoInjectionEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("simpleWeldEjbNoInjection"),
- createWeldArchive(SimpleWeldEjbNoInjection.class, SimpleLocalInterface.class));
- try
- {
- accessWebApp("test-weld/simpleWeldEjbNoInjection.jsf", "SimpleWeldEjbNoInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testSimpleWeldBeanWeldInjectionWar() throws Throwable
- {
- URL url = createAndDeployWar("simpleWeldBeanWeldInjection",
- SimpleWeldBeanWeldInjection.class,
- WeldDependency.class,
- RedWeldDependency.class,
- BlueWeldDependency.class,
- Red.class,
- Blue.class);
- try
- {
- accessWebApp("test-weld/simpleWeldBeanWeldInjection.jsf", "SimpleWeldBeanWeldInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testSimpleWeldBeanWeldInjectionEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("simpleWeldBeanWeldInjection"),
- createWeldArchive(SimpleWeldBeanWeldInjection.class, WeldDependency.class, RedWeldDependency.class, BlueWeldDependency.class, Red.class, Blue.class));
- try
- {
- accessWebApp("test-weld/simpleWeldBeanWeldInjection.jsf", "SimpleWeldBeanWeldInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testSimpleWeldEjbWeldInjectionWar() throws Throwable
- {
- URL url = createAndDeployWar("simpleWeldEjbWeldInjection",
- SimpleWeldEjbWeldInjection.class,
- SimpleLocalInterface.class,
- WeldDependency.class,
- RedWeldDependency.class,
- BlueWeldDependency.class,
- Red.class,
- Blue.class);
- try
- {
- accessWebApp("test-weld/simpleWeldEjbWeldInjection.jsf", "SimpleWeldBeanEjbInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testSimpleWeldEjbWeldInjectionEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("simpleWeldEjbWeldInjection"),
- createWeldArchive(SimpleWeldEjbWeldInjection.class,
- SimpleLocalInterface.class,
- WeldDependency.class,
- RedWeldDependency.class,
- BlueWeldDependency.class,
- Red.class,
- Blue.class));
- try
- {
- accessWebApp("test-weld/simpleWeldEjbWeldInjection.jsf", "SimpleWeldBeanEjbInjection#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- /////////////////////////////////////////////////////////////////
- //These are the real Weld<->MC injection tests
-
- public void testMcNoDependenciesInjectedIntoWeldBeanWar() throws Throwable
- {
- URL url = createAndDeployWar("mcNoDependenciesInjectedIntoWeldBean",
- "mctoweld/nodependencies",
- WeldWithMcBean.class,
- Red.class,
- Blue.class,
- McBeanNoDependencies.class,
- RedMcBeanNoDependencies.class,
- BlueMcBeanNoDependencies.class,
- //TODO Remove the Kickstart EJB, which is currently necessary to make sure that there are some EJB containers to wait for before BootstrapBean can start
- KickstartEjb.class,
- Kickstart.class);
-
- try
- {
- accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldBean.jsf", "WeldWithMcBean#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testMcNoDependenciesInjectedIntoWeldBeanEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("mcNoDependenciesInjectedIntoWeldBean"),
- //TODO Remove the Kickstart EJB, which is currently necessary to make sure that there are some EJB containers to wait for before BootstrapBean can start
- createWeldArchive(WeldWithMcBean.class, KickstartEjb.class, Kickstart.class),
- createMcArchive("mctoweld/nodependencies", Red.class, Blue.class, McBeanNoDependencies.class, RedMcBeanNoDependencies.class, BlueMcBeanNoDependencies.class));
-
- try
- {
- accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldBean.jsf", "WeldWithMcBean#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testMcNoDependenciesInjectedIntoWeldEjbWar() throws Throwable
- {
- URL url = createAndDeployWar("mcNoDependenciesInjectedIntoWeldEjb",
- "mctoweld/nodependencies",
- WeldWithMcEjb.class,
- McToWeldLocalInterface.class,
- Red.class,
- Blue.class,
- McBeanNoDependencies.class,
- RedMcBeanNoDependencies.class,
- BlueMcBeanNoDependencies.class);
-
- try
- {
- accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldEjb.jsf", "WeldWithMcEjb#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testMcNoDependenciesInjectedIntoWeldEjbEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("mcNoDependenciesInjectedIntoWeldEjb"),
- createWeldArchive(WeldWithMcEjb.class, McToWeldLocalInterface.class, Red.class, Blue.class),
- createMcArchive("mctoweld/nodependencies", McBeanNoDependencies.class, RedMcBeanNoDependencies.class, BlueMcBeanNoDependencies.class));
-
- try
- {
- accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldEjb.jsf", "WeldWithMcEjb#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testWeldInjectedIntoMcInjectedIntoWeldBeanWar() throws Throwable
- {
- URL url = createAndDeployWar("weldInjectedIntoMcInjectedIntoWeldBean",
- "weldtomctoweld",
- WeldWithMcWithWeldBean.class,
- WeldMcDependency.class,
- RedWeldMcDependency.class,
- BlueWeldMcDependency.class,
- Red.class,
- Blue.class,
- McBeanWeldDependencies.class,
- RedMcBeanWeldDependencies.class,
- BlueMcBeanWeldDependencies.class,
- //TODO Remove the Kickstart EJB, which is currently necessary to make sure that there are some EJB containers to wait for before BootstrapBean can start
- KickstartEjb.class,
- Kickstart.class);
-
- try
- {
- accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldBean.jsf", "WeldWithMcWithWeldBean#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
- public void testWeldInjectedIntoMcInjectedIntoWeldBeanEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("weldInjectedIntoMcInjectedIntoWeldBean"),
- //TODO Remove the Kickstart EJB, which is currently necessary to make sure that there are some EJB containers to wait for before BootstrapBean can start
- createWeldArchive(WeldWithMcWithWeldBean.class,
- WeldMcDependency.class,
- RedWeldMcDependency.class,
- BlueWeldMcDependency.class,
- KickstartEjb.class,
- Kickstart.class),
- createMcArchive("weldtomctoweld",
- Red.class,
- Blue.class,
- McBeanWeldDependencies.class,
- RedMcBeanWeldDependencies.class,
- BlueMcBeanWeldDependencies.class));
-
- try
- {
- accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldBean.jsf", "WeldWithMcWithWeldBean#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
- }
-
-
- public void testWeldInjectedIntoMcInjectedIntoWeldEjbWar() throws Throwable
- {
- URL url = createAndDeployWar("weldInjectedIntoMcInjectedIntoWeldEjb",
- "weldtomctoweld",
- WeldWithMcWithWeldEjb.class,
- WeldToMcToWeldLocalInterface.class,
- WeldMcDependency.class,
- RedWeldMcDependency.class,
- BlueWeldMcDependency.class,
- Red.class,
- Blue.class,
- McBeanWeldDependencies.class,
- RedMcBeanWeldDependencies.class,
- BlueMcBeanWeldDependencies.class,
- //TODO Remove the Kickstart EJB, which is currently necessary to make sure that there are some EJB containers to wait for before BootstrapBean can start
- KickstartEjb.class,
- Kickstart.class);
-
- try
- {
- accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldEjb.jsf", "WeldWithMcWithWeldEjb#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
-
- }
-
- public void testWeldInjectedIntoMcInjectedIntoWeldEjbEar() throws Throwable
- {
- URL url = createAndDeployEar(
- createWebArchive("weldInjectedIntoMcInjectedIntoWeldEjb"),
- //TODO Remove the Kickstart EJB, which is currently necessary to make sure that there are some EJB containers to wait for before BootstrapBean can start
- createWeldArchive(WeldWithMcWithWeldEjb.class,
- WeldToMcToWeldLocalInterface.class,
- WeldMcDependency.class,
- RedWeldMcDependency.class,
- BlueWeldMcDependency.class,
- KickstartEjb.class,
- Kickstart.class),
- createMcArchive("weldtomctoweld",
- Red.class,
- Blue.class,
- McBeanWeldDependencies.class,
- RedMcBeanWeldDependencies.class,
- BlueMcBeanWeldDependencies.class));
-
- try
- {
- accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldEjb.jsf", "WeldWithMcWithWeldEjb#ok#");
- }
- finally
- {
- if (url != null)
- undeploy(url.toString());
- }
-
- }
-
- private WebArchive createWebArchive(String name)
- {
- WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "test-weld.war");
- webArchive
- .addResource("org/jboss/test/deployers/as/support/webapp/" + name + ".xhtml", "/" + name + ".xhtml")
- .addResource("org/jboss/test/deployers/as/support/webapp/WEB-INF/web.xml", WEB_XML)
- .addResource("org/jboss/test/deployers/as/support/webapp/WEB-INF/faces-config.xml", FACES_CONFIG);
-
-
-
- getLog().debug(webArchive.toString(true));
-
- return webArchive;
- }
-
- private JavaArchive createWeldArchive(Class<?>...classes)
- {
- JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, "weld.jar")
- .addClasses(classes)
- .addResource("org/jboss/test/deployers/as/support/weld/META-INF/beans.xml", META_BEANS_XML);
-
- getLog().debug(javaArchive.toString(true));
- return javaArchive;
- }
-
- private JavaArchive createMcArchive(String packageFragment, Class<?>...classes)
- {
-
- JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class, "mc.jar")
- .addClasses(classes)
- .addResource("org/jboss/test/deployers/as/support/" + packageFragment + "/META-INF/jboss-beans.xml", JBOSS_BEANS_XML);
-
- getLog().debug(javaArchive.toString(true));
- return javaArchive;
- }
-
- private URL createAndDeployWar(String name, Class<?>...classes) throws Exception
- {
- WebArchive webArchive = createWebArchive(name)
- .addResource("org/jboss/test/deployers/as/support/weld/META-INF/beans.xml", WEB_BEANS_XML)
- .addClasses(classes);
-
- return explodeArchiveAndDeploy(webArchive);
- }
-
- private URL createAndDeployWar(String name, String mcDescriptorPackageFragment, Class<?>...classes) throws Exception
- {
- WebArchive webArchive = createWebArchive(name)
- .addResource("org/jboss/test/deployers/as/support/weld/META-INF/beans.xml", WEB_BEANS_XML)
- .addResource("org/jboss/test/deployers/as/support/" + mcDescriptorPackageFragment + "/META-INF/jboss-beans.xml", JBOSS_BEANS_XML)
- .addClasses(classes);
-
- return explodeArchiveAndDeploy(webArchive);
- }
-
- private URL createAndDeployEar(Archive<?>...archives) throws Exception
- {
- EnterpriseArchive enterpriseArchive = ShrinkWrap.create("simple.ear", EnterpriseArchive.class);
- for (Archive<?> archive : archives)
- enterpriseArchive.add(archive, "/");
-
- return explodeArchiveAndDeploy(enterpriseArchive);
- }
-
- private URL explodeArchiveAndDeploy(Archive<?> archive) throws Exception
- {
- URL url = createExplodedArchive(archive);
-
- getLog().debug(archive.toString(true));
-
- undeploy(url.toString());
- try
- {
- deploy(url.toString());
- }
- catch(Exception e)
- {
- undeploy(url.toString());
- throw(e);
- }
-
- return url;
- }
-
- private void accessWebApp(String urlPath, String...tokens) throws Exception
- {
- HttpMethodBase request = HttpUtils.accessURL(new URL(HttpUtils.getBaseURL() + urlPath));
- String body = request.getResponseBodyAsString();
-
- assertTrue("Body was not transformed to html:\n" + body, body.indexOf("<h:") < 0);
-
- System.out.println(body);
-
-
- for (String token : tokens)
- assertTrue("Could not find '" + token + "' in body:\n" + body, body.indexOf(token) >= 0);
- }
-
- private URL createExplodedArchive(Archive<?> archive) throws Exception
- {
- File file = new File("target/lib");
- if (file.exists())
- deleteFile(file);
- file.mkdir();
- File ear = new File(file, archive.getName());
- if (ear.exists())
- deleteFile(file);
- file = archive.as(ExplodedExporter.class).exportExploded(file);
-
- return file.toURI().toURL();
- }
-
- private void deleteFile(File file)
- {
- if (file.isDirectory())
- {
- for (String name : file.list())
- deleteFile(new File(file, name));
- }
-
- file.delete();
- }
-}
Added: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/McWeldInjectionApplicationServerTestCase.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/McWeldInjectionApplicationServerTestCase.java (rev 0)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/McWeldInjectionApplicationServerTestCase.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -0,0 +1,244 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.as.test;
+
+import java.net.URL;
+
+import org.jboss.test.deployers.as.support.Blue;
+import org.jboss.test.deployers.as.support.Red;
+import org.jboss.test.deployers.as.support.mctoweld.mc.BlueMcBeanNoDependencies;
+import org.jboss.test.deployers.as.support.mctoweld.mc.McBeanNoDependencies;
+import org.jboss.test.deployers.as.support.mctoweld.mc.RedMcBeanNoDependencies;
+import org.jboss.test.deployers.as.support.mctoweld.weld.McToWeldLocalInterface;
+import org.jboss.test.deployers.as.support.mctoweld.weld.WeldWithMcBean;
+import org.jboss.test.deployers.as.support.mctoweld.weld.WeldWithMcEjb;
+import org.jboss.test.deployers.as.support.weldtomctoweld.mc.BlueMcBeanWeldDependencies;
+import org.jboss.test.deployers.as.support.weldtomctoweld.mc.McBeanWeldDependencies;
+import org.jboss.test.deployers.as.support.weldtomctoweld.mc.RedMcBeanWeldDependencies;
+import org.jboss.test.deployers.as.support.weldtomctoweld.weld.BlueWeldMcDependency;
+import org.jboss.test.deployers.as.support.weldtomctoweld.weld.RedWeldMcDependency;
+import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldMcDependency;
+import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldToMcToWeldLocalInterface;
+import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldWithMcWithWeldBean;
+import org.jboss.test.deployers.as.support.weldtomctoweld.weld.WeldWithMcWithWeldEjb;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class McWeldInjectionApplicationServerTestCase extends AbstractWeldInAsTest
+{
+ public McWeldInjectionApplicationServerTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testMcNoDependenciesInjectedIntoWeldBeanWar() throws Throwable
+ {
+ URL url = createAndDeployWar("mcNoDependenciesInjectedIntoWeldBean",
+ "mctoweld/nodependencies",
+ WeldWithMcBean.class,
+ Red.class,
+ Blue.class,
+ McBeanNoDependencies.class,
+ RedMcBeanNoDependencies.class,
+ BlueMcBeanNoDependencies.class);
+
+ try
+ {
+ accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldBean.jsf", "WeldWithMcBean#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testMcNoDependenciesInjectedIntoWeldBeanEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("mcNoDependenciesInjectedIntoWeldBean"),
+ createWeldArchive(WeldWithMcBean.class),
+ createMcArchive("mctoweld/nodependencies", Red.class, Blue.class, McBeanNoDependencies.class, RedMcBeanNoDependencies.class, BlueMcBeanNoDependencies.class));
+
+ try
+ {
+ accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldBean.jsf", "WeldWithMcBean#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testMcNoDependenciesInjectedIntoWeldEjbWar() throws Throwable
+ {
+ URL url = createAndDeployWar("mcNoDependenciesInjectedIntoWeldEjb",
+ "mctoweld/nodependencies",
+ WeldWithMcEjb.class,
+ McToWeldLocalInterface.class,
+ Red.class,
+ Blue.class,
+ McBeanNoDependencies.class,
+ RedMcBeanNoDependencies.class,
+ BlueMcBeanNoDependencies.class);
+
+ try
+ {
+ accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldEjb.jsf", "WeldWithMcEjb#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testMcNoDependenciesInjectedIntoWeldEjbEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("mcNoDependenciesInjectedIntoWeldEjb"),
+ createWeldArchive(WeldWithMcEjb.class, McToWeldLocalInterface.class, Red.class, Blue.class),
+ createMcArchive("mctoweld/nodependencies", McBeanNoDependencies.class, RedMcBeanNoDependencies.class, BlueMcBeanNoDependencies.class));
+
+ try
+ {
+ accessWebApp("test-weld/mcNoDependenciesInjectedIntoWeldEjb.jsf", "WeldWithMcEjb#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testWeldInjectedIntoMcInjectedIntoWeldBeanWar() throws Throwable
+ {
+ URL url = createAndDeployWar("weldInjectedIntoMcInjectedIntoWeldBean",
+ "weldtomctoweld",
+ WeldWithMcWithWeldBean.class,
+ WeldMcDependency.class,
+ RedWeldMcDependency.class,
+ BlueWeldMcDependency.class,
+ Red.class,
+ Blue.class,
+ McBeanWeldDependencies.class,
+ RedMcBeanWeldDependencies.class,
+ BlueMcBeanWeldDependencies.class);
+
+ try
+ {
+ accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldBean.jsf", "WeldWithMcWithWeldBean#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testWeldInjectedIntoMcInjectedIntoWeldBeanEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("weldInjectedIntoMcInjectedIntoWeldBean"),
+ createWeldArchive(WeldWithMcWithWeldBean.class,
+ WeldMcDependency.class,
+ RedWeldMcDependency.class,
+ BlueWeldMcDependency.class),
+ createMcArchive("weldtomctoweld",
+ Red.class,
+ Blue.class,
+ McBeanWeldDependencies.class,
+ RedMcBeanWeldDependencies.class,
+ BlueMcBeanWeldDependencies.class));
+
+ try
+ {
+ accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldBean.jsf", "WeldWithMcWithWeldBean#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+
+ public void testWeldInjectedIntoMcInjectedIntoWeldEjbWar() throws Throwable
+ {
+ URL url = createAndDeployWar("weldInjectedIntoMcInjectedIntoWeldEjb",
+ "weldtomctoweld",
+ WeldWithMcWithWeldEjb.class,
+ WeldToMcToWeldLocalInterface.class,
+ WeldMcDependency.class,
+ RedWeldMcDependency.class,
+ BlueWeldMcDependency.class,
+ Red.class,
+ Blue.class,
+ McBeanWeldDependencies.class,
+ RedMcBeanWeldDependencies.class,
+ BlueMcBeanWeldDependencies.class);
+
+ try
+ {
+ accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldEjb.jsf", "WeldWithMcWithWeldEjb#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+
+ }
+
+ public void testWeldInjectedIntoMcInjectedIntoWeldEjbEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("weldInjectedIntoMcInjectedIntoWeldEjb"),
+ createWeldArchive(WeldWithMcWithWeldEjb.class,
+ WeldToMcToWeldLocalInterface.class,
+ WeldMcDependency.class,
+ RedWeldMcDependency.class,
+ BlueWeldMcDependency.class),
+ createMcArchive("weldtomctoweld",
+ Red.class,
+ Blue.class,
+ McBeanWeldDependencies.class,
+ RedMcBeanWeldDependencies.class,
+ BlueMcBeanWeldDependencies.class));
+
+ try
+ {
+ accessWebApp("test-weld/weldInjectedIntoMcInjectedIntoWeldEjb.jsf", "WeldWithMcWithWeldEjb#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+
+ }
+}
Added: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/SanityApplicationServerTestCase.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/SanityApplicationServerTestCase.java (rev 0)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/as/test/SanityApplicationServerTestCase.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -0,0 +1,193 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.as.test;
+
+import java.net.URL;
+
+import org.jboss.test.deployers.as.support.Blue;
+import org.jboss.test.deployers.as.support.Red;
+import org.jboss.test.deployers.as.support.weld.simple.BlueWeldDependency;
+import org.jboss.test.deployers.as.support.weld.simple.RedWeldDependency;
+import org.jboss.test.deployers.as.support.weld.simple.SimpleLocalInterface;
+import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldBeanNoInjection;
+import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldBeanWeldInjection;
+import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldEjbNoInjection;
+import org.jboss.test.deployers.as.support.weld.simple.SimpleWeldEjbWeldInjection;
+import org.jboss.test.deployers.as.support.weld.simple.WeldDependency;
+
+/**
+ * A few tests to make sure that basic weld is working as expected.
+ * No MC<->Weld injection here.
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SanityApplicationServerTestCase extends AbstractWeldInAsTest
+{
+
+ public SanityApplicationServerTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testSimpleWeldBeanNoInjectionWar() throws Throwable
+ {
+ URL url = createAndDeployWar("simpleWeldBeanNoInjection", SimpleWeldBeanNoInjection.class);
+ try
+ {
+ accessWebApp("test-weld/simpleWeldBeanNoInjection.jsf", "SimpleWeldBeanNoInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testSimpleWeldBeanNoInjectionEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("simpleWeldBeanNoInjection"),
+ createWeldArchive(SimpleWeldBeanNoInjection.class));
+ try
+ {
+ accessWebApp("test-weld/simpleWeldBeanNoInjection.jsf", "SimpleWeldBeanNoInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testSimpleWeldEjbNoInjectionWar() throws Throwable
+ {
+ URL url = createAndDeployWar("simpleWeldEjbNoInjection",
+ SimpleWeldEjbNoInjection.class,
+ SimpleLocalInterface.class);
+ try
+ {
+ accessWebApp("test-weld/simpleWeldEjbNoInjection.jsf", "SimpleWeldEjbNoInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testSimpleWeldEjbNoInjectionEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("simpleWeldEjbNoInjection"),
+ createWeldArchive(SimpleWeldEjbNoInjection.class, SimpleLocalInterface.class));
+ try
+ {
+ accessWebApp("test-weld/simpleWeldEjbNoInjection.jsf", "SimpleWeldEjbNoInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testSimpleWeldBeanWeldInjectionWar() throws Throwable
+ {
+ URL url = createAndDeployWar("simpleWeldBeanWeldInjection",
+ SimpleWeldBeanWeldInjection.class,
+ WeldDependency.class,
+ RedWeldDependency.class,
+ BlueWeldDependency.class,
+ Red.class,
+ Blue.class);
+ try
+ {
+ accessWebApp("test-weld/simpleWeldBeanWeldInjection.jsf", "SimpleWeldBeanWeldInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testSimpleWeldBeanWeldInjectionEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("simpleWeldBeanWeldInjection"),
+ createWeldArchive(SimpleWeldBeanWeldInjection.class, WeldDependency.class, RedWeldDependency.class, BlueWeldDependency.class, Red.class, Blue.class));
+ try
+ {
+ accessWebApp("test-weld/simpleWeldBeanWeldInjection.jsf", "SimpleWeldBeanWeldInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testSimpleWeldEjbWeldInjectionWar() throws Throwable
+ {
+ URL url = createAndDeployWar("simpleWeldEjbWeldInjection",
+ SimpleWeldEjbWeldInjection.class,
+ SimpleLocalInterface.class,
+ WeldDependency.class,
+ RedWeldDependency.class,
+ BlueWeldDependency.class,
+ Red.class,
+ Blue.class);
+ try
+ {
+ accessWebApp("test-weld/simpleWeldEjbWeldInjection.jsf", "SimpleWeldBeanEjbInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+ public void testSimpleWeldEjbWeldInjectionEar() throws Throwable
+ {
+ URL url = createAndDeployEar(
+ createWebArchive("simpleWeldEjbWeldInjection"),
+ createWeldArchive(SimpleWeldEjbWeldInjection.class,
+ SimpleLocalInterface.class,
+ WeldDependency.class,
+ RedWeldDependency.class,
+ BlueWeldDependency.class,
+ Red.class,
+ Blue.class));
+ try
+ {
+ accessWebApp("test-weld/simpleWeldEjbWeldInjection.jsf", "SimpleWeldBeanEjbInjection#ok#");
+ }
+ finally
+ {
+ if (url != null)
+ undeploy(url.toString());
+ }
+ }
+
+}
Modified: trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/test/McIntegrationTestCase.java
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/test/McIntegrationTestCase.java 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/test/java/org/jboss/test/deployers/test/McIntegrationTestCase.java 2010-07-02 10:16:17 UTC (rev 106396)
@@ -22,6 +22,7 @@
package org.jboss.test.deployers.test;
import java.lang.reflect.Method;
+import java.util.Set;
import javax.enterprise.inject.spi.BeanManager;
@@ -30,6 +31,7 @@
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -272,14 +274,100 @@
}
}
- public void testExternalMcBeanInjectedIntoWeld2() throws Exception
+ public void testNonExistantMcBeanInjectedIntoWeldFails() throws Exception
{
+ VirtualFile weldEar = VFS.getChild("weld.ear");
+ createAssembledDirectory(weldEar)
+ .addPath("/weld/mcandweld/ear/weldonly");
+ createWeldLib(weldEar, "/weld/mcandweld/weld", WeldBeanWithInjectedMcBean.class);
+
+ try
+ {
+ testBootstrap(weldEar, null);
+ fail("Weld deployment should not have worked without mc deployment");
+ }
+ catch(Exception expected)
+ {
+ }
+ }
+
+ public void testUndeployedMcBeanInjectedIntoWeldFails() throws Exception
+ {
VirtualFile mcEar = VFS.getChild("mc.ear");
createAssembledDirectory(mcEar)
.addPath("/weld/mcandweld/ear/mconly");
createMcLib(mcEar, "/weld/mcandweld/mc/simple", SimpleBean.class);
Deployment mc = deploy(mcEar);
+ undeploy(mc);
+ VirtualFile weldEar = VFS.getChild("weld.ear");
+ createAssembledDirectory(weldEar)
+ .addPath("/weld/mcandweld/ear/weldonly");
+ createWeldLib(weldEar, "/weld/mcandweld/weld", WeldBeanWithInjectedMcBean.class);
+
+ try
+ {
+ testBootstrap(weldEar, null);
+ fail("Weld deployment should not have worked without mc deployment");
+ }
+ catch(Exception expected)
+ {
+ }
+ }
+
+ public void testExternalMcBeanInjectedIntoWeldInitiallyNotPresentThenDeployed() throws Exception
+ {
+ VirtualFile weldEar = VFS.getChild("weld.ear");
+ createAssembledDirectory(weldEar)
+ .addPath("/weld/mcandweld/ear/weldonly");
+ createWeldLib(weldEar, "/weld/mcandweld/weld", WeldBeanWithInjectedMcBean.class);
+
+ try
+ {
+ testBootstrap(weldEar, null);
+ fail("Weld deployment should not have worked without mc deployment");
+ }
+ catch(Exception expected)
+ {
+ }
+
+ VirtualFile mcEar = VFS.getChild("mc.ear");
+ createAssembledDirectory(mcEar)
+ .addPath("/weld/mcandweld/ear/mconly");
+ createMcLib(mcEar, "/weld/mcandweld/mc/simple", SimpleBean.class);
+ Deployment mc = deploy(mcEar);
+ try
+ {
+ testBootstrap(weldEar, new RunSpecificTest()
+ {
+ public void runTest(BeanManager manager, DeploymentUnit unit) throws Exception
+ {
+ Object mc = getBean("SimpleBean");
+ assertNotNull(mc);
+ Object weldBean = assertWebBean(manager, unit, WeldBeanWithInjectedMcBean.class.getName());
+ assertSame(mc, assertWebBean(manager, unit, mc));
+
+ Method m = weldBean.getClass().getMethod("getSimpleBean");
+ Object injectedBean = m.invoke(weldBean);
+ assertNotNull(injectedBean);
+ assertSame(mc, injectedBean);
+ }
+ });
+ }
+ finally
+ {
+ undeploy(mc);
+ }
+ }
+
+ public void testExternalMcBeanInjectedIntoWeldInitiallyUndeployedThenDeployed() throws Exception
+ {
+ VirtualFile mcEar = VFS.getChild("mc.ear");
+ createAssembledDirectory(mcEar)
+ .addPath("/weld/mcandweld/ear/mconly");
+ createMcLib(mcEar, "/weld/mcandweld/mc/simple", SimpleBean.class);
+ Deployment mc = deploy(mcEar);
+
undeploy(mc);
VirtualFile weldEar = VFS.getChild("weld.ear");
@@ -323,41 +411,24 @@
protected void testBootstrap(VirtualFile ear, RunSpecificTest test) throws Exception
{
+ enableTrace("org.jboss.dependency.plugins.");
Deployment deployment = deploy(ear);
+ DeploymentUnit earDU = null;
try
{
- DeploymentUnit earDU = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
+ earDU = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
//Check that the flat deployment bean has been started
FlatDeployment flatDeployment = (FlatDeployment)getBean(DeployersUtils.getDeploymentBeanName(earDU));
assertNotNull(flatDeployment);
- String bootName = DeployersUtils.getBootstrapBeanName(earDU);
+ //Check the bootstrap bean has been installed
+ assertNotNull(getControllerContext(DeployersUtils.getBootstrapBeanName(earDU)));
- ControllerContext context = getControllerContext(bootName, null);
- outputContext(context);
+ BeanManager manager = getBeanManager(earDU);
- //Check the bootstrap bean has been created
- assertNotNull(getControllerContext(DeployersUtils.getBootstrapBeanName(earDU), ControllerState.CREATE));
-
- // install ejb
- KernelControllerContext ejb = deploy(new AbstractBeanMetaData("EjbContainer#1", Object.class.getName()));
- try
- {
- assertTrue(ejb.getState().equals(ControllerState.INSTALLED));
- //Check the bootstrap bean has been installed
- assertNotNull(getControllerContext(DeployersUtils.getBootstrapBeanName(earDU)));
-
- BeanManager manager = getBeanManager(earDU);
-
- if (test != null)
- test.runTest(manager, earDU);
-
- }
- finally
- {
- undeploy(ejb);
- }
+ if (test != null)
+ test.runTest(manager, earDU);
}
finally
{
Modified: trunk/weld-int/deployer-mc-int/src/test/resources/org/jboss/test/deployers/test/McIntegrationTestCase.xml
===================================================================
--- trunk/weld-int/deployer-mc-int/src/test/resources/org/jboss/test/deployers/test/McIntegrationTestCase.xml 2010-07-02 02:16:59 UTC (rev 106395)
+++ trunk/weld-int/deployer-mc-int/src/test/resources/org/jboss/test/deployers/test/McIntegrationTestCase.xml 2010-07-02 10:16:17 UTC (rev 106396)
@@ -23,9 +23,7 @@
<beanfactory name="JBossJpaServices" class="org.jboss.test.deployers.support.MockJBossJpaServices"/>
- <bean name="EjbServicesDeployer" class="org.jboss.weld.integration.deployer.env.EjbServicesDeployer">
- <property name="ejbServicesClassName">org.jboss.test.deployers.support.MockEjbServices</property>
- </bean>
+ <bean name="EjbServicesDeployer" class="org.jboss.weld.integration.deployer.env.EjbServicesDeployer"/>
<bean name="DeploymentDeployer" class="org.jboss.weld.integration.deployer.env.FlatDeploymentDeployer"/>
@@ -39,8 +37,8 @@
<!-- Mock EJB utils -->
- <beanfactory name="JBossEjbServices" class="org.jboss.test.deployers.support.MockEjbServices"/>
-
+ <beanfactory name="JBossEjbServices" class="org.jboss.weld.integration.ejb.JBossEjbServices"/>
+
<bean name="JBossTransactionServices" class="org.jboss.test.deployers.support.MockTransactionServices"/>
<bean name="RealTransactionManager" class="java.lang.Object"/>
More information about the jboss-cvs-commits
mailing list