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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 12 15:32:15 EDT 2007


Author: bdecoste
Date: 2007-06-12 15:32:14 -0400 (Tue, 12 Jun 2007)
New Revision: 63485

Added:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnly.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnlyBean.java
Modified:
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemote.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java
Log:
[EJBTHREE-991] fix and test for SessionContext.getBusinessObject() when no Remote interfaces

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java	2007-06-12 19:28:44 UTC (rev 63484)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java	2007-06-12 19:32:14 UTC (rev 63485)
@@ -871,7 +871,7 @@
          Class[] localInterfaces = ProxyFactoryHelper.getLocalInterfaces(this);
          if (localInterfaces != null)
          {
-            for (Class intf : remoteInterfaces)
+            for (Class intf : localInterfaces)
             {
                if (intf.getName().equals(businessInterface.getName()))
                {

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java	2007-06-12 19:28:44 UTC (rev 63484)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulBean.java	2007-06-12 19:32:14 UTC (rev 63485)
@@ -62,6 +62,8 @@
    
    @EJB(mappedName="StatefulRemote")
    StatefulRemote statefulRemote = null;
+   
+   @EJB StatefulLocalOnly statefulLocalOnly;
 
    EJBLocalObject ejbLocalObject;
    EJBObject ejbObject;
@@ -126,4 +128,9 @@
       ejbLocalObject = sessionContext.getEJBLocalObject();
       ejbObject = sessionContext.getEJBObject();
    }
+   
+   public Object testLocalOnlyGetBusinessObject() throws Exception
+   {
+	   return statefulLocalOnly.getBusinessObject();
+   }
 }

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnly.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnly.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnly.java	2007-06-12 19:32:14 UTC (rev 63485)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbcontext;
+
+/**
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface StatefulLocalOnly
+{
+	public Object getBusinessObject() throws Exception;
+}

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnlyBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnlyBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulLocalOnlyBean.java	2007-06-12 19:32:14 UTC (rev 63485)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbcontext;
+
+import javax.annotation.Resource;
+import javax.ejb.Local;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+
+
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful(name="StatefulLocalOnly")
+ at Local(StatefulLocalOnly.class)
+ at LocalBinding(jndiBinding="StatefulLocalOnly")
+public class StatefulLocalOnlyBean
+   implements StatefulLocalOnly
+{
+   private static final Logger log = Logger.getLogger(StatefulLocalOnlyBean.class);
+   
+   @Resource
+   SessionContext sessionContext;
+
+   public Object getBusinessObject() throws Exception
+   {
+      return sessionContext.getBusinessObject(org.jboss.ejb3.test.ejbcontext.StatefulLocalOnly.class);
+   }
+}

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemote.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemote.java	2007-06-12 19:28:44 UTC (rev 63484)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/StatefulRemote.java	2007-06-12 19:32:14 UTC (rev 63485)
@@ -31,4 +31,6 @@
 public interface StatefulRemote
 {
    Class testInvokedBusinessInterface2() throws Exception;
+   
+   Object testLocalOnlyGetBusinessObject() throws Exception;
 }

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java	2007-06-12 19:28:44 UTC (rev 63484)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbcontext/unit/EjbContextUnitTestCase.java	2007-06-12 19:32:14 UTC (rev 63485)
@@ -162,9 +162,14 @@
       stateful1.setState("same");
       Stateful stateful3 = (Stateful)stateful1.getBusinessObject();
       assertEquals("same", stateful3.getState());
-
-      
    }
+   
+   public void testLocalOnlyGetBusinessObject() throws Exception
+   {
+	   StatefulRemote sfsb = (StatefulRemote)getInitialContext().lookup("StatefulRemote");
+	   Object o = sfsb.testLocalOnlyGetBusinessObject();
+	   assertNotNull(o);
+   }
 
    public static Test suite() throws Exception
    {




More information about the jboss-cvs-commits mailing list