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 396e51cd5 Migrate StreamSourceToOMResultTest to the new matrix test 
framework
396e51cd5 is described below

commit 396e51cd5e7f7187a29ec3a48195522504b5aee1
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Sun Mar 8 23:11:03 2026 +0000

    Migrate StreamSourceToOMResultTest to the new matrix test framework
---
 axiom-compat/pom.xml                               | 16 ++++
 .../om/impl/jaxp/StreamSourceToOMResultTest.java   | 92 +++++++---------------
 ...st.java => StreamSourceToOMResultTestCase.java} | 49 +++---------
 3 files changed, 56 insertions(+), 101 deletions(-)

diff --git a/axiom-compat/pom.xml b/axiom-compat/pom.xml
index 9959c67e1..ae46067aa 100644
--- a/axiom-compat/pom.xml
+++ b/axiom-compat/pom.xml
@@ -70,6 +70,22 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>multiton</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>xml-testsuite</artifactId>
diff --git 
a/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
 
b/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
index f23877ab3..daccbb051 100644
--- 
a/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
+++ 
b/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
@@ -18,73 +18,35 @@
  */
 package org.apache.axiom.om.impl.jaxp;
 
-import static com.google.common.truth.Truth.assertAbout;
-import static org.apache.axiom.truth.xml.XMLTruth.xml;
+import java.util.stream.Stream;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.Iterator;
-
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.TestSuite;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.testing.multiton.Multiton;
-import org.apache.axiom.testutils.suite.MatrixTestCase;
-import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
-import org.apache.axiom.ts.jaxp.xslt.XSLTImplementation;
+import org.apache.axiom.testutils.suite.MatrixTest;
+import com.google.common.collect.ImmutableList;
+import org.apache.axiom.testutils.suite.MatrixTestFilters;
+import org.apache.axiom.testutils.suite.ParameterFanOutNode;
 import org.apache.axiom.ts.xml.XMLSample;
