ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1719667 - in /webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element: TestGetChildrenWithLocalName.java TestGetChildrenWithName.java
Date Sat, 12 Dec 2015 12:14:37 GMT
Author: veithen
Date: Sat Dec 12 12:14:37 2015
New Revision: 1719667

URL: http://svn.apache.org/viewvc?rev=1719667&view=rev
Log:
AXIOM-311: Rewrite some test cases so that they don't use AbstractTestCase.

Modified:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithLocalName.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithName.java

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithLocalName.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithLocalName.java?rev=1719667&r1=1719666&r2=1719667&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithLocalName.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithLocalName.java
Sat Dec 12 12:14:37 2015
@@ -18,16 +18,17 @@
  */
 package org.apache.axiom.ts.om.element;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
 
-import org.apache.axiom.om.AbstractTestCase;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMMetaFactory;
-import org.apache.axiom.om.TestConstants;
-import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.ts.xml.XMLSample;
 
 public class TestGetChildrenWithLocalName extends AxiomTestCase {
     public TestGetChildrenWithLocalName(OMMetaFactory metaFactory) {
@@ -35,13 +36,13 @@ public class TestGetChildrenWithLocalNam
     }
 
     protected void runTest() throws Throwable {
-        OMElement elt = AbstractTestCase.getTestResourceAsElement(metaFactory, TestConstants.SOAP_SOAPMESSAGE1);
-        Iterator it = elt.getChildrenWithLocalName(SOAP11Constants.BODY_LOCAL_NAME);
-        assertTrue(it.hasNext());
+        OMElement elt = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
+                XMLSample.SIMPLE.getInputStream()).getDocumentElement().getFirstElement();
+        Iterator it = elt.getChildrenWithLocalName("subelement");
+        assertThat(it.hasNext()).isTrue();
         OMElement child = (OMElement)it.next();
-        assertEquals(new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
-                SOAP11Constants.BODY_LOCAL_NAME), child.getQName());
-        assertFalse(it.hasNext());
+        assertThat(child.getQName()).isEqualTo(new QName("urn:ns2", "subelement"));
+        assertThat(it.hasNext()).isFalse();
         elt.close(false);
     }
 }

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithName.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithName.java?rev=1719667&r1=1719666&r2=1719667&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithName.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetChildrenWithName.java
Sat Dec 12 12:14:37 2015
@@ -22,13 +22,12 @@ import java.util.Iterator;
 
 import javax.xml.namespace.QName;
 
-import org.apache.axiom.om.AbstractTestCase;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.TestConstants;
-import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.ts.AxiomTestCase;
+import org.apache.axiom.ts.xml.XMLSample;
 
 /** Test the element iterator */
 public class TestGetChildrenWithName extends AxiomTestCase {
@@ -37,9 +36,9 @@ public class TestGetChildrenWithName ext
     }
 
     protected void runTest() throws Throwable {
-        OMElement elt = AbstractTestCase.getTestResourceAsElement(metaFactory, TestConstants.SOAP_SOAPMESSAGE1);
-        QName qname = new QName(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
-                                SOAP11Constants.BODY_LOCAL_NAME);
+        OMElement elt = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
+                XMLSample.SIMPLE.getInputStream()).getDocumentElement().getFirstElement();
+        QName qname = new QName("urn:ns2", "subelement");
         Iterator iter = elt.getChildrenWithName(qname);
         int counter = 0;
         while (iter.hasNext()) {



Mime
View raw message