User: fleury  
  Date: 00/09/07 22:17:02

  Modified:    src/java/org/jboss/zol/testbean/bean
                        StatelessSessionBean.java
  Log:
  Test Transactions from Stateless bean
  
  Revision  Changes    Path
  1.8       +34 -25    
zola/src/java/org/jboss/zol/testbean/bean/StatelessSessionBean.java
  
  Index: StatelessSessionBean.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/zola/src/java/org/jboss/zol/testbean/bean/StatelessSessionBean.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StatelessSessionBean.java 2000/08/29 22:10:29     1.7
  +++ StatelessSessionBean.java 2000/09/08 05:17:02     1.8
  @@ -35,12 +35,21 @@
   
     public void setSessionContext(SessionContext context) throws RemoteException {
       sessionContext = context;
  -     //Exception e = new Exception("in set Session context");
  -     //e.printStackTrace();
  +    //Exception e = new Exception("in set Session context");
  +    //e.printStackTrace();
     }
   
     public void callBusinessMethodA() {
         //Do nothing just make sure the call works
  +        
  +      try {
  +         Object tx = ((javax.transaction.TransactionManager) new 
InitialContext().lookup("TransactionManager")).getTransaction();
  +         if (tx == null) 
  +           System.out.println("I don't see a transaction");
  +         else
  +           System.out.println("I see a transaction "+tx.hashCode());
  +      }
  +      catch (Exception e) {e.printStackTrace();}
         System.out.println("StatelessSessionBean.callBusinessMethodA() called");
      }
   
  @@ -56,18 +65,18 @@
     }
   
     public String callBusinessMethodB(String words) {
  -          // test if overloaded methods are properly called
  -          System.out.println("StatelessSessionBean.callBusinessMethodB(String) 
called");
  +         // test if overloaded methods are properly called
  +         System.out.println("StatelessSessionBean.callBusinessMethodB(String) 
called");
            // Check that my EJBObject is there
  -              EJBObject ejbObject = sessionContext.getEJBObject();
  -              if (ejbObject == null) {
  -                      return "ISNULL:NOT FOUND!!!!!";
  -             
  -              }
  -              else {
  -                     return "OK ejbObject is "+ejbObject.toString()+" words "+words;
  -                     
  -              }                       
  +        EJBObject ejbObject = sessionContext.getEJBObject();
  +        if (ejbObject == null) {
  +          return "ISNULL:NOT FOUND!!!!!";
  +       
  +        }
  +        else {
  +         return "OK ejbObject is "+ejbObject.toString()+" words "+words;
  +         
  +        }                     
     
     }
   
  @@ -88,26 +97,26 @@
     }
     
     public String callBusinessMethodE() {
  -              System.out.println("StatelessSessionBean.callBusinessMethodE() 
called");
  +        System.out.println("StatelessSessionBean.callBusinessMethodE() called");
            // Check that my EJBObject is there
  -              EJBObject ejbObject = sessionContext.getEJBObject();
  -              if (ejbObject == null) {
  -                      return "ISNULL:NOT FOUND!!!!!";
  -              }
  -              else {
  -                     return ejbObject.toString();
  -              }                       
  +        EJBObject ejbObject = sessionContext.getEJBObject();
  +        if (ejbObject == null) {
  +          return "ISNULL:NOT FOUND!!!!!";
  +        }
  +        else {
  +         return ejbObject.toString();
  +        }                     
     }
     
      public void testClassLoading() throws BusinessMethodException {
          System.out.println("StatelessSessionBean.testClassLoading() called");
          
           try{
  -                     Class.forName("org.somepackage.SomeClass");
  -             } catch( Exception e){
  -                 e.printStackTrace();
  +            Class.forName("org.somepackage.SomeClass");
  +        } catch( Exception e){
  +            e.printStackTrace();
               throw new BusinessMethodException();
  -             }
  +        }
     }
     
   }
  
  
  

Reply via email to