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/02/27 23:57:39 UTC

svn commit: r1294381 - in /webservices/commons/trunk/modules/axiom/modules: axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/ axiom-tests/src/test/java/org/apache/axiom/xpath/ axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/ axiom-testsuit...

Author: veithen
Date: Mon Feb 27 22:57:38 2012
New Revision: 1294381

URL: http://svn.apache.org/viewvc?rev=1294381&view=rev
Log:
AXIOM-311: Moved the regression test for AXIOM-141 to the new test suite.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/xpath/
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/xpath/TestXPathAppliedToSOAPEnvelope.java
      - copied, changed from r1294355, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java
Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.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-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java?rev=1294381&r1=1294380&r2=1294381&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/soap/impl/dom/SOAPImplementationTest.java Mon Feb 27 22:57:38 2012
@@ -26,6 +26,7 @@ import org.apache.axiom.ts.soap.SOAPTest
 import org.apache.axiom.ts.soap.factory.TestGetDefaultFaultEnvelope;
 import org.apache.axiom.ts.soap.faultdetail.TestWSCommons202;
 import org.apache.axiom.ts.soap.faulttext.TestSetLang;
+import org.apache.axiom.ts.soap.xpath.TestXPathAppliedToSOAPEnvelope;
 import org.apache.axiom.ts.soap12.fault.TestMoreChildrenAddition;
 import org.apache.axiom.ts.soap12.faultcode.TestSetValueFromQNameWithExistingValue;
 
@@ -46,6 +47,10 @@ public class SOAPImplementationTest exte
         builder.exclude(org.apache.axiom.ts.soap12.faultcode.TestSetValueFromQName.class);
         builder.exclude(TestSetValueFromQNameWithExistingValue.class);
         
+        // TODO: fails because DOOM's factories are not stateless
+        //       (and createOMDocument doesn't create a new document in this case)
+        builder.exclude(TestXPathAppliedToSOAPEnvelope.class, "(createDocument=true)");
+        
         return builder.build();
     }
 }

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=1294381&r1=1294380&r2=1294381&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 Mon Feb 27 22:57:38 2012
@@ -92,6 +92,8 @@ public class SOAPTestSuiteBuilder extend
         addTest(new org.apache.axiom.ts.soap.headerblock.TestSetMustUnderstandString01(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.headerblock.TestSetMustUnderstandWithInvalidValue(metaFactory, spec));
         addTest(new org.apache.axiom.ts.soap.headerblock.TestSetRole(metaFactory, spec));
+        addTest(new org.apache.axiom.ts.soap.xpath.TestXPathAppliedToSOAPEnvelope(metaFactory, spec, true));
+        addTest(new org.apache.axiom.ts.soap.xpath.TestXPathAppliedToSOAPEnvelope(metaFactory, spec, false));
     }
     
     protected void addTests() {

Copied: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/xpath/TestXPathAppliedToSOAPEnvelope.java (from r1294355, webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java)
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/xpath/TestXPathAppliedToSOAPEnvelope.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/xpath/TestXPathAppliedToSOAPEnvelope.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java&r1=1294355&r2=1294381&rev=1294381&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-tests/src/test/java/org/apache/axiom/xpath/XPathAppliedToSOAPEnvelopeTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/xpath/TestXPathAppliedToSOAPEnvelope.java Mon Feb 27 22:57:38 2012
@@ -16,62 +16,46 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+package org.apache.axiom.ts.soap.xpath;
 
-package org.apache.axiom.xpath;
-
-import junit.framework.TestCase;
-import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.xpath.AXIOMXPath;
 import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-
-public class XPathAppliedToSOAPEnvelopeTest extends TestCase {
-
-    public void testDocumentNotAdded() throws Exception {
-        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
-
-        OMElement elem1 = factory.createOMElement("elem1", null);
-        OMElement elem2 = factory.createOMElement("elem2", null);
-        OMElement elem3 = factory.createOMElement("elem3", null);
-        elem2.addChild(elem3);
-        elem1.addChild(elem2);
-        SOAPEnvelope envelope = factory.getDefaultEnvelope();
-        envelope.getBody().addChild(elem1);
-
-        //The only difference of the two test methods is the following line.
-//		factory.createOMDocument().addChild(envelope);
-
-        String XPathString = "//elem1";
-
-        AXIOMXPath XPath = new AXIOMXPath(XPathString);
-        OMNode node = (OMNode) XPath.selectSingleNode(envelope);
-
+import org.apache.axiom.ts.soap.SOAPSpec;
+import org.apache.axiom.ts.soap.SOAPTestCase;
 
-        assertNotNull(node);
+/**
+ * Regression test for <a href="https://issues.apache.org/jira/browse/AXIOM-141">AXIOM-141</a>.
+ */
+public class TestXPathAppliedToSOAPEnvelope extends SOAPTestCase {
+    private boolean createDocument;
+    
+    public TestXPathAppliedToSOAPEnvelope(OMMetaFactory metaFactory, SOAPSpec spec, boolean createDocument) {
+        super(metaFactory, spec);
+        this.createDocument = createDocument;
+        addTestProperty("createDocument", String.valueOf(createDocument));
     }
 
-    public void testDocumentAdded() throws Exception {
-        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
-
-        OMElement elem1 = factory.createOMElement("elem1", null);
-        OMElement elem2 = factory.createOMElement("elem2", null);
-        OMElement elem3 = factory.createOMElement("elem3", null);
+    protected void runTest() throws Throwable {
+        OMElement elem1 = soapFactory.createOMElement("elem1", null);
+        OMElement elem2 = soapFactory.createOMElement("elem2", null);
+        OMElement elem3 = soapFactory.createOMElement("elem3", null);
         elem2.addChild(elem3);
         elem1.addChild(elem2);
-        SOAPEnvelope envelope = factory.getDefaultEnvelope();
+        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
         envelope.getBody().addChild(elem1);
 
-        //The only difference of the two test methods is the following line.
-        factory.createOMDocument().addChild(envelope);
+        if (createDocument) {
+            soapFactory.createOMDocument().addChild(envelope);
+        }
 
         String XPathString = "//elem1";
 
         AXIOMXPath XPath = new AXIOMXPath(XPathString);
         OMNode node = (OMNode) XPath.selectSingleNode(envelope);
 
-
         assertNotNull(node);
     }
 }