ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1685888 - in /webservices/axiom/branches/attrs-aspects: ./ testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetAllDeclaredNamespacesRemove.java
Date Tue, 16 Jun 2015 18:31:40 GMT
Author: veithen
Date: Tue Jun 16 18:31:40 2015
New Revision: 1685888

URL: http://svn.apache.org/r1685888
Log:
Merge latest changes from trunk.

Modified:
    webservices/axiom/branches/attrs-aspects/   (props changed)
    webservices/axiom/branches/attrs-aspects/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetAllDeclaredNamespacesRemove.java

Propchange: webservices/axiom/branches/attrs-aspects/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 16 18:31:40 2015
@@ -10,4 +10,4 @@
 /webservices/axiom/branches/JAXB2_DS:1366463-1367737
 /webservices/axiom/branches/namespaceURIInterning:1293148-1293587
 /webservices/axiom/branches/osgi-redesign:1180368-1180596
-/webservices/axiom/trunk:1685218-1685881
+/webservices/axiom/trunk:1685218-1685887

Modified: webservices/axiom/branches/attrs-aspects/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetAllDeclaredNamespacesRemove.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/attrs-aspects/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetAllDeclaredNamespacesRemove.java?rev=1685888&r1=1685887&r2=1685888&view=diff
==============================================================================
--- webservices/axiom/branches/attrs-aspects/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetAllDeclaredNamespacesRemove.java
(original)
+++ webservices/axiom/branches/attrs-aspects/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetAllDeclaredNamespacesRemove.java
Tue Jun 16 18:31:40 2015
@@ -18,7 +18,13 @@
  */
 package org.apache.axiom.ts.om.element;
 
+import static org.apache.axiom.truth.AxiomTestVerb.ASSERT;
+
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
@@ -37,19 +43,31 @@ public class TestGetAllDeclaredNamespace
 
     protected void runTest() throws Throwable {
         OMFactory factory = metaFactory.getOMFactory();
-        OMElement element = factory.createOMElement("test", null);
-        element.declareNamespace("urn:a", "a");
-        element.declareNamespace("urn:b", "b");
-        element.declareNamespace("urn:c", "c");
-        for (Iterator it = element.getAllDeclaredNamespaces(); it.hasNext(); ) {
-            OMNamespace ns = (OMNamespace)it.next();
-            if (ns.getPrefix().equals("b")) {
-                it.remove();
-                break;
+        List<String> prefixes = Arrays.asList("a", "b", "c");
+        for (String prefixToRemove : prefixes) {
+            OMElement element = factory.createOMElement("test", null);
+            for (String prefix : prefixes) {
+                element.declareNamespace("urn:" + prefix, prefix);
+            }
+            Set<String> seenPrefixes = new HashSet<String>();
+            for (Iterator it = element.getAllDeclaredNamespaces(); it.hasNext(); ) {
+                OMNamespace ns = (OMNamespace)it.next();
+                String prefix = ns.getPrefix();
+                if (prefix.equals(prefixToRemove)) {
+                    it.remove();
+                }
+                seenPrefixes.add(prefix);
+            }
+            ASSERT.that(seenPrefixes).containsAllIn(prefixes);
+            for (String prefix : prefixes) {
+                OMNamespace ns = element.findNamespaceURI(prefix);
+                if (prefix.equals(prefixToRemove)) {
+                    ASSERT.that(ns).isNull();
+                } else {
+                    ASSERT.that(ns).isNotNull();
+                    ASSERT.that(ns.getNamespaceURI()).isEqualTo("urn:" + prefix);
+                }
             }
         }
-        assertEquals("urn:a", element.findNamespaceURI("a").getNamespaceURI());
-        assertNull(element.findNamespaceURI("b"));
-        assertEquals("urn:c", element.findNamespaceURI("c").getNamespaceURI());
     }
 }



Mime
View raw message