[jboss-cvs] JBossAS SVN: r91771 - in projects/webbeans-ri-int/trunk/deployer/src: main/java/org/jboss/webbeans/integration/deployer/env and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 29 11:21:47 EDT 2009


Author: alesj
Date: 2009-07-29 11:21:46 -0400 (Wed, 29 Jul 2009)
New Revision: 91771

Added:
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/AbstractBootstrapInfoDeployer.java
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/AbstractDeploymentDeployer.java
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/BootstrapInfo.java
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/EjbServicesDeployer.java
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeployment.java
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeploymentDeployer.java
   projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java
   projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java
   projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java
   projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java
   projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml
   projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml
   projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarwarinear/
   projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarwarinear/META-INF/
   projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarwarinear/META-INF/application.properties
Removed:
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/JBossDeployment.java
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/env/WebBeansBootstrapDeployer.java
   projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/WebBeansFilesDeployer.java
   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/MockEjbServices.java
   projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java
   projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java
Log:
[WBINT-19]; 2nd try; only porting Flat Deployment.

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-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/assembly/resources/META-INF/webbeans-deployers-jboss-beans.xml	2009-07-29 15:21:46 UTC (rev 91771)
@@ -13,6 +13,12 @@
   <!-- Responsible for discovering Web Bean classes -->
   <bean name="WebBeansDiscoveryDeployer" class="org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryDeployer"/>
 
+  <!-- Responsible for discovering Web Bean classes -->
+  <bean name="EjbServicesDeployer" class="org.jboss.webbeans.integration.deployer.env.EjbServicesDeployer"/>
+
+  <!-- Responsible for discovering Web Bean classes -->
+  <bean name="FlatDeploymentDeployer" class="org.jboss.webbeans.integration.deployer.env.FlatDeploymentDeployer"/>
+
   <!-- Responsible for dynamic ejb dependency creation -->
   <bean name="DynamicDependencyCreator" class="org.jboss.webbeans.integration.deployer.env.DynamicDependencyCreator">
     <constructor>

Added: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/AbstractBootstrapInfoDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/AbstractBootstrapInfoDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/AbstractBootstrapInfoDeployer.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,101 @@
+/*
+ * 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.webbeans.integration.deployer.env;
+
+import java.util.Collection;
+
+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.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractOptionalRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webbeans.integration.deployer.DeployersUtils;
+
+/**
+ * Abstract bootstrap info deployer.
+ * Adding and getting info for Bootstrap bean.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractBootstrapInfoDeployer extends AbstractOptionalRealDeployer<BootstrapInfo>
+{
+   public AbstractBootstrapInfoDeployer(boolean isPassThroughBootstrapInfo)
+   {
+      super(BootstrapInfo.class);
+      setTopLevelOnly(true);
+      setStage(DeploymentStages.PRE_REAL);
+      addInput(DeployersUtils.WEB_BEANS_FILES);
+      if (isPassThroughBootstrapInfo)
+         addOutput(BootstrapInfo.class);
+   }
+
+   public final void deploy(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      boolean doDeploy = (info != null);
+      if (doDeploy == false)
+      {
+         @SuppressWarnings("unchecked")
+         Collection<VirtualFile> wbFiles = unit.getAttachment(DeployersUtils.WEB_BEANS_FILES, Collection.class);
+         doDeploy = (wbFiles != null && wbFiles.isEmpty() == false);
+         if (doDeploy)
+         {
+            // info is null, create one
+            info = new BootstrapInfo();
+            unit.addAttachment(BootstrapInfo.class, info);
+         }
+      }
+      
+      if (doDeploy)
+         deployInternal(unit, info);
+   }
+
+   /**
+    * Do deploy.
+    *
+    * @param unit the deployment unit
+    * @param info non-null bootstrap info
+    * @throws DeploymentException for any error
+    */
+   protected abstract void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException;
+
+   /**
+    * Create service connector.
+    *
+    * @param name the connector name
+    * @param bean the bean to create
+    * @param unit the deployment unit
+    * @return new inject metadata
+    */
+   protected static ValueMetaData createServiceConnector(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/main/java/org/jboss/webbeans/integration/deployer/env/AbstractDeploymentDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/AbstractDeploymentDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/AbstractDeploymentDeployer.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,77 @@
+/*
+ * 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.webbeans.integration.deployer.env;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Abstract Deployment Deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractDeploymentDeployer extends AbstractBootstrapInfoDeployer
+{
+   public AbstractDeploymentDeployer()
+   {
+      super(true);
+      addInput(BootstrapInfo.EJB_SERVICES);
+      addOutput(BootstrapInfo.DEPLOYMENT);
+      addOutput(BeanMetaData.class);
+   }
+
+   public void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      if (info.getEjbServices() == null)
+         throw new DeploymentException("Missing ejb services value: " + unit);
+
+      if (isRelevant(unit) == false)
+         return;
+
+      String unitName = unit.getName();
+      String deploymentName = unitName + "_JBossDeployment";
+
+      BeanMetaData deploymentBMD = deploy(unit, info, deploymentName);
+      unit.addAttachment(deploymentName, deploymentBMD, BeanMetaData.class);
+   }
+
+   /**
+    * Is this deployer relevant.
+    *
+    * @param unit the deployment unit
+    * @return true if relevant, false otherwise
+    */
+   protected boolean isRelevant(DeploymentUnit unit)
+   {
+      return true;
+   }
+
+   /**
+    * Deploy.
+    *
+    * @param unit the deployment unit
+    * @param info the bootstrap info
+    * @param deploymentName the deployment name
+    * @return deployment's bean metadata
+    */
+   protected abstract BeanMetaData deploy(DeploymentUnit unit, BootstrapInfo info, String deploymentName);}
\ No newline at end of file

