[webbeans-commits] Webbeans SVN: r2936 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bootstrap and 10 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Jun 30 14:27:59 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-06-30 14:27:59 -0400 (Tue, 30 Jun 2009)
New Revision: 2936

Added:
   ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbModule.java
Removed:
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
   ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
   ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java
Log:
switch to using Deployment

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -173,16 +173,27 @@
     * Application scoped data structures 
     * ***********************************
     */
+   
+   private transient final ConcurrentListMultiMap<Class<? extends Annotation>, Context> contexts;
+   private transient final ClientProxyProvider clientProxyProvider;
+   private final transient AtomicInteger ids;
+   private transient final Map<String, RIBean<?>> riBeans;
+   private transient final Map<Class<?>, EnterpriseBean<?>> newEnterpriseBeans;
+   
+   /*
+    * Archive scoped services
+    * *********************** 
+    */
+   
+   /*
+    * Archive scoped data structures
+    * ******************************
+    */
    private transient List<Class<? extends Annotation>> enabledDeploymentTypes;
    private transient List<Class<?>> enabledDecoratorClasses;
    private transient List<Class<?>> enabledInterceptorClasses;
-   private transient final ConcurrentListMultiMap<Class<? extends Annotation>, Context> contexts;
    private final transient Set<CurrentActivity> currentActivities;
-   private transient final ClientProxyProvider clientProxyProvider;
-   private transient final Map<Class<?>, EnterpriseBean<?>> newEnterpriseBeans;
-   private transient final Map<String, RIBean<?>> riBeans;
    private final transient Map<Contextual<?>, Contextual<?>> specializedBeans;
-   private final transient AtomicInteger ids;
 
    /*
     * Activity scoped services 
@@ -251,8 +262,10 @@
 
       return new BeanManagerImpl(
             parentManager.getServices(), 
-            beans, parentManager.getDecorators(), 
-            registeredObservers, rootNamespace, 
+            beans, 
+            parentManager.getDecorators(), 
+            registeredObservers, 
+            rootNamespace, 
             parentManager.getNewEnterpriseBeanMap(), 
             parentManager.getRiBeans(), 
             parentManager.getClientProxyProvider(), 

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -16,6 +16,10 @@
  */
 package org.jboss.webbeans.bootstrap;
 
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
 import javax.enterprise.inject.spi.BeforeShutdown;
 import javax.enterprise.inject.spi.Extension;
 
@@ -32,7 +36,8 @@
 import org.jboss.webbeans.bootstrap.api.Environments;
 import org.jboss.webbeans.bootstrap.api.helpers.AbstractBootstrap;
 import org.jboss.webbeans.bootstrap.api.helpers.ServiceRegistries;
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
 import org.jboss.webbeans.context.ApplicationContext;
 import org.jboss.webbeans.context.ContextLifecycle;
 import org.jboss.webbeans.context.ConversationContext;
@@ -47,6 +52,8 @@
 import org.jboss.webbeans.conversation.ServletConversationManager;
 import org.jboss.webbeans.ejb.EJBApiAbstraction;
 import org.jboss.webbeans.ejb.EjbDescriptorCache;
+import org.jboss.webbeans.ejb.spi.EJBModule;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.jsf.JsfApiAbstraction;
 import org.jboss.webbeans.log.Log;
