Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 37 additions & 36 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -475,55 +475,56 @@
</antcall>
</target>

<target name="test-core" depends="compile-core-test, job" description="--> run core JUnit tests only">

<target name="test-core" depends="compile-core-test, job" description="--> run core JUnit tests">
<delete dir="${test.build.data}"/>
<mkdir dir="${test.build.data}"/>
<!--
copy resources needed in junit tests
-->
<copy todir="${test.build.data}">
<fileset dir="src/testresources" includes="**/*"/>
</copy>
<copy file="${test.src.dir}/log4j.properties" todir="${test.build.classes}"/>
<copy file="${test.src.dir}/crawl-tests.xml" todir="${test.build.classes}"/>
<copy file="${test.src.dir}/domain-urlfilter.txt" todir="${test.build.classes}"/>
<copy file="${test.src.dir}/filter-all.txt" todir="${test.build.classes}"/>

<copy file="${test.src.dir}/log4j.properties"
todir="${test.build.classes}"/>

<copy file="${test.src.dir}/crawl-tests.xml"
todir="${test.build.classes}"/>

<copy file="${test.src.dir}/domain-urlfilter.txt"
todir="${test.build.classes}"/>

<copy file="${test.src.dir}/filter-all.txt"
todir="${test.build.classes}"/>

<junit printsummary="yes" haltonfailure="no" fork="yes" dir="${basedir}"
errorProperty="tests.failed" failureProperty="tests.failed" maxmemory="1000m">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<sysproperty key="test.include.slow" value="${test.include.slow}"/>
<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
<junitlauncher printSummary="true" haltOnFailure="true" failureProperty="tests.failed">
<classpath refid="test.classpath"/>
<formatter type="${test.junit.output.format}" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.src.dir}"
includes="**/Test*.java" excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<testclasses outputDir="${test.build.dir}" unless="testcase" includeEngines="junit-vintage">
<listener type="${test.junit.output.format}" sendSysOut="true" sendSysErr="true"/>
<fork dir="${basedir}">
<jvmarg value="-Xmx1000m"/>
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<sysproperty key="test.include.slow" value="${test.include.slow}"/>
<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
</fork>
<fileset dir="${test.build.classes}">
<include name="**/Test*.class"/>
<exclude name="**/${test.exclude}.class"/>
</fileset>
</testclasses>
<testclasses outputDir="${test.build.dir}" if="testcase" includeEngines="junit-vintage">
<listener type="${test.junit.output.format}" sendSysOut="true" sendSysErr="true"/>
<fork dir="${basedir}">
<jvmarg value="-Xmx1000m"/>
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<sysproperty key="test.include.slow" value="${test.include.slow}"/>
<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
</fork>
<fileset dir="${test.build.classes}">
<include name="**/${testcase}.class"/>
</fileset>
</testclasses>
</junitlauncher>

<fail if="tests.failed">Tests failed!</fail>

</target>

<target name="test-plugins" depends="resolve-test, compile, compile-core-test" description="--> run plugin JUnit tests only">
<target name="test-plugins" depends="resolve-test, compile, compile-core-test" description="--> run JUnit tests for all plugins">
<ant dir="src/plugin" target="test" inheritAll="false"/>
</target>

<target name="test-plugin" depends="resolve-test, compile, compile-core-test" description="--> run a single plugin's JUnit tests">
<target name="test-plugin" depends="resolve-test, compile, compile-core-test" description="--> run JUnit tests for a single plugin">
<ant dir="src/plugin" target="test-single" inheritAll="false"/>
</target>

Expand All @@ -541,7 +542,7 @@
<antcall target="copy-libs"/>
</target>

