|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<project name="restsql-test" default="all"> |
| 3 | + <property file="build.properties" /> |
| 4 | + |
| 5 | + <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpath="../restsql/lib/jaxb-xjc.jar" /> |
| 6 | + |
| 7 | + <target name="all" depends="clean,test-api,test-service-http,test-report" /> |
| 8 | + |
| 9 | + <target name="clean"> |
| 10 | + <delete dir="obj" failonerror="false" includeEmptyDirs="true" quiet="true" /> |
| 11 | + </target> |
| 12 | + |
| 13 | + <target name="compile-schema"> |
| 14 | + <!-- Create output dir --> |
| 15 | + <mkdir dir="obj/bin" /> |
| 16 | + |
| 17 | + <xjc destdir="src" package="org.restsql.service.testcase" removeOldOutput="yes"> |
| 18 | + <schema file="src/resources/xml/service/testcase/ServiceTestCaseDefinition.xsd" /> |
| 19 | + <depends file="src/resources/xml/service/testcase/ServiceTestCaseDefinition.xsd" /> |
| 20 | + <produces dir="obj/bin" /> |
| 21 | + </xjc> |
| 22 | + </target> |
| 23 | + |
| 24 | + <target name="compile-tests"> |
| 25 | + <ant antfile="../restsql/build.xml" target="compile" inheritall="no" /> |
| 26 | + |
| 27 | + <!-- Create output dir --> |
| 28 | + <mkdir dir="obj/bin" /> |
| 29 | + |
| 30 | + <!-- Copy supporting files --> |
| 31 | + <copy todir="obj/bin"> |
| 32 | + <fileset dir="src"> |
| 33 | + <include name="**/*.properties" /> |
| 34 | + <include name="**/*.xml" /> |
| 35 | + <include name="**/*.xsd" /> |
| 36 | + </fileset> |
| 37 | + </copy> |
| 38 | + |
| 39 | + <!-- Compile tests --> |
| 40 | + <javac srcdir="src" destdir="obj/bin" classpath="${test-compile.classpath}" debug="true" /> |
| 41 | + </target> |
| 42 | + |
| 43 | + <target name="test-api" depends="compile-tests"> |
| 44 | + <!-- Create output dir --> |
| 45 | + <delete dir="obj/test" /> |
| 46 | + <mkdir dir="obj/test" /> |
| 47 | + |
| 48 | + <!-- Execute tests --> |
| 49 | + <junit fork="true" showoutput="true" printsummary="true" tempdir="obj/test" dir="${basedir}"> |
| 50 | + <sysproperty key="java.util.logging.config.file" value="/restsql/eclipse-workspace/restsql-test/src/resources/properties/test-logging-file.properties" /> |
| 51 | + <classpath path="${test-exec.classpath}" /> |
| 52 | + <formatter type="xml" /> |
| 53 | + <batchtest todir="obj/test"> |
| 54 | + <fileset dir="src" includes="**/*Test.*" excludes="" /> |
| 55 | + </batchtest> |
| 56 | + </junit> |
| 57 | + </target> |
| 58 | + |
| 59 | + <!-- Creates report for API test --> |
| 60 | + <target name="test-report"> |
| 61 | + <!-- Create output dir --> |
| 62 | + <delete dir="obj/test/report" /> |
| 63 | + <mkdir dir="obj/test/report" /> |
| 64 | + |
| 65 | + <!-- Create report --> |
| 66 | + <junitreport todir="obj/test"> |
| 67 | + <fileset dir="obj/test"> |
| 68 | + <include name="TEST-*.xml" /> |
| 69 | + </fileset> |
| 70 | + <report format="frames" todir="obj/test/report" /> |
| 71 | + </junitreport> |
| 72 | + </target> |
| 73 | + |
| 74 | + <target name="test-service-http"> |
| 75 | + <antcall target="-test-service"> |
| 76 | + <param name="testStyle" value="http" /> |
| 77 | + <param name="testList" value="%" /> |
| 78 | + </antcall> |
| 79 | + </target> |
| 80 | + |
| 81 | + <target name="test-service-http-subset"> |
| 82 | + <antcall target="-test-service"> |
| 83 | + <param name="testStyle" value="http" /> |
| 84 | + <param name="testList" value="${test.list}" /> |
| 85 | + </antcall> |
| 86 | + </target> |
| 87 | + |
| 88 | + <target name="test-service-java"> |
| 89 | + <antcall target="-test-service"> |
| 90 | + <param name="testStyle" value="java" /> |
| 91 | + <param name="testList" value="%" /> |
| 92 | + </antcall> |
| 93 | + </target> |
| 94 | + |
| 95 | + <target name="test-service-java-subset"> |
| 96 | + <antcall target="-test-service"> |
| 97 | + <param name="testStyle" value="java" /> |
| 98 | + <param name="testList" value="${test.list}" /> |
| 99 | + </antcall> |
| 100 | + </target> |
| 101 | + |
| 102 | + <target name="-test-service" depends="compile-tests"> |
| 103 | + <property name="org.restsql.baseUri" value="http://localhost:8080/restsql/" /> |
| 104 | + <java fork="true" classpath="${test-exec.classpath}" classname="org.restsql.service.ServiceTestRunner" dir="${basedir}"> |
| 105 | + <arg value="${testStyle}" /> |
| 106 | + <arg value="${testList}" /> |
| 107 | + <jvmarg value="-Dorg.restsql.baseUri=${org.restsql.baseUri}" /> |
| 108 | + </java> |
| 109 | + </target> |
| 110 | + |
| 111 | +</project> |
0 commit comments