openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r892510 - /incubator/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
Date Sat, 19 Dec 2009 21:59:45 GMT
Author: struberg
Date: Sat Dec 19 21:59:44 2009
New Revision: 892510

URL: http://svn.apache.org/viewvc?rev=892510&view=rev
Log:
OWB-190 Make the TestLifeCycles available in webbeans-impl

I moved the test lifecycle and a few Mock interfaces it needs
from the test to the main classes. This way they can be used
in unit tests of other projects easily.



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

Modified: incubator/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java?rev=892510&r1=892509&r2=892510&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
Sat Dec 19 21:59:44 2009
@@ -19,13 +19,18 @@
 
 import javax.enterprise.inject.spi.BeanManager;
 
+import org.apache.openejb.OpenEJB;
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.spi.ContainerSystem;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.lifecycle.EnterpriseLifeCycle;
+import org.apache.webbeans.lifecycle.test.MockHttpSession;
+import org.apache.webbeans.lifecycle.test.MockServletContextEvent;
 import org.apache.webbeans.spi.ServiceLoader;
 import org.apache.webbeans.spi.deployer.MetaDataDiscoveryService;
-import org.apache.webbeans.test.mock.MockHttpSession;
-import org.apache.webbeans.test.mock.MockServletContextEvent;
 import org.apache.webbeans.test.tck.mock.TCKMetaDataDiscoveryImpl;
 import org.jboss.testharness.api.DeploymentException;
 import org.jboss.testharness.spi.StandaloneContainers;
@@ -115,22 +120,36 @@
     
     public void setup()
     {
+    	if ( SystemInstance.get().getComponent(ContainerSystem.class) == null )
+    	{
+    		// which means OpenEJB is not yet started!
+    		// this happens if you start the TCK in 'standalone mode'
+    		// which means we have to bootstrap OpenEJB now:
+	        try 
+	        {
+	            OpenEJB.init(System.getProperties());
+	        } 
+	        catch( OpenEJBException e ) 
+	        {
+	            throw new RuntimeException("failure in OpenWebBeans ejb-plugin while starting
OpenEJB!", e);
+	        }
+    	}
         
     }
     
     public void cleanup()
     {
-        
+        OpenEJB.destroy();
     }
     
 
     public void undeploy()
     {
+        this.lifeCycle.applicationEnded(this.servletContextEvent);
+
         ContextFactory.destroyRequestContext(null);
         ContextFactory.destroySessionContext(this.mockHttpSession);
         ContextFactory.destroyConversationContext();
-        
-        this.lifeCycle.applicationEnded(this.servletContextEvent);
     }
 
     public DeploymentException getDeploymentException()



Mime
View raw message