Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3d97d7

Browse files
author
Barry Lind
committed
Applied patch from Oliver Jowett to clean up the jdbc regression test build
Modified Files: jdbc/build.xml jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
1 parent 302f1a8 commit e3d97d7

File tree

2 files changed

+42
-48
lines changed

2 files changed

+42
-48
lines changed

src/interfaces/jdbc/build.xml

Lines changed: 42 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
This file now requires Ant 1.4.1. 2002-04-18
88
9-
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.34 2003/08/11 21:27:52 barry Exp $
9+
$Header: /cvsroot/pgsql/src/interfaces/jdbc/Attic/build.xml,v 1.35 2003/08/11 23:42:04 barry Exp $
1010
1111
-->
1212

@@ -48,16 +48,23 @@
4848
</condition>
4949
<available property="datasource" classname="javax.sql.DataSource"/>
5050
<available property="ssl" classname="javax.net.ssl.SSLSocketFactory"/>
51-
<available property="junit" classname="junit.framework.Test" />
51+
<available property="junit" classname="junit.framework.Test"/>
52+
<available property="junit.task" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
5253
<condition property="jdbc2tests">
5354
<and>
54-
<isset property="jdbc2"/>
55+
<or>
56+
<isset property="jdbc2"/>
57+
<isset property="jdbc3"/>
58+
</or>
5559
<isset property="junit"/>
5660
</and>
5761
</condition>
5862
<condition property="jdbc2optionaltests">
5963
<and>
60-
<isset property="jdbc2"/>
64+
<or>
65+
<isset property="jdbc2"/>
66+
<isset property="jdbc3"/>
67+
</or>
6168
<isset property="datasource"/>
6269
<isset property="junit"/>
6370
</and>
@@ -82,7 +89,6 @@
8289
<jar jarfile="${jardir}/postgresql.jar">
8390
<fileset dir="${builddir}">
8491
<include name="${package}/**/*.class" />
85-
<exclude name="${package}/test/**" />
8692
</fileset>
8793

8894
<fileset dir="${srcdir}">
@@ -277,62 +283,51 @@
277283
<property name="username" value="test" />
278284
<!-- Password must be something. Doesn't matter if trust is used! -->
279285
<property name="password" value="password" />
280-
<!-- junit.ui is one of textui, awtui, or swingui -->
281-
<property name="junit.ui" value="textui" />
282286

287+
<!-- The tests now build to a separate directory and jarfile from the
288+
driver build, to ensure we're really testing against the jar we just
289+
built, and not whatever happens to be in builddir. -->
283290

284-
<target name="test" depends="testjdbc2,testjdbc2optional,testjdbc3">
285-
</target>
291+
<!-- This compiles and builds the test jarfile. -->
292+
<target name="testjar" depends="jar" if="junit">
293+
<mkdir dir="${builddir}/tests"/>
294+
<javac srcdir="${srcdir}" destdir="${builddir}/tests" debug="${debug}">
295+
<include name="${package}/test/**" />
286296

287-
<target name="testjdbc2" depends="jar" if="jdbc2tests">
288-
<javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}">
289-
<include name="${package}/test/jdbc2/*" />
290-
</javac>
291-
<java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true">
292-
<arg value="org.postgresql.test.jdbc2.Jdbc2TestSuite" />
293-
<sysproperty key="database" value="${database}" />
294-
<sysproperty key="username" value="${username}" />
295-
<sysproperty key="password" value="${password}" />
296-
<classpath>
297-
<pathelement location="${builddir}" />
298-
<pathelement path="${java.class.path}" />
299-
</classpath>
300-
</java>
301-
</target>
297+
<exclude name="${package}/test/jdbc2/**" unless="jdbc2tests"/>
298+
<exclude name="${package}/test/jdbc2/optional/**" unless="jdbc2optionaltests" />
299+
<exclude name="${package}/test/jdbc3/**" unless="jdbc3tests" />
300+
<exclude name="${package}/test/util/**" unless="jdbc2optionaltests"/>
302301

303-
<target name="testjdbc2optional" depends="jar" if="jdbc2optionaltests">
304-
<javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}">
305-
<include name="${package}/test/jdbc2/optional/**" />
306-
<include name="${package}/test/util/**" />
307-
</javac>
308-
<java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true">
309-
<arg value="org.postgresql.test.jdbc2.optional.OptionalTestSuite" />
310-
<sysproperty key="database" value="${database}" />
311-
<sysproperty key="username" value="${username}" />
312-
<sysproperty key="password" value="${password}" />
313302
<classpath>
314-
<pathelement location="${builddir}" />
315-
<pathelement path="${java.class.path}" />
303+
<pathelement location="${jardir}/postgresql.jar"/>
316304
</classpath>
317-
</java>
305+
</javac>
306+
<jar jarfile="${jardir}/postgresql-tests.jar" basedir="${builddir}/tests"/>
318307
</target>
308+
309+
<!-- This actually runs the tests -->
310+
<target name="runtest" depends="testjar" if="junit.task">
311+
<junit>
312+
<formatter type="brief" usefile="false"/>
319313

320-
<target name="testjdbc3" depends="jar" if="jdbc3tests">
321-
<javac srcdir="${srcdir}" destdir="${builddir}" debug="${debug}">
322-
<include name="${package}/test/jdbc3/*" />
323-
<include name="${package}/test/util/*" />
324-
</javac>
325-
<java fork="yes" classname="junit.${junit.ui}.TestRunner" taskname="junit" failonerror="true">
326-
<arg value="org.postgresql.test.jdbc3.Jdbc3TestSuite" />
327314
<sysproperty key="database" value="${database}" />
328315
<sysproperty key="username" value="${username}" />
329316
<sysproperty key="password" value="${password}" />
317+
330318
<classpath>
331-
<pathelement location="${builddir}" />
319+
<pathelement location="${jardir}/postgresql.jar" />
320+
<pathelement location="${jardir}/postgresql-tests.jar" />
332321
<pathelement path="${java.class.path}" />
333322
</classpath>
334-
</java>
335-
</target>
336323

324+
<test name="org.postgresql.test.jdbc2.Jdbc2TestSuite" if="jdbc2tests"/>
325+
<test name="org.postgresql.test.jdbc2.optional.OptionalTestSuite" if="jdbc2optionaltests"/>
326+
<test name="org.postgresql.test.jdbc3.Jdbc3TestSuite" if="jdbc3tests"/>
327+
</junit>
328+
</target>
329+
330+
<!-- This is the target invoked by the Makefile -->
331+
<target name="test" depends="testjar,runtest"/>
337332

338333
</project>

src/interfaces/jdbc/org/postgresql/test/jdbc3/Jdbc3TestSuite.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class Jdbc3TestSuite extends TestSuite
1414
public static TestSuite suite()
1515
{
1616
TestSuite suite = new TestSuite();
17-
suite.addTest(org.postgresql.test.jdbc2.Jdbc2TestSuite.suite());
1817
suite.addTestSuite(Jdbc3SimpleDataSourceTest.class);
1918
suite.addTestSuite(Jdbc3ConnectionPoolTest.class);
2019
suite.addTestSuite(Jdbc3PoolingDataSourceTest.class);

0 commit comments

Comments
 (0)