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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 13 14:35:44 EDT 2007


Author: bdecoste
Date: 2007-03-13 14:35:44 -0400 (Tue, 13 Mar 2007)
New Revision: 61301

Added:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatefulBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatelessBean.java
Modified:
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
   branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/Test.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/TestBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/unit/HomeTestCase.java
Log:
[JBCTS-540] if business and home jndi bindings are the same, one proxy is created that implements both interfaces

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java	2007-03-13 18:30:20 UTC (rev 61300)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -29,6 +29,7 @@
 import org.jboss.ejb3.JBossProxy;
 import org.jboss.ejb3.NonSerializableFactory;
 import org.jboss.ejb3.ProxyFactoryHelper;
+import org.jboss.logging.Logger;
 
 
 /**
@@ -39,17 +40,40 @@
  */
 public class StatefulLocalProxyFactory extends BaseStatefulProxyFactory
 {
+   private static final Logger log = Logger.getLogger(StatefulLocalProxyFactory.class);
+
    protected Class[] getInterfaces()
    {
       Class[] interfaces;
-
+      
+      StatefulContainer statefulContainer = (StatefulContainer) container;
+      LocalHome localHome = (LocalHome) statefulContainer.resolveAnnotation(LocalHome.class);
+      
+      boolean bindTogether = false;
+      
+      if (localHome != null && bindHomeAndBusinessTogether(statefulContainer))
+         bindTogether = true;
+      
       Class[] localInterfaces = ProxyFactoryHelper.getLocalInterfaces(container);
-      interfaces = new Class[localInterfaces.length + 2];
+      if (bindTogether)
+         interfaces = new Class[localInterfaces.length + 3];
+      else
+         interfaces = new Class[localInterfaces.length + 2];
+      
       System.arraycopy(localInterfaces, 0, interfaces, 0, localInterfaces.length);
       interfaces[localInterfaces.length] = JBossProxy.class;
       interfaces[localInterfaces.length + 1] = javax.ejb.EJBLocalObject.class;
+      
+      if (bindTogether)
+         interfaces[localInterfaces.length + 2] = localHome.value();
+      
       return interfaces;
    }
+   
+   protected boolean bindHomeAndBusinessTogether(StatefulContainer container)
+   {
+      return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(ProxyFactoryHelper.getLocalJndiName(container));
+   }
 
    protected void initializeJndiName()
    {
@@ -71,8 +95,9 @@
          throw namingException;
       }
 
+      StatefulContainer statefulContainer = (StatefulContainer) container;
       LocalHome localHome = (LocalHome) ((EJBContainer) container).resolveAnnotation(LocalHome.class);
-      if (localHome != null)
+      if (localHome != null  && !bindHomeAndBusinessTogether(statefulContainer))
       {
          Class[] interfaces = {localHome.value()};
          Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(container.getBeanClass().getClassLoader(),
@@ -85,8 +110,10 @@
    {
       super.stop();
       NonSerializableFactory.unbind(container.getInitialContext(), jndiName + PROXY_FACTORY_NAME);
+      
+      StatefulContainer statefulContainer = (StatefulContainer) container;
       LocalHome localHome = (LocalHome) ((EJBContainer) container).resolveAnnotation(LocalHome.class);
-      if (localHome != null)
+      if (localHome != null  && !bindHomeAndBusinessTogether(statefulContainer))
       {
          NonSerializableFactory.unbind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container));
       }

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java	2007-03-13 18:30:20 UTC (rev 61300)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -59,15 +59,34 @@
    protected Class[] getInterfaces()
    {
       Class[] interfaces;
-
+      
+      StatefulContainer statefulContainer = (StatefulContainer) container;
+      RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
+      
+      boolean bindTogether = false;
+      
+      if (remoteHome != null && bindHomeAndBusinessTogether(statefulContainer))
+         bindTogether = true;
+      
       Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteInterfaces(container);
+      if (bindTogether)
+         interfaces = new Class[remoteInterfaces.length + 3];
+      else
          interfaces = new Class[remoteInterfaces.length + 2];
 
       System.arraycopy(remoteInterfaces, 0, interfaces, 0, remoteInterfaces.length);
       interfaces[remoteInterfaces.length] = JBossProxy.class;
       interfaces[remoteInterfaces.length + 1] = javax.ejb.EJBObject.class;
+      if (bindTogether)
+         interfaces[remoteInterfaces.length + 2] = remoteHome.value();
+         
       return interfaces;
    }
+   
+   protected boolean bindHomeAndBusinessTogether(StatefulContainer container)
+   {
+      return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteJndiName(container));
+   }
 
    protected void initializeJndiName()
    {
@@ -102,7 +121,7 @@
 
       StatefulContainer statefulContainer = (StatefulContainer) container;
       RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
-      if (remoteHome != null)
+      if (remoteHome != null && !bindHomeAndBusinessTogether(statefulContainer))
       {
          Object homeProxy = createHomeProxy(remoteHome.value());
          Util.rebind(container.getInitialContext(), ProxyFactoryHelper.getHomeJndiName(container), homeProxy);
@@ -113,9 +132,10 @@
    {
       Util.unbind(container.getInitialContext(), jndiName + PROXY_FACTORY_NAME);
       Dispatcher.singleton.unregisterTarget(jndiName + PROXY_FACTORY_NAME);
+      
       StatefulContainer statefulContainer = (StatefulContainer) container;
       RemoteHome remoteHome = (RemoteHome) statefulContainer.resolveAnnotation(RemoteHome.class);
-      if (remoteHome != null)
+      if (remoteHome != null && !bindHomeAndBusinessTogether(statefulContainer))
       {
          Util.unbind(container.getInitialContext(), ProxyFactoryHelper.getHomeJndiName(container));
       }

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java	2007-03-13 18:30:20 UTC (rev 61300)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessLocalProxyFactory.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -23,11 +23,13 @@
 
 import java.lang.reflect.InvocationTargetException;
 import javax.ejb.LocalHome;
+
 import org.jboss.annotation.ejb.LocalBinding;
 import org.jboss.ejb3.EJBContainer;
 import org.jboss.ejb3.JBossProxy;
 import org.jboss.ejb3.NonSerializableFactory;
 import org.jboss.ejb3.ProxyFactoryHelper;
+import org.jboss.logging.Logger;
 
 
 /**
@@ -38,20 +40,40 @@
  */
 public class StatelessLocalProxyFactory extends BaseStatelessProxyFactory
 {
+   private static final Logger log = Logger.getLogger(StatelessLocalProxyFactory.class);
+
    protected Class[] getInterfaces()
    {
       Class[] interfaces;
-
-      Class[] localInterfaces = ProxyFactoryHelper.getLocalInterfaces(container);
+      
       EJBContainer statelessContainer = (EJBContainer) container;
-      interfaces = new Class[localInterfaces.length + 2];
+      LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
+      
+      boolean bindTogether = false;
+      
+      if (localHome != null && bindHomeAndBusinessTogether(statelessContainer))
+         bindTogether = true;
+      
+      Class[] localInterfaces = ProxyFactoryHelper.getLocalInterfaces(container);
+      
+      if (bindTogether)
+         interfaces = new Class[localInterfaces.length + 3];
+      else
+         interfaces = new Class[localInterfaces.length + 2];
 
       System.arraycopy(localInterfaces, 0, interfaces, 0, localInterfaces.length);
       interfaces[localInterfaces.length] = JBossProxy.class;
       interfaces[localInterfaces.length + 1] = javax.ejb.EJBLocalObject.class;
+      if (bindTogether)
+         interfaces[localInterfaces.length + 2] = localHome.value();
 
       return interfaces;
    }
+   
+   protected boolean bindHomeAndBusinessTogether(EJBContainer container)
+   {
+      return ProxyFactoryHelper.getLocalHomeJndiName(container).equals(ProxyFactoryHelper.getLocalJndiName(container));
+   }
 
    protected void initializeJndiName()
    {
@@ -64,7 +86,7 @@
       super.start();
       EJBContainer statelessContainer = (EJBContainer) container;
       LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
-      if (localHome != null)
+      if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
       {
          Class[] interfaces = {localHome.value()};
          Object homeProxy = java.lang.reflect.Proxy.newProxyInstance(container.getBeanClass().getClassLoader(),
@@ -79,7 +101,7 @@
       super.stop();
       EJBContainer statelessContainer = (EJBContainer) container;
       LocalHome localHome = (LocalHome) statelessContainer.resolveAnnotation(LocalHome.class);
-      if (localHome != null)
+      if (localHome != null && !bindHomeAndBusinessTogether(statelessContainer))
       {
          NonSerializableFactory.unbind(container.getInitialContext(), ProxyFactoryHelper.getLocalHomeJndiName(container));
       }
@@ -88,38 +110,15 @@
 
    public Object createProxy()
    {
-      /*
-      try
-      {
-         Object[] args = {new StatelessLocalProxy(container)};
-         return proxyConstructor.newInstance(args);
-      }
-      catch (InstantiationException e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
-      catch (IllegalAccessException e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
-      catch (IllegalArgumentException e)
-      {
-         throw new RuntimeException(e);  //To change body of catch statement use Options | File Templates.
-      }
-      catch (InvocationTargetException e)
-      {
-         throw new RuntimeException(e.getTargetException());  //To change body of catch statement use Options | File Templates.
-      }
-      */
       return constructProxy(new StatelessLocalProxy(container));
    }
 
    protected StatelessHandleImpl getHandle()
    {
       StatelessHandleImpl handle = new StatelessHandleImpl();
-      LocalBinding remoteBinding = (LocalBinding) advisor.resolveAnnotation(LocalBinding.class);
-      if (remoteBinding != null)
-         handle.jndiName = remoteBinding.jndiBinding();
+      LocalBinding localBinding = (LocalBinding) advisor.resolveAnnotation(LocalBinding.class);
+      if (localBinding != null)
+         handle.jndiName = localBinding.jndiBinding();
 
       return handle;
    }

Modified: branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java
===================================================================
--- branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java	2007-03-13 18:30:20 UTC (rev 61300)
+++ branches/Branch_4_2/ejb3/src/main/org/jboss/ejb3/stateless/StatelessRemoteProxyFactory.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -31,6 +31,7 @@
 import org.jboss.ejb3.JBossProxy;
 import org.jboss.ejb3.ProxyFactoryHelper;
 import org.jboss.ejb3.remoting.RemoteProxyFactory;
+import org.jboss.ejb3.stateful.StatefulContainer;
 import org.jboss.logging.Logger;
 import org.jboss.remoting.InvokerLocator;
 import org.jboss.naming.Util;
@@ -56,18 +57,37 @@
 
    protected Class[] getInterfaces() {
       Class[] interfaces;
-
-      Class[] remoteInterfaces = ProxyFactoryHelper
-            .getRemoteInterfaces(container);
-      interfaces = new Class[remoteInterfaces.length + 2];
-
+      
+      StatelessContainer statelessContainer = (StatelessContainer) container;
+      RemoteHome remoteHome = (RemoteHome) statelessContainer.resolveAnnotation(RemoteHome.class);
+      
+      boolean bindTogether = false;
+      
+      if (remoteHome != null && bindHomeAndBusinessTogether(statelessContainer))
+         bindTogether = true;
+      
+      Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteInterfaces(container);
+      
+      if (bindTogether)
+         interfaces = new Class[remoteInterfaces.length + 3];
+      else
+         interfaces = new Class[remoteInterfaces.length + 2];
+      
       System.arraycopy(remoteInterfaces, 0, interfaces, 0,
             remoteInterfaces.length);
       interfaces[remoteInterfaces.length] = JBossProxy.class;
       interfaces[remoteInterfaces.length + 1] = javax.ejb.EJBObject.class;
+      
+      if (bindTogether)
+         interfaces[remoteInterfaces.length + 2] = remoteHome.value();
 
       return interfaces;
    }
+   
+   protected boolean bindHomeAndBusinessTogether(EJBContainer container)
+   {
+      return ProxyFactoryHelper.getHomeJndiName(container).equals(ProxyFactoryHelper.getRemoteJndiName(container));
+   }
 
    protected void initializeJndiName() {
       jndiName = ProxyFactoryHelper.getRemoteJndiName(container, binding);
@@ -84,7 +104,7 @@
       EJBContainer statelessContainer = (EJBContainer) container;
       RemoteHome remoteHome = (RemoteHome) statelessContainer
             .resolveAnnotation(RemoteHome.class);
-      if (remoteHome != null) {
+      if (remoteHome != null && !bindHomeAndBusinessTogether(statelessContainer)) {
          Object homeProxy = createHomeProxy(remoteHome.value());
          try {
             Util.rebind(container.getInitialContext(), ProxyFactoryHelper
@@ -108,7 +128,7 @@
       EJBContainer statelessContainer = (EJBContainer) container;
       RemoteHome remoteHome = (RemoteHome) statelessContainer
             .resolveAnnotation(RemoteHome.class);
-      if (remoteHome != null) {
+      if (remoteHome != null && !bindHomeAndBusinessTogether(statelessContainer)) {
          Util.unbind(container.getInitialContext(), ProxyFactoryHelper
                .getHomeJndiName(container));
       }

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatefulBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatefulBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatefulBean.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -0,0 +1,60 @@
+/*
+ * 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.homeinterface;
+
+import javax.ejb.Local;
+import javax.ejb.LocalHome;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateful;
+
+import org.jboss.annotation.ejb.LocalHomeBinding;
+import org.jboss.annotation.ejb.RemoteHomeBinding;
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.annotation.ejb.RemoteBinding;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful
+ at Remote(RemoteInterface.class)
+ at RemoteBinding(jndiBinding="DuplicateStateful")
+ at RemoteHomeBinding(jndiBinding="DuplicateStateful")
+ at RemoteHome(Home.class)
+ at Local(LocalInterface.class)
+ at LocalBinding(jndiBinding="DuplicateStatefulLocal")
+ at LocalHomeBinding(jndiBinding="DuplicateStatefulLocal")
+ at LocalHome(org.jboss.ejb3.test.homeinterface.LocalHome.class)
+public class DuplicateStatefulBean implements RemoteInterface, LocalInterface
+{
+   private static final Logger log = Logger.getLogger(DuplicateStatefulBean.class);
+    
+   public void test() 
+   {
+   }
+   
+   public void testLocal() 
+   {
+   }
+}

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatelessBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatelessBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/DuplicateStatelessBean.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -0,0 +1,60 @@
+/*
+ * 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.homeinterface;
+
+import javax.ejb.Local;
+import javax.ejb.LocalHome;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateless;
+
+import org.jboss.annotation.ejb.LocalHomeBinding;
+import org.jboss.annotation.ejb.RemoteHomeBinding;
+import org.jboss.annotation.ejb.LocalBinding;
+import org.jboss.annotation.ejb.RemoteBinding;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateless
+ at Remote(RemoteInterface.class)
+ at RemoteBinding(jndiBinding="DuplicateStateless")
+ at RemoteHomeBinding(jndiBinding="DuplicateStateless")
+ at RemoteHome(Home.class)
+ at Local(LocalInterface.class)
+ at LocalBinding(jndiBinding="DuplicateStatelessLocal")
+ at LocalHomeBinding(jndiBinding="DuplicateStatelessLocal")
+ at LocalHome(org.jboss.ejb3.test.homeinterface.LocalHome.class)
+public class DuplicateStatelessBean implements RemoteInterface, LocalInterface
+{
+   private static final Logger log = Logger.getLogger(DuplicateStatelessBean.class);
+    
+   public void test() 
+   {
+   }
+   
+   public void testLocal() 
+   {
+   }
+}

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/Test.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/Test.java	2007-03-13 18:30:20 UTC (rev 61300)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/Test.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -37,4 +37,8 @@
    void testExplicitStatefulLocal() throws Exception;
    
    void testDescriptorStatefulLocal() throws Exception;
+   
+   void testDuplicateStatelessLocal() throws Exception;
+   
+   void testDuplicateStatefulLocal() throws Exception;
 }

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/TestBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/TestBean.java	2007-03-13 18:30:20 UTC (rev 61300)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/TestBean.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -108,4 +108,26 @@
       local = (LocalInterface)jndiContext.lookup("DescriptorStatefulBean/local");
       local.testLocal();
    }
+   
+   public void testDuplicateStatelessLocal() throws Exception
+   {
+      InitialContext jndiContext = new InitialContext();
+      LocalHome home = (LocalHome)jndiContext.lookup("DuplicateStatelessLocal");
+      LocalInterface local = home.create();
+      local.testLocal();
+      
+      local = (LocalInterface)jndiContext.lookup("DuplicateStatelessLocal");
+      local.testLocal();
+   }
+   
+   public void testDuplicateStatefulLocal() throws Exception
+   {
+      InitialContext jndiContext = new InitialContext();
+      LocalHome home = (LocalHome)jndiContext.lookup("DuplicateStatefulLocal");
+      LocalInterface local = home.create();
+      local.testLocal();
+      
+      local = (LocalInterface)jndiContext.lookup("DuplicateStatefulLocal");
+      local.testLocal();
+   }
 }

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/unit/HomeTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/unit/HomeTestCase.java	2007-03-13 18:30:20 UTC (rev 61300)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/homeinterface/unit/HomeTestCase.java	2007-03-13 18:35:44 UTC (rev 61301)
@@ -126,6 +126,34 @@
       test.testDescriptorStatefulLocal();
    }
    
+   public void testDuplicateStateful() throws Exception
+   {
+      InitialContext jndiContext = new InitialContext();
+      Home home = (Home)jndiContext.lookup("DuplicateStateful");
+      RemoteInterface remote = home.create();
+      remote.test();
+      
+      remote = (RemoteInterface)jndiContext.lookup("DuplicateStateful");
+      remote.test();
+      
+      Test test = (Test)jndiContext.lookup("TestBean/remote");
+      test.testDuplicateStatefulLocal();
+   }
+   
+   public void testDuplicateStateless() throws Exception
+   {
+      InitialContext jndiContext = new InitialContext();
+      Home home = (Home)jndiContext.lookup("DuplicateStateless");
+      RemoteInterface remote = home.create();
+      remote.test();
+      
+      remote = (RemoteInterface)jndiContext.lookup("DuplicateStateless");
+      remote.test();
+      
+      Test test = (Test)jndiContext.lookup("TestBean/remote");
+      test.testDuplicateStatelessLocal();
+   }
+   
    public static junit.framework.Test suite() throws Exception
    {
       return getDeploySetup(HomeTestCase.class, "homeinterface-test.jar");




More information about the jboss-cvs-commits mailing list