1   //----------------------------------------------------------------------
2   // 
3   // PerfectJPattern: "Design patterns are good but components are better!" 
4   // TestJtaTransactionStrategy.java Copyright (c) 2009 Giovanni Azua Garcia
5   // bravegag@hotmail.com
6   //  
7   // This program is free software; you can redistribute it and/or
8   // modify it under the terms of the GNU General Public License
9   // as published by the Free Software Foundation; either version 3
10  // of the License, or (at your option) any later version.
11  //
12  // This program is distributed in the hope that it will be useful,
13  // but WITHOUT ANY WARRANTY; without even the implied warranty of
14  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  // GNU General Public License for more details.
16  //
17  // You should have received a copy of the GNU General Public License
18  // along with this program; if not, see <http://www.gnu.org/licenses/>.
19  //
20  //----------------------------------------------------------------------
21  package org.perfectjpattern.jee.integration.dao;
22  
23  import junit.framework.*;
24  
25  import org.perfectjpattern.jee.api.integration.dao.*;
26  
27  /**
28   * Test suite for the {@link JtaTransactionStrategy} implementation
29   * 
30   * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
31   * @version $Revision: 1.0 $Date: Feb 20, 2009 3:48:46 AM $
32   */
33  public 
34  class TestJtaTransactionStrategy
35  extends TestCase
36  {
37      //------------------------------------------------------------------------
38      // public
39      //------------------------------------------------------------------------
40      public void
41      testGetTransaction()
42      {
43          System.setProperty("log4j.category.OpenEJB", "debug"); 
44          
45          ITransactionStrategy myTransactionStrategy = 
46              new JtaTransactionStrategy();
47  
48          assertNotNull("TransactionStrategy must not be null", 
49              myTransactionStrategy);
50          
51          // TODO: fails with javax.naming.NameNotFoundException
52          // "java:comp/UserTransaction" seems to be a bug in OpenEJB        
53          // http://issues.apache.org/jira/browse/OPENEJB-960
54          // additionally I get the following popping out in the logs
55          // ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider 
56          // requested installation of a ClassFileTransformer which requires a 
57          // JavaAgent.  See http://openejb.apache.org/3.0/javaagent.html
58          
59  //        ITransaction myTransaction = myTransactionStrategy.getTransaction();
60  //        
61  //        assertNotNull("Transaction must not be null", myTransaction);
62  //        
63  //        myTransaction.begin();
64  //        
65  //        myTransaction.rollback();
66      }
67  }