@@ -75,6 +82,73 @@
  */
 public class WebBeansBootstrap extends AbstractBootstrap implements Bootstrap
 {
+   
+   // Temporary workaround for reading from a Deployment
+   private static class DeploymentVisitor
+   {
+      
+      private final Collection<Class<?>> beanClasses;
+      private final Collection<URL> beansXmlUrls;
+      private final Collection<EjbDescriptor<?>> ejbDescriptors;
+      private final Deployment deployment;
+      
+      public DeploymentVisitor(Deployment deployment)
+      {
+         this.deployment = deployment;
+         this.beanClasses = new ArrayList<Class<?>>();
+         this.beansXmlUrls = new ArrayList<URL>();
+         this.ejbDescriptors = new ArrayList<EjbDescriptor<?>>();
+      }
+      
+      public DeploymentVisitor visit()
+      {
+         for (BeanDeploymentArchive archvive : deployment.getBeanDeploymentArchives())
+         {
+            visit(archvive);
+         }
+         return this;
+      }
+      
+      private void visit(BeanDeploymentArchive beanDeploymentArchive)
+      {
+         for (Class<?> clazz : beanDeploymentArchive.getBeanClasses())
+         {
+            beanClasses.add(clazz);
+         }
+         for (URL url : beanDeploymentArchive.getBeansXml())
+         {
+            beansXmlUrls.add(url);
+         }
+         if (beanDeploymentArchive instanceof EJBModule)
+         {
+            EJBModule ejbModule = (EJBModule) beanDeploymentArchive;
+            for (EjbDescriptor<?> ejbDescriptor : ejbModule.getEjbs())
+            {
+               ejbDescriptors.add(ejbDescriptor);
+            }
+         }
+         for (BeanDeploymentArchive archive : beanDeploymentArchive.getBeanDeploymentArchives())
+         {
+            visit(archive);
+         }
+      }
+      
+      public Iterable<Class<?>> getBeanClasses()
+      {
+         return beanClasses;
+      }
+      
+      public Iterable<URL> getBeansXmlUrls()
+      {
+         return beansXmlUrls;
+      }
+      
+      public Iterable<EjbDescriptor<?>> getEjbDescriptors()
+      {
+         return ejbDescriptors;
+      }
+      
+   }
   
    // The log provider
    private static Log log = Logging.getLog(WebBeansBootstrap.class);
@@ -171,11 +245,6 @@
       beanDeployer.createBeans().deploy();
    }
    
-   private void registerExtensionBeans(Iterable<Extension> instances, AbstractBeanDeployer beanDeployer)
-   {
-      
-   }
-   
    public void boot()
    {
       synchronized (this)
@@ -189,8 +258,10 @@
             throw new IllegalStateException("No application context BeanStore set");
          }
          
-         parseBeansXml();
+         DeploymentVisitor deploymentVisitor = new DeploymentVisitor(getServices().get(Deployment.class)).visit();
          
+         parseBeansXml(deploymentVisitor.getBeansXmlUrls());
+         
          beginApplication(getApplicationContext());
          BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
          beginDeploy(requestBeanStore);
@@ -200,7 +271,7 @@
          {
             // Must populate EJB cache first, as we need it to detect whether a
             // bean is an EJB!
-            ejbDescriptors.addAll(getServices().get(EjbServices.class).discoverEjbs());
+            ejbDescriptors.addAll(deploymentVisitor.getEjbDescriptors());
          }
          
          // TODO Should use a separate event manager for sending bootstrap events
@@ -211,7 +282,7 @@
          BeanDeployer beanDeployer = new BeanDeployer(manager, ejbDescriptors);
          
          fireBeforeBeanDiscoveryEvent(beanDeployer);
-         registerBeans(getServices().get(WebBeanDiscovery.class).discoverWebBeanClasses(), beanDeployer);
+         registerBeans(deploymentVisitor.getBeanClasses(), beanDeployer);
          fireAfterBeanDiscoveryEvent();
          log.debug("Web Beans initialized. Validating beans.");
          getServices().get(Validator.class).validateDeployment(manager, beanDeployer.getBeanDeployerEnvironment());
@@ -222,9 +293,9 @@
       }
    }
    
