[jboss-cvs] JBossAS SVN: r65872 - trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1058/unit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 5 04:37:51 EDT 2007


Author: ALRubinger
Date: 2007-10-05 04:37:51 -0400 (Fri, 05 Oct 2007)
New Revision: 65872

Added:
   trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1058/unit/InvokeEjbObjectMethodWithoutHomeTest.java
Log:
EJBTHREE-1058: Added Unit Test Suite

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1058/unit/InvokeEjbObjectMethodWithoutHomeTest.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1058/unit/InvokeEjbObjectMethodWithoutHomeTest.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1058/unit/InvokeEjbObjectMethodWithoutHomeTest.java	2007-10-05 08:37:51 UTC (rev 65872)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ejb3.test.ejbthree1058.unit;
+
+import javax.ejb.EJBObject;
+import javax.ejb.NoSuchEJBException;
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1058.StatefulRemote;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * A InvokeEjbObjectMethodWithoutHomeTest.
+ * 
+ * @author <a href="andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision:  $
+ */
+public class InvokeEjbObjectMethodWithoutHomeTest extends JBossTestCase
+{
+   public InvokeEjbObjectMethodWithoutHomeTest(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Attempts to invoke an EJBObject Method on an EJB with a Remote interface defined, but no home interface
+    * 
+    * @throws Exception
+    */
+   public void testInvokeRemoveOnEjbObjectWithoutHome() throws Exception
+   {
+      // Obtain stub
+      Object obj = getInitialContext().lookup(StatefulRemote.JNDI_NAME_REMOTE);
+      StatefulRemote session = (StatefulRemote) PortableRemoteObject.narrow(obj, StatefulRemote.class);
+      EJBObject ejbObject = (EJBObject) obj;
+
+      // Ensure EJBObject 
+      assertTrue(session instanceof EJBObject);
+
+      // Cast and remove appropriately, ensuring removed
+      boolean removed = false;
+      String result = session.test();
+      assertEquals(StatefulRemote.TEST_STRING, result);
+      ejbObject.remove();
+      try
+      {
+         session.test();
+      }
+      catch (NoSuchEJBException nsee)
+      {
+         removed = true;
+      }
+      assertTrue(removed);
+
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(InvokeEjbObjectMethodWithoutHomeTest.class, "ejbthree1058.jar");
+   }
+}


Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1058/unit/InvokeEjbObjectMethodWithoutHomeTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the jboss-cvs-commits mailing list