-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.xml
226 lines (193 loc) · 8.88 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<?xml version="1.0" encoding="UTF-8"?>
<project name="restsql-test" default="test-all">
<property file="build.properties" />
<property name="api-test.dir" value="obj/test/api" />
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpath="../restsql/lib/jaxb-xjc.jar" />
<target name="test-all" depends="test-api,test-api-report,test-service-http" />
<target name="clean" description="deletes output dir">
<delete dir="obj" failonerror="false" includeEmptyDirs="true" quiet="true" />
</target>
<target name="compile-schema" description="compiles test case definition schema">
<!-- Create output dir -->
<mkdir dir="obj/bin" />
<xjc destdir="src" package="org.restsql.service.testcase" removeOldOutput="yes">
<schema file="src/resources/xml/service/testcase/ServiceTestCaseDefinition.xsd" />
<depends file="src/resources/xml/service/testcase/ServiceTestCaseDefinition.xsd" />
<produces dir="obj/bin" />
</xjc>
</target>
<target name="compile-tests" description="compiles JUnit tests">
<ant antfile="../restsql/build.xml" target="compile" inheritall="no" />
<!-- Create output dir -->
<mkdir dir="obj/bin" />
<!-- Copy supporting files -->
<copy todir="obj/bin">
<fileset dir="src">
<include name="**/*.properties" />
<include name="**/*.xml" />
<include name="**/*.xsd" />
</fileset>
</copy>
<!-- Compile tests -->
<javac srcdir="src" destdir="obj/bin" classpath="${test-compile.classpath}" includeantruntime="false" debug="true" />
</target>
<target name="exec-examples" description="executes sample programs">
<ant antfile="../restsql-sdk/build.xml" target="exec-examples" inheritall="false" />
</target>
<target name="prep-mysql" description="prepares /etc/opt/restsql for http tests with mysql">
<antcall target="-prep">
<param name="database" value="mysql" />
</antcall>
</target>
<target name="prep-pgsql" description="prepares /etc/opt/restsql for http tests with postgresql">
<antcall target="-prep">
<param name="database" value="postgresql" />
</antcall>
</target>
<target name="-prep" depends="compile-tests" description="prepares /etc/opt/restsql for tests for specified database">
<delete file="/etc/opt/restsql/privileges.properties" />
<delete file="/etc/opt/restsql/restsql.properties" />
<copy file="src/resources/properties/restsql-${database}.properties" tofile="/etc/opt/restsql/restsql.properties" />
<copy todir="/etc/opt/restsql/sqlresources">
<fileset dir="src/resources/xml/sqlresources" />
</copy>
<copy file="src/resources/properties/triggers.properties" tofile="/etc/opt/restsql/triggers.properties" />
<copy todir="/etc/opt/restsql/triggers">
<fileset dir="obj/bin" />
</copy>
</target>
<target name="test-api" depends="compile-tests" description="exercises junit tests for java api">
<antcall target="-test-api">
<param name="includes" value="**/*Test.*" />
<param name="excludes" value="**/Base*.*,org/restsql/security/**" />
</antcall>
</target>
<target name="test-api-pgsql" depends="compile-tests" description="exercises junit tests for java api-pgsql">
<antcall target="-test-api">
<param name="propertiesFile" value="${org.restsql.pgsql-properties}" />
<param name="includes" value="**/*Test.*" />
<param name="excludes" value="**/Base*.*,org/restsql/security/**" />
</antcall>
</target>
<target name="test-api-security" depends="compile-tests" description="exercises security junit tests for java api">
<antcall target="-test-api">
<param name="includes" value="org/restsql/security/*Test.*,org/restsql/security/impl/*Test.*" />
<param name="excludes" value="**/Base*.*" />
</antcall>
</target>
<target name="-test-api">
<property name="propertiesFile" value="${org.restsql.properties}" />
<echo message="Using ${propertiesFile}" />
<!-- Create output dir -->
<delete dir="${api-test.dir}" />
<mkdir dir="${api-test.dir}" />
<!-- Execute tests -->
<junit fork="true" showoutput="true" printsummary="true" tempdir="${api-test.dir}" dir="${basedir}">
<sysproperty key="org.restsql.properties" value="${propertiesFile}" />
<classpath path="${test-exec.classpath}" />
<formatter type="xml" />
<batchtest todir="${api-test.dir}">
<fileset dir="src" includes="${includes}" excludes="${excludes}" />
</batchtest>
</junit>
</target>
<!-- Creates report for API test -->
<target name="test-api-report" description="generates junit report for api tests">
<!-- Create output dir -->
<delete dir="${api-test.dir}/report" />
<mkdir dir="${api-test.dir}/report" />
<!-- Create report -->
<junitreport todir="${api-test.dir}">
<fileset dir="${api-test.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${api-test.dir}/report" />
</junitreport>
</target>
<target name="test-service-http" description="executes all test cases for the http interface">
<antcall target="-test-service">
<param name="style" value="http" />
<param name="scope" value="all" />
<param name="exclude" value="Security" />
</antcall>
</target>
<target name="test-service-http-pgsql" description="executes all test cases for the http interface-pgsql">
<antcall target="-test-service">
<param name="style" value="http" />
<param name="scope" value="all" />
<param name="exclude" value="Security,MySqlOnly" />
<param name="propertiesFile" value="${org.restsql.pgsql-properties}" />
</antcall>
</target>
<target name="test-service-http-security" description="executes security test cases for the http interface">
<antcall target="-test-service">
<param name="style" value="http" />
<param name="scope" value="Security" />
<param name="exclude" value="none" />
</antcall>
</target>
<target name="test-service-http-subset" description="executes some of test cases for the http interface">
<antcall target="-test-service">
<param name="style" value="http" />
<param name="scope" value="${test.list}" />
<param name="exclude" value="none" />
</antcall>
</target>
<target name="test-service-http-subset-pgsql" description="executes some of test cases for the http interface-pgsql">
<antcall target="-test-service">
<param name="style" value="http" />
<param name="scope" value="${test.list}" />
<param name="exclude" value="MySqlOnly" />
<param name="propertiesFile" value="${org.restsql.pgsql-properties}" />
</antcall>
</target>
<target name="test-service-java" description="executes all test cases for the service's java interface, excluding security">
<antcall target="-test-service">
<param name="style" value="java" />
<param name="scope" value="all" />
<param name="exclude" value="Security" />
</antcall>
</target>
<target name="test-service-java-pgsql" description="executes all test cases for the service's java interface, excluding security-pgsql">
<antcall target="-test-service">
<param name="style" value="java" />
<param name="scope" value="all" />
<param name="exclude" value="Security,MySqlOnly" />
<param name="propertiesFile" value="${org.restsql.pgsql-properties}" />
</antcall>
</target>
<target name="test-service-java-default-properties" description="executes all test cases for the service's java interface, excluding security">
<antcall target="-test-service">
<param name="style" value="java" />
<param name="scope" value="all" />
<param name="exclude" value="Security" />
<param name="propertiesFile" value="${org.restsql.default-properties}" />
</antcall>
</target>
<target name="test-service-java-subset" description="executes some test cases for the service's java interface">
<antcall target="-test-service">
<param name="style" value="java" />
<param name="scope" value="${test.list}" />
<param name="exclude" value="none" />
</antcall>
</target>
<target name="test-service-java-subset-pgsql" description="executes some test cases for the service's java interface-pgsql">
<antcall target="-test-service">
<param name="style" value="java" />
<param name="scope" value="${test.list}" />
<param name="exclude" value="MySqlOnly" />
<param name="propertiesFile" value="${org.restsql.pgsql-properties}" />
</antcall>
</target>
<target name="-test-service" depends="compile-tests">
<property name="propertiesFile" value="${org.restsql.properties}" />
<java fork="true" classpath="${test-exec.classpath}" classname="org.restsql.service.ServiceTestRunner" dir="${basedir}">
<arg value="${style}" />
<arg value="${scope}" />
<arg value="${exclude}" />
<jvmarg value="-Dorg.restsql.baseUri=${org.restsql.baseUri}" />
<jvmarg value="-Dorg.restsql.properties=${propertiesFile}" />
<jvmarg value="-Dorg.restsql.testDatabase=${org.restsql.testDatabase}" />
</java>
</target>
</project>