User: mnf999  
  Date: 02/01/30 15:06:44

  Modified:    src/main/org/jboss/test/bmp/beans BMPHelperSessionBean.java
  Log:
  Fixed the rollback of transaction test, made no sense before (BMP was doing BMT when 
it can only be CMT)
  
  marcf
  
  Revision  Changes    Path
  1.3       +36 -2     
jbosstest/src/main/org/jboss/test/bmp/beans/BMPHelperSessionBean.java
  
  Index: BMPHelperSessionBean.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosstest/src/main/org/jboss/test/bmp/beans/BMPHelperSessionBean.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BMPHelperSessionBean.java 2001/01/20 16:00:16     1.2
  +++ BMPHelperSessionBean.java 2002/01/30 23:06:44     1.3
  @@ -66,13 +66,47 @@
         try
         {
            sb.append ("now rolling back...\n");
  -         ctx.getUserTransaction().rollback ();
  -         sb.append ("current name is: "+b.getName ()+"\n");
  +         
  +         //marcf FIXME: I don't understand the test below. 
  +         //
  +         // ctx.getUserTransaction().rollback ();
  +         // sb.append ("current name is: "+b.getName ()+"\n");
  +         //
  +         //First of all BMP beans are CMT so 
  +         // you dont' get the "usertransaction" directly, then the proper way to 
rollback 
  +         // is to do a 
  +         // ctx.setRollbackOnly();
  +         // let the call return, let the call rollback in the transaction 
interceptor
  +         // and do a new call to test the value.  Here the sub-call just says that 
  +         // we are trying to access an instance marked for rollback
  +         // This test is void in my mind
  +         // marcf: Fixed with doTestAfterRollback call that should return the right 
name
  +         
  +         ctx.setRollbackOnly();
         }
         catch (Exception _e)
         {
            sb.append ("Error on rolling back: "+_e.getMessage ()+"\n");
         }
  +      sb.append ("done.");
  +   
  +      return sb.toString ();
  +   }
  +   
  +   public String doTestAfterRollback () throws RemoteException
  +   {
  +      StringBuffer sb = new StringBuffer ();
  +      SimpleBMP b;
  +      try
  +      {
  +         SimpleBMPHome home = (SimpleBMPHome) new InitialContext ().lookup 
("java:comp/env/bean");
  +         b = home.findByPrimaryKey(new Integer (1));
  +      }
  +      catch (Exception _ne)
  +      {
  +         throw new EJBException ("couldnt find entity: "+_ne.getMessage ());
  +      }
  +      sb.append ("found: "+b.getName ()+"\n");
         sb.append ("done.");
      
         return sb.toString ();
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to