You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/09/05 00:08:38 UTC
svn commit: r1701332 - in /webservices/axiom/trunk:
implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/
implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/
testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/...
Author: veithen
Date: Fri Sep 4 22:08:37 2015
New Revision: 1701332
URL: http://svn.apache.org/r1701332
Log:
Eliminate duplicate test cases.
Added:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestAddElementAfterBody.java (with props)
Removed:
webservices/axiom/trunk/implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/SOAPEnvelopeTest.java
webservices/axiom/trunk/implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/SOAPEnvelopeTest.java
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/envelope/
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/envelope/TestAddElementAfterBody.java
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1701332&r1=1701331&r2=1701332&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Fri Sep 4 22:08:37 2015
@@ -141,6 +141,8 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.builder.TestRegisterCustomBuilderForPayloadAfterSOAPFaultCheck(metaFactory, spec));
}
}
+ addTest(new org.apache.axiom.ts.soap.envelope.TestAddElementAfterBody(metaFactory, spec, false));
+ addTest(new org.apache.axiom.ts.soap.envelope.TestAddElementAfterBody(metaFactory, spec, true));
addTest(new org.apache.axiom.ts.soap.envelope.TestAddHeaderToIncompleteEnvelope(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.envelope.TestBodyHeaderOrder(metaFactory, spec));
if (supportsOMSourcedElement) {
@@ -324,7 +326,6 @@ public class SOAPTestSuiteBuilder extend
}
}
addTest(new org.apache.axiom.ts.soap11.builder.TestBuilder(metaFactory));
- addTest(new org.apache.axiom.ts.soap11.envelope.TestAddElementAfterBody(metaFactory));
addTest(new org.apache.axiom.ts.soap11.fault.TestGetNode(metaFactory));
addTest(new org.apache.axiom.ts.soap11.fault.TestSetNode(metaFactory));
addTest(new org.apache.axiom.ts.soap11.faultcode.TestGetValue(metaFactory));
@@ -344,7 +345,6 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap11.misc.TestElementPullStreamAndOMExpansion3(metaFactory));
}
addTest(new org.apache.axiom.ts.soap12.builder.TestBuilder(metaFactory));
- addTest(new org.apache.axiom.ts.soap12.envelope.TestAddElementAfterBody(metaFactory));
addTest(new org.apache.axiom.ts.soap12.envelope.TestBuildWithAttachments(metaFactory));
addTest(new org.apache.axiom.ts.soap12.envelope.TestMTOMForwardStreaming(metaFactory, true));
addTest(new org.apache.axiom.ts.soap12.envelope.TestMTOMForwardStreaming(metaFactory, false));
Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestAddElementAfterBody.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestAddElementAfterBody.java?rev=1701332&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestAddElementAfterBody.java (added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestAddElementAfterBody.java Fri Sep 4 22:08:37 2015
@@ -0,0 +1,62 @@
+/*
+ * 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.soap.envelope;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+/**
+ * Test that attempts to add an arbitrary element to the SOAP envelope (after the body). This is
+ * allowed in SOAP 1.1, but not in SOAP 1.2.
+ */
+public class TestAddElementAfterBody extends SOAPTestCase {
+ private final boolean header;
+
+ public TestAddElementAfterBody(OMMetaFactory metaFactory, SOAPSpec spec, boolean header) {
+ super(metaFactory, spec);
+ this.header = header;
+ addTestParameter("header", header);
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ SOAPEnvelope env = soapFactory.createSOAPEnvelope();
+ if (header) {
+ soapFactory.createSOAPHeader(env);
+ }
+ soapFactory.createSOAPBody(env);
+ OMElement elem = env.getOMFactory().createOMElement(new QName("foo"));
+ if (spec.isAllowsElementsAfterBody()) {
+ env.addChild(elem);
+ } else {
+ try {
+ env.addChild(elem);
+ fail("Expected SOAPProcessingException");
+ } catch (SOAPProcessingException ex) {
+ // expected
+ }
+ }
+ }
+}
Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestAddElementAfterBody.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java?rev=1701332&r1=1701331&r2=1701332&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java (original)
+++ webservices/axiom/trunk/testing/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPSpec.java Fri Sep 4 22:08:37 2015
@@ -50,7 +50,8 @@ public abstract class SOAPSpec extends M
"http://schemas.xmlsoap.org/soap/actor/next",
new QName("http://schemas.xmlsoap.org/soap/envelope/", "Client"),
new QName("http://schemas.xmlsoap.org/soap/envelope/", "Server"),
- new String[] { "soap-1.1.xsd" }) {
+ new String[] { "soap-1.1.xsd" },
+ true) {
public SOAPSpec getAltSpec() {
return SOAPSpec.SOAP12;
}
@@ -75,7 +76,8 @@ public abstract class SOAPSpec extends M
"http://www.w3.org/2003/05/soap-envelope/role/next",
new QName("http://www.w3.org/2003/05/soap-envelope", "Sender"),
new QName("http://www.w3.org/2003/05/soap-envelope", "Receiver"),
- new String[] { "xml.xsd", "soap-1.2.xsd" }) {
+ new String[] { "xml.xsd", "soap-1.2.xsd" },
+ false) {
public SOAPSpec getAltSpec() {
return SOAPSpec.SOAP11;
}
@@ -106,12 +108,13 @@ public abstract class SOAPSpec extends M
private final QName receiverFaultCode;
private final String[] schemaResources;
private Schema schema;
+ private final boolean allowsElementsAfterBody;
private SOAPSpec(String name, String contentType, String envelopeNamespaceURI, BooleanLiteral[] booleanLiterals,
QName faultCodeQName, QName faultValueQName, QName faultSubCodeQName, QName faultReasonQName,
QName faultTextQName, QName faultNodeQName, QName faultRoleQName, QName faultDetailQName,
String nextRoleURI, QName senderFaultCode, QName receiverFaultCode,
- String[] schemaResources) {
+ String[] schemaResources, boolean allowsElementsAfterBody) {
this.name = name;
this.contentType = contentType;
this.envelopeNamespaceURI = envelopeNamespaceURI;
@@ -132,6 +135,7 @@ public abstract class SOAPSpec extends M
this.senderFaultCode = senderFaultCode;
this.receiverFaultCode = receiverFaultCode;
this.schemaResources = schemaResources;
+ this.allowsElementsAfterBody = allowsElementsAfterBody;
}
public final String getName() {
@@ -282,4 +286,8 @@ public abstract class SOAPSpec extends M
}
return schema;
}
+
+ public final boolean isAllowsElementsAfterBody() {
+ return allowsElementsAfterBody;
+ }
}