Added: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/BootstrapInfo.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/BootstrapInfo.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/BootstrapInfo.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.integration.deployer.env;
+
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * Simple bootstrap info class, used as attachment key.
+ * Holds inject values for deployment and various services.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class BootstrapInfo
+{
+   private ValueMetaData ejbServices;
+   public static final String EJB_SERVICES = BootstrapInfo.class.getSimpleName() + "EJB_SERVICES";
+
+   private ValueMetaData deployment;
+   public static final String DEPLOYMENT = BootstrapInfo.class.getSimpleName() + "DEPLOYMENT";
+
+   public ValueMetaData getDeployment()
+   {
+      return deployment;
+   }
+
+   public void setDeployment(ValueMetaData deployment)
+   {
+      this.deployment = deployment;
+   }
+
+   public ValueMetaData getEjbServices()
+   {
+      return ejbServices;
+   }
+
+   public void setEjbServices(ValueMetaData ejbServices)
+   {
+      this.ejbServices = ejbServices;
+   }
+}
\ No newline at end of file

Added: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/EjbServicesDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/EjbServicesDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/EjbServicesDeployer.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,59 @@
+/*
+ * 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.webbeans.integration.deployer.env;
+
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * EjbServices Deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class EjbServicesDeployer extends AbstractBootstrapInfoDeployer
+{
+   /** The ejb services class name */
+   private String ejbServicesClassName = "org.jboss.webbeans.integration.ejb.JBossEjbServices";
+
+   public EjbServicesDeployer()
+   {
+      super(true);
+      addOutput(BootstrapInfo.EJB_SERVICES);
+   }
+
+   public void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
+   {
+      ValueMetaData ejbServicesValue = createServiceConnector("JBossEjbServices", ejbServicesClassName, unit);
+      info.setEjbServices(ejbServicesValue);
+   }
+
+   /**
+    * Set ejb services class name.
+    *
+    * @param ejbServicesClassName the ejb services classname
+    */
+   public void setEjbServicesClassName(String ejbServicesClassName)
+   {
+      this.ejbServicesClassName = ejbServicesClassName;
+   }
+}

