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 8578fd2a4 Consolidate saaj-testsuite tests into BodyTests,
ElementTests, HeaderTests
8578fd2a4 is described below
commit 8578fd2a4614724e8f6389a86bb2d2dad78a78fa
Author: Copilot <[email protected]>
AuthorDate: Sat May 23 06:43:01 2026 +0100
Consolidate saaj-testsuite tests into BodyTests, ElementTests, HeaderTests
Co-authored-by: Andreas Veithen-Knowles <[email protected]>
---
...ChildElementReification.java => BodyTests.java} | 10 +--
.../org/apache/axiom/ts/saaj/ElementTests.java | 91 ++++++++++++++++++++++
...erstandHeaderElements.java => HeaderTests.java} | 10 +--
.../org/apache/axiom/ts/saaj/SAAJTestSuite.java | 17 +---
.../saaj/element/TestAddChildElementLocalName.java | 43 ----------
.../TestAddChildElementLocalNamePrefixAndURI.java | 51 ------------
.../ts/saaj/element/TestGetOwnerDocument.java | 46 -----------
.../ts/saaj/element/TestSetParentElement.java | 45 -----------
8 files changed, 105 insertions(+), 208 deletions(-)
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/BodyTests.java
similarity index 86%
rename from
testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/body/TestAddChildElementReification.java
rename to
testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/BodyTests.java
index 1ad234b95..9ca2d97f1 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/BodyTests.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.axiom.ts.saaj.body;
+package org.apache.axiom.ts.saaj;
import static org.assertj.core.api.Assertions.assertThat;
@@ -25,14 +25,14 @@ import jakarta.xml.soap.MessageFactory;
import jakarta.xml.soap.SOAPBody;
import jakarta.xml.soap.SOAPBodyElement;
import jakarta.xml.soap.SOAPElement;
-import org.junit.jupiter.api.function.Executable;
+import org.apache.axiom.testutils.suite.Test;
-public class TestAddChildElementReification implements Executable {
+public class BodyTests {
@Inject
private MessageFactory messageFactory;
- @Override
- public void execute() throws Throwable {
+ @Test
+ public void addChildElementReification() throws Throwable {
SOAPBody body = messageFactory.createMessage().getSOAPBody();
SOAPElement child =
body.addChildElement((SOAPElement)
body.getOwnerDocument().createElementNS("urn:test", "p:test"));
diff --git
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/ElementTests.java
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/ElementTests.java
new file mode 100644
index 000000000..d39da6de8
--- /dev/null
+++
b/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/ElementTests.java
@@ -0,0 +1,91 @@
+/*
+ * 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 static org.assertj.core.api.Assertions.assertThat;
+
+import com.google.inject.Inject;
+import jakarta.xml.soap.SOAPElement;
+import jakarta.xml.soap.SOAPFactory;
+import jakarta.xml.soap.SOAPPart;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import org.apache.axiom.testutils.suite.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ElementTests {
+ @Inject
+ private SOAPFactory soapFactory;
+
+ /** Tests the behavior of {@link SOAPElement#addChildElement(String)}. */
+ @Test
+ public void addChildElementLocalName() throws Throwable {
+ SOAPElement root = soapFactory.createElement("root", "p", "urn:test");
+ SOAPElement element = root.addChildElement("child");
+ assertThat(element.getLocalName()).isEqualTo("child");
+ assertThat(element.getNamespaceURI()).isNull();
+ assertThat(element.getPrefix()).isNull();
+ assertThat(element.getParentNode()).isSameAs(root);
+ assertThat(element.getAttributes().getLength()).isEqualTo(0);
+ }
+
+ /** Tests the behavior of {@link SOAPElement#addChildElement(String,
String, String)}. */
+ @Test
+ public void addChildElementLocalNamePrefixAndURI() throws Throwable {
+ SOAPElement root = soapFactory.createElement("root", "ns1", "urn:ns1");
+ SOAPElement element = root.addChildElement("child", "ns2", "urn:ns2");
+ assertThat(element.getLocalName()).isEqualTo("child");
+ assertThat(element.getNamespaceURI()).isEqualTo("urn:ns2");
+ assertThat(element.getPrefix()).isEqualTo("ns2");
+ assertThat(element.getParentNode()).isSameAs(root);
+ NamedNodeMap attributes = element.getAttributes();
+ assertThat(attributes.getLength()).isEqualTo(1);
+ Attr attr = (Attr) attributes.item(0);
+
assertThat(attr.getNamespaceURI()).isEqualTo(XMLConstants.XMLNS_ATTRIBUTE_NS_URI);
+ assertThat(attr.getPrefix()).isEqualTo(XMLConstants.XMLNS_ATTRIBUTE);
+ assertThat(attr.getLocalName()).isEqualTo("ns2");
+ }
+
+ /**
+ * Tests the behavior of the {@link Node#getOwnerDocument()} method when
invoked on a {@link
+ * SOAPElement} as well as the properties of the returned document.
+ */
+ @Test
+ public void getOwnerDocument() throws Throwable {
+ Document doc = soapFactory.createElement(new
QName("test")).getOwnerDocument();
+ assertThat(doc).isNotInstanceOf(SOAPPart.class);
+ assertThat(doc.createElementNS(null,
"test")).isInstanceOf(SOAPElement.class);
+ }
+
+ @Test
+ public void setParentElement() throws Throwable {
+ SOAPElement parent = soapFactory.createElement(new QName("parent"));
+ SOAPElement child1 = parent.addChildElement(new QName("child1"));
+ SOAPElement child2 = (SOAPElement)
parent.getOwnerDocument().createElementNS(null, "child2");
+ child2.setParentElement(parent);
+ NodeList children = parent.getChildNodes();
+ assertThat(children.getLength()).isEqualTo(2);
+ assertThat(children.item(0)).isSameAs(child1);
+ assertThat(children.item(1)).isSameAs(child2);
+ }
+}
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/HeaderTests.java
similarity index 89%
rename from
testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/header/TestExamineMustUnderstandHeaderElements.java
rename to
testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/HeaderTests.java
index 413127671..f98aa52b1 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/HeaderTests.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.axiom.ts.saaj.header;
+package org.apache.axiom.ts.saaj;
import static org.assertj.core.api.Assertions.assertThat;
@@ -28,19 +28,19 @@ import jakarta.xml.soap.SOAPHeaderElement;
import jakarta.xml.soap.SOAPMessage;
import java.io.InputStream;
import java.util.Iterator;
+import org.apache.axiom.testutils.suite.Test;
import org.apache.axiom.ts.soap.SOAPSampleSet;
import org.apache.axiom.ts.soap.SOAPSpec;
-import org.junit.jupiter.api.function.Executable;
-public class TestExamineMustUnderstandHeaderElements implements Executable {
+public class HeaderTests {
@Inject
private SOAPSpec spec;
@Inject
private MessageFactory messageFactory;
- @Override
- public void execute() throws Throwable {
+ @Test
+ public void examineMustUnderstandHeaderElements() throws Throwable {
MimeHeaders mimeHeaders = new MimeHeaders();
mimeHeaders.addHeader("Content-Type", spec.getContentType());
InputStream in =
SOAPSampleSet.MUST_UNDERSTAND.getMessage(spec).getInputStream();
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 42d2f3c3c..99c8f0378 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
@@ -30,15 +30,9 @@ import org.apache.axiom.testutils.suite.Binding;
import org.apache.axiom.testutils.suite.FanOutNode;
import org.apache.axiom.testutils.suite.InjectorNode;
import org.apache.axiom.testutils.suite.LabelBinding;
-import org.apache.axiom.testutils.suite.MatrixTest;
+import org.apache.axiom.testutils.suite.MatrixTestContainer;
import org.apache.axiom.testutils.suite.MatrixTestNode;
import org.apache.axiom.testutils.suite.ParentNode;
-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 SAAJTestSuite {
@@ -66,11 +60,8 @@ public class SAAJTestSuite {
}
},
new ParentNode(
- new
MatrixTest(TestAddChildElementReification.class),
- new
MatrixTest(TestExamineMustUnderstandHeaderElements.class),
- new
MatrixTest(TestAddChildElementLocalName.class),
- new
MatrixTest(TestAddChildElementLocalNamePrefixAndURI.class),
- new
MatrixTest(TestSetParentElement.class),
- new
MatrixTest(TestGetOwnerDocument.class)))));
+ new
MatrixTestContainer(BodyTests.class),
+ new
MatrixTestContainer(ElementTests.class),
+ new
MatrixTestContainer(HeaderTests.class)))));
}
}
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
deleted file mode 100644
index 2b4a30a17..000000000
---
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalName.java
+++ /dev/null
@@ -1,43 +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.element;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.inject.Inject;
-import jakarta.xml.soap.SOAPElement;
-import jakarta.xml.soap.SOAPFactory;
-import org.junit.jupiter.api.function.Executable;
-
-/** Tests the behavior of {@link SOAPElement#addChildElement(String)}. */
-public class TestAddChildElementLocalName implements Executable {
- @Inject
- private SOAPFactory soapFactory;
-
- @Override
- public void execute() throws Throwable {
- SOAPElement root = soapFactory.createElement("root", "p", "urn:test");
- SOAPElement element = root.addChildElement("child");
- assertThat(element.getLocalName()).isEqualTo("child");
- assertThat(element.getNamespaceURI()).isNull();
- assertThat(element.getPrefix()).isNull();
- assertThat(element.getParentNode()).isSameAs(root);
- assertThat(element.getAttributes().getLength()).isEqualTo(0);
- }
-}
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
deleted file mode 100644
index 6d87aa864..000000000
---
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestAddChildElementLocalNamePrefixAndURI.java
+++ /dev/null
@@ -1,51 +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.element;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.inject.Inject;
-import jakarta.xml.soap.SOAPElement;
-import jakarta.xml.soap.SOAPFactory;
-import javax.xml.XMLConstants;
-import org.junit.jupiter.api.function.Executable;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-
-/** Tests the behavior of {@link SOAPElement#addChildElement(String, String,
String)}. */
-public class TestAddChildElementLocalNamePrefixAndURI implements Executable {
- @Inject
- private SOAPFactory soapFactory;
-
- @Override
- public void execute() throws Throwable {
- SOAPElement root = soapFactory.createElement("root", "ns1", "urn:ns1");
- SOAPElement element = root.addChildElement("child", "ns2", "urn:ns2");
- assertThat(element.getLocalName()).isEqualTo("child");
- assertThat(element.getNamespaceURI()).isEqualTo("urn:ns2");
- assertThat(element.getPrefix()).isEqualTo("ns2");
- assertThat(element.getParentNode()).isSameAs(root);
- NamedNodeMap attributes = element.getAttributes();
- assertThat(attributes.getLength()).isEqualTo(1);
- Attr attr = (Attr) attributes.item(0);
-
assertThat(attr.getNamespaceURI()).isEqualTo(XMLConstants.XMLNS_ATTRIBUTE_NS_URI);
- assertThat(attr.getPrefix()).isEqualTo(XMLConstants.XMLNS_ATTRIBUTE);
- assertThat(attr.getLocalName()).isEqualTo("ns2");
- }
-}
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
deleted file mode 100644
index c7e58b1af..000000000
---
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestGetOwnerDocument.java
+++ /dev/null
@@ -1,46 +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.element;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.inject.Inject;
-import jakarta.xml.soap.SOAPElement;
-import jakarta.xml.soap.SOAPFactory;
-import jakarta.xml.soap.SOAPPart;
-import javax.xml.namespace.QName;
-import org.junit.jupiter.api.function.Executable;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Tests the behavior of the {@link Node#getOwnerDocument()} method when
invoked on a {@link
- * SOAPElement} as well as the properties of the returned document.
- */
-public class TestGetOwnerDocument implements Executable {
- @Inject
- private SOAPFactory soapFactory;
-
- @Override
- public void execute() throws Throwable {
- Document doc = soapFactory.createElement(new
QName("test")).getOwnerDocument();
- assertThat(doc).isNotInstanceOf(SOAPPart.class);
- assertThat(doc.createElementNS(null,
"test")).isInstanceOf(SOAPElement.class);
- }
-}
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
deleted file mode 100644
index 97464d9da..000000000
---
a/testing/saaj-testsuite/src/main/java/org/apache/axiom/ts/saaj/element/TestSetParentElement.java
+++ /dev/null
@@ -1,45 +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.element;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.inject.Inject;
-import jakarta.xml.soap.SOAPElement;
-import jakarta.xml.soap.SOAPFactory;
-import javax.xml.namespace.QName;
-import org.junit.jupiter.api.function.Executable;
-import org.w3c.dom.NodeList;
-
-public class TestSetParentElement implements Executable {
- @Inject
- private SOAPFactory soapFactory;
-
- @Override
- public void execute() throws Throwable {
- SOAPElement parent = soapFactory.createElement(new QName("parent"));
- SOAPElement child1 = parent.addChildElement(new QName("child1"));
- SOAPElement child2 = (SOAPElement)
parent.getOwnerDocument().createElementNS(null, "child2");
- child2.setParentElement(parent);
- NodeList children = parent.getChildNodes();
- assertThat(children.getLength()).isEqualTo(2);
- assertThat(children.item(0)).isSameAs(child1);
- assertThat(children.item(1)).isSameAs(child2);
- }
-}