This is an automated email from the ASF dual-hosted git repository.
veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-axiom.git
The following commit(s) were added to refs/heads/master by this push:
new 1dacf5124 Extract TestParserConfiguration into a standalone singleton
1dacf5124 is described below
commit 1dacf51244a5603aff96f03bbac2c9c902845ba1
Author: Copilot <[email protected]>
AuthorDate: Sun May 17 11:25:44 2026 +0100
Extract TestParserConfiguration into a standalone singleton
Co-authored-by: Andreas Veithen-Knowles <[email protected]>
---
.../java/org/apache/axiom/ts/AxiomTestCase.java | 18 -------------
...mTestCase.java => TestParserConfiguration.java} | 30 +++++++++-------------
.../apache/axiom/ts/dimension/BuilderFactory.java | 5 ++--
.../org/apache/axiom/ts/om/XMLSampleAdapter.java | 4 +--
.../ts/om/container/TestGetXMLStreamReader.java | 3 ++-
.../soap11/faultreason/TestGetTextWithCDATA.java | 4 +--
6 files changed, 20 insertions(+), 44 deletions(-)
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
index cf591ca63..fce66a465 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
@@ -18,27 +18,9 @@
*/
package org.apache.axiom.ts;
-import javax.xml.stream.XMLInputFactory;
import junit.framework.TestCase;
-import org.apache.axiom.om.util.StAXParserConfiguration;
-import org.apache.axiom.util.stax.dialect.StAXDialect;
public abstract class AxiomTestCase extends TestCase {
- public static final StAXParserConfiguration TEST_PARSER_CONFIGURATION =
new StAXParserConfiguration() {
- @Override
- public XMLInputFactory configure(XMLInputFactory factory, StAXDialect
dialect) {
- // For the tests, preserve as much of the syntactic structure of
the test
- // documents
-
factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
Boolean.FALSE);
- return dialect.enableCDataReporting(factory);
- }
-
- @Override
- public String toString() {
- return "TEST";
- }
- };
-
public AxiomTestCase() {
setName(getClass().getName());
}
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/TestParserConfiguration.java
similarity index 55%
copy from
testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
copy to
testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/TestParserConfiguration.java
index cf591ca63..3ceab849d 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestCase.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/TestParserConfiguration.java
@@ -19,30 +19,24 @@
package org.apache.axiom.ts;
import javax.xml.stream.XMLInputFactory;
-import junit.framework.TestCase;
import org.apache.axiom.om.util.StAXParserConfiguration;
import org.apache.axiom.util.stax.dialect.StAXDialect;
-public abstract class AxiomTestCase extends TestCase {
- public static final StAXParserConfiguration TEST_PARSER_CONFIGURATION =
new StAXParserConfiguration() {
- @Override
- public XMLInputFactory configure(XMLInputFactory factory, StAXDialect
dialect) {
- // For the tests, preserve as much of the syntactic structure of
the test
- // documents
-
factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
Boolean.FALSE);
- return dialect.enableCDataReporting(factory);
- }
+public final class TestParserConfiguration implements StAXParserConfiguration {
+ public static final TestParserConfiguration INSTANCE = new
TestParserConfiguration();
- @Override
- public String toString() {
- return "TEST";
- }
- };
+ private TestParserConfiguration() {}
- public AxiomTestCase() {
- setName(getClass().getName());
+ @Override
+ public XMLInputFactory configure(XMLInputFactory factory, StAXDialect
dialect) {
+ // For the tests, preserve as much of the syntactic structure of the
test
+ // documents
+ factory.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
Boolean.FALSE);
+ return dialect.enableCDataReporting(factory);
}
@Override
- protected abstract void runTest() throws Throwable;
+ public String toString() {
+ return "TEST";
+ }
}
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/dimension/BuilderFactory.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/dimension/BuilderFactory.java
index ae4a6b04e..f63ec4b13 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/dimension/BuilderFactory.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/dimension/BuilderFactory.java
@@ -28,7 +28,7 @@ import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.stax.XMLStreamReaderComparator;
import org.apache.axiom.testutils.suite.Dimension;
import org.apache.axiom.testutils.suite.LabelTarget;
-import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.ts.TestParserConfiguration;
import org.apache.axiom.ts.jaxp.dom.DOMImplementation;
import org.apache.axiom.ts.jaxp.sax.SAXImplementation;
import org.xml.sax.InputSource;
@@ -55,8 +55,7 @@ public abstract class BuilderFactory extends Multiton
implements Dimension {
@Override
public OMXMLParserWrapper getBuilder(OMMetaFactory metaFactory,
InputSource inputSource) throws Exception {
- return ((OMMetaFactorySPI) metaFactory)
- .createOMBuilder(AxiomTestCase.TEST_PARSER_CONFIGURATION,
inputSource);
+ return ((OMMetaFactorySPI)
metaFactory).createOMBuilder(TestParserConfiguration.INSTANCE, inputSource);
}
};
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/XMLSampleAdapter.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/XMLSampleAdapter.java
index e9d6ce80b..450303c1b 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/XMLSampleAdapter.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/XMLSampleAdapter.java
@@ -24,7 +24,7 @@ import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMMetaFactorySPI;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.testing.multiton.AdapterType;
-import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.ts.TestParserConfiguration;
import org.apache.axiom.ts.xml.XMLSample;
import org.xml.sax.InputSource;
@@ -39,7 +39,7 @@ public final class XMLSampleAdapter {
public OMXMLParserWrapper getBuilder(OMMetaFactory metaFactory) {
return ((OMMetaFactorySPI) metaFactory)
.createOMBuilder(
- AxiomTestCase.TEST_PARSER_CONFIGURATION,
+ TestParserConfiguration.INSTANCE,
new InputSource(sample.getUrl().toString()));
}
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
index 939ed78e4..c460f558e 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetXMLStreamReader.java
@@ -28,6 +28,7 @@ import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.testutils.stax.XMLStreamReaderComparator;
import org.apache.axiom.ts.ConformanceTestCase;
+import org.apache.axiom.ts.TestParserConfiguration;
import org.apache.axiom.ts.dimension.BuilderFactory;
import org.apache.axiom.ts.xml.XMLSample;
import org.xml.sax.InputSource;
@@ -61,7 +62,7 @@ public class TestGetXMLStreamReader extends
ConformanceTestCase {
InputStream in = file.getInputStream();
try {
XMLStreamReader expected = StAXUtils.createXMLStreamReader(
- TEST_PARSER_CONFIGURATION, file.getUrl().toString(), in);
+ TestParserConfiguration.INSTANCE,
file.getUrl().toString(), in);
try {
OMXMLParserWrapper builder = builderFactory.getBuilder(
metaFactory, new
InputSource(file.getUrl().toString()));
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
index 374733b24..c645e59c5 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
@@ -32,7 +32,7 @@ import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.soap.SOAPFaultReason;
import org.apache.axiom.soap.SOAPModelBuilder;
-import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.ts.TestParserConfiguration;
public class TestGetTextWithCDATA extends TestCase {
@Inject
@@ -54,7 +54,7 @@ public class TestGetTextWithCDATA extends TestCase {
+ "</SOAP-ENV:Body>"
+ "</SOAP-ENV:Envelope>";
XMLStreamReader soap11Parser =
-
StAXUtils.createXMLStreamReader(AxiomTestCase.TEST_PARSER_CONFIGURATION, new
StringReader(soap11Fault));
+
StAXUtils.createXMLStreamReader(TestParserConfiguration.INSTANCE, new
StringReader(soap11Fault));
SOAPModelBuilder soap11Builder =
OMXMLBuilderFactory.createStAXSOAPModelBuilder(metaFactory, soap11Parser);
OMElement element = soap11Builder.getDocumentElement();
element.build();