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 10d76bd94 Introduce MatrixTestNode/MatrixTestSuite framework and 
refactor saaj-testsuite
10d76bd94 is described below

commit 10d76bd948a84a4973c473b8105da0782f704d1c
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Sun Mar 1 07:20:41 2026 +0000

    Introduce MatrixTestNode/MatrixTestSuite framework and refactor 
saaj-testsuite
    
    Add a new JUnit 5 / Guice based test suite infrastructure to the
    matrix-testsuite module:
    - MatrixTestNode: base class for filterable test tree nodes
    - AbstractFanOutNode: creates child Guice injectors per dimension value
    - DimensionFanOutNode: fan-out for Dimension types
    - ParameterFanOutNode: fan-out for arbitrary types with name/function
    - MatrixTest: leaf node that instantiates TestCase via Guice
    - MatrixTestSuite: root suite owning the Guice root injector
    
    Refactor saaj-testsuite to use the new framework:
    - SAAJTestCase now uses @Inject fields instead of constructor parameters
    - Test case classes no longer take constructor arguments
    - SAAJTestSuite replaces SAAJTestSuiteBuilder
    - SAAJRITest uses JUnit 5 @TestFactory instead of JUnit 3 suite()
---
 pom.xml                                            |   5 +
 testing/matrix-testsuite/pom.xml                   |   8 ++
 .../axiom/testutils/suite/AbstractFanOutNode.java  | 113 +++++++++++++++++++++
 .../axiom/testutils/suite/DimensionFanOutNode.java |  61 +++++++++++
 .../apache/axiom/testutils/suite/MatrixTest.java   |  66 ++++++++++++
 .../axiom/testutils/suite/MatrixTestNode.java}     |  27 +++--
 .../axiom/testutils/suite/MatrixTestSuite.java     |  57 +++++++++++
 .../axiom/testutils/suite/ParameterFanOutNode.java |  50 +++++++++
 testing/saaj-testsuite/pom.xml                     |  13 +++
 .../org/apache/axiom/ts/saaj/SAAJTestCase.java     |  15 ++-
 .../org/apache/axiom/ts/saaj/SAAJTestSuite.java    |  65 ++++++++++++
 .../apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java |  53 ----------
 .../saaj/body/TestAddChildElementReification.java  |   6 --
 .../saaj/element/TestAddChildElementLocalName.java |   6 --
 .../TestAddChildElementLocalNamePrefixAndURI.java  |   7 --
 .../ts/saaj/element/TestGetOwnerDocument.java      |   6 --
 .../ts/saaj/element/TestSetParentElement.java      |   6 --
 .../TestExamineMustUnderstandHeaderElements.java   |   7 --
 .../java/org/apache/axiom/ts/saaj/SAAJRITest.java  |  17 ++--
 19 files changed, 474 insertions(+), 114 deletions(-)