-import org.xml.sax.InputSource;
-
-@SuppressWarnings({"rawtypes", "deprecation"})
-public class StreamSourceToOMResultTest extends MatrixTestCase {
-    private static final String[] axiomImplementations = {"default", "dom"};
-
-    private final OMMetaFactory omMetaFactory;
-    private final XMLSample file;
-
-    private StreamSourceToOMResultTest(String axiomImplementation, XMLSample 
file) {
-        omMetaFactory = OMAbstractFactory.getMetaFactory(axiomImplementation);
-        this.file = file;
-        addTestParameter("axiomImplementation", axiomImplementation);
-        addTestParameter("file", file.getName());
-    }
-
-    @Override
-    protected void runTest() throws Throwable {
-        StreamSource source = new StreamSource(file.getUrl().toString());
-        OMResult result = new OMResult(omMetaFactory.getOMFactory());
-        
XSLTImplementation.XALAN.newTransformerFactory().newTransformer().transform(source,
 result);
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        result.getDocument().serialize(out);
-        InputSource actual = new InputSource();
-        actual.setByteStream(new ByteArrayInputStream(out.toByteArray()));
-        actual.setSystemId(file.getUrl().toString());
-        assertAbout(xml())
-                .that(actual)
-                .ignoringWhitespaceInPrologAndEpilog()
-                .expandingEntityReferences()
-                .hasSameContentAs(file.getUrl());
-    }
-
-    public static TestSuite suite() {
-        MatrixTestSuiteBuilder builder =
-                new MatrixTestSuiteBuilder() {
-                    @Override
-                    protected void addTests() {
-                        for (int i = 0; i < axiomImplementations.length; i++) {
-                            for (Iterator it = 
Multiton.getInstances(XMLSample.class).iterator();
-                                    it.hasNext(); ) {
-                                addTest(
-                                        new StreamSourceToOMResultTest(
-                                                axiomImplementations[i], 
(XMLSample) it.next()));
-                            }
-                        }
-                    }
-                };
-        
builder.exclude("(|(file=sax-attribute-namespace-bug.xml)(file=large.xml))");
-        return builder.build();
+import org.junit.jupiter.api.DynamicNode;
+import org.junit.jupiter.api.TestFactory;
+
+public class StreamSourceToOMResultTest {
+    @TestFactory
+    public Stream<DynamicNode> tests() {
+        MatrixTestFilters excludes =
+                MatrixTestFilters.builder()
+                        
.add("(|(file=sax-attribute-namespace-bug.xml)(file=large.xml))")
+                        .build();
+        return new ParameterFanOutNode<>(
+                        String.class,
+                        ImmutableList.of("default", "dom"),
+                        "axiomImplementation",
+                        s -> s,
+                        new ParameterFanOutNode<>(
+                                XMLSample.class,
+                                Multiton.getInstances(XMLSample.class),
+                                "file",
+                                XMLSample::getName,
+                                new 
MatrixTest(StreamSourceToOMResultTestCase.class)))
+                .toDynamicNodes(excludes);
     }
 }
diff --git 
a/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
 
b/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java
similarity index 55%
copy from 
axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
copy to 
axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java
index f23877ab3..46e9f6779 100644
--- 
a/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTest.java
+++ 
b/axiom-compat/src/test/java/org/apache/axiom/om/impl/jaxp/StreamSourceToOMResultTestCase.java
@@ -23,37 +23,33 @@ import static org.apache.axiom.truth.xml.XMLTruth.xml;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.util.Iterator;
 
 import javax.xml.transform.stream.StreamSource;
 
-import junit.framework.TestSuite;
-
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMMetaFactory;
-import org.apache.axiom.testing.multiton.Multiton;
-import org.apache.axiom.testutils.suite.MatrixTestCase;
-import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
 import org.apache.axiom.ts.jaxp.xslt.XSLTImplementation;
 import org.apache.axiom.ts.xml.XMLSample;
 import org.xml.sax.InputSource;
 
-@SuppressWarnings({"rawtypes", "deprecation"})
-public class StreamSourceToOMResultTest extends MatrixTestCase {
-    private static final String[] axiomImplementations = {"default", "dom"};
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
 
-    private final OMMetaFactory omMetaFactory;
-    private final XMLSample file;
+import junit.framework.TestCase;
 
-    private StreamSourceToOMResultTest(String axiomImplementation, XMLSample 
file) {
-        omMetaFactory = OMAbstractFactory.getMetaFactory(axiomImplementation);
-        this.file = file;
-        addTestParameter("axiomImplementation", axiomImplementation);
-        addTestParameter("file", file.getName());
-    }
+public class StreamSourceToOMResultTestCase extends TestCase {
+    @Inject
+    @Named("axiomImplementation")
+    private String axiomImplementation;
+
+    @Inject
+    @Named("file")
+    private XMLSample file;
 
     @Override
+    @SuppressWarnings({"deprecation"})
     protected void runTest() throws Throwable {
+        OMMetaFactory omMetaFactory = 
OMAbstractFactory.getMetaFactory(axiomImplementation);
         StreamSource source = new StreamSource(file.getUrl().toString());
         OMResult result = new OMResult(omMetaFactory.getOMFactory());
         
XSLTImplementation.XALAN.newTransformerFactory().newTransformer().transform(source,
 result);
@@ -68,23 +64,4 @@ public class StreamSourceToOMResultTest extends 
MatrixTestCase {
                 .expandingEntityReferences()
                 .hasSameContentAs(file.getUrl());
     }
-
-    public static TestSuite suite() {
-        MatrixTestSuiteBuilder builder =
-                new MatrixTestSuiteBuilder() {
-                    @Override
-                    protected void addTests() {
-                        for (int i = 0; i < axiomImplementations.length; i++) {
-                            for (Iterator it = 
Multiton.getInstances(XMLSample.class).iterator();
-                                    it.hasNext(); ) {
-                                addTest(
-                                        new StreamSourceToOMResultTest(
-                                                axiomImplementations[i], 
(XMLSample) it.next()));
-                            }
-                        }
-                    }
-                };
-        
builder.exclude("(|(file=sax-attribute-namespace-bug.xml)(file=large.xml))");
-        return builder.build();
-    }
 }

Reply via email to