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 4965809e5 Add SelectorNode and use it to simplify SpringWSTestSuite
4965809e5 is described below
commit 4965809e554d59b89d8f81a178a40a5f0ea37ca2
Author: Andreas Veithen-Knowles <[email protected]>
AuthorDate: Sat Mar 14 12:31:48 2026 +0000
Add SelectorNode and use it to simplify SpringWSTestSuite
Introduce SelectorNode, a MatrixTestNode subclass that conditionally
delegates to its child based on a parameter value, removing the parameter
before delegation. Use it in SpringWSTestSuite to move the MTOM test
inside the SOAP version fan-out with a SOAP 1.2 selector, eliminating
the separate InjectorNode with a hardcoded SOAPSpec binding.
---
.../apache/axiom/testutils/suite/SelectorNode.java | 57 +++++++++++++++
.../axiom/ts/springws/SpringWSTestSuite.java | 84 +++++++++-------------
2 files changed, 91 insertions(+), 50 deletions(-)
diff --git
a/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/SelectorNode.java
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/SelectorNode.java
new file mode 100644
index 000000000..48d884b95
--- /dev/null
+++
b/testing/matrix-testsuite/src/main/java/org/apache/axiom/testutils/suite/SelectorNode.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.HashMap;
+import java.util.Map;
+import java.util.function.BiPredicate;
+import java.util.stream.Stream;
+
+import org.junit.jupiter.api.DynamicNode;
+
+import com.google.inject.Injector;
+
+/**
+ * A node that only delegates to its child if a given parameter has a given
value. The parameter is
+ * removed from the inherited parameters before delegating.
+ */
+public final class SelectorNode extends MatrixTestNode {
+ private final String parameterName;
+ private final String parameterValue;
+ private final MatrixTestNode child;
+
+ public SelectorNode(String parameterName, String parameterValue,
MatrixTestNode child) {
+ this.parameterName = parameterName;
+ this.parameterValue = parameterValue;
+ this.child = child;
+ }
+
+ @Override
+ Stream<DynamicNode> toDynamicNodes(
+ Injector parentInjector,
+ Map<String, String> inheritedParameters,
+ BiPredicate<Class<?>, Map<String, String>> excludes) {
+ if (!parameterValue.equals(inheritedParameters.get(parameterName))) {
+ return Stream.empty();
+ }
+ Map<String, String> filteredParameters = new
HashMap<>(inheritedParameters);
+ filteredParameters.remove(parameterName);
+ return child.toDynamicNodes(parentInjector, filteredParameters,
excludes);
+ }
+}
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 0ad39621a..29c1ce7e2 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
@@ -25,6 +25,7 @@ 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.ParentNode;
+import org.apache.axiom.testutils.suite.SelectorNode;
import org.apache.axiom.ts.soap.SOAPSpec;
import org.apache.axiom.ts.springws.scenario.ScenarioConfig;
import org.apache.axiom.ts.springws.scenario.broker.BrokerScenarioTest;
@@ -40,8 +41,6 @@ import
org.apache.axiom.ts.springws.soap.messagefactory.TestCreateWebServiceMess
import
org.apache.axiom.ts.springws.soap.messagefactory.TestCreateWebServiceMessageFromInputStreamVersionMismatch;
import com.google.common.collect.ImmutableList;
-import com.google.inject.AbstractModule;
-import com.google.inject.name.Names;
public class SpringWSTestSuite {
public static MatrixTestNode create(
@@ -54,54 +53,39 @@ public class SpringWSTestSuite {
new ScenarioConfig(messageFactoryConfigurator,
altMessageFactoryConfigurator));
}
- AbstractModule mfcModule =
- new AbstractModule() {
- @Override
- protected void configure() {
- bind(MessageFactoryConfigurator.class)
- .toInstance(messageFactoryConfigurator);
- }
- };
-
- return new ParentNode(
- new InjectorNode(
- ImmutableList.of(
- mfcModule,
- new AbstractModule() {
- @Override
- protected void configure() {
- bind(SOAPSpec.class)
-
.annotatedWith(Names.named("soapVersion"))
- .toInstance(SOAPSpec.SOAP12);
- }
- }),
- new
MatrixTest(TestCreateWebServiceMessageFromInputStreamMTOM.class)),
- new ParameterFanOutNode<>(
- SOAPSpec.class,
- Multiton.getInstances(SOAPSpec.class),
- "soapVersion",
- spec ->
spec.getAdapter(SOAPSpecAdapter.class).getSoapVersion(),
- new ParentNode(
- new InjectorNode(
- mfcModule,
- new ParentNode(
- new
MatrixTest(TestCreateWebServiceMessage.class),
- new MatrixTest(
-
TestCreateWebServiceMessageFromInputStream
- .class),
+ return new ParameterFanOutNode<>(
+ SOAPSpec.class,
+ Multiton.getInstances(SOAPSpec.class),
+ "soapVersion",
+ spec ->
spec.getAdapter(SOAPSpecAdapter.class).getSoapVersion(),
+ new ParentNode(
+ new InjectorNode(
+ binder ->
+
binder.bind(MessageFactoryConfigurator.class)
+
.toInstance(messageFactoryConfigurator),
+ new ParentNode(
+ new
MatrixTest(TestCreateWebServiceMessage.class),
+ new MatrixTest(
+
TestCreateWebServiceMessageFromInputStream.class),
+ new MatrixTest(
+
TestCreateWebServiceMessageFromInputStreamVersionMismatch
+ .class),
+ new SelectorNode(
+ "soapVersion",
+ "SOAP_12",
new MatrixTest(
-
TestCreateWebServiceMessageFromInputStreamVersionMismatch
- .class))),
- new DimensionFanOutNode<>(
- ScenarioConfig.class,
- configs.build(),
- new ParentNode(
- new
MatrixTest(ClientServerTest.class),
- new
MatrixTest(WSAddressingDOMTest.class),
- new
MatrixTest(JAXB2Test.class),
- new
MatrixTest(BrokerScenarioTest.class),
- new
MatrixTest(ValidationTest.class),
- new
MatrixTest(SecureEchoTest.class),
- new
MatrixTest(SoapActionTest.class))))));
+
TestCreateWebServiceMessageFromInputStreamMTOM
+ .class)))),
+ new DimensionFanOutNode<>(
+ ScenarioConfig.class,
+ configs.build(),
+ new ParentNode(
+ new MatrixTest(ClientServerTest.class),
+ new
MatrixTest(WSAddressingDOMTest.class),
+ new MatrixTest(JAXB2Test.class),
+ new
MatrixTest(BrokerScenarioTest.class),
+ new MatrixTest(ValidationTest.class),
+ new MatrixTest(SecureEchoTest.class),
+ new
MatrixTest(SoapActionTest.class)))));
}
}