Modified: xmlbeans/branches/gradle-build/src/test/java/misc/detailed/SampleRunner.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/misc/detailed/SampleRunner.java?rev=1896456&r1=1896455&r2=1896456&view=diff ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/misc/detailed/SampleRunner.java (original) +++ xmlbeans/branches/gradle-build/src/test/java/misc/detailed/SampleRunner.java Mon Dec 27 20:28:38 2021 @@ -22,6 +22,7 @@ import java.io.File; import java.io.FilenameFilter; import java.io.PrintStream; import java.util.ArrayList; +import java.util.List; /** * Date: Feb 8, 2005 @@ -29,86 +30,72 @@ import java.util.ArrayList; */ public class SampleRunner { - private ArrayList samples; - private Project proj; - private Target target; + private List<File> samples; private String XMLBEANS_HOME; private SamplesBuildFileTest runSampleTest; @Before - protected void setUp() throws Exception { - proj = new Project(); + public void setUp() throws Exception { + Project proj = new Project(); proj.setName("Samples Task Tests"); - XMLBEANS_HOME = proj.getBaseDir().getAbsolutePath(); - samples = new ArrayList(); + XMLBEANS_HOME = new File(proj.getBaseDir(), "build").getAbsolutePath(); + samples = new ArrayList<>(); runSampleTest = new SamplesBuildFileTest(); } @Test public void testSamples() throws Exception { loadSampleDirs(new File("./samples")); - ArrayList exceptions = new ArrayList(); - for (int i = 0; i < samples.size(); i++) - { - - runSampleTest.call_samples_task( - ((File) samples.get(i)).getAbsolutePath() - , "test"); + List<Object> exceptions = new ArrayList<>(); + for (File sample : samples) { + + runSampleTest.call_samples_task(sample.getAbsolutePath(), "test"); BuildException e; - if ((e = runSampleTest.getAnyExceptions()) != null) - { - exceptions.add(((File) samples.get(i)).getAbsolutePath()); - exceptions.add(e.getException()); + if ((e = runSampleTest.getAnyExceptions()) != null) { + exceptions.add(sample.getAbsolutePath()); + exceptions.add(e.getCause()); } } - if (exceptions.size() != 0) + if (exceptions.size() != 0) { throw new RuntimeException(getMessageFromExceptions(exceptions)); + } } - private String getMessageFromExceptions(ArrayList ex) - { + private String getMessageFromExceptions(List<Object> ex) { StringBuilder sb = new StringBuilder(); - for (int i = 0; i < ex.size(); i += 2) - { - sb.append("\n\nFILE:" + (String) ex.get(i)); - sb.append( - "\n **Error: " + ((BuildException) ex.get(i + 1)).getMessage()); + for (int i = 0; i < ex.size(); i += 2) { + sb.append("\n\nFILE:").append(ex.get(i)); + sb.append("\n **Error: ").append(((BuildException) ex.get(i + 1)).getMessage()); } return sb.toString(); } - private void loadSampleDirs(File dir) - { + private void loadSampleDirs(File dir) { assert dir != null && dir.exists(); File[] files = dir.listFiles(new BuildFilter()); - assert files.length == 1; + assert (files != null && files.length == 1); samples.add(files[0]); } - private class BuildFilter - implements FilenameFilter - { - public boolean accept(File file, String name) - { + private static class BuildFilter + implements FilenameFilter { + public boolean accept(File file, String name) { return name.equals("build.xml"); } } private class SamplesBuildFileTest extends BuildFileTest { - public void call_samples_task(String projectPath, String taskName) - { + public void call_samples_task(String projectPath, String taskName) { configureProject(projectPath); Project proj = getProject(); proj.setProperty("xmlbeans.home", XMLBEANS_HOME); executeTarget(proj.getDefaultTarget()); } - public BuildException getAnyExceptions() - throws Exception - { + public BuildException getAnyExceptions() { return this.getBuildException(); } } @@ -160,25 +147,26 @@ abstract class BuildFileTest { } /** - * set up to run the named project + * set up to run the named project * - * @param filename name of project file to run + * @param filename name of project file to run */ protected void configureProject(String filename) throws BuildException { logBuffer = new StringBuilder(); fullLogBuffer = new StringBuilder(); project = new Project(); project.init(); - project.setUserProperty( "ant.file" , new File(filename).getAbsolutePath() ); + project.setUserProperty("ant.file", new File(filename).getAbsolutePath()); project.addBuildListener(new BuildFileTest.AntTestListener()); //ProjectHelper.configureProject(project, new File(filename)); ProjectHelper.getProjectHelper().parse(project, new File(filename)); } /** - * execute a target we have set up - * @pre configureProject has been called - * @param targetName target to run + * execute a target we have set up. + * configureProject needs to be called before + * + * @param targetName target to run */ protected void executeTarget(String targetName) { PrintStream sysOut = System.out; @@ -220,7 +208,7 @@ abstract class BuildFileTest { */ private class AntOutputStream extends java.io.OutputStream { public void write(int b) { - outBuffer.append((char)b); + outBuffer.append((char) b); } } @@ -229,63 +217,63 @@ abstract class BuildFileTest { */ private class AntTestListener implements BuildListener { /** - * Fired before any targets are started. + * Fired before any targets are started. */ public void buildStarted(BuildEvent event) { } /** - * Fired after the last target has finished. This event - * will still be thrown if an error occured during the build. + * Fired after the last target has finished. This event + * will still be thrown if an error occured during the build. * - * @see BuildEvent#getException() + * @see BuildEvent#getException() */ public void buildFinished(BuildEvent event) { } /** - * Fired when a target is started. + * Fired when a target is started. * - * @see BuildEvent#getTarget() + * @see BuildEvent#getTarget() */ public void targetStarted(BuildEvent event) { //System.out.println("targetStarted " + event.getTarget().getName()); } /** - * Fired when a target has finished. This event will - * still be thrown if an error occured during the build. + * Fired when a target has finished. This event will + * still be thrown if an error occured during the build. * - * @see BuildEvent#getException() + * @see BuildEvent#getException() */ public void targetFinished(BuildEvent event) { //System.out.println("targetFinished " + event.getTarget().getName()); } /** - * Fired when a task is started. + * Fired when a task is started. * - * @see BuildEvent#getTask() + * @see BuildEvent#getTask() */ public void taskStarted(BuildEvent event) { //System.out.println("taskStarted " + event.getTask().getTaskName()); } /** - * Fired when a task has finished. This event will still - * be throw if an error occured during the build. + * Fired when a task has finished. This event will still + * be throw if an error occured during the build. * - * @see BuildEvent#getException() + * @see BuildEvent#getException() */ public void taskFinished(BuildEvent event) { //System.out.println("taskFinished " + event.getTask().getTaskName()); } /** - * Fired whenever a message is logged. + * Fired whenever a message is logged. * - * @see BuildEvent#getMessage() - * @see BuildEvent#getPriority() + * @see BuildEvent#getMessage() + * @see BuildEvent#getPriority() */ public void messageLogged(BuildEvent event) { if (event.getPriority() == Project.MSG_INFO ||
Copied: xmlbeans/branches/gradle-build/src/test/java/org/w3c/LICENSE.txt (from r1896455, xmlbeans/branches/gradle-build/test/lib/LICENSE.txt) URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/LICENSE.txt?p2=xmlbeans/branches/gradle-build/src/test/java/org/w3c/LICENSE.txt&p1=xmlbeans/branches/gradle-build/test/lib/LICENSE.txt&r1=1896455&r2=1896456&rev=1896456&view=diff ============================================================================== --- xmlbeans/branches/gradle-build/test/lib/LICENSE.txt (original) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/LICENSE.txt Mon Dec 27 20:28:38 2021 @@ -1,28 +1,61 @@ -Jar w3c_domts contains the test cases from DOMTS 2001, level2,core. Some test cases have been modified, as has been the test harness.For more information on the Dom Conformance Suite, visit http://www.w3.org/DOM/Test/ +Jar w3c_domts contains the test cases from DOMTS 2001, level2,core. Some test +cases have been modified, as has been the test harness.For more information on +the Dom Conformance Suite, visit http://www.w3.org/DOM/Test/ - -W3C® SOFTWARE NOTICE AND LICENSE +W3C® SOFTWARE NOTICE AND LICENSE http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 -This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. - -Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications: - -The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. -Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code. -Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) -THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. - -COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. - -The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. +This work (and included software, documentation such as READMEs, or other +related items) is being provided by the copyright holders under the following +license. By obtaining, using and/or copying this work, you (the licensee) +agree that you have read, understood, and will comply with the following terms +and conditions. + +Permission to copy, modify, and distribute this software and its documentation, +with or without modification, for any purpose and without fee or royalty is +hereby granted, provided that you include the following on ALL copies of the +software and documentation or portions thereof, including modifications: + +The full text of this NOTICE in a location viewable to users of the +redistributed or derivative work. +Any pre-existing intellectual property disclaimers, notices, or terms and +conditions. If none exist, the W3C Software Short Notice should be included +(hypertext is preferred, text is permitted) within the body of any redistributed +or derivative code. +Notice of any changes or modifications to the files, including the date changes +were made. (We recommend you provide URIs to the location from which the code +is derived.) + +THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE +NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT +THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY +PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + +COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. + +The name and trademarks of copyright holders may NOT be used in advertising or +publicity pertaining to the software without specific, written prior permission. +Title to copyright in this software and any associated documentation will at all +times remain with copyright holders. ____________________________________ -This formulation of W3C's notice and license became active on December 31 2002. This version removes the copyright ownership notice such that this license can be used with materials other than those owned by the W3C, reflects that ERCIM is now a host of the W3C, includes references to this specific dated version of the license, and removes the ambiguous grant of "use". Otherwise, this version is the same as the previous version and is written so as to preserve the Free Software Foundation's assessment of GPL compatibility and OSI's certification under the Open Source Definition. Please see our Copyright FAQ for common questions about using materials from our site, including specific terms and conditions for packages like libwww, Amaya, and Jigsaw. Other questions about this notice can be directed to [email protected]. - +This formulation of W3C's notice and license became active on December 31 2002. +This version removes the copyright ownership notice such that this license can +be used with materials other than those owned by the W3C, reflects that ERCIM +is now a host of the W3C, includes references to this specific dated version of +the license, and removes the ambiguous grant of "use". Otherwise, this version +is the same as the previous version and is written so as to preserve the Free +Software Foundation's assessment of GPL compatibility and OSI's certification +under the Open Source Definition. Please see our Copyright FAQ for common +questions about using materials from our site, including specific terms and +conditions for packages like libwww, Amaya, and Jigsaw. Other questions about +this notice can be directed to [email protected]. + -Joseph Reagle <[email protected]> +Joseph Reagle <[email protected]> Last revised by Reagle $Date$ Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTest.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTest.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTest.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTest.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,86 @@ + +/* + * Copyright (c) 2001-2003 World Wide Web Consortium, (Massachusetts Institute + * of Technology, Institut National de Recherche en Informatique et en + * Automatique, Keio University). All Rights Reserved. This program is + * distributed under the W3C's Software Intellectual Property License. This + * program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See W3C License + * http://www.w3.org/Consortium/Legal/ for more details. + */ + +/* + * $Log: DOMTest.java,v $ + * Revision 1.12 2004/01/05 08:27:14 dom-ts-4 + * XHTML compatible L3 Core tests (bug 455) + * + * Revision 1.11 2003/12/30 06:17:08 dom-ts-4 + * Miscellaneous L&S changes based on implementor feedback (bug 447) + * + * Revision 1.10 2003/12/19 22:21:04 dom-ts-4 + * willBeModified violation detection support (bug 412) + * Revision 1.9 2003/12/09 08:22:27 dom-ts-4 Additional + * L&S tests, mostly configuration (Bug 401) + * + * Revision 1.8 2003/12/02 03:49:29 dom-ts-4 Load/save fixup (bug 396) + * + * Revision 1.7 2003/06/27 05:36:05 dom-ts-4 contentType condition fixes: + * http://www.w3.org/Bugs/Public/show_bug.cgi?id=241 + * + * Revision 1.6 2003/04/24 05:02:05 dom-ts-4 Xalan-J support for L3 XPath + * http://www.w3.org/Bugs/Public/show_bug.cgi?id=191 + * + * Revision 1.5 2003/04/23 05:48:24 dom-ts-4 DOMTSML and framework support for + * createXPathEvaluator http://www.w3.org/Bugs/Public/show_bug.cgi?id=190 + * + * Revision 1.4 2003/04/03 07:18:23 dom-ts-4 Added openStream method + * + * Revision 1.3 2002/08/13 04:44:46 dom-ts-4 Added getImplementation() + * + * Revision 1.2 2002/02/03 04:22:35 dom-ts-4 DOM4J and Batik support added. + * Rework of parser settings + * + * Revision 1.1 2001/07/23 04:52:20 dom-ts-4 Initial test running using JUnit. + * + */ + +package org.w3c.domts; + +import dom.common.Loader; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import tools.util.JarUtil; + +/** + * This is an abstract base class for generated DOM tests + */ + +public abstract class DOMTest { + private Document _XBeanDoc; + + public DOMImplementation getImplementation() { + return _XBeanDoc.getImplementation(); + } + + public Document load(String docURI, boolean willBeModified) + throws DOMTestLoadException { + + + try { + String sXml = JarUtil.getResourceFromJar( + "xbean/dom/W3C/level2/core/files/" + docURI + ".xml"); + Loader _loader = Loader.getLoader(); + _XBeanDoc = _loader.load(sXml); + } catch (Exception e) { + throw new DOMTestLoadException(e); + } + return _XBeanDoc; + } + + abstract public String getTargetURI(); + + public final boolean isExpandEntityReferences() { + return false; + } +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestCase.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestCase.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestCase.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestCase.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,302 @@ + +/* + * Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute + * of Technology, Institut National de Recherche en Informatique et en + * Automatique, Keio University). All Rights Reserved. This program is + * distributed under the W3C's Software Intellectual Property License. This + * program is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See W3C License + * http://www.w3.org/Consortium/Legal/ for more details. + */ + +/* + * $Log: DOMTestCase.java,v $ + * Revision 1.17 2004/01/06 16:45:42 dom-ts-4 + * Removed obsolete avalon testlet support (bug 400) + * Revision 1.16 2003/12/23 03:27:25 dom-ts-4 Adds + * fail construct (bug 445) + * + * Revision 1.15 2003/12/06 06:50:29 dom-ts-4 More fixes for L&S (Bug 396) + * + * Revision 1.14 2003/11/18 08:14:55 dom-ts-4 assertTrue does not accept + * Object's (bug 380) + * + * Revision 1.13 2002/07/01 03:57:31 dom-ts-4 Added name parameter to + * assertURIEquals + * + * Revision 1.12 2002/06/03 23:48:48 dom-ts-4 Support for Events tests + * + * Revision 1.11 2002/02/03 04:22:35 dom-ts-4 DOM4J and Batik support added. + * Rework of parser settings + * + * Revision 1.10 2002/01/30 07:08:44 dom-ts-4 Update for GNUJAXP + * + * Revision 1.9 2001/12/10 05:37:21 dom-ts-4 Added xml_alltests, svg_alltests, + * and html_alltests suites to run all tests using a particular content type. + * + * Revision 1.8 2001/11/01 15:02:50 dom-ts-4 Doxygen and Avalon support + * + * Revision 1.7 2001/10/18 07:58:17 dom-ts-4 assertURIEquals added Can now run + * from dom1-core.jar + * + * Revision 1.6 2001/08/30 08:30:18 dom-ts-4 Added metadata and Software + * licence (dropped in earlier processing) to test Enhanced test-matrix.xsl + * + * Revision 1.5 2001/08/22 22:12:49 dom-ts-4 Now passing all tests with default + * settings + * + * Revision 1.4 2001/08/22 06:22:46 dom-ts-4 Updated resource path for IDE + * debugging + * + * Revision 1.3 2001/08/20 06:56:35 dom-ts-4 Full compile (-2 files that lock + * up Xalan 2.1) + * + * Revision 1.2 2001/07/23 04:52:20 dom-ts-4 Initial test running using JUnit. + * + */ + +package org.w3c.domts; + +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +import java.util.Collection; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * This is an abstract base class for generated DOM tests + */ + +public abstract class DOMTestCase extends DOMTest { + private DOMTestFramework framework; + + /** + * This constructor is for DOMTestCase's that make specific demands for + * parser configuration. setFactory should be called before the end of the + * tests constructor to set the factory. + */ + public DOMTestCase() { + framework = new XBeanFramework(); + } + + /** + * Sets test framework to be used by test. + */ + public void setFramework(DOMTestFramework framework) { + this.framework = framework; + } + + /** + * Asserts that the length of the collection is the expected size. + * + * @param assertID identifier of assertion + * @param expectedSize expected size + * @param collection collection + */ + public void assertSize( + String assertID, + int expectedSize, + NodeList collection) { + framework.assertSize(this, assertID, expectedSize, collection); + + } + + /** + * Asserts that the length of the collection is the expected size. + * + * @param assertID identifier of assertion + * @param expectedSize expected size + * @param collection collection + */ + public void assertSize( + String assertID, + int expectedSize, + NamedNodeMap collection) { + framework.assertSize(this, assertID, expectedSize, collection); + + } + + /** + * Asserts that the length of the collection is the expected size. + * + * @param assertID identifier of assertion + * @param expectedSize expected size + * @param collection collection + */ + public void assertSize( + String assertID, + int expectedSize, + Collection collection) { + framework.assertSize(this, assertID, expectedSize, collection); + + } + + /** + * Asserts that expected.equalsIgnoreCase(actual) is true + * + * @param assertID identifier of assertion + * @param actual actual value + * @param expected Expected value, may not be null. + */ + public void assertEqualsIgnoreCase( + String assertID, + String expected, + String actual) { + framework.assertEqualsIgnoreCase(this, assertID, expected, actual); + + } + + public void assertURIEquals( + String assertID, + String scheme, + String path, + String host, + String file, + String name, + String query, + String fragment, + Boolean isAbsolute, + String actual) { + // + // URI must be non-null + assertNotNull(assertID, actual); + + String uri = actual; + + int lastPound = actual.lastIndexOf("#"); + String actualFragment = ""; + if (lastPound != -1) { + // + // substring before pound + // + uri = actual.substring(0, lastPound); + actualFragment = actual.substring(lastPound + 1); + } + if (fragment != null) { + assertEquals(assertID, fragment, actualFragment); + } + + int lastQuestion = uri.lastIndexOf("?"); + String actualQuery = ""; + if (lastQuestion != -1) { + // + // substring before pound + // + uri = actual.substring(0, lastQuestion); + actualQuery = actual.substring(lastQuestion + 1); + } + if (query != null) { + assertEquals(assertID, query, actualQuery); + } + + int firstColon = uri.indexOf(":"); + int firstSlash = uri.indexOf("/"); + String actualPath = uri; + String actualScheme = ""; + if (firstColon != -1 && firstColon < firstSlash) { + actualScheme = uri.substring(0, firstColon); + actualPath = uri.substring(firstColon + 1); + } + + if (scheme != null) { + assertEquals(assertID, scheme, actualScheme); + } + + if (path != null) { + assertEquals(assertID, path, actualPath); + } + + if (host != null) { + String actualHost = ""; + if (actualPath.startsWith("//")) { + int termSlash = actualPath.indexOf("/", 2); + actualHost = actualPath.substring(0, termSlash); + } + assertEquals(assertID, host, actualHost); + } + + String actualFile = actualPath; + if (file != null || name != null) { + int finalSlash = actualPath.lastIndexOf("/"); + if (finalSlash != -1) { + actualFile = actualPath.substring(finalSlash + 1); + } + if (file != null) { + assertEquals(assertID, file, actualFile); + } + } + + if (name != null) { + String actualName = actualFile; + int finalPeriod = actualFile.lastIndexOf("."); + if (finalPeriod != -1) { + actualName = actualFile.substring(0, finalPeriod); + } + assertEquals(assertID, name, actualName); + } + + if (isAbsolute != null) { + // + // Jar URL's will have any actual path like file:/c:/somedrive... + assertEquals( + assertID, + isAbsolute.booleanValue(), + actualPath.startsWith("/") || actualPath.startsWith("file:/")); + } + } + + + public boolean same(Object expected, Object actual) { + return framework.same(expected, actual); + } + + public boolean equals(String expected, String actual) { + return framework.equals(expected, actual); + } + + public boolean equals(int expected, int actual) { + return framework.equals(expected, actual); + } + + public boolean equals(double expected, double actual) { + return framework.equals(expected, actual); + } + + public boolean equals(Collection expected, Collection actual) { + return framework.equals(expected, actual); + } + + + public boolean equals(List expected, List actual) { + return framework.equals(expected, actual); + } + + public int size(Collection collection) { + return framework.size(collection); + } + + /** + * Gets the size of the collection + * + * @param collection collection, may not be null. + * @return size of collection + */ + public int size(NamedNodeMap collection) { + return framework.size(collection); + } + + /** + * Gets the size of the collection + * + * @param collection collection, may not be null. + * @return size of collection + */ + public int size(NodeList collection) { + return framework.size(collection); + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestFramework.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestFramework.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestFramework.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestFramework.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,132 @@ + +/* + * Copyright (c) 2001 World Wide Web Consortium, + * (Massachusetts Institute of Technology, Institut National de + * Recherche en Informatique et en Automatique, Keio University). All + * Rights Reserved. This program is distributed under the W3C's Software + * Intellectual Property License. This program is distributed in the + * hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. + * See W3C License http://www.w3.org/Consortium/Legal/ for more details. + */ + +/* +$Log: DOMTestFramework.java,v $ +Revision 1.11 2003/12/23 03:27:25 dom-ts-4 +Adds fail construct (bug 445) + +Revision 1.10 2003/12/06 06:50:29 dom-ts-4 +More fixes for L&S (Bug 396) + +Revision 1.9 2003/01/25 18:41:53 dom-ts-4 +Removed tabs and other code cleanup + +Revision 1.8 2002/08/12 08:09:18 dom-ts-4 +Added name parameter to assertURIEquals + +Revision 1.7 2002/06/03 23:48:48 dom-ts-4 +Support for Events tests + +Revision 1.6 2001/10/18 07:58:17 dom-ts-4 +assertURIEquals added +Can now run from dom1-core.jar + +Revision 1.5 2001/08/22 22:12:49 dom-ts-4 +Now passing all tests with default settings + +Revision 1.4 2001/07/23 04:52:20 dom-ts-4 +Initial test running using JUnit. + +*/ + +package org.w3c.domts; + +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilder; +import java.util.Collection; +import java.util.List; + +/** + * This interface provides services typically provided by a test framework + */ +public interface DOMTestFramework { + boolean hasFeature( + DocumentBuilder docBuilder, + String feature, + String version); + + void fail(DOMTestCase test, String assertID); + + void assertTrue(DOMTestCase test, String assertID, boolean actual); + + void assertFalse(DOMTestCase test, String assertID, boolean actual); + + void assertNull(DOMTestCase test, String assertID, Object actual); + + void assertNotNull(DOMTestCase test, String assertID, Object actual); + + void assertSize( + DOMTestCase test, + String assertID, + int expectedSize, + NodeList collection); + + void assertSize( + DOMTestCase test, + String assertID, + int expectedSize, + NamedNodeMap collection); + + void assertSize( + DOMTestCase test, + String assertID, + int expectedSize, + Collection collection); + + void assertEqualsIgnoreCase( + DOMTestCase test, + String assertID, + String expected, + String actual); + + void assertEquals( + DOMTestCase test, + String assertID, + String expected, + String actual); + + void assertEquals( + DOMTestCase test, + String assertID, + int expected, + int actual); + + void assertEquals( + DOMTestCase test, + String assertID, + boolean expected, + boolean actual); + + boolean same(Object expected, Object actual); + + boolean equals(String expected, String actual); + + boolean equals(int expected, int actual); + + boolean equals(boolean expected, boolean actual); + + boolean equals(double expected, double actual); + + boolean equals(Collection expected, Collection actual); + + boolean equals(List expected, List actual); + + int size(Collection collection); + + int size(NamedNodeMap collection); + + int size(NodeList collection); +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestLoadException.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestLoadException.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestLoadException.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/DOMTestLoadException.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,44 @@ + +/* + * Copyright (c) 2001 World Wide Web Consortium, + * (Massachusetts Institute of Technology, Institut National de + * Recherche en Informatique et en Automatique, Keio University). All + * Rights Reserved. This program is distributed under the W3C's Software + * Intellectual Property License. This program is distributed in the + * hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. + * See W3C License http://www.w3.org/Consortium/Legal/ for more details. + */ + + +package org.w3c.domts; + + +/** + * Encapsulates a concrete load exception such as + * a SAX exception + * + * @author Curt Arnold + * @date 2 Feb 2002 + */ + +public class DOMTestLoadException extends Exception { + private final Throwable innerException; + + /** + * Constructor + * + * @param innerException should not be null + */ + public DOMTestLoadException(Throwable innerException) { + this.innerException = innerException; + } + + public String toString() { + if (innerException != null) { + return innerException.toString(); + } + return super.toString(); + } +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/XBeanFramework.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/XBeanFramework.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/XBeanFramework.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/XBeanFramework.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,202 @@ + +/* + * Copyright (c) 2001 World Wide Web Consortium, + * (Massachusetts Institute of Technology, Institut National de + * Recherche en Informatique et en Automatique, Keio University). All + * Rights Reserved. This program is distributed under the W3C's Software + * Intellectual Property License. This program is distributed in the + * hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. + * See W3C License http://www.w3.org/Consortium/Legal/ for more details. + */ + +/* +$Log: DOMTestFramework.java,v $ +Revision 1.11 2003/12/23 03:27:25 dom-ts-4 +Adds System.err.println construct (bug 445) + +Revision 1.10 2003/12/06 06:50:29 dom-ts-4 +More fixes for L&S (Bug 396) + +Revision 1.9 2003/01/25 18:41:53 dom-ts-4 +Removed tabs and other code cleanup + +Revision 1.8 2002/08/12 08:09:18 dom-ts-4 +Added name parameter to assertURIEquals + +Revision 1.7 2002/06/03 23:48:48 dom-ts-4 +Support for Events tests + +Revision 1.6 2001/10/18 07:58:17 dom-ts-4 +assertURIEquals added +Can now run from dom1-core.jar + +Revision 1.5 2001/08/22 22:12:49 dom-ts-4 +Now passing all tests with default settings + +Revision 1.4 2001/07/23 04:52:20 dom-ts-4 +Initial test running using JUnit. + +*/ + +package org.w3c.domts; + +import org.junit.Assert; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilder; +import java.util.Collection; +import java.util.List; +import java.util.Objects; + +/** + * This interface provides services typically provided by a test framework + */ +public class XBeanFramework implements DOMTestFramework { + + public boolean hasFeature( + DocumentBuilder docBuilder, + String feature, + String version) { + System.err.println("????????"); + return false; + } + + public void fail(DOMTestCase test, String assertID) { + Assert.fail("System.Err.Printlnure at " + assertID); + } + + public void assertTrue(DOMTestCase test, String assertID, boolean actual) { + Assert.assertTrue(actual); + } + + public void assertFalse(DOMTestCase test, String assertID, boolean actual) { + Assert.assertFalse(actual); + } + + public void assertNull(DOMTestCase test, String assertID, Object actual) { + Assert.assertNull(actual); + } + + public void assertNotNull(DOMTestCase test, String assertID, Object actual) { + Assert.assertNotNull(actual); + } + + public void assertSize( + DOMTestCase test, + String assertID, + int expectedSize, + NodeList collection) { + Assert.assertEquals(expectedSize, collection.getLength()); + } + + public void assertSize( + DOMTestCase test, + String assertID, + int expectedSize, + NamedNodeMap collection) { + + Assert.assertEquals(expectedSize, collection.getLength()); + } + + public void assertSize( + DOMTestCase test, + String assertID, + int expectedSize, + Collection collection) { + Assert.assertEquals(expectedSize, collection.size()); + + } + + public void assertEqualsIgnoreCase( + DOMTestCase test, + String assertID, + String expected, + String actual) { + Assert.assertEquals(expected.toLowerCase(), actual.toLowerCase()); + } + + public void assertEquals( + DOMTestCase test, + String assertID, + String expected, + String actual) { + Assert.assertEquals(expected, actual); + } + + public void assertEquals( + DOMTestCase test, + String assertID, + int expected, + int actual) { + Assert.assertEquals(expected, actual); + } + + public void assertEquals( + DOMTestCase test, + String assertID, + boolean expected, + boolean actual) { + Assert.assertEquals(expected, actual); + } + + public void assertEquals( + DOMTestCase test, + String assertID, + double expected, + double actual) { + Assert.assertEquals(expected, actual, 0.0); + } + + public void assertEquals( + DOMTestCase test, + String assertID, + Collection expected, + Collection actual) { + Assert.assertEquals(expected, actual); + } + + public boolean same(Object expected, Object actual) { + return Objects.equals(expected, actual); + } + + public boolean equals(String expected, String actual) { + return Objects.equals(expected, actual); + } + + public boolean equals(int expected, int actual) { + return expected == actual; + } + + public boolean equals(boolean expected, boolean actual) { + return expected == actual; + } + + public boolean equals(double expected, double actual) { + return expected == actual; + } + + public boolean equals(Collection expected, Collection actual) { + System.err.println("????????"); + return false; + } + + public boolean equals(List expected, List actual) { + System.err.println("????????"); + return false; + } + + public int size(Collection collection) { + return collection.size(); + } + + public int size(NamedNodeMap collection) { + return collection.getLength(); + } + + public int size(NodeList collection) { + return collection.getLength(); + } +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,81 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001-2003 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "getOwnerElement()" will return the Element node this attribute is attached to or + * null if this attribute is not in use. + * Retreive the default attribute defaultAttr and check its owner element. Verify if the name + * the nodeName of the returned ownerElement is emp:employee. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement">http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement</a> + * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a> + */ +public class attrgetownerelement01 extends DOMTestCase { + + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + Attr attr; + Element element; + Element ownerElement; + String ownerElementName; + NodeList elementList; + NamedNodeMap attributes; + String nullNS = null; + + doc = load("staffNS", false); + elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "employee"); + element = (Element) elementList.item(1); + attributes = element.getAttributes(); + attr = (Attr) attributes.getNamedItemNS(nullNS, "defaultAttr"); + ownerElement = attr.getOwnerElement(); + ownerElementName = ownerElement.getNodeName(); + assertEquals("attrgetownerelement01", "emp:employee", ownerElementName); + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement01"; + } + +} + + + + + + Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,69 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.domts.DOMTestCase; + + +/** + * The "getOwnerElement()" will return the Element node this attribute + * is attached to or null if this attribute is not in use. + * Create a new element and attribute node, attach the attribute to the element. + * Check the value of owner element of the new attribute node + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement">http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement</a> + */ +public class attrgetownerelement02 extends DOMTestCase { + + @Test + public void testRun() throws Throwable { + Document doc; + Element element; + Element ownerElement; + String ownerElementName; + Attr attr; + Attr newAttr; + doc = load("staffNS", false); + element = doc.createElement("root"); + attr = doc.createAttributeNS("http://www.w3.org/DOM/L1", "L1:att"); + newAttr = element.setAttributeNodeNS(attr); + ownerElement = attr.getOwnerElement(); + ownerElementName = ownerElement.getNodeName(); + assertEqualsIgnoreCase("attrgetownerelement02", "root", ownerElementName); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,65 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNull; + + +/** + * The "getOwnerElement()" will return the Element node this attribute + * is attached to or null if this attribute is not in use. + * <p> + * Create a new attribute node for this document node. Since the newly attribute is + * not it use its owner element should be null. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement">http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement</a> + */ +public class attrgetownerelement03 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Node ownerElement; + Attr attr; + doc = load("staffNS", false); + attr = doc.createAttributeNS("http://www.w3.org/DOM", "dom:attr"); + ownerElement = attr.getOwnerElement(); + assertNull("attrgetownerelement03", ownerElement); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement04.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement04.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement04.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement04.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,76 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertNull; + + +/** + * The "getOwnerElement()" will return the Element node this attribute is attached to or + * null if this attribute is not in use. + * <p> + * Import an attribute node to another document. If an Attr node is imported, its + * ownerElement attribute should be set to null. Verify if the ownerElement has been set + * to null. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement">http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement</a> + */ +public class attrgetownerelement04 extends DOMTestCase { + + @Test + @Ignore + public void testRun() throws Throwable { + Document doc; + Document docImp; + Node ownerElement; + Element element; + Attr attr; + Attr attrImp; + doc = load("staffNS", false); + docImp = load("staff", false); + element = doc.getElementById("CANADA"); + attr = element.getAttributeNodeNS("http://www.nist.gov", "zone"); + attrImp = (Attr) docImp.importNode(attr, true); + ownerElement = attrImp.getOwnerElement(); + assertNull("attrgetownerelement04", ownerElement); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement04"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement05.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement05.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement05.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/attrgetownerelement05.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,77 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001-2003 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.*; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "getOwnerElement()" will return the Element node this attribute is attached to + * or null if this attribute is not in use. + * Retreive an element and its attributes. Then remove the element and check the name of + * the ownerElement of attribute of the attribute "street". + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement">http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement</a> + * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a> + */ +public class attrgetownerelement05 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + Document doc; + Node element; + Element ownerElement; + Element parentElement; + NodeList elementList; + String ownerElementName; + Attr attr; + Node removedChild; + NamedNodeMap nodeMap; + String nullNS = null; + + doc = load("staffNS", true); + elementList = doc.getElementsByTagNameNS("*", "address"); + element = elementList.item(1); + parentElement = (Element) element.getParentNode(); + nodeMap = element.getAttributes(); + removedChild = parentElement.removeChild(element); + attr = (Attr) nodeMap.getNamedItemNS(nullNS, "street"); + ownerElement = attr.getOwnerElement(); + ownerElementName = ownerElement.getNodeName(); + assertEquals("attrgetownerelement05", "address", ownerElementName); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement05"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,78 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "createAttributeNS(namespaceURI,qualifiedName)" method for a + * Document should raise NAMESPACE_ERR DOMException + * if qualifiedName is malformed. + * <p> + * Invoke method createAttributeNS(namespaceURI,qualifiedName) on + * the XMLNS Document with namespaceURI being "http://www.ecommerce.org/", + * qualifiedName as "prefix::local". Method should raise + * NAMESPACE_ERR DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class createAttributeNS01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.ecommerce.org/"; + String malformedName = "prefix::local"; + Document doc; + Attr newAttr; + doc = load("staffNS", false); + + { + boolean success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI, malformedName); + } catch (DOMException ex) { + assertEquals(DOMException.NAMESPACE_ERR, ex.code); + } + + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,80 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + + +/** + * The "createAttributeNS(namespaceURI,qualifiedName)" method for a + * Document should raise NAMESPACE_ERR DOMException + * if qualifiedName has a prefix and namespaceURI is null. + * <p> + * Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document + * with namespaceURI being null and qualifiedName contains the prefix "person". + * Method should raise NAMESPACE_ERR DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class createAttributeNS02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = null; + + String qualifiedName = "prefix:local"; + Document doc; + Attr newAttr; + doc = load("staffNS", false); + + { + boolean success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI, qualifiedName); + fail("throw_NAMESPACE_ERR,qualifiedName has a prefix and namespaceURI is null"); + } catch (DOMException ex) { + assertTrue(ex.code == DOMException.NAMESPACE_ERR); + } + //assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,109 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "createAttributeNS(namespaceURI,qualifiedName)" method for a + * Document should raise INVALID_CHARACTER_ERR DOMException + * if qualifiedName contains an illegal character. + * <p> + * Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document + * with qualifiedName containing an illegal character from illegalChars[]. + * Method should raise INVALID_CHARACTER_ERR DOMException for all + * characters in illegalChars[]. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a> + */ +public class createAttributeNS03 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.wedding.com/"; + String qualifiedName; + Document doc; + Attr newAttr; + java.util.List illegalQNames = new java.util.ArrayList(); + illegalQNames.add("person:{"); + illegalQNames.add("person:}"); + illegalQNames.add("person:~"); + illegalQNames.add("person:'"); + illegalQNames.add("person:!"); + illegalQNames.add("person:@"); + illegalQNames.add("person:#"); + illegalQNames.add("person:$"); + illegalQNames.add("person:%"); + illegalQNames.add("person:^"); + illegalQNames.add("person:&"); + illegalQNames.add("person:*"); + illegalQNames.add("person:("); + illegalQNames.add("person:)"); + illegalQNames.add("person:+"); + illegalQNames.add("person:="); + illegalQNames.add("person:["); + illegalQNames.add("person:]"); + illegalQNames.add("person:\\"); + illegalQNames.add("person:/"); + illegalQNames.add("person:;"); + illegalQNames.add("person:`"); + illegalQNames.add("person:<"); + illegalQNames.add("person:>"); + illegalQNames.add("person:,"); + illegalQNames.add("person:a "); + illegalQNames.add("person:\""); + + doc = load("staffNS", false); + for (int indexd292e121 = 0; indexd292e121 < illegalQNames.size(); indexd292e121++) { + qualifiedName = (String) illegalQNames.get(indexd292e121); + + { + boolean success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI, qualifiedName); + } catch (DOMException ex) { + success = (ex.code == DOMException.INVALID_CHARACTER_ERR); + } + assertTrue("throw_INVALID_CHARACTER_ERR", success); + } + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS03"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS04.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS04.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS04.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS04.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,82 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + + +/** + * The "createAttributeNS(namespaceURI,qualifiedName)" method for a + * Document should raise NAMESPACE_ERR DOMException + * if qualifiedName has the "xml" prefix and namespaceURI is different + * from "http://www.w3.org/XML/1998/namespace". + * <p> + * Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document + * with qualifiedName being "xml:attr1 and namespaceURI equals + * the string "http://www.w3.org/XML/1998/namespaces" (which differs from the required + * string "http://www.w3.org/XML/1998/namespace"). + * Method should raise NAMESPACE_ERR DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class createAttributeNS04 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.w3.org/XML/1998/namespaces"; + String qualifiedName = "xml:attr1"; + Document doc; + Attr newAttr; + doc = load("staffNS", false); + + { + boolean success = false; + try { + newAttr = doc.createAttributeNS(namespaceURI, qualifiedName); + fail("BAD NS for prefix xml"); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS04"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS05.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS05.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS05.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createAttributeNS05.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,68 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.Attr; +import org.w3c.dom.Document; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertEquals; + + +/** + * The "createAttributeNS(namespaceURI,qualifiedName)" method for a + * Document should return a new Attr object given that all parameters are + * valid and correctly formed. + * <p> + * Invoke method createAttributeNS(namespaceURI,qualifiedName) on this document with + * parameters equal "http://www.ecommerce.org/" and "ecom:local" + * respectively. Method should return a new Attr object whose name is "ecom:local". + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1112119403">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1112119403</a> + */ +public class createAttributeNS05 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.ecommerce.org/"; + String qualifiedName = "econm:local"; + Document doc; + Attr newAttr; + String attrName; + doc = load("staffNS", false); + newAttr = doc.createAttributeNS(namespaceURI, qualifiedName); + attrName = newAttr.getName(); + assertEquals(qualifiedName, attrName); + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createAttributeNS05"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument01.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument01.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument01.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument01.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,85 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + * DOMImplementation should raise NAMESPACE_ERR DOMException + * if parameter qualifiedName is malformed. + * <p> + * Retrieve the DOMImplementation on the XMLNS Document. + * Invoke method createDocument(namespaceURI,qualifiedName,doctype) + * on the retrieved DOMImplementation with namespaceURI being + * the literal string "http://www.ecommerce.org/", qualifiedName as + * "prefix::local", and doctype as null. Method should raise + * NAMESPACE_ERR DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class createDocument01 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = "http://www.ecommerce.org/"; + String malformedName = "prefix::local"; + Document doc; + DocumentType docType = null; + + DOMImplementation domImpl; + Document aNewDoc; + doc = load("staffNS", false); + domImpl = doc.getImplementation(); + + { + boolean success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI, malformedName, docType); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument01"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument02.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument02.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument02.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument02.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,83 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + * DOMImplementation should raise NAMESPACE_ERR DOMException + * if qualifiedName has a prefix and namespaceURI is null. + * <p> + * Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + * this domimplementation with namespaceURI being null and qualifiedName + * equals "k:local". Method should raise NAMESPACE_ERR DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a> + */ +public class createDocument02 extends DOMTestCase { + @Test + public void testRun() throws Throwable { + String namespaceURI = null; + + String qualifiedName = "k:local"; + Document doc; + DocumentType docType = null; + + DOMImplementation domImpl; + Document aNewDoc; + doc = load("staffNS", false); + domImpl = doc.getImplementation(); + + { + boolean success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI, qualifiedName, docType); + } catch (DOMException ex) { + success = (ex.code == DOMException.NAMESPACE_ERR); + } + assertTrue("throw_NAMESPACE_ERR, qualifiedName has a prefix and namespaceURI is null", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument02"; + } + +} Added: xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument03.java URL: http://svn.apache.org/viewvc/xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument03.java?rev=1896456&view=auto ============================================================================== --- xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument03.java (added) +++ xmlbeans/branches/gradle-build/src/test/java/org/w3c/domts/level2/core/createDocument03.java Mon Dec 27 20:28:38 2021 @@ -0,0 +1,84 @@ +/* +This Java source file was generated by test-to-java.xsl +and is a derived work from the source document. +The source document contained the following notice: + + + +Copyright (c) 2001 World Wide Web Consortium, +(Massachusetts Institute of Technology, Institut National de +Recherche en Informatique et en Automatique, Keio University). All +Rights Reserved. This program is distributed under the W3C's Software +Intellectual Property License. This program is distributed in the +hope that it will be useful, but WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. + +See W3C License http://www.w3.org/Consortium/Legal/ for more details. + + +*/ + +package org.w3c.domts.level2.core; + + +import org.junit.Ignore; +import org.junit.Test; +import org.w3c.dom.DOMException; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.domts.DOMTestCase; + +import static org.junit.Assert.assertTrue; + + +/** + * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a + * DOMImplementation should raise WRONG_DOCUMENT_ERR DOMException + * if parameter doctype has been used with a different document. + * <p> + * Invoke method createDocument(namespaceURI,qualifiedName,doctype) on + * this domimplementation where doctype is the type of this document. + * Method should raise WRONG_DOCUMENT_ERR DOMException. + * + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='WRONG_DOCUMENT_ERR'])</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument</a> + * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='WRONG_DOCUMENT_ERR'])</a> + */ +public class createDocument03 extends DOMTestCase { + @Test + @Ignore + public void testRun() throws Throwable { + String namespaceURI = "http://www.ecommerce.org/schema"; + String qualifiedName = "namespaceURI:x"; + Document doc; + DocumentType docType; + DOMImplementation domImpl; + Document aNewDoc; + doc = load("staffNS", false); + docType = doc.getDoctype(); + domImpl = doc.getImplementation(); + + { + boolean success = false; + try { + aNewDoc = domImpl.createDocument(namespaceURI, qualifiedName, docType); + } catch (DOMException ex) { + success = (ex.code == DOMException.WRONG_DOCUMENT_ERR); + } + assertTrue("throw_WRONG_DOCUMENT_ERR", success); + } + + } + + /** + * Gets URI that identifies the test + * + * @return uri identifier of test + */ + public String getTargetURI() { + return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/createDocument03"; + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
