ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1733746 - in /webservices/axiom/branches/stax-stream: ./ implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/ implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/ testing/axiom-testsuite/src/main/java/or...
Date Sat, 05 Mar 2016 17:58:48 GMT
Author: veithen
Date: Sat Mar  5 17:58:47 2016
New Revision: 1733746

URL: http://svn.apache.org/viewvc?rev=1733746&view=rev
Log:
Merge latest changes from trunk.

Modified:
    webservices/axiom/branches/stax-stream/   (props changed)
    webservices/axiom/branches/stax-stream/implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
    webservices/axiom/branches/stax-stream/implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
    webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
    webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext.java

Propchange: webservices/axiom/branches/stax-stream/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar  5 17:58:47 2016
@@ -14,4 +14,4 @@
 /webservices/axiom/branches/maven-site-plugin-3.5:1731125-1732708
 /webservices/axiom/branches/namespaceURIInterning:1293148-1293587
 /webservices/axiom/branches/osgi-redesign:1180368-1180596
-/webservices/axiom/trunk:1733528-1733722
+/webservices/axiom/trunk:1733528-1733745

Modified: webservices/axiom/branches/stax-stream/implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java?rev=1733746&r1=1733745&r2=1733746&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
(original)
+++ webservices/axiom/branches/stax-stream/implementations/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
Sat Mar  5 17:58:47 2016
@@ -25,6 +25,7 @@ import org.apache.axiom.om.impl.dom.fact
 import org.apache.axiom.ts.om.OMTestSuiteBuilder;
 import org.apache.axiom.ts.om.document.TestDigest;
 import org.apache.axiom.ts.om.element.TestGetChildrenWithName4;
+import org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext;
 import org.apache.axiom.ts.om.element.sr.TestClose;
 import org.apache.axiom.ts.om.node.TestInsertSiblingAfterOnChild;
 import org.apache.axiom.ts.om.node.TestInsertSiblingBeforeOnChild;
@@ -50,6 +51,9 @@ public class OMImplementationTest extend
         // TODO: test case needing review
         builder.exclude(TestClose.class);
         
+        // TODO: the namespace context is different when cache=false
+        builder.exclude(TestGetXMLStreamReaderWithPreserveNamespaceContext.class, "(cache=false)");
+        
         return builder.build();
     }
 }

Modified: webservices/axiom/branches/stax-stream/implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java?rev=1733746&r1=1733745&r2=1733746&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
(original)
+++ webservices/axiom/branches/stax-stream/implementations/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
Sat Mar  5 17:58:47 2016
@@ -24,6 +24,7 @@ import junit.framework.TestSuite;
 import org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory;
 import org.apache.axiom.ts.om.OMTestSuiteBuilder;
 import org.apache.axiom.ts.om.document.TestDigest;
+import org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext;
 import org.apache.axiom.ts.om.element.sr.TestClose;
 import org.apache.axiom.ts.om.node.TestInsertSiblingAfterOnChild;
 import org.apache.axiom.ts.om.node.TestInsertSiblingBeforeOnChild;
@@ -45,6 +46,9 @@ public class OMImplementationTest extend
         // TODO: test case needing review
         builder.exclude(TestClose.class);
         
+        // TODO: the namespace context is different when cache=false
+        builder.exclude(TestGetXMLStreamReaderWithPreserveNamespaceContext.class, "(cache=false)");
+        
         return builder.build();
     }
 }

