[jboss-cvs] JBossAS SVN: r66520 - in branches/Branch_4_2/ejb3: src/test/org/jboss/ejb3/test and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Oct 28 16:11:55 EDT 2007


Author: ALRubinger
Date: 2007-10-28 16:11:54 -0400 (Sun, 28 Oct 2007)
New Revision: 66520

Added:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java
Removed:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java
Modified:
   branches/Branch_4_2/ejb3/build-test.xml
Log:
EJBTHREE-1057: Merged Unit Tests w/ Branch_4_2

Modified: branches/Branch_4_2/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_2/ejb3/build-test.xml	2007-10-28 19:01:22 UTC (rev 66519)
+++ branches/Branch_4_2/ejb3/build-test.xml	2007-10-28 20:11:54 UTC (rev 66520)
@@ -1900,6 +1900,10 @@
       
       <build-simple-jar name="ejbthree1025"/>
    </target>
+
+   <target name="ejbthree1057" depends="compile-classes">
+      <build-simple-jar name="ejbthree1057"/>
+   </target>
    
    <target name="jbas4489"
       description="Builds a simple jar files."
@@ -3377,7 +3381,7 @@
    <target name="jars" depends="removedislocal, statelesscreation, defaultremotebindings, localfromremote, clusteredjms, entityoptimisticlocking, concurrentnaming, propertyreplacement, persistenceunits, invalidtxmdb, descriptortypo, libdeployment, homeinterface, timestampentity, servicexmbean, arjuna, mdbtransactions, unauthenticatedprincipal, clusteredservice, invoker, classloader, 
       circulardependency, jsp, timerdependency, servicedependency, servlet, stateless14, webservices, ear, ejbthree440, 
       ejbthree454, ejbthree653, ejbthree670, ejbthree712, ejbthree724, ejbthree751, ejbthree785, ejbthree786, ejbthree832, ejbthree921,
-      ejbthree959, ejbthree963, ejbthree986, ejbthree994, ejbthree1023, ejbthree1025,
+      ejbthree959, ejbthree963, ejbthree986, ejbthree994, ejbthree1023, ejbthree1025, ejbthree1057,
       jbas4489,
       aspectdomain, ejbcontext, schema, mail, scopedclassloader, dependency, jaxws,
       pkg, securitydomain, enventry, 
@@ -3963,6 +3967,9 @@
          <param name="test" value="ejbthree1025"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
+         <param name="test" value="ejbthree1057"/>
+      </antcall>
+      <antcall target="test" inheritRefs="true">
          <param name="test" value="jbas4489"/>
       </antcall>
    </target>

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057 (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057)

Deleted: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java	2007-10-18 23:09:39 UTC (rev 66259)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -1,39 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.ejb3.test.ejbthree1057;
-
-import javax.ejb.EJB;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.Remote;
-import javax.ejb.Stateless;
-
-import org.jboss.annotation.ejb.RemoteBinding;
-
-/**
- * A DelegateBean.
- * 
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision: $
- */
- at Stateless
- at Remote(DelegateBusinessRemote.class)
- at RemoteBinding(jndiBinding = DelegateBusinessRemote.JNDI_NAME_REMOTE)
-public class DelegateBean implements DelegateBusinessRemote
-{
-
-   // Instance Members
-   @EJB
-   TestBusinessLocal bean;
-
-   // Required Implementations
-
-   public EJBLocalObject testGetEjbLocalObject()
-   {
-      return bean.testGetEjbLocalObject();
-   }
-
-}

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java)
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBean.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ejb3.test.ejbthree1057;
+
+import javax.ejb.EJB;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.annotation.ejb.RemoteBinding;
+
+/**
+ * A DelegateBean.
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(DelegateBusinessRemote.class)
+ at RemoteBinding(jndiBinding = DelegateBusinessRemote.JNDI_NAME_REMOTE)
+public class DelegateBean implements DelegateBusinessRemote
+{
+
+   // Instance Members
+   @EJB
+   TestBusinessLocal bean;
+
+   // Required Implementations
+
+   public EJBLocalObject testGetEjbLocalObject()
+   {
+      return bean.testGetEjbLocalObject();
+   }
+
+}

Deleted: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java	2007-10-18 23:09:39 UTC (rev 66259)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -1,23 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.ejb3.test.ejbthree1057;
-
-import javax.ejb.EJBLocalObject;
-
-/**
- * 
- * A DelegateBusinessRemote.
- * 
- * @author <a href="mailto:andrew.rubinger at redhat.com>ALR</a>
- * @version $Revision:  $
- */
-public interface DelegateBusinessRemote
-{
-   public static String JNDI_NAME_REMOTE = "DelegateBean/remote";
-   
-   EJBLocalObject testGetEjbLocalObject();
-}

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java)
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/DelegateBusinessRemote.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ejb3.test.ejbthree1057;
+
+import javax.ejb.EJBLocalObject;
+
+/**
+ * 
+ * A DelegateBusinessRemote.
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com>ALR</a>
+ * @version $Revision:  $
+ */
+public interface DelegateBusinessRemote
+{
+   public static String JNDI_NAME_REMOTE = "DelegateBean/remote";
+   
+   EJBLocalObject testGetEjbLocalObject();
+}

