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 2012/06/05 21:23:13 UTC

svn commit: r1346543 - in /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom: DOMTestSuiteBuilder.java attr/TestGetValueWithMultipleChildren.java document/TestCreateAttributeNS.java

Author: veithen
Date: Tue Jun  5 19:23:12 2012
New Revision: 1346543

URL: http://svn.apache.org/viewvc?rev=1346543&view=rev
Log:
Some more test coverage for AXIOM-425.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/attr/TestGetValueWithMultipleChildren.java   (with props)
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
    webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateAttributeNS.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java?rev=1346543&r1=1346542&r2=1346543&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java Tue Jun  5 19:23:12 2012
@@ -31,6 +31,7 @@ public class DOMTestSuiteBuilder extends
     
     protected void addTests() {
         addTest(new org.apache.axiom.ts.dom.attr.TestGetFirstChild(dbf));
+        addTest(new org.apache.axiom.ts.dom.attr.TestGetValueWithMultipleChildren(dbf));
         addTest(new org.apache.axiom.ts.dom.attr.TestSetPrefixNotNullWithNamespace(dbf));
         addTest(new org.apache.axiom.ts.dom.attr.TestSetPrefixNotNullWithoutNamespace(dbf));
         addTest(new org.apache.axiom.ts.dom.builder.TestWhitespaceAroundDocumentElement(dbf));

Added: webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/attr/TestGetValueWithMultipleChildren.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/attr/TestGetValueWithMultipleChildren.java?rev=1346543&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/attr/TestGetValueWithMultipleChildren.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/attr/TestGetValueWithMultipleChildren.java Tue Jun  5 19:23:12 2012
@@ -0,0 +1,40 @@
+/*
+ * 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.attr;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.axiom.ts.dom.DOMTestCase;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+
+public class TestGetValueWithMultipleChildren extends DOMTestCase {
+    public TestGetValueWithMultipleChildren(DocumentBuilderFactory dbf) {
+        super(dbf);
+    }
+
+    protected void runTest() throws Throwable {
+        Document document = dbf.newDocumentBuilder().newDocument();
+        Attr attr = document.createAttributeNS(null, "attr");
+        attr.appendChild(document.createTextNode("A"));
+        attr.appendChild(document.createTextNode("B"));
+        attr.appendChild(document.createTextNode("C"));
+        assertEquals("ABC", attr.getValue());
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/attr/TestGetValueWithMultipleChildren.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateAttributeNS.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateAttributeNS.java?rev=1346543&r1=1346542&r2=1346543&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateAttributeNS.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateAttributeNS.java Tue Jun  5 19:23:12 2012
@@ -30,19 +30,23 @@ public class TestCreateAttributeNS exten
     }
 
     protected void runTest() throws Throwable {
-        String attrName = "attrIdentifier";
-        String attrValue = "attrValue";
-        String attrNs = "http://ws.apache.org/axis2/ns";
-        String attrNsPrefix = "axis2";
+        String localName = "attrIdentifier";
+        String uri = "http://ws.apache.org/axis2/ns";
+        String prefix = "axis2";
+        String name = prefix + ":" + localName;
 
         Document doc = dbf.newDocumentBuilder().newDocument();
 
-        Attr attr = doc.createAttributeNS(attrNs, attrNsPrefix + ":" + attrName);
-        assertEquals("Attr name mismatch", attrName, attr.getLocalName());
-        assertNotNull("Namespace value should not be null", attr.getNamespaceURI());
-        assertEquals("NamsspaceURI mismatch", attrNs, attr.getNamespaceURI());
-        assertEquals("namespace prefix mismatch", attrNsPrefix, attr.getPrefix());
+        Attr attr = doc.createAttributeNS(uri, name);
+        
+        // Check name
+        assertEquals("Attr name mismatch", localName, attr.getLocalName());
+        assertEquals("NamsspaceURI mismatch", uri, attr.getNamespaceURI());
+        assertEquals("namespace prefix mismatch", prefix, attr.getPrefix());
+        assertEquals(name, attr.getName());
 
-        attr.setValue(attrValue);
+        // Check defaults
+        assertNull(attr.getFirstChild());
+        assertEquals("", attr.getValue());
     }
 }