You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/01/28 23:10:52 UTC

svn commit: r1237170 - in /axis/axis1/java/trunk/axis/src/test: java/test/message/TestSOAPFault.java resources/test/message/ resources/test/message/AXIS-1008.xml

Author: veithen
Date: Sat Jan 28 22:10:52 2012
New Revision: 1237170

URL: http://svn.apache.org/viewvc?rev=1237170&view=rev
Log:
Externalized the test data for AXIS-1008.

Added:
    axis/axis1/java/trunk/axis/src/test/resources/test/message/
    axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-1008.xml   (with props)
Modified:
    axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java

Modified: axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java?rev=1237170&r1=1237169&r2=1237170&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java (original)
+++ axis/axis1/java/trunk/axis/src/test/java/test/message/TestSOAPFault.java Sat Jan 28 22:10:52 2012
@@ -22,7 +22,7 @@ import junit.framework.TestSuite;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
-import java.io.ByteArrayInputStream;
+import java.io.InputStream;
 
 /**
  * @author steve.johnson@riskmetrics.com (Steve Johnson)
@@ -47,7 +47,7 @@ public class TestSOAPFault extends TestC
      */
     public static void main(String[] argv) throws Exception {
         TestSOAPFault tester = new TestSOAPFault("TestSOAPFault");
-        tester.testSoapFaultBUG();
+        tester.testAxis1008();
     }
 
     /**
@@ -59,34 +59,25 @@ public class TestSOAPFault extends TestC
         super(name);
     }
 
-    String xmlString =
-            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-            "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
-            "<soapenv:Body>" +
-            "<soapenv:Fault>" +
-            "<faultcode>soapenv:13001</faultcode>" +
-            "<faultstring>java.lang.Exception: File already exists</faultstring>" +
-            "<faultactor>urn:RiskMetricsDirect:1.0:object-service-service:CreateObject</faultactor>" +
-            "<detail/>" +
-            "</soapenv:Fault>" +
-            "</soapenv:Body>" +
-            "</soapenv:Envelope>";
-
     /**
-     * Method testSoapFaultBUG
+     * Regression test for AXIS-1008.
      * 
      * @throws Exception 
      */
-    public void testSoapFaultBUG() throws Exception {
-        ByteArrayInputStream bis = new ByteArrayInputStream(xmlString.getBytes());
-        MessageFactory msgFactory = MessageFactory.newInstance();
-        SOAPMessage msg = msgFactory.createMessage(null, bis);
-			
-        //now attempt to access the fault
-        if (msg.getSOAPPart().getEnvelope().getBody().hasFault()) {
-            SOAPFault fault =
-                    msg.getSOAPPart().getEnvelope().getBody().getFault();
-            System.out.println("Fault: " + fault.getFaultString());
+    public void testAxis1008() throws Exception {
+        InputStream in = TestSOAPFault.class.getResourceAsStream("AXIS-1008.xml");
+        try {
+            MessageFactory msgFactory = MessageFactory.newInstance();
+            SOAPMessage msg = msgFactory.createMessage(null, in);
+    			
+            //now attempt to access the fault
+            if (msg.getSOAPPart().getEnvelope().getBody().hasFault()) {
+                SOAPFault fault =
+                        msg.getSOAPPart().getEnvelope().getBody().getFault();
+                System.out.println("Fault: " + fault.getFaultString());
+            }
+        } finally {
+            in.close();
         }
     }
 }    
\ No newline at end of file

Added: axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-1008.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-1008.xml?rev=1237170&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-1008.xml (added)
+++ axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-1008.xml Sat Jan 28 22:10:52 2012
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:13001</faultcode><faultstring>java.lang.Exception: File already exists</faultstring><faultactor>urn:RiskMetricsDirect:1.0:object-service-service:CreateObject</faultactor><detail/></soapenv:Fault></soapenv:Body></soapenv:Envelope>
\ No newline at end of file

Propchange: axis/axis1/java/trunk/axis/src/test/resources/test/message/AXIS-1008.xml
------------------------------------------------------------------------------
    svn:eol-style = native