ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1294851 - in /webservices/commons/trunk/modules/axiom/modules: axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/f...
Date Tue, 28 Feb 2012 22:00:37 GMT
Author: veithen
Date: Tue Feb 28 22:00:37 2012
New Revision: 1294851

URL: http://svn.apache.org/viewvc?rev=1294851&view=rev
Log:
AXIOM-311: Migrated the test case for WSCOMMONS-367 to the new test suite. Also fixed the
test case so that it actually tests what it is expected to test (by configuring the parser
to report CDATA sections).

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
  (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilderTest.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.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?rev=1294851&r1=1294850&r2=1294851&view=diff
==============================================================================
--- 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
Tue Feb 28 22:00:37 2012
@@ -671,31 +671,4 @@ public class StAXSOAPModelBuilderTest ex
         this.assertTrue(!parser.isReadBody());
         parser.close();
     }
-    
-    public void testFaultWithCDATA() 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\"><![CDATA[handleMessage throws
SOAPFaultException for ThrowsSOAPFaultToClientHandlersTest]]></faultstring>" +
-                        "<detail>" +
-                            "<somefaultentry/>" +
-                        "</detail>" +
-                        "<faultactor>faultActor</faultactor>" +
-                        "</SOAP-ENV:Fault>" +
-                    "</SOAP-ENV:Body>" +
-                "</SOAP-ENV:Envelope>";
-        XMLStreamReader soap11Parser = StAXUtils.createXMLStreamReader(
-                new StringReader(soap11Fault));
-        StAXSOAPModelBuilder soap11Builder = new StAXSOAPModelBuilder(soap11Parser, null);
-        OMElement element = soap11Builder.getDocumentElement();
-        element.build();
-        assertTrue(element instanceof SOAPEnvelope);
-        SOAPEnvelope se =  (SOAPEnvelope) element;
-        SOAPFault fault = se.getBody().getFault();
-        SOAPFaultReason reason = fault.getReason();
-        assertTrue(reason.getText().equals("handleMessage throws SOAPFaultException for ThrowsSOAPFaultToClientHandlersTest"));
-        soap11Parser.close();
-    }
 }

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1294851&r1=1294850&r2=1294851&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
Tue Feb 28 22:00:37 2012
@@ -109,6 +109,7 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap11.faultcode.TestSetValueFromQName(metaFactory));
         addTest(new org.apache.axiom.ts.soap11.faultreason.TestAddSOAPText(metaFactory));
         addTest(new org.apache.axiom.ts.soap11.faultreason.TestGetFirstSOAPText(metaFactory));
+        addTest(new org.apache.axiom.ts.soap11.faultreason.TestGetTextWithCDATA(metaFactory));
         addTest(new org.apache.axiom.ts.soap11.header.TestExamineAllHeaderBlocksWithParser(metaFactory));
         addTest(new org.apache.axiom.ts.soap11.header.TestExamineHeaderBlocksWithParser(metaFactory));
         addTest(new org.apache.axiom.ts.soap11.header.TestExamineMustUnderstandHeaderBlocksWithParser(metaFactory));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java?rev=1294851&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
(added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
Tue Feb 28 22:00:37 2012
@@ -0,0 +1,68 @@
+/*
+ * 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.soap11.faultreason;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.util.StAXParserConfiguration;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPModelBuilder;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestGetTextWithCDATA extends SOAPTestCase {
+    public TestGetTextWithCDATA(OMMetaFactory metaFactory) {
+        super(metaFactory, SOAPSpec.SOAP11);
+    }
+
+    protected void runTest() throws Throwable {
+        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\"><![CDATA[handleMessage throws
SOAPFaultException for ThrowsSOAPFaultToClientHandlersTest]]></faultstring>" +
+                        "<detail>" +
+                            "<somefaultentry/>" +
+                        "</detail>" +
+                        "<faultactor>faultActor</faultactor>" +
+                        "</SOAP-ENV:Fault>" +
+                    "</SOAP-ENV:Body>" +
+                "</SOAP-ENV:Envelope>";
+        XMLStreamReader soap11Parser = StAXUtils.createXMLStreamReader(
+                StAXParserConfiguration.PRESERVE_CDATA_SECTIONS, new StringReader(soap11Fault));
+        SOAPModelBuilder soap11Builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(metaFactory,
soap11Parser);
+        OMElement element = soap11Builder.getDocumentElement();
+        element.build();
+        assertTrue(element instanceof SOAPEnvelope);
+        SOAPEnvelope se =  (SOAPEnvelope) element;
+        SOAPFault fault = se.getBody().getFault();
+        SOAPFaultReason reason = fault.getReason();
+        assertTrue(reason.getText().equals("handleMessage throws SOAPFaultException for ThrowsSOAPFaultToClientHandlersTest"));
+        soap11Parser.close();
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap11/faultreason/TestGetTextWithCDATA.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message