You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by di...@apache.org on 2007/04/25 16:14:25 UTC

svn commit: r532361 - /webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java

Author: dims
Date: Wed Apr 25 07:14:25 2007
New Revision: 532361

URL: http://svn.apache.org/viewvc?view=rev&rev=532361
Log:
add a test to check axiom builds soap fault properly and check if serialization matches the input as well

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java?view=diff&rev=532361&r1=532360&r2=532361
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java Wed Apr 25 07:14:25 2007
@@ -36,6 +36,8 @@
 import org.apache.axiom.soap.SOAPFaultValue;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.custommonkey.xmlunit.XMLTestCase;
+import org.custommonkey.xmlunit.XMLUnit;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
@@ -43,7 +45,7 @@
 import java.io.StringReader;
 import java.util.Iterator;
 
-public class StAXSOAPModelBuilderTest extends TestCase {
+public class StAXSOAPModelBuilderTest extends XMLTestCase {
 
     public void setUp() {
 
@@ -597,5 +599,27 @@
             }
             fail("Successfully parsed bad envelope ('" + badHeaders[i] + "')");
         }
+    }
+
+    public void testFault() throws Exception {
+        String soap11Fault = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+                "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+                    "<SOAP-ENV:Body>" +
+                    "<SOAP-ENV:Fault>" +
+                        "<faultcode>SOAP-ENV:Server</faultcode>" +
+                        "<faultstring xml:lang=\"en\">handleMessage throws SOAPFaultException for ThrowsSOAPFaultToClientHandlersTest</faultstring>" +
+                        "<detail>" +
+                            "<somefaultentry/>" +
+                        "</detail>" +
+                        "<faultactor>faultActor</faultactor>" +
+                        "</SOAP-ENV:Fault>" +
+                    "</SOAP-ENV:Body>" +
+                "</SOAP-ENV:Envelope>";
+        XMLStreamReader soap11Parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(new StringReader(soap11Fault));
+        StAXSOAPModelBuilder soap11Builder = new StAXSOAPModelBuilder(soap11Parser, null);
+        OMElement element = soap11Builder.getDocumentElement();
+        element.build();
+        this.assertXMLEqual(soap11Fault, element.toString());
     }
 }



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