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
|
<!-- $Id$ -->
<project name="clover" default="build" basedir=".">
<property name="db" location="../../.."/>
<property name="db.jar" location="${db}/build_unix/db.jar"/>
<property name="test.src" location="src"/>
<property name="examples.src" location="${db}/examples/java/src"/>
<property name="clover.initstring" location="reports/clover.db"/>
<property name="clover.excludes" value="**/test/** collections/** db/** com/sleepycat/db/**"/>
<!--
<property name="build.compiler"
value="org.apache.tools.ant.taskdefs.CloverCompilerAdapter"/>
-->
<target name="all" depends="clean,test,report"/>
<target name="clean">
<delete dir="classes"/>
<delete dir="tmp"/>
<delete dir="reports"/>
<delete dir="original"/>
<delete dir="evolved"/>
<delete dir="testevolvedir"/>
<delete dir="testserialdir"/>
<delete dir="testenhancedir"/>
</target>
<target name="init">
<mkdir dir="classes"/>
<mkdir dir="tmp"/>
<mkdir dir="reports"/>
</target>
<path id="clover.classpath">
<pathelement location="clover.jar"/>
<pathelement location="velocity.jar"/>
</path>
<path id="classpath">
<pathelement location="${db.jar}"/>
<pathelement location="classes"/>
<pathelement location="clover.jar"/>
<path refid="clover.classpath"/>
</path>
<path id="enhanced.classpath">
<pathelement location="${db.jar}"/>
<pathelement location="testenhancedir"/>
</path>
<target name="build" depends="init">
<echo message="Using db.jar: ${db.jar}"/>
<javac destdir="classes" debug="on" source="1.5" target="1.5">
<classpath refid="classpath"/>
<src path="${test.src}"/>
<src path="${examples.src}"/>
<exclude name="com/sleepycat/**/release/**"/>
</javac>
<!-- Compile original version of TestSerial.java.original. -->
<property name="testserialpath"
value="com/sleepycat/collections/test/serial/TestSerial"/>
<copy file="${test.src}/${testserialpath}.java.original"
tofile="testserialdir/${testserialpath}.java"/>
<javac destdir="testserialdir" debug="on" source="1.5" target="1.5"
includeAntRuntime="true" srcdir="testserialdir">
<include name="${testserialpath}.java"/>
<classpath refid="classpath"/>
</javac>
<!-- Compile original version of EvolveClasses. -->
<copy file=
"${test.src}/com/sleepycat/persist/test/EvolveClasses.java.original"
tofile=
"testevolvedir/com/sleepycat/persist/test/EvolveClasses.java"/>
<copy file=
"${test.src}/com/sleepycat/persist/test/EvolveCase.java"
tofile=
"testevolvedir/com/sleepycat/persist/test/EvolveCase.java"/>
<copy file=
"${test.src}/com/sleepycat/persist/test/PersistTestUtils.java"
tofile=
"testevolvedir/com/sleepycat/persist/test/PersistTestUtils.java"/>
<javac debug="on" source="1.5" target="1.5">
<src path="testevolvedir"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="test" depends="build">
<!-- Determine which tests to run. -->
<condition property="dotestserial">
<or>
<not><isset property="testcase"/></not>
<equals arg1="${testcase}" arg2=
"com.sleepycat.collections.test.serial.StoredClassCatalogTest"/>
</or>
</condition>
<condition property="dotestevolve">
<or>
<not><isset property="testcase"/></not>
<equals arg1="${testcase}"
arg2="com.sleepycat.persist.test.EvolveTest"/>
</or>
</condition>
<!-- Performs initialization needed before StoredClassCatalogTest. -->
<junit fork="yes" dir="." printsummary="on" haltonfailure="on"
showoutput="on">
<jvmarg value="-ea"/>
<classpath path="testserialdir"/> <!-- Must be first -->
<classpath refid="classpath"/>
<sysproperty key="testdestdir" value="./tmp"/>
<sysproperty key="longtest" value="${longtest}"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<test name=
"com.sleepycat.collections.test.serial.StoredClassCatalogTestInit"
todir="reports" if="dotestserial"/>
</junit>
<!-- Performs initialization needed before persist EvolveTest. -->
<junit fork="yes" dir="." printsummary="on" haltonfailure="on"
showoutput="on">
<jvmarg value="-ea"/>
<classpath path="testevolvedir"/>
<classpath refid="classpath"/>
<sysproperty key="testdestdir" value="./tmp"/>
<sysproperty key="longtest" value="${longtest}"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<test name="com.sleepycat.persist.test.EvolveTestInit"
todir="reports" if="dotestevolve"/>
</junit>
<!-- Performs testcase if set, or batch tests. -->
<junit fork="yes" dir="." printsummary="on" haltonfailure="on"
showoutput="on">
<jvmarg value="-ea"/>
<classpath refid="classpath"/>
<sysproperty key="testdestdir" value="./tmp"/>
<sysproperty key="longtest" value="${longtest}"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<test name="${testcase}" todir="reports" if="testcase"/>
<batchtest todir="reports" unless="testcase">
<fileset dir="classes" includes="**/*Test.class"/>
</batchtest>
</junit>
<!-- Run the persist tests with -javaagent to enhance classes as they are
loaded. In this, and the following two tests with enhanced classes,
set the expectEnhanced system property to cause the test to fail if
classes are not enhanced. -->
<echo message="Run persist tests with -javaagent"/>
<junit fork="yes" dir="." printsummary="on" haltonfailure="on"
showoutput="on">
<jvmarg value="-ea"/>
<jvmarg value="-javaagent:${db.jar}=enhance:-v,com.sleepycat.persist"/>
<classpath refid="classpath"/>
<sysproperty key="testdestdir" value="./tmp"/>
<sysproperty key="longtest" value="${longtest}"/>
<sysproperty key="expectEnhanced" value="true"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="reports" unless="testcase">
<fileset dir="classes"
includes="com/sleepycat/persist/**/*Test.class"/>
</batchtest>
</junit>
<!-- Enhance persist test classes by rewriting the class files with the
enhancer ant task, and run the persist tests again. Compile
ClassEnhancerTask here. It is not compiled into db.jar because that
would create a primary build dependency on the Ant libraries. -->
<!-- <echo message="Run persist tests with ClassEnhancer ant task"/>
<delete dir="testenhancedir"/>
<mkdir dir="testenhancedir"/>
<copy todir="testenhancedir">
<fileset dir="classes" includes="com/sleepycat/persist/**/*.class"/>
</copy>
<javac destdir="testenhancedir" debug="on" source="1.5" target="1.5"
includeAntRuntime="true" srcdir="${db}/lang/java/src">
<include name="com/sleepycat/persist/model/ClassEnhancerTask.java"/>
<classpath refid="classpath"/>
</javac>
<taskdef name="enhancer"
classname="com.sleepycat.persist.model.ClassEnhancerTask">
<classpath refid="enhanced.classpath"/>
</taskdef>
<enhancer verbose="on">
<fileset dir="testenhancedir"/>
</enhancer>
<junit fork="yes" dir="." printsummary="on" haltonfailure="on"
showoutput="on">
<jvmarg value="-ea"/>
<classpath refid="enhanced.classpath"/>
<classpath refid="classpath"/>
<sysproperty key="testdestdir" value="./tmp"/>
<sysproperty key="longtest" value="${longtest}"/>
<sysproperty key="expectEnhanced" value="true"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="reports" unless="testcase">
<fileset dir="classes"
includes="com/sleepycat/persist/**/*Test.class"/>
</batchtest>
</junit> -->
<!-- Enhance persist test classes by rewriting the class files with the
ClassEnhancer main program, and run the persist tests again. -->
<echo message="Run persist tests with ClassEnhancer main program"/>
<delete dir="testenhancedir"/>
<mkdir dir="testenhancedir"/>
<copy todir="testenhancedir">
<fileset dir="classes" includes="com/sleepycat/persist/**/*.class"/>
</copy>
<java fork="yes" failonerror="true"
classname="com.sleepycat.persist.model.ClassEnhancer">
<arg line="-v testenhancedir"/>
<classpath refid="classpath"/>
</java>
<junit fork="yes" dir="." printsummary="on" haltonfailure="on"
showoutput="on">
<jvmarg value="-ea"/>
<classpath refid="enhanced.classpath"/>
<classpath refid="classpath"/>
<sysproperty key="testdestdir" value="./tmp"/>
<sysproperty key="longtest" value="${longtest}"/>
<sysproperty key="expectEnhanced" value="true"/>
<formatter type="plain" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="reports" unless="testcase">
<fileset dir="classes"
includes="com/sleepycat/persist/**/*Test.class"/>
</batchtest>
</junit>
</target>
<!-- examples runs all examples, but does not include access_example because
it is interactive.
-->
<target name="examples" depends="build">
<echo message="=== HelloDatabaseWorld ==="/>
<java dir="." fork="yes" classpathref="classpath" failonerror="true"
classname="collections.hello.HelloDatabaseWorld"/>
<echo message=""/>
<antcall target="one_shipment_example">
<param name="param_name" value="basic"/>
</antcall>
<antcall target="one_shipment_example">
<param name="param_name" value="index"/>
</antcall>
<antcall target="one_shipment_example">
<param name="param_name" value="entity"/>
</antcall>
<antcall target="one_shipment_example">
<param name="param_name" value="tuple"/>
</antcall>
<antcall target="one_shipment_example">
<param name="param_name" value="sentity"/>
</antcall>
<antcall target="one_shipment_example">
<param name="param_name" value="marshal"/>
</antcall>
<antcall target="one_shipment_example">
<param name="param_name" value="factory"/>
</antcall>
<antcall target="one_persist_example">
<param name="param_name" value="CustomKeyOrderExample"/>
</antcall>
<antcall target="one_persist_example">
<param name="param_name" value="EventExample"/>
</antcall>
<antcall target="one_persist_example">
<param name="param_name" value="EventExampleDPL"/>
</antcall>
<antcall target="one_persist_example">
<param name="param_name" value="PersonExample"/>
</antcall>
<antcall target="DplDump">
<param name="home" value="tmp"/>
<param name="store" value="PersonStore"/>
</antcall>
<antcall target="db-gettingStarted"/>
<antcall target="db-txn"/>
<antcall target="persist-gettingStarted"/>
<antcall target="persist-txn"/>
</target>
<target name="one_shipment_example">
<echo message="=== ${param_name} ==="/>
<delete dir="tmp"/>
<mkdir dir="tmp"/>
<java dir="." fork="yes" classpathref="classpath" failonerror="true"
classname="collections.ship.${param_name}.Sample"/>
</target>
<target name="one_persist_example">
<echo message="=== ${param_name} ==="/>
<delete dir="tmp"/>
<mkdir dir="tmp"/>
<java fork="yes" dir="." classname="persist.${param_name}"
failonerror="true">
<jvmarg value="-ea"/>
<arg line="-h tmp"/>
<classpath refid="classpath"/>
</java>
</target>
<!--
Before running this example, first run another DPL example that writes to the
home directory. Note that we do not clear the home directory here, in order
to use the DB in the home directory from a previous run.
-->
<target name="DplDump">
<echo message="=== DplDump ${home} ${store} ==="/>
<java fork="yes" dir="." classname="persist.DplDump" failonerror="true">
<jvmarg value="-ea"/>
<arg line="-h ${home} -s ${store}"/>
<classpath refid="classpath"/>
</java>
</target>
<target name="access_example" depends="build">
<echo message="=== AccessExample ==="/>
<java fork="yes" dir="." classpathref="classpath" failonerror="true"
classname="collections.access.AccessExample">
</java>
</target>
<!-- Test GSG examples -->
<target name="db-gettingStarted" depends="build">
<delete dir="tmp"/>
<mkdir dir="tmp"/>
<copy todir="tmp">
<fileset dir="${examples.src}/db/GettingStarted">
<include name="*.txt"/>
<exclude name="*.java"/>
</fileset>
</copy>
<java fork="yes" dir="tmp"
classname="db.GettingStarted.ExampleDatabaseLoad"
failonerror="true">
<arg line="-h ."/>
<classpath refid="classpath"/>
</java>
<java fork="yes" dir="tmp"
classname="db.GettingStarted.ExampleDatabaseRead"
failonerror="true">
<arg line="-h ."/>
<classpath refid="classpath"/>
</java>
<delete file="tmp/inventory.txt"/>
<delete file="tmp/vendors.txt"/>
</target>
<target name="db-txn" depends="build">
<delete dir="tmp"/>
<mkdir dir="tmp"/>
<java fork="yes" dir="."
classname="db.txn.TxnGuide"
failonerror="true">
<arg line="-h tmp"/>
<classpath refid="classpath"/>
</java>
</target>
<target name="persist-gettingStarted" depends="build">
<delete dir="tmp"/>
<mkdir dir="tmp"/>
<mkdir dir="tmp/JEDB"/>
<copy todir="tmp">
<fileset dir="${examples.src}/persist/gettingStarted">
<include name="*.txt"/>
<exclude name="*.java"/>
</fileset>
</copy>
<java fork="yes" dir="tmp"
classname="persist.gettingStarted.SimpleStorePut"
failonerror="true">
<arg line="-h ."/>
<classpath refid="classpath"/>
</java>
<java fork="yes" dir="tmp"
classname="persist.gettingStarted.SimpleStoreGet"
failonerror="true">
<arg line="-h ."/>
<classpath refid="classpath"/>
</java>
<delete file="tmp/inventory.txt"/>
<delete file="tmp/vendors.txt"/>
</target>
<target name="persist-txn" depends="build">
<delete dir="tmp"/>
<mkdir dir="tmp"/>
<java fork="yes" dir="."
classname="persist.txn.TxnGuideDPL"
failonerror="true">
<arg line="-h tmp"/>
<classpath refid="classpath"/>
</java>
</target>
<target name="report">
<java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter"
failonerror="true" fork="true">
<arg line="--outputdir reports --showSrc --initstring ${clover.initstring} --title 'Berkeley DB Java BDB API'"/>
<classpath refid="clover.classpath"/>
</java>
</target>
</project>
|