summaryrefslogtreecommitdiff
path: root/src/etc/testcases/taskdefs
diff options
context:
space:
mode:
authorJaikiran Pai <jaikiran@apache.org>2018-08-27 18:50:15 +0530
committerJaikiran Pai <jaikiran@apache.org>2018-08-27 18:50:15 +0530
commitd7c518584ecf5dc4b586dd4a1a9a20dec50a1a20 (patch)
treedb0d2130b32685e87fcdd1c6754017f5b0f64cbf /src/etc/testcases/taskdefs
parent8590e1539af7e5057d02941911c44d887ba3caca (diff)
downloadant-d7c518584ecf5dc4b586dd4a1a9a20dec50a1a20.tar.gz
[junitlauncher] add some more tests to verify exclusion of Ant runtime and JUnit platform libraries from the forked JVM classpath of junitlauncher task
Diffstat (limited to 'src/etc/testcases/taskdefs')
-rw-r--r--src/etc/testcases/taskdefs/optional/junitlauncher.xml60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/etc/testcases/taskdefs/optional/junitlauncher.xml b/src/etc/testcases/taskdefs/optional/junitlauncher.xml
index d24421371..3daa397a0 100644
--- a/src/etc/testcases/taskdefs/optional/junitlauncher.xml
+++ b/src/etc/testcases/taskdefs/optional/junitlauncher.xml
@@ -32,6 +32,7 @@
<fileset dir="../../../../../lib/optional" includes="junit-vintage-engine*.jar"/>
<fileset dir="../../../../../lib/optional" includes="junit-*.jar"/>
<fileset dir="../../../../../lib/optional" includes="hamcrest*.jar"/>
+ <fileset dir="../../../../../lib/optional" includes="opentest4j*.jar"/>
</path>
<path id="junit.engine.jupiter.classpath">
@@ -210,5 +211,64 @@
</test>
</junitlauncher>
</target>
+
+ <target name="test-ant-runtime-lib-custom-location" depends="init">
+ <!-- duplicate the Ant classes into a jar -->
+ <jar destfile="${output.dir}/ant-runtime-duplicated.jar" basedir="${ant.runtime.classes.original.path}"/>
+
+ <junitlauncher>
+ <classpath>
+ <path refid="junit.engine.jupiter.classpath"/>
+ <path refid="junit.engine.vintage.classpath"/>
+ <pathelement location="${build.classes.dir}"/>
+ <!-- our duplicated Ant runtime classes jar, since we
+ exclude the original Ant runtime classes on the fork element
+ by setting includeAntRuntimeLibraries=false -->
+ <pathelement location="${output.dir}/ant-runtime-duplicated.jar"/>
+ </classpath>
+ <testclasses outputdir="${output.dir}">
+ <fileset dir="${build.classes.dir}">
+ <include name="org/example/**/junitlauncher/**/"/>
+ </fileset>
+ <listener classname="org.example.junitlauncher.Tracker"
+ outputDir="${output.dir}"
+ resultFile="${test-ant-runtime-lib-custom-location.tracker}"
+ if="test-ant-runtime-lib-custom-location.tracker"/>
+ <fork dir="${basedir}" includeAntRuntimeLibraries="false">
+ <sysproperty key="junitlauncher.test.sysprop.one" value="forked"/>
+ </fork>
+ </testclasses>
+ </junitlauncher>
+ </target>
+
+
+ <target name="test-ant-and-junit-platform-lib-custom-location" depends="init">
+ <!-- duplicate the Ant classes into a jar -->
+ <jar destfile="${output.dir}/ant-runtime-duplicated.jar" basedir="${ant.runtime.classes.original.path}"/>
+
+ <junitlauncher>
+ <classpath>
+ <path refid="junit.engine.vintage.classpath"/>
+ <pathelement location="${build.classes.dir}"/>
+ <!-- our duplicated Ant runtime classes jar, since we
+ exclude the original Ant runtime classes on the fork element
+ by setting includeAntRuntimeLibraries=false -->
+ <pathelement location="${output.dir}/ant-runtime-duplicated.jar"/>
+ <!-- we set includeJUnitPlatformLibraries=false on the fork element
+ and then explicitly specify a location of the JUnit platform libraries -->
+ <path refid="junit.platform.classpath"/>
+ </classpath>
+ <testclasses outputdir="${output.dir}">
+ <fileset dir="${build.classes.dir}">
+ <include name="org/example/**/junitlauncher/**/JUnit4SampleTest.class"/>
+ </fileset>
+ <listener classname="org.example.junitlauncher.Tracker"
+ outputDir="${output.dir}"
+ resultFile="${test-ant-and-junit-platform-lib-custom-location.tracker}"
+ if="test-ant-and-junit-platform-lib-custom-location.tracker"/>
+ <fork dir="${basedir}" includeAntRuntimeLibraries="false" includeJUnitPlatformLibraries="false"/>
+ </testclasses>
+ </junitlauncher>
+ </target>
</project>