From 813ded32226f5b99716198e86a2d7aa31539fce8 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Thu, 10 Apr 2014 11:09:36 +0200
Subject: [PATCH] TAP: Execute all JUnit tests before building the TAP library.
 At any JUnit failure, the build is canceled + Update the version number for
 the generated JARs.

---
 buildADQL.xml |  2 +-
 buildTAP.xml  | 30 +++++++++++++++++++++++++++---
 buildUWS.xml  |  2 +-
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/buildADQL.xml b/buildADQL.xml
index 9f31e15..398c502 100644
--- a/buildADQL.xml
+++ b/buildADQL.xml
@@ -2,7 +2,7 @@
 <!DOCTYPE project>
 <project name="adql" basedir="." default="buildLib">
 	
-	<property name="version" value="1.1" />
+	<property name="version" value="1.2" />
 
 	<property name="srcDir" value="src" />
 	<property name="compileDir" value="antBuild" />
diff --git a/buildTAP.xml b/buildTAP.xml
index 28c4378..0680755 100644
--- a/buildTAP.xml
+++ b/buildTAP.xml
@@ -2,7 +2,7 @@
 <!DOCTYPE project>
 <project name="tap" basedir="." default="buildLib">
 	
-	<property name="version" value="1.0" />
+	<property name="version" value="1.1" />
 
 	<property name="srcDir" value="src" />
 	<property name="compileDir" value="antBuild" />
@@ -28,14 +28,29 @@
 	<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>
 	
 	<path id="tap.classpath">
 		<pathelement location="${uploadUtilsJar}" />
 		<pathelement location="${CATALINA}" />
 		<pathelement location="${SERVLET-API}" />
+		<pathelement path="${JUNIT-API}" />
 	</path>
 	
-	<echo>TAP LIBRARY VERSION = ${version}</echo>
+	<!-- Define the classpath which includes the junit.jar and the classes after compiling-->
+		<path id="junit.class.path">
+			<pathelement path="${JUNIT-API}" />
+			<pathelement location="/opt/Java_Libraries/postgresql-9.3-1100.jdbc3.jar" />
+			<pathelement location="${jsonJar}" />
+			<pathelement location="${uploadUtilsJar}" />
+			<pathelement location="${CATALINA}" />
+			<pathelement location="${SERVLET-API}" />
+			<pathelement location="bin" />
+		</path>
+		
+		<echo>TAP LIBRARY VERSION = ${version}</echo>
 	
 	<!-- BUILD ALL TASK -->
 	<target name="buildAll" depends="buildLibAndSrc,buildJavadoc"
@@ -46,7 +61,16 @@
 	<target name="cleanAll" depends="clean,cleanJavadoc" description="Delete all files generated by this ANT file for the set version." />
 			
 	<!-- LIB & SOURCES -->
-	<target name="clean" description="Delete the JARs for the library (classes) and for its sources for the set version.">
+	<target name="junitValidation" description="Executes all JUnit tests before building the library and stop ANT at any error.">
+			<junit printsummary="on" fork="yes" haltonfailure="yes">
+				<classpath refid="junit.class.path" />
+				<test name="tap.config.AllTests" outfile="testReports">
+					<formatter type="plain" usefile="yes" />
+				</test>
+			</junit>
+		</target>
+		
+		<target name="clean" depends="junitValidation" 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" />
diff --git a/buildUWS.xml b/buildUWS.xml
index 6bf8219..4bdf61f 100644
--- a/buildUWS.xml
+++ b/buildUWS.xml
@@ -2,7 +2,7 @@
 <!DOCTYPE project>
 <project name="uws" basedir="." default="buildLib">
 	
-	<property name="version" value="4.0" />
+	<property name="version" value="4.1" />
 
 	<property name="srcDir" value="src" />
 	<property name="compileDir" value="antBuild" />
-- 
GitLab