<!--
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
 -->

<project name="DBCPTest" default="run" basedir=".">
     
  <property name="src" location=".."/>
  <property name="build" location="build"/>
  <property name="lib" location="lib"/>
	
  <property name="component-propfile" value="${basedir}/build.properties"/>
  <property file="${component-propfile}"/>

  <path id="compile.classpath">
  	<pathelement location="${pool2-jar}"/>
    <fileset dir="${lib}">
      <include name="*.jar"/>
    </fileset>
  </path>
	
  <path id="run.classpath">
    <pathelement path="${build}"/>
    <pathelement path="${java.class.path}"/>
    <path refid="compile.classpath" /> 
  </path>

  <target name="init">
    <mkdir dir="${build}"/>
    <mkdir dir="${lib}"/>
  </target>

  <target name="get-collections">
    <get
    src="${mavenRepo}/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"
    dest="${lib}/commons-collections-3.1.jar"
    usetimestamp="true"/>
  </target>
  
  <target name="get-beanutils">
    <get
    src="${mavenRepo}/commons-beanutils/commons-beanutils/1.6.1/commons-beanutils-1.6.1.jar"
    dest="${lib}/commons-beanutils-1.6.1.jar"
    usetimestamp="true"/>
  </target>

  <target name="get-digester">
    <get
    src="${mavenRepo}/commons-digester/commons-digester/2.1/commons-digester-2.1.jar"
    dest="${lib}/commons-digester-1.8.jar"
    usetimestamp="true"/>
  </target>
  <target name="get-math">
    <get
	src="${mavenRepo}/org/hipparchus/hipparchus-core/1.8/hipparchus-core-1.8.jar"
	dest="${lib}/hipparchus-core-1.8.jar"
	usetimestamp="true"/>
	<get
	 src="${mavenRepo}/org/hipparchus/hipparchus-stat/1.8/hipparchus-stat-1.8.jar"
	 dest="${lib}/hipparchus-stat-1.8.jar"
	 usetimestamp="true"/> 
  </target>
  <target name="get-logging">
    <get
    src="${mavenRepo}/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"
    dest="${lib}/commons-logging-1.0.4.jar"
    usetimestamp="true"/>
  </target>
	
  <target name="get-deps"
      depends="get-collections,get-beanutils,get-digester,get-math,get-logging">
  </target>

  <target name="compile" depends="clean,init,get-deps">
    <javac srcdir="${src}/java"
    	   includes="**/pool/**"
    	   destdir="${build}">
      <classpath refid="compile.classpath"/>
      <compilerarg value="-Xlint:unchecked" />
    </javac>
    <copy file="${basedir}/config-pool.xml" tofile="${build}/config-pool.xml"/>
    <copy file="${basedir}/logging.properties" tofile="${build}/logging.properties"/>
  </target>

  <target name="run" depends="compile">
    <java classname="org.apache.commons.performance.pool.PoolTest" fork="true">
      <classpath refid="run.classpath"/>
      <jvmarg 
      value="-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger"/>
      <jvmarg value="-Djava.util.logging.config.file=logging.properties"/>
    </java>
  </target>
  	
  <target name="clean">
    <delete dir="${build}"/>
  </target>
</project>
