source: gs3-extensions/testing/trunk/src/build.xml@ 32683

Last change on this file since 32683 was 32683, checked in by ak19, 2 years ago
  1. Rudimentary test class for running GLI with Assertj Swing. 2. Already accidentally prematurely committed major changes in revision 32680 to ext/testing/build.xml which starts using assertj-swing. I think it's now successfully launching GLI. The reason I may not be seeing GLI's GUI when testing may perhaps be since there are no actual tests yet other than to run and quit GLI. The changes to build.xml in this commit are cosmetic, but wanted a commit message explaining the new targets introduced in revision 32680, which were to compile up and build our tutorial testing classes. At present there's only one class which doesn't do much yet, as explained. But at least I got the ant target's classpath correct to get it compiled and for JUnit to start running the basic test class.
  • Property svn:executable set to *
File size: 4.0 KB
Line 
1<?xml version="1.0"?>
2<project name="Greenstone3 Testing Extension" default="build-util-jar" basedir=".">
3
4 <property environment="env"/> <!-- get properties from the environment -->
5 <property name="compile.includeantruntime" value="false"/> <!-- to get rid of annoying 'ant' warning -->
6
7 <property name="gli.home" value="${env.GSDL3SRCHOME}/gli"/>
8
9 <target name="build-util-jar">
10 <mkdir dir="${basedir}/build"/>
11 <javac srcdir="${basedir}/src" destdir="${basedir}/build">
12 <classpath>
13 <fileset dir="${basedir}/lib/java">
14 <include name="*.jar"/>
15 </fileset>
16 </classpath>
17 <include name="org/greenstone/gsdl3/testing/*.java"/>
18 </javac>
19 <jar destfile="${basedir}/lib/java/GSTestingUtil.jar">
20 <fileset dir="${basedir}/build">
21 <include name="org/greenstone/gsdl3/testing/**"/>
22 </fileset>
23 <manifest>
24 <attribute name="Built-By" value="Greenstone" />
25 </manifest>
26 </jar>
27 </target>
28
29<!-- +++++++++++++ TUTORIAL TESTING TARGETS ++++++++++++++ -->
30<target name="needs-make-gli-jar">
31 <condition property="gli-jar-missing">
32 <not>
33 <available file="${gli.home}/GLI.jar"/>
34 </not>
35 </condition>
36
37 <fail if="gli-jar-missing" message="Run the makegli followed by makejar scripts in the gli folder before starting the Greenstone server."/>
38</target>
39
40<target name="needs-gs3-setup">
41 <!-- has the gs3-setup script been run?? -->
42 <condition property="gs3-setup-not-done">
43 <not>
44 <isset property="env.GSDL3HOME"/>
45 </not>
46 </condition>
47
48 <fail if="gs3-setup-not-done" message="Please run 'gs3-setup' (Windows) or 'source gs3-setup.sh' (Linux/Mac) before starting the Greenstone server."/>
49
50 <echo>GLI HOME: ${gli.home}</echo>
51 </target>
52
53<target name="compile-tutorials-tests" depends="needs-gs3-setup, needs-make-gli-jar">
54
55 <mkdir dir="${basedir}/build"/>
56 <javac
57 srcdir="${basedir}/src"
58 destdir="${basedir}/build"
59 includeantruntime="${compile.includeantruntime}">
60 <classpath>
61 <fileset dir="${basedir}/lib/java">
62 <include name="*.jar"/>
63 </fileset>
64 <fileset dir="${gli.home}">
65 <include name="GLI.jar"/>
66 </fileset>
67 </classpath>
68 <include name="gstests/tutorials/*.java"/>
69 </javac>
70 <jar destfile="${basedir}/tutorial-tests.jar">
71 <fileset dir="${basedir}/build">
72 <include name="gstests/tutorials/**"/>
73 </fileset>
74 <manifest>
75 <attribute name="Built-By" value="greenstone" />
76 </manifest>
77 </jar>
78</target>
79
80<!-- https://stackoverflow.com/questions/10704324/how-to-add-to-classpath-all-classes-from-set-of-directories-in-ant -->
81<path id="tutorials.path">
82 <fileset dir="${basedir}/lib/java">
83 <include name="*.jar"/>
84 </fileset>
85 <!--<fileset dir="${basedir}/build">
86 <include name="gstests/tutorials/**/*.class"/>
87 </fileset>-->
88 <files includes="${basedir}/tutorial-tests.jar"/>
89
90 <!-- To run GLI, need GLI.jar and its help jars and folder: classes folder, apache.jar, jna.jar, jna-platform.jar, qfslib.jar, rsyntaxtextarea.jar -->
91 <fileset dir="${gli.home}">
92 <include name="GLI.jar"/>
93 </fileset>
94 <pathelement path="${gli.home}/classes"/>
95 <fileset dir="${gli.home}/lib">
96 <include name="*.jar"/>
97 </fileset>
98</path>
99
100<!-- TODO: for darwin, need to set custom_vm_args, see gli.sh
101TODO: Launching GLI for GS2 is also different -->
102
103<!-- JUnit must run in GLI folder to mimic how GLI is run.
104 One reason why this is necessary is that GLI then won't display parsing issues with GLI class HelpFrame -->
105<!-- http://ant.1045680.n5.nabble.com/How-to-increase-memory-used-by-JVM-in-Ant-td1355370.html -->
106<target name="run-tutorials-tests" depends="needs-gs3-setup, needs-make-gli-jar">
107 <echo>Tutorial tests</echo>
108 <echo>GSDLHOME: ${env.GSDLHOME}</echo>
109 <java classname="org.junit.runner.JUnitCore" dir="${gli.home}" fork="true" maxmemory="256m" classpathref="tutorials.path">
110 <arg value="gstests.tutorials.RunGLITest"/>
111
112 </java>
113
114
115</target>
116
117</project>
118
Note: See TracBrowser for help on using the repository browser.