Author: veithen
Date: Wed Dec 2 20:30:52 2015
New Revision: 1717677
URL: http://svn.apache.org/viewvc?rev=1717677&view=rev
Log:
Add assertions about the behavior of lookupNamespaceURI and lookupPrefix.
Added:
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURIDefaultBindings.java
(with props)
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupPrefixDefaultBindings.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=1717677&r1=1717676&r2=1717677&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
Wed Dec 2 20:30:52 2015
@@ -143,9 +143,11 @@ public final class DOMTestSuiteBuilder e
addTest(new org.apache.axiom.ts.dom.element.TestGetTextContent(dbf));
addTest(new org.apache.axiom.ts.dom.element.TestInsertBefore(dbf));
addTest(new
org.apache.axiom.ts.dom.element.TestInsertBeforeWithDocumentFragment(dbf));
+ 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.TestLookupNamespaceURIXercesJ1586(dbf));
+ addTest(new
org.apache.axiom.ts.dom.element.TestLookupPrefixDefaultBindings(dbf));
addTest(new
org.apache.axiom.ts.dom.element.TestLookupPrefixEmptyNamespace(dbf));
addTest(new
org.apache.axiom.ts.dom.element.TestLookupPrefixExplicitMasked(dbf));
addTest(new
org.apache.axiom.ts.dom.element.TestLookupPrefixImplicitMasked(dbf));
Added:
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURIDefaultBindings.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURIDefaultBindings.java?rev=1717677&view=auto
==============================================================================
---
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURIDefaultBindings.java
(added)
+++
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURIDefaultBindings.java
Wed Dec 2 20:30:52 2015
@@ -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.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.Node;
+
+import org.apache.axiom.ts.dom.DOMTestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Test that {@link Node#lookupNamespaceURI(String)} does NOT recognize the
default namespace
+ * bindings for the {@code xml} and {@code xmlns} prefixes.
+ */
+public class TestLookupNamespaceURIDefaultBindings extends DOMTestCase {
+ public TestLookupNamespaceURIDefaultBindings(DocumentBuilderFactory dbf) {
+ super(dbf);
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ Document document = dbf.newDocumentBuilder().newDocument();
+ Element element = document.createElementNS(null, "test");
+
assertThat(element.lookupNamespaceURI(XMLConstants.XML_NS_PREFIX)).isNull();
+
assertThat(element.lookupNamespaceURI(XMLConstants.XMLNS_ATTRIBUTE)).isNull();
+ }
+}
Propchange:
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupNamespaceURIDefaultBindings.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupPrefixDefaultBindings.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupPrefixDefaultBindings.java?rev=1717677&view=auto
==============================================================================
---
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupPrefixDefaultBindings.java
(added)
+++
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupPrefixDefaultBindings.java
Wed Dec 2 20:30:52 2015
@@ -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.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.Node;
+
+import org.apache.axiom.ts.dom.DOMTestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Test that {@link Node#lookupPrefix(String)} does NOT recognize the default
namespace bindings for
+ * the {@code xml} and {@code xmlns} prefixes.
+ */
+public class TestLookupPrefixDefaultBindings extends DOMTestCase {
+ public TestLookupPrefixDefaultBindings(DocumentBuilderFactory dbf) {
+ super(dbf);
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ Document document = dbf.newDocumentBuilder().newDocument();
+ Element element = document.createElementNS(null, "test");
+ assertThat(element.lookupPrefix(XMLConstants.XML_NS_URI)).isNull();
+
assertThat(element.lookupPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)).isNull();
+ }
+}
Propchange:
webservices/axiom/trunk/testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/element/TestLookupPrefixDefaultBindings.java
------------------------------------------------------------------------------
svn:eol-style = native