-   private void parseBeansXml()
+   private void parseBeansXml(Iterable<URL> urls)
    {
-      BeansXmlParser parser = new BeansXmlParser(getServices().get(ResourceLoader.class), getServices().get(WebBeanDiscovery.class).discoverWebBeansXml());
+      BeansXmlParser parser = new BeansXmlParser(getServices().get(ResourceLoader.class), urls);
       parser.parse();
       
       if (parser.getEnabledDeploymentTypes() != null)

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -20,7 +20,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.messaging.spi.JmsServices;
 import org.jboss.webbeans.persistence.spi.JpaServices;
@@ -41,22 +41,22 @@
    /**
     * Java EE5 or Java EE6
     */
-   EE(WebBeanDiscovery.class, EjbServices.class, JpaServices.class, WebServices.class, JmsServices.class, ResourceServices.class, TransactionServices.class, ResourceLoader.class),
+   EE(Deployment.class, EjbServices.class, JpaServices.class, WebServices.class, JmsServices.class, ResourceServices.class, TransactionServices.class, ResourceLoader.class),
    
    /**
     * Java EE6 Web Profile
     */
-   EE_WEB_PROFILE(WebBeanDiscovery.class, EjbServices.class, JpaServices.class, ResourceServices.class, TransactionServices.class, ResourceLoader.class),
+   EE_WEB_PROFILE(Deployment.class, EjbServices.class, JpaServices.class, ResourceServices.class, TransactionServices.class, ResourceLoader.class),
    
    /**
     * Servlet container such as Tomcat
     */
-   SERVLET(WebBeanDiscovery.class, ResourceLoader.class),
+   SERVLET(Deployment.class, ResourceLoader.class),
    
    /**
     * Java SE
     */
-   SE(WebBeanDiscovery.class, ResourceLoader.class);
+   SE(Deployment.class, ResourceLoader.class);
    
    private final Set<Class<? extends Service>> requiredServices;
    

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/BootstrapBean.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -3,7 +3,7 @@
 import org.jboss.webbeans.bootstrap.api.Bootstrap;
 import org.jboss.webbeans.bootstrap.api.Environment;
 import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
 import org.jboss.webbeans.context.api.BeanStore;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.manager.api.WebBeansManager;
@@ -59,17 +59,17 @@
    {
       bootstrap.getServices().add(ResourceServices.class, resourceServices);
    }
-
-   public void setWebBeanDiscovery(WebBeanDiscovery webBeanDiscovery)
+   
+   public void setDeployment(Deployment deployment)
    {
-      bootstrap.getServices().add(WebBeanDiscovery.class, webBeanDiscovery);
+      bootstrap.getServices().add(Deployment.class, deployment);
    }
-
-   public WebBeanDiscovery getWebBeanDiscovery()
+   
+   public Deployment getDeployment()
    {
-      return bootstrap.getServices().get(WebBeanDiscovery.class);
+      return bootstrap.getServices().get(Deployment.class);
    }
-
+   
    public void setTransactionServices(TransactionServices transactionServices)
    {
       bootstrap.getServices().add(TransactionServices.class, transactionServices);

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -19,7 +19,6 @@
 import java.net.URL;
 import java.util.List;
 
-import org.jboss.webbeans.bootstrap.api.Service;
 import org.jboss.webbeans.ejb.spi.EJBModule;
 
 /**
@@ -46,12 +45,12 @@
  * @author Pete Muir
  * 
  */
-public interface BeanDeploymentArchive extends Service
+public interface BeanDeploymentArchive
 {
 
    /**
     * Get the ordered bean deployment archives which are accessible to this bean
-    * deployment archive and adjacent to it in the deployment archive graph.
+    * deployment archive and adjacent to it i n the deployment archive graph.
     * 
     * The bean deployment archives will be processed in the order specified.
     * 
@@ -69,11 +68,16 @@
    public Iterable<Class<?>> getBeanClasses();
 
    /**
-    * Get the deployment descriptor
+    * Get any deployment descriptors in the bean deployment archive.
     * 
-    * @return a URL pointing to the deployment descriptor, or null if it is not
-    *         present
+    * The container will normally return a single deployment descriptor per bean
+    * deployment archive (the physical META-INF/beans.xml or WEB-INF/beans.xml),
+    * however it is permitted to return other deployment descriptors defined
+    * using other methods.
+    * 
+    * @return an iteration over the URLs pointing to the deployment descriptor,
+    *         or an empty set if none are present
     */
-   public URL getBeansXml();
+   public Iterable<URL> getBeansXml();
 
 }

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -18,6 +18,7 @@
 
 import java.util.List;
 
+import org.jboss.webbeans.bootstrap.api.Service;
 import org.jboss.webbeans.ejb.spi.EJBModule;
 
 /**
@@ -49,7 +50,7 @@
  * @author Pete Muir
  * 
  */
-public interface Deployment
+public interface Deployment extends Service
 {
 
    /**

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbServices.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -71,13 +71,4 @@
     */
    public Object resolveRemoteEjb(String jndiName, String mappedName, String ejbLink);
    
-   /**
-    * Gets a descriptor for each EJB in the application
-    * 
-    * @deprecated an {@link EJBModule} should be used to represent all EJBs
-    * @return the EJB descriptors
-    */
-   @Deprecated
-   public Iterable<EjbDescriptor<?>> discoverEjbs();
-   
 }

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/ejb/spi/helpers/ForwardingEjbServices.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -51,11 +51,6 @@
    {
       return delegate().resolveRemoteEjb(jndiName, mappedName, ejbLink);
    }
-
-   public Iterable<EjbDescriptor<?>> discoverEjbs()
-   {
-      return delegate().discoverEjbs();
-   }
    
    @Override
    public boolean equals(Object obj)

Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -2,7 +2,7 @@
 
 import org.jboss.webbeans.bootstrap.api.Environments;
 import org.jboss.webbeans.bootstrap.api.helpers.AbstractBootstrap;
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
 import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
 import org.jboss.webbeans.ejb.spi.EjbServices;
 import org.jboss.webbeans.messaging.spi.JmsServices;
@@ -34,7 +34,7 @@
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
       bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
       bootstrap.getServices().add(WebServices.class, new MockWebServices());
@@ -50,7 +50,7 @@
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
       bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
       bootstrap.getServices().add(WebServices.class, new MockWebServices());
@@ -66,7 +66,7 @@
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
       bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
       bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
@@ -82,7 +82,7 @@
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
       bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
       bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
@@ -99,7 +99,7 @@
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
       bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
       bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
@@ -116,7 +116,7 @@
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
       bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
       bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
@@ -131,7 +131,7 @@
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(EjbServices.class, new MockEjbServices()); 
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
       bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
       bootstrap.initialize();
@@ -145,7 +145,7 @@
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(EjbServices.class, new MockEjbServices()); 
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());
       bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
       bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
       bootstrap.initialize();
@@ -158,7 +158,7 @@
       bootstrap.setEnvironment(Environments.SE);
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());      
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());      
       bootstrap.initialize();
    }
    
