Removed unnecessary dependencies on org.apache.log4j
[simantics/platform.git] / tests / org.simantics.db.tests / build.xml
1 <!--
2     Copyright (c) 2007, 2010 Association for Decentralized Information Management
3     in Industry THTH ry.
4     All rights reserved. This program and the accompanying materials
5     are made available under the terms of the Eclipse Public License v1.0
6     which accompanies this distribution, and is available at
7     http://www.eclipse.org/legal/epl-v10.html
8    
9     Contributors:
10         VTT Technical Research Centre of Finland - initial API and implementation
11  -->
12 <project name="Run db tests." basedir="." default="all">
13         <!-- Load properties -->
14         <property file="build.properties"/>
15
16         <property name="test.deadlock.timeout" value="3600000"/>
17         <property name="test.exit.timeout" value="${test.deadlock.timeout}"/>
18         <property name="test.configuration" value="regression"/>
19         <property name="test.graph.impl" value="socket"/>
20         <property name="test.transaction.policy" value="keep"/>
21         <property name="test.thread.model" value="4"/>
22         <property name="test.use.failed" value="false"/>
23         <property name="jvmarg.Xmx" value=""/>
24         <property name="jvmarg.ea" value=""/>
25         
26         <condition property="use.failed" value="true">
27         <istrue value="${test.use.failed}"/>
28         </condition>
29
30         <condition property="family" value="win32" else="linux">
31         <os family="windows"/>
32         </condition>
33
34         <condition property="arch" value="x86_64" else="x86">
35                 <or>
36                 <os arch="amd64"/>
37                 <os arch="x86_64"/>
38                 </or>
39         </condition>
40
41         <property name="os.dir" value="${family}.${arch}" />
42
43         <!-- Set properties for directories -->
44         <property name="origin.dir" value="../"/>
45         <property name="lib.dir" value="./lib"/>
46         <property name="run.dir" value="run/"/>
47         <property name="env.dir" value="${run.dir}env/"/>
48         <property name="defaultDb.dir" value="${run.dir}/defaultDb"/>
49         <property name="path.dir" value="env/"/>
50         <property name="target.dir" value="${user.home}/targetDir"/>
51         <property name="databoard.dir" value="${origin.dir}/org.simantics.databoard"/>
52
53         <!-- Set properties for test classes -->
54         <property name="regression.tests" value="org.simantics.db.tests.suite.RegressionTests"/>
55         <property name="performance.tests" value="org.simantics.db.tests.suite.PerformanceTests"/>
56         <property name="plugin.tests" value="org.simantics.db.tests.suite.PluginTests"/>
57         <property name="plugin2.tests" value="org.simantics.db.tests.suite.PluginTests2"/>
58         <property name="stress.tests" value="org.simantics.db.tests.suite.StressTests"/>
59         <property name="temp.tests" value="org.simantics.db.tests.suite.TempTests"/>
60
61         <property name="test.classes.dir" value="./test.classes" />
62         <property name="src.dir" value="src"/>
63         <!--<property name="classes.dir" value="./"/>-->
64         <property name="project.name" value="db"/>
65         <property name="version" value="0.7"/>
66         <property name="user.name" value="VTT"/>
67
68         <!-- Set property for external lib directory 
69         (typically set up as external project within project) -->
70         <property name="lib.dir" value="lib"/>
71
72         <target name="init-dirs">
73                 <!--<echo>Creating folders...</echo>-->
74                 <mkdir dir="${run.dir}" />
75                 <mkdir dir="${defaultDb.dir}" />
76         </target>
77         
78         <target name="-init-prop" depends="init-dirs">
79                 <tstamp>
80                         <format property="start.time" pattern="yyyy-MM-dd-HH-mm-ss" timezone="EET" />
81                 </tstamp>
82                 <path id="env.classpath">
83                         <fileset dir="${run.dir}">
84                                 <include name="**/*.jar" />
85                         </fileset>
86                 </path>
87                 <condition property="env.built">
88                         <resourcecount refid="env.classpath" count="0" when="gt"/>
89                 </condition>
90                 <echo>target.dir=${target.dir}</echo>
91                 <echo>test.deadlock.timeout=${test.deadlock.timeout}</echo>
92                 <echo>test.exit.timeout=${test.exit.timeout}</echo>
93                 <echo>test.configuration=${test.configuration}</echo>
94                 <echo>test.graph.impl=${test.graph.impl}</echo>
95                 <echo>test.transaction.policy=${test.transaction.policy}</echo>
96                 <echo>test.thread.model=${test.thread.model}</echo>
97                 <echo>test.use.failed=${test.use.failed}</echo>
98                 <echo>jvmarg.Xmx=${jvmarg.Xmx}</echo>
99                 <echo>jvmarg.ea=${jvmarg.ea}</echo>
100         </target>
101         
102         <target name="init-db" depends="init-dirs" unless="env.built">
103                 <!--<exec executable="./generate_layer0.bat" osfamily="windows"/>
104                 <exec executable="./generate_layer0.sh" os="Linux"/>-->
105                 <copy todir="${defaultDb.dir}">
106                         <fileset dir="${origin.dir}org.simantics.db.build/${os.dir}">
107                                 <include name="*.cnfg" />
108                                 <!--<include name="*.procore" />-->
109                         </fileset>
110                 </copy>
111         </target>
112
113         <target name="-init" depends="-init-prop"/>
114
115         <target name="env-jars" depends="build-dirs,build-databoard" unless="env.built"/>
116         
117         <target name="build-dirs" unless="env.built">
118                 <fail unless="target.dir" message="Target dir must be set to built runtime environment."/>
119                 <mkdir dir="${run.dir}" />
120                 <mkdir dir="${env.dir}" />
121                 <copy todir="${env.dir}">
122                         <fileset dir="${origin.dir}org.simantics.db.build/${os.dir}">
123                                 <include name="*.dll" />
124                                 <include name="*.so" />
125                         </fileset>
126                 </copy>
127                 <copy todir="${env.dir}">
128                         <fileset dir="${target.dir}">
129                                 <include name="eclipse/plugins/org.junit_4*/junit.jar" />
130                                 <include name="eclipse/plugins/org.junit_4*.jar" />
131                                 <include name="eclipse/plugins/org.eclipse.equinox.p2.metadata_*.jar" />
132                                 <include name="eclipse/plugins/org.eclipse.equinox.common_*.jar" />
133                                 <include name="eclipse/plugins/org.eclipse.equinox.registry_*.jar" />
134                                 <include name="eclipse/plugins/org.eclipse.core.runtime_*.jar" />
135                                 <include name="eclipse/plugins/org.eclipse.osgi_*.jar" />
136                                 <include name="external/plugins/gnu.trove*.jar" />
137                                 <include name="external/plugins/org.apache.commons.collections_*.jar" />
138                                 <include name="external/plugins/org.apache.commons.io_*.jar" />
139                                 <include name="simantics/plugins/org.simantics.databoard_*.jar" />
140                                 <include name="simantics/plugins/org.simantics.db.layer0_*.jar" />
141                                 <include name="simantics/plugins/org.simantics.layer0_*.jar" />
142                                 <!--<include name="org.simantics.project_*.jar" />-->
143                                 <include name="org.eclipse.equinox.p2.metadata_*.jar" />
144                         </fileset>
145                 </copy>
146         </target>
147
148         <target name="build-databoard" unless="env.built">
149                 <ant antfile="build2.xml" dir="${databoard.dir}" inheritAll="false"/>
150                 <copy todir="${env.dir}">
151                         <fileset dir="${databoard.dir}/build">
152                                 <include name="org.simantics.databoard_*.jar" />
153                         </fileset>
154                 </copy>
155         </target>       
156         <target name="build-env" depends="-init,env-jars,init-db,compile" unless="env.built"
157                 description="Build runtime envrionment for the tests.">
158         </target>
159
160         <target name="clean-compile" description="Clean up compiled classes.">
161                 <delete dir="${test.classes.dir}"/>
162         </target>
163         
164         <target name="clean-run" description="Clean up run directory.">
165                 <delete includeEmptyDirs="true">
166                         <fileset dir="${run.dir}" includes="**/*"/>
167                 </delete>
168         </target>
169         
170         <target name="clean" depends="clean-compile,clean-run" description="Clean up generated stuff.">
171                 <!--<echo>Cleaning up...</echo>-->
172         </target>
173
174         <target name="all" depends="clean,regression,performance,stress"  description="Run all pojo tests.">
175                 <echo>Tests done.</echo>
176         </target>
177
178         <target name="regression" depends="build-env" description="Run regression tests.">
179                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
180                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
181                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
182                         <sysproperty key="test.configuration" value="${test.configuration}"/>
183                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
184                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
185                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
186                         <sysproperty key="test.use.failed" value="${test.use.failed}"/>
187                         <jvmarg line="${jvmarg.Xmx}"/>
188                         <jvmarg line="${jvmarg.ea}"/>
189                         <jvmarg value="-Djava.library.path=${path.dir}"/>
190                         <jvmarg value="-Xshare:off"/>
191                         <classpath refid="env.classpath" />
192                         <formatter type="brief" usefile="false"/>
193                         <formatter type="xml" usefile="true"/>
194                         <test name="${regression.tests}" todir="${run.dir}" outfile="${regression.tests}-${start.time}" haltonfailure="true" haltonerror="true" unless="use.failed"/>
195                         <test name="${regression.tests}" todir="${run.dir}" outfile="${regression.tests}-${start.time}" haltonfailure="false" haltonerror="false" if="use.failed"/>
196                 </junit>
197         </target>
198
199         <target name="plugin" depends="build-env" description="Run plugin tests.">
200                 <junit fork="yes" forkmode="once" dir="${run.dir}" haltonfailure="yes" haltonerror="yes"
201                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
202                         <jvmarg value="-Djava.library.path=${path.dir}"/>
203                         <jvmarg line="${jvmarg.Xmx}"/>
204                         <jvmarg line="${jvmarg.ea}"/>
205                         <jvmarg value="-Xshare:off"/>
206                         <classpath refid="env.classpath" />
207                         <!--                    <formatter type="plain" usefile="true" /> -->
208                         <formatter type="brief" usefile="false"/>
209                         <formatter type="xml" usefile="true"/>
210                         <test name="${plugin.tests}" todir="${run.dir}" outfile="PluginTests-${start.time}"/>
211                 </junit>
212         </target>
213
214         <target name="plugin2" depends="build-env" description="Run plugin2 tests.">
215                 <junit fork="yes" forkmode="once" dir="${run.dir}" haltonfailure="yes" haltonerror="yes"
216                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
217                         <jvmarg value="-Djava.library.path=${path.dir}"/>
218                         <jvmarg value="-ea"/>
219                         <jvmarg line="${jvmarg.Xmx}"/>
220                         <jvmarg value="-Xshare:off"/>
221                         <classpath refid="env.classpath" />
222                         <!--                    <formatter type="plain" usefile="true" /> -->
223                         <formatter type="brief" usefile="false"/>
224                         <formatter type="xml" usefile="true"/>
225                         <test name="${plugin2.tests}" todir="${run.dir}" outfile="PluginTests2-${start.time}"/>
226                 </junit>
227         </target>
228
229         <target name="performance" depends="build-env" description="Run performance tests.">
230                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
231                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
232                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
233                         <sysproperty key="test.configuration" value="${test.configuration}"/>
234                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
235                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
236                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
237                         <jvmarg line="${jvmarg.Xmx}"/>
238                         <jvmarg line="${jvmarg.ea}"/>
239                         <jvmarg value="-Djava.library.path=${path.dir}"/>
240                         <jvmarg value="-Xshare:off"/>
241                         <classpath refid="env.classpath" />
242                         <formatter type="brief" usefile="false"/>
243                         <formatter type="xml" usefile="true"/>
244                         <test name="${performance.tests}" todir="${run.dir}" outfile="PerformanceTests-${start.time}"/>
245                 </junit>
246         </target>
247
248         <target name="stress" depends="build-env" description="Run stress tests.">
249                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
250                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
251                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
252                         <sysproperty key="test.configuration" value="${test.configuration}"/>
253                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
254                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
255                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
256                         <jvmarg line="${jvmarg.Xmx}"/>
257                         <jvmarg line="${jvmarg.ea}"/>
258                         <jvmarg value="-Djava.library.path=${path.dir}"/>
259                         <jvmarg value="-Xshare:off"/>
260                         <classpath refid="env.classpath" />
261                         <formatter type="brief" usefile="false"/>
262                         <formatter type="xml" usefile="true"/>
263                         <test name="${stress.tests}" todir="${run.dir}" outfile="StressTests-${start.time}"/>
264                 </junit>
265         </target>
266
267         <target name="temp" depends="build-env" description="Run temporary tests.">
268                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
269                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
270                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
271                         <sysproperty key="test.configuration" value="${test.configuration}"/>
272                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
273                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
274                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
275                         <sysproperty key="test.use.failed" value="${test.use.failed}"/>
276                         <jvmarg line="${jvmarg.Xmx}"/>
277                         <jvmarg line="${jvmarg.ea}"/>
278                         <jvmarg value="-Djava.library.path=${path.dir}"/>
279                         <jvmarg value="-Xshare:off"/>
280                         <classpath refid="env.classpath" />
281                         <formatter type="brief" usefile="false"/>
282                         <formatter type="xml" usefile="true"/>
283                         <test name="${temp.tests}" todir="${run.dir}" outfile="TempTests-${start.time}" haltonfailure="true" haltonerror="true" unless="use.failed"/>
284                         <test name="${temp.tests}" todir="${run.dir}" outfile="TempTests-${start.time}" haltonfailure="false" haltonerror="false" if="use.failed"/>
285                 </junit>
286         </target>
287
288         <target name="api" depends="build-env" description="Run API tests.">
289                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
290                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
291                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
292                         <sysproperty key="test.configuration" value="${test.configuration}"/>
293                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
294                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
295                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
296                         <jvmarg line="${jvmarg.Xmx}"/>
297                         <jvmarg line="${jvmarg.ea}"/>
298                         <jvmarg value="-Djava.library.path=${path.dir}"/>
299                         <jvmarg value="-Xshare:off"/>
300                         <classpath refid="env.classpath" />
301                         <formatter type="brief" usefile="false"/>
302                         <formatter type="xml" usefile="true"/>
303                         <test name="org.simantics.db.tests.common.GenerateTest" todir="${run.dir}" outfile="TestGenerate-${start.time}"/>
304                         <batchtest todir="${run.dir}">
305                             <fileset dir="src/">
306                               <include name="org/simantics/db/tests/api/**/*.java"/>
307                             </fileset>
308                         </batchtest>
309                 </junit>
310         </target>
311         
312         <path id="compile-classpath">
313                 <fileset dir="${env.dir}" >
314                         <include name="**/*.jar"/>
315                 </fileset>
316                 <!--<fileset dir="${origin.dir}" >
317                         <include name="**/*.jar"/>
318                 </fileset>-->
319         </path>
320
321         <target name="compile" depends="-init-prop,env-jars">
322                 <mkdir dir="${test.classes.dir}" />
323                 <copy todir="${test.classes.dir}">
324                         <fileset dir="${origin.dir}/org.simantics.db/src/" includes="**/*.java"/>
325                         <fileset dir="${origin.dir}/org.simantics.db.common/src/" includes="**/*.java" />
326                         <fileset dir="${origin.dir}/org.simantics.db.impl/src/" includes="**/*.java" />
327                         <fileset dir="${origin.dir}/org.simantics.db.layer0/src/" includes="**/*.java" />
328                         <fileset dir="${origin.dir}/org.simantics.db.management/src/" includes="**/*.java" />
329                         <fileset dir="${origin.dir}/org.simantics.db.procore/src/" includes="**/*.java">
330                           <exclude name="**/bundle/*.java" />
331                         </fileset>
332                         <fileset dir="${origin.dir}/org.simantics.db.procore.protocol/src/" includes="**/*.java" />
333                         <fileset dir="${origin.dir}/org.simantics.db.procore.protocol/stubs/" includes="**/*.java" />
334                         <fileset dir="${origin.dir}/org.simantics.db.services/src" includes="**/*.java" />
335                         <fileset dir="${origin.dir}/org.simantics/src/" includes="**/*.java" />
336                         <fileset dir="${origin.dir}/org.simantics.common/src/" includes="**/*.java" />
337                         <fileset dir="${origin.dir}/org.simantics.data/src/" includes="**/*.java" />
338                         <fileset dir="${origin.dir}/org.simantics.graph/src/" includes="**/*.java" />
339                         <fileset dir="${origin.dir}/org.simantics.graph.db/src/" includes="**/*.java" />
340                         <fileset dir="${origin.dir}/org.simantics.fastlz/src/" includes="**/*.java" >
341                           <exclude name="**/bundle/*.java" />
342                         </fileset>
343                         <fileset dir="${origin.dir}/org.simantics.layer0/src/" includes="**/*.java" />
344                         <fileset dir="${origin.dir}/org.simantics.scl.runtime/src/" includes="**/*.java" />
345                         <fileset dir="${origin.dir}/org.simantics.utils/src/" includes="**/*.java" />
346                         <fileset dir="${origin.dir}/org.simantics.utils.thread/src/" includes="**/*.java">
347                                 <exclude name="**/org/simantics/utils/threads/Executors2.java"/>
348                         </fileset>
349                         <fileset dir="${origin.dir}/org.simantics.utils.datastructures/src/" includes="**/*.java"/>
350                         <fileset dir="${origin.dir}/org.simantics.layer0.utils/src/" includes="**/*.java">
351                                 <exclude name="**/org/simantics/layer0/utils/serialization/TransferableGraphUtils.java" />
352                                 <exclude name="**/org/simantics/layer0/utils/writer/AbstractDelayedGraphWriter.java" />
353                                 <exclude name="**/org/simantics/layer0/utils/writer/DelayedGraphWriter.java" />
354                                 <exclude name="**/org/simantics/layer0/utils/writer/DummyGraphWriter.java" />
355                         </fileset>
356                         <fileset dir="${origin.dir}/org.simantics.db.tests/src/" includes="**/*.java">
357                                 <exclude name="**/org/simantics/db/tests/performance/java/BufferTest.java" />
358                                 <exclude name="**/org/simantics/db/tests/Activator.java" />
359                                 <!--<exclude name="**/org/simantics/db/tests/l0/**.java" />-->
360                                 <exclude name="**/InitializeDbTestPlugin.java" />
361                                 <exclude name="**/AdaptionFailureTest.java" />
362                                 <exclude name="**/QuerySemanticsTest.java" />
363                                 <exclude name="**/SyntheticModellingTest.java" />
364                                 <exclude name="**/TextIndexingTest.java" />
365                                 <exclude name="**/SyncAsyncSyncTest7.java" />
366                                 <exclude name="**/PluginTests.java" />
367                                 <exclude name="**/PluginTests2.java" />
368                         </fileset>
369                         <fileset dir="${origin.dir}/org.simantics.diagram.ontology/src/" includes="**/*.java"/>
370                         <fileset dir="${origin.dir}/org.simantics.operating.ontology/src/" includes="**/*.java"/>
371                         <fileset dir="${origin.dir}/org.simantics.project/src/">
372                                 <include name="**/GraphBundle*.java"/>
373                                 <include name="**/ServerManager*.java"/>
374                                 <include name="**/DatabaseManagement.java"/>
375                         </fileset>
376                 </copy>
377                 <javac destdir="${test.classes.dir}" nowarn="on" debug="on">
378                         <classpath refid="compile-classpath" />
379                         <src path="${test.classes.dir}" />
380                         <include name="**/*.java" />
381                 </javac>
382                 <jar destfile="${env.dir}db-test.jar">
383                         <fileset dir="${test.classes.dir}" includes="**/*.class" />
384                         <fileset dir="${test.classes.dir}" includes="**/*.java" />
385                         <manifest>
386                                 <!-- Who is building this jar? -->
387                                 <attribute name="Built-By" value="${user.name}"/>
388                                 <attribute name="Implementation-Vendor" value="VTT"/>
389                                 <attribute name="Implementation-Title" value="${project.name}"/>
390                                 <attribute name="Implementation-Version" value="${version}"/>
391                         </manifest>
392                 </jar>
393         </target>
394 </project>