Modified: webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1733746&r1=1733745&r2=1733746&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
(original)
+++ webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
Sat Mar  5 17:58:47 2016
@@ -354,7 +354,10 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithNamespaceURIInterning(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithoutCachingPartiallyBuilt(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithoutCachingPartiallyBuiltModified(metaFactory));
-        addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext(metaFactory));
+        addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext(metaFactory,
true, true));
+        addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext(metaFactory,
true, false));
+        addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext(metaFactory,
false, true));
+        addTest(new org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithPreserveNamespaceContext(metaFactory,
false, false));
         addTest(new org.apache.axiom.ts.om.element.TestHasNameWithNamespace(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestHasNameWithoutNamespace(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestIsCompleteAfterAddingIncompleteChild(metaFactory));

Modified: webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext.java?rev=1733746&r1=1733745&r2=1733746&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext.java
(original)
+++ webservices/axiom/branches/stax-stream/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext.java
Sat Mar  5 17:58:47 2016
@@ -18,11 +18,13 @@
  */
 package org.apache.axiom.ts.om.element;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import java.io.InputStream;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
+import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.axiom.om.OMElement;
@@ -33,26 +35,46 @@ import org.apache.axiom.ts.AxiomTestCase
 
 /**
  * Tests the behavior of
- * {@link OMElement#getXMLStreamReader(boolean, OMXMLStreamReaderConfiguration)} with
- * {@link OMXMLStreamReaderConfiguration#isPreserveNamespaceContext()} set to <code>true</code>.
+ * {@link OMElement#getXMLStreamReader(boolean, OMXMLStreamReaderConfiguration)} in conjunction
with
+ * {@link OMXMLStreamReaderConfiguration#isPreserveNamespaceContext()}.
  */
 public class TestGetXMLStreamReaderWithPreserveNamespaceContext extends AxiomTestCase {
-    public TestGetXMLStreamReaderWithPreserveNamespaceContext(OMMetaFactory metaFactory)
{
+    private final boolean preserveNamespaceContext;
+    private final boolean cache;
+
+    public TestGetXMLStreamReaderWithPreserveNamespaceContext(OMMetaFactory metaFactory,
boolean preserveNamespaceContext, boolean cache) {
         super(metaFactory);
+        this.preserveNamespaceContext = preserveNamespaceContext;
+        addTestParameter("preserveNamespaceContext", preserveNamespaceContext);
+        this.cache = cache;
+        addTestParameter("cache", cache);
     }
 
     protected void runTest() throws Throwable {
         InputStream in = TestGetXMLStreamReaderWithPreserveNamespaceContext.class.getResourceAsStream("AXIOM-114.xml");
         OMElement root = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
in).getDocumentElement();
+        root.declareNamespace("http://example.org", "p");
         OMXMLStreamReaderConfiguration configuration = new OMXMLStreamReaderConfiguration();
-        configuration.setPreserveNamespaceContext(true);
-        XMLStreamReader reader = root.getFirstElement().getFirstElement().getXMLStreamReader(true,
configuration);
-        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-        assertEquals(4, reader.getNamespaceCount());
+        configuration.setPreserveNamespaceContext(preserveNamespaceContext);
+        XMLStreamReader reader = root.getFirstElement().getFirstElement().getXMLStreamReader(cache,
configuration);
+        assertThat(reader.next()).isEqualTo(XMLStreamReader.START_ELEMENT);
         Set<String> prefixes = new HashSet<>();
-        for (int i=0; i<4; i++) {
+        for (int i=0; i<reader.getNamespaceCount(); i++) {
             prefixes.add(reader.getNamespacePrefix(i));
         }
-        assertEquals(new HashSet<>(Arrays.asList(new String[] { "soapenv", "xsd", "xsi",
"ns"} )), prefixes);
+        if (preserveNamespaceContext) {
+            assertThat(prefixes).containsExactly("soapenv", "xsd", "xsi", "ns", "p");
+        } else {
+            assertThat(prefixes).containsExactly("ns");
+        }
+        // Make sure that we start pulling events directly from the underlying parser.
+        reader.nextTag();
+        // The following assertions are true irrespective of the value of preserveNamespaceContext.
+        assertThat(reader.getNamespaceURI("xsd")).isEqualTo("http://www.w3.org/2001/XMLSchema");
+        // Namespace declarations added programmatically on an ancestor should also be visible.
+        assertThat(reader.getNamespaceURI("p")).isEqualTo("http://example.org");
+        NamespaceContext nc = reader.getNamespaceContext();
+        assertThat(nc.getPrefix("http://www.w3.org/2001/XMLSchema")).isEqualTo("xsd");
+        assertThat(nc.getPrefix("http://example.org")).isEqualTo("p");
     }
 }



Mime
View raw message