vhardy 02/04/12 10:22:17 Modified: test-resources/org/apache/batik/dom unitTesting.xml Added: test-sources/org/apache/batik/dom AppendChildTest.java Log: Initial test for append child on suspected error with DocumentFragments Revision Changes Path 1.1 xml-batik/test-sources/org/apache/batik/dom/AppendChildTest.java Index: AppendChildTest.java =================================================================== /***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * * ------------------------------------------------------------------------- * * This software is published under the terms of the Apache Software License * * version 1.1, a copy of which has been included with this distribution in * * the LICENSE file. * *****************************************************************************/ package org.apache.batik.dom; import org.w3c.dom.*; import java.io.*; import java.net.*; import org.apache.batik.dom.util.*; import org.apache.batik.util.*; import org.apache.batik.test.*; /** * This class tests the appendChild method. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> * @version $Id: AppendChildTest.java,v 1.1 2002/04/12 17:22:17 vhardy Exp $ */ public class AppendChildTest extends AbstractTest { public static String ERROR_GET_ELEMENT_BY_ID_FAILED = "error.get.element.by.id.failed"; public static String ENTRY_KEY_ID = "entry.key.id"; protected String testFileName; protected String rootTag; protected String targetId; public AppendChildTest(String file, String root, String id) { testFileName = file; rootTag = root; targetId = id; } public TestReport runImpl() throws Exception { String parser = XMLResourceDescriptor.getXMLParserClassName(); DocumentFactory df = new SAXDocumentFactory (GenericDOMImplementation.getDOMImplementation(), parser); File f = (new File(testFileName)); URL url = f.toURL(); Document doc = df.createDocument(null, rootTag, url.toString(), url.openStream()); Element e = doc.getElementById(targetId); if (e == null){ DefaultTestReport report = new DefaultTestReport(this); report.setErrorCode(ERROR_GET_ELEMENT_BY_ID_FAILED); report.addDescriptionEntry(ENTRY_KEY_ID, targetId); report.setPassed(false); return report; } Document otherDocument = df.createDocument(null, rootTag, url.toString(), url.openStream()); DocumentFragment docFrag = otherDocument.createDocumentFragment(); docFrag.appendChild(doc.getDocumentElement()); return reportSuccess(); } } 1.6 +11 -1 xml-batik/test-resources/org/apache/batik/dom/unitTesting.xml Index: unitTesting.xml =================================================================== RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/dom/unitTesting.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- unitTesting.xml 20 Mar 2002 10:42:26 -0000 1.5 +++ unitTesting.xml 12 Apr 2002 17:22:17 -0000 1.6 @@ -9,7 +9,7 @@ <!-- ========================================================================= --> <!-- @author [EMAIL PROTECTED] --> <!-- @author [EMAIL PROTECTED] --> -<!-- @version $Id: unitTesting.xml,v 1.5 2002/03/20 10:42:26 hillion Exp $ --> +<!-- @version $Id: unitTesting.xml,v 1.6 2002/04/12 17:22:17 vhardy Exp $ --> <!-- ========================================================================= --> <testSuite id="dom.unitTesting" name="org.apache.batik.dom package - Unit Testing"> @@ -59,6 +59,16 @@ <!-- replaceChild test --> <!-- ========================================================================== --> <test id="replaceChild" class="org.apache.batik.dom.ReplaceChildTest" > + <arg class="java.lang.String" + value="test-resources/org/apache/batik/dom/dummyXML3.xml" /> + <arg class="java.lang.String" value="doc" /> + <arg class="java.lang.String" value="root" /> + </test> + + <!-- ========================================================================== --> + <!-- appendChild test --> + <!-- ========================================================================== --> + <test id="appendChild" class="org.apache.batik.dom.AppendChildTest" > <arg class="java.lang.String" value="test-resources/org/apache/batik/dom/dummyXML3.xml" /> <arg class="java.lang.String" value="doc" />
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]