]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.db.tests/build.xml
Fix NPE in Export Core
[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.log4j_*.jar" />
139                                 <include name="external/plugins/org.apache.commons.io_*.jar" />
140                                 <include name="simantics/plugins/org.simantics.databoard_*.jar" />
141                                 <include name="simantics/plugins/org.simantics.db.layer0_*.jar" />
142                                 <include name="simantics/plugins/org.simantics.layer0_*.jar" />
143                                 <!--<include name="org.simantics.project_*.jar" />-->
144                                 <include name="org.eclipse.equinox.p2.metadata_*.jar" />
145                         </fileset>
146                 </copy>
147         </target>
148
149         <target name="build-databoard" unless="env.built">
150                 <ant antfile="build2.xml" dir="${databoard.dir}" inheritAll="false"/>
151                 <copy todir="${env.dir}">
152                         <fileset dir="${databoard.dir}/build">
153                                 <include name="org.simantics.databoard_*.jar" />
154                         </fileset>
155                 </copy>
156         </target>       
157         <target name="build-env" depends="-init,env-jars,init-db,compile" unless="env.built"
158                 description="Build runtime envrionment for the tests.">
159         </target>
160
161         <target name="clean-compile" description="Clean up compiled classes.">
162                 <delete dir="${test.classes.dir}"/>
163         </target>
164         
165         <target name="clean-run" description="Clean up run directory.">
166                 <delete includeEmptyDirs="true">
167                         <fileset dir="${run.dir}" includes="**/*"/>
168                 </delete>
169         </target>
170         
171         <target name="clean" depends="clean-compile,clean-run" description="Clean up generated stuff.">
172                 <!--<echo>Cleaning up...</echo>-->
173         </target>
174
175         <target name="all" depends="clean,regression,performance,stress"  description="Run all pojo tests.">
176                 <echo>Tests done.</echo>
177         </target>
178
179         <target name="regression" depends="build-env" description="Run regression tests.">
180                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
181                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
182                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
183                         <sysproperty key="test.configuration" value="${test.configuration}"/>
184                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
185                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
186                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
187                         <sysproperty key="test.use.failed" value="${test.use.failed}"/>
188                         <jvmarg line="${jvmarg.Xmx}"/>
189                         <jvmarg line="${jvmarg.ea}"/>
190                         <jvmarg value="-Djava.library.path=${path.dir}"/>
191                         <jvmarg value="-Xshare:off"/>
192                         <classpath refid="env.classpath" />
193                         <formatter type="brief" usefile="false"/>
194                         <formatter type="xml" usefile="true"/>
195                         <test name="${regression.tests}" todir="${run.dir}" outfile="${regression.tests}-${start.time}" haltonfailure="true" haltonerror="true" unless="use.failed"/>
196                         <test name="${regression.tests}" todir="${run.dir}" outfile="${regression.tests}-${start.time}" haltonfailure="false" haltonerror="false" if="use.failed"/>
197                 </junit>
198         </target>
199
200         <target name="plugin" depends="build-env" description="Run plugin tests.">
201                 <junit fork="yes" forkmode="once" dir="${run.dir}" haltonfailure="yes" haltonerror="yes"
202                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
203                         <jvmarg value="-Djava.library.path=${path.dir}"/>
204                         <jvmarg line="${jvmarg.Xmx}"/>
205                         <jvmarg line="${jvmarg.ea}"/>
206                         <jvmarg value="-Xshare:off"/>
207                         <classpath refid="env.classpath" />
208                         <!--                    <formatter type="plain" usefile="true" /> -->
209                         <formatter type="brief" usefile="false"/>
210                         <formatter type="xml" usefile="true"/>
211                         <test name="${plugin.tests}" todir="${run.dir}" outfile="PluginTests-${start.time}"/>
212                 </junit>
213         </target>
214
215         <target name="plugin2" depends="build-env" description="Run plugin2 tests.">
216                 <junit fork="yes" forkmode="once" dir="${run.dir}" haltonfailure="yes" haltonerror="yes"
217                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
218                         <jvmarg value="-Djava.library.path=${path.dir}"/>
219                         <jvmarg value="-ea"/>
220                         <jvmarg line="${jvmarg.Xmx}"/>
221                         <jvmarg value="-Xshare:off"/>
222                         <classpath refid="env.classpath" />
223                         <!--                    <formatter type="plain" usefile="true" /> -->
224                         <formatter type="brief" usefile="false"/>
225                         <formatter type="xml" usefile="true"/>
226                         <test name="${plugin2.tests}" todir="${run.dir}" outfile="PluginTests2-${start.time}"/>
227                 </junit>
228         </target>
229
230         <target name="performance" depends="build-env" description="Run performance tests.">
231                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
232                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
233                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
234                         <sysproperty key="test.configuration" value="${test.configuration}"/>
235                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
236                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
237                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
238                         <jvmarg line="${jvmarg.Xmx}"/>
239                         <jvmarg line="${jvmarg.ea}"/>
240                         <jvmarg value="-Djava.library.path=${path.dir}"/>
241                         <jvmarg value="-Xshare:off"/>
242                         <classpath refid="env.classpath" />
243                         <formatter type="brief" usefile="false"/>
244                         <formatter type="xml" usefile="true"/>
245                         <test name="${performance.tests}" todir="${run.dir}" outfile="PerformanceTests-${start.time}"/>
246                 </junit>
247         </target>
248
249         <target name="stress" depends="build-env" description="Run stress tests.">
250                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
251                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
252                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
253                         <sysproperty key="test.configuration" value="${test.configuration}"/>
254                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
255                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
256                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
257                         <jvmarg line="${jvmarg.Xmx}"/>
258                         <jvmarg line="${jvmarg.ea}"/>
259                         <jvmarg value="-Djava.library.path=${path.dir}"/>
260                         <jvmarg value="-Xshare:off"/>
261                         <classpath refid="env.classpath" />
262                         <formatter type="brief" usefile="false"/>
263                         <formatter type="xml" usefile="true"/>
264                         <test name="${stress.tests}" todir="${run.dir}" outfile="StressTests-${start.time}"/>
265                 </junit>
266         </target>
267
268         <target name="temp" depends="build-env" description="Run temporary tests.">
269                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
270                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
271                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
272                         <sysproperty key="test.configuration" value="${test.configuration}"/>
273                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
274                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
275                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
276                         <sysproperty key="test.use.failed" value="${test.use.failed}"/>
277                         <jvmarg line="${jvmarg.Xmx}"/>
278                         <jvmarg line="${jvmarg.ea}"/>
279                         <jvmarg value="-Djava.library.path=${path.dir}"/>
280                         <jvmarg value="-Xshare:off"/>
281                         <classpath refid="env.classpath" />
282                         <formatter type="brief" usefile="false"/>
283                         <formatter type="xml" usefile="true"/>
284                         <test name="${temp.tests}" todir="${run.dir}" outfile="TempTests-${start.time}" haltonfailure="true" haltonerror="true" unless="use.failed"/>
285                         <test name="${temp.tests}" todir="${run.dir}" outfile="TempTests-${start.time}" haltonfailure="false" haltonerror="false" if="use.failed"/>
286                 </junit>
287         </target>
288
289         <target name="api" depends="build-env" description="Run API tests.">
290                 <junit fork="yes" forkmode="perTest" timeout="${test.deadlock.timeout}" dir="${run.dir}" haltonfailure="false" haltonerror="false"
291                 outputtoformatters="false" tempdir="${run.dir}" printsummary="on" showoutput="true">
292                         <sysproperty key="test.exit.timeout" value="${test.exit.timeout}"/>
293                         <sysproperty key="test.configuration" value="${test.configuration}"/>
294                         <sysproperty key="test.graph.impl" value="${test.graph.impl}"/>
295                         <sysproperty key="test.transaction.policy" value="${test.transaction.policy}"/>
296                         <sysproperty key="test.thread.model" value="${test.thread.model}"/>
297                         <jvmarg line="${jvmarg.Xmx}"/>
298                         <jvmarg line="${jvmarg.ea}"/>
299                         <jvmarg value="-Djava.library.path=${path.dir}"/>
300                         <jvmarg value="-Xshare:off"/>
301                         <classpath refid="env.classpath" />
302                         <formatter type="brief" usefile="false"/>
303                         <formatter type="xml" usefile="true"/>
304                         <test name="org.simantics.db.tests.common.GenerateTest" todir="${run.dir}" outfile="TestGenerate-${start.time}"/>
305                         <batchtest todir="${run.dir}">
306                             <fileset dir="src/">
307                               <include name="org/simantics/db/tests/api/**/*.java"/>
308                             </fileset>
309                         </batchtest>
310                 </junit>
311         </target>
312         
313         <path id="compile-classpath">
314                 <fileset dir="${env.dir}" >
315                         <include name="**/*.jar"/>
316                 </fileset>
317                 <!--<fileset dir="${origin.dir}" >
318                         <include name="**/*.jar"/>
319                 </fileset>-->
320         </path>
321
322         <target name="compile" depends="-init-prop,env-jars">
323                 <mkdir dir="${test.classes.dir}" />
324                 <copy todir="${test.classes.dir}">
325                         <fileset dir="${origin.dir}/org.simantics.db/src/" includes="**/*.java"/>
326                         <fileset dir="${origin.dir}/org.simantics.db.common/src/" includes="**/*.java" />
327                         <fileset dir="${origin.dir}/org.simantics.db.impl/src/" includes="**/*.java" />
328                         <fileset dir="${origin.dir}/org.simantics.db.layer0/src/" includes="**/*.java" />
329                         <fileset dir="${origin.dir}/org.simantics.db.management/src/" includes="**/*.java" />
330                         <fileset dir="${origin.dir}/org.simantics.db.procore/src/" includes="**/*.java">
331                           <exclude name="**/bundle/*.java" />
332                         </fileset>
333                         <fileset dir="${origin.dir}/org.simantics.db.procore.protocol/src/" includes="**/*.java" />
334                         <fileset dir="${origin.dir}/org.simantics.db.procore.protocol/stubs/" includes="**/*.java" />
335                         <fileset dir="${origin.dir}/org.simantics.db.services/src" includes="**/*.java" />
336                         <fileset dir="${origin.dir}/org.simantics/src/" includes="**/*.java" />
337                         <fileset dir="${origin.dir}/org.simantics.common/src/" includes="**/*.java" />
338                         <fileset dir="${origin.dir}/org.simantics.data/src/" includes="**/*.java" />
339                         <fileset dir="${origin.dir}/org.simantics.graph/src/" includes="**/*.java" />
340                         <fileset dir="${origin.dir}/org.simantics.graph.db/src/" includes="**/*.java" />
341                         <fileset dir="${origin.dir}/org.simantics.fastlz/src/" includes="**/*.java" >
342                           <exclude name="**/bundle/*.java" />
343                         </fileset>
344                         <fileset dir="${origin.dir}/org.simantics.layer0/src/" includes="**/*.java" />
345                         <fileset dir="${origin.dir}/org.simantics.scl.runtime/src/" includes="**/*.java" />
346                         <fileset dir="${origin.dir}/org.simantics.utils/src/" includes="**/*.java" />
347                         <fileset dir="${origin.dir}/org.simantics.utils.thread/src/" includes="**/*.java">
348                                 <exclude name="**/org/simantics/utils/threads/Executors2.java"/>
349                         </fileset>
350                         <fileset dir="${origin.dir}/org.simantics.utils.datastructures/src/" includes="**/*.java"/>
351                         <fileset dir="${origin.dir}/org.simantics.layer0.utils/src/" includes="**/*.java">
352                                 <exclude name="**/org/simantics/layer0/utils/serialization/TransferableGraphUtils.java" />
353                                 <exclude name="**/org/simantics/layer0/utils/writer/AbstractDelayedGraphWriter.java" />
354                                 <exclude name="**/org/simantics/layer0/utils/writer/DelayedGraphWriter.java" />
355                                 <exclude name="**/org/simantics/layer0/utils/writer/DummyGraphWriter.java" />
356                         </fileset>
357                         <fileset dir="${origin.dir}/org.simantics.db.tests/src/" includes="**/*.java">
358                                 <exclude name="**/org/simantics/db/tests/performance/java/BufferTest.java" />
359                                 <exclude name="**/org/simantics/db/tests/Activator.java" />
360                                 <!--<exclude name="**/org/simantics/db/tests/l0/**.java" />-->
361                                 <exclude name="**/InitializeDbTestPlugin.java" />
362                                 <exclude name="**/AdaptionFailureTest.java" />
363                                 <exclude name="**/QuerySemanticsTest.java" />
364                                 <exclude name="**/SyntheticModellingTest.java" />
365                                 <exclude name="**/TextIndexingTest.java" />
366                                 <exclude name="**/SyncAsyncSyncTest7.java" />
367                                 <exclude name="**/PluginTests.java" />
368                                 <exclude name="**/PluginTests2.java" />
369                         </fileset>
370                         <fileset dir="${origin.dir}/org.simantics.diagram.ontology/src/" includes="**/*.java"/>
371                         <fileset dir="${origin.dir}/org.simantics.operating.ontology/src/" includes="**/*.java"/>
372                         <fileset dir="${origin.dir}/org.simantics.project/src/">
373                                 <include name="**/GraphBundle*.java"/>
374                                 <include name="**/ServerManager*.java"/>
375                                 <include name="**/DatabaseManagement.java"/>
376                         </fileset>
377                 </copy>
378                 <javac destdir="${test.classes.dir}" nowarn="on" debug="on">
379                         <classpath refid="compile-classpath" />
380                         <src path="${test.classes.dir}" />
381                         <include name="**/*.java" />
382                 </javac>
383                 <jar destfile="${env.dir}db-test.jar">
384                         <fileset dir="${test.classes.dir}" includes="**/*.class" />
385                         <fileset dir="${test.classes.dir}" includes="**/*.java" />
386                         <manifest>
387                                 <!-- Who is building this jar? -->
388                                 <attribute name="Built-By" value="${user.name}"/>
389                                 <attribute name="Implementation-Vendor" value="VTT"/>
390                                 <attribute name="Implementation-Title" value="${project.name}"/>
391                                 <attribute name="Implementation-Version" value="${version}"/>
392                         </manifest>
393                 </jar>
394         </target>
395 </project>