@@ -169,7 +169,7 @@
       bootstrap.setEnvironment(Environments.SERVLET);
       bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
       bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
-      bootstrap.getServices().add(WebBeanDiscovery.class, new MockWebBeanDiscovery());      
+      bootstrap.getServices().add(Deployment.class, new MockDeployment());      
       bootstrap.initialize();
    }
    

Added: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java	                        (rev 0)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -0,0 +1,41 @@
+/*
+ * 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.bootstrap.api.test;
+
+import java.util.List;
+
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockDeployment implements Deployment
+{
+
+   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return null;
+   }
+
+   public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+   {
+      return null;
+   }
+
+}


Property changes on: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java	                        (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -0,0 +1,63 @@
+/*
+ * 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.mock;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockBeanDeploymentArchive implements BeanDeploymentArchive
+{
+   
+
+   private Iterable<Class<?>> beanClasses = new HashSet<Class<?>>();
+
+   private Iterable<URL> webBeansXmlFiles = new HashSet<URL>();
+
+   public Iterable<Class<?>> getBeanClasses()
+   {
+      return beanClasses;
+   }
+
+   public Iterable<URL> getBeansXml()
+   {
+      return webBeansXmlFiles;
+   }
+   
+   public void setBeanClasses(Iterable<Class<?>> webBeanClasses)
+   {
+      this.beanClasses = webBeanClasses;
+   }
+   
+   public void setWebBeansXmlFiles(Iterable<URL> webBeansXmlFiles)
+   {
+      this.webBeansXmlFiles = webBeansXmlFiles;
+   }
+
+   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return Collections.emptyList();
+   }
+
+}


Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java (from rev 2934, ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java)
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java	                        (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -0,0 +1,54 @@
+/*
+ * 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.mock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+
+public class MockDeployment implements Deployment
+{
+   
+   private MockEjbModule ejbModule;
+   
+   private List<BeanDeploymentArchive> beanDeploymentArchives;
+   
+   public MockDeployment()
+   {
+      this.ejbModule = new MockEjbModule();
+      this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>();
+      this.beanDeploymentArchives.add(ejbModule);
+   }
+   
+   public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+   {
+      return beanDeploymentArchives;
+   }
+
+   public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+   {
+      return ejbModule;
+   }
+   
+   public MockEjbModule getEjbModule()
+   {
+      return ejbModule;
+   }
+
+}


Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -33,8 +33,8 @@
    {
       super();
       getBootstrap().getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
-      getBootstrap().getServices().add(EjbServices.class, new MockEjBServices(getWebBeanDiscovery()));
-      getBootstrap().getServices().add(JpaServices.class, new MockJpaServices(getWebBeanDiscovery()));
+      getBootstrap().getServices().add(EjbServices.class, new MockEjBServices());
+      getBootstrap().getServices().add(JpaServices.class, new MockJpaServices(getDeployment()));
       getBootstrap().getServices().add(ResourceServices.class, new MockResourceServices());
       getBootstrap().getServices().add(WebServices.class, new MockWebServices());
       getBootstrap().getServices().add(JmsServices.class, new MockJmsServices());

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjBServices.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -8,7 +8,6 @@
 
 import javax.enterprise.inject.spi.InjectionPoint;
 
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
 import org.jboss.webbeans.ejb.api.SessionObjectReference;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbServices;
@@ -16,13 +15,6 @@
 public class MockEjBServices implements EjbServices
 {
    
-   private final MockEjbDiscovery ejbDiscovery;
-   
-   public MockEjBServices(WebBeanDiscovery webBeanDiscovery)
-   {
-      this.ejbDiscovery = new MockEjbDiscovery(webBeanDiscovery);
-   }
-   
    public Object resolveEjb(InjectionPoint injectionPoint)
    {
       return null;
@@ -37,11 +29,6 @@
    {
       return null;
    }
-   
-   public Iterable<EjbDescriptor<?>> discoverEjbs()
-   {
-      return ejbDiscovery.discoverEjbs();
-   }
 
    public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor)
    {

Deleted: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbDiscovery.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -1,67 +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.mock;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.ejb.MessageDriven;
-import javax.ejb.Singleton;
-import javax.ejb.Stateful;
-import javax.ejb.Stateless;
-
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-
-public class MockEjbDiscovery
-{
-   
-   private final WebBeanDiscovery webBeanDiscovery;
-
-   public MockEjbDiscovery(WebBeanDiscovery webBeanDiscovery)
-   {
-      this.webBeanDiscovery = webBeanDiscovery;
-   }
-
-   public Iterable<EjbDescriptor<?>> discoverEjbs()
-   {
-      List<EjbDescriptor<?>> ejbs = new ArrayList<EjbDescriptor<?>>();
-      for (Class<?> ejbClass : discoverEjbs(webBeanDiscovery.discoverWebBeanClasses()))
-      {
-         ejbs.add(MockEjbDescriptor.of(ejbClass));
-      }
-      return ejbs;
-   }
-   
-   protected static Iterable<Class<?>> discoverEjbs(Iterable<Class<?>> webBeanClasses)
-   {
-      Set<Class<?>> ejbs = new HashSet<Class<?>>();
-      for (Class<?> clazz : webBeanClasses)
-      {
-         if (clazz.isAnnotationPresent(Stateless.class) || clazz.isAnnotationPresent(Stateful.class) || clazz.isAnnotationPresent(MessageDriven.class) || clazz.isAnnotationPresent(Singleton.class)) 
-         {
-            ejbs.add(clazz);
-         }
-      }
-      return ejbs;
-   }
-   
-
-   
-}

Added: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbModule.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbModule.java	                        (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbModule.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -0,0 +1,70 @@
+/*
+ * 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.mock;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.MessageDriven;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.webbeans.ejb.spi.EJBModule;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockEjbModule extends MockBeanDeploymentArchive implements EJBModule
+{
+   
+   private List<EjbDescriptor<?>> ejbs;
+
+   @Override
+   public void setBeanClasses(Iterable<Class<?>> webBeanClasses)
+   {
+      super.setBeanClasses(webBeanClasses);
+      ejbs = new ArrayList<EjbDescriptor<?>>();
+      for (Class<?> ejbClass : discoverEjbs(getBeanClasses()))
+      {
+         ejbs.add(MockEjbDescriptor.of(ejbClass));
+      }
+   }
+   
+   public Iterable<EjbDescriptor<?>> getEjbs()
+   {
+      return ejbs;
+   }
+   
+   protected static Iterable<Class<?>> discoverEjbs(Iterable<Class<?>> webBeanClasses)
+   {
+      Set<Class<?>> ejbs = new HashSet<Class<?>>();
+      for (Class<?> clazz : webBeanClasses)
+      {
+         if (clazz.isAnnotationPresent(Stateless.class) || clazz.isAnnotationPresent(Stateful.class) || clazz.isAnnotationPresent(MessageDriven.class) || clazz.isAnnotationPresent(Singleton.class)) 
+         {
+            ejbs.add(clazz);
+         }
+      }
+      return ejbs;
+   }
+
+}


Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEjbModule.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -12,17 +12,18 @@
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
 import org.jboss.webbeans.persistence.spi.JpaServices;
 
 public class MockJpaServices implements JpaServices
 {
    
-   private final WebBeanDiscovery webBeanDiscovery;
+   private final Deployment deployment;
    
-   public MockJpaServices(WebBeanDiscovery webBeanDiscovery)
+   public MockJpaServices(Deployment deployment)
    {
-      this.webBeanDiscovery = webBeanDiscovery;
+      this.deployment = deployment;
    }
    
    public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
@@ -43,14 +44,26 @@
    public Collection<Class<?>> discoverEntities()
    {
       Set<Class<?>> classes = new HashSet<Class<?>>();
-      for (Class<?> clazz : webBeanDiscovery.discoverWebBeanClasses())
+      for (BeanDeploymentArchive archive : deployment.getBeanDeploymentArchives())
       {
+         discoverEntities(archive, classes);
+      }
+      return classes;
+   }
+   
+   private void discoverEntities(BeanDeploymentArchive archive, Set<Class<?>> classes)
+   {
+      for (Class<?> clazz : archive.getBeanClasses())
+      {
          if (clazz.isAnnotationPresent(Entity.class))
          {
             classes.add(clazz);
          }
       }
-      return classes;
+      for (BeanDeploymentArchive child : archive.getBeanDeploymentArchives())
+      {
+         discoverEntities(child, classes);
+      }
    }
 
 }
\ No newline at end of file

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -2,7 +2,7 @@
 
 import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
 import org.jboss.webbeans.bootstrap.api.Environments;
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
 import org.jboss.webbeans.context.ContextLifecycle;
 import org.jboss.webbeans.context.api.BeanStore;
 import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
@@ -13,22 +13,22 @@
    private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
    
    private final WebBeansBootstrap bootstrap;
-   private final MockWebBeanDiscovery webBeanDiscovery;
+   private final MockDeployment deployment;
    private final BeanStore applicationBeanStore = new ConcurrentHashMapBeanStore();
    private final BeanStore sessionBeanStore = new ConcurrentHashMapBeanStore();
    private final BeanStore requestBeanStore = new ConcurrentHashMapBeanStore();
    
    public MockServletLifecycle()
    {
-      this.webBeanDiscovery = new MockWebBeanDiscovery();
-      if (webBeanDiscovery == null)
+      this.deployment = new MockDeployment();
+      if (deployment == null)
       {
          throw new IllegalStateException("No WebBeanDiscovery is available");
       }
       bootstrap = new WebBeansBootstrap();
       bootstrap.setEnvironment(Environments.SERVLET);
       bootstrap.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
-      bootstrap.getServices().add(WebBeanDiscovery.class, webBeanDiscovery);
+      bootstrap.getServices().add(Deployment.class, deployment);
       bootstrap.setApplicationContext(applicationBeanStore);
    }
    
@@ -37,9 +37,9 @@
       bootstrap.initialize();
    }
    
-   public MockWebBeanDiscovery getWebBeanDiscovery()
+   public MockDeployment getDeployment()
    {
-      return webBeanDiscovery;
+      return deployment;
    }
    
    public WebBeansBootstrap getBootstrap()

Deleted: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockWebBeanDiscovery.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -1,51 +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.mock;
-
-import java.net.URL;
-import java.util.HashSet;
-
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-
-public class MockWebBeanDiscovery implements WebBeanDiscovery
-{
-
-   private Iterable<Class<?>> webBeanClasses = new HashSet<Class<?>>();
-
-   private Iterable<URL> webBeansXmlFiles = new HashSet<URL>();
-
-   public Iterable<Class<?>> discoverWebBeanClasses()
-   {
-      return webBeanClasses;
-   }
-
-   public Iterable<URL> discoverWebBeansXml()
-   {
-      return webBeansXmlFiles;
-   }
-   
-   public void setWebBeanClasses(Iterable<Class<?>> webBeanClasses)
-   {
-      this.webBeanClasses = webBeanClasses;
-   }
-   
-   public void setWebBeansXmlFiles(Iterable<URL> webBeansXmlFiles)
-   {
-      this.webBeansXmlFiles = webBeansXmlFiles;
-   }
-
-}

Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -4,8 +4,8 @@
 
 import org.jboss.testharness.api.DeploymentException;
 import org.jboss.testharness.spi.StandaloneContainers;
+import org.jboss.webbeans.mock.MockBeanDeploymentArchive;
 import org.jboss.webbeans.mock.MockServletLifecycle;
-import org.jboss.webbeans.mock.MockWebBeanDiscovery;
 
 public abstract class AbstractStandaloneContainersImpl implements StandaloneContainers
 {
@@ -20,11 +20,11 @@
       lifecycle.initialize();
       try
       {
-         MockWebBeanDiscovery discovery = lifecycle.getWebBeanDiscovery();
-         discovery.setWebBeanClasses(classes);
+         MockBeanDeploymentArchive archive = lifecycle.getDeployment().getEjbModule();
+         archive.setBeanClasses(classes);
          if (beansXml != null)
          {
-            discovery.setWebBeansXmlFiles(beansXml);
+            archive.setWebBeansXmlFiles(beansXml);
          }
          lifecycle.beginApplication();
       }

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -1,6 +1,6 @@
 package org.jboss.webbeans.test.unit.bootstrap;
 
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
 import org.jboss.webbeans.mock.MockEELifecycle;
 import org.testng.annotations.Test;
 
@@ -11,7 +11,7 @@
    public void testDiscoverFails()
    {
       MockEELifecycle lifecycle = new MockEELifecycle();
-      lifecycle.getBootstrap().getServices().add(WebBeanDiscovery.class, null);
+      lifecycle.getBootstrap().getServices().add(Deployment.class, null);
       lifecycle.initialize();
       lifecycle.beginApplication();
    }

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java	2009-06-30 18:26:45 UTC (rev 2935)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java	2009-06-30 18:27:59 UTC (rev 2936)
@@ -12,8 +12,8 @@
 import org.jboss.webbeans.CurrentManager;
 import org.jboss.webbeans.bean.RIBean;
 import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.mock.MockBeanDeploymentArchive;
 import org.jboss.webbeans.mock.MockServletLifecycle;
-import org.jboss.webbeans.mock.MockWebBeanDiscovery;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
@@ -29,8 +29,8 @@
    {
       lifecycle = new MockServletLifecycle(); 
       lifecycle.initialize();
-      MockWebBeanDiscovery discovery = lifecycle.getWebBeanDiscovery();
-      discovery.setWebBeanClasses(Arrays.asList(Animal.class, DeadlyAnimal.class, DeadlySpider.class, DeadlyAnimal.class, Hound.class, HoundLocal.class, Salmon.class, ScottishFish.class, SeaBass.class, Sole.class, Spider.class, Tarantula.class, TarantulaProducer.class, Tuna.class));
+      MockBeanDeploymentArchive archive = lifecycle.getDeployment().getEjbModule();
+      archive.setBeanClasses(Arrays.asList(Animal.class, DeadlyAnimal.class, DeadlySpider.class, DeadlyAnimal.class, Hound.class, HoundLocal.class, Salmon.class, ScottishFish.class, SeaBass.class, Sole.class, Spider.class, Tarantula.class, TarantulaProducer.class, Tuna.class));
       lifecycle.beginApplication();
       lifecycle.beginSession();
       lifecycle.beginRequest();




More information about the weld-commits mailing list