Author: veithen
Date: Mon Jun 30 23:15:51 2014
New Revision: 1606944

URL: http://svn.apache.org/r1606944
Log:
AXIOM-311: Refactored some SOAPFaultRole tests and introduced new clean test 
messages for these tests.

Added:
    
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultrole/
    
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultrole/TestGetRoleValueWithParser.java
   (with props)
    
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-fault.xml
   (with props)
    
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-request.xml
   (with props)
Modified:
    
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTestBase.java
    
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
    
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
    
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java

Modified: 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTestBase.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTestBase.java?rev=1606944&r1=1606943&r2=1606944&view=diff
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTestBase.java
 (original)
+++ 
webservices/axiom/trunk/modules/axiom-api/src/test/java/org/apache/axiom/soap/SOAPFaultRoleTestBase.java
 Mon Jun 30 23:15:51 2014
@@ -25,8 +25,6 @@ public class SOAPFaultRoleTestBase exten
 
     protected SOAPFaultRole soap11FaultRole;
     protected SOAPFaultRole soap12FaultRole;
-    protected SOAPFaultRole soap11FaultRoleWithParser;
-    protected SOAPFaultRole soap12FaultRoleWithParser;
 
     public SOAPFaultRoleTestBase(OMMetaFactory omMetaFactory) {
         super(omMetaFactory);
@@ -36,8 +34,6 @@ public class SOAPFaultRoleTestBase exten
         super.setUp();
         soap11FaultRole = soap11Factory.createSOAPFaultRole(soap11Fault);
         soap12FaultRole = soap12Factory.createSOAPFaultRole(soap12Fault);
-        soap11FaultRoleWithParser = soap11FaultWithParser.getRole();
-        soap12FaultRoleWithParser = soap12FaultWithParser.getRole();
     }
 
     //SOAP 1.1 Fault Role Test (Programaticaly Created)
@@ -75,20 +71,4 @@ public class SOAPFaultRoleTestBase exten
                 "SOAP 1.2 Fault Role Test : - After calling setRoleValue 
method, getRoleValue method returns incorrect value",
                 soap12FaultRole.getRoleValue().trim().equals("This is only a 
test"));
     }
-
-    //SOAP 1.1 Fault Role Test (With Parser)
-    public void testSOAP11GetRoleValueWithParser() {
-        assertTrue(
-                "SOAP 1.1 Fault Role Test With Parser : - getRoleValue method 
returns incorrect value",
-                soap11FaultRoleWithParser.getRoleValue().trim().equals(
-                        
"http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver";));
-    }
-
-    //SOAP 1.2 Fault Role Test (With Parser)
-    public void testSOAP12GetRoleValueWithParser() {
-        assertTrue(
-                "SOAP 1.2 Fault Role Test With Parser : - getRoleValue method 
returns incorrect value",
-                soap12FaultRoleWithParser.getRoleValue().trim().equals(
-                        "ultimateReceiver"));
-    }
 }

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=1606944&r1=1606943&r2=1606944&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
 Mon Jun 30 23:15:51 2014
@@ -212,6 +212,7 @@ public class SOAPTestSuiteBuilder extend
         if (spec.getFaultTextQName() != null) {
             addTest(new 
org.apache.axiom.ts.soap.faulttext.TestSetLang(metaFactory, spec));
         }
