User: peter   
  Date: 01/01/03 20:43:57

  Modified:    src/main/org/jboss/test/cts/ejb StatefulSessionBean.java
  Log:
  Added tests for SessionContext and SessionSynchronization.
  
  Revision  Changes    Path
  1.4       +25 -7     
jbosstest/src/main/org/jboss/test/cts/ejb/StatefulSessionBean.java
  
  Index: StatefulSessionBean.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jbosstest/src/main/org/jboss/test/cts/ejb/StatefulSessionBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StatefulSessionBean.java  2000/12/21 04:42:41     1.3
  +++ StatefulSessionBean.java  2001/01/04 04:43:57     1.4
  @@ -14,11 +14,11 @@
    *
    *   @see <related>
    *   @author $Author: peter $
  - *   @version $Revision: 1.3 $
  + *   @version $Revision: 1.4 $
    */
   
   public class StatefulSessionBean
  -   extends SessionSupport
  +   extends SessionSupport implements SessionSynchronization
   {
      private int counter;
   
  @@ -35,6 +35,22 @@
      {
      }
   
  +    public void afterBegin( )
  +    {
  +     System.out.println( "Calling afterBegin( )..." );
  +    }
  +
  +    public void afterCompletion(boolean isCommited)
  +    {
  +     System.out.println( "Calling afterCompletion( )" );
  +     System.out.println( "isCommited = " + isCommited );
  +    }
  +
  +    public void beforeCompletion( )
  +    {
  +     System.out.println( "Calling beforeCompletion( )..." );
  +    }
  +
      /**
       * Method method1
       *
  @@ -121,14 +137,16 @@
         Class homeInterface = sessionCtx.getEJBHome().getClass();
   
         ctx.homeInterface = homeInterface.getName();
  -
  -      System.out.println("Getting CallerPrincipal...");
   
  -      Principal principal = sessionCtx.getCallerPrincipal();
  +      //System.out.println("Getting CallerPrincipal...");
  +      //Principal principal = sessionCtx.getCallerPrincipal();
  +      //ctx.principleName = principal.getName();
  +      //ctx.isCallerInRole = sessionCtx.isCallerInRole();
   
  -      ctx.principleName = principal.getName();
  +      System.out.println( "calling setRollbackOnly( ) on context" );
  +      sessionCtx.setRollbackOnly( );
  +      ctx.isRollbackOnly = new Boolean(sessionCtx.getRollbackOnly( ));
   
  -      //ctx.isCallerInRole = sessionCtx.isCallerInRole();
         return ctx;
      }
   }
  
  
  

Reply via email to