Author: pete.muir(a)jboss.org
Date: 2009-04-09 06:44:50 -0400 (Thu, 09 Apr 2009)
New Revision: 2360
Added:
ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractStandaloneContainersImpl.java
Log:
oops
Added:
ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractStandaloneContainersImpl.java
===================================================================
---
ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractStandaloneContainersImpl.java
(rev 0)
+++
ri/trunk/tests/src/main/java/org/jboss/webbeans/test/AbstractStandaloneContainersImpl.java 2009-04-09
10:44:50 UTC (rev 2360)
@@ -0,0 +1,63 @@
+package org.jboss.webbeans.test;
+
+import java.net.URL;
+
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.testharness.spi.StandaloneContainers;
+import org.jboss.webbeans.mock.MockServletLifecycle;
+import org.jboss.webbeans.mock.MockWebBeanDiscovery;
+
+public abstract class AbstractStandaloneContainersImpl implements StandaloneContainers
+{
+
+ private MockServletLifecycle lifecycle;
+
+ public void deploy(Iterable<Class<?>> classes, Iterable<URL>
beansXml) throws DeploymentException
+ {
+ this.lifecycle = newLifecycle();
+ lifecycle.initialize();
+ try
+ {
+ MockWebBeanDiscovery discovery = lifecycle.getWebBeanDiscovery();
+ discovery.setWebBeanClasses(classes);
+ if (beansXml != null)
+ {
+ discovery.setWebBeansXmlFiles(beansXml);
+ }
+ lifecycle.beginApplication();
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Error deploying beans", e);
+ }
+ lifecycle.beginSession();
+ lifecycle.beginRequest();
+ }
+
+ protected abstract MockServletLifecycle newLifecycle();
+
+ public void deploy(Iterable<Class<?>> classes) throws DeploymentException
+ {
+ deploy(classes, null);
+ }
+
+ public void cleanup()
+ {
+ // Np-op
+
+ }
+
+ public void setup()
+ {
+ // No-op
+ }
+
+ public void undeploy()
+ {
+ lifecycle.endRequest();
+ lifecycle.endSession();
+ lifecycle.endApplication();
+ lifecycle = null;
+ }
+
+}
\ No newline at end of file