Copied: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeployment.java (from rev 91761, projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/JBossDeployment.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeployment.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeployment.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.integration.deployer.env;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+
+/**
+ * Initial (naive) implementation of Deployment for JBoss AS.
+ *
+ * This version simply flattens the entire deployment into a single
+ * BeanDeploymentArchive
+ *
+ * @author pmuir
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FlatDeployment implements Deployment
+{
+   private final BeanDeploymentArchive beanDeploymentArchive;
+   private final List<BeanDeploymentArchive> beanDeploymentArchives;
+
+   public FlatDeployment(WebBeanDiscoveryEnvironment environment, Iterable<EjbDescriptor<?>> ejbDescriptors)
+   {
+      this.beanDeploymentArchive = new JBossBeanDeploymentArchive(environment, ejbDescriptors);
+      this.beanDeploymentArchives = Collections.singletonList(beanDeploymentArchive);
+   }
+
+   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return beanDeploymentArchives;
+   }
+
+   public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+   {
+      return beanDeploymentArchive;
+   }
+}
\ No newline at end of file

Added: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeploymentDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeploymentDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/FlatDeploymentDeployer.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,55 @@
+/*
+ * 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.webbeans.integration.deployer.env;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * Flat Deployment Deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FlatDeploymentDeployer extends AbstractDeploymentDeployer
+{
+   public FlatDeploymentDeployer()
+   {
+      super();
+      addInput(WebBeanDiscoveryEnvironment.class);
+   }
+
+   @Override
+   protected boolean isRelevant(DeploymentUnit unit)
+   {
+      return unit.isAttachmentPresent(WebBeanDiscoveryEnvironment.class);
+   }
+
+   protected BeanMetaData deploy(DeploymentUnit unit, BootstrapInfo info, String deploymentName)
+   {
+      WebBeanDiscoveryEnvironment env = unit.getAttachment(WebBeanDiscoveryEnvironment.class);
+      BeanMetaDataBuilder deploymentWrapper = BeanMetaDataBuilder.createBuilder(deploymentName, FlatDeployment.class.getName());
+      deploymentWrapper.addConstructorParameter(WebBeanDiscoveryEnvironment.class.getName(), env);
+      deploymentWrapper.addConstructorParameter(Iterable.class.getName(), deploymentWrapper.createInject(info.getEjbServices().getUnderlyingValue(), "ejbs"));
+      return deploymentWrapper.getBeanMetaData();
+   }
+}
\ No newline at end of file

Deleted: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/JBossDeployment.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/JBossDeployment.java	2009-07-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/JBossDeployment.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.integration.deployer.env;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-
-/**
- * Initial (naive) implementation of Deployment for JBoss AS.
- * 
- * This version simply flattens the entire deployment into a single
- * BeanDeploymentArchive
- * 
- * @author pmuir
- * 
- */
-public class JBossDeployment implements Deployment
-{
-
-   private final BeanDeploymentArchive beanDeploymentArchive;
-   private final List<BeanDeploymentArchive> beanDeploymentArchives;
-   
-   public JBossDeployment(WebBeanDiscoveryEnvironment environment, Iterable<EjbDescriptor<?>> ejbDescriptors)
-   {
-      this.beanDeploymentArchive = new JBossBeanDeploymentArchive(environment, ejbDescriptors);
-      this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>();
-      this.beanDeploymentArchives.add(beanDeploymentArchive);
-   }
-   
-   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
-   {
-      return beanDeploymentArchives;
-   }
-
-   public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
-   {
-      return beanDeploymentArchive;
-   }
-
-}

Modified: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/WebBeansBootstrapDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/WebBeansBootstrapDeployer.java	2009-07-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/env/WebBeansBootstrapDeployer.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -27,8 +27,6 @@
 import org.jboss.beans.metadata.spi.builder.ParameterMetaDataBuilder;
 import org.jboss.dependency.spi.ControllerState;
 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.bootstrap.api.Bootstrap;
 import org.jboss.webbeans.bootstrap.api.Environments;
@@ -41,38 +39,33 @@
  *
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
-public class WebBeansBootstrapDeployer extends AbstractSimpleRealDeployer<WebBeanDiscoveryEnvironment>
+public class WebBeansBootstrapDeployer extends AbstractBootstrapInfoDeployer
 {
    public WebBeansBootstrapDeployer()
    {
-      super(WebBeanDiscoveryEnvironment.class);
-      setTopLevelOnly(true);
-      setStage(DeploymentStages.PRE_REAL);
+      super(false);
+      setDisableOptional(true);
       addOutput(BeanMetaData.class);
    }
 
-   @Override
-   public void deploy(DeploymentUnit unit, WebBeanDiscoveryEnvironment env) throws DeploymentException
+   protected void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException
    {
-      String unitName = unit.getName();
-      String envName = unitName + "_JBossDeployment";
-      
-      ValueMetaData ejbServicesValue = createEjbConnector("JBossEjbServices", "org.jboss.webbeans.integration.ejb.JBossEjbServices", unit);
-      
+      ValueMetaData ejbServicesValue = info.getEjbServices();
+      if (ejbServicesValue == null)
+         throw new DeploymentException("Missing ejb services: " + unit);
+
+      ValueMetaData deploymentValue = info.getDeployment();
+      if (deploymentValue == null)
+         throw new DeploymentException("Missing deployment: " + unit);
+
       String bootstrapName = DeployersUtils.getBootstrapBeanName(unit);
       BeanMetaDataBuilder bootstrap = BeanMetaDataBuilder.createBuilder(bootstrapName, "org.jboss.webbeans.bootstrap.api.helpers.BootstrapBean");
       
-      BeanMetaDataBuilder envWrapper = BeanMetaDataBuilder.createBuilder(envName, "org.jboss.webbeans.integration.deployer.env.JBossDeployment");
-      envWrapper.addConstructorParameter(WebBeanDiscoveryEnvironment.class.getName(), env);
-      envWrapper.addConstructorParameter(Iterable.class.getName(), bootstrap.createInject(ejbServicesValue.getUnderlyingValue(), "ejbs"));
-      unit.addAttachment(envName + "_" + BeanMetaData.class.getSimpleName(), envWrapper.getBeanMetaData());
-
-      
       bootstrap.addConstructorParameter(Bootstrap.class.getName(), createBootstrap(unit));
-      bootstrap.addPropertyMetaData("deployment", bootstrap.createInject(envName));
+      bootstrap.addPropertyMetaData("deployment", deploymentValue);
       
       bootstrap.addPropertyMetaData("ejbServices", ejbServicesValue);
-      bootstrap.addPropertyMetaData("jpaServices", createEjbConnector("JBossJpaServices", "org.jboss.webbeans.integration.persistence.JBossJpaServices", unit));
+      bootstrap.addPropertyMetaData("jpaServices", createServiceConnector("JBossJpaServices", "org.jboss.webbeans.integration.persistence.JBossJpaServices", unit));
       bootstrap.addPropertyMetaData("resourceServices", bootstrap.createInject("JBossResourceServices"));
       bootstrap.addPropertyMetaData("webServices", bootstrap.createInject("JBossWebServices"));
       bootstrap.addPropertyMetaData("jmsServices", bootstrap.createInject("JBossJmsServices"));
@@ -105,25 +98,6 @@
    }
 
    /**
-    * 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);
-   }
-
-   /**
     * Create bootstrap bean.
     *
     * @param unit the deployment unit

Modified: projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/WebBeansFilesDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/WebBeansFilesDeployer.java	2009-07-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/main/java/org/jboss/webbeans/integration/deployer/metadata/WebBeansFilesDeployer.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -95,7 +95,6 @@
       {
          throw DeploymentException.rethrowAsDeploymentException("Cannot WBD files/classpath.", e);
       }
-
    }
 
    /**

Modified: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java	2009-07-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/VFSTestSuite.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -25,9 +25,11 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 import org.jboss.test.deployers.test.BootDeployerTestCase;
+import org.jboss.test.deployers.test.CLIsolationTestCase;
+import org.jboss.test.deployers.test.FlatDeploymentTestCase;
+import org.jboss.test.deployers.test.SmokeTestCase;
+import org.jboss.test.deployers.test.WBDiscoveryEnvTestCase;
 import org.jboss.test.deployers.test.PostDeployersTestCase;
-import org.jboss.test.deployers.test.WBDiscoveryEnvTestCase;
-import org.jboss.test.deployers.test.CLIsolationTestCase;
 
 /**
  * VFS deployers tests.
@@ -45,11 +47,20 @@
    {
       TestSuite suite = new TestSuite("Deployers WebBeans Tests");
 
-      suite.addTest(WBDiscoveryEnvTestCase.suite());
+      // Smoke
+      suite.addTest(SmokeTestCase.suite());
+
+      // Post metadata modification
       suite.addTest(PostDeployersTestCase.suite());
-      suite.addTest(BootDeployerTestCase.suite());
       suite.addTest(CLIsolationTestCase.suite());
 
+      // Bootstrap creation
+      suite.addTest(WBDiscoveryEnvTestCase.suite());
+      suite.addTest(FlatDeploymentTestCase.suite());
+
+      // Bootstrap bean
+      suite.addTest(BootDeployerTestCase.suite());
+
       return suite;
    }
 }

Modified: 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	2009-07-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/MockEjbServices.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -38,7 +38,7 @@
    public void setDeploymentUnit(DeploymentUnit unit)
    {
    }
-   
+
    public Object resolveEjb(InjectionPoint injectionPoint)
    {
       return null;
@@ -53,7 +53,7 @@
    {
       return null;
    }
-   
+
    public void removeEjb(Object instance)
    {
    }
@@ -62,17 +62,17 @@
    {
       return null;
    }
-   
-   public Iterable<EjbDescriptor<?>> discoverEjbs()
+
+   public Iterable<EjbDescriptor<?>> getEjbs()
    {
       return Collections.emptySet();
    }
 
-   public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink) 
+   public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink)
    {
       return null;
    }
-   
+
    public Iterable<String> getEjbContainerNames()
    {
 	   return Collections.singleton("EjbContainer#1");

Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java (from rev 91761, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockWarClassLoaderDeployer.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/support/deployer/MockUrlIntegrationDeployer.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.deployers.support.deployer;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.webbeans.integration.deployer.cl.WebBeansUrlIntegrationDeployer;
+import org.jboss.webbeans.integration.deployer.ext.JBossWebBeansMetaData;
+
+/**
+ * Mock war classloader deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockUrlIntegrationDeployer extends WebBeansUrlIntegrationDeployer<JBossWebBeansMetaData>
+{
+   public MockUrlIntegrationDeployer()
+   {
+      super(JBossWebBeansMetaData.class);
+   }
+
+   protected String getShortLibName()
+   {
+      return "<ignore>";
+   }
+
+   @Override
+   protected Set<URL> getURLs()
+   {
+      try
+      {
+         URL url = getClass().getProtectionDomain().getCodeSource().getLocation();
+         return Collections.singleton(url);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}
\ No newline at end of file

Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractDeploymentTest.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,158 @@
+/*
+ * 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.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.deployers.support.MockEjbServices;
+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.AssembledDirectory;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+
+/**
+ * Abstract Deployment test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractDeploymentTest extends AbstractWebBeansTest
+{
+   protected AbstractDeploymentTest(String name)
+   {
+      super(name);
+   }
+
+   protected void getArchives(List<BeanDeploymentArchive> result, List<BeanDeploymentArchive> archives)
+   {
+      for (BeanDeploymentArchive bda : archives)
+      {
+         result.add(bda);
+         getArchives(result, bda.getBeanDeploymentArchives());
+      }
+   }
+
+   protected abstract int getExpectedArchives();
+
+   public void testSimpleUsage() throws Exception
+   {
+      AssembledDirectory ear = createBasicEar(MockEjbServices.class);
+      VFSDeploymentUnit topUnit = assertDeploy(ear);
+      try
+      {
+         Object bean = getBean(Deployment.class);
+         Deployment deployment = assertInstanceOf(bean, Deployment.class, false);
+
+         List<BeanDeploymentArchive> archives = new ArrayList<BeanDeploymentArchive>();
+         getArchives(archives, deployment.getBeanDeploymentArchives());
+         assertEquals(getExpectedArchives(), archives.size());
+
+         List<URL> urls = new ArrayList<URL>();
+         List<Class<?>> classes = new ArrayList<Class<?>>();
+         for (BeanDeploymentArchive bad : archives)
+         {
+            for (URL url : bad.getBeansXml())
+               urls.add(url);
+            for (Class<?> clazz : bad.getBeanClasses())
+               classes.add(clazz);
+         }
+
+         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");
+
+         assertEquals("Illegal size or urls.", urls.size(), expected.size());
+
+         for (URL url : urls)
+         {
+            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);
+         }
+
+         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);
+
+         assertEquals("Illegal size or classes.", classes.size(), expected.size());
+
+         for (Class<?> clazz : classes)
+            assertTrue(expected.remove(clazz.getName()));
+
+         assertEmpty("Should be emtpy, missing " + expected, expected);
+
+         Class<?> newBeanClass = topUnit.getClassLoader().loadClass("org.jboss.test.deployers.support.MockTransactionServices");
+         BeanDeploymentArchive newBDA = deployment.loadBeanDeploymentArchive(newBeanClass);
+         assertNewBeanDeploymentArchive(archives, newBDA);
+      }
+      finally
+      {
+         undeploy(topUnit);
+      }
+   }
+
+   protected abstract void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA);
+
+   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());
+   }
+}
\ No newline at end of file

Modified: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java	2009-07-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/AbstractWebBeansTest.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -73,8 +73,13 @@
 
    protected AssembledDirectory createBasicEar() throws Exception
    {
-      AssembledDirectory ear = createTopLevelWithUtil();
+      return createBasicEar(SomeUtil.class);
+   }
 
+   protected AssembledDirectory createBasicEar(Class<?> utilClass) throws Exception
+   {
+      AssembledDirectory ear = createTopLevelWithUtil(utilClass);
+
       AssembledDirectory jar = ear.mkdir("simple.jar");
       addPackage(jar, PlainJavaBean.class);
       addPath(jar, "/webbeans/simple/jar", "META-INF");
@@ -115,18 +120,28 @@
 
    protected AssembledDirectory createTopLevelWithUtil() throws Exception
    {
-      return createTopLevelWithUtil("/webbeans/simple");   
+      return createTopLevelWithUtil("/webbeans/simple");
    }
 
+   protected AssembledDirectory createTopLevelWithUtil(Class<?> utilClass) throws Exception
+   {
+      return createTopLevelWithUtil("/webbeans/simple", utilClass);
+   }
+
    protected AssembledDirectory createTopLevelWithUtil(String path) throws Exception
    {
+      return createTopLevelWithUtil(path, SomeUtil.class);
+   }
+
+   protected AssembledDirectory createTopLevelWithUtil(String path, Class<?> utilClass) throws Exception
+   {
       AssembledDirectory topLevel = createAssembledDirectory("top-level.ear", "top-level.ear");
       addPath(topLevel, path, "META-INF");
 
       AssembledDirectory earLib = topLevel.mkdir("lib");
 
       AssembledDirectory util = earLib.mkdir("util.jar");
-      addPackage(util, SomeUtil.class);
+      addPackage(util, utilClass);
 
       AssembledDirectory ext = earLib.mkdir("ext.jar");
       addPackage(ext, ExternalWebBean.class);

Modified: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java	2009-07-29 15:18:59 UTC (rev 91770)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -85,7 +85,6 @@
          mainDeployer.removeDeployment(deployment1);
          mainDeployer.process();
       }
-
    }
 
    public void testTwoEars() throws Exception

Added: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/FlatDeploymentTestCase.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,55 @@
+/*
+ * 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.webbeans.bootstrap.spi.BeanDeploymentArchive;
+
+/**
+ * Flat Deployment test case.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class FlatDeploymentTestCase extends AbstractDeploymentTest
+{
+   public FlatDeploymentTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(FlatDeploymentTestCase.class);
+   }
+
+   protected int getExpectedArchives()
+   {
+      return 1; // flat only
+   }
+
+   protected void assertNewBeanDeploymentArchive(List<BeanDeploymentArchive> archives, BeanDeploymentArchive newBDA)
+   {
+      assertSame(newBDA, archives.iterator().next());
+   }
+}
\ No newline at end of file

Copied: projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java (from rev 91761, projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/CLIsolationTestCase.java)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/java/org/jboss/test/deployers/test/SmokeTestCase.java	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,112 @@
+/*
+ * 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.dependency.spi.ControllerContext;
+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.test.deployers.support.jar.PlainJavaBean;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.webbeans.integration.deployer.DeployersUtils;
+
+/**
+ * Smoke tests.
+ * Test non WB deployments work OK.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SmokeTestCase extends AbstractWebBeansTest
+{
+   public SmokeTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(SmokeTestCase.class);
+   }
+
+   protected void testDeployment(VirtualFile app) throws Exception
+   {
+      Deployment deployment = createVFSDeployment(app);
+
+      DeployerClient mainDeployer = getDeployerClient();
+      mainDeployer.addDeployment(deployment);
+      mainDeployer.process();
+      try
+      {
+         DeploymentUnit du = getMainDeployerStructure().getDeploymentUnit(deployment.getName());
+         ControllerContext context = du.getAttachment(ControllerContext.class);
+         assertNotNull(context);
+         assertEquals(ControllerState.INSTALLED, context.getState());
+
+         // There should be no WB bootstrap bean
+         assertNoBean(DeployersUtils.getBootstrapBeanName(du), null);
+      }
+      finally
+      {
+         mainDeployer.removeDeployment(deployment);
+         mainDeployer.process();
+      }
+   }
+
+   public void testEar() throws Exception
+   {
+      AssembledDirectory ear = createAssembledDirectory("jar-in-ear.ear", "jar-in-ear.ear");
+      addPath(ear, "/webbeans/jarwarinear", "META-INF");
+
+      AssembledDirectory jar = ear.mkdir("simple.jar");
+      addPackage(jar, PlainJavaBean.class);
+
+      AssembledDirectory war = ear.mkdir("simple.war");
+      AssembledDirectory webinf = war.mkdir("WEB-INF");
+      AssembledDirectory classes = webinf.mkdir("classes");
+      addPackage(classes, PlainJavaBean.class);
+      addPath(war, "/webbeans/warwowb/web", "WEB-INF");
+
+      testDeployment(ear);
+   }
+
+   public void testWar() throws Exception
+   {
+      AssembledDirectory war = createAssembledDirectory("w1.war", "w1.war");
+      AssembledDirectory webinf = war.mkdir("WEB-INF");
+      AssembledDirectory classes = webinf.mkdir("classes");
+      addPackage(classes, PlainJavaBean.class);
+      addPath(war, "/webbeans/warwowb/web", "WEB-INF");
+
+      testDeployment(war);
+   }
+
+   public void testJar() throws Exception
+   {
+      AssembledDirectory jar = createAssembledDirectory("j1.jar", "j1.jar");
+      addPackage(jar, PlainJavaBean.class);
+
+      testDeployment(jar);
+   }
+}
\ No newline at end of file

Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml (from rev 91761, 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/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/FlatDeploymentTestCase.xml	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,17 @@
+<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"/>
+
+  <beanfactory name="JBossEjbServices" class="org.jboss.test.deployers.support.MockEjbServices"/>
+
+  <bean name="EjbServicesDeployer" class="org.jboss.webbeans.integration.deployer.env.EjbServicesDeployer">
+    <property name="ejbServicesClassName">org.jboss.test.deployers.support.MockEjbServices</property>
+  </bean>
+
+  <bean name="DeploymentDeployer" class="org.jboss.webbeans.integration.deployer.env.FlatDeploymentDeployer"/>
+</deployment>

Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml (from rev 91761, projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/CLIsolationTestCase.xml)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/org/jboss/test/deployers/test/SmokeTestCase.xml	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,58 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- Structure mocks -->
+
+  <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"/>
+
+  <!-- Mock metadata deployer -->
+
+  <bean name="JBAppMDDeployer" class="org.jboss.test.deployers.support.deployer.MockJBossAppDeployer"/>
+  <bean name="JBWMDDeployer" class="org.jboss.test.deployers.support.deployer.MockWebDeployer"/>
+  <bean name="EjbJarDeployer" class="org.jboss.test.deployers.support.deployer.MockEjbJarDeployer"/>
+  <bean name="EjbMergeDeployer" class="org.jboss.test.deployers.support.deployer.MockCopyJBossDeployer"/>
+  <bean name="WarCLDeployer" class="org.jboss.test.deployers.support.deployer.MockWarClassLoaderDeployer"/>
+
+  <!-- Web Beans deployers -->
+
+  <!-- Responsible for discovering Web Bean files -->
+  <bean name="WebBeansFilesDeployer" class="org.jboss.webbeans.integration.deployer.metadata.WebBeansFilesDeployer"/>
+
+  <!-- Responsible for discovering Web Bean classes -->
+  <bean name="WebBeansDiscoveryDeployer" class="org.jboss.webbeans.integration.deployer.env.WebBeanDiscoveryDeployer"/>
+
+  <!-- Responsible for discovering Web Bean classes -->
+  <bean name="EjbServicesDeployer" class="org.jboss.webbeans.integration.deployer.env.EjbServicesDeployer"/>
+
+  <!-- Responsible for discovering Web Bean classes -->
+  <bean name="FlatDeploymentDeployer" class="org.jboss.webbeans.integration.deployer.env.FlatDeploymentDeployer"/>
+
+  <!-- Responsible for dynamic ejb dependency creation -->
+  <bean name="DynamicDependencyCreator" class="org.jboss.webbeans.integration.deployer.env.DynamicDependencyCreator">
+    <constructor>
+      <parameter><inject bean="jboss.kernel:service=KernelController"/></parameter>
+    </constructor>
+  </bean>
+
+  <!-- Responsible for booting Web Beans -->
+  <bean name="WebBeansBootstrapDeployer" class="org.jboss.webbeans.integration.deployer.env.WebBeansBootstrapDeployer"/>
+
+  <!-- Missing real URL integration tests-->
+
+  <bean name="MockUrlIntegrationDeployer" class="org.jboss.test.deployers.support.deployer.MockUrlIntegrationDeployer"/>
+
+  <!-- Responsible for inserting the Web Beans RI EJB interceptor -->
+  <bean name="PostEjbJarMetadataDeployer" class="org.jboss.webbeans.integration.deployer.metadata.WBEjbInterceptorMetadataDeployer"/>
+
+  <!-- Responsible for enabling classloader isolation for Web Bean jars -->
+  <bean name="PostJBossMetadataDeployer" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossMetadataDeployer"/>
+
+  <!-- Responsible for enabling classloader isolation for Web Bean wars -->
+  <bean name="PostJBossWebMetadataDeployer" class="org.jboss.webbeans.integration.deployer.metadata.PostJBossWebMetadataDeployer"/>
+
+  <!-- Responsible for adding the Web Beans RI listener to the Servlet -->
+  <bean name="PostWebMetadataDeployer" class="org.jboss.webbeans.integration.deployer.metadata.PostWebMetadataDeployer"/>
+
+  <!-- Removed WebBeansJndiBinder -->
+
+</deployment>

Copied: projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarwarinear/META-INF/application.properties (from rev 91761, projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/earwithutil/META-INF/application.properties)
===================================================================
--- projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarwarinear/META-INF/application.properties	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/deployer/src/test/resources/webbeans/jarwarinear/META-INF/application.properties	2009-07-29 15:21:46 UTC (rev 91771)
@@ -0,0 +1,2 @@
+jar-moduel=simple.jar
+web-module=simple.war




More information about the jboss-cvs-commits mailing list