openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r919887 - in /openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck: StandaloneContainersImpl.java mock/TCKMetaDataDiscoveryImpl.java
Date Sun, 07 Mar 2010 00:10:02 GMT
Author: gerdogdu
Date: Sun Mar  7 00:10:01 2010
New Revision: 919887

URL: http://svn.apache.org/viewvc?rev=919887&view=rev
Log:
[OWB-320] Remove Java EE Dependencies from WebBeans Core

Modified:
    openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
    openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java

Modified: openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java?rev=919887&r1=919886&r2=919887&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
(original)
+++ openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
Sun Mar  7 00:10:01 2010
@@ -41,10 +41,7 @@
 import org.apache.openejb.jee.StatefulBean;
 import org.apache.openejb.jee.StatelessBean;
 import org.apache.webbeans.container.BeanManagerImpl;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.lifecycle.DefaultLifecycle;
-import org.apache.webbeans.lifecycle.test.MockHttpSession;
-import org.apache.webbeans.lifecycle.test.MockServletContextEvent;
+import org.apache.webbeans.lifecycle.StandaloneLifeCycle;
 import org.apache.webbeans.spi.ScannerService;
 import org.apache.webbeans.spi.ServiceLoader;
 import org.apache.webbeans.test.tck.mock.TCKMetaDataDiscoveryImpl;
@@ -53,21 +50,23 @@
 
 public class StandaloneContainersImpl implements StandaloneContainers
 {
-    private DefaultLifecycle lifeCycle = null;
-    
-    private MockServletContextEvent servletContextEvent;
-    
-    private MockHttpSession mockHttpSession;
+    private StandaloneLifeCycle lifeCycle = null;
     
     private DeploymentException excpetion;
         
     public void deployInternal(Iterable<Class<?>> classes) throws DeploymentException
     {
-        initializeContexts();
+        //Scanner service
+        final TCKMetaDataDiscoveryImpl discovery = (TCKMetaDataDiscoveryImpl)ServiceLoader.getService(ScannerService.class);
         
-        TCKMetaDataDiscoveryImpl discovery = (TCKMetaDataDiscoveryImpl)ServiceLoader.getService(ScannerService.class);
-        
-        this.lifeCycle = new DefaultLifecycle();
+        //Lifecycle container
+        this.lifeCycle = new StandaloneLifeCycle()
+        {
+            protected void afterInitApplication(Properties event)
+            {
+                this.scannerService = discovery;
+            }            
+        };
         
         try
         {
@@ -77,7 +76,7 @@
                 discovery.addBeanClass(it.next());
             }
             
-            this.lifeCycle.applicationStarted(servletContextEvent);
+            this.lifeCycle.startApplication(null);
             
         }catch(Throwable e)
         {
@@ -93,11 +92,9 @@
     {
         try
         {
-            initializeContexts();
-            
             TCKMetaDataDiscoveryImpl discovery = (TCKMetaDataDiscoveryImpl)ServiceLoader.getService(ScannerService.class);
             
-            this.lifeCycle = new DefaultLifecycle();
+            this.lifeCycle = new StandaloneLifeCycle();
             
             Iterator<Class<?>> it = classes.iterator();
             while(it.hasNext())
@@ -111,7 +108,7 @@
                 discovery.addBeanXml(itUrl.next());
             }
             
-            this.lifeCycle.applicationStarted(servletContextEvent);            
+            this.lifeCycle.startApplication(null);            
         }
         catch(Throwable e)
         {
@@ -124,18 +121,6 @@
         return true;
     }
 
-    
-    private void initializeContexts()
-    {
-        this.mockHttpSession = new MockHttpSession();
-        
-        ContextFactory.initRequestContext(null);
-        ContextFactory.initSessionContext(mockHttpSession);
-        ContextFactory.initConversationContext(null);
-        
-        this.servletContextEvent = new MockServletContextEvent();        
-    }
-    
     public void setup()
     {
         
@@ -149,11 +134,7 @@
 
     public void undeploy()
     {
-        this.lifeCycle.applicationEnded(this.servletContextEvent);
-
-        ContextFactory.destroyRequestContext(null);
-        ContextFactory.destroySessionContext(this.mockHttpSession);
-        ContextFactory.destroyConversationContext();
+        this.lifeCycle.stopApplication(null);
      }
 
     public DeploymentException getDeploymentException()

Modified: openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java?rev=919887&r1=919886&r2=919887&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
Sun Mar  7 00:10:01 2010
@@ -21,7 +21,7 @@
 
 import javassist.ClassPool;
 
-import org.apache.webbeans.spi.deployer.AbstractMetaDataDiscovery;
+import org.apache.webbeans.spi.scanner.AbstractMetaDataDiscovery;
 import org.apache.webbeans.util.Asserts;
 
 public class TCKMetaDataDiscoveryImpl extends AbstractMetaDataDiscovery



Mime
View raw message