Add apigateway docs
[parser.git] / verigraph / buildVeriGraph_gRPC.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  Copyright (c) 2017 Politecnico di Torino and others.
4
5  All rights reserved. This program and the accompanying materials
6  are made available under the terms of the Apache License, Version 2.0
7  which accompanies this distribution, and is available at
8  http://www.apache.org/licenses/LICENSE-2.0
9 -->
10
11 <project name="gRPC-Verigraph" default="run-tests" basedir="."  xmlns:artifact="antlib:org.apache.maven.artifact.ant">
12         <description>
13                         Script for gRPC-Verigraph
14         </description>
15
16         <!-- The location of this assignment -->
17         <property name="grpc.location" location="." />
18
19         <!-- The location to be used for class files -->
20         <property name="build.dir" location="${grpc.location}/build" />
21         <!-- The location for source files -->
22         <property name="src.dir" location="${grpc.location}/src/main/java" />
23         <!-- The location for solutions -->
24         <property name="grpc.dir" value="src/main/java/it/polito/grpc" />
25         <!-- The location for jar files -->
26         <property name="lib.dir" location="${grpc.location}/lib" />
27         <!-- The location for jar files -->
28         <property name="other_lib.dir" location="${grpc.location}/service/build" />
29         <!-- The location for generated files -->
30         <property name="generated.dir" location="${basedir}/target/generated-sources" />
31         <!-- The default test class -->
32         <property name="test1.class" value="it.polito.grpc.test.GrpcServerTest" />
33         <property name="test2.class" value="it.polito.grpc.test.GrpcTest" />
34         <property name="test3.class" value="it.polito.grpc.test.MultiThreadTest" />
35         <property name="test4.class" value="it.polito.grpc.test.ReachabilityTest" />
36
37         <!-- The name to be given to the final zip -->
38         <property name="sol.zip" value="grpc.zip" />
39
40         <!-- Java compiler settings -->
41         <property name="debug" value="true" />
42         <property name="debuglevel" value="source,lines,vars" />
43         <property name="target" value="1.8" />
44         <property name="source" value="1.8" />
45
46         <!-- The classpath to be used for running the tests -->
47         <path id="test.classpath">
48                 <pathelement path="${build.dir}" />
49                 <fileset dir="${grpc.location}/lib">
50                     <include name="*.jar" />
51                 </fileset>
52                 <fileset refid="mvn-dependencies" />
53         </path>
54
55         <!-- Here starts part for Maven -->
56         <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
57         <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
58                    uri="antlib:org.apache.maven.artifact.ant"
59                    classpathref="maven-ant-tasks.classpath" />
60         <property file="build.properties"/>
61
62         <!-- Load pom.xml for dependencies -->
63         <artifact:pom id="pomfile" file="pom.xml" />
64         <artifact:dependencies filesetId="mvn-dependencies" pomRefId="pomfile" />
65
66         <!-- Grab the HSQLDB jar and add it to the classpath
67         <artifact:dependencies filesetId="warDeps">
68                 <dependency groupId="org.glassfish.jersey" artifactId="jersey-bom" version="2.22.1" />
69         </artifact:dependencies>-->
70
71         <path id="build.classpath">
72             <fileset refid="mvn-dependencies" />
73         </path>
74
75         <target name="init">
76                 <mkdir dir="${build.dir}" />
77         </target>
78
79         <!-- The target for compiling the gRPC application -->
80         <target name="build" depends="init" description="Build the sources">
81                 <echo>Building gRPC (if needed)...</echo>
82                         <javac
83                                 debug="${debug}"
84                                 debuglevel="${debuglevel}"
85                                 source="${source}"
86                                 target="${target}"
87                                 destdir="${build.dir}"
88                                 classpathref="build.classpath"
89                                 includeantruntime="false">
90                                 <src path="${generated.dir}" />
91                                 <src path="${src.dir}" />
92                                 <compilerarg value="-Xlint:unchecked"/>
93                                 <classpath>
94                                         <pathelement path="${other_lib.dir}/qjutils.jar"/>
95                                 </classpath>
96                         </javac>
97                 <echo>Done.</echo>
98         </target>
99
100         <!-- The target for running the gRPC application -->
101         <target name="run" depends="build" description="Run gRPC">
102                 <parallel>
103                         <sequential>
104                         <java classname="it.polito.grpc.Service" failonerror="true" classpathref="build.classpath" fork="yes">
105                                 <classpath>
106                                         <pathelement path="${build.dir}"/>
107                                 </classpath>
108                         </java>
109                         </sequential>
110                     <sequential>
111                                 <sleep milliseconds="500"/>
112                         <java classname="it.polito.grpc.Client" failonerror="true" classpathref="build.classpath" fork="yes">
113                                 <classpath>
114                                         <pathelement path="${build.dir}"/>
115                                 </classpath>
116                                 </java>
117                         </sequential>
118                 </parallel>
119         </target>
120
121         <target name="run-client" depends="build" description="Run gRPC client">
122                 <java classname="it.polito.grpc.Client" failonerror="true" classpathref="build.classpath" fork="yes">
123                         <classpath>
124                                 <pathelement path="${build.dir}"/>
125                         </classpath>
126                 </java>
127         </target>
128
129         <target name="run-server" depends="build" description="Run gRPC server">
130                 <java classname="it.polito.grpc.Service" failonerror="true" classpathref="build.classpath" fork="yes">
131                         <classpath>
132                                 <pathelement path="${build.dir}"/>
133                         </classpath>
134                 </java>
135         </target>
136
137         <target name="run-tests" description="Run tests for gRPC">
138                 <echo>Running functional tests</echo>
139                 
140                 <antcall target="runFuncTest.real">
141                         <param name="exit.code1" value="126" />
142                         <param name="exit.code2" value="125" />
143                         <param name="exit.code3" value="124" />
144                         <param name="exit.code4" value="123" />
145                 </antcall>
146         </target>
147
148         <!-- Target runFuncTest.real    -->
149         <target name="runFuncTest.real" depends="build">
150
151                 <echo>Running First set of Junit tests...</echo>
152                 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
153                         <jvmarg value="-Djava.awt.headless=true" />
154                         <formatter type="brief" usefile="false"/>
155                         <test haltonfailure="no" failureproperty="test_failed" name="${test1.class}"/>
156                         <classpath>
157                                 <path refid="test.classpath" />
158                         </classpath>
159                 </junit>
160                 <fail if="test_failed" status="${exit.code1}" message="*** First set of Junit tests: Some Tests FAILED ***"/>
161                 <echo>*** First set of Junit tests: All Tests PASSED  ***</echo>
162                 
163                 <echo>Running Second set of Junit tests...</echo>
164                 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
165                         <jvmarg value="-Djava.awt.headless=true" />
166                         <formatter type="brief" usefile="false"/>
167                         <test haltonfailure="no" failureproperty="test_failed" name="${test2.class}"/>
168                         <classpath>
169                                 <path refid="test.classpath" />
170                         </classpath>
171                 </junit>
172                 <fail if="test_failed" status="${exit.code2}" message="*** Second set of Junit tests: Some Tests FAILED ***"/>
173                 <echo>*** Second set of Junit tests: All Tests PASSED  ***</echo>
174                 
175                 <echo>Running Third set of Junit tests...</echo>
176                 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
177                         <jvmarg value="-Djava.awt.headless=true" />
178                         <formatter type="brief" usefile="false"/>
179                         <test haltonfailure="no" failureproperty="test_failed" name="${test3.class}"/>
180                         <classpath>
181                                 <path refid="test.classpath" />
182                         </classpath>
183                 </junit>
184                 <fail if="test_failed" status="${exit.code3}" message="*** Third set of Junit tests: Some Tests FAILED ***"/>
185                 <echo>*** Third set of Junit tests: All Tests PASSED  ***</echo>
186
187                 <echo>Running Fourth set of Junit tests...</echo>
188                 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
189                         <jvmarg value="-Djava.awt.headless=true" />
190                         <jvmarg value="-Djava.library.path=${other_lib.dir}" />
191                         <formatter type="brief" usefile="false"/>
192                         <test haltonfailure="no" failureproperty="test_failed" name="${test4.class}"/>
193                         <classpath>
194                                 <path refid="test.classpath" />
195                                 <fileset dir="${other_lib.dir}">
196                                         <include name="*.jar" />
197                                 </fileset>
198                         </classpath>
199                 </junit>
200                 <fail if="test_failed" status="${exit.code4}" message="*** Fourth set of Junit tests: Some Tests FAILED ***"/>
201                 <echo>*** Fourth set of Junit tests: All Tests PASSED  ***</echo>
202                 <echo>***************************************************</echo>
203                 <echo>*************** All Tests PASSED  *****************</echo>
204         </target>
205
206         <!-- target for cleaning -->
207         <target name="clean">
208                 <delete dir="${build.dir}" />
209         </target>
210 </project>