File: test-jar.xml

package info (click to toggle)
libcommons-dbcp-java 1.4-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,964 kB
  • sloc: java: 16,699; xml: 2,245; jsp: 84; sh: 12; makefile: 2
file content (184 lines) | stat: -rw-r--r-- 7,346 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!--
/*
 * 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.
 */
 -->

<!-- $Id$ -->

<!-- 
     Compiles DBCP unit tests and attempts to run them using the compiled dbcp jar
     specified in the "commons-dbcp.jar" property.  Set this property in build.properties
     along with commons-pool.jar and execute the "test" target to run the tests.
     
     If the jdk level is <= 1.5, JDBC 4 methods will be commented out in the test 
     code before compilation of the tests.
-->

<project name="commons-dbcp" default="test" basedir=".">

   <target name="init">
      <tstamp/>

      <!-- read properties from the build.properties, if any -->
      <property name="component-propfile" value="${basedir}/build.properties"/>
      <property file="${component-propfile}"/>

      <!-- read properties from the ${user.home}/propfile, if any -->
      <property name="user-propfile" value="${user.home}/build.properties"/>
      <property file="${user-propfile}"/>

      <property name="commons-pool.jar" value="${basedir}/../pool/dist/commons-pool.jar"/>
   	  <property name="commons-dbcp.jar" value="${basedir}/../../commons-dbcp-1.3-SNAPSHOT.jar"/>

      <!-- now combine the classpaths -->
      <property name="classpath" 
       value="${cp}:${commons-pool.jar}:${commons-dbcp.jar}:${jdbc20ext.jar}:${junit.jar}:
        ${naming-common.jar}:${naming-java.jar}:${commons-logging.jar}:
      	${xerces.jar}:${xml-apis.jar}:${jta-spec.jar}:${jta-impl.jar}:
      	${backport-util-concurrent.jar}:${ejb-spec.jar}"/>

      <property name="build.dir" value="${basedir}/build"/>
      <property name="build.test-classes.dir" value="${build.dir}/test-classes"/>

      <property name="test.entry" value="org.apache.commons.dbcp.TestAll"/>
      <property name="test.failonerror" value="true" /> 
      <property name="test.runner" value="junit.textui.TestRunner" /> 
 
      <property name="javac.optimize" value="false"/>
      <property name="javac.debug" value="true"/>
      <property name="javac.deprecation" value="false"/>
      
   	  <available property="jndi.present" classname="javax.naming.Context"/>
      <available property="jdbc4.present" classname="java.sql.Wrapper"/>
   </target>

   <target name="check_jar">
   	   <available file="${file}" property="found"/>
   	   <antcall target="check_message"/>
   </target>

	<target name="check_message" unless="found">
		<!-- echo could be replaced with fail if required -->
        <echo message="Could not find ${file}"/>
   </target>

   <!-- Check that all the dependencies exist -->
   <target name="check_depends" depends="init">
       <echo>Checking dependencies</echo>
       <antcall target="check_jar">
           <param name="file" value="${commons-pool.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${junit.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${naming-common.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${naming-java.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${commons-logging.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${xerces.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${jta-spec.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${jta-impl.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${backport-util-concurrent.jar}"/>
       </antcall>
       <antcall target="check_jar">
           <param name="file" value="${ejb-spec.jar}"/>
       </antcall>
   </target>

   <!-- ######################################################### -->

   <target name="clean" depends="init" description="removes generated files">
      <delete dir="${build.dir}"/>
      <delete dir="${dist.dir}"/>
   </target>

	<target name="prepare-nojdbc4" depends="init" unless="jdbc4.present">
	   <echo message="Commenting out the jdbc4 additional methods since JDBC 4 was not detected."/>
	   <property name="src.dir" value="${build.dir}/src"/>
	   <property name="src.java.dir" value="${src.dir}/java"/>
	   <property name="src.test.dir" value="${src.dir}/test"/>
	   <property name="javac.source" value="1.4" />

	   <mkdir dir="${src.dir}"/> 
	   <copy todir="${src.dir}" filtering="yes">
	      <fileset dir="${basedir}/src" defaultexcludes="no">
	         <include name="**/*.java"/>
	         <include name="**/*.xml"/>
	         <include name="**/*.properties"/>
	         <include name="**/*.jocl"/>
	         <include name="**/package.html"/>
	      </fileset>
	   </copy>
	   <replace dir="${src.dir}" token="/* JDBC_4_ANT_KEY_BEGIN */" value="/*"/>
	   <replace dir="${src.dir}" token="/* JDBC_4_ANT_KEY_END */" value="*/"/>
	</target>

	<target name="prepare-jdbc4" depends="init" if="jdbc4.present">
	  <echo message="JDBC 4 was detected."/>
	      <property name="src.dir" value="${basedir}/src"/>
	      <property name="src.java.dir" value="${src.dir}/java"/>
	      <property name="src.test.dir" value="${src.dir}/test"/>
	      <property name="javac.source" value="1.5" />
	   </target>

   <target name="prepare" depends="init,prepare-nojdbc4,prepare-jdbc4"/>

   <!-- ######################################################### -->
   
   <target name="compile-test" depends="check_depends,prepare" description="compiles test files">
      <mkdir dir="${build.test-classes.dir}"/>
      <javac destdir="${build.test-classes.dir}"
             srcdir="${src.test.dir}"
             debug="${javac.debug}"
             deprecation="${javac.deprecation}"
             optimize="${javac.optimize}"
             source="${javac.source}">
        <classpath>
          <pathelement location="${build.test-classes.dir}" /> 
          <pathelement path="${classpath}" /> 
        </classpath>
      </javac>
      <copy todir="${build.test-classes.dir}" file="${src.test.dir}/testpool.jocl"/>
   </target>

   <target name="test" depends="compile-test" description="runs (junit) unit tests">
      <echo message="${classpath}"/>
      <junit printsummary="true" showoutput="true" fork="yes" haltonfailure="${test.failonerror}">
        <classpath>
          <pathelement location="${build.test-classes.dir}" /> 
          <pathelement path="${classpath}" /> 
        </classpath>
        <test name="${test.entry}"/>
      	<formatter type="plain"/>
      </junit>
   </target>
   
</project>