1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 2017 Politecnico di Torino and others.
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
11 <project name="gRPC-Verigraph" default="run-tests" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
13 Script for gRPC-Verigraph
16 <!-- The location of this assignment -->
17 <property name="grpc.location" location="." />
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" />
37 <!-- The name to be given to the final zip -->
38 <property name="sol.zip" value="grpc.zip" />
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" />
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" />
52 <fileset refid="mvn-dependencies" />
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"/>
62 <!-- Load pom.xml for dependencies -->
63 <artifact:pom id="pomfile" file="pom.xml" />
64 <artifact:dependencies filesetId="mvn-dependencies" pomRefId="pomfile" />
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>-->
71 <path id="build.classpath">
72 <fileset refid="mvn-dependencies" />
76 <mkdir dir="${build.dir}" />
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>
84 debuglevel="${debuglevel}"
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"/>
94 <pathelement path="${other_lib.dir}/qjutils.jar"/>
100 <!-- The target for running the gRPC application -->
101 <target name="run" depends="build" description="Run gRPC">
104 <java classname="it.polito.grpc.Service" failonerror="true" classpathref="build.classpath" fork="yes">
106 <pathelement path="${build.dir}"/>
111 <sleep milliseconds="500"/>
112 <java classname="it.polito.grpc.Client" failonerror="true" classpathref="build.classpath" fork="yes">
114 <pathelement path="${build.dir}"/>
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">
124 <pathelement path="${build.dir}"/>
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">
132 <pathelement path="${build.dir}"/>
137 <target name="run-tests" description="Run tests for gRPC">
138 <echo>Running functional tests</echo>
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" />
148 <!-- Target runFuncTest.real -->
149 <target name="runFuncTest.real" depends="build">
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}"/>
157 <path refid="test.classpath" />
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>
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}"/>
169 <path refid="test.classpath" />
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>
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}"/>
181 <path refid="test.classpath" />
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>
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}"/>
194 <path refid="test.classpath" />
195 <fileset dir="${other_lib.dir}">
196 <include name="*.jar" />
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>
206 <!-- target for cleaning -->
207 <target name="clean">
208 <delete dir="${build.dir}" />