Author: veithen
Date: Thu Jun 18 21:53:01 2015
New Revision: 1686323
URL: http://svn.apache.org/r1686323
Log:
Add a regression test for DOOM.
Added:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/attr/TestSetValueOnNamespaceDeclaration.java
(with props)
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
Modified:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java?rev=1686323&r1=1686322&r2=1686323&view=diff
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
(original)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/OMDOMTestSuiteBuilder.java
Thu Jun 18 21:53:01 2015
@@ -36,6 +36,7 @@ public class OMDOMTestSuiteBuilder exten
protected void addTests() {
addTest(new
org.apache.axiom.ts.omdom.attr.TestGetNamespaceNormalized(metaFactory));
+ addTest(new
org.apache.axiom.ts.omdom.attr.TestSetValueOnNamespaceDeclaration(metaFactory));
addTest(new
org.apache.axiom.ts.omdom.document.TestAppendChildForbidden(metaFactory, true));
addTest(new
org.apache.axiom.ts.omdom.document.TestAppendChildForbidden(metaFactory,
false));
addTest(new
org.apache.axiom.ts.omdom.document.TestCreateDocumentFragmentInterfaces(metaFactory));
Added:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/attr/TestSetValueOnNamespaceDeclaration.java
URL:
http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/attr/TestSetValueOnNamespaceDeclaration.java?rev=1686323&view=auto
==============================================================================
---
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/attr/TestSetValueOnNamespaceDeclaration.java
(added)
+++
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/attr/TestSetValueOnNamespaceDeclaration.java
Thu Jun 18 21:53:01 2015
@@ -0,0 +1,58 @@
+/*
+ * 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.omdom.attr;
+
+import static org.apache.axiom.truth.AxiomTestVerb.ASSERT;
+
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.dom.DOMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Tests that after calling {@link Attr#setValue(String)} on a namespace
declaration the new
+ * namespace URI is reflected in the result of {@link
OMElement#getAllDeclaredNamespaces()}.
+ */
+public class TestSetValueOnNamespaceDeclaration extends AxiomTestCase {
+ public TestSetValueOnNamespaceDeclaration(OMMetaFactory metaFactory) {
+ super(metaFactory);
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ Document doc =
((DOMMetaFactory)metaFactory).newDocumentBuilderFactory().newDocumentBuilder().newDocument();
+ Element element = doc.createElementNS("", "test");
+ Attr attr = doc.createAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
"xmlns:attr");
+ element.setAttributeNodeNS(attr);
+ attr.setValue("urn:test");
+ Iterator it = ((OMElement)element).getAllDeclaredNamespaces();
+ ASSERT.that(it.hasNext()).isTrue();
+ OMNamespace ns = (OMNamespace)it.next();
+ ASSERT.that(ns.getNamespaceURI()).isEqualTo("urn:test");
+ ASSERT.that(it.hasNext()).isFalse();
+ }
+}
Propchange:
webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/omdom/attr/TestSetValueOnNamespaceDeclaration.java
------------------------------------------------------------------------------
svn:eol-style = native