Deleted: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java	2007-10-18 23:09:39 UTC (rev 66259)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -1,45 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.ejb3.test.ejbthree1057;
-
-import javax.annotation.Resource;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-import javax.ejb.SessionContext;
-import javax.ejb.Stateless;
-
-import org.jboss.annotation.ejb.LocalBinding;
-import org.jboss.annotation.ejb.RemoteBinding;
-
- at Stateless
- at Local(TestBusinessLocal.class)
- at Remote(TestBusinessRemote.class)
- at LocalBinding(jndiBinding=TestBusinessLocal.JNDI_NAME_LOCAL)
- at RemoteBinding(jndiBinding=TestBusinessRemote.JNDI_NAME_REMOTE)
-public class TestBusinessBean implements TestBusinessLocal, TestBusinessRemote
-{
-   
-   // Instance Members
-   @Resource
-   private SessionContext ctx;
-
-   // Required Implementations
-   
-   public EJBLocalObject testGetEjbLocalObject()
-   {
-      return ctx.getEJBLocalObject();
-   }
-
-   public EJBObject testGetEjbObject()
-   {
-      return ctx.getEJBObject();
-   }
-
-   
-}

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java)
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessBean.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ejb3.test.ejbthree1057;
+
+import javax.annotation.Resource;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.annotation.ejb.RemoteBinding;
+
+ at Stateless
+ at Local(TestBusinessLocal.class)
+ at Remote(TestBusinessRemote.class)
+ at LocalBinding(jndiBinding=TestBusinessLocal.JNDI_NAME_LOCAL)
+ at RemoteBinding(jndiBinding=TestBusinessRemote.JNDI_NAME_REMOTE)
+public class TestBusinessBean implements TestBusinessLocal, TestBusinessRemote
+{
+   
+   // Instance Members
+   @Resource
+   private SessionContext ctx;
+
+   // Required Implementations
+   
+   public EJBLocalObject testGetEjbLocalObject()
+   {
+      return ctx.getEJBLocalObject();
+   }
+
+   public EJBObject testGetEjbObject()
+   {
+      return ctx.getEJBObject();
+   }
+
+   
+}

Deleted: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java	2007-10-18 23:09:39 UTC (rev 66259)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -1,22 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.ejb3.test.ejbthree1057;
-
-import javax.ejb.EJBLocalObject;
-
-/**
- * A TestBusinessLocal.
- * 
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision:  $
- */
-public interface TestBusinessLocal
-{
-   public static final String JNDI_NAME_LOCAL = "TestBean/local";
-   
-   EJBLocalObject testGetEjbLocalObject();
-}

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java)
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessLocal.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ejb3.test.ejbthree1057;
+
+import javax.ejb.EJBLocalObject;
+
+/**
+ * A TestBusinessLocal.
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision:  $
+ */
+public interface TestBusinessLocal
+{
+   public static final String JNDI_NAME_LOCAL = "TestBean/local";
+   
+   EJBLocalObject testGetEjbLocalObject();
+}

