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 2013/01/24 23:20:31 UTC
svn commit: r1438227 - in /webservices/axiom/trunk/modules:
axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/
axiom-impl/src/test/java/org/apache/axiom/soap/impl/llom/
axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/
axiom-testsuite/src/ma...
Author: veithen
Date: Thu Jan 24 22:20:30 2013
New Revision: 1438227
URL: http://svn.apache.org/viewvc?rev=1438227&view=rev
Log:
More test cases for AXIOM-392.
Added:
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java (with props)
Modified:
webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java
webservices/axiom/trunk/modules/axiom-impl/src/test/java/org/apache/axiom/soap/impl/llom/SOAPImplementationTest.java
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Modified: webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java?rev=1438227&r1=1438226&r2=1438227&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java (original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java Thu Jan 24 22:20:30 2013
@@ -26,6 +26,7 @@ import org.apache.axiom.ts.soap.SOAPTest
import org.apache.axiom.ts.soap.body.TestHasFaultAfterReplace;
import org.apache.axiom.ts.soap.envelope.TestSerialize;
import org.apache.axiom.ts.soap.factory.TestGetDefaultFaultEnvelope;
+import org.apache.axiom.ts.soap.fault.TestChildOrder;
import org.apache.axiom.ts.soap.faultdetail.TestWSCommons202;
import org.apache.axiom.ts.soap.faulttext.TestSetLang;
import org.apache.axiom.ts.soap12.fault.TestMoreChildrenAddition;
@@ -53,6 +54,7 @@ public class SOAPImplementationTest exte
// TODO: AXIOM-430
builder.exclude(TestSerialize.class, "(&(file=*/empty-header.xml)(|(serializationStrategy=OutputStream)(serializationStrategy=Writer)(serializationStrategy=XMLStreamWriter))(|(cache=true)(expand=fully)))");
+ builder.exclude(TestChildOrder.class);
// TODO: AXIOM-392
builder.exclude(TestSerialize.class, "(&(file=*fault*)(|(serializationStrategy=OutputStream)(serializationStrategy=Writer)(serializationStrategy=XMLStreamWriter))(|(cache=true)(expand=fully)))");
Modified: webservices/axiom/trunk/modules/axiom-impl/src/test/java/org/apache/axiom/soap/impl/llom/SOAPImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/test/java/org/apache/axiom/soap/impl/llom/SOAPImplementationTest.java?rev=1438227&r1=1438226&r2=1438227&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/test/java/org/apache/axiom/soap/impl/llom/SOAPImplementationTest.java (original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/test/java/org/apache/axiom/soap/impl/llom/SOAPImplementationTest.java Thu Jan 24 22:20:30 2013
@@ -24,6 +24,7 @@ import junit.framework.TestSuite;
import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
import org.apache.axiom.ts.soap.SOAPTestSuiteBuilder;
import org.apache.axiom.ts.soap.envelope.TestSerialize;
+import org.apache.axiom.ts.soap.fault.TestChildOrder;
public class SOAPImplementationTest extends TestCase {
public static TestSuite suite() {
@@ -34,6 +35,7 @@ public class SOAPImplementationTest exte
// TODO: AXIOM-392
builder.exclude(TestSerialize.class, "(&(file=*fault*)(|(serializationStrategy=OutputStream)(serializationStrategy=Writer)(serializationStrategy=XMLStreamWriter))(|(cache=true)(expand=fully)))");
+ builder.exclude(TestChildOrder.class, "(|(serializationStrategy=XMLStreamReader)(serializationStrategy=SAXSource))");
return builder.build();
}
Modified: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1438227&r1=1438226&r2=1438227&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Thu Jan 24 22:20:30 2013
@@ -80,6 +80,7 @@ public class SOAPTestSuiteBuilder extend
}
private void addTests(SOAPSpec spec) {
+ SerializationStrategy[] serializationStrategies = Strategies.getSerializationStrategies();
addTest(new org.apache.axiom.ts.soap.body.TestAddFault1(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.body.TestAddFault2(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.body.TestGetFault(metaFactory, spec));
@@ -152,6 +153,9 @@ public class SOAPTestSuiteBuilder extend
addTest(new org.apache.axiom.ts.soap.factory.TestGetDefaultFaultEnvelope(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.factory.TestGetMetaFactory(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.factory.TestGetNamespace(metaFactory, spec));
+ for (int i=0; i<serializationStrategies.length; i++) {
+ addTest(new org.apache.axiom.ts.soap.fault.TestChildOrder(metaFactory, spec, serializationStrategies[i]));
+ }
addTest(new org.apache.axiom.ts.soap.fault.TestGetCode(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestGetCodeWithParser(metaFactory, spec));
addTest(new org.apache.axiom.ts.soap.fault.TestGetDetail(metaFactory, spec));
Added: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java?rev=1438227&view=auto
==============================================================================
--- webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java (added)
+++ webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java Thu Jan 24 22:20:30 2013
@@ -0,0 +1,70 @@
+/*
+ * 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.fault;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+import org.apache.axiom.ts.strategy.serialization.SerializationStrategy;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * Tests that the children added using methods such as {@link SOAPFault#setCode(SOAPFaultCode)} and
+ * {@link SOAPFault#setReason(SOAPFaultReason)} appear in the order required by the SOAP specs when
+ * the {@link SOAPFault} is serialized.
+ * <p>
+ * Regression test for <a href="https://issues.apache.org/jira/browse/AXIOM-392">AXIOM-392</a>.
+ */
+public class TestChildOrder extends SOAPTestCase {
+ private final SerializationStrategy serializationStrategy;
+
+ public TestChildOrder(OMMetaFactory metaFactory, SOAPSpec spec, SerializationStrategy serializationStrategy) {
+ super(metaFactory, spec);
+ this.serializationStrategy = serializationStrategy;
+ serializationStrategy.addTestProperties(this);
+ }
+
+ protected void runTest() throws Throwable {
+ SOAPFault fault = soapFactory.createSOAPFault();
+ // Add fault code and reason in the "wrong" order
+ SOAPFaultReason reason = soapFactory.createSOAPFaultReason();
+ reason.setText("Invalid credentials");
+ fault.setReason(reason);
+ SOAPFaultCode code = soapFactory.createSOAPFaultCode();
+ code.setText(new QName(soapFactory.getNamespace().getNamespaceURI(), "Client"));
+ fault.setCode(code);
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ // Check the result using the given serialization strategy
+ Document document = dbf.newDocumentBuilder().parse(serializationStrategy.serialize(fault).getInputSource());
+ Element domFault = document.getDocumentElement();
+ NodeList children = domFault.getChildNodes();
+ assertEquals(2, children.getLength());
+ assertEquals(spec.getFaultCodeQName().getLocalPart(), children.item(0).getLocalName());
+ assertEquals(spec.getFaultReasonQName().getLocalPart(), children.item(1).getLocalName());
+ }
+}
Propchange: webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/fault/TestChildOrder.java
------------------------------------------------------------------------------
svn:eol-style = native