Author: veithen
Date: Fri Nov 29 21:03:16 2013
New Revision: 1546650

URL: http://svn.apache.org/r1546650
Log:
Test the behavior of cloneNode(false) on a DocumentFragment.

Added:
    
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeDeep.java
      - copied, changed from r1546641, 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNode.java
    
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeShallow.java
   (with props)
Removed:
    
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNode.java
Modified:
    
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java

Modified: 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java?rev=1546650&r1=1546649&r2=1546650&view=diff
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
 (original)
+++ 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
 Fri Nov 29 21:03:16 2013
@@ -95,7 +95,8 @@ public class DOMTestSuiteBuilder extends
             addTest(new 
org.apache.axiom.ts.dom.document.TestTransformerWithStylesheet(dbf, 
xsltImplementation));
         }
         addTest(new org.apache.axiom.ts.dom.document.TestValidator(dbf));
-        addTest(new 
org.apache.axiom.ts.dom.documentfragment.TestCloneNode(dbf));
+        addTest(new 
org.apache.axiom.ts.dom.documentfragment.TestCloneNodeDeep(dbf));
+        addTest(new 
org.apache.axiom.ts.dom.documentfragment.TestCloneNodeShallow(dbf));
         addTest(new 
org.apache.axiom.ts.dom.documentfragment.TestLookupNamespaceURI(dbf));
         addTest(new org.apache.axiom.ts.dom.documenttype.TestWithParser1(dbf));
         addTest(new org.apache.axiom.ts.dom.documenttype.TestWithParser2(dbf));

Copied: 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeDeep.java
 (from r1546641, 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNode.java)
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeDeep.java?p2=webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeDeep.java&p1=webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNode.java&r1=1546641&r2=1546650&rev=1546650&view=diff
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNode.java
 (original)
+++ 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeDeep.java
 Fri Nov 29 21:03:16 2013
@@ -25,8 +25,11 @@ import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Node;
 
-public class TestCloneNode extends DOMTestCase {
-    public TestCloneNode(DocumentBuilderFactory dbf) {
+/**
+ * Tests {@link Node#cloneNode(boolean)} with <code>deep</code> set to 
<code>true</code>.
+ */
+public class TestCloneNodeDeep extends DOMTestCase {
+    public TestCloneNodeDeep(DocumentBuilderFactory dbf) {
         super(dbf);
     }
 

Added: 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeShallow.java
URL: 
http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeShallow.java?rev=1546650&view=auto
==============================================================================
--- 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeShallow.java
 (added)
+++ 
webservices/axiom/trunk/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/documentfragment/TestCloneNodeShallow.java
 Fri Nov 29 21:03:16 2013
@@ -0,0 +1,46 @@
+/*
+ * 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.documentfragment;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.axiom.ts.dom.DOMTestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+
+/**
+ * Tests {@link Node#cloneNode(boolean)} with <code>deep</code> set to 
<code>false</code>.
+ */
+public class TestCloneNodeShallow extends DOMTestCase {
+    public TestCloneNodeShallow(DocumentBuilderFactory dbf) {
+        super(dbf);
+    }
+
+    protected void runTest() throws Throwable {
+        Document document = dbf.newDocumentBuilder().newDocument();
+        DocumentFragment fragment = document.createDocumentFragment();
+        fragment.appendChild(document.createElementNS(null, "test"));
+        DocumentFragment clone = (DocumentFragment)fragment.cloneNode(false);
+        assertSame(document, clone.getOwnerDocument());
+        assertNull(clone.getFirstChild());
+        assertNull(clone.getLastChild());
+        assertEquals(0, clone.getChildNodes().getLength());
+    }
+}

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


Reply via email to