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 f2df19002 Unify DimensionFanOutNode and ParameterFanOutNode
f2df19002 is described below
commit f2df19002f250457cfa7f9ed8490c57a09b0ddb7
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Sun Mar 15 22:10:04 2026 +0000
Unify DimensionFanOutNode and ParameterFanOutNode
---
.../apache/axiom/util/sax/XMLReaderTestSuite.java | 7 ++-
.../om/impl/jaxp/StreamSourceToOMResultTest.java | 12 ++---
.../serializer/SerializerConformanceTest.java | 7 ++-
.../stax/pull/output/StAXPivotTransformerTest.java | 13 +++--
.../apache/axiom/ts/om/cross/CrossOMTestSuite.java | 13 +++--
.../org/apache/axiom/ts/omdom/OMDOMTestSuite.java | 13 +++--
.../axiom/testutils/suite/DimensionFanOutNode.java | 63 ----------------------
.../{AbstractFanOutNode.java => FanOutNode.java} | 58 ++++++++++----------
.../apache/axiom/testutils/suite/MatrixTest.java | 4 +-
.../axiom/testutils/suite/MatrixTestNode.java | 5 +-
.../axiom/testutils/suite/ParameterBinding.java | 25 +++++++++
.../axiom/testutils/suite/ParameterFanOutNode.java | 52 ------------------
.../org/apache/axiom/ts/saaj/SAAJTestSuite.java | 7 ++-
.../axiom/ts/springws/SpringWSTestSuite.java | 15 +++---
.../org/apache/axiom/truth/xml/CompareTest.java | 26 ++++-----
15 files changed, 113 insertions(+), 207 deletions(-)
diff --git
a/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuite.java
b/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuite.java
index a4aee3ef7..23070c142 100644
--- a/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuite.java
+++ b/axiom-api/src/test/java/org/apache/axiom/util/sax/XMLReaderTestSuite.java
@@ -20,7 +20,7 @@ package org.apache.axiom.util.sax;
import org.apache.axiom.testutils.suite.InjectorNode;
import org.apache.axiom.testutils.suite.MatrixTest;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.xml.sax.XMLReader;
import com.google.common.collect.ImmutableList;
@@ -30,7 +30,7 @@ public class XMLReaderTestSuite {
public static InjectorNode create(XMLReader xmlReader) {
return new InjectorNode(
binder -> binder.bind(XMLReader.class).toInstance(xmlReader),
- new ParameterFanOutNode<>(
+ new FanOutNode<>(
ImmutableList.of(
"http://xml.org/sax/features/namespaces",
"http://xml.org/sax/features/namespace-prefixes",
@@ -39,8 +39,7 @@ public class XMLReaderTestSuite {
binder.bind(String.class)
.annotatedWith(Names.named("feature"))
.toInstance(value),
- "feature",
- s -> s,
+ (params, value) -> params.addTestParameter("feature",
value),
new MatrixTest(TestGetSetFeature.class)));
}
}
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 a075a3d6a..25999114a 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
@@ -25,7 +25,7 @@ import org.apache.axiom.testutils.suite.MatrixTest;
import com.google.common.collect.ImmutableList;
import com.google.inject.name.Names;
import org.apache.axiom.testutils.suite.MatrixTestFilters;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.ts.xml.XMLSample;
import org.junit.jupiter.api.DynamicNode;
import org.junit.jupiter.api.TestFactory;
@@ -37,19 +37,17 @@ public class StreamSourceToOMResultTest {
MatrixTestFilters.builder()
.add("(|(file=sax-attribute-namespace-bug.xml)(file=large.xml))")
.build();
- return new ParameterFanOutNode<>(
+ return new FanOutNode<>(
ImmutableList.of("default", "dom"),
(binder, value) ->
binder.bind(String.class)
.annotatedWith(Names.named("axiomImplementation"))
.toInstance(value),
- "axiomImplementation",
- s -> s,
- new ParameterFanOutNode<>(
+ (params, value) ->
params.addTestParameter("axiomImplementation", value),
+ new FanOutNode<>(
Multiton.getInstances(XMLSample.class),
(binder, value) ->
binder.bind(XMLSample.class).toInstance(value),
- "file",
- XMLSample::getName,
+ (params, value) ->
params.addTestParameter("file", value.getName()),
new
MatrixTest(StreamSourceToOMResultTestCase.class)))
.toDynamicNodes(excludes);
}
diff --git
a/components/core-streams/src/test/java/org/apache/axiom/core/stream/serializer/SerializerConformanceTest.java
b/components/core-streams/src/test/java/org/apache/axiom/core/stream/serializer/SerializerConformanceTest.java
index 2039977d6..5500b6ca2 100644
---
a/components/core-streams/src/test/java/org/apache/axiom/core/stream/serializer/SerializerConformanceTest.java
+++
b/components/core-streams/src/test/java/org/apache/axiom/core/stream/serializer/SerializerConformanceTest.java
@@ -22,7 +22,7 @@ import java.util.stream.Stream;
import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.suite.MatrixTest;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.ts.xml.XMLSample;
import org.junit.jupiter.api.DynamicNode;
import org.junit.jupiter.api.TestFactory;
@@ -30,11 +30,10 @@ import org.junit.jupiter.api.TestFactory;
public class SerializerConformanceTest {
@TestFactory
public Stream<DynamicNode> tests() {
- return new ParameterFanOutNode<>(
+ return new FanOutNode<>(
Multiton.getInstances(XMLSample.class),
(binder, value) ->
binder.bind(XMLSample.class).toInstance(value),
- "sample",
- XMLSample::getName,
+ (params, value) -> params.addTestParameter("sample",
value.getName()),
new MatrixTest(SerializerConformanceTestCase.class))
.toDynamicNodes();
}
diff --git
a/components/core-streams/src/test/java/org/apache/axiom/core/stream/stax/pull/output/StAXPivotTransformerTest.java
b/components/core-streams/src/test/java/org/apache/axiom/core/stream/stax/pull/output/StAXPivotTransformerTest.java
index afcb7824a..b8eee1758 100644
---
a/components/core-streams/src/test/java/org/apache/axiom/core/stream/stax/pull/output/StAXPivotTransformerTest.java
+++
b/components/core-streams/src/test/java/org/apache/axiom/core/stream/stax/pull/output/StAXPivotTransformerTest.java
@@ -22,7 +22,7 @@ import java.util.stream.Stream;
import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.suite.MatrixTest;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.ts.jaxp.xslt.XSLTImplementation;
import org.apache.axiom.ts.xml.XMLSample;
import org.junit.jupiter.api.DynamicNode;
@@ -33,20 +33,19 @@ import com.google.common.collect.ImmutableList;
public class StAXPivotTransformerTest {
@TestFactory
public Stream<DynamicNode> tests() {
- return new ParameterFanOutNode<>(
+ return new FanOutNode<>(
Multiton.getInstances(XSLTImplementation.class).stream()
.filter(XSLTImplementation::supportsStAXSource)
.collect(ImmutableList.toImmutableList()),
(binder, value) ->
binder.bind(XSLTImplementation.class).toInstance(value),
- "xslt",
- XSLTImplementation::getName,
- new ParameterFanOutNode<>(
+ (params, value) -> params.addTestParameter("xslt",
value.getName()),
+ new FanOutNode<>(
Multiton.getInstances(XMLSample.class).stream()
.filter(s -> !s.hasDTD())
.collect(ImmutableList.toImmutableList()),
(binder, value) ->
binder.bind(XMLSample.class).toInstance(value),
- "sample",
- XMLSample::getName,
+ (params, value) ->
+ params.addTestParameter("sample",
value.getName()),
new
MatrixTest(StAXPivotTransformerTestCase.class)))
.toDynamicNodes();
}
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/cross/CrossOMTestSuite.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/cross/CrossOMTestSuite.java
index 98194698b..85ef288ea 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/cross/CrossOMTestSuite.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/cross/CrossOMTestSuite.java
@@ -23,7 +23,7 @@ import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.suite.InjectorNode;
import org.apache.axiom.testutils.suite.MatrixTest;
import org.apache.axiom.testutils.suite.ParentNode;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.ts.xml.XMLSample;
import com.google.common.collect.ImmutableList;
@@ -42,20 +42,19 @@ public class CrossOMTestSuite {
},
new ParentNode(
new MatrixTest(TestAddChild.class),
- new ParameterFanOutNode<>(
+ new FanOutNode<>(
Multiton.getInstances(XMLSample.class),
(binder, value) ->
binder.bind(XMLSample.class).toInstance(value),
- "file",
- XMLSample::getName,
+ (params, value) ->
params.addTestParameter("file", value.getName()),
new
MatrixTest(TestImportInformationItem.class)),
- new ParameterFanOutNode<>(
+ new FanOutNode<>(
ImmutableList.of(false, true),
(binder, value) ->
binder.bind(Boolean.class)
.annotatedWith(Names.named("before"))
.toInstance(value),
- "before",
- String::valueOf,
+ (params, value) ->
+ params.addTestParameter("before",
String.valueOf(value)),
new MatrixTest(TestInsertSibling.class))));
}
}
diff --git
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuite.java
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuite.java
index 603d71313..0412dc479 100644
---
a/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuite.java
+++
b/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuite.java
@@ -23,7 +23,7 @@ import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.suite.InjectorNode;
import org.apache.axiom.testutils.suite.MatrixTest;
import org.apache.axiom.testutils.suite.ParentNode;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.ts.xml.XMLSample;
import com.google.common.collect.ImmutableList;
@@ -44,14 +44,14 @@ public class OMDOMTestSuite {
new MatrixTest(
org.apache.axiom.ts.omdom.attr.TestSetValueOnNamespaceDeclaration
.class),
- new ParameterFanOutNode<>(
+ new FanOutNode<>(
ImmutableList.of(true, false),
(binder, value) ->
binder.bind(Boolean.class)
.annotatedWith(Names.named("build"))
.toInstance(value),
- "build",
- String::valueOf,
+ (params, value) ->
+ params.addTestParameter("build",
String.valueOf(value)),
new ParentNode(
new MatrixTest(
org.apache.axiom.ts.omdom.document
@@ -64,11 +64,10 @@ public class OMDOMTestSuite {
.TestCreateDocumentFragmentInterfaces.class),
new
MatrixTest(org.apache.axiom.ts.omdom.document.TestGetOMFactory1.class),
new
MatrixTest(org.apache.axiom.ts.omdom.document.TestGetOMFactory2.class),
- new ParameterFanOutNode<>(
+ new FanOutNode<>(
Multiton.getInstances(XMLSample.class),
(binder, value) ->
binder.bind(XMLSample.class).toInstance(value),
- "file",
- XMLSample::getName,
+ (params, value) ->
params.addTestParameter("file", value.getName()),
new MatrixTest(
org.apache.axiom.ts.omdom.document.TestImportNode.class)),
new MatrixTest(
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
deleted file mode 100644
index fc495453c..000000000
---
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/DimensionFanOutNode.java
+++ /dev/null
@@ -1,63 +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.testutils.suite;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * 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(
- ImmutableList<D> dimensions, Binding<D> binding, MatrixTestNode
child) {
- super(dimensions, binding, child);
- }
-
- @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/AbstractFanOutNode.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/FanOutNode.java
similarity index 59%
rename from
testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/AbstractFanOutNode.java
rename to
testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/FanOutNode.java
index ea18396aa..4e786740e 100644
---
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/FanOutNode.java
@@ -31,42 +31,29 @@ import com.google.common.collect.ImmutableList;
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}. The value is bound as a plain
(unannotated) type binding.
- * <li>{@link ParameterFanOutNode} — for arbitrary types, using a
caller-supplied parameter name
- * and {@link java.util.function.Function}. The value is bound with a
{@code @Named}
- * annotation whose value is the parameter name; injection sites must use
- * {@code @Inject @Named("paramName")}.
- * </ul>
+ * Fan-out node that iterates 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.
*
* @param <T> the value type
*/
-public abstract class AbstractFanOutNode<T> extends MatrixTestNode {
+public final class FanOutNode<T> extends MatrixTestNode {
private final ImmutableList<T> values;
private final Binding<T> binding;
+ private final ParameterBinding<? super T> parameterBinding;
private final MatrixTestNode child;
- protected AbstractFanOutNode(
- ImmutableList<T> values, Binding<T> binding, MatrixTestNode child)
{
+ public FanOutNode(
+ ImmutableList<T> values,
+ Binding<T> binding,
+ ParameterBinding<? super T> parameterBinding,
+ MatrixTestNode child) {
this.values = values;
this.binding = binding;
+ this.parameterBinding = parameterBinding;
this.child = 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,
@@ -78,17 +65,32 @@ public abstract class AbstractFanOutNode<T> extends
MatrixTestNode {
Injector childInjector =
parentInjector.createChildInjector(
binder ->
binding.configure(binder, value));
+ Map<String, String> parameters = new
HashMap<>(inheritedParameters);
+ parameterBinding.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));
+ }
- Map<String, String> parameters =
extractParameters(value);
- HashMap<String, String> params = new
HashMap<>(inheritedParameters);
- params.putAll(parameters);
+ @Override
+ public void addTestParameter(String
name, int value) {
+ addTestParameter(name,
String.valueOf(value));
+ }
+ },
+ value);
String displayName =
parameters.entrySet().stream()
.map(e -> e.getKey() + "=" +
e.getValue())
.collect(Collectors.joining(", "));
return DynamicContainer.dynamicContainer(
displayName,
- child.toDynamicNodes(childInjector,
params, excludes));
+ child.toDynamicNodes(childInjector,
parameters, excludes));
});
}
}
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
index a98ab424a..06a2678bc 100644
---
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
@@ -34,8 +34,8 @@ import junit.framework.TestCase;
*
* <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.
+ * the ancestor {@link FanOutNode} 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.
diff --git
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
index 2ec07eddc..874f36d19 100644
---
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
+++
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/MatrixTestNode.java
@@ -32,9 +32,8 @@ 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.
+ * <p>The {@code parentInjector} parameter threads through the tree: each
{@link FanOutNode} creates
+ * child injectors from it, and each {@link MatrixTest} uses it to instantiate
the test class.
*/
public abstract class MatrixTestNode {
abstract Stream<DynamicNode> toDynamicNodes(
diff --git
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/ParameterBinding.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/ParameterBinding.java
new file mode 100644
index 000000000..e33d01dbd
--- /dev/null
+++
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/ParameterBinding.java
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+public interface ParameterBinding<T> {
+ ParameterBinding<Dimension> DIMENSION = (params, value) ->
value.addTestParameters(params);
+
+ void addTestParameters(TestParameterTarget params, T value);
+}
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
deleted file mode 100644
index 9d821af94..000000000
---
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/ParameterFanOutNode.java
+++ /dev/null
@@ -1,52 +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.testutils.suite;
-
-import java.util.Map;
-import java.util.function.Function;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * 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(
- ImmutableList<T> values,
- Binding<T> binding,
- String parameterName,
- Function<T, String> parameterValueFunction,
- MatrixTestNode child) {
- super(values, binding, child);
- 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/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuite.java
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/SAAJTestSuite.java
index 834d1c2b0..3864e7623 100644
---
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
@@ -24,7 +24,7 @@ import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.suite.MatrixTest;
import org.apache.axiom.testutils.suite.InjectorNode;
import org.apache.axiom.testutils.suite.ParentNode;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.ts.saaj.body.TestAddChildElementReification;
import org.apache.axiom.ts.saaj.element.TestAddChildElementLocalName;
import
org.apache.axiom.ts.saaj.element.TestAddChildElementLocalNamePrefixAndURI;
@@ -39,11 +39,10 @@ public class SAAJTestSuite {
binder ->
binder.bind(SAAJImplementation.class)
.toInstance(new
SAAJImplementation(metaFactory)),
- new ParameterFanOutNode<>(
+ new FanOutNode<>(
Multiton.getInstances(SOAPSpec.class),
(binder, value) ->
binder.bind(SOAPSpec.class).toInstance(value),
- "spec",
- SOAPSpec::getName,
+ (params, value) -> params.addTestParameter("spec",
value.getName()),
new ParentNode(
new
MatrixTest(TestAddChildElementReification.class),
new
MatrixTest(TestExamineMustUnderstandHeaderElements.class),
diff --git
a/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuite.java
b/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuite.java
index 64163dd80..141d31af4 100644
---
a/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuite.java
+++
b/testing/spring-ws-testsuite/src/main/java/org/apache/axiom/ts/springws/SpringWSTestSuite.java
@@ -19,11 +19,11 @@
package org.apache.axiom.ts.springws;
import org.apache.axiom.testing.multiton.Multiton;
-import org.apache.axiom.testutils.suite.DimensionFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.testutils.suite.InjectorNode;
import org.apache.axiom.testutils.suite.MatrixTest;
import org.apache.axiom.testutils.suite.MatrixTestNode;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.ParameterBinding;
import org.apache.axiom.testutils.suite.ParentNode;
import org.apache.axiom.testutils.suite.SelectorNode;
import org.apache.axiom.ts.soap.SOAPSpec;
@@ -53,11 +53,13 @@ public class SpringWSTestSuite {
new ScenarioConfig(messageFactoryConfigurator,
altMessageFactoryConfigurator));
}
- return new ParameterFanOutNode<>(
+ return new FanOutNode<>(
Multiton.getInstances(SOAPSpec.class),
(binder, value) ->
binder.bind(SOAPSpec.class).toInstance(value),
- "soapVersion",
- spec ->
spec.getAdapter(SOAPSpecAdapter.class).getSoapVersion(),
+ (params, value) ->
+ params.addTestParameter(
+ "soapVersion",
+
value.getAdapter(SOAPSpecAdapter.class).getSoapVersion()),
new ParentNode(
new InjectorNode(
binder ->
@@ -76,10 +78,11 @@ public class SpringWSTestSuite {
new MatrixTest(
TestCreateWebServiceMessageFromInputStreamMTOM
.class)))),
- new DimensionFanOutNode<>(
+ new FanOutNode<>(
configs.build(),
(binder, value) ->
binder.bind(ScenarioConfig.class).toInstance(value),
+ ParameterBinding.DIMENSION,
new ParentNode(
new MatrixTest(ClientServerTest.class),
new
MatrixTest(WSAddressingDOMTest.class),
diff --git
a/testing/xml-truth/src/test/java/org/apache/axiom/truth/xml/CompareTest.java
b/testing/xml-truth/src/test/java/org/apache/axiom/truth/xml/CompareTest.java
index 9debe6075..a330fe5c8 100644
---
a/testing/xml-truth/src/test/java/org/apache/axiom/truth/xml/CompareTest.java
+++
b/testing/xml-truth/src/test/java/org/apache/axiom/truth/xml/CompareTest.java
@@ -22,7 +22,7 @@ import java.util.stream.Stream;
import org.apache.axiom.testing.multiton.Multiton;
import org.apache.axiom.testutils.suite.MatrixTest;
-import org.apache.axiom.testutils.suite.ParameterFanOutNode;
+import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.ts.xml.XMLSample;
import org.junit.jupiter.api.DynamicNode;
import org.junit.jupiter.api.TestFactory;
@@ -33,31 +33,29 @@ import com.google.inject.name.Names;
public class CompareTest {
@TestFactory
public Stream<DynamicNode> tests() {
- return new ParameterFanOutNode<>(
+ return new FanOutNode<>(
Multiton.getInstances(XMLSample.class),
(binder, value) ->
binder.bind(XMLSample.class)
.annotatedWith(Names.named("sample"))
.toInstance(value),
- "sample",
- XMLSample::getName,
- new ParameterFanOutNode<>(
+ (params, value) -> params.addTestParameter("sample",
value.getName()),
+ new FanOutNode<>(
Multiton.getInstances(XMLObjectFactory.class),
(binder, value) ->
binder.bind(XMLObjectFactory.class)
.annotatedWith(Names.named("left"))
.toInstance(value),
- "left",
- XMLObjectFactory::getName,
- new ParameterFanOutNode<>(
+ (params, value) ->
params.addTestParameter("left", value.getName()),
+ new FanOutNode<>(
Multiton.getInstances(XMLObjectFactory.class),
(binder, value) ->
binder.bind(XMLObjectFactory.class)
.annotatedWith(Names.named("right"))
.toInstance(value),
- "right",
- XMLObjectFactory::getName,
- new ParameterFanOutNode<>(
+ (params, value) ->
+
params.addTestParameter("right", value.getName()),
+ new FanOutNode<>(
ImmutableList.of(true, false),
(binder, value) ->
binder.bind(Boolean.class)
@@ -65,8 +63,10 @@ public class CompareTest {
Names.named(
"expandEntityReferences"))
.toInstance(value),
- "expandEntityReferences",
- String::valueOf,
+ (params, value) ->
+
params.addTestParameter(
+
"expandEntityReferences",
+
String.valueOf(value)),
new
MatrixTest(CompareTestCase.class)))))
.toDynamicNodes();
}