Deleted: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java	2007-10-18 23:09:39 UTC (rev 66259)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -1,22 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.ejb3.test.ejbthree1057;
-
-import javax.ejb.EJBObject;
-
-/**
- * A TestBusinessRemote.
- * 
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision:  $
- */
-public interface TestBusinessRemote
-{
-   public static final String JNDI_NAME_REMOTE = "TestBean/remote";
-
-   EJBObject testGetEjbObject();
-}

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java)
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/TestBusinessRemote.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ejb3.test.ejbthree1057;
+
+import javax.ejb.EJBObject;
+
+/**
+ * A TestBusinessRemote.
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision:  $
+ */
+public interface TestBusinessRemote
+{
+   public static final String JNDI_NAME_REMOTE = "TestBean/remote";
+
+   EJBObject testGetEjbObject();
+}

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit)

Deleted: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java	2007-10-18 23:09:39 UTC (rev 66259)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -1,119 +0,0 @@
-/*
- * JBoss, the OpenSource J2EE webOS
- * 
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.ejb3.test.ejbthree1057.unit;
-
-import javax.ejb.EJBException;
-import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBObject;
-import javax.naming.NameNotFoundException;
-
-import junit.framework.Test;
-
-import org.jboss.ejb3.test.ejbthree1057.DelegateBusinessRemote;
-import org.jboss.ejb3.test.ejbthree1057.TestBusinessRemote;
-import org.jboss.test.JBossTestCase;
-
-/**
- * A GetEjbObjectWithNo21ViewUnitTestCase.
- * 
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision:  $
- */
-public class GetEjbObjectWithNo21ViewUnitTestCase extends JBossTestCase
-{
-
-   // Constructor
-
-   public GetEjbObjectWithNo21ViewUnitTestCase(String name)
-   {
-      super(name);
-   }
-
-   // Test Suite
-
-   public static Test suite() throws Exception
-   {
-      return getDeploySetup(GetEjbObjectWithNo21ViewUnitTestCase.class, "ejbthree1057.jar");
-   }
-
-   // Tests
-
-   /**
-    * Ensures that a call to SessionContext.getEJBObject fails when 
-    * no EJB 2.1 view is defined
-    */
-   public void testGetEjbObjectWithNo21ViewFails() throws Exception
-   {
-      // Obtain test bean
-      TestBusinessRemote bean = null;
-      try
-      {
-         bean = (TestBusinessRemote) this.getInitialContext().lookup(TestBusinessRemote.JNDI_NAME_REMOTE);
-      }
-      catch (NameNotFoundException nnfe)
-      {
-         log.error("Could not obtain " + TestBusinessRemote.class.getName() + " from expected location "
-               + TestBusinessRemote.JNDI_NAME_REMOTE);
-      }
-
-      // Attempt to obtain EJBObject
-      EJBObject obj = null;
-      try
-      {
-         obj = bean.testGetEjbObject();
-      }
-      catch (EJBException ejbe)
-      {
-         if (ejbe.getCause() instanceof IllegalStateException)
-         {
-            log.info("Expected exception " + ejbe.getClass().getName() + " encountered.");
-            return;
-         }
-      }
-
-      // Should not be reached; fail the test
-      fail("Should have received exception while attempting to invoke SessionContext.getEJBObject().");
-   }
-
-   /**
-    * Ensures that a call to SessionContext.getEJBLocalObject fails when 
-    * no EJB 2.1 view is defined
-    */
-   public void testGetEjbLocalObjectWithNo21ViewFails() throws Exception
-   {
-      // Obtain test bean
-      DelegateBusinessRemote bean = null;
-      try
-      {
-         bean = (DelegateBusinessRemote) this.getInitialContext().lookup(DelegateBusinessRemote.JNDI_NAME_REMOTE);
-      }
-      catch (NameNotFoundException nnfe)
-      {
-         log.error("Could not obtain " + DelegateBusinessRemote.class.getName() + " from expected location "
-               + DelegateBusinessRemote.JNDI_NAME_REMOTE);
-      }
-
-      // Attempt to obtain EJBObject
-      EJBLocalObject obj = null;
-      try
-      {
-         obj = bean.testGetEjbLocalObject();
-      }
-      catch (Exception e)
-      {
-         if (e.getCause() instanceof IllegalStateException)
-         {
-            log.info("Expected exception " + e.getClass().getName() + " encountered.");
-            return;
-         }
-      }
-
-      // Should not be reached; fail the test
-      fail("Should have received exception while attempting to invoke SessionContext.getEJBLocalObject().");
-   }
-
-}

