[jboss-cvs] JBossAS SVN: r78682 - projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/remoteaccess/unit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 18 16:19:33 EDT 2008


Author: ALRubinger
Date: 2008-09-18 16:19:33 -0400 (Thu, 18 Sep 2008)
New Revision: 78682

Modified:
   projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/remoteaccess/unit/RemoteAccessTestCase.java
Log:
[EJBTHREE-1493] Added Unit Test

Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/remoteaccess/unit/RemoteAccessTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/remoteaccess/unit/RemoteAccessTestCase.java	2008-09-18 19:38:26 UTC (rev 78681)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/remoteaccess/unit/RemoteAccessTestCase.java	2008-09-18 20:19:33 UTC (rev 78682)
@@ -22,6 +22,7 @@
 package org.jboss.ejb3.test.proxy.remoteaccess.unit;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.BufferedReader;
@@ -74,6 +75,12 @@
    private static final String FILENAME_DEPENDENCY_CP = RemoteAccessTestCase.LOCATION_TARGET + File.separator
          + "cp.txt";
 
+   private static final String JNDI_NAME_SLSB_LOCAL = "MyStatelessBean/local";
+
+   private static final String JNDI_NAME_SLSB_REMOTE = "MyStatelessBean/remote";
+
+   private static final String JNDI_NAME_SFSB_REMOTE = "MyStatefulBean/remote";
+
    private static Process remoteProcess;
 
    private static Context context;
@@ -92,7 +99,7 @@
    @Test
    public void testStatelessSessionRemoteInvocation() throws Throwable
    {
-      Object bean = RemoteAccessTestCase.getContext().lookup("MyStatelessBean/remote");
+      Object bean = RemoteAccessTestCase.getContext().lookup(JNDI_NAME_SLSB_REMOTE);
       assertTrue("Bean was not of expected type " + MyStatelessRemote.class.getName() + " but was instead " + bean,
             bean instanceof MyStatelessRemote);
 
@@ -107,7 +114,7 @@
    @Test
    public void testStatelessSessionDuplicateRemoteInvocations() throws Throwable
    {
-      Object bean = RemoteAccessTestCase.getContext().lookup("MyStatelessBean/remote");
+      Object bean = RemoteAccessTestCase.getContext().lookup(JNDI_NAME_SLSB_REMOTE);
       assertTrue("Bean was not of expected type " + MyStatelessRemote.class.getName() + " but was instead " + bean,
             bean instanceof MyStatelessRemote);
 
@@ -127,7 +134,7 @@
    public void testStatefulSessionRemoteInvocation() throws Throwable
    {
       // Obtain the Proxy
-      Object bean = RemoteAccessTestCase.getContext().lookup("MyStatefulBean/remote");
+      Object bean = RemoteAccessTestCase.getContext().lookup(JNDI_NAME_SFSB_REMOTE);
       assertTrue("Bean must be assignable to " + MyStatefulRemoteBusiness.class.getSimpleName() + " but was instead "
             + bean.getClass(), bean instanceof MyStatefulRemoteBusiness);
 
@@ -143,7 +150,7 @@
    public void testStatefulSessionDuplicateRemoteInvocation() throws Throwable
    {
       // Obtain the Proxy
-      Object bean = RemoteAccessTestCase.getContext().lookup("MyStatefulBean/remote");
+      Object bean = RemoteAccessTestCase.getContext().lookup(JNDI_NAME_SFSB_REMOTE);
       assertTrue("Bean must be assignable to " + MyStatefulRemoteBusiness.class.getSimpleName() + " but was instead "
             + bean.getClass(), bean instanceof MyStatefulRemoteBusiness);
 
@@ -155,6 +162,25 @@
       assertEquals(result, 1);
    }
 
+   /**
+    * Ensures that a SLSB Local Proxy may be looked up from a Remote Host.
+    * Invocation, however, is not tested (as this is expected to fail)
+    */
+   @Test
+   public void testStatelessLocalProxyLookupFromRemoteHost() throws Throwable
+   {
+      // Lookup 
+      Object bean = RemoteAccessTestCase.getContext().lookup(JNDI_NAME_SLSB_LOCAL);
+
+      // Ensure not null
+      assertNotNull("Local Proxy obtained from remote host is null", bean);
+
+      // Ensure correct type
+      assertTrue("Bean was not of expected type " + MyStatelessRemote.class.getName() + " but was instead " + bean,
+            bean instanceof MyStatelessRemote);
+
+   }
+
    // --------------------------------------------------------------------------------||
    // Lifecycle Methods --------------------------------------------------------------||
    // --------------------------------------------------------------------------------||




More information about the jboss-cvs-commits mailing list