Commit 0422fb7d authored by gmantele's avatar gmantele
Browse files

[TAP] Fix and add JUnit tests. Now, they should work on any machine.

Two embedded DBMS are used: H2 and a little SQLite. JDBC drivers are provided
in the `lib` directory. The databases are created and deleted automatically
by the JUnit tests (see `test/tap/db_testtools/DBTools for more details`).

The ANT and Gradle build scripts have been updated to reflect all these test
modifications.
parent 005fc622
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
apply plugin: 'java'
apply plugin: 'war'

compileJava.options.encoding = 'UTF-8'

test{
	forkEvery = 1
	include '**/Test*'
}

repositories {
    jcenter()
    mavenCentral()
@@ -8,14 +15,18 @@ repositories {
}

dependencies {
    compile fileTree(dir: 'lib', include: '*.jar')
    compile fileTree(dir: 'lib', includes: ['stil_3.1.jar','cos-1.5beta.jar'])
    compile 'javax.servlet:javax.servlet-api:3.0.1'
    compile 'postgresql:postgresql:9.1-901.jdbc4'

    testCompile 'simple-jndi:simple-jndi:0.11.4.1'
    testCompile 'junit:junit:4.12'
    testCompile 'org.xerial:sqlite-jdbc:3.16.1'
    testCompile 'com.h2database:h2:1.4.193'
    testCompile 'com.vividsolutions:jts-core:1.14.0'
    testCompile 'org.locationtech.spatial4j:spatial4j:0.6'
    testCompile fileTree(dir: 'lib', include: 'astroh2-0.3.jar')
}

sourceSets.main.java.srcDirs = ["src"]
// the tests fail because they have environemnt specific parameters
// sourceSets.test.java.srcDirs = ["test"]
sourceSets.test.java.srcDirs = ["test"]
+25 −2
Original line number Diff line number Diff line
@@ -17,6 +17,18 @@
	<property name="stilJarName" value="stil_3.1.jar" />
	<property name="stilJar" value="${libDir}/${stilJarName}" />

	<property name="sqliteJarName" value="sqlite-jdbc-3.16.1.jar" />
	<property name="sqliteJar" value="${libDir}/${sqliteJarName}" />

	<property name="h2JarName" value="h2-1.4.193.jar" />
	<property name="h2Jar" value="${libDir}/${h2JarName}" />
	<property name="jtsJarName" value="jts-core-1.14.0.jar" />
	<property name="jtsJar" value="${libDir}/${jtsJarName}" />
	<property name="spatial4jJarName" value="spatial4j-0.6.jar" />
	<property name="spatial4jJar" value="${libDir}/${spatial4jJarName}" />
	<property name="astroh2JarName" value="astroh2-0.3.jar" />
	<property name="astroh2Jar" value="${libDir}/${astroh2JarName}" />
		
	<property name="tapPath" value="tap/**,adql/**,uws/**,cds/**" />
	<property name="jsonPath" value="org/json/**" />
	<property name="extLibsPath" value="com/oreilly/servlet/**,nom/tam/**,org/apache/tools/bzip2/**,uk/ac/starlink/**" />
@@ -61,11 +73,22 @@
		<pathelement location="${SERVLET-API}" />
	</path>
	
	<path id="h2.classpath">
		<pathelement location="${h2Jar}" />
		<pathelement location="${jtsJar}" />
		<pathelement location="${spatial4jJar}" />
		<pathelement location="${astroh2Jar}" />
	</path>
	
	<path id="junit.class.path">
		<path refid="tap.classpath" />
		<pathelement path="${JNDI-API}" />
		<pathelement path="${JUNIT-API}" />
			
		<path refid="tap.classpath" />
		<pathelement location="bin" />
		
		<path refid="h2.classpath" />
		<pathelement location="${sqliteJar}" />
	</path>
	
	<echo>TAP LIBRARY VERSION = ${version}</echo>
@@ -89,7 +112,7 @@
		<mkdir dir="${adqlJunitReportsDir}"/>
		<mkdir dir="${uwsJunitReportsDir}"/>
		<mkdir dir="${tapJunitReportsDir}"/>
		<junit errorproperty="testsFailure" failureproperty="testsFailure">
		<junit fork="true" errorproperty="testsFailure" failureproperty="testsFailure">
			<classpath refid="junit.class.path" />
			<classpath>
				<pathelement location="${compileDir}" />

lib/astroh2-0.3.jar

0 → 100644
+15.9 KiB

File added.

No diff preview for this file type.

lib/h2-1.4.193.jar

0 → 100644
+1.71 MiB

File added.

No diff preview for this file type.

+768 KiB

File added.

No diff preview for this file type.

Loading