You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/07/04 00:35:18 UTC

svn commit: r1356994 - in /webservices/commons/trunk/modules/axiom/modules: axiom-tests/src/test/java/org/apache/axiom/om/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/

Author: veithen
Date: Tue Jul  3 22:35:17 2012
New Revision: 1356994

URL: http://svn.apache.org/viewvc?rev=1356994&view=rev
Log:
AXIOM-311: Refactored regression test for WSCOMMONS-226.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestSerializeAndConsumeWithOMSEInBody.java
      - copied, changed from r1356953, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SourcedOMElementTest.java
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SourcedOMElementTest.java
Modified:
    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-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=1356994&r1=1356993&r2=1356994&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 Jul  3 22:35:17 2012
@@ -106,6 +106,9 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.envelope.TestHasFault(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.envelope.TestHasFaultWithParser(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.envelope.TestHasFaultWithParserOptimized(metaFactory, spec));
+        if (supportsOMSourcedElement) {
+            addTest(new org.apache.axiom.ts.soap.envelope.TestSerializeAndConsumeWithOMSEInBody(metaFactory, spec));
+        }
         addTest(new org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelope(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.factory.TestCreateSOAPEnvelopeWithCustomPrefix(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.factory.TestCreateSOAPFault(metaFactory, spec));

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestSerializeAndConsumeWithOMSEInBody.java (from r1356953, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SourcedOMElementTest.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestSerializeAndConsumeWithOMSEInBody.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestSerializeAndConsumeWithOMSEInBody.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SourcedOMElementTest.java&r1=1356953&r2=1356994&rev=1356994&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/om/SourcedOMElementTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestSerializeAndConsumeWithOMSEInBody.java Tue Jul  3 22:35:17 2012
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axiom.om;
+package org.apache.axiom.ts.soap.envelope;
 
 import java.io.OutputStream;
 import java.io.StringReader;
@@ -28,28 +28,31 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.SOAPBody;
 import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
 
+/**
+ * Regression test for WSCOMMONS-226.
+ */
+public class TestSerializeAndConsumeWithOMSEInBody extends SOAPTestCase {
+    public TestSerializeAndConsumeWithOMSEInBody(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
 
-public class SourcedOMElementTest extends TestCase {
-    
-    public void testSerialization() throws Exception {
-        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
-        SOAPEnvelope envelope = factory.createSOAPEnvelope();
-        SOAPBody body = factory.createSOAPBody();
+    protected void runTest() throws Throwable {
+        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
+        SOAPBody body = soapFactory.createSOAPBody();
         envelope.addChild(body);
-        OMNamespace ns = factory.createOMNamespace("http://ns1", "d");
-        OMElement payload = factory.createOMElement(new DummySource(), "dummy", ns);
+        OMNamespace ns = soapFactory.createOMNamespace("http://ns1", "d");
+        OMElement payload = soapFactory.createOMElement(new DummySource(), "dummy", ns);
         payload.setNamespace(ns); // This line will cause NoSuchElementException
         body.addChild(payload);
         payload.getBuilder().setCache(false); // Or This line will cause NoSuchElementException