Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: v4.4
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 454 lines (420 sloc) 20.796 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
<project name="agraph-java-client" default="build"
         xmlns:artifact="antlib:org.apache.maven.artifact.ant">

    <property environment="env"/>
    <!-- if these AGRAPH env vars are blank, the java test code will look elsewhere -->
    <property name="env.AGRAPH_HOST" value=""/>
    <property name="env.AGRAPH_PORT" value=""/>
    <property name="env.root" value=""/>

    <property name="DIST" value="DIST"/>

    <!-- Version is parameterized instead of hard-coded in multiple places. -->
    <!-- This same algorithm is in clojure/project.clj -->
    <!-- VERSION and env.version are set in makefile. -->
    <!-- git-branch-name is used as default for dev only. -->
    <loadfile property="git-branch-name" srcFile=".git-branch-name"
              failonerror="false">
        <filterchain> <striplinebreaks/> </filterchain>
    </loadfile>
    <condition property="env.version"
               value="${env.VERSION}"
               else="${git-branch-name}-snapshot">
        <and>
            <isset property="env.VERSION"/>
            <length string="${env.VERSION}" when="greater" length="0"/>
        </and>
    </condition>
    
    <!-- Library. -->
    <property name="src" location="src"/>
    <property name="lib" location="lib"/>
    <property name="build" location="classes"/>
    <property name="jarfile" location="agraph.jar"/>
    <property name="srcjarfile" location="agraph-src.jar"/>
    
    <path id="classpath">
        <path location="${lib}/json.jar"/>
        <path location="${lib}/junit-4.8.1.jar"/>
        <path location="${lib}/logging/commons-logging-1.1.1.jar"/>
        <path location="${lib}/logging/slf4j-api-1.6.1.jar"/>
        <path location="${lib}/logging/slf4j-jcl-1.6.1.jar"/>
        <path location="${lib}/sesame-2.3.2/commons-codec-1.3.jar"/>
        <path location="${lib}/sesame-2.3.2/commons-httpclient-3.1.jar"/>
        <path location="${lib}/sesame-2.3.2/openrdf-sesame-2.3.2-onejar.jar"/>
        <path location="${lib}/jena-2.6.2/arq-2.8.1.jar"/>
        <path location="${lib}/jena-2.6.2/icu4j-3.4.4.jar"/>
        <path location="${lib}/jena-2.6.2/iri-0.7.jar"/>
        <path location="${lib}/jena-2.6.2/jena-2.6.2-tests.jar"/>
        <path location="${lib}/jena-2.6.2/jena-2.6.2.jar"/>
        <path location="${lib}/jena-2.6.2/lucene-core-2.3.1.jar"/>
        <path location="${lib}/jena-2.6.2/stax-api-1.0.1.jar"/>
        <path location="${lib}/jena-2.6.2/wstx-asl-3.2.9.jar"/>
        <path location="${lib}/jena-2.6.2/xercesImpl-2.7.1.jar"/>
        <path location="${lib}/commons-cli-1.2.jar"/>
        <path location="${lib}/commons-pool-1.5.6.jar"/>
        <path location="${lib}/servlet-api-2.5.jar"/>
    </path>
    
    <target name="init">
        <tstamp/>
        <mkdir dir="${build}"/>
        <mkdir dir="target"/>
    </target>
    
    <target name="clean"
            description="Remove generated files and directories.">
        <delete dir="${build}"/>
        <delete file="${jarfile}"/>
        <delete file="${srcjarfile}"/>
        <delete dir="doc"/>
        <delete dir="target"/>
        <delete file="agraph-java-client-test.jar"/>
        <ant dir="clojure" target="clean" inheritall="false"/>
    </target>

    <target name="compile" depends="init"
            description="Compile Java sources.">
        <javac srcdir="${src}" destdir="${build}" encoding="utf8"
               debug="true"
               includes="**/*.java"
               includeAntRuntime="false"
               classpathref="classpath"/>
    </target>
    
    <target name="jar"
            description="Build agraph.jar file."
            depends="compile">
        <manifestclasspath property="mf.path" jarfile="${jarfile}">
            <classpath refid="classpath"/>
        </manifestclasspath>
        <tstamp prefix="jar">
            <format property="datestamp" pattern="yyyy-MM-dd H:mm"/>
        </tstamp>
        <jar jarfile="${jarfile}">
            <fileset dir="${build}" includes="**/*.class">
                <exclude name="tutorial/**"/>
                <exclude name="test/**"/>
                <exclude name="*.class"/>
            </fileset>
            <manifest>
                <attribute name="Implementation-Title" value="AllegroGraph Java Client"/>
                <attribute name="Implementation-Version" value="${env.version}"/>
                <attribute name="Implementation-Vendor" value="Franz, Inc."/>
             <attribute name="Implementation-URL" value="http://www.franz.com/agraph/"/>
             <attribute name="Built-At" value="${jar.datestamp}"/>
             <attribute name="Class-Path" value="${mf.path}"/>
            </manifest>
        </jar>
    </target>
    
    <target name="srcjar"
            description="Build agraph-src.jar file."
            depends="compile">
        <manifestclasspath property="mf.path.src" jarfile="${srcjarfile}">
            <classpath refid="classpath"/>
        </manifestclasspath>
        <tstamp prefix="srcjar">
            <format property="datestamp" pattern="yyyy-MM-dd H:mm"/>
        </tstamp>
        <jar jarfile="${srcjarfile}">
            <fileset dir="${src}" includes="**/*.java">
                <exclude name="tutorial/**"/>
                <exclude name="test/**"/>
            </fileset>
            <manifest>
                <attribute name="Implementation-Title" value="AllegroGraph Java Client Sources"/>
                <attribute name="Implementation-Version" value="${env.version}"/>
                <attribute name="Implementation-Vendor" value="Franz, Inc."/>
             <attribute name="Implementation-URL" value="http://www.franz.com/agraph/"/>
             <attribute name="Built-At" value="${srcjar.datestamp}"/>
             <attribute name="Class-Path" value="${mf.path.src}"/>
            </manifest>
        </jar>
    </target>
    
    <target name="build" depends="clean, jar"
            description="clean, and build jar">
    </target>
    
    <target name="test-jar"
            description="Create jar file of test classes."
            depends="compile">
        <tstamp prefix="jar">
            <format property="datestamp" pattern="yyyy-MM-dd H:mm"/>
        </tstamp>
        <jar jarfile="agraph-java-client-test.jar">
            <fileset dir="${build}">
                <include name="tutorial/**"/>
                <include name="test/**"/>
            </fileset>
            <manifest>
                <attribute name="Implementation-Title" value="AllegroGraph Java Client Test Code"/>
                <attribute name="Implementation-Version" value="${env.version}"/>
                <attribute name="Implementation-Vendor" value="Franz, Inc."/>
                <attribute name="Implementation-URL" value="http://www.franz.com/agraph/"/>
                <attribute name="Built-At" value="${jar.datestamp}"/>
                <attribute name="Class-Path" value="${mf.path}"/>
            </manifest>
        </jar>
    </target>

    <target name="javadoc"
     description="Generate javadocs to the doc directory">
        <delete dir="doc"/>
        <javadoc destdir="doc"
                 access="public"
                 author="true"
                 doctitle="Franz, Inc. AllegroGraph ${env.version} Javadoc"
                 header="Franz Inc, AllegroGraph"
                 footer="Copyright &amp;copy; 2008-2011 Franz Inc."
                 overview="src/overview.html"
                 nodeprecated="false"
                 nodeprecatedlist="false"
                 noindex="false"
                 nonavbar="false"
                 notree="false"
                 packagenames="com.franz.agraph.jena,com.franz.agraph.repository,com.franz.openrdf.rio.nquads,com.franz.util,com.franz.agraph.pool"
                 source="1.6"
                 sourcepath="src"
                 splitindex="true"
                 use="true"
                 version="true"
                 classpathref="classpath">
            <link href="http://download.oracle.com/javase/6/docs/api/" offline="true" packagelistLoc="lib/java"/>
            <link href="http://openjena.org/javadoc/" offline="true" packagelistloc="lib/jena-2.6.2"/>
            <link href="http://www.openrdf.org/doc/sesame2/2.3.2/apidocs/" offline="true" packagelistloc="lib/sesame-2.3.2"/>
        </javadoc>
    </target>
    
    <target name="prepush"
            description="Tests required before git push: clean, build, and run Java and Clojure client tests"
            depends="build, test-prepush">
        <ant dir="clojure" target="prepush" inheritall="false"/>
    </target>

    <target name="dist-init"
            description="Creates the DIST dir, runs dependencies"
            depends="clean, build, javadoc, srcjar">
        <delete dir="${DIST}"/>
        <mkdir dir="${DIST}"/>
        <copy file="LICENSE" todir="${DIST}"/>
    </target>
    
    <macrodef name="run-java"
              description="Run java class">
        <attribute name="tasknamex" default="java"/>
        <attribute name="classname"/>
        <attribute name="arg"/>
        <attribute name="maxmemory" default="1024m"/>
        <attribute name="streamResults" default="false"/>
        <sequential>
            <property name="log" value="info"/>
            <java classname="@{classname}" failonerror="true" taskname="@{tasknamex}"
                  fork="true" maxmemory="@{maxmemory}"
                  inputstring="">
                <!-- inputstring so ant will not hang when placed in shell background. This assumes none of the java code uses input. -->
                <sysproperty key="org.apache.commons.logging.Log"
                             value="org.apache.commons.logging.impl.SimpleLog"/>
                <sysproperty key="org.apache.commons.logging.simplelog.defaultlog"
                             value="${log}"/>
                <sysproperty key="org.apache.commons.logging.simplelog.log.org"
                             value="info"/>
                <sysproperty key="org.apache.commons.logging.simplelog.log.httpclient"
                             value="info"/>
                <sysproperty key="org.apache.commons.logging.simplelog.showlogname"
                             value="true"/>
                <sysproperty key="org.apache.commons.logging.simplelog.log.com"
                             value="info"/>
                <sysproperty key="org.apache.commons.logging.simplelog.log.test"
                             value="info"/>
                <sysproperty key="AGRAPH_HOST" value="${env.AGRAPH_HOST}"/>
                <sysproperty key="AGRAPH_PORT" value="${env.AGRAPH_PORT}"/>
                <sysproperty key="AGRAPH_ROOT" value="${env.root}"/>
                <sysproperty key="com.franz.agraph.repository.AGRepositoryConnection.streamResults" value="@{streamResults}"/>
                <classpath>
                    <path refid="classpath"/>
                    <path location="classes"/>
                </classpath>
                <arg value="@{arg}"/>
            </java>
        </sequential>
    </macrodef>
    
    <target name="test-junit"
            depends="compile"
            description="Run unit tests (use -Dcat=Prepush, Broken, or Stress)
