jvanzyl     01/10/28 10:39:12

  Modified:    .        build-test.xml build.xml default.properties
               src/java/org/apache/torque Torque.java
  Log:
  - more steps toward a complete test bed.
  
  Revision  Changes    Path
  1.4       +63 -18    jakarta-turbine-torque/build-test.xml
  
  Index: build-test.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/build-test.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- build-test.xml    2001/10/27 19:46:51     1.3
  +++ build-test.xml    2001/10/28 18:39:11     1.4
  @@ -2,6 +2,13 @@
   
   <project name="Torque" default="test" basedir=".">
   
  +  <!-- Allow any user specific values to override the defaults -->
  +  <property file="${user.home}/build.properties" />
  +  <!-- Allow user defaults for this project -->
  +  <property file="build.properties" />
  +  <!-- Set default values for the build -->
  +  <property file="default.properties" />
  +
     <!-- ============================================================== -->
     <!-- T O R Q U E  T E S T S                                         -->
     <!-- ============================================================== -->
  @@ -11,6 +18,11 @@
     <target 
       name="test">
       
  +    <copy 
  +      todir="${torque.distDir}/schema"
  +      file="${torque.testSchema}"
  +    />
  +    
       <antcall target="test-generative"/>
       <antcall target="test-runtime"/>
     
  @@ -29,14 +41,14 @@
     <!--                                                                -->
     <!-- These are the tasks that we will be testing:                   -->
     <!--                                                                -->
  +  <!-- project-sql                                                    -->
  +  <!-- project-om                                                     -->
     <!-- project-datadtd                                                -->
     <!-- project-datadump                                               -->
     <!-- project-datasql                                                -->
     <!-- project-jdbc                                                   -->
  -  <!-- project-om                                                     -->
  -  <!-- project-om-classpath                                          -->
  -  <!-- project-sql                                                    -->
     <!-- project-sql-classpath                                          -->
  +  <!-- project-om-classpath                                          -->
     <!-- project-sql2xml                                                -->
     <!--                                                                -->
     <!-- The project-sql is also another complete set of tests:         -->
  @@ -48,50 +60,68 @@
     <target
       name="test-generative">
       
  +    <antcall target="test-project-sql"/>
  +    <antcall target="test-project-om"/>
  +    
  +    <!--
       <antcall target="test-project-datadtd"/>
       <antcall target="test-project-datadump"/>
       <antcall target="test-project-datasql"/>
       <antcall target="test-project-jdbc"/>
  -    <antcall target="test-project-om"/>
  -    <antcall target="test-project-om-classpath"/>
  -    <antcall target="test-project-sql"/>
  +    -->
  +
  +    <!--
       <antcall target="test-project-sql-classpath"/>
  +    <antcall target="test-project-om-classpath"/>
       <antcall target="test-project-sql2xml"/>
  -    
  +    -->
  +
     </target>
   
     <target
  -    name="test-project-datadtd">
  +    name="test-project-sql">
  +    <ant 
  +      dir="${torque.buildFileDir}"
  +      antfile="${torque.buildFile}"
  +      target="project-sql"
  +      inheritAll="false">
  +    </ant>
     </target>
  -  
  +
     <target
  -    name="test-project-datadump">
  +    name="test-project-om">
  +    <ant 
  +      dir="${torque.buildFileDir}"
  +      antfile="${torque.buildFile}"
  +      target="project-om"
  +      inheritAll="false">
  +    </ant>
     </target>
     
     <target
  -    name="test-project-datasql">
  +    name="test-project-datadtd">
     </target>
     
     <target
  -    name="test-project-jdbc">
  +    name="test-project-datadump">
     </target>
     
     <target
  -    name="test-project-om">
  +    name="test-project-datasql">
     </target>
     
     <target
  -    name="test-project-om-classpath">
  +    name="test-project-jdbc">
     </target>
     
     <target
  -    name="test-project-sql">
  +    name="test-project-sql-classpath">
     </target>
     
     <target
  -    name="test-project-sql-classpath">
  +    name="test-project-om-classpath">
     </target>
  -  
  +    
     <target
       name="test-project-sql2xml">
     </target>
  @@ -100,9 +130,24 @@
     <!-- R U N T I M E  T E S T S                                       -->
     <!-- ============================================================== -->
   
  +  <!-- Build classpath -->
  +  <path id="classpath">
  +    <pathelement location="${log4j.jar}"/>
  +    <pathelement location="${commons-collections.jar}"/>
  +    <pathelement location="${commons-util.jar}"/>
  +    <pathelement location="${village.jar}"/>
  +    <pathelement location="${build.dest}"/>
  +  </path>
  +
     <target
       name="test-runtime">
  -  
  +    
  +    <java
  +      classname="org.apache.torque.TorqueRunner"
  +      fork="true">
  +      <arg value="src/test/Torque.properties"/>
  +      <classpath refid="classpath"/>
  +    </java>
     </target>
   
   </project>
  
  
  
  1.22      +8 -5      jakarta-turbine-torque/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/build.xml,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- build.xml 2001/10/27 21:22:13     1.21
  +++ build.xml 2001/10/28 18:39:11     1.22
  @@ -54,7 +54,8 @@
     <!-- ================================================================== -->
   
     <target
  -    name="test">
  +    name="test"
  +    depends="compile-test,dist">
       
       <ant antfile="build-test.xml"/>
     </target>
  @@ -246,23 +247,25 @@
         todir="${build.dest}/org/apache/torque/engine/database/transform"/>
     </target>
   
  +  <!-- ================================================================== -->
  +  <!-- C O M P I L E  T E S T S                                           -->
  +  <!-- ================================================================== -->
  +
     <target 
       name="compile-test" 
       depends="compile" 
       if="junit.present"
       description="==> compiles the test source code">
       
  -    <mkdir dir="${build.test}"/>
  -
       <javac srcdir="${test.dir}"
  -      destdir="${build.test}"
  +      destdir="${build.dest}"
         excludes="**/package.html"
         debug="${debug}"
         deprecation="${deprecation}"
         optimize="${optimize}">
         <classpath refid="classpath"/>
         <classpath>
  -          <pathelement path="${build.dest}"/>
  +        <pathelement path="${build.dest}"/>
         </classpath>
       </javac>
     </target>
  
  
  
  1.5       +9 -0      jakarta-turbine-torque/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/default.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- default.properties        2001/10/24 01:08:47     1.4
  +++ default.properties        2001/10/28 18:39:11     1.5
  @@ -18,6 +18,15 @@
   src.dir = ./src
   test.dir = ${src.dir}/test
   
  +# -------------------------------------------------------------------
  +# Standard Torque build file references used
  +# for testing.
  +# -------------------------------------------------------------------
  +torque.distDir = bin/torque/torque
  +torque.buildFileDir = ${torque.distDir}
  +torque.buildFile = build-torque.xml
  +torque.testSchema = src/test/bookstore-schema.xml
  +
   docs.src = ./xdocs
   docs.dest = ./docs
   javadoc.destdir = ./docs/api
  
  
  
  1.21      +27 -3     jakarta-turbine-torque/src/java/org/apache/torque/Torque.java
  
  Index: Torque.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/Torque.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Torque.java       2001/10/28 02:59:18     1.20
  +++ Torque.java       2001/10/28 18:39:11     1.21
  @@ -82,7 +82,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Magn�s ��r Torfason</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Rafal Krzewski</a>
  - * @version $Id: Torque.java,v 1.20 2001/10/28 02:59:18 jvanzyl Exp $
  + * @version $Id: Torque.java,v 1.21 2001/10/28 18:39:11 jvanzyl Exp $
    */
   public class Torque
   {
  @@ -147,7 +147,6 @@
           throws Exception
       {
           dbMaps = new HashMap();
  -
           pools = new HashMap();
   
           // Create monitor thread
  @@ -182,6 +181,31 @@
           Torque.init();
       }
   
  +    public static void init2(String configFile)
  +        throws Exception
  +    {
  +        ExtendedProperties c = new ExtendedProperties(configFile);
  +        c = c.subset("torque");
  +        
  +        if (isLoggingConfigured() == false)
  +        {
  +            // Get the applicationRoot for use in the log4j
  +            // properties.
  +            String applicationRoot = c.getString("applicationRoot", ".");
  +        
  +            Properties p = new Properties();
  +            p.load(new FileInputStream(configFile));
  +            // Set the applicationRoot in the log4j properties so that
  +            // ${applicationRoot} can be used in the properties file.
  +            p.setProperty("applicationRoot", applicationRoot);
  +            PropertyConfigurator.configure(p);
  +        }
  +        
  +        Torque.setConfiguration(c);
  +        Torque.setCategory(Category.getInstance(DEFAULT_CATEGORY));
  +        Torque.init();
  +    }
  +
       /**
        * Sets the logging category for Torque and all dependencies.
        */
  @@ -214,7 +238,7 @@
        *
        * @return boolean Whether log4j is configured.
        */
  -    protected boolean isLoggingConfigured() 
  +    protected static boolean isLoggingConfigured() 
       {
           // This is a note from Ceki, taken from a message on the log4j
           // user list:
  
  
  

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

Reply via email to