view tests/build.xml @ 970:f90d811e97eb default tip

Adjust getTableTypes() test for new table type: LOCAL TEMPORARY VIEW, added in 11.53.4 (Mar2025-SP1)
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 03 Apr 2025 15:01:33 +0200 (2 days ago)
parents d416e9b6b3d0
children
line wrap: on
line source
<?xml version="1.0"?><!-- vim:set ts=2 sw=2 expandtab: -->

<!--
SPDX-License-Identifier: MPL-2.0

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0.  If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright 2024, 2025 MonetDB Foundation;
Copyright August 2008 - 2023 MonetDB B.V.;
Copyright 1997 - July 2008 CWI.
-->

<!--
  Build file to allow ant (http://ant.apache.org/) to be used
  to build and run the tests
-->

<project name="JDBCTests" default="compile" basedir=".">

  <property file="build.local.properties" />
  <property file="build.properties" />
  <property file="../build.properties" /> <!-- included for version -->

  <!-- set global properties for this build -->
  <property name="srcdir"    value="." />
  <property name="builddir"  value="build" />
  <property name="jardir"    value="../jars" />

  <property name="jvm.version" value="8" />
  <property name="jre.version" value="jre8" />
  <property name="javac.flags" value="-source 8" />
  <property name="javac.flags" value="-target 8" />
  <property name="javac.flags" value="-profile compact2" />
  <property name="javac.flags" value="-Xlint" />

  <property name="jdbc_jar"
    value="${jardir}/monetdb-jdbc-${JDBC_MAJOR}.${JDBC_MINOR}.${jre.version}.jar" />
  <property name="jdbc_url"
    value="jdbc:monetdb://localhost/?user=monetdb&amp;password=monetdb${debug}" />
  <property name="jdbctests-jar"
    value="${jardir}/jdbctests.jar" />

  <!-- Prepares the build directory -->
  <target name="prepare">
    <mkdir dir="${builddir}" />
  </target>

  <!-- Compiles the tests -->
  <target name="compile" depends="prepare,jdbc">
    <echo message="Compiling JDBC tests" />
    <javac
      srcdir="${srcdir}"
      destdir="${builddir}"
      debug="true"
      optimize="false"
      includeantruntime="false"
      source="${jvm.version}"
      target="${jvm.version}"
      >
      <include name="**/*.java" />
      <compilerarg line="${javac.flags}" />
      <classpath>
        <pathelement path="${srcdir}" />
        <pathelement path="${jdbc_jar}" />
      </classpath>
    </javac>
  </target>

  <!-- a convenience jar collecting all JDBC tests -->
  <target name="jar_jdbctests"
    depends="compile"
    unless="uptodate.jdbctests-jar">
    <echo message="Building JDBC tests convenience jar" />
    <jar jarfile="${jdbctests-jar}">
      <fileset dir="${builddir}">
        <include name="JDBC_API_Tester.class" />
        <include name="UrlTester.class" />
        <include name="UrlTester$*.class" />
        <include name="OnClientTester.class" />
        <include name="OnClientTester$*.class" />
        <include name="ConnectionTests.class" />
        <include name="ConnectionTests$*.class" />
        <include name="TLSTester.class" />
        <include name="TLSTester$*.class" />
      </fileset>
      <fileset dir="${srcdir}">
        <include name="tests.md" />
        <include name="javaspecific.md" />
      </fileset>
    </jar>
  </target>

  <!-- makes sure the jdbc driver is compiled -->
  <target name="jdbc" depends="find_driver" unless="have_driver">
    <ant antfile="build.xml" dir=".." inheritAll="false" target="jar_jdbc" />
  </target>

  <target name="find_driver">
    <condition property="have_driver">
      <and>
        <available classname="org.monetdb.jdbc.MonetDriver">
          <classpath>
            <pathelement path="${jdbc_jar}" />
          </classpath>
        </available>
      </and>
    </condition>
  </target>

  <!-- This target removes the build directory -->
  <target name="clean">
    <delete quiet="true" dir="${builddir}" />
  </target>

  <!-- Run tests -->
  <target name="test">
    <antcall target="JDBC_API_Tester" />
  </target>

  <target name="test_class" depends="compile,jdbc">
    <echo message="Testing class ${test.class}" />
    <!-- fork="true" allows the test program to call System.exit() -->
    <java classname="${test.class}" failonerror="true" fork="true">
      <classpath>
        <pathelement path="${builddir}" />
        <pathelement path="." /> <!-- Needed for 'ant test' to find tests.md. -->
        <pathelement path="${jdbc_jar}" />
      </classpath>
      <arg value="${jdbc_url}" />
    </java>
  </target>

  <!-- convenience targets for the outside caller to specify which
  test(s) should be run -->
  <target name="JDBC_API_Tester">
    <antcall target="test_class">
      <param name="test.class" value="JDBC_API_Tester" />
    </antcall>
  </target>

  <target name="OnClientTester">
    <antcall target="test_class">
      <param name="test.class" value="OnClientTester" />
    </antcall>
  </target>

</project>