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/03 22:38:05 UTC

svn commit: r1356922 - 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/soap/env...

Author: veithen
Date: Tue Jul  3 20:38:03 2012
New Revision: 1356922

URL: http://svn.apache.org/viewvc?rev=1356922&view=rev
Log:
AXIOM-311: Refactored the test case for WSCOMMONS-303.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestHasFaultWithParserOptimized.java   (with props)
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/XMLStreamReaderWithQName.java
      - copied, changed from r1353106, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/XMLStreamReaderWithQName.java
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/
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=1356922&r1=1356921&r2=1356922&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 20:38:03 2012
@@ -103,6 +103,7 @@ 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));
         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));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestHasFaultWithParserOptimized.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestHasFaultWithParserOptimized.java?rev=1356922&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestHasFaultWithParserOptimized.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestHasFaultWithParserOptimized.java Tue Jul  3 20:38:03 2012
@@ -0,0 +1,59 @@
+/*
+ * 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.soap.envelope;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.AbstractTestCase;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPModelBuilder;
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
+
+public class TestHasFaultWithParserOptimized extends SOAPTestCase {
+    public TestHasFaultWithParserOptimized(OMMetaFactory metaFactory, SOAPSpec spec) {
+        super(metaFactory, spec);
+    }
+
+    protected void runTest() throws Throwable {
+        // Use the test parser that is aware of the first qname in the body.
+        // This simulates the use of the parser that has this information built into its
+        // implementation.
+        
+        XMLStreamReader soap11Parser = StAXUtils.createXMLStreamReader(
+                AbstractTestCase.getTestResource("soap/" + spec.getName() + "/" + MESSAGE), null);
+        QName qname = new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.BODY_FAULT_LOCAL_NAME, "SOAP-ENV");
+        XMLStreamReaderWithQName parser = new XMLStreamReaderWithQName(soap11Parser, qname);
+        SOAPModelBuilder soap11Builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(metaFactory, parser);
+        SOAPEnvelope env = soap11Builder.getSOAPEnvelope();
+        assertTrue(env.hasFault());
+        assertTrue(!parser.isReadBody());
+        
+        // Get the name of the first element in the body
+        String localName = env.getSOAPBodyFirstElementLocalName();
+        assertTrue(localName.equals("Fault"));
+        assertTrue(!parser.isReadBody());
+        parser.close();
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestHasFaultWithParserOptimized.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/XMLStreamReaderWithQName.java (from r1353106, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/XMLStreamReaderWithQName.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/XMLStreamReaderWithQName.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/XMLStreamReaderWithQName.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/XMLStreamReaderWithQName.java&r1=1353106&r2=1356922&rev=1356922&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/soap/impl/builder/XMLStreamReaderWithQName.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/XMLStreamReaderWithQName.java Tue Jul  3 20:38:03 2012
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axiom.soap.impl.builder;
+package org.apache.axiom.ts.soap.envelope;
 
 import org.apache.axiom.soap.SOAPConstants;