1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 2017 Politecnico di Torino and others.
4 All rights reserved. This program and the accompanying materials
5 are made available under the terms of the Apache License, Version 2.0
6 which accompanies this distribution, and is available at
7 http://www.apache.org/licenses/LICENSE-2.0
9 <project name="gRPC-Verigraph" default="gRPC-run" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
11 Script for gRPC-Verigraph
14 <!-- The location of this assignment -->
15 <property name="grpc.location" location="." />
16 <!-- The location to be used for class files -->
17 <property name="build.dir" location="${grpc.location}/build" />
18 <!-- The location for source files -->
19 <property name="src.dir" location="${grpc.location}/src" />
20 <!-- The location for solutions -->
21 <property name="grpc.dir" value="src/it/polito/verigraph/grpc" />
22 <!-- The location for jar files -->
23 <property name="lib.dir" location="${grpc.location}/lib" />
24 <!-- The location for jar files -->
25 <property name="other_lib.dir" location="${grpc.location}/service/build" />
26 <!-- The location for generated files -->
27 <property name="generated.dir" location="${basedir}/gen-protobuf" />
28 <!-- The default test class -->
29 <property name="test1.class" value="it.polito.verigraph.grpc.test.GrpcServerTest" />
30 <property name="test2.class" value="it.polito.verigraph.grpc.test.GrpcTest" />
31 <property name="test3.class" value="it.polito.verigraph.grpc.test.MultiThreadTest" />
32 <property name="test4.class" value="it.polito.verigraph.grpc.test.ReachabilityTest" />
33 <!-- Tosca grpc test class -->
34 <property name="testToscaGrpc.class" value="it.polito.verigraph.grpc.tosca.test.GrpcToscaTest" />
35 <!-- The name to be given to the final zip -->
36 <property name="sol.zip" value="grpc.zip" />
37 <!-- Java compiler settings -->
38 <property name="debug" value="true" />
39 <property name="debuglevel" value="source,lines,vars" />
40 <property name="target" value="1.8" />
41 <property name="source" value="1.8" />
43 <!-- The classpath to be used for running the tests -->
44 <path id="test.classpath">
45 <pathelement path="${build.dir}" />
46 <fileset dir="${grpc.location}/lib">
47 <include name="com.microsoft.z3.jar" />
49 <fileset refid="mvn-dependencies" />
52 <!-- Here starts part for Maven -->
53 <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
54 <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
55 uri="antlib:org.apache.maven.artifact.ant"
56 classpathref="maven-ant-tasks.classpath" />
57 <property file="build.properties"/>
59 <!-- Load pom.xml for dependencies -->
60 <artifact:pom id="pomfile" file="pom.xml" />
61 <artifact:dependencies filesetId="mvn-dependencies" pomRefId="pomfile" />
63 <!-- Grab the HSQLDB jar and add it to the classpath
64 <artifact:dependencies filesetId="warDeps">
65 <dependency groupId="org.glassfish.jersey" artifactId="jersey-bom" version="2.22.1" />
66 </artifact:dependencies>-->
68 <path id="build.classpath">
69 <fileset refid="mvn-dependencies" />
72 <!-- target name="init">
73 <mkdir dir="${build.dir}" />
77 <!-- The target for compiling the gRPC application -->
78 <!--target name="gRPC-build" depends="init" description="Build the sources"-->
79 <target name="gRPC-build" description="Build the sources">
80 <echo>Building gRPC (if needed)...</echo>
83 debuglevel="${debuglevel}"
86 destdir="${build.dir}"
87 classpathref="build.classpath"
88 includeantruntime="false">
89 <src path="${generated.dir}" />
90 <src path="${src.dir}" />
91 <src path="${grpc.location}/gen-src"/>
92 <compilerarg value="-Xlint:unchecked"/>
94 <pathelement path="${grpc.location}/lib/com.microsoft.z3.jar"/>
96 <include name="$it/polito/**/**/*.java"/>
98 <pathelement path="${other_lib.dir}/qjutils.jar"/>
105 <!-- The target for running the gRPC application -->
106 <target name="gRPC-run" depends="gRPC-build" description="Run gRPC">
109 <java classname="it.polito.verigraph.grpc.Service" failonerror="true" classpathref="build.classpath" fork="yes">
111 <pathelement path="${build.dir}"/>
112 <path refid="test.classpath" />
117 <sleep milliseconds="500"/>
118 <java classname="it.polito.verigraph.grpc.Client" failonerror="true" classpathref="build.classpath" fork="yes">
120 <pathelement path="${build.dir}"/>
128 <target name="gRPC-run-client" depends="gRPC-build" description="Run gRPC client">
129 <java classname="it.polito.verigraph.grpc.client.Client" failonerror="true" classpathref="build.classpath" fork="yes">
131 <pathelement path="${build.dir}"/>
137 <target name="gRPC-run-server" depends="gRPC-build" description="Run gRPC server">
138 <java classname="it.polito.verigraph.grpc.server.Service" failonerror="true" classpathref="build.classpath" fork="yes">
140 <pathelement path="${build.dir}"/>
141 <path refid="test.classpath" />
147 <target name="gRPC-run-tests" description="Run tests for gRPC">
148 <echo>Running functional tests</echo>
149 <antcall target="runFuncTest.real">
150 <param name="exit.code1" value="126" />
151 <param name="exit.code2" value="125" />
152 <param name="exit.code3" value="124" />
153 <param name="exit.code4" value="123" />
157 <!-- Run Tosca Grpc Tests -->
158 <target name="gRPC-tosca-run-tests" description="Run tests for Tosca implementation of gRPC">
159 <echo>Running grpc tests...</echo>
160 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="yes" filtertrace="true" timeout="120000">
161 <jvmarg value="-Djava.awt.headless=true" />
162 <formatter type="brief" usefile="false" />
163 <test haltonfailure="no" failureproperty="test_failed" name="${testToscaGrpc.class}" />
165 <path refid="test.classpath" />
168 <fail if="test_failed" message="*** JUnit tests for gRPC Tosca completed: some Tests FAILED ***" />
171 <!-- Target runFuncTest.real -->
172 <target name="runFuncTest.real" depends="gRPC-build">
173 <echo>Running First set of Junit tests...</echo>
174 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
175 <jvmarg value="-Djava.awt.headless=true" />
176 <formatter type="brief" usefile="false"/>
177 <test haltonfailure="no" failureproperty="test_failed" name="${test1.class}"/>
179 <path refid="test.classpath" />
182 <fail if="test_failed" status="${exit.code1}" message="*** First set of Junit tests: Some Tests FAILED ***"/>
183 <echo>*** First set of Junit tests: All Tests PASSED ***</echo>
185 <echo>Running Second set of Junit tests...</echo>
186 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
187 <jvmarg value="-Djava.awt.headless=true" />
188 <formatter type="brief" usefile="false"/>
189 <test haltonfailure="no" failureproperty="test_failed" name="${test2.class}"/>
191 <path refid="test.classpath" />
194 <fail if="test_failed" status="${exit.code2}" message="*** Second set of Junit tests: Some Tests FAILED ***"/>
195 <echo>*** Second set of Junit tests: All Tests PASSED ***</echo>
197 <!--echo>Running Third set of Junit tests...</echo>
198 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
199 <jvmarg value="-Djava.awt.headless=true" />
200 <formatter type="brief" usefile="false"/>
201 <test haltonfailure="no" failureproperty="test_failed" name="${test3.class}"/>
203 <path refid="test.classpath" />
206 <fail if="test_failed" status="${exit.code3}" message="*** Third set of Junit tests: Some Tests FAILED ***"/>
207 <echo>*** Third set of Junit tests: All Tests PASSED ***</echo-->
209 <echo>Running Fourth set of Junit tests...</echo>
210 <junit printsummary="yes" dir="." fork="yes" haltonfailure="no" showoutput="no" filtertrace="true" timeout="120000">
211 <jvmarg value="-Djava.awt.headless=true" />
212 <formatter type="brief" usefile="false"/>
213 <test haltonfailure="no" failureproperty="test_failed" name="${test4.class}"/>
215 <path refid="test.classpath" />
216 <fileset dir="${lib.dir}">
217 <include name="*.jar" />
221 <fail if="test_failed" status="${exit.code4}" message="*** Fourth set of Junit tests: Some Tests FAILED ***"/>
222 <echo>*** Fourth set of Junit tests: All Tests PASSED ***</echo>
223 <echo>***************************************************</echo>
224 <echo>*************** All Tests PASSED *****************</echo>
228 <!-- target for cleaning -->
229 <!-- target name="clean">
230 <delete dir="${build.dir}" />