<target name="resolve-test" depends="clean-test-lib, init" description="--> resolve and retrieve dependencies with ivy">
<target name="resolve-test" depends="clean-test-lib, init" description="--> resolve and retrieve test dependencies with ivy">
<ivy:resolve file="${ivy.file}" conf="test" log="download-only"/>
<ivy:retrieve pattern="${test.build.lib.dir}/[artifact]-[revision](-[classifier]).[ext]" symlink="false" log="quiet"/>
<antcall target="copy-libs"/>
Expand Down
2 changes: 1 addition & 1 deletion default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.build.lib.dir = ${test.build.dir}/lib
test.build.data = ${test.build.dir}/data
test.build.classes = ${test.build.dir}/classes
test.build.javadoc = ${test.build.dir}/docs/api
test.junit.output.format = plain
test.junit.output.format = legacy-plain

# Proxy Host and Port to use for building JavaDoc
javadoc.proxy.host=-J-DproxyHost=
Expand Down
6 changes: 5 additions & 1 deletion ivy/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@
<exclude org="org.gnu.inet" module="libidn" /><!-- LGPL 2.1 -->
</dependency>

<!--artifacts needed for testing -->
<!-- Keep the JUnit 4 dependency for test compilation and runtime support. Remove once migration is complete -->
<dependency org="junit" name="junit" rev="4.13.2" conf="test->default" />
<!-- JUnit 5 Platform Launcher (required for <junitlauncher> task) -->
<dependency org="org.junit.platform" name="junit-platform-launcher" rev="1.13.4" conf="test->default"/>
<!-- JUnit Vintage Engine (to run existing JUnit 4 tests). Remove once migration is complete -->
<dependency org="org.junit.vintage" name="junit-vintage-engine" rev="5.13.4" conf="test->default"/>
<dependency org="org.apache.mrunit" name="mrunit" rev="1.1.0" conf="test->default">
<artifact name="mrunit" ns0:classifier="hadoop2" />
<exclude org="log4j" module="log4j" />
Expand Down
35 changes: 31 additions & 4 deletions src/plugin/build-plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@
</fileset>
<!-- global test dependencies -->
<fileset dir="${nutch.root}/build/test/lib">
<include name="junit*.jar" />
<include name="hamcrest*.jar" />
<include name="junit*.jar" />
<include name="opentest4j*.jar" />
</fileset>
<path refid="classpath"/>
</path>
Expand Down Expand Up @@ -208,7 +209,7 @@
<target name="test" depends="compile-test, deploy" if="test.available">
<echo message="Testing plugin: ${name}"/>

<junit printsummary="yes" haltonfailure="no" fork="yes"
<!--junit printsummary="yes" haltonfailure="no" fork="yes"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="test.data" value="${build.test}/data"/>
<sysproperty key="test.input" value="${root}/data"/>
Expand All @@ -222,10 +223,36 @@
<batchtest todir="${build.test}" if="testcase">
<fileset dir="${src.test}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
</junit-->

<fail if="tests.failed">Tests failed!</fail>
<junitlauncher printSummary="true" haltOnFailure="true" failureProperty="tests.failed">
<classpath refid="test.classpath"/>
<testclasses outputDir="${build.test}" unless="testcase">
<listener type="${test.junit.output.format}" sendSysOut="true" sendSysErr="true"/>
<fork dir="${basedir}">
<sysproperty key="test.data" value="${build.test}/data"/>
<sysproperty key="test.input" value="${root}/data"/>
<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
</fork>
<fileset dir="${build.test}">
<include name="**/Test*.class"/>
<exclude name="**/${test.exclude}.class"/>
</fileset>
</testclasses>
<testclasses outputDir="${build.test}" if="testcase">
<listener type="${test.junit.output.format}" sendSysOut="true" sendSysErr="true"/>
<fork dir="${basedir}">
<sysproperty key="test.data" value="${build.test}/data"/>
<sysproperty key="test.input" value="${root}/data"/>
<sysproperty key="javax.xml.parsers.DocumentBuilderFactory" value="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
</fork>
<fileset dir="${build.test}">
<include name="**/${testcase}.class"/>
</fileset>
</testclasses>
</junitlauncher>

<fail if="tests.failed">Tests failed!</fail>
</target>

<!-- target: resolve ================================================= -->
Expand Down