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 2016/10/09 13:58:25 UTC

svn commit: r1763981 - in /webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom: DOMTestSuiteBuilder.java element/TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute.java

Author: veithen
Date: Sun Oct  9 13:58:25 2016
New Revision: 1763981

URL: http://svn.apache.org/viewvc?rev=1763981&view=rev
Log:
Add an assertion about the behavior of DOM's lookupNamespaceURI method in the presence of a namespace declaration added using a namespace unaware API (namely setAttribute). This corresponds to the case described in AXIOM-487.

Added:
    webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute.java   (with props)
Modified:
    webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java

Modified: webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java?rev=1763981&r1=1763980&r2=1763981&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java Sun Oct  9 13:58:25 2016
@@ -152,6 +152,7 @@ public final class DOMTestSuiteBuilder e
         addTest(new org.apache.axiom.ts.dom.element.TestLookupNamespaceURIDefaultBindings(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestLookupNamespaceURIExplicit(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestLookupNamespaceURIImplicit(dbf));
+        addTest(new org.apache.axiom.ts.dom.element.TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestLookupNamespaceURIXercesJ1586(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestLookupPrefixDefaultBindings(dbf));
         addTest(new org.apache.axiom.ts.dom.element.TestLookupPrefixEmptyNamespace(dbf));

Added: webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute.java?rev=1763981&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute.java (added)
+++ webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute.java Sun Oct  9 13:58:25 2016
@@ -0,0 +1,47 @@
+/*
+ * 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.dom.element;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.axiom.ts.dom.DOMTestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Tests the behavior of {@link Node#lookupNamespaceURI(String)} in the presence of a namespace
+ * declaration added with {@link Element#setAttribute(String, String)}.
+ */
+public class TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute extends DOMTestCase {
+    public TestLookupNamespaceURINamespaceDeclarationAsNSUnawareAttribute(
+            DocumentBuilderFactory dbf) {
+        super(dbf);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        Document document = dbf.newDocumentBuilder().newDocument();
+        Element element = document.createElementNS(null, "test");
+        element.setAttribute("xmlns:p", "urn:test");
+        assertThat(element.lookupNamespaceURI("p")).isNull();
+    }
+}

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