[jboss-cvs] JBossAS SVN: r62131 - in branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp: interfaces and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 5 10:43:43 EDT 2007
Author: adrian at jboss.org
Date: 2007-04-05 10:43:43 -0400 (Thu, 05 Apr 2007)
New Revision: 62131
Modified:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java
Log:
Port test for JBAS-4304 to JBoss-4.2
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java 2007-04-05 14:41:12 UTC (rev 62130)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java 2007-04-05 14:43:43 UTC (rev 62131)
@@ -40,6 +40,7 @@
import javax.sql.DataSource;
import org.jboss.logging.Logger;
+import org.jboss.test.bmp.interfaces.SimpleBMPHome;
public class SimpleBMPBean implements EntityBean
{
@@ -53,6 +54,8 @@
// bmp fields
Integer id;
String name;
+ boolean ejbStoreInvoked = false;
+ boolean tempEjbStoreInvoked = false;
public Integer ejbCreate (int _id, String _name)
throws CreateException, RemoteException
@@ -162,6 +165,19 @@
throws CreateException, RemoteException
{
log.debug ("ejbPostCreate (int, String) called");
+
+ tempEjbStoreInvoked = false;
+ // Do a find all to see whether ejbStore gets invoked
+ SimpleBMPHome home = (SimpleBMPHome) ctx.getEJBHome();
+ try
+ {
+ home.findAll();
+ }
+ catch (FinderException e)
+ {
+ throw new RemoteException("Unexpected error invoking findAll", e);
+ }
+ ejbStoreInvoked = tempEjbStoreInvoked;
}
public void ejbPostCreateMETHOD (int _id, String _name)
@@ -209,6 +225,7 @@
public void ejbStore ()
{
log.debug ("ejbStore () called " + this);
+ tempEjbStoreInvoked = true;
Connection con = null;
try
@@ -405,5 +422,8 @@
return name;
}
-
+ public boolean isEjbStoreInvoked()
+ {
+ return ejbStoreInvoked;
+ }
}
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java 2007-04-05 14:41:12 UTC (rev 62130)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java 2007-04-05 14:43:43 UTC (rev 62131)
@@ -30,4 +30,5 @@
public void setName (String _name) throws RemoteException;
public String getName () throws RemoteException;
Integer getIdViaEJBObject() throws RemoteException;
+ boolean isEjbStoreInvoked() throws RemoteException;
}
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java 2007-04-05 14:41:12 UTC (rev 62130)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java 2007-04-05 14:43:43 UTC (rev 62131)
@@ -134,6 +134,9 @@
it = home.findAll ().iterator ();
while (it.hasNext ())
((SimpleBMP)it.next ()).remove ();
+
+ SimpleBMP b2 = home.create(200, "Dave");
+ assertFalse("ejbStore() should not be invoked during ejbPostCreate()", b2.isEjbStoreInvoked());
}
finally
{
More information about the jboss-cvs-commits
mailing list