[Jboss-cvs] JBossAS SVN: r56635 - in branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test: clusteredsession dd/web dd/web/jsp jca/inflowmdb mdb regression regression/ejbthree485 regression/ejbthree485/unit regression/ejbthree620 regression/ejbthree620/unit regression/ejbthree625 regression/ejbthree625/unit regression/ejbthree653 regression/ejbthree653/unit regression/ejbthree670 regression/ejbthree670/unit stateful/unit

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 7 23:28:09 EDT 2006


Author: bill.burke at jboss.com
Date: 2006-09-07 23:28:03 -0400 (Thu, 07 Sep 2006)
New Revision: 56635

Added:
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/BogusPolicy.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulRemote.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/dd/web/jsp/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/dd/web/jsp/InjectionTest.jsp
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSMDBBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTest.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTestBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessRemote.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/DlqTestMDB.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/LocalStatelessBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideDefaultedQueueTestMDB.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyException.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyRemote.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/StatelessBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/unit/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/unit/ClassNameTestCase.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/Calculator.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/CalculatorBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/unit/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/unit/EJBBeanInterfaceTestCase.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/Silly.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/SillyBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/StupidInterceptor.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/unit/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/unit/Ejb625UnitTestCase.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Bean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Home.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateless.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStatelessBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/unit/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/unit/PoolingSLBSTestCase.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Bean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Home.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStatefulBean.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/unit/
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/unit/PreDestroyCallsTestCase.java
   branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/NestedBeanUnitTestCase.java