+        addTest(new 
org.apache.axiom.ts.soap.faultrole.TestGetRoleValueWithParser(metaFactory, 
spec));
         addTest(new 
org.apache.axiom.ts.soap.header.TestAddHeaderBlock(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.header.TestAddHeaderBlockFromQName(metaFactory, spec));
         addTest(new 
org.apache.axiom.ts.soap.header.TestAddHeaderBlockFromQNameWithoutNamespace(metaFactory,
 spec));

Added: 
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultrole/TestGetRoleValueWithParser.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultrole/TestGetRoleValueWithParser.java?rev=1606944&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultrole/TestGetRoleValueWithParser.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultrole/TestGetRoleValueWithParser.java
 Mon Jun 30 23:15:51 2014
@@ -0,0 +1,38 @@
+/*
+ * 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.faultrole;
+
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+import org.apache.axiom.ts.soap.TestMessageAdapter;
+import org.apache.axiom.ts.soap.TestMessageSet;
+
+public class TestGetRoleValueWithParser extends SOAPTestCase {
+    public TestGetRoleValueWithParser(OMMetaFactory metaFactory, SOAPSpec 
spec) {
+        super(metaFactory, spec);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        SOAPEnvelope env = 
TestMessageSet.CUSTOM_ROLE_FAULT.getMessage(spec).getAdapter(TestMessageAdapter.class).getSOAPEnvelope(metaFactory);
+        assertEquals("http://www.example.org/gateway/cache";, 
env.getBody().getFault().getRole().getRoleValue());
+    }
+}

Propchange: 
webservices/axiom/trunk/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/faultrole/TestGetRoleValueWithParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java?rev=1606944&r1=1606943&r2=1606944&view=diff
==============================================================================
--- 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
 (original)
+++ 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/ConvertedTestMessage.java
 Mon Jun 30 23:15:51 2014
@@ -69,6 +69,10 @@ final class ConvertedTestMessage extends
     }
     
     private static void processSOAPElement(Element element, SOAPElementType 
type) {
+        if (type == SOAPFaultChild.NODE) {
+            element.getParentNode().removeChild(element);
+            return;
+        }
         QName newName = type.getQName(SOAPSpec.SOAP11);
         String prefix = element.getPrefix();
         if (newName.getNamespaceURI().isEmpty()) {

Modified: 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java?rev=1606944&r1=1606943&r2=1606944&view=diff
==============================================================================
--- 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java
 (original)
+++ 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/java/org/apache/axiom/ts/soap/TestMessageSet.java
 Mon Jun 30 23:15:51 2014
@@ -48,6 +48,16 @@ public final class TestMessageSet extend
      */
     public static final TestMessageSet SIMPLE_FAULT = new 
TestMessageSet("simple-fault");
     
+    /**
+     * A SOAP request having a header block with a custom role.
+     */
+    public static final TestMessageSet CUSTOM_ROLE_REQUEST = new 
TestMessageSet("custom-role-request");
+    
+    /**
+     * A SOAP fault response with a custom role (corresponding to {@link 
#CUSTOM_ROLE_REQUEST}).
+     */
+    public static final TestMessageSet CUSTOM_ROLE_FAULT = new 
TestMessageSet("custom-role-fault");
+    
     private final TestMessage soap11Message;
     private final TestMessage soap12Message;
     

Added: 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-fault.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-fault.xml?rev=1606944&view=auto
==============================================================================
--- 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-fault.xml
 (added)
+++ 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-fault.xml
 Mon Jun 30 23:15:51 2014
@@ -0,0 +1,14 @@
+<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope";>
+    <s:Body>
+        <s:Fault>
+            <s:Code>
+                <s:Value>s:Receiver</s:Value>
+            </s:Code>
+            <s:Reason>
+                <s:Text xml:lang="en">The backend service is unavailable and 
no cached response was found</s:Text>
+            </s:Reason>
+            <s:Node>http://gateway.corp.example.org/</s:Node>
+            <s:Role>http://www.example.org/gateway/cache</s:Role>
+        </s:Fault>
+    </s:Body>
+</s:Envelope>

Propchange: 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-fault.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-request.xml
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-request.xml?rev=1606944&view=auto
==============================================================================
--- 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-request.xml
 (added)
+++ 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-request.xml
 Mon Jun 30 23:15:51 2014
@@ -0,0 +1,13 @@
+<SOAP:Envelope xmlns:SOAP="http://www.w3.org/2003/05/soap-envelope";>
+    <SOAP:Header>
+        <CachePolicy xmlns="http://www.example.org/cache-policy"; 
SOAP:role="http://www.example.org/gateway/cache"; SOAP:mustUnderstand="true">
+            <RequestETag>686897696a7c876b7e</RequestETag>
+            <MaxAge>3600</MaxAge>
+        </CachePolicy>
+    </SOAP:Header>
+    <SOAP:Body>
+        <Lookup xmlns="http://www.acme.co.uk/postcode-lookup";>
+            <Postcode>SW1A 1AA</Postcode>
+        </Lookup>
+    </SOAP:Body>
+</SOAP:Envelope>

Propchange: 
webservices/axiom/trunk/testsuites/soap-testsuite/src/main/resources/test-message/set/custom-role-request.xml
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to