(or use -Dtest=test.stress.TransactionStressTest)">
        <property name="cat" value="Prepush"/>
        <property name="prefix" value="test.TestSuites$"/>
        <property name="test" value="${prefix}${cat}"/>
        <property name="log" value="warn"/>
        <junit printsummary="no" haltonfailure="yes">
            <sysproperty key="org.apache.commons.logging.Log"
                         value="org.apache.commons.logging.impl.SimpleLog"/>
            <sysproperty key="org.apache.commons.logging.simplelog.defaultlog"
                         value="${log}"/>
            <sysproperty key="org.apache.commons.logging.simplelog.log.org"
                         value="warn"/>
            <sysproperty key="org.apache.commons.logging.simplelog.log.httpclient"
                         value="warn"/>
            <sysproperty key="org.apache.commons.logging.simplelog.showlogname"
                         value="true"/>
            <sysproperty key="AGRAPH_HOST" value="${env.AGRAPH_HOST}"/>
            <sysproperty key="AGRAPH_PORT" value="${env.AGRAPH_PORT}"/>
            <sysproperty key="AGRAPH_ROOT" value="${env.root}"/>
            <classpath>
                <path refid="classpath"/>
                <path location="classes"/>
            </classpath>
            <formatter type="plain" usefile="no"/>
            <test name="${test}"/>
        </junit>
    </target>
    
    <target name="test-prepush"
            depends="compile"
            description="run prepush tests">
        <run-java tasknamex="test" classname="test.TestRunner" arg="test.TestSuites$Prepush"/>
    </target>
    
    <target name="test-bigger"
            depends="clean, test-dist, prepush, test-stress-events, test-stress"
            description="run bigger tests, takes about 10 minutes">
    </target>
    
    <target name="test-broken"
            depends="compile"
            description="run tests known to be broken">
        <run-java tasknamex="test" classname="test.TestRunner" arg="test.TestSuites$Broken"/>
    </target>
    
    <target name="test-stress"
            depends="compile"
            description="long-running stress tests">
        <run-java tasknamex="test-stream" classname="test.TestRunner" arg="test.TestSuites$Prepush"
                  streamResults="true"/>
        <run-java tasknamex="test" classname="test.TestRunner" arg="test.TestSuites$Stress"/>
    </target>
    
    <target name="test-temp"
            depends="compile"
            description="">
        <property name="cat" value="Temp"/>
        <property name="prefix" value="test.TestSuites$"/>
        <property name="test" value="${prefix}${cat}"/>
        <run-java tasknamex="test" classname="test.TestRunner" arg="${test}"
                  streamResults="${streamResults}"/>
    </target>
    
    <target name="test-stress-events"
            depends="compile"
            description="Run events.sh with small settings">
        <exec executable="time" taskname="events"
              failonerror="true">
            <arg value="./events.sh"/>
            <arg value="--catalog"/>
            <arg value="java-tutorial"/>
            <arg value="--load"/>
            <arg value="2"/>
            <arg value="--query"/>
            <arg value="2"/>
            <arg value="--time"/>
            <arg value="1"/>
            <arg value="--size"/>
            <arg value="100000"/>
        </exec>
    </target>

    <!-- The testing/test-eclipse-workspace was created manually -->
    <!-- because there is no easy way to create a workspace and import -->
    <!-- a project using the eclipse command line. -->
    <!-- Instructions to create manually: -->
    <!-- 1. Run: ant test-dist-manual-step1 -->
    <!-- 2. Run: eclipse -data target/manual-ws -->
    <!-- 3. In the eclipse UI, import existing project, choose target/manual-ws/acjproject, Finish. -->
    <!-- 4. Exit eclipse. -->
    <!-- 5. Run: ant test-dist-manual-step2 -->
    <!-- 6. Run: ant test-dist -->
    <!-- 7. Run: git add testing/test-eclipse-workspace -->
    <target name="test-dist-manual-step1">
        <exec executable="make" taskname="make"
              failonerror="true" timeout="20000">
            <arg value="dist"/>
        </exec>
        <mkdir dir="target/manual-ws"/>
        <untar src="agraph-${env.version}-client-java.tar.gz" compression="gzip" dest="target/manual-ws/acjproject"/>
    </target>
    <target name="test-dist-manual-step2">
        <delete dir="testing/test-eclipse-workspace"/>
        <copy todir="testing/test-eclipse-workspace">
            <fileset dir="target/manual-ws">
                <include name=".metadata/version.ini"/>
                <include name=".metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version"/>
                <include name=".metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index"/>
                <include name=".metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version"/>
                <include name=".metadata/.plugins/org.eclipse.core.resources/.root/1.tree"/>
                <include name=".metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources"/>
            </fileset>
        </copy>
    </target>
    
    <target name="test-dist"
            description="Tests distribution agraph*.tar.gz">
        <exec executable="make" taskname="make"
              failonerror="true" timeout="40000">
            <env key="VERSION" value="${env.version}"/>
            <arg value="dist"/>
        </exec>
        <copy todir="target/test-ws">
            <fileset dir="testing/test-eclipse-workspace"/>
        </copy>
        <mkdir dir="target/test-ws/acjproject"/>
        <untar src="agraph-${env.version}-client-java.tar.gz" compression="gzip" dest="target/test-ws/acjproject"/>
        <exec executable="./eclipse-build.sh" taskname="eclipse-build.sh"
              failonerror="true" timeout="80000">
            <arg value="target/test-ws/"/>
            <arg value="target/test-ws/acjproject/bin/tutorial/TutorialExamples.class"/>
        </exec>
    </target>
    
    <target name="lubm-prolog"
            depends="compile"
            description="Run test.stress.Events">
        <run-java tasknamex="lubm-prolog" classname="test.lubm.AGLubmProlog" arg=""/>
    </target>
    
    <target name="lubm-sparql"
            depends="compile"
            description="Run test.stress.Events">
        <run-java tasknamex="lubm-sparql" classname="test.lubm.AGLubmSparql" arg=""/>
    </target>
    
    <target name="tutorial"
            depends="compile"
            description="Run tutorial example. Use -Dexample=5 for a specific example, default is all">
        <property name="example" value="all"/>
        <run-java tasknamex="tutorial" classname="tutorial.TutorialExamples" arg="${example}"/>
    </target>
    
    <target name="jena-tutorial"
            depends="compile"
            description="Run jena examples. Use -Dexample=5 for a specific example, default is all">
        <property name="example" value="all"/>
        <run-java tasknamex="jena-tutorial" classname="tutorial.JenaTutorialExamples" arg="${example}"/>
    </target>
    
    <target name="jena-compliance-tests"
            depends="compile"
            description="Run jena compliance tests.">
        <run-java tasknamex="AGGraphMakerTest " classname="org.junit.runner.JUnitCore" arg="test.AGGraphMakerTest"/>
        <run-java tasknamex="AGGraphTest " classname="org.junit.runner.JUnitCore" arg="test.AGGraphTest"/>
        <run-java tasknamex="AGModelTest " classname="org.junit.runner.JUnitCore" arg="test.AGModelTest"/>
        <run-java tasknamex="AGPrefixMappingTest" classname="org.junit.runner.JUnitCore" arg="test.AGPrefixMappingTest"/>
        <run-java tasknamex="AGResultSetTest " classname="org.junit.runner.JUnitCore" arg="test.AGResultSetTest"/>
        <run-java tasknamex="AGReifierTest " classname="org.junit.runner.JUnitCore" arg="test.AGReifierTest"/>
    </target>
    
    <target name="mvn-install"
            depends="build"
            description="install jars into local maven repo">
        <path id="maven-ant-tasks.classpath" path="${user.home}/.m2/repository/org/apache/maven/maven-ant-tasks/2.0.10/maven-ant-tasks-2.0.10.jar" />
        <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
                 uri="antlib:org.apache.maven.artifact.ant"
                 classpathref="maven-ant-tasks.classpath" />
        <copy file="pom.xml"
              tofile="classes/pom.xml">
            <filterset>
                <filter token="AGRAPH_VERSION" value="${env.version}"/>
            </filterset>
        </copy>
        <artifact:pom id="agraph" file="classes/pom.xml" />
        <artifact:install file="${jarfile}">
            <pom refid="agraph"/>
        </artifact:install>
        <artifact:pom id="sesame" file="pom-sesame.xml" />
        <artifact:install file="lib/sesame-2.3.2/openrdf-sesame-2.3.2-onejar.jar">
            <pom refid="sesame"/>
        </artifact:install>
    </target>

    <target name="test-war"
            depends="compile"
            description="builds agraph-test.war">
        <war destfile="target/agraph-test.war"
             webxml="src/test/web/web.xml">
            <classes dir="classes" includes="**/*"/>
            <lib dir="lib" includes="*.jar" excludes="servlet-api-2.5.jar"/>
            <lib dir="lib/sesame-2.3.2" includes="*.jar"/>
            <lib dir="lib/logging" includes="*.jar"/>
        </war>
    </target>

</project>
Something went wrong with that request. Please try again.