Log:
merge from head

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/BogusPolicy.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/BogusPolicy.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/BogusPolicy.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,50 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.clusteredsession;
+
+import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
+import org.jboss.ha.framework.interfaces.HARMIClient;
+import org.jboss.ha.framework.interfaces.FamilyClusterInfo;
+
+import org.jboss.invocation.Invocation;
+
+/**
+ * @version <tt>$Revision: 44965 $</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public class BogusPolicy implements LoadBalancePolicy
+{
+   public void init (HARMIClient father)
+   {
+      throw new RuntimeException("Bogus implementation!");
+   }
+
+   public Object chooseTarget (FamilyClusterInfo clusterFamily)
+   {
+      throw new RuntimeException("Bogus implementation!");
+   }
+   public Object chooseTarget (FamilyClusterInfo clusterFamily, Invocation routingDecision)
+   {
+      throw new RuntimeException("Bogus implementation!");
+   }
+
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,55 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.clusteredsession;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import org.jboss.annotation.ejb.Clustered;
+import org.jboss.annotation.ejb.cache.tree.CacheConfig;
+import org.jboss.logging.Logger;
+import org.jboss.system.server.ServerConfig;
+
+/**
+ * @version <tt>$Revision: 45045 $</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at Stateful(name="OverrideStateful")
+ at Clustered(partition="BogusPartition", loadBalancePolicy=org.jboss.ejb3.test.clusteredsession.BogusPolicy.class)
+ at CacheConfig(maxSize=1000, idleTimeoutSeconds=2)
+ at Remote(OverrideStatefulRemote.class)
+public class OverrideStatefulBean implements OverrideStatefulRemote
+{
+   private static final Logger log = Logger.getLogger(OverrideStatefulBean.class);
+   
+   private int state = 0;
+
+   public int increment()
+   {
+      log.info("INCREMENT - counter: " + (state++));
+      return state;
+   }
+   
+   public String getHostAddress()
+   {
+      return System.getProperty(ServerConfig.SERVER_BIND_ADDRESS);
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulRemote.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulRemote.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/clusteredsession/OverrideStatefulRemote.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,32 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.clusteredsession;
+
+/**
+ * @version <tt>$Revision: 44965 $</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface OverrideStatefulRemote
+{
+   int increment();
+   String getHostAddress();
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/dd/web/jsp/InjectionTest.jsp
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/dd/web/jsp/InjectionTest.jsp	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/dd/web/jsp/InjectionTest.jsp	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,63 @@
+<%@ page import="java.util.Hashtable,
+                 javax.naming.*" %>
+<%@ page import="java.lang.reflect.Proxy"%>
+<%@ page import="org.jboss.ejb3.Ejb3Registry"%>
+<%@ page import="org.jboss.ejb3.Container"%>
+<%@ page import="java.util.Iterator"%>
+<%@ page import="javax.ejb.EJB"%>
+<%@ page import="org.jboss.ejb3.test.dd.web.interfaces.Session30"%>
+<%@ page import="javax.persistence.PersistenceContext"%>
+<%@ page import="javax.persistence.EntityManager"%>
+<%@ page import="javax.persistence.PersistenceUnit"%>
+<%@ page import="javax.persistence.EntityManagerFactory"%>
+<%@ page import="javax.annotation.Resource"%>
+<%@ page import="javax.transaction.UserTransaction"%>
+<%@ page import="org.jboss.ejb3.test.dd.web.ejb.Address"%>
+
+<%!
+
+   @EJB Session30 injectedSession30;
+   @PersistenceContext(unitName="../dd-web-ejbs.jar#tempdb") EntityManager injectedEntityManager;
+   @PersistenceUnit(unitName="../dd-web-ejbs.jar#tempdb") EntityManagerFactory injectedEntityManagerFactory;
+   @Resource int nonOverridentConstant = 5;
+   @Resource(name="overridenConstant") int overridenConstant = 1;
+   @Resource UserTransaction tx;
+
+%>
+
+<html>
+<body>
+<%
+   System.out.println("HERE!!!!!!!!!!!!!!!!!!!!!!!!");
+   String access = injectedSession30.access();
+   System.out.println("After injectSession30.access() HERE!!!!!!!!!!!!!!!!!!!!!!!!");
+
+   Address address = new Address();
+   address.setStreet("Clarendon Street");
+   address.setCity("Boston");
+   address.setState("MA");
+   address.setZip("02116");
+
+   Address address2 = new Address();
+   address.setStreet("Clarendon Street");
+   address.setCity("Boston");
+   address.setState("MA");
+   address.setZip("02116");
+
+   Address address3 = new Address();
+   address.setStreet("Clarendon Street");
+   address.setCity("Boston");
+   address.setState("MA");
+   address.setZip("02116");
+
+   //tx = (UserTransaction)ctx.lookup("UserTransaction");
+   EntityManager em = injectedEntityManagerFactory.createEntityManager();
+   tx.begin();
+   injectedEntityManager.persist(address2);
+   em.persist(address3);
+   tx.commit();
+   em.close();
+%>
+<h1>Test passed!</h1>
+</body>
+</html>
\ No newline at end of file

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSMDBBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSMDBBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSMDBBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.jca.inflowmdb;
+
+import org.jboss.logging.Logger;
+import org.jboss.annotation.ejb.ResourceAdapter;
+
+import javax.ejb.MessageDriven;
+import javax.ejb.ActivationConfigProperty;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ *
+ * @version <tt>$Revision: 46471 $</tt>
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+ at MessageDriven(activationConfig =
+{
+ at ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+ at ActivationConfigProperty(propertyName="destination", propertyValue="queue/mdbtest"),
+ at ActivationConfigProperty(propertyName="maxSession", propertyValue="1")
+})
+ at ResourceAdapter("jms-ra.rar")
+public class JMSMDBBean implements MessageListener
+{
+   private static final Logger log = Logger.getLogger(JMSMDBBean.class);
+
+   public static boolean called = false;
+   
+   public void onMessage(Message recvMsg)
+   {
+      log.info("************** here!!!!");
+      called = true;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTest.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTest.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTest.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.jca.inflowmdb;
+
+import javax.ejb.Remote;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 44837 $
+ */
+ at Remote
+public interface JMSTest
+{
+   boolean wasCalled();
+
+   void clearCalled();
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTestBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTestBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/JMSTestBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.jca.inflowmdb;
+
+import javax.ejb.Stateless;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 44837 $
+ */
+ at Stateless
+public class JMSTestBean implements JMSTest
+{
+   public boolean wasCalled()
+   {
+      return JMSMDBBean.called;
+   }
+
+   public void clearCalled()
+   {
+       JMSMDBBean.called = false;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,67 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.jca.inflowmdb;
+
+import javax.ejb.Stateless;
+import javax.ejb.Remote;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.ejb3.InitialContextFactory;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 45712 $
+ */
+ at Stateless
+ at Remote(StatelessRemote.class)
+public class StatelessBean implements StatelessRemote
+{
+   private static final Logger log = Logger.getLogger(StatelessBean.class);
+     
+   public void sendMessage() throws Exception
+   {
+      QueueConnection cnn = null;
+      QueueSender sender = null;
+      QueueSession session = null;
+      
+      InitialContext jndiContext = InitialContextFactory.getInitialContext();
+
+      Queue queue = (Queue) jndiContext.lookup("queue/mdbtest");
+      QueueConnectionFactory factory = (QueueConnectionFactory) jndiContext.lookup("java:/ConnectionFactory");
+      cnn = factory.createQueueConnection();
+      session = cnn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+
+      TextMessage msg = session.createTextMessage("Hello World");
+
+      sender = session.createSender(queue);
+      
+      sender.send(msg);
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessRemote.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessRemote.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/jca/inflowmdb/StatelessRemote.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,31 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.jca.inflowmdb;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 45479 $
+ */
+public interface StatelessRemote
+{
+   void sendMessage() throws Exception;
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/DlqTestMDB.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/DlqTestMDB.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/DlqTestMDB.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,50 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.mdb;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version <tt>$Revision: 46536 $</tt>
+ */
+ at MessageDriven(activationConfig =
+        {
+        @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+        @ActivationConfigProperty(propertyName="destination", propertyValue="queue/dlqtest"),
+        @ActivationConfigProperty(propertyName="dLQMaxResent", propertyValue="1")
+        })
+public class DlqTestMDB implements MessageListener
+{
+   private static final Logger log = Logger.getLogger(DlqTestMDB.class);
+   
+   public void onMessage(Message message)
+   { 
+      System.out.println("*** DlqTestMDB onMessage ");
+      throw new RuntimeException("force resend");
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/LocalStatelessBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/LocalStatelessBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/LocalStatelessBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,46 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.mdb;
+
+import javax.ejb.Stateless;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 46471 $
+ */
+ at Stateless(name="LocalStateless")
+public class LocalStatelessBean implements org.jboss.ejb3.test.mdb.Stateless
+{
+   private static String state = null;
+
+   public String getState()
+   {
+      return state;
+   }
+
+   public void setState(String state)
+   {
+      this.state = state;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideDefaultedQueueTestMDB.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideDefaultedQueueTestMDB.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/mdb/OverrideDefaultedQueueTestMDB.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,63 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.mdb;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import javax.annotation.security.RunAs;
+import javax.annotation.Resource;
+
+import org.jboss.annotation.ejb.DefaultActivationSpecs;
+import org.jboss.annotation.security.SecurityDomain;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 46009 $
+ */
+ at DefaultActivationSpecs({
+      @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Bogus")
+      })
+ at MessageDriven(activationConfig =
+        {
+        @ActivationConfigProperty(propertyName="destination", propertyValue="queue/overridedefaultedmdbtest")
+        })
+ at RunAs("TestRole")
+ at SecurityDomain("other")
+public class OverrideDefaultedQueueTestMDB implements MessageListener
+{
+   private static final Logger log = Logger.getLogger(DefaultedQueueTestMDB.class);
+   @Resource MessageDrivenContext ctx;
+
+   public void onMessage(Message recvMsg)
+   {
+      if (ctx == null) throw new RuntimeException("FAILED ON CTX LOOKUP");
+      System.out.println("*** OverrideDefaultedQueueTestMDB onMessage");
+      TestStatusBean.overrideDefaultedQueueRan++;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyException.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyException.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyException.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,38 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.regression.ejbthree485;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo at nerdnet.nl">Carlo de Wolf</a>
+ * @version $Revision: 45000 $
+ */
+public class MyException extends Exception
+{
+   private static final long serialVersionUID = 1L;
+
+   public MyException(String message)
+   {
+      super(message);
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyRemote.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyRemote.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/MyRemote.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,39 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.regression.ejbthree485;
+
+import java.io.Serializable;
+
+import javax.ejb.Remote;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo at nerdnet.nl">Carlo de Wolf</a>
+ * @version $Revision: 46054 $
+ */
+ at Remote
+public interface MyRemote //extends Serializable
+{
+   void giveMeAnException() throws MyException;
+   void giveMeARuntimeException();
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/StatelessBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/StatelessBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/StatelessBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,42 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.regression.ejbthree485;
+
+import javax.ejb.Stateless;
+
+/**
+ * For EJBTHREE-485 unit test
+ *
+ * @author <a href="mailto:carlo at nerdnet.nl">Carlo de Wolf</a>
+ * @version $Revision: 45000 $
+ */
+ at Stateless
+public class StatelessBean implements MyRemote
+{
+   public void giveMeAnException() throws MyException {
+      throw new MyException("Here you are");
+   }
+   
+   public void giveMeARuntimeException() {
+      throw new RuntimeException("Sure, no problem");
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/unit/ClassNameTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/unit/ClassNameTestCase.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree485/unit/ClassNameTestCase.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,98 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.regression.ejbthree485.unit;
+
+import java.rmi.RMISecurityManager;
+
+import javax.naming.Context;
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.regression.ejbthree485.MyException;
+import org.jboss.ejb3.test.regression.ejbthree485.MyRemote;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo at nerdnet.nl">Carlo de Wolf</a>
+ * @version $Revision: 46054 $
+ */
+public class ClassNameTestCase extends JBossTestCase
+{
+   public ClassNameTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testException() throws Exception {
+      Context ctx = getInitialContext();
+      MyRemote remote = (MyRemote) ctx.lookup("StatelessBean/remote");
+      try {
+         remote.giveMeAnException();
+         
+         fail("expected an exception");
+      }
+      catch(MyException e) {
+         e.printStackTrace();
+         
+         StackTraceElement stackTrace[] = e.getStackTrace();
+         int i = 0;
+         while(i < stackTrace.length && !stackTrace[i].getClassName().equals(ClassNameTestCase.class.getName()))
+            i++;
+         //assertTrue(i < stackTrace.length); // let's error if this happens
+         i--;
+         String actual = stackTrace[i].getClassName();
+         String expected = "?";
+         assertFalse("class name must not start with $Proxy", actual.startsWith("$Proxy"));
+         assertEquals(expected, actual);
+         return;
+      }
+   }
+   
+   public void testRuntimeException() throws Exception {
+      Context ctx = getInitialContext();
+      MyRemote remote = (MyRemote) ctx.lookup("StatelessBean/remote");
+      try {
+         remote.giveMeARuntimeException();
+         
+         fail("expected an exception");
+      }
+      catch(RuntimeException re) {
+         Throwable e = re.getCause();
+         StackTraceElement stackTrace[] = e.getStackTrace();
+         int i = 0;
+         while(i < stackTrace.length && !stackTrace[i].getClassName().equals(ClassNameTestCase.class.getName()))
+            i++;
+         //assertTrue(i < stackTrace.length); // let's error if this happens
+         i--;
+         String actual = stackTrace[i].getClassName();
+         String expected = "?";
+         assertFalse("class name must not start with $Proxy", actual.startsWith("$Proxy"));
+         assertEquals(expected, actual);
+      }
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(ClassNameTestCase.class, "ejbthree485.jar");
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/Calculator.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/Calculator.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/Calculator.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,38 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.regression.ejbthree620;
+
+import javax.ejb.Remote;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 46056 $
+ */
+ at Remote
+public interface Calculator
+{
+   int add(int a, int b);
+   
+   int performAddition(int a, int b);
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/CalculatorBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/CalculatorBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/CalculatorBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,53 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.regression.ejbthree620;
+
+import javax.ejb.EJB;
+//import javax.ejb.EJBException;
+import javax.ejb.Stateless;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 46096 $
+ */
+ at Stateless
+public class CalculatorBean implements Calculator
+{
+   @EJB(beanInterface=Calculator.class) Object other;
+//   @EJB(businessInterface=Calculator.class) Object deprecatedOther;
+   
+   public int add(int a, int b)
+   {
+      int result1 = ((Calculator) other).performAddition(a, b);
+//      int result2 = ((Calculator) deprecatedOther).performAddition(a, b);
+//      if(result1 != result2)
+//         throw new EJBException("something horrible happened");
+      return result1;
+   }
+
+   public int performAddition(int a, int b)
+   {
+      return a + b;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/unit/EJBBeanInterfaceTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/unit/EJBBeanInterfaceTestCase.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree620/unit/EJBBeanInterfaceTestCase.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,54 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.regression.ejbthree620.unit;
+
+import javax.naming.Context;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.regression.ejbthree620.Calculator;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 46056 $
+ */
+public class EJBBeanInterfaceTestCase extends JBossTestCase
+{
+   public EJBBeanInterfaceTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testAddition() throws Exception {
+      Context ctx = getInitialContext();
+      Calculator calculator = (Calculator) ctx.lookup("CalculatorBean/remote");
+      assertEquals(3, calculator.add(1, 2));
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(EJBBeanInterfaceTestCase.class, "ejbthree620.jar");
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/Silly.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/Silly.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/Silly.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.regression.ejbthree625;
+
+import javax.ejb.Remote;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 45664 $
+ */
+ at Remote
+public interface Silly
+{
+   int add(int x, int y);
+
+   int sub(int x, int y);
+
+   void clear();
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/SillyBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/SillyBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/SillyBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.regression.ejbthree625;
+
+import javax.ejb.Stateless;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 45664 $
+ */
+ at Stateless
+public class SillyBean implements Silly
+{
+   public int add(int x, int y)
+   {
+      if (StupidInterceptor.count != 1) throw new RuntimeException("count is wrong: " + StupidInterceptor.count);
+      return x + y;
+   }
+
+   public int sub(int x, int y)
+   {
+      if (StupidInterceptor.count != 1) throw new RuntimeException("count is wrong: " + StupidInterceptor.count);
+      return x-y;
+   }
+
+   public void clear()
+   {
+      StupidInterceptor.count = 0;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/StupidInterceptor.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/StupidInterceptor.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/StupidInterceptor.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.regression.ejbthree625;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 45664 $
+ */
+public class StupidInterceptor
+{
+   public static int count = 0;
+   @AroundInvoke
+   public Object intercept(InvocationContext ic) throws Exception
+   {
+       count++;
+       return ic.proceed();
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/unit/Ejb625UnitTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/unit/Ejb625UnitTestCase.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree625/unit/Ejb625UnitTestCase.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.regression.ejbthree625.unit;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.ejb3.test.regression.ejbthree290.DAO;
+import org.jboss.ejb3.test.regression.ejbthree290.MyEntity;
+import org.jboss.ejb3.test.regression.ejbthree290.unit.Ejb290UnitTestCase;
+import org.jboss.ejb3.test.regression.ejbthree625.Silly;
+import junit.framework.Test;
+
+/**
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: Ejb625UnitTestCase.java 45664 2006-06-19 14:13:44Z bill $
+ */
+
+public class Ejb625UnitTestCase
+extends JBossTestCase
+{
+   org.apache.log4j.Category log = getLog();
+
+   static boolean deployed = false;
+   static int test = 0;
+
+   public Ejb625UnitTestCase(String name)
+   {
+
+      super(name);
+
+   }
+
+   public void testDefaultInterceptors() throws Exception
+   {
+      Silly silly = (Silly)getInitialContext().lookup("SillyBean/remote");
+      assertEquals(2, silly.add(1, 1));
+      silly.clear();
+      assertEquals(0, silly.sub(1, 1));
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(Ejb625UnitTestCase.class, "regression-ejbthree625-test.jar");
+   }
+
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree653;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateful21 extends EJBObject
+{
+   String sayHelloTo(String name) throws RemoteException;
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Bean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Bean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Bean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree653;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJB;
+import javax.ejb.EJBException;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at Remote(MyStateful21.class)
+ at RemoteHome(MyStateful21Home.class)
+public class MyStateful21Bean implements SessionBean
+{
+   private static final long serialVersionUID = 1L;
+
+   @SuppressWarnings("unused")
+   private static final Logger log = Logger.getLogger(MyStateful21Bean.class);
+   
+   @EJB
+   private MyStateless delegate;
+   
+   public void ejbActivate() throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbPassivate() throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbRemove() throws EJBException, RemoteException
+   {
+   }
+
+   public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+   {
+   }
+
+   public String sayHelloTo(String name)
+   {
+      return delegate.sayHelloTo(name);
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Home.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Home.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateful21Home.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree653;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateful21Home extends EJBHome
+{
+   MyStateful21 create() throws CreateException, RemoteException;
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateless.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateless.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStateless.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree653;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateless
+{
+   String sayHelloTo(String name);
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStatelessBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStatelessBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/MyStatelessBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree653;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(MyStateless.class)
+public class MyStatelessBean
+{
+   private static long currentThreadId;
+   
+   /**
+    * EJBCreate method.
+    */
+   @PostConstruct
+   public void ejb3Create() 
+   {
+      System.out.println("New SessionBean " + this);
+      System.out.println("Thread " + Thread.currentThread().getId());
+      //setupBean();
+      if(currentThreadId == 0)
+      {
+         currentThreadId = Thread.currentThread().getId();
+      }
+      else
+      {
+         if(Thread.currentThread().getId() == currentThreadId)
+         {
+            throw new IllegalStateException("no new instance should be created");
+         }
+         else
+         {
+            // could happen with remoting 2.0
+            currentThreadId = Thread.currentThread().getId();
+         }
+      }
+   } 
+   
+   public String sayHelloTo(String name)
+   {
+      return "Hi " + name;
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/unit/PoolingSLBSTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/unit/PoolingSLBSTestCase.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree653/unit/PoolingSLBSTestCase.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree653.unit;
+
+import java.util.Date;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.regression.ejbthree653.MyStateful21;
+import org.jboss.ejb3.test.regression.ejbthree653.MyStateful21Home;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PoolingSLBSTestCase extends JBossTestCase
+{
+
+   public PoolingSLBSTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test1() throws Exception
+   {
+      MyStateful21Home home = (MyStateful21Home) getInitialContext().lookup("MyStateful21Bean/remoteHome");
+      MyStateful21 session = home.create();
+      for(int i = 0; i < 1000; i++)
+      {
+         String me = new Date().toString();
+         String expected = "Hi " + me;
+         String actual = session.sayHelloTo(me);
+         assertEquals(expected, actual);
+      }
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(PoolingSLBSTestCase.class, "ejbthree653.jar");
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree670;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateful
+{
+   void remove();
+   void setName(String name);
+   String sayHello();
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree670;
+
+import javax.ejb.EJBObject;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateful21 extends EJBObject, MyStateful
+{
+
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Bean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Bean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Bean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree670;
+
+import java.rmi.RemoteException;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.EJBException;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.Remove;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateful;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at Remote(MyStateful21.class)
+ at RemoteHome(MyStateful21Home.class)
+public class MyStateful21Bean implements SessionBean
+{
+   private static final Logger log = Logger.getLogger(MyStateful21Bean.class);
+   
+   private String name;
+   private int preDestroyCalls = 0;
+   
+   public void ejbActivate() throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbPassivate() throws EJBException, RemoteException
+   {
+   }
+
+   public void ejbRemove() throws EJBException, RemoteException
+   {
+      log.info("remove");
+   }
+
+   public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+   {
+   }
+
+   @PreDestroy
+   public void preDestroy()
+   {
+      //new Exception().printStackTrace();
+      preDestroyCalls++;
+      log.info("pre destroy");
+      if(preDestroyCalls > 1)
+         throw new IllegalStateException("pre destroy called multiple times");
+   }
+   
+   public String sayHello()
+   {
+      return "Hi " + name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Home.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Home.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStateful21Home.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree670;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateful21Home extends EJBHome
+{
+   MyStateful21 create() throws CreateException, RemoteException;
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStatefulBean.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStatefulBean.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/MyStatefulBean.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree670;
+
+import javax.annotation.PreDestroy;
+import javax.ejb.Remote;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+import org.jboss.annotation.ejb.cache.Cache;
+import org.jboss.ejb3.cache.simple.SimpleStatefulCache;
+import org.jboss.logging.Logger;
+
+/**
+ * Test how many times pre destroy is called.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at Remote(MyStateful.class)
+public class MyStatefulBean implements MyStateful
+{
+   private static final Logger log = Logger.getLogger(MyStatefulBean.class);
+   
+   private String name;
+   private int preDestroyCalls = 0;
+   
+   @PreDestroy
+   public void preDestroy()
+   {
+      preDestroyCalls++;
+      log.info("pre destroy");
+      if(preDestroyCalls > 1)
+         throw new IllegalStateException("pre destroy called multiple times");
+   }
+   
+   @Remove
+   public void remove()
+   {
+      log.info("remove");
+   }
+   
+   public String sayHello()
+   {
+      return "Hi " + name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/unit/PreDestroyCallsTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/unit/PreDestroyCallsTestCase.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/regression/ejbthree670/unit/PreDestroyCallsTestCase.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.regression.ejbthree670.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.regression.ejbthree670.MyStateful;
+import org.jboss.ejb3.test.regression.ejbthree670.MyStateful21;
+import org.jboss.ejb3.test.regression.ejbthree670.MyStateful21Home;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PreDestroyCallsTestCase extends JBossTestCase
+{
+
+   public PreDestroyCallsTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void test1() throws Exception
+   {
+      MyStateful session = (MyStateful) getInitialContext().lookup("MyStatefulBean/remote");
+      session.setName("Test");
+      String actual = session.sayHello();
+      assertEquals("Hi Test", actual);
+      try
+      {
+         session.remove();
+      }
+      catch(RuntimeException e)
+      {
+         if(e.getCause().getMessage().equals("pre destroy called multiple times"))
+            fail("pre destroy called multiple times");
+         throw e;
+      }
+   }
+   
+   public void test21() throws Exception
+   {
+      MyStateful21Home home = (MyStateful21Home) getInitialContext().lookup("MyStateful21Bean/remoteHome");
+      MyStateful21 session = home.create();
+      session.setName("Test");
+      String actual = session.sayHello();
+      assertEquals("Hi Test", actual);
+      try
+      {
+         session.remove();
+      }
+      catch(RuntimeException e)
+      {
+         if(e.getCause().getMessage().equals("pre destroy called multiple times"))
+            fail("pre destroy called multiple times");
+         throw e;
+      }
+   }
+   
+   public void testRemoveByHandle() throws Exception
+   {
+      MyStateful21Home home = (MyStateful21Home) getInitialContext().lookup("MyStateful21Bean/remoteHome");
+      MyStateful21 session = home.create();
+      session.setName("Test");
+      String actual = session.sayHello();
+      assertEquals("Hi Test", actual);
+      try
+      {
+         home.remove(session.getHandle());
+      }
+      catch(RuntimeException e)
+      {
+         if(e.getCause().getMessage().equals("pre destroy called multiple times"))
+            fail("pre destroy called multiple times");
+         throw e;
+      }
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(PreDestroyCallsTestCase.class, "ejbthree670.jar");
+   }
+}

Added: branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/NestedBeanUnitTestCase.java
===================================================================
--- branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/NestedBeanUnitTestCase.java	2006-09-08 03:18:53 UTC (rev 56634)
+++ branches/Branch_4_0/ejb3/src/test/org/jboss/ejb3/test/stateful/unit/NestedBeanUnitTestCase.java	2006-09-08 03:28:03 UTC (rev 56635)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package org.jboss.ejb3.test.stateful.unit;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.ejb3.test.stateful.nested.ParentStatefulRemote;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.Date;
+
+import junit.framework.Test;
+
+/**
+ * Test nested SFSB for repeated passivation
+ *
+ * @author  Ben.Wang at jboss.org
+ * @version $Revision: 45372 $
+ */
+public class NestedBeanUnitTestCase extends JBossTestCase
+{
+   static boolean deployed = false;
+   public static int test = 0;
+   static Date startDate = new Date();
+
+   protected final String namingFactory =
+   System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
+
+   protected final String providerURL =
+   System.getProperty(Context.PROVIDER_URL);
+
+   public NestedBeanUnitTestCase (String name)
+   {
+      super(name);
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(NestedBeanUnitTestCase.class, "stateful-test.jar");
+   }
+
+   public void testBasic()
+   throws Exception
+   {
+      getLog().debug(++NestedBeanUnitTestCase.test +"- "
+              +"Trying the context...");
+
+      // Connect to the server0 JNDI
+      InitialContext ctx = getInitialContext();
+
+      getLog().debug("Test Stateful Bean");
+      getLog().debug("==================================");
+      getLog().debug(++NestedBeanUnitTestCase.test +"- "
+              +"Looking up testBasic...");
+      ParentStatefulRemote stateful = (ParentStatefulRemote) ctx.lookup("testParentStateful/remote");
+
+      assertEquals("Counter: ", 1, stateful.increment());
+      assertEquals("Counter: ", 2, stateful.increment());
+
+      stateful.remove();
+      getLog().debug("ok");
+   }
+
+   public void testStatefulPassivation()
+   throws Exception
+   {
+      getLog().debug(++NestedBeanUnitTestCase.test +"- "+"Trying the context...");
+
+      InitialContext ctx = getInitialContext();
+
+      getLog().debug("Test Stateful Bean passivation");
+      getLog().debug("==================================");
+      getLog().debug(++NestedBeanUnitTestCase.test +"- "
+              +"Looking up testParentStateful...");
+      ParentStatefulRemote stateful = (ParentStatefulRemote) ctx.lookup("testParentStateful/remote");
+
+      assertEquals("Counter: ", 1, stateful.increment());
+      assertEquals("Counter: ", 2, stateful.increment());
+      _sleep(10000);  // should passivated
+
+      assertEquals("Counter: ", 3, stateful.increment());
+      assertEquals("Counter: ", 4, stateful.increment());
+      assertEquals(1, stateful.getPrePassivate());
+      assertEquals(1, stateful.getPostActivate());
+
+      stateful.remove();
+      getLog().debug("ok");
+   }
+
+   public void testStatefulRepeatedPassivation()
+   throws Exception
+   {
+      getLog().debug(++NestedBeanUnitTestCase.test +"- "+"Trying the context...");
+
+      InitialContext ctx = getInitialContext();
+
+      getLog().debug("Test Stateful Bean passivation");
+      getLog().debug("==================================");
+      getLog().debug(++NestedBeanUnitTestCase.test +"- "
+              +"Looking up testParentStateful...");
+      ParentStatefulRemote stateful = (ParentStatefulRemote) ctx.lookup("testParentStateful/remote");
+      stateful.reset();
+
+      assertEquals("Counter: ", 1, stateful.increment());
+      assertEquals("Counter: ", 2, stateful.increment());
+      _sleep(10000);  // should passivated
+
+      assertEquals("Counter: ", 3, stateful.increment());
+      assertEquals("Counter: ", 4, stateful.increment());
+      assertEquals(1, stateful.getPrePassivate());
+      assertEquals(1, stateful.getPostActivate());
+      _sleep(10000);  // should passivated
+
+      assertEquals("Counter: ", 5, stateful.increment());
+      assertEquals("Counter: ", 6, stateful.increment());
+      assertEquals(2, stateful.getPrePassivate());
+      assertEquals(2, stateful.getPostActivate());
+
+      stateful.remove();
+      getLog().debug("ok");
+   }
+
+   protected void _sleep(long time)
+   {
+      try {
+         Thread.sleep(time);
+      } catch (InterruptedException e) {
+         e.printStackTrace();
+      }
+   }
+}




More information about the jboss-cvs-commits mailing list