This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xerces-j.git
The following commit(s) were added to refs/heads/main by this push:
new 8f83cf685 [XERCESJ-1770] Test on Java 11, 17, and 21. Turn on more
tests for Java 8. (#15)
8f83cf685 is described below
commit 8f83cf685bc9b6aef4c93dbc8f14da667967c846
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Sun Jun 29 11:36:33 2025 +0000
[XERCESJ-1770] Test on Java 11, 17, and 21. Turn on more tests for Java 8.
(#15)
* Turn on tests for Java 11
* clean before test
* Remove DOMFilter test that no longer exists
* disable schema.config.AllTests
* turn on more tests
* run all tests on Java 8
* Fix annotations tests
* turn on JDK 17 and 21
* no more java9OrLater
---
.github/workflows/ant.yml | 8 +-
README | 2 +-
build.xml | 122 +++++++++------------
tests/schema/annotations/TestCase.java | 14 +--
.../XSAttributeGroupAnnotationsTest.java | 6 +-
5 files changed, 63 insertions(+), 89 deletions(-)
diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml
index 5de4b4633..4849549e3 100644
--- a/.github/workflows/ant.yml
+++ b/.github/workflows/ant.yml
@@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- jdk: ['8']
+ jdk: ['8', '11', '17', '21']
steps:
- uses: actions/checkout@v4
@@ -42,10 +42,8 @@ jobs:
- name: Ant Build (target dtdjars)
run: ant -noinput -buildfile build.xml dtdjars
- # test fails on JDK 8 due to java.lang.NoSuchFieldError
- # test fails in JDK 11+ as -Xbootclasspath/p is no longer a supported
option
- - name: Ant Test (target test)
- run: ant -noinput -buildfile build.xml ci-test
+ - name: Ant Test (target ci-test)
+ run: ant -noinput -buildfile build.xml clean ci-test
# cannot target 'all' with any JDK due to NoClassDefFoundError:
com/sun/image/codec/jpeg/JPEGCodec
#- name: Ant Build (target all)
diff --git a/README b/README
index a9f5daf79..b68fe5477 100644
--- a/README
+++ b/README
@@ -39,7 +39,7 @@ repos has Java language maximum source/target level
requirement of 1.8.
Before initiating any part of the build, set the JAVA_HOME environment
variable to the installation directory of your JDK.
-An Ant (https://ant.apache.org/) build tool is needed to build everything in
Xerces-J, including
+Ant (https://ant.apache.org/) 1.10.2 or later is needed to build everything in
Xerces-J, including
the documentation. This tool, and the others needed (besides the
pre-requisite JDK) are contained within the tools package. To
make building Xerces-J packages easier, Windows batch file and a Linux
diff --git a/build.xml b/build.xml
index d0da81856..f2882dba1 100644
--- a/build.xml
+++ b/build.xml
@@ -27,7 +27,7 @@ Authors:
$Id$
==================================================================== -->
-<project default="usage" basedir="." xmlns:if="ant:if">
+<project default="usage" basedir=".">
<!-- Xerces Java directories -->
<property name="build.dir" value="./build"/>
@@ -88,15 +88,10 @@ Authors:
<property name="copyright" value="Copyright © ${year} The Apache
Software Foundation. All Rights Reserved."/>
<echo message= "---------------- ${parser.Name} ${parser.Version}
[${year}] ---------------"/>
- <!-- changed made to synchronize with a patch from Sam Ruby
(<[email protected]>) to Xerces1
- <property name="build.compiler" value="classic"/> -->
<property name="debug" value="true"/> <!-- make this 'false' during
releases -->
<property name="debuglevel" value="lines,source"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="off"/>
-
- <!--<property name="javac.source" value="${ant.java.version}"/>
- <property name="javac.target" value="${ant.java.version}"/>-->
<property name="javac.source" value="1.8"/>
<property name="javac.target" value="1.8"/>
@@ -126,10 +121,6 @@ Authors:
<filter token="date" value="${TODAY}"/>
<filter token="log" value="true"/>
<filter token="verbose" value="true"/>
-
- <condition property="java9OrLater">
- <javaversion atleast="9" />
- </condition>
</target>
<!-- =================================================================== -->
@@ -756,58 +747,58 @@ Authors:
</target>
- <!-- =================================================================== -->
- <!-- Do a sanity test using samples -->
- <!-- =================================================================== -->
<target name="test" depends="tests">
- <path id="test.classpath">
+ <path id="run.classpath">
<pathelement location="${tools.dir}/${jar.apis}"/>
<pathelement location="${tools.dir}/${jar.resolver}"/>
<pathelement location="${tools.dir}/${jar.serializer}"/>
<pathelement location="${tools.dir}/${jar.junit}"/>
<pathelement location="${build.dir}/classes"/>
+ </path>
+ <pathconvert property="run.classpath.string" refid="run.classpath"
pathsep="${path.separator}"/>
+ <path id="test.classpath">
+ <path refid="run.classpath"/>
<pathelement location="${build.dir}/tests"/>
</path>
+ <pathconvert property="test.classpath.string" refid="test.classpath"
pathsep="${path.separator}"/>
+
<echo message="Performing sanity test for ${parser.Name} ${parser.Version}
..." />
- <echo message="Using
classpath='${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}:${build.dir}/classes'"
/>
+ <echo message="Using classpath='${run.classpath.string}'" />
<echo message="Running sax.Counter ..." />
<java fork="yes"
classname="sax.Counter"
+ classpathref="run.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="${data.dir}/personal.xml"/>
</java>
<echo message="Running sax.Writer ..." />
<java fork="yes"
classname="sax.Writer"
+ classpathref="run.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="${data.dir}/personal.xml"/>
</java>
- <!-- fails in CI on Java 8 due to NoSuchFieldError; fix this -->
- <echo if:set="java9OrLater" message="Running dom.Counter ..." />
- <java if:set="java9OrLater"
- fork="yes"
+ <echo message="Running dom.Counter ..." />
+ <java fork="yes"
classname="dom.Counter"
+ classpathref="run.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="${data.dir}/personal.xml"/>
</java>
- <echo if:set="java9OrLater" message="Running dom.Writer ..." />
- <java if:set="java9OrLater"
- fork="yes"
+ <echo message="Running dom.Writer ..." />
+ <java fork="yes"
classname="dom.Writer"
+ classpathref="run.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="${data.dir}/personal.xml"/>
</java>
<!-- TODO These should be run using the junit tasks, not java -->
- <echo if:set="java9OrLater" message="Running thread.Test dom" />
- <java if:set="java9OrLater"
- fork="yes"
+ <echo message="Running thread.Test dom" />
+ <echo message="Using classpath='${test.classpath.string}'" />
+ <java fork="yes"
classname="thread.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="-dom"/>
<arg value="-threads"/>
<arg value="20"/>
@@ -818,8 +809,8 @@ Authors:
<echo message="Running thread.Test sax" />
<java fork="yes"
classname="thread.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="-threads"/>
<arg value="20"/>
<arg value="-time"/>
@@ -827,37 +818,29 @@ Authors:
<arg value="${data.dir}/personal-schema.xml"/>
</java>
- <echo if:set="java9OrLater" message="Running DOMFilter ..." />
- <java if:set="java9OrLater"
- fork="yes"
-
classpath="${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}:${build.dir}/classes"
- classname="dom.DOMFilter"
- args="-p dom.wrappers.DOMParser ${data.dir}/personal.xml"/>
<echo message="Running dom.DTest..." />
<java fork="yes"
classname="dom.DTest"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
<echo message="Running dom.mem.Test..." />
<java fork="yes"
classname="dom.mem.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
- <java if:set="java9OrLater"
- fork="yes"
+ <java fork="yes"
classname="dom.range.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="all"/>
</java>
- <echo if:set="java9OrLater" message="Running dom.ids.Test..." />
- <java if:set="java9OrLater"
- fork="yes"
+ <echo message="Running dom.ids.Test..." />
+ <java fork="yes"
classname="dom.ids.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
<!--
@@ -865,31 +848,29 @@ Authors:
[java] error: Error occurred - Feature
'http://apache.org/xml/features/validation/schema' is not recognized.
[java] org.xml.sax.SAXNotRecognizedException: Feature
'http://apache.org/xml/features/validation/schema' is not recognized.
-->
- <echo if:set="java9OrLater" message="Running dom.serialization.Test..." />
- <java if:set="java9OrLater" fork="yes"
- classname="dom.serialization.Test"
+ <echo message="Running dom.serialization.Test..." />
+ <java classname="dom.serialization.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="${data.dir}/personal-schema.xml"/>
<arg value="out.xml"/>
</java>
- <echo if:set="java9OrLater" message="Running dom.traversal.AllTests..." />
- <java if:set="java9OrLater"
- fork="yes"
+ <echo message="Running dom.traversal.AllTests..." />
+ <java fork="yes"
classname="dom.traversal.AllTests"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${tools.dir}/${jar.junit}${path.separator}${build.dir}/classes${path.separator}${build.dir}/tests"/>
</java>
<echo message="Running schema.Test..." />
<java fork="yes"
classname="schema.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
- <echo if:set="java9OrLater" message="Running schema.config.AllTests..." />
- <!-- TODO some of these tests pass on java 8 so I need to split them in
such a way that we can enable them -->
- <junit if:set="java9OrLater"
- fork="yes"
+ <!-- TODO some of these tests pass so I need to split them in such a way
that we can enable them -->
+ <!-- These tests are failing. Fix them.
+ <echo message="Running schema.config.AllTests..." />
+ <junit fork="yes"
haltonfailure="no"
haltonerror="no"
failureproperty="test.failed"
@@ -899,28 +880,31 @@ Authors:
<test name="schema.config.AllTests"/>
<formatter type="brief" usefile="false"/>
</junit>
- <echo if:set="java9OrLater" message="Running
schema.annotations.AllTests..." />
- <junit if:set="java9OrLater" fork="yes"
- haltonfailure="no"
+ -->
+ <echo message="Running schema.annotations.AllTests..." />
+ <junit haltonfailure="no"
haltonerror="no"
failureproperty="test.failed"
errorproperty="test.failed"
showoutput="yes">
- <classpath refid="test.classpath"/>
+ <classpath>
+ <path refid="test.classpath"/>
+ <pathelement location="tests"/>
+ </classpath>
<test name="schema.annotations.AllTests"/>
<formatter type="brief" usefile="false"/>
</junit>
<echo message="Running jaxp.PropertyTest..." />
<java fork="yes"
classname="jaxp.PropertyTest"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
<echo message="Running jaxp.JAXPSpecTest..." />
<java fork="yes"
classname="jaxp.JAXPSpecTest"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
<arg value="testSchemaLanguageSAX"/>
<arg value="testSchemaSourceSAX"/>
<arg value="testSchemaLanguageDOM"/>
@@ -929,26 +913,26 @@ Authors:
<echo message="Running xinclude.Test..." />
<java fork="yes"
classname="xinclude.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
<echo message="Running dom.registry.Test..." />
<java fork="yes"
classname="dom.registry.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
<echo message="Running dom.dom3.Test..." />
<java fork="yes"
classname="dom.dom3.Test"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${build.dir}/classes"/>
</java>
<echo message="Running idc.AllTests..." />
<java fork="yes"
classname="idc.AllTests"
+ classpathref="test.classpath"
failOnError="yes">
- <jvmarg
value="-Xbootclasspath/p:${tools.dir}/${jar.apis}${path.separator}${tools.dir}/${jar.resolver}${path.separator}${tools.dir}/${jar.serializer}${path.separator}${tools.dir}/${jar.junit}${path.separator}${build.dir}/classes${path.separator}${build.dir}/tests"/>
</java>
</target>
diff --git a/tests/schema/annotations/TestCase.java
b/tests/schema/annotations/TestCase.java
index 189512aaa..75b20cf3f 100644
--- a/tests/schema/annotations/TestCase.java
+++ b/tests/schema/annotations/TestCase.java
@@ -33,27 +33,19 @@ public class TestCase extends junit.framework.TestCase {
super(test);
}
- /**
- *
- */
protected String getResourceURL(String path) {
// build the location URL of the document
String packageDir = this.getClass().getPackage().getName().replace('.',
File.separatorChar);
String documentPath = packageDir + "/" + path;
- URL url = ClassLoader.getSystemResource(documentPath);
+ URL url = this.getClass().getClassLoader().getResource(documentPath);
if (url == null) {
- fail ("Couldn't find xml file for test: " + documentPath);
+ String message = "Couldn't find xml file for test: " +
documentPath;
+ fail (message);
}
- // = getClass().getClassLoader().getResource(path);
-
- // System.out.println(url.toExternalForm());
return url.toExternalForm();
}
- /**
- *
- */
protected String trim(String toTrim) {
String replaced = toTrim.replace('\t', ' ');
replaced = replaced.replace('\n', ' ');
diff --git a/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java
b/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java
index f01d35fe2..7ed9a3368 100644
--- a/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java
+++ b/tests/schema/annotations/XSAttributeGroupAnnotationsTest.java
@@ -74,7 +74,7 @@ public class XSAttributeGroupAnnotationsTest extends TestCase
{
}
/**
- * This method is called before every test case method, to tears down the
+ * This method is called after every test case method, to tear down the
* test fixture.
*/
protected void tearDown() {
@@ -140,8 +140,8 @@ public class XSAttributeGroupAnnotationsTest extends
TestCase {
* Test #4.
*/
public void testAnnotations() {
- XSModel model = fSchemaLoader
-
.loadURI(getResourceURL("XSAttributeGroupAnnotationsTest02.xsd"));
+ String resourceURL =
getResourceURL("XSAttributeGroupAnnotationsTest02.xsd");
+ XSModel model = fSchemaLoader.loadURI(resourceURL);
XSAttributeGroupDefinition AG = model.getAttributeGroup("AG",
"XSAttributeGroupAnnotationsTest");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]