[jboss-cvs] JBossAS SVN: r62132 - in trunk/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:45:42 EDT 2007


Author: adrian at jboss.org
Date: 2007-04-05 10:45:41 -0400 (Thu, 05 Apr 2007)
New Revision: 62132

Modified:
   trunk/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java
   trunk/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java
   trunk/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java
Log:
Port test for JBAS-4304 to head

Modified: trunk/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java	2007-04-05 14:43:43 UTC (rev 62131)
+++ trunk/testsuite/src/main/org/jboss/test/bmp/beans/SimpleBMPBean.java	2007-04-05 14:45:41 UTC (rev 62132)
@@ -1,24 +1,24 @@
 /*
-  * 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.
-  */
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.test.bmp.beans;
 
 import java.rmi.RemoteException;
@@ -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: trunk/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java	2007-04-05 14:43:43 UTC (rev 62131)
+++ trunk/testsuite/src/main/org/jboss/test/bmp/interfaces/SimpleBMP.java	2007-04-05 14:45:41 UTC (rev 62132)
@@ -1,24 +1,24 @@
 /*
-  * 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.
-  */
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.test.bmp.interfaces;
 
 import java.rmi.RemoteException;
@@ -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: trunk/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java	2007-04-05 14:43:43 UTC (rev 62131)
+++ trunk/testsuite/src/main/org/jboss/test/bmp/test/BmpUnitTestCase.java	2007-04-05 14:45:41 UTC (rev 62132)
@@ -1,24 +1,24 @@
 /*
-  * 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.
-  */
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
 package org.jboss.test.bmp.test;
 
 import java.util.Iterator;
@@ -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