diff --git a/pom.xml b/pom.xml
index 4e3b6af20..00d234198 100644
--- a/pom.xml
+++ b/pom.xml
@@ -547,6 +547,11 @@
                 <artifactId>jaxws-rt</artifactId>
                 <version>${jaxws-rt.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.google.inject</groupId>
+                <artifactId>guice</artifactId>
+                <version>7.0.0</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
diff --git a/testing/matrix-testsuite/pom.xml b/testing/matrix-testsuite/pom.xml
index 60b3473bb..384b97883 100644
--- a/testing/matrix-testsuite/pom.xml
+++ b/testing/matrix-testsuite/pom.xml
@@ -39,6 +39,14 @@
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
         <dependency><!-- We use this only for LDAP like filters -->
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.framework</artifactId>
diff --git 
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
new file mode 100644
index 000000000..2843a8c0c
--- /dev/null
+++ 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.testutils.suite;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.DynamicContainer;
+import org.junit.jupiter.api.DynamicNode;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Injector;
+
+/**
+ * Abstract base class for fan-out nodes that iterate over a list of values, 
creating one {@link
+ * DynamicContainer} per value. For each value, a child Guice injector is 
created that binds the
+ * value type to the specific instance.
+ *
+ * <p>Subclasses define how test parameters (used for display names and LDAP 
filter matching) are
+ * extracted from each value:
+ *
+ * <ul>
+ *   <li>{@link DimensionFanOutNode} — for types that implement {@link 
Dimension}, using {@link
+ *       Dimension#addTestParameters}.
+ *   <li>{@link ParameterFanOutNode} — for arbitrary types, using a 
caller-supplied parameter name
+ *       and {@link java.util.function.Function}.
+ * </ul>
+ *
+ * @param <T> the value type
+ */
+public abstract class AbstractFanOutNode<T> extends MatrixTestNode {
+    private final Class<T> type;
+    private final List<T> values;
+    private final List<MatrixTestNode> children = new ArrayList<>();
+
+    protected AbstractFanOutNode(Class<T> type, List<T> values) {
+        this.type = type;
+        this.values = values;
+    }
+
+    public void addChild(MatrixTestNode child) {
+        children.add(child);
+    }
+
+    /**
+     * Extracts test parameters from the given value. The returned map entries 
are used for the
+     * display name and for LDAP filter matching.
+     */
+    protected abstract Map<String, String> extractParameters(T value);
+
+    @Override
+    Stream<DynamicNode> toDynamicNodes(
+            Injector parentInjector,
+            Dictionary<String, String> inheritedParameters,
+            MatrixTestFilters excludes) {
+        return values.stream()
+                .map(
+                        value -> {
+                            Injector childInjector =
+                                    parentInjector.createChildInjector(
+                                            new AbstractModule() {
+                                                @Override
+                                                protected void configure() {
+                                                    
bind(type).toInstance(value);
+                                                }
+                                            });
+
+                            Map<String, String> parameters = 
extractParameters(value);
+                            Hashtable<String, String> params = new 
Hashtable<>();
+                            for (Enumeration<String> e = 
inheritedParameters.keys();
+                                    e.hasMoreElements(); ) {
+                                String key = e.nextElement();
+                                params.put(key, inheritedParameters.get(key));
+                            }
+                            parameters.forEach(params::put);
+                            String displayName =
+                                    parameters.entrySet().stream()
+                                            .map(e -> e.getKey() + "=" + 
e.getValue())
+                                            .collect(Collectors.joining(", "));
+                            return DynamicContainer.dynamicContainer(
+                                    displayName,
+                                    children.stream()
+                                            .flatMap(
+                                                    child ->
+                                                            
child.toDynamicNodes(
+                                                                    
childInjector,
+                                                                    params,
+                                                                    
excludes)));
+                        });
+    }
+}
diff --git 
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/DimensionFanOutNode.java
 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/DimensionFanOutNode.java
new file mode 100644
index 000000000..e64a80aa2
--- /dev/null
+++ 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/DimensionFanOutNode.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.testutils.suite;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Fan-out node for types that implement {@link Dimension}. Parameters are 
extracted via {@link
+ * Dimension#addTestParameters}.
+ *
+ * <p>For types that do <em>not</em> implement {@code Dimension}, use {@link 
ParameterFanOutNode}
+ * instead.
+ *
+ * @param <D> the dimension type
+ */
+public class DimensionFanOutNode<D extends Dimension> extends 
AbstractFanOutNode<D> {
+    public DimensionFanOutNode(Class<D> dimensionType, List<D> dimensions) {
+        super(dimensionType, dimensions);
+    }
+
+    @Override
+    protected Map<String, String> extractParameters(D dimension) {
+        Map<String, String> parameters = new LinkedHashMap<>();
+        dimension.addTestParameters(
+                new TestParameterTarget() {
+                    @Override
+                    public void addTestParameter(String name, String value) {
+                        parameters.put(name, value);
+                    }
+
+                    @Override
+                    public void addTestParameter(String name, boolean value) {
+                        addTestParameter(name, String.valueOf(value));
+                    }
+
+                    @Override
+                    public void addTestParameter(String name, int value) {
+                        addTestParameter(name, String.valueOf(value));
+                    }
+                });
+        return parameters;
+    }
+}
diff --git 
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTest.java
 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTest.java
new file mode 100644
index 000000000..0356c1a78
--- /dev/null
+++ 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.testutils.suite;
+
+import java.util.Dictionary;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.DynamicNode;
+import org.junit.jupiter.api.DynamicTest;
+
+import com.google.inject.Injector;
+
+import junit.framework.TestCase;
+
+/**
+ * A leaf node that instantiates a {@link TestCase} subclass via Guice and 
executes it.
+ *
+ * <p>The test class must have an injectable constructor (either a no-arg 
constructor or one
+ * annotated with {@code @Inject}). Field injection is also supported. The 
injector received from
+ * the ancestor {@link AbstractFanOutNode} chain will have bindings for all 
dimension types, plus
+ * any implementation-level bindings from the root injector.
+ *
+ * <p>Once the instance is created, it is executed via {@link 
TestCase#runBare()}, which invokes the
+ * full {@code setUp()} → {@code runTest()} → {@code tearDown()} lifecycle.
+ */
+public class MatrixTest extends MatrixTestNode {
+    private final Class<? extends TestCase> testClass;
+
+    public MatrixTest(Class<? extends TestCase> testClass) {
+        this.testClass = testClass;
+    }
+
+    @Override
+    Stream<DynamicNode> toDynamicNodes(
+            Injector injector,
+            Dictionary<String, String> inheritedParameters,
+            MatrixTestFilters excludes) {
+        if (excludes.test(testClass, inheritedParameters)) {
+            return Stream.empty();
+        }
+        return Stream.of(
+                DynamicTest.dynamicTest(
+                        testClass.getSimpleName(),
+                        () -> {
+                            TestCase testInstance = 
injector.getInstance(testClass);
+                            testInstance.setName(testClass.getSimpleName());
+                            testInstance.runBare();
+                        }));
+    }
+}
diff --git 
a/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
similarity index 50%
copy from 
testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
copy to 
testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
index e0f851c47..b306f66ec 100644
--- 
a/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
+++ 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
@@ -16,15 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.axiom.ts.saaj;
+package org.apache.axiom.testutils.suite;
 
-import com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl;
+import java.util.Dictionary;
+import java.util.stream.Stream;
 
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.jupiter.api.DynamicNode;
 
-public class SAAJRITest extends TestCase {
-    public static TestSuite suite() throws Exception {
-        return new SAAJTestSuiteBuilder(new SAAJMetaFactoryImpl()).build();
-    }
+import com.google.inject.Injector;
+
+/**
+ * Represents a node in the test tree that can be filtered before conversion 
to JUnit 5's dynamic
+ * test API.
+ *
+ * <p>The {@code parentInjector} parameter threads through the tree: each 
fan-out node ({@link
+ * DimensionFanOutNode}, {@link ParameterFanOutNode}) creates child injectors 
from it, and each
+ * {@link MatrixTest} uses it to instantiate the test class.
+ */
+public abstract class MatrixTestNode {
+    abstract Stream<DynamicNode> toDynamicNodes(
+            Injector parentInjector,
+            Dictionary<String, String> inheritedParameters,
+            MatrixTestFilters excludes);
 }
diff --git 
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestSuite.java
 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestSuite.java
new file mode 100644
index 000000000..4eb896001
--- /dev/null
+++ 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestSuite.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.testutils.suite;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.DynamicNode;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+/**
+ * Root of a test suite. Owns the Guice root injector and the tree of {@link 
MatrixTestNode}
+ * instances. Provides a {@link #toDynamicNodes(MatrixTestFilters)} method 
that converts the tree to
+ * JUnit 5 dynamic nodes, applying the supplied exclusion filters.
+ *
+ * <p>Exclusion filters are <em>not</em> owned by the suite itself because 
they are specific to each
+ * consumer (implementation under test), whereas the suite structure and 
bindings are defined by the
+ * test suite author.
+ */
+public class MatrixTestSuite {
+    private final Injector rootInjector;
+    private final List<MatrixTestNode> children = new ArrayList<>();
+
+    public MatrixTestSuite(Module... modules) {
+        this.rootInjector = Guice.createInjector(modules);
+    }
+
+    public void addChild(MatrixTestNode child) {
+        children.add(child);
+    }
+
+    public Stream<DynamicNode> toDynamicNodes(MatrixTestFilters excludes) {
+        return children.stream()
+                .flatMap(child -> child.toDynamicNodes(rootInjector, new 
Hashtable<>(), excludes));
+    }
+}
diff --git 
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/ParameterFanOutNode.java
 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/ParameterFanOutNode.java
new file mode 100644
index 000000000..9999ac9c3
--- /dev/null
+++ 
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/ParameterFanOutNode.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.testutils.suite;
+
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+
+/**
+ * Fan-out node for arbitrary value types that do not implement {@link 
Dimension}. The caller
+ * supplies a parameter name and a {@link Function} that maps each value to 
its parameter value
+ * (used for display names and LDAP filter matching).
+ *
+ * @param <T> the value type
+ */
+public class ParameterFanOutNode<T> extends AbstractFanOutNode<T> {
+    private final String parameterName;
+    private final Function<T, String> parameterValueFunction;
+
+    public ParameterFanOutNode(
+            Class<T> type,
+            List<T> values,
+            String parameterName,
+            Function<T, String> parameterValueFunction) {
+        super(type, values);
+        this.parameterName = parameterName;
+        this.parameterValueFunction = parameterValueFunction;
+    }
+
+    @Override
+    protected Map<String, String> extractParameters(T value) {
+        return Map.of(parameterName, parameterValueFunction.apply(value));
+    }
+}
diff --git a/testing/saaj-testsuite/pom.xml b/testing/saaj-testsuite/pom.xml
index bae42917f..1ed5444bf 100644
--- a/testing/saaj-testsuite/pom.xml
+++ b/testing/saaj-testsuite/pom.xml
@@ -57,6 +57,11 @@
             <artifactId>matrix-testsuite</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>multiton</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>soap-testsuite</artifactId>
@@ -71,6 +76,14 @@
             <artifactId>auto-service-annotations</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.sun.xml.messaging.saaj</groupId>
             <artifactId>saaj-impl</artifactId>
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
index c0c732c3d..190bbcdd1 100644
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestCase.java
@@ -22,18 +22,15 @@ import jakarta.xml.soap.MessageFactory;
 import jakarta.xml.soap.SOAPException;
 import jakarta.xml.soap.SOAPFactory;
 
-import org.apache.axiom.testutils.suite.MatrixTestCase;
 import org.apache.axiom.ts.soap.SOAPSpec;
 
-public abstract class SAAJTestCase extends MatrixTestCase {
-    protected final SAAJImplementation saajImplementation;
-    protected final SOAPSpec spec;
+import com.google.inject.Inject;
 
-    public SAAJTestCase(SAAJImplementation saajImplementation, SOAPSpec spec) {
-        this.saajImplementation = saajImplementation;
-        this.spec = spec;
-        addTestParameter("spec", spec.getName());
-    }
+import junit.framework.TestCase;
+
+public abstract class SAAJTestCase extends TestCase {
+    @Inject protected SAAJImplementation saajImplementation;
+    @Inject protected SOAPSpec spec;
 
     protected final MessageFactory newMessageFactory() throws SOAPException {
         return 
spec.getAdapter(FactorySelector.class).newMessageFactory(saajImplementation);
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuite.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuite.java
new file mode 100644
index 000000000..962ea365e
--- /dev/null
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuite.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.saaj;
+
+import jakarta.xml.soap.SAAJMetaFactory;
+
+import org.apache.axiom.testing.multiton.Multiton;
+import org.apache.axiom.testutils.suite.MatrixTest;
+import org.apache.axiom.testutils.suite.MatrixTestSuite;
+import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.ts.saaj.body.TestAddChildElementReification;
+import org.apache.axiom.ts.saaj.element.TestAddChildElementLocalName;
+import 
org.apache.axiom.ts.saaj.element.TestAddChildElementLocalNamePrefixAndURI;
+import org.apache.axiom.ts.saaj.element.TestGetOwnerDocument;
+import org.apache.axiom.ts.saaj.element.TestSetParentElement;
+import org.apache.axiom.ts.saaj.header.TestExamineMustUnderstandHeaderElements;
+import org.apache.axiom.ts.soap.SOAPSpec;
+
+import com.google.inject.AbstractModule;
+
+public class SAAJTestSuite {
+    public static MatrixTestSuite create(SAAJMetaFactory metaFactory) {
+        SAAJImplementation impl = new SAAJImplementation(metaFactory);
+        MatrixTestSuite suite =
+                new MatrixTestSuite(
+                        new AbstractModule() {
+                            @Override
+                            protected void configure() {
+                                
bind(SAAJImplementation.class).toInstance(impl);
+                            }
+                        });
+
+        ParameterFanOutNode<SOAPSpec> specs =
+                new ParameterFanOutNode<>(
+                        SOAPSpec.class,
+                        Multiton.getInstances(SOAPSpec.class),
+                        "spec",
+                        SOAPSpec::getName);
+        specs.addChild(new MatrixTest(TestAddChildElementReification.class));
+        specs.addChild(new 
MatrixTest(TestExamineMustUnderstandHeaderElements.class));
+        specs.addChild(new MatrixTest(TestAddChildElementLocalName.class));
+        specs.addChild(new 
MatrixTest(TestAddChildElementLocalNamePrefixAndURI.class));
+        specs.addChild(new MatrixTest(TestSetParentElement.class));
+        specs.addChild(new MatrixTest(TestGetOwnerDocument.class));
+        suite.addChild(specs);
+
+        return suite;
+    }
+}
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
deleted file mode 100644
index a3b77bf8e..000000000
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuiteBuilder.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axiom.ts.saaj;
-
-import jakarta.xml.soap.SAAJMetaFactory;
-
-import org.apache.axiom.testutils.suite.MatrixTestSuiteBuilder;
-import org.apache.axiom.ts.saaj.body.TestAddChildElementReification;
-import org.apache.axiom.ts.saaj.element.TestAddChildElementLocalName;
-import 
org.apache.axiom.ts.saaj.element.TestAddChildElementLocalNamePrefixAndURI;
-import org.apache.axiom.ts.saaj.element.TestGetOwnerDocument;
-import org.apache.axiom.ts.saaj.element.TestSetParentElement;
-import org.apache.axiom.ts.saaj.header.TestExamineMustUnderstandHeaderElements;
-import org.apache.axiom.ts.soap.SOAPSpec;
-
-public class SAAJTestSuiteBuilder extends MatrixTestSuiteBuilder {
-    private final SAAJImplementation saajImplementation;
-
-    public SAAJTestSuiteBuilder(SAAJMetaFactory metaFactory) {
-        saajImplementation = new SAAJImplementation(metaFactory);
-    }
-
-    @Override
-    protected void addTests() {
-        addTests(SOAPSpec.SOAP11);
-        addTests(SOAPSpec.SOAP12);
-    }
-
-    private void addTests(SOAPSpec spec) {
-        addTest(new 
TestExamineMustUnderstandHeaderElements(saajImplementation, spec));
-        addTest(new TestAddChildElementLocalName(saajImplementation, spec));
-        addTest(new 
TestAddChildElementLocalNamePrefixAndURI(saajImplementation, spec));
-        addTest(new TestSetParentElement(saajImplementation, spec));
-        addTest(new TestGetOwnerDocument(saajImplementation, spec));
-        addTest(new TestAddChildElementReification(saajImplementation, spec));
-    }
-}
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/body/TestAddChildElementReification.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/body/TestAddChildElementReification.java
index 8687defaa..7e3f4a8ca 100644
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/body/TestAddChildElementReification.java
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/body/TestAddChildElementReification.java
@@ -24,15 +24,9 @@ import jakarta.xml.soap.SOAPBody;
 import jakarta.xml.soap.SOAPBodyElement;
 import jakarta.xml.soap.SOAPElement;
 
-import org.apache.axiom.ts.saaj.SAAJImplementation;
 import org.apache.axiom.ts.saaj.SAAJTestCase;
-import org.apache.axiom.ts.soap.SOAPSpec;
 
 public class TestAddChildElementReification extends SAAJTestCase {
-    public TestAddChildElementReification(SAAJImplementation 
saajImplementation, SOAPSpec spec) {
-        super(saajImplementation, spec);
-    }
-
     @Override
     protected void runTest() throws Throwable {
         SOAPBody body = newMessageFactory().createMessage().getSOAPBody();
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalName.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalName.java
index e45efddfc..b3f47b882 100644
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalName.java
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalName.java
@@ -22,16 +22,10 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import jakarta.xml.soap.SOAPElement;
 
-import org.apache.axiom.ts.saaj.SAAJImplementation;
 import org.apache.axiom.ts.saaj.SAAJTestCase;
-import org.apache.axiom.ts.soap.SOAPSpec;
 
 /** Tests the behavior of {@link SOAPElement#addChildElement(String)}. */
 public class TestAddChildElementLocalName extends SAAJTestCase {
-    public TestAddChildElementLocalName(SAAJImplementation saajImplementation, 
SOAPSpec spec) {
-        super(saajImplementation, spec);
-    }
-
     @Override
     protected void runTest() throws Throwable {
         SOAPElement root = newSOAPFactory().createElement("root", "p", 
"urn:test");
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalNamePrefixAndURI.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalNamePrefixAndURI.java
index b898dcbc9..218d862e4 100644
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalNamePrefixAndURI.java
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalNamePrefixAndURI.java
@@ -23,19 +23,12 @@ import static org.assertj.core.api.Assertions.assertThat;
 import javax.xml.XMLConstants;
 import jakarta.xml.soap.SOAPElement;
 
-import org.apache.axiom.ts.saaj.SAAJImplementation;
 import org.apache.axiom.ts.saaj.SAAJTestCase;
-import org.apache.axiom.ts.soap.SOAPSpec;
 import org.w3c.dom.Attr;
 import org.w3c.dom.NamedNodeMap;
 
 /** Tests the behavior of {@link SOAPElement#addChildElement(String, String, 
String)}. */
 public class TestAddChildElementLocalNamePrefixAndURI extends SAAJTestCase {
-    public TestAddChildElementLocalNamePrefixAndURI(
-            SAAJImplementation saajImplementation, SOAPSpec spec) {
-        super(saajImplementation, spec);
-    }
-
     @Override
     protected void runTest() throws Throwable {
         SOAPElement root = newSOAPFactory().createElement("root", "ns1", 
"urn:ns1");
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestGetOwnerDocument.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestGetOwnerDocument.java
index 3f5b8a8c4..bc3ff4c7a 100644
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestGetOwnerDocument.java
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestGetOwnerDocument.java
@@ -24,9 +24,7 @@ import javax.xml.namespace.QName;
 import jakarta.xml.soap.SOAPElement;
 import jakarta.xml.soap.SOAPPart;
 
-import org.apache.axiom.ts.saaj.SAAJImplementation;
 import org.apache.axiom.ts.saaj.SAAJTestCase;
-import org.apache.axiom.ts.soap.SOAPSpec;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
@@ -35,10 +33,6 @@ import org.w3c.dom.Node;
  * SOAPElement} as well as the properties of the returned document.
  */
 public class TestGetOwnerDocument extends SAAJTestCase {
-    public TestGetOwnerDocument(SAAJImplementation saajImplementation, 
SOAPSpec spec) {
-        super(saajImplementation, spec);
-    }
-
     @Override
     protected void runTest() throws Throwable {
         Document doc = newSOAPFactory().createElement(new 
QName("test")).getOwnerDocument();
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestSetParentElement.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestSetParentElement.java
index 44d9899a0..3e57a33e6 100644
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestSetParentElement.java
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestSetParentElement.java
@@ -23,16 +23,10 @@ import static org.assertj.core.api.Assertions.assertThat;
 import javax.xml.namespace.QName;
 import jakarta.xml.soap.SOAPElement;
 
-import org.apache.axiom.ts.saaj.SAAJImplementation;
 import org.apache.axiom.ts.saaj.SAAJTestCase;
-import org.apache.axiom.ts.soap.SOAPSpec;
 import org.w3c.dom.NodeList;
 
 public class TestSetParentElement extends SAAJTestCase {
-    public TestSetParentElement(SAAJImplementation saajImplementation, 
SOAPSpec spec) {
-        super(saajImplementation, spec);
-    }
-
     @Override
     protected void runTest() throws Throwable {
         SOAPElement parent = newSOAPFactory().createElement(new 
QName("parent"));
diff --git 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/header/TestExamineMustUnderstandHeaderElements.java
 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/header/TestExamineMustUnderstandHeaderElements.java
index 8d6c926b0..9239fac4a 100644
--- 
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/header/TestExamineMustUnderstandHeaderElements.java
+++ 
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/header/TestExamineMustUnderstandHeaderElements.java
@@ -28,17 +28,10 @@ import jakarta.xml.soap.SOAPHeader;
 import jakarta.xml.soap.SOAPHeaderElement;
 import jakarta.xml.soap.SOAPMessage;
 
-import org.apache.axiom.ts.saaj.SAAJImplementation;
 import org.apache.axiom.ts.saaj.SAAJTestCase;
-import org.apache.axiom.ts.soap.SOAPSpec;
 import org.apache.axiom.ts.soap.SOAPSampleSet;
 
 public class TestExamineMustUnderstandHeaderElements extends SAAJTestCase {
-    public TestExamineMustUnderstandHeaderElements(
-            SAAJImplementation saajImplementation, SOAPSpec spec) {
-        super(saajImplementation, spec);
-    }
-
     @Override
     protected void runTest() throws Throwable {
         MimeHeaders mimeHeaders = new MimeHeaders();
diff --git 
a/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java 
b/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
index e0f851c47..c4b9b61a1 100644
--- 
a/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
+++ 
b/testing/saaj-testsuite/src/test/java/org/apache/axiom/ts/saaj/SAAJRITest.java
@@ -18,13 +18,18 @@
  */
 package org.apache.axiom.ts.saaj;
 
-import com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl;
+import java.util.stream.Stream;
+
+import org.apache.axiom.testutils.suite.MatrixTestFilters;
+import org.junit.jupiter.api.DynamicNode;
+import org.junit.jupiter.api.TestFactory;
 
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl;
 
-public class SAAJRITest extends TestCase {
-    public static TestSuite suite() throws Exception {
-        return new SAAJTestSuiteBuilder(new SAAJMetaFactoryImpl()).build();
+public class SAAJRITest {
+    @TestFactory
+    public Stream<DynamicNode> saajTests() {
+        return SAAJTestSuite.create(new SAAJMetaFactoryImpl())
+                .toDynamicNodes(MatrixTestFilters.builder().build());
     }
 }


Reply via email to