openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r453097 - /incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/stateful/StatefulContainerTest.java
Date Thu, 05 Oct 2006 03:05:05 GMT
Author: dblevins
Date: Wed Oct  4 20:05:04 2006
New Revision: 453097

URL: http://svn.apache.org/viewvc?view=rev&rev=453097
Log:
Basic Stateful/Business Remote functionality works.  Part of OPENEJB-92

Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/stateful/StatefulContainerTest.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/stateful/StatefulContainerTest.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/stateful/StatefulContainerTest.java?view=diff&rev=453097&r1=453096&r2=453097
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/stateful/StatefulContainerTest.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/stateful/StatefulContainerTest.java
Wed Oct  4 20:05:04 2006
@@ -55,9 +55,6 @@
 
     public void testPojoStyleBean() throws Exception {
 
-        WidgetBean.lifecycle.clear();
-
-
         // Do a create...
         Method createMethod = deploymentInfo.getLocalHomeInterface().getMethod("create");
 
@@ -79,7 +76,6 @@
     }
 
     public void testBusinessLocalInterface() throws Exception {
-        WidgetBean.lifecycle.clear();
 
         // Do a create...
 
@@ -107,11 +103,42 @@
         assertEquals(StatefulContainerTest.join("\n", expected) , join("\n", WidgetBean.lifecycle));
     }
 
+    public void testBusinessRemoteInterface() throws Exception {
+        WidgetBean.lifecycle.clear();
+
+        // Do a create...
+
+        CoreDeploymentInfo coreDeploymentInfo = (CoreDeploymentInfo) deploymentInfo;
+        DeploymentInfo.BusinessRemoteHome businessRemoteHome = coreDeploymentInfo.getBusinessRemoteHome();
+        assertNotNull("businessRemoteHome", businessRemoteHome);
+
+        Object object = businessRemoteHome.create();
+        assertNotNull("businessRemoteHome.create()", businessRemoteHome);
+
+        assertTrue("instanceof widget", object instanceof RemoteWidget);
+
+        RemoteWidget widget = (RemoteWidget) object;
+
+        // Do a business method...
+        Stack<Lifecycle> lifecycle = widget.getLifecycle();
+        assertNotNull("lifecycle",lifecycle);
+        assertNotSame("is copy", lifecycle, WidgetBean.lifecycle);
+
+        // Do a remove...
+        widget.destroy();
+
+        // Check the lifecycle of the bean
+        List expected = Arrays.asList(StatefulContainerTest.Lifecycle.values());
+
+        assertEquals(StatefulContainerTest.join("\n", expected) , join("\n", WidgetBean.lifecycle));
+    }
+
     protected void setUp() throws Exception {
         // Setup the descriptor information
 
         StatefulBean bean = new StatefulBean("widget", WidgetBean.class.getName());
         bean.setBusinessLocal(Widget.class.getName());
+        bean.setBusinessRemote(RemoteWidget.class.getName());
         bean.addPostConstruct("init");
         bean.addPreDestroy("destroy");
         bean.addPrePassivate("passivate");
@@ -146,6 +173,9 @@
         ProxyManager.registerFactory("ivm_server", new Jdk13ProxyFactory());
         ProxyManager.setDefaultFactory("ivm_server");
 
+
+        WidgetBean.lifecycle.clear();
+
     }
 
     private static String join(String delimeter, List items){
@@ -169,11 +199,16 @@
         Stack<Lifecycle> getLifecycle();
         void destroy();
     }
+
+    public static interface RemoteWidget extends Widget {
+
+    }
+
     public static enum Lifecycle {
         CONSTRUCTOR, INJECTION, POST_CONSTRUCT, PRE_PASSIVATE1, POST_ACTIVATE1, BUSINESS_METHOD,
PRE_PASSIVATE2, POST_ACTIVATE2, PRE_DESTROY
     }
 
-    public static class WidgetBean implements Widget, Serializable {
+    public static class WidgetBean implements Widget, RemoteWidget, Serializable {
 
         private int activates = 0;
         private int passivates = 0;



Mime
View raw message