Copied: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java (from rev 66259, trunk/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java)
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree1057/unit/GetEjbObjectWithNo21ViewUnitTestCase.java	2007-10-28 20:11:54 UTC (rev 66520)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ * 
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.ejb3.test.ejbthree1057.unit;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBLocalObject;
+import javax.ejb.EJBObject;
+import javax.naming.NameNotFoundException;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree1057.DelegateBusinessRemote;
+import org.jboss.ejb3.test.ejbthree1057.TestBusinessRemote;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * A GetEjbObjectWithNo21ViewUnitTestCase.
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision:  $
+ */
+public class GetEjbObjectWithNo21ViewUnitTestCase extends JBossTestCase
+{
+
+   // Constructor
+
+   public GetEjbObjectWithNo21ViewUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   // Test Suite
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(GetEjbObjectWithNo21ViewUnitTestCase.class, "ejbthree1057.jar");
+   }
+
+   // Tests
+
+   /**
+    * Ensures that a call to SessionContext.getEJBObject fails when 
+    * no EJB 2.1 view is defined
+    */
+   public void testGetEjbObjectWithNo21ViewFails() throws Exception
+   {
+      // Obtain test bean
+      TestBusinessRemote bean = null;
+      try
+      {
+         bean = (TestBusinessRemote) this.getInitialContext().lookup(TestBusinessRemote.JNDI_NAME_REMOTE);
+      }
+      catch (NameNotFoundException nnfe)
+      {
+         log.error("Could not obtain " + TestBusinessRemote.class.getName() + " from expected location "
+               + TestBusinessRemote.JNDI_NAME_REMOTE);
+      }
+
+      // Attempt to obtain EJBObject
+      EJBObject obj = null;
+      try
+      {
+         obj = bean.testGetEjbObject();
+      }
+      catch (EJBException ejbe)
+      {
+         if (ejbe.getCause() instanceof IllegalStateException)
+         {
+            log.info("Expected exception " + ejbe.getClass().getName() + " encountered.");
+            return;
+         }
+      }
+
+      // Should not be reached; fail the test
+      fail("Should have received exception while attempting to invoke SessionContext.getEJBObject().");
+   }
+
+   /**
+    * Ensures that a call to SessionContext.getEJBLocalObject fails when 
+    * no EJB 2.1 view is defined
+    */
+   public void testGetEjbLocalObjectWithNo21ViewFails() throws Exception
+   {
+      // Obtain test bean
+      DelegateBusinessRemote bean = null;
+      try
+      {
+         bean = (DelegateBusinessRemote) this.getInitialContext().lookup(DelegateBusinessRemote.JNDI_NAME_REMOTE);
+      }
+      catch (NameNotFoundException nnfe)
+      {
+         log.error("Could not obtain " + DelegateBusinessRemote.class.getName() + " from expected location "
+               + DelegateBusinessRemote.JNDI_NAME_REMOTE);
+      }
+
+      // Attempt to obtain EJBObject
+      EJBLocalObject obj = null;
+      try
+      {
+         obj = bean.testGetEjbLocalObject();
+      }
+      catch (Exception e)
+      {
+         if (e.getCause() instanceof IllegalStateException)
+         {
+            log.info("Expected exception " + e.getClass().getName() + " encountered.");
+            return;
+         }
+      }
+
+      // Should not be reached; fail the test
+      fail("Should have received exception while attempting to invoke SessionContext.getEJBLocalObject().");
+   }
+
+}




More information about the jboss-cvs-commits mailing list