axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidills...@apache.org
Subject svn commit: r501053 - in /webservices/axis2/trunk/java/modules/addressing: test-resources/fault-messages/ test-resources/fault-messages/soap11/ test-resources/fault-messages/soap12/ test/org/apache/axis2/handlers/addressing/
Date Mon, 29 Jan 2007 14:00:29 GMT
Author: davidillsley
Date: Mon Jan 29 06:00:28 2007
New Revision: 501053

URL: http://svn.apache.org/viewvc?view=rev&rev=501053
Log:
Tests for AXIS2-2039

Added:
    webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/
    webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/
    webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/InvalidAddressingHeader.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/MessageAddressingHeaderRequired.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/
    webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/InvalidAddressingHeader.xml
    webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/MessageAddressingHeaderRequired.xml
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/InvalidAddressingHeader.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/InvalidAddressingHeader.xml?view=auto&rev=501053
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/InvalidAddressingHeader.xml
(added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/InvalidAddressingHeader.xml
Mon Jan 29 06:00:28 2007
@@ -0,0 +1,20 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+  <soapenv:Header>
+    <wsa:FaultDetail xmlns:wsa="http://www.w3.org/2005/08/addressing">
+      <wsa:ProblemHeaderQName>wsa:To</wsa:ProblemHeaderQName>
+
+    </wsa:FaultDetail>
+    <wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
+    <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/fault</wsa:Action>
+    <wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:D1C0B91E-0109-4000-E000-02ACC0A8015E</wsa:MessageID>
+    <wsa:RelatesTo xmlns:wsa="http://www.w3.org/2005/08/addressing">urn:uuid:9a35afc8-7be6-4a41-ba64-92a44f73a3d7</wsa:RelatesTo>
+  </soapenv:Header>
+  <soapenv:Body>
+
+    <soapenv:Fault>
+      <faultcode>wsa:InvalidAddressingHeader</faultcode>
+      <faultstring><![CDATA[A header representing a Message Addressing Property
is not valid and the message cannot be processed]]></faultstring>
+    </soapenv:Fault>
+  </soapenv:Body>
+</soapenv:Envelope>
+

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/MessageAddressingHeaderRequired.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/MessageAddressingHeaderRequired.xml?view=auto&rev=501053
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/MessageAddressingHeaderRequired.xml
(added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap11/MessageAddressingHeaderRequired.xml
Mon Jan 29 06:00:28 2007
@@ -0,0 +1,19 @@
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+  <soapenv:Header>
+
+    <wsa:FaultDetail xmlns:wsa="http://www.w3.org/2005/08/addressing">
+      <wsa:ProblemHeaderQName>wsa:Action</wsa:ProblemHeaderQName>
+    </wsa:FaultDetail>
+    <wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
+    <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/fault</wsa:Action>
+    <wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:D1C0C3DF-0109-4000-E000-02ACC0A8015E</wsa:MessageID>
+    <wsa:RelatesTo xmlns:wsa="http://www.w3.org/2005/08/addressing">urn:uuid:32119abf-94c4-48e0-bda5-3daaaa90771e</wsa:RelatesTo>
+
+  </soapenv:Header>
+  <soapenv:Body>
+    <soapenv:Fault>
+      <faultcode>wsa:MessageAddressingHeaderRequired</faultcode>
+      <faultstring><![CDATA[A required header representing a Message Addressing
Property is not present]]></faultstring>
+    </soapenv:Fault>
+  </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/InvalidAddressingHeader.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/InvalidAddressingHeader.xml?view=auto&rev=501053
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/InvalidAddressingHeader.xml
(added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/InvalidAddressingHeader.xml
Mon Jan 29 06:00:28 2007
@@ -0,0 +1,27 @@
+<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+  <soapenv:Header>
+    <wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
+
+    <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/fault</wsa:Action>
+    <wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:D1C0C55C-0109-4000-E000-02ACC0A8015E</wsa:MessageID>
+    <wsa:RelatesTo xmlns:wsa="http://www.w3.org/2005/08/addressing">urn:uuid:53eb42ea-b3e5-4e47-991a-61223652e6c8</wsa:RelatesTo>
+  </soapenv:Header>
+  <soapenv:Body>
+    <soapenv:Fault>
+      <soapenv:Code>
+
+        <soapenv:Value>soapenv:Sender</soapenv:Value>
+        <soapenv:Subcode>
+          <soapenv:Value>wsa:InvalidAddressingHeader</soapenv:Value>
+        </soapenv:Subcode>
+      </soapenv:Code>
+      <soapenv:Reason>
+        <soapenv:Text xml:lang="en-US"><![CDATA[A header representing a Message
Addressing Property is not valid and the message cannot be processed]]></soapenv:Text>
+      </soapenv:Reason>
+
+      <soapenv:Detail>
+        <wsa:ProblemHeaderQName>wsa:To</wsa:ProblemHeaderQName>
+      </soapenv:Detail>
+    </soapenv:Fault>
+  </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/MessageAddressingHeaderRequired.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/MessageAddressingHeaderRequired.xml?view=auto&rev=501053
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/MessageAddressingHeaderRequired.xml
(added)
+++ webservices/axis2/trunk/java/modules/addressing/test-resources/fault-messages/soap12/MessageAddressingHeaderRequired.xml
Mon Jan 29 06:00:28 2007
@@ -0,0 +1,27 @@
+<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+  <soapenv:Header>
+    <wsa:To xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</wsa:To>
+
+    <wsa:Action xmlns:wsa="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/fault</wsa:Action>
+    <wsa:MessageID xmlns:wsa="http://www.w3.org/2005/08/addressing">uuid:D1C0CE6F-0109-4000-E000-02ACC0A8015E</wsa:MessageID>
+    <wsa:RelatesTo xmlns:wsa="http://www.w3.org/2005/08/addressing">urn:uuid:c96e0172-c25e-4a6e-a90d-a1fe93e141f0</wsa:RelatesTo>
+  </soapenv:Header>
+  <soapenv:Body>
+    <soapenv:Fault>
+      <soapenv:Code>
+
+        <soapenv:Value>soapenv:Sender</soapenv:Value>
+        <soapenv:Subcode>
+          <soapenv:Value>wsa:InvalidAddressingHeader</soapenv:Value>
+        </soapenv:Subcode>
+      </soapenv:Code>
+      <soapenv:Reason>
+        <soapenv:Text xml:lang="en-US"><![CDATA[A header representing a Message
Addressing Property is not valid and the message cannot be processed]]></soapenv:Text>
+      </soapenv:Reason>
+
+      <soapenv:Detail>
+        <wsa:ProblemHeaderQName>wsa:To</wsa:ProblemHeaderQName>
+      </soapenv:Detail>
+    </soapenv:Fault>
+  </soapenv:Body>
+</soapenv:Envelope>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java?view=auto&rev=501053
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
(added)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
Mon Jan 29 06:00:28 2007
@@ -0,0 +1,73 @@
+/*
+ * Licensed 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.axis2.handlers.addressing;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.util.TestUtil;
+
+public class AddressingInFaultHandlerTest extends TestCase {
+
+    TestUtil testUtil = new TestUtil();
+ 
+    /**
+     * @param testName
+     */
+    public AddressingInFaultHandlerTest(String testName) {
+        super(testName);
+    }
+
+    public void testInvalidAddressingHeaderWsaToSOAP11() throws Exception{
+        AxisFault af = getFaultForTest("InvalidAddressingHeader", true);
+        assertNotNull(af);
+        assertEquals("The server failed to process the WS-Addressing header: "+"wsa:To"+"
[Reason]: A header representing a Message Addressing Property is not valid and the message
cannot be processed", af.getMessage());
+    }
+    
+    public void testMissingActionSOAP11() throws Exception{
+        AxisFault af = getFaultForTest("MessageAddressingHeaderRequired", true);
+        assertNotNull(af);
+    }
+    
+    public void testInvalidAddressingHeaderWsaToSOAP12() throws Exception{
+        AxisFault af = getFaultForTest("InvalidAddressingHeader", false);
+        assertNotNull(af);
+        assertEquals("The server failed to process the WS-Addressing header: "+"wsa:To"+"
[Reason]: A header representing a Message Addressing Property is not valid and the message
cannot be processed", af.getMessage());
+    }
+    
+    public void testMissingActionSOAP12() throws Exception{
+        AxisFault af = getFaultForTest("MessageAddressingHeaderRequired", false);
+        assertNotNull(af);
+    }
+    
+    private AxisFault getFaultForTest(String testName, boolean isSOAP11) throws Exception{
+        String testfile = "fault-messages/"+(isSOAP11?"soap11":"soap12")+"/"+testName+".xml";
+        StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testfile);
+        SOAPEnvelope envelope = ((SOAPEnvelope) omBuilder.getDocumentElement());
+        MessageContext msgContext = new MessageContext();
+        msgContext.setEnvelope(envelope);
+        AddressingFinalInHandler afih = new AddressingFinalInHandler();
+        afih.invoke(msgContext);
+        AddressingInFaultHandler aifh = new AddressingInFaultHandler();
+        aifh.invoke(msgContext);
+        
+        return (AxisFault)msgContext.getProperty(Constants.INBOUND_FAULT_OVERRIDE);
+    }
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message