You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/12/18 17:54:18 UTC

cvs commit: logging-log4j/tests db.xml build.xml

ceki        2004/12/18 08:54:18

  Modified:    tests    build.xml
  Added:       tests    db.xml
  Log:
  Moved the DB tests out to their own file.
  
  Revision  Changes    Path
  1.75      +1 -189    logging-log4j/tests/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/build.xml,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- build.xml	18 Dec 2004 15:25:02 -0000	1.74
  +++ build.xml	18 Dec 2004 16:54:18 -0000	1.75
  @@ -427,15 +427,6 @@
       </junit>
     </target>
   
  -  <target name="MazeAppender" depends="check, build, cleanOutputDir">
  -    <junit printsummary="yes" fork="yes" haltonfailure="yes">
  -      <classpath refid="tests.classpath"/>
  -      <formatter type="plain" usefile="false" />
  -      <test name="org.apache.log4j.MazeAppenderTestCase" />
  -    </junit>
  -  </target>
  -
  -
     <target name="OR" depends="check, build, cleanOutputDir">
       <junit printsummary="yes" fork="yes" haltonfailure="yes">
         <classpath refid="tests.classpath"/>
  @@ -595,186 +586,7 @@
   	  <test name="org.apache.log4j.helpers.MessageFormatterTest" />
       </junit>
     </target>
  -	  
  -	
  -  
  -  <!-- ================================================================= -->
  -  <!-- ========================= DB Tests ======================= -->
  -  <!-- ================================================================= -->
  -
  -  <!-- These tests follow the same pattern. They will be run if a property file 
  -       defining access as well as necessary class files are available. Otherwise,
  -       the test is skipped.
  -       --> 
  -
  -
  -  <!-- The target that performs the actual test -->
  -  <target name="invokeDBTestCase">    
  -    <junit printsummary="yes" fork="no" haltonfailure="yes"> 
  -      <sysproperty key="toto" value="${toto}"/>     
  -      <sysproperty key="appendConfigFile" value="${appendConfigFile}"/>
  -      <sysproperty key="readConfigFile" value="${readConfigFile}"/>
  -      <classpath refid="tests.classpath"/>
  -      <formatter type="plain" usefile="false"/>
  -      <test name="org.apache.log4j.db.FullCycleDBTest" />
  -    </junit>
  -  </target>
  -  
  -  
  -  <!-- the following target is shared by MySQL and PostgreSQL targets -->
  -  <target name="commonDB">
  -    <property file="./input/db/db.properties"/> 
  -
  -    <!-- This task deletes existing entries in the database -->
  -    <!-- Do not use on a table with valuable dataset        -->
  -    <input
  -     message="All data is going to be deleted from DB. Continue (y/n)?"
  -     validargs="y,n"
  -     addproperty="do.delete"
  -     />
  -    <condition property="do.abort">
  -      <equals arg1="n" arg2="${do.delete}"/>
  -    </condition>
  -    <fail if="do.abort">Build aborted by user.</fail>
  -    <sql driver="${driverClass}" 
  -	 url="${url}" 
  -	 userid="${user}" 
  -	 password="${password}"
  -	 src="./input/db/deleteTables.sql">
  -      <classpath refid="tests.classpath"/>
  -    </sql>
  -    
  -    
  -    <echo message="Running test case with DriverManager config file"/>
  -    <antcall target="invokeDBTestCase">
  -      <param name="appendConfigFile" value="./input/db/append-with-drivermanager1.xml"/>
  -      <param name="readConfigFile"   value="./input/db/read-with-drivermanager1.xml"/>
  -    </antcall>
  -    
  -    <echo message="Running test case with DataSource"/>
  -    <antcall target="invokeDBTestCase">
  -      <param name="appendConfigFile" value="./input/db/append-with-datasource1.xml"/>
  -      <param name="readConfigFile"   value="./input/db/read-with-datasource1.xml"/>
  -    </antcall>
  -    
  -    <echo message="Running test case with a native *pooled* DataSource"/>
  -    <antcall target="invokeDBTestCase">
  -      <param name="appendConfigFile" value="./input/db/append-with-pooled-datasource1.xml"/>
  -      <param name="readConfigFile"   value="./input/db/read-with-pooled-datasource1.xml"/>
  -    </antcall>
  -    
  -    <echo message="Running test case with a DataSource with JNDI"/>
  -    <antcall target="invokeDBTestCase">
  -      <param name="appendConfigFile" value="./input/db/append-with-jndi1.xml"/>
  -      <param name="readConfigFile"   value="./input/db/read-with-jndi1.xml"/>
  -    </antcall> 
  -  </target>   
  -  
  -  <!-- ============ hsqldb  specific tests ============== -->     
  -  
  -  <target name="hsqldbCheck">
  -    <condition property="hsqldb-present">
  -      <and>
  -	<available file="./input/db/hsqldb.properties" />
  -	<available classname="org.hsqldb.jdbcDriver">
  -	  <classpath refid="tests.classpath"/>
  -	</available>
  -      </and>
  -    </condition>
  -  </target>
  -  
  -  <target name="hsqldb" depends="hsqldbCheck, build" if="hsqldb-present">
  -    <delete file="./input/db/db.properties"/>
  -    <echo message="hsqldb available"/>
  -    <copy file="./input/db/hsqldb.properties" tofile="./input/db/db.properties"/>
  -    
  -    <echo message="Running test case with DriverManager config file"/>
  -    <antcall target="invokeDBTestCase">
  -      <param name="appendConfigFile" value="./input/db/append-with-drivermanager1.xml"/>
  -      <param name="readConfigFile"   value="./input/db/read-with-drivermanager1.xml"/>
  -    </antcall>
  -  </target>
  -  
  -  <!-- ============ MySQL specific tests ============== -->     
  -  <target name="mysqlCheck">
  -    <condition property="mysql-present">
  -      <and>
  -	<available file="./input/db/mysql.properties" />
  -	<available classname="com.mysql.jdbc.Driver">
  -	  <classpath refid="tests.classpath"/>
  -	</available>
  -      </and>
  -    </condition>
  -  </target>
  -  
  -  <target name="mysql" depends="mysqlCheck, build" if="mysql-present">
  -    <delete file="./input/db/db.properties"/>
  -    <echo message="MySQL available"/>
  -    <copy file="./input/db/mysql.properties" tofile="./input/db/db.properties"/>
  -    
  -    <antcall target="commonDB"/>
  -  </target>
  -  
  -  <!-- ============ PostgreSQL specific tests ============== -->     
  -  
  -  <target name="postgresqlCheck">
  -    <condition property="postgresql-present">
  -      <and>
  -	<available file="./input/db/postgresql.properties" />
  -	<available classname="org.postgresql.Driver">
  -	  <classpath refid="tests.classpath"/>
  -	</available>
  -      </and>
  -    </condition>
  -  </target>
  -  
  -  <target name="postgresql" depends="postgresqlCheck, build" if="postgresql-present">
  -    <delete file="./input/db/db.properties"/>
  -    <echo message="PostgreSQL available"/>
  -    <copy file="./input/db/postgresql.properties" tofile="./input/db/db.properties"/>
  -    <antcall target="commonDB"/>
  -  </target>
  -  
  -  <!-- ============ Oracle specific tests ============== --> 
  -  <target name="oracleCheck"> 
  -    <condition property="oracle-present"> 
  -      <and> 
  -	<available file="./input/db/oracle.properties" /> 
  -	<available classname="oracle.jdbc.driver.OracleDriver"> 
  -	  <classpath refid="tests.classpath"/> 
  -	</available> 
  -      </and> 
  -    </condition> 
  -  </target> 
  -  
  -  <target name="oracle" depends="oracleCheck, build" if="oracle-present"> 
  -    <delete file="./input/db/db.properties"/> 
  -    <echo message="Oracle available"/> 
  -    <copy file="./input/db/oracle.properties" tofile="./input/db/db.properties"/> 
  -    
  -    <antcall target="commonDB"/> 
  -  </target> 
  -  
  -  <!-- ============ MS SQL Server specific tests ============== --> 
  -  <target name="msSqlCheck"> 
  -    <condition property="msSql-present"> 
  -      <and> 
  -	<available file="./input/db/msSql.properties" /> 
  -	<available classname="weblogic.jdbc.mssqlserver4.Driver"> 
  -	  <classpath refid="tests.classpath"/> 
  -	</available> 
  -      </and> 
  -    </condition> 
  -  </target> 
  -  
  -  <target name="msSql" depends="msSqlCheck, build" if="msSql-present"> 
  -    <delete file="./input/db/db.properties"/> 
  -    <echo message="Ms Sql available"/> 
  -    <copy file="./input/db/msSql.properties" tofile="./input/db/db.properties"/> 
  -    
  -    <antcall target="commonDB"/> 
  -  </target> 
  -  
  +	    
     <!-- ================================================================= -->
     <!-- =========================   long Tests  ========================= -->
     <!-- ================================================================= -->
  
  
  
  1.1                  logging-log4j/tests/db.xml
  
  Index: db.xml
  ===================================================================
  <project name="db-tests" default="usage" basedir="." >
  
    <property file="build.properties"/>
  
    <!-- The base directory relative to which most targets are built -->
    <property name="base" value="."/>
   
    <!-- The directory where source files are stored. -->
    <property name="project.source.home" value="../src/java/"/>
    <property name="project.classes.home" value="../dist/classes/"/>
    <property name="examples.classes" value="../examples/classes/"/>
    
    <property name="tests.source.home" value="./src/java/"/>
    
    <!-- The stem where most log4j source code is located. -->
    <property name="stem" value="org/apache/log4j"/>
    
    <path id="tests.classpath">
      <pathelement location="${project.source.home}"/>
      <pathelement location="${project.classes.home}"/>
      <pathelement location="${examples.classes}"/>
      <pathelement location="${tests.source.home}"/>
      <pathelement location="./classes"/>
      <pathelement location="./resources"/>
      <pathelement location="${jakarta-oro.jar}"/>
      <fileset dir="./lib/">
        <include name="*.jar"/>
      </fileset>
    </path>
    
  	
     <target name="usage">
       <echo>
  	      hsqldb - to invoke HSQLDB tests
       </echo>
     </target>
  	
     <!-- ================================================================= -->
     <!-- Build the parent project as well as the test classes              -->
     <!-- ================================================================= -->  
     <target name="build">
       <ant antfile="build.xml" target="build" inheritRefs="true"/>
     </target>
  
  	<!-- ================================================================= -->
    <!-- ========================= DB Tests ======================= -->
    <!-- ================================================================= -->
  
    <!-- These tests follow the same pattern. They will be run if a property file 
         defining access as well as necessary class files are available. Otherwise,
         the test is skipped.
         --> 
  
  
    <!-- The target that performs the actual test -->
    <target name="invokeDBTestCase">    
      <junit printsummary="yes" fork="no" haltonfailure="yes"> 
        <sysproperty key="toto" value="${toto}"/>     
        <sysproperty key="appendConfigFile" value="${appendConfigFile}"/>
        <sysproperty key="readConfigFile" value="${readConfigFile}"/>
        <classpath refid="tests.classpath"/>
        <formatter type="plain" usefile="false"/>
        <test name="org.apache.log4j.db.FullCycleDBTest" />
      </junit>
    </target>
    
    
    <!-- the following target is shared by MySQL and PostgreSQL targets -->
    <target name="commonDB">
      <property file="./input/db/db.properties"/> 
  
      <!-- This task deletes existing entries in the database -->
      <!-- Do not use on a table with valuable dataset        -->
      <input
       message="All data is going to be deleted from DB. Continue (y/n)?"
       validargs="y,n"
       addproperty="do.delete"
       />
      <condition property="do.abort">
        <equals arg1="n" arg2="${do.delete}"/>
      </condition>
      <fail if="do.abort">Build aborted by user.</fail>
      <sql driver="${driverClass}" 
  	 url="${url}" 
  	 userid="${user}" 
  	 password="${password}"
  	 src="./input/db/deleteTables.sql">
        <classpath refid="tests.classpath"/>
      </sql>
      
      
      <echo message="Running test case with DriverManager config file"/>
      <antcall target="invokeDBTestCase">
        <param name="appendConfigFile" value="./input/db/append-with-drivermanager1.xml"/>
        <param name="readConfigFile"   value="./input/db/read-with-drivermanager1.xml"/>
      </antcall>
      
      <echo message="Running test case with DataSource"/>
      <antcall target="invokeDBTestCase">
        <param name="appendConfigFile" value="./input/db/append-with-datasource1.xml"/>
        <param name="readConfigFile"   value="./input/db/read-with-datasource1.xml"/>
      </antcall>
      
      <echo message="Running test case with a native *pooled* DataSource"/>
      <antcall target="invokeDBTestCase">
        <param name="appendConfigFile" value="./input/db/append-with-pooled-datasource1.xml"/>
        <param name="readConfigFile"   value="./input/db/read-with-pooled-datasource1.xml"/>
      </antcall>
      
      <echo message="Running test case with a DataSource with JNDI"/>
      <antcall target="invokeDBTestCase">
        <param name="appendConfigFile" value="./input/db/append-with-jndi1.xml"/>
        <param name="readConfigFile"   value="./input/db/read-with-jndi1.xml"/>
      </antcall> 
    </target>   
    
    <!-- ============ hsqldb  specific tests ============== -->     
    
    <target name="hsqldbCheck">
      <condition property="hsqldb-present">
        <and>
  	<available file="./input/db/hsqldb.properties" />
  	<available classname="org.hsqldb.jdbcDriver">
  	  <classpath refid="tests.classpath"/>
  	</available>
        </and>
      </condition>
    </target>
    
    <target name="hsqldb" depends="hsqldbCheck, build" if="hsqldb-present">
      <delete file="./input/db/db.properties"/>
      <echo message="hsqldb available"/>
      <copy file="./input/db/hsqldb.properties" tofile="./input/db/db.properties"/>
      
      <echo message="Running test case with DriverManager config file"/>
      <antcall target="invokeDBTestCase">
        <param name="appendConfigFile" value="./input/db/append-with-drivermanager1.xml"/>
        <param name="readConfigFile"   value="./input/db/read-with-drivermanager1.xml"/>
      </antcall>
    </target>
    
    <!-- ============ MySQL specific tests ============== -->     
    <target name="mysqlCheck">
      <condition property="mysql-present">
        <and>
  	<available file="./input/db/mysql.properties" />
  	<available classname="com.mysql.jdbc.Driver">
  	  <classpath refid="tests.classpath"/>
  	</available>
        </and>
      </condition>
    </target>
    
    <target name="mysql" depends="mysqlCheck, build" if="mysql-present">
      <delete file="./input/db/db.properties"/>
      <echo message="MySQL available"/>
      <copy file="./input/db/mysql.properties" tofile="./input/db/db.properties"/>
      
      <antcall target="commonDB"/>
    </target>
    
    <!-- ============ PostgreSQL specific tests ============== -->     
    
    <target name="postgresqlCheck">
      <condition property="postgresql-present">
        <and>
  	<available file="./input/db/postgresql.properties" />
  	<available classname="org.postgresql.Driver">
  	  <classpath refid="tests.classpath"/>
  	</available>
        </and>
      </condition>
    </target>
    
    <target name="postgresql" depends="postgresqlCheck, build" if="postgresql-present">
      <delete file="./input/db/db.properties"/>
      <echo message="PostgreSQL available"/>
      <copy file="./input/db/postgresql.properties" tofile="./input/db/db.properties"/>
      <antcall target="commonDB"/>
    </target>
    
    <!-- ============ Oracle specific tests ============== --> 
    <target name="oracleCheck"> 
      <condition property="oracle-present"> 
        <and> 
  	<available file="./input/db/oracle.properties" /> 
  	<available classname="oracle.jdbc.driver.OracleDriver"> 
  	  <classpath refid="tests.classpath"/> 
  	</available> 
        </and> 
      </condition> 
    </target> 
    
    <target name="oracle" depends="oracleCheck, build" if="oracle-present"> 
      <delete file="./input/db/db.properties"/> 
      <echo message="Oracle available"/> 
      <copy file="./input/db/oracle.properties" tofile="./input/db/db.properties"/> 
      
      <antcall target="commonDB"/> 
    </target> 
    
    <!-- ============ MS SQL Server specific tests ============== --> 
    <target name="msSqlCheck"> 
      <condition property="msSql-present"> 
        <and> 
  	<available file="./input/db/msSql.properties" /> 
  	<available classname="weblogic.jdbc.mssqlserver4.Driver"> 
  	  <classpath refid="tests.classpath"/> 
  	</available> 
        </and> 
      </condition> 
    </target> 
    
    <target name="msSql" depends="msSqlCheck, build" if="msSql-present"> 
      <delete file="./input/db/db.properties"/> 
      <echo message="Ms Sql available"/> 
      <copy file="./input/db/msSql.properties" tofile="./input/db/db.properties"/> 
      
      <antcall target="commonDB"/> 
    </target> 
  </project>
  
    
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org