[jboss-cvs] JBossAS SVN: r61024 - in branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived: unit and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 1 04:50:26 EST 2007


Author: wolfc
Date: 2007-03-01 04:50:26 -0500 (Thu, 01 Mar 2007)
New Revision: 61024

Modified:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/Contained.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/ContainedBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/HibernateShoppingCartBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/unit/EntityUnitTestCase.java
Log:
EJBTHREE-867: modifed longlived unit test

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/Contained.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/Contained.java	2007-03-01 04:21:04 UTC (rev 61023)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/Contained.java	2007-03-01 09:50:26 UTC (rev 61024)
@@ -29,6 +29,8 @@
  */
 public interface Contained
 {
+   void checkout();
+   
    Customer find(long id);
 
    void setCustomer(long id);

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/ContainedBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/ContainedBean.java	2007-03-01 04:21:04 UTC (rev 61023)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/ContainedBean.java	2007-03-01 09:50:26 UTC (rev 61024)
@@ -26,6 +26,7 @@
 import javax.persistence.PersistenceContextType;
 import javax.persistence.EntityManager;
 import javax.annotation.PreDestroy;
+import javax.ejb.Remove;
 import javax.ejb.Stateful;
 import javax.ejb.PrePassivate;
 import javax.ejb.PostActivate;
@@ -42,6 +43,8 @@
 @CacheConfig(maxSize = 1000, idleTimeoutSeconds = 2)
 public class ContainedBean implements Contained, Serializable
 {
+   private static final long serialVersionUID = 1L;
+
    @PersistenceContext(type= PersistenceContextType.EXTENDED) EntityManager em;
 
    Customer customer;
@@ -94,8 +97,15 @@
    }
 
    @PreDestroy
-   public void destroy()
+   public void preDestroy()
    {
+      System.out.println("ContainedBean.preDestroy");
       destroyed = true;
    }
+   
+   @Remove
+   public void checkout() 
+   {
+      System.out.println("ContainedBean.checkout");
+   }
 }

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/HibernateShoppingCartBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/HibernateShoppingCartBean.java	2007-03-01 04:21:04 UTC (rev 61023)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/HibernateShoppingCartBean.java	2007-03-01 09:50:26 UTC (rev 61024)
@@ -111,9 +111,11 @@
       if (contained.getCustomer() != customer) throw new RuntimeException("not same customer");
    }
 
-
-
-
    @Remove
-   public void checkout() {}
+   public void checkout()
+   {
+      System.out.println("HibernateShoppingCartBean.checkout");
+      // Wolf: with EJBTHREE-896 we become responsible for the lifecycle of nested beans
+      contained.checkout();
+   }
 }

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/unit/EntityUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/unit/EntityUnitTestCase.java	2007-03-01 04:21:04 UTC (rev 61023)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/longlived/unit/EntityUnitTestCase.java	2007-03-01 09:50:26 UTC (rev 61024)
@@ -126,14 +126,16 @@
       assertEquals("Bill Jr.", c.getName());
       test.setContainedCustomer();
       Thread.sleep(6000); // passivation
-      assertTrue(remote.isPassivated());
+      assertTrue("ContainedBean is not passivated", remote.isPassivated());
       test.checkContainedCustomer();  
       test.findAndUpdateStateless();
       test.updateContained();
       remote.clearDestroyed();
+      assertFalse(remote.isDestroyed());
       assertTrue(test.isContainedActivated());
       test.checkout();
-      assertTrue(remote.isDestroyed());
+      System.out.println("remote.isDestroyed = " + remote.isDestroyed());
+      assertTrue("ContainedBean is not destroyed", remote.isDestroyed());
    }
 
    public void testHibernateLongLivedSession() throws Exception




More information about the jboss-cvs-commits mailing list