diff --git a/README.md b/README.md index 497a356d46a41178aec3b4c18b28e6816971ac8d..9228d767246c4f6dd0bb724032f9737e0f823ce8 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,9 @@ At the root of the repository, there are 3 ANT scripts. Each is dedicated to one 4 properties must be set before using one of these scripts: * `POSTGRES` *only for ADQL and TAP if you want to keep adql.translator.PgSphereTranslator*: a path toward a JAR or a binary directory containing all `org.postgresql.*` - [https://jdbc.postgresql.org/download.html](JDBC Postgres driver) -* `SERVLET-API`: a path toward a JAR or a binary directory containing all `javax.servlet.*` +* `SERVLET-API` *only for UWS and TAP*: a path toward a JAR or a binary directory containing all `javax.servlet.*` * `JUNIT-API` *not required if you are not interested by running the JUnit tests*: a path toward one or several JARs or binary directories containing all classes to use JUnit. -* `JNDI-API` *not required if you are not interested by running the JUnit tests*: a path toward one or several JARs or binary directories containing all classes to run a JNDI. Several libraries exist for that ; [Simple-JNDI](https://code.google.com/archive/p/osjava/wikis/SimpleJNDI.wiki) is very simple and is used by the libraries developer to run the related JUnit tests. +* `JNDI-API` *only for TAP AND only if you are interested by running the JUnit tests*: a path toward one or several JARs or binary directories containing all classes to run a JNDI. Several libraries exist for that ; [Simple-JNDI](https://code.google.com/archive/p/osjava/wikis/SimpleJNDI.wiki) is very simple and is used by the libraries developer to run the related JUnit tests. *__Note:__ No JNDI library is provided in this Git repository because any JNDI Library may work and there is no reason to impose a specific one. Besides, similarly as the other libraries required to compile the sources, it lets avoiding version incompatibility with the host system (i.e. your machine when you checkout/clone/fork this repository).* diff --git a/buildADQL.xml b/buildADQL.xml index fd486b1ca049c206d66b697d8162c53efb021a85..c0fe2b3d09d5b1b7784b7c20d53e3d8ecd077bb1 100644 --- a/buildADQL.xml +++ b/buildADQL.xml @@ -5,7 +5,9 @@ <property name="version" value="1.4" /> <property name="srcDir" value="src" /> + <property name="testDir" value="test" /> <property name="compileDir" value="antBuild" /> + <property name="junitBuildDir" value="junitBuild" /> <property name="classesDir" value="${compileDir}"/> <property name="javadocDir" value="javadoc/adql" /> @@ -29,10 +31,6 @@ <condition><not><isset property="POSTGRES"/></not></condition> </fail> - <fail message="The property SERVLET-API must be set! It provides the path toward a directory or a JAR which contains all classes inside javax.servlet."> - <condition><not><isset property="SERVLET-API"/></not></condition> - </fail> - <fail message="The property JUNIT-API must be set! It provides the path toward a directory or a JAR which contains all classes needed to use JUnit."> <condition><not><isset property="JUNIT-API"/></not></condition> </fail> @@ -64,17 +62,34 @@ <delete dir="${junitReportsDir}" failonerror="false" /> </target> - <target name="junitValidation" depends="cleanJUnitReports" description="Executes all JUnit tests before building the library and stop ANT at any error."> + <target name="junitValidation" depends="cleanJUnitReports,compileJUnit" description="Executes all JUnit tests before building the library and stop ANT at any error."> <mkdir dir="${junitReportsDir}"/> <junit errorproperty="adqlTestsFailure" failureproperty="adqlTestsFailure"> <classpath refid="junit.class.path" /> + <classpath> + <pathelement location="${compileDir}" /> + <pathelement location="${junitBuildDir}" /> + </classpath> <formatter type="brief" usefile="yes" /> <batchtest todir="${junitReportsDir}"> <fileset dir="${testsDir}" includes="adql/**/Test*.java" /> </batchtest> </junit> + <delete dir="${junitBuildDir}" failonerror="false" /> <fail if="${adqlTestsFailure}" message="Failed JUnit validation for ADQL Lib.!" /> </target> + + <target name="compileJUnit" depends="compileLib" description="Build all the classes to test the ADQL library."> + <mkdir dir="${junitBuildDir}" /> + <javac destdir="${junitBuildDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" bootclasspath="${adql.bootclasspath}" debug="true"> + <src path="${testDir}" /> + <classpath refid="junit.class.path" /> + <classpath refid="adql.classpath" /> + <classpath> + <pathelement location="${compileDir}" /> + </classpath> + </javac> + </target> <!-- LIB & SOURCES --> <target name="clean" description="Delete the JARs for the library (classes), the runnable ADQL parser and for its sources for the set version."> @@ -83,16 +98,17 @@ <delete file="${adqlParserJarFile}" failonerror="false" /> <symlink action="delete" link="${adqlParserLink}" failonerror="false" /> <delete dir="${compileDir}" failonerror="false" /> + <delete dir="${junitBuildDir}" failonerror="false" /> </target> - <target name="compileLib" depends="clean,junitValidation" description="Build all the classes of the ADQL library. This target is particularly usefull because it lets highlighting missing dependencies."> + <target name="compileLib" depends="clean" description="Build all the classes of the ADQL library. This target is particularly usefull because it lets highlighting missing dependencies."> <mkdir dir="${compileDir}" /> <javac destdir="${compileDir}" srcdir="${srcDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" bootclasspath="${adql.bootclasspath}" debug="true"> <classpath refid="adql.classpath" /> </javac> </target> - <target name="buildLib" depends="compileLib" description="After 'clean', build the library JAR (only classes) and the runnable ADQL parser."> + <target name="buildLib" depends="compileLib,junitValidation" description="After 'clean', build the library JAR (only classes) and the runnable ADQL parser."> <echo>Generate the library:</echo> <jar basedir="${classesDir}" destfile="${libJarFile}" includes="${includesList}" /> <echo>Generate the ADQL parser:</echo> @@ -133,4 +149,4 @@ <jar destfile="${javadocJarFile}" basedir="${javadocDir}" /> </target> -</project> +</project> \ No newline at end of file diff --git a/buildTAP.xml b/buildTAP.xml index 5a937ca4a5e67605cd3b3b40b13cc7609e070cf3..99dbb4afd2ff79cf71200b993a816e3c287d5d09 100644 --- a/buildTAP.xml +++ b/buildTAP.xml @@ -5,8 +5,10 @@ <property name="version" value="2.1" /> <property name="srcDir" value="src" /> + <property name="testDir" value="test" /> <property name="libDir" value="lib" /> <property name="compileDir" value="antBuild" /> + <property name="junitBuildDir" value="junitBuild" /> <property name="classesDir" value="${compileDir}"/> <property name="javadocDir" value="javadoc/tap" /> @@ -83,12 +85,16 @@ <delete dir="${tapJunitReportsDir}" failonerror="false" /> </target> - <target name="junitValidation" depends="cleanJUnitReports" description="Executes all JUnit tests before building the library and stop ANT at any error."> + <target name="junitValidation" depends="cleanJUnitReports,compileJUnit" description="Executes all JUnit tests before building the library and stop ANT at any error."> <mkdir dir="${adqlJunitReportsDir}"/> <mkdir dir="${uwsJunitReportsDir}"/> <mkdir dir="${tapJunitReportsDir}"/> <junit errorproperty="testsFailure" failureproperty="testsFailure"> <classpath refid="junit.class.path" /> + <classpath> + <pathelement location="${compileDir}" /> + <pathelement location="${junitBuildDir}" /> + </classpath> <formatter type="brief" usefile="yes" /> <batchtest todir="${adqlJunitReportsDir}"> <fileset dir="${testsDir}" includes="adql/**/Test*.java" /> @@ -100,33 +106,47 @@ <fileset dir="${testsDir}" includes="tap/**/Test*.java" /> </batchtest> </junit> + <delete dir="${junitBuildDir}" failonerror="false" /> <fail if="${testsFailure}" message="Failed JUnit validation for ADQL, UWS or TAP Lib.!" /> </target> + + <target name="compileJUnit" depends="compileLib" description="Build all the classes to test the TAP library."> + <mkdir dir="${junitBuildDir}" /> + <javac destdir="${junitBuildDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" bootclasspath="${tap.bootclasspath}" debug="true"> + <src path="${testDir}" /> + <classpath refid="junit.class.path" /> + <classpath refid="tap.classpath" /> + <classpath> + <pathelement location="${compileDir}" /> + </classpath> + </javac> + </target> <!-- LIB & SOURCES --> <target name="clean" description="Delete the JARs for the library (classes) and for its sources for the set version."> <delete file="${libJarFile}" failonerror="false" /> <delete file="${srcJarFile}" failonerror="false" /> <delete dir="${compileDir}" failonerror="false" /> + <delete dir="${junitBuildDir}" failonerror="false" /> </target> - <target name="compileLib" depends="clean,junitValidation" description="Build all the classes of the TAP library. This target is particularly usefull because it lets highlighting missing dependencies."> + <target name="compileLib" depends="clean" description="Build all the classes of the TAP library. This target is particularly usefull because it lets highlighting missing dependencies."> <mkdir dir="${compileDir}" /> <javac destdir="${compileDir}" srcdir="${srcDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" debug="true"> <classpath refid="tap.classpath" /> </javac> </target> - <target name="buildLib" depends="compileLib" description="After 'clean', build the library JAR (only classes)."> + <target name="buildLib" depends="compileLib,junitValidation" description="After 'clean', build the library JAR (only classes)."> <echo>Generate the library:</echo> <jar basedir="${classesDir}" destfile="${libJarFileWithSTIL}" includes="${includesList}"> <zipfileset src="${cosJar}" excludes="META-INF/*" /> <zipfileset src="${stilJar}" excludes="META-INF/*" /> - <zipfileset dir="src" includes="${licensePath}" /> + <zipfileset dir="${srcDir}" includes="${licensePath}" /> </jar> <jar basedir="${classesDir}" destfile="${libJarFile}" includes="${includesList}"> <zipfileset src="${cosJar}" excludes="META-INF/*" /> - <zipfileset dir="src" includes="${licensePath}" /> + <zipfileset dir="${srcDir}" includes="${licensePath}" /> </jar> <delete dir="${compileDir}" failonerror="true" /> </target> diff --git a/buildUWS.xml b/buildUWS.xml index f3cf96ff374fb351342119f5fc18a481374c9651..ee76a3a86f3c613df64f328439003befd0108446 100644 --- a/buildUWS.xml +++ b/buildUWS.xml @@ -5,8 +5,10 @@ <property name="version" value="4.2" /> <property name="srcDir" value="src" /> + <property name="testDir" value="test" /> <property name="libDir" value="lib" /> <property name="compileDir" value="antBuild" /> + <property name="junitBuildDir" value="junitBuild" /> <property name="classesDir" value="${compileDir}"/> <property name="javadocDir" value="javadoc/uws" /> @@ -58,17 +60,34 @@ <delete dir="${junitReportsDir}" failonerror="false" /> </target> - <target name="junitValidation" depends="cleanJUnitReports" description="Executes all JUnit tests before building the library and stop ANT at any error."> + <target name="junitValidation" depends="cleanJUnitReports,compileJUnit" description="Executes all JUnit tests before building the library and stop ANT at any error."> <mkdir dir="${junitReportsDir}"/> <junit errorproperty="uwsTestsFailure" failureproperty="uwsTestsFailure"> <classpath refid="junit.class.path" /> + <classpath> + <pathelement location="${compileDir}" /> + <pathelement location="${junitBuildDir}" /> + </classpath> <formatter type="brief" usefile="yes" /> <batchtest todir="${junitReportsDir}"> <fileset dir="${testsDir}" includes="uws/**/Test*.java" /> </batchtest> </junit> + <delete dir="${junitBuildDir}" failonerror="false" /> <fail if="${uwsTestsFailure}" message="Failed JUnit validation for UWS Lib.!" /> </target> + + <target name="compileJUnit" depends="compileLib" description="Build all the classes to test the UWS library."> + <mkdir dir="${junitBuildDir}" /> + <javac destdir="${junitBuildDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" bootclasspath="${uws.bootclasspath}" debug="true"> + <src path="${testDir}" /> + <classpath refid="junit.class.path" /> + <classpath refid="uws.classpath" /> + <classpath> + <pathelement location="${compileDir}" /> + </classpath> + </javac> + </target> <!-- LIB & SOURCES --> <target name="clean" description="Delete the JARs for the library (classes) and for its sources for the set version."> @@ -77,18 +96,18 @@ <delete dir="${compileDir}" failonerror="false" /> </target> - <target name="compileLib" depends="clean,junitValidation" description="Build all the classes of the UWS library. This target is particularly usefull because it lets highlighting missing dependencies."> + <target name="compileLib" depends="clean" description="Build all the classes of the UWS library. This target is particularly usefull because it lets highlighting missing dependencies."> <mkdir dir="${compileDir}" /> <javac destdir="${compileDir}" srcdir="${srcDir}" includes="${includesList}" includeantruntime="false" encoding="utf8" debug="true"> <classpath refid="uws.classpath" /> </javac> </target> - <target name="buildLib" depends="compileLib" description="After 'clean', build the library JAR (only classes)."> + <target name="buildLib" depends="compileLib,junitValidation" description="After 'clean', build the library JAR (only classes)."> <echo>Generate the library:</echo> <jar basedir="${classesDir}" destfile="${libJarFile}" includes="${includesList}"> <zipfileset src="${cosJar}" excludes="META-INF/*" /> - <zipfileset dir="src" includes="${licensePath}" /> + <zipfileset dir="${srcDir}" includes="${licensePath}" /> </jar> <delete dir="${compileDir}" failonerror="true" /> </target>