ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1758113 - in /webservices/axiom/trunk/testing/axiom-testsuite/src/main: java/org/apache/axiom/ts/om/ java/org/apache/axiom/ts/om/element/ resources/org/apache/axiom/ts/om/element/
Date Sun, 28 Aug 2016 13:45:03 GMT
Author: veithen
Date: Sun Aug 28 13:45:03 2016
New Revision: 1758113

URL: http://svn.apache.org/viewvc?rev=1758113&view=rev
Log:
Add a regression test for AXIOM-485 (which affects the 1.2 branch, but not the trunk).

Added:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext2.java
  (with props)
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/org/apache/axiom/ts/om/element/AXIOM-485.xml
  (with props)
Modified:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1758113&r1=1758112&r2=1758113&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
Sun Aug 28 13:45:03 2016
@@ -366,6 +366,7 @@ public class OMTestSuiteBuilder extends
         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.TestGetXMLStreamReaderWithPreserveNamespaceContext2(metaFactory));
         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));

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext2.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext2.java?rev=1758113&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext2.java
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext2.java
Sun Aug 28 13:45:03 2016
@@ -0,0 +1,57 @@
+/*
+ * 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.om.element;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.OMXMLStreamReaderConfiguration;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests the behavior of
+ * {@link OMElement#getXMLStreamReader(boolean, OMXMLStreamReaderConfiguration)} when
+ * {@link OMXMLStreamReaderConfiguration#isPreserveNamespaceContext()} is {@code true} and
there are
+ * masked or redundant namespace declarations. This is a regression test for
+ * <a href="https://issues.apache.org/jira/browse/AXIOM-485">AXIOM-485</a>.
+ */
+public class TestGetXMLStreamReaderWithPreserveNamespaceContext2 extends AxiomTestCase {
+    public TestGetXMLStreamReaderWithPreserveNamespaceContext2(OMMetaFactory metaFactory)
{
+        super(metaFactory);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMElement root = OMXMLBuilderFactory.createOMBuilder(metaFactory.getOMFactory(),
+                TestGetXMLStreamReaderWithPreserveNamespaceContext2.class.getResourceAsStream("AXIOM-485.xml")).getDocumentElement();
+        OMElement child = root.getFirstElement();
+        OMXMLStreamReaderConfiguration configuration = new OMXMLStreamReaderConfiguration();
+        configuration.setPreserveNamespaceContext(true);
+        XMLStreamReader reader = child.getXMLStreamReader(true, configuration);
+        reader.next();
+        assertThat(reader.isStartElement()).isTrue();
+        assertThat(reader.getNamespaceCount()).isEqualTo(1);
+        assertThat(reader.getNamespacePrefix(0)).isEqualTo("p");
+        assertThat(reader.getNamespaceURI(0)).isEqualTo("urn:ns2");
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderWithPreserveNamespaceContext2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/org/apache/axiom/ts/om/element/AXIOM-485.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/org/apache/axiom/ts/om/element/AXIOM-485.xml?rev=1758113&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/org/apache/axiom/ts/om/element/AXIOM-485.xml
(added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/org/apache/axiom/ts/om/element/AXIOM-485.xml
Sun Aug 28 13:45:03 2016
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns:p="urn:ns1">
+    <child xmlns:p="urn:ns2"/>
+</root>

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/resources/org/apache/axiom/ts/om/element/AXIOM-485.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message