From a9e79b5d7a12f31f5f694595110cf11c1993cbc0 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@hostsharing.net>
Date: Fri, 06 May 2011 13:10:41 +0200
Subject: [PATCH] Aufruf der JUnit Tests

---
 hsarback/build.xml |   68 ++++++++++++++++++++++++++++++---
 1 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/hsarback/build.xml b/hsarback/build.xml
index b891cfb..9594f78 100644
--- a/hsarback/build.xml
+++ b/hsarback/build.xml
@@ -5,8 +5,11 @@
 	<property name="lib.home" value="${basedir}/lib" />
 	<property name="conf.home" value="${basedir}/conf" />
 	<property name="src.home" value="${basedir}/src" />
+	<property name="test.home" value="${basedir}/test" />
 	<property name="dist.home" value="${basedir}/dist" />
 
+	<property file="${user.home}/.hsar.ant.properties" />
+	
 	<!-- Optionen  für Java-Compiler-->
 	<property name="compile.debug" value="true" />
 	<property name="compile.deprecation" value="true" />
@@ -31,7 +34,20 @@
 		<delete dir="${dist.home}" />
 	</target>
 
+	<target name="deploy" depends="war">
+		<delete dir="${hsar.deploy.dir}/hsar" />
+		<copy file="build/hsar.war" todir="${hsar.deploy.dir}" />
+	</target>
+
 	<target name="war" depends="enhance">
+		<copy file="conf/WEB-INF/web.xml" todir="webapp/WEB-INF/">
+			<filterset>
+				<filter token="LOGIN_HOST" value="${cas.domain.name}"/>
+				<filter token="LOGIN_PORT" value="${cas.https.port}"/>
+				<filter token="CONFIG_HOST" value="${hsar.domain.name}"/>
+				<filter token="CONFIG_PORT" value="${hsar.https.port}"/>
+			</filterset>
+		</copy>
         <war destfile="build/hsar.war" basedir="webapp">
         	<lib dir="lib">
     		    <include name="**/*.jar"/>
@@ -52,8 +68,21 @@
 	<target name="compile" description="compilieren">
 		<mkdir dir="${build.home}" />
 		<mkdir dir="${build.home}/cls" />
-		<javac srcdir="${src.home}" destdir="${build.home}/cls" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
+		<javac srcdir="${src.home}" destdir="${build.home}/cls" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" encoding="UTF8">
 			<classpath refid="compile.classpath" />
+		</javac>
+	</target>
+
+	<target name="compile-test" description="tests compilieren" depends="compile">
+		<mkdir dir="${build.home}" />
+		<mkdir dir="${build.home}/test" />
+		<javac srcdir="${test.home}" destdir="${build.home}/test" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" encoding="UTF8">
+			<classpath refid="compile.classpath" />
+			<classpath>
+				<pathelement path="${compile.classpath}"/>
+				<pathelement location="${build.home}/cls"/>
+				<pathelement path="/usr/share/java/junit4.jar"/>
+			</classpath>
 		</javac>
 	</target>
 
@@ -72,17 +101,42 @@
 
 	<target name="init-db" description="init empty database">
 		<sql
-			classpath="/usr/share/java/postgresql-jdbc3-8.2.jar"
+			classpath="/usr/share/java/postgresql-jdbc3.jar"
 			driver="org.postgresql.Driver" 
-			url="jdbc:postgresql://localhost:5432/hsh02_hsdb1" 
-			userid="hsh02_hsdb" password="Phoh9t" 
+			url="jdbc:postgresql://localhost:5432/${database.name}"
+			userid="${database.user}" password="${database.password}" 
 			src="database/schema.sql" />		
 		<sql
-			classpath="/usr/share/java/postgresql-jdbc3-8.2.jar"
+			classpath="/usr/share/java/postgresql-jdbc3.jar"
 			driver="org.postgresql.Driver" 
-			url="jdbc:postgresql://localhost:5432/hsh02_hsdb1" 
-			userid="hsh02_hsdb" password="Phoh9t" 
+			url="jdbc:postgresql://localhost:5432/${database.name}"
+			userid="${database.user}" password="${database.password}" 
 			src="database/data.sql" />		
 	</target>
 	
+	<target name="drop-db" description="make empty database">
+		<sql
+			classpath="/usr/share/java/postgresql-jdbc3.jar"
+			driver="org.postgresql.Driver" 
+			url="jdbc:postgresql://localhost:5432/${database.name}"
+			userid="${database.user}" password="${database.password}" 
+			src="database/dropschema.sql" />		
+	</target>
+	
+	<target name="remote-test" description="inspection of xmlrpc-api" depends="compile-test">
+		<mkdir dir="${build.home}/junit" />
+		<junit printsummary="yes" fork="yes">
+			<classpath>
+				<fileset dir="lib">
+					<include name="*.jar" />
+				</fileset>
+				<pathelement location="${build.home}/cls"/>
+				<pathelement location="${build.home}/test"/>
+				<pathelement path="/usr/share/java/junit4.jar"/>
+			</classpath>
+			<formatter type="xml"/>
+			<test name="de.hsadmin.remote.RemoteTest" todir="${build.home}/junit" />
+		</junit>
+	</target>
+	
 </project>

--
Gitblit v1.9.3