dobbs       02/04/29 10:45:01

  Modified:    src/test/org/apache/torque BaseTestCase.java
  Log:
  moving the Torque initialization out of the constructor and into a
  setUp method.
  
  Revision  Changes    Path
  1.6       +19 -12    
jakarta-turbine-torque/src/test/org/apache/torque/BaseTestCase.java
  
  Index: BaseTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/test/org/apache/torque/BaseTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BaseTestCase.java 21 Aug 2001 03:40:34 -0000      1.5
  +++ BaseTestCase.java 29 Apr 2002 17:45:01 -0000      1.6
  @@ -62,7 +62,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christopher Elkins</a>
  - * @version $Id: BaseTestCase.java,v 1.5 2001/08/21 03:40:34 dlr Exp $
  + * @version $Id: BaseTestCase.java,v 1.6 2002/04/29 17:45:01 dobbs Exp $
    */
   public abstract class BaseTestCase extends TestCase
   {
  @@ -88,22 +88,29 @@
       public BaseTestCase(String name)
       {
           super(name);
  -        if (!hasInitialized)
  +    }
  +
  +    /**
  +     * Initialize Torque on the first setUp().  Subclasses which
  +     * override setUp() must call super.setUp() as their first action.
  +     */
  +    public void setUp()
  +    {
  +        synchronized (BaseTestCase.class)
           {
  -            synchronized (BaseTestCase.class)
  +            if (!hasInitialized)
               {
  -                if (!hasInitialized)
  +                try
  +                {
  +                    Torque.init(CONFIG_FILE);
  +                    hasInitialized = true;
  +                }
  +                catch (Exception e)
                   {
  -                    try
  -                    {
  -                        Torque.init(CONFIG_FILE);
  -                    }
  -                    catch (Exception e)
  -                    {
  -                        fail("Couldn't initialize Torque: " + e.getMessage());
  -                    }
  +                    fail("Couldn't initialize Torque: " + e.getMessage());
                   }
               }
           }
       }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to