The version of Apache log4j used by SoundHelix.

[[ 🗃 ^aEp6o apache-log4j ]] :: [📥 Inbox] [📤 Outbox] [🐤 Followers] [🤝 Collaborators] [🛠 Commits]

Clone

HTTPS: git clone https://vervis.peers.community/repos/aEp6o

SSH: git clone USERNAME@vervis.peers.community:aEp6o

Branches

Tags

v1_3alpha_6 :: tests /

db.xml

<project name="db-tests" default="usage" basedir="." >
  
  <path id="tests.classpath">
    <pathelement location="${project.source.home}"/>
    <pathelement location="${project.classes.home}"/>
    <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>
       This build file cannot be invoked directly but only through 
       its parent build file, build.xml.
     </echo>
   </target>
	
  <!-- ================================================================= -->
  <!--                            DB Tests                               -->
  <!-- ================================================================= -->

  <!-- These tests all 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>
  		
  	<fail unless="hsqldb-present">
  		
  		Could not find HSQLDB driver. 
  		No point in running HSQLDB tests.
  	</fail>
  			
  </target>
  
  <target name="hsqldb" depends="hsqldbCheck" >
    <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>
  	
  	<fail unless="mysql-present">
  		
  		Could not find MySQL driver. 
  		No point in running MySQL tests.
  	</fail>
  		
  </target>
  
  <target name="mysql" depends="mysqlCheck">
    <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>
  	
  	<fail unless="postgresql-present">
  		
  		Could not find PostgreSQL driver. 
  		No point in running PostgreSQL tests.
  	</fail>
  </target>
  
  <target name="postgresql" depends="postgresqlCheck">
    <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> 
  	
  	<fail unless="oracle-present">
  		
  		Could not find Oracle driver. 
  		No point in running Oracle tests.
  	</fail>
  </target> 
  
  <target name="oracle" depends="oracleCheck" > 
    <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> 
  	
  	<fail unless="msSql-present">
  		
  		Could not find MsSQL driver. 
  		No point in running MsSQL tests.
  	</fail>
  </target> 
  
  <target name="msSql" depends="msSqlCheck"> 
    <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>

  
[See repo JSON]