You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2019/01/18 23:08:48 UTC
svn commit: r1851656 [8/28] - in /xmlbeans/trunk: ./ external/ lib/
resources/ resources/typeimpl/ resources/typeimpl/org/
resources/typeimpl/org/apache/ resources/typeimpl/org/apache/xmlbeans/
resources/typeimpl/org/apache/xmlbeans/impl/ resources/typ...
Modified: xmlbeans/trunk/test/src/dom/common/NodeWithChildrenTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/common/NodeWithChildrenTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/common/NodeWithChildrenTest.java (original)
+++ xmlbeans/trunk/test/src/dom/common/NodeWithChildrenTest.java Fri Jan 18 23:08:44 2019
@@ -15,24 +15,23 @@
package dom.common;
+import org.junit.Ignore;
+import org.junit.Test;
import org.w3c.dom.*;
+import static org.junit.Assert.*;
-
-
+@Ignore
public abstract class NodeWithChildrenTest extends NodeTest {
-
- public NodeWithChildrenTest(String s) {
- super(s);
- }
-
+ @Test
public void testRemoveChildEnd() {
Node node = m_node.getLastChild();
super.testRemoveChild(node);
}
+ @Test
public void testRemoveChild() {
NodeList children = m_node.getChildNodes();
int pos = children.getLength() / 2;
@@ -41,12 +40,12 @@ public abstract class NodeWithChildrenTe
}
-
+ @Test
public void testRemoveChildDiffImpl() throws Exception {
Node toRemove=NodeTest.getApacheNode(sXml,true,'E');
try {
- super.testRemoveChild(toRemove);
+ super.testRemoveChild(toRemove);
fail("Removing node from a different impl");
} catch (DOMException de) {
assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
@@ -54,6 +53,7 @@ public abstract class NodeWithChildrenTe
}
+ @Test
public void testRemoveChildDiffDoc() throws Exception {
Node toRemove=m_docNS.getDocumentElement();
try {
@@ -65,18 +65,19 @@ public abstract class NodeWithChildrenTe
}
-
-
+ @Test
public void testRemoveChildFront() {
Node node = m_node.getFirstChild();
super.testRemoveChild(node);
}
+ @Test
public void testRemoveChildNull() {
super.testRemoveChild(null);
}
+ @Test
public void testReplaceChild() {
NodeList children = m_node.getChildNodes();
int pos = children.getLength() / 2;
@@ -90,25 +91,29 @@ public abstract class NodeWithChildrenTe
}
+ @Test
public void testReplaceChildEnd() {
Node node = m_node.getLastChild();
Node newNode = m_doc.createTextNode("fooBAR");
super.testReplaceChild(newNode, node);
}
+ @Test
public void testReplaceChildFront() {
Node node = m_node.getFirstChild();
Node newNode = m_doc.createTextNode("fooBAR");
super.testReplaceChild(newNode, node);
}
+ @Test
public void testReplaceChildNullChild() {
Node node = m_node.getChildNodes().item(0);
Node newNode = null;
- assertFalse(null == node);
+ assertNotNull(node);
super.testReplaceChild(newNode, node);
}
+ @Test
public void testReplaceChildNull() {
Node node = null;
Node newNode;
@@ -119,6 +124,7 @@ public abstract class NodeWithChildrenTe
super.testReplaceChild(newNode, node);
}
+ @Test
public void testReplaceChildDNE() {
if (!(m_doc instanceof Document))
@@ -136,7 +142,7 @@ public abstract class NodeWithChildrenTe
//newChild was created from a different document than the one that created this node
newNode = m_docNS.createElement("fooBAR");
- assertFalse(m_docNS.equals(m_node.getOwnerDocument()));
+ assertNotEquals(m_docNS, m_node.getOwnerDocument());
try {
super.testReplaceChild(newNode, node);
fail("Node is from the wrong document");
@@ -161,7 +167,7 @@ public abstract class NodeWithChildrenTe
// public void testInsertBeforeDiffDoc(){}:done above
-
+ @Test
public void testReplace_replacement_DiffImpl() throws Exception {
Node node = m_node.getFirstChild();
Node newnode=NodeTest.getApacheNode(sXml,true,'T');
@@ -175,6 +181,7 @@ public abstract class NodeWithChildrenTe
}
//ref child is diff impl
+ @Test
public void testReplace_target_DiffImpl() throws Exception {
Node node =NodeTest.getApacheNode(sXml,true,'E');
Node newnode=m_node.getFirstChild();
@@ -187,6 +194,7 @@ public abstract class NodeWithChildrenTe
}
+ @Test
public void testReplaceChildDocFrag() {
DocumentFragment child = m_doc.createDocumentFragment();
child.appendChild(m_doc.createElement("foo"));
@@ -195,18 +203,21 @@ public abstract class NodeWithChildrenTe
super.testReplaceChild(child, toReplace);
}
+ @Test
public void testInsertBefore() {
Node target = m_node.getFirstChild();
Node child = m_doc.createElementNS("org.foo.www", "foonode");
- assertFalse(target == null);
+ assertNotNull(target);
super.testInsertBefore(child, target);
}
+ @Test
public void testInsertBeforeNullTarget() {
Node child = m_doc.createElementNS("org.foo.www", "foonode");
super.testInsertBefore(child, null);
}
+ @Test
public void testInsertBeforeInvalidRefNode() {
Node child = m_doc.createElementNS("org.foo.www", "foonode");
Node target = m_doc.createElement("foo");
@@ -219,6 +230,7 @@ public abstract class NodeWithChildrenTe
}
}
+ @Test
public void testInsertBeforeNewChildDiffDoc(){
Node target = m_node.getFirstChild();
Node toInsert=m_docNS.getDocumentElement();
@@ -232,6 +244,7 @@ public abstract class NodeWithChildrenTe
}
+ @Test
public void testInsertBeforeNewChildDiffImpl() throws Exception {
Node target = m_node.getFirstChild();
Node toInsert=NodeTest.getApacheNode(sXml,true,'T');
@@ -244,32 +257,32 @@ public abstract class NodeWithChildrenTe
}
+ @Test
public void testInsertBeforeRefChildDiffDoc(){
- Node target = m_docNS.getDocumentElement();
- Node toInsert= m_node.getFirstChild();;
- try {
- super.testInsertBefore(toInsert, target);
- fail("Ref Child from a different doc");
- } catch (DOMException de) {
- assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
- }
-
-
+ Node target = m_docNS.getDocumentElement();
+ Node toInsert = m_node.getFirstChild();
+ try {
+ super.testInsertBefore(toInsert, target);
+ fail("Ref Child from a different doc");
+ } catch (DOMException de) {
+ assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
}
+ }
- public void testInsertBeforeRefChildDiffImpl() throws Exception {
- Node target = NodeTest.getApacheNode(sXml,true,'T');
- Node toInsert=m_node.getFirstChild();;
- try {
- super.testInsertBefore(toInsert, target);
- fail("Inserting node created from a different impl");
- } catch (DOMException de) {
- assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
- }
-
+ @Test
+ public void testInsertBeforeRefChildDiffImpl() throws Exception {
+ Node target = NodeTest.getApacheNode(sXml, true, 'T');
+ Node toInsert = m_node.getFirstChild();
+ try {
+ super.testInsertBefore(toInsert, target);
+ fail("Inserting node created from a different impl");
+ } catch (DOMException de) {
+ assertEquals(de.code, DOMException.WRONG_DOCUMENT_ERR);
}
+ }
+ @Test
public void testInsertBeforeNullChild() {
Node target = m_doc.createElement("foo");
super.testInsertBefore(null, target);
@@ -279,7 +292,6 @@ public abstract class NodeWithChildrenTe
* pre: child is not a parent ancestor
*/
public void testAppendChildExisting(Node child) {
-
if (child == m_node)
child = m_doc.getLastChild();
//if still the same, too bad
@@ -297,7 +309,8 @@ public abstract class NodeWithChildrenTe
assertFalse(target == null || child == null);
super.testInsertBefore(child, target);
}
-
+
+ @Test
public void testInsertBeforeDocFrag() {
DocumentFragment child = m_doc.createDocumentFragment();
child.appendChild(m_doc.createElement("foo1"));
@@ -305,12 +318,14 @@ public abstract class NodeWithChildrenTe
super.testInsertBefore(child, target);
}
+ @Test
public void testAppendChild() {
Node newNode = m_doc.createElement("foo");
super.testAppendChild(newNode);
}
//try to append the parent
+ @Test
public void testAppendChildIllegal0() {
Node parent = m_node.getFirstChild();
m_node = m_node.getFirstChild();
@@ -323,6 +338,7 @@ public abstract class NodeWithChildrenTe
}
//try to insert diff doc
+ @Test
public void testAppendChildIllegal1() {
Node newNode = m_docNS.createElement("newNode");
try {
@@ -334,6 +350,7 @@ public abstract class NodeWithChildrenTe
}
//append doc frag
+ @Test
public void testAppendChildDocFrag() {
DocumentFragment child = m_doc.createDocumentFragment();
child.appendChild(m_doc.createElement("foo"));
@@ -341,8 +358,8 @@ public abstract class NodeWithChildrenTe
}
//TODO : not implemented
+ @Test
public void testNormalize() {
-
int nCount=m_node.getChildNodes().getLength();
String value="";
if (m_node.getLastChild() instanceof Text)
@@ -370,11 +387,10 @@ public abstract class NodeWithChildrenTe
value+="foo bar";
assertEquals(value,m_node.getLastChild().getNodeValue());
-
-
}
+ @Test
public void testSetPrefixInvalid() {
//test only applies to Attrs and Elems
if (!(m_node.getNodeType() == Node.ATTRIBUTE_NODE
@@ -405,11 +421,12 @@ public abstract class NodeWithChildrenTe
}
+ @Test
public void testSetNodeValue() {
int nCount = m_node.getChildNodes().getLength();
m_node.setNodeValue("blah");
assertEquals(nCount, m_node.getChildNodes().getLength());
for (int i = 0; i < nCount; i++)
- assertEquals(false, ("blah".equals(m_node.getChildNodes().item(i).getNodeValue())));
+ assertNotEquals("blah", m_node.getChildNodes().item(i).getNodeValue());
}
}
Modified: xmlbeans/trunk/test/src/dom/common/TestSetup.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/common/TestSetup.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/common/TestSetup.java (original)
+++ xmlbeans/trunk/test/src/dom/common/TestSetup.java Fri Jan 18 23:08:44 2019
@@ -17,5 +17,5 @@ package dom.common;
public interface TestSetup{
- public static boolean bDTD=false;
+ boolean bDTD=false;
}
Modified: xmlbeans/trunk/test/src/dom/detailed/AttrNamespaceTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/AttrNamespaceTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/AttrNamespaceTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/AttrNamespaceTest.java Fri Jan 18 23:08:44 2019
@@ -16,25 +16,26 @@
package dom.detailed;
import dom.common.Loader;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+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.xml.sax.InputSource;
-import org.apache.xmlbeans.XmlObject;
import java.io.StringReader;
-import java.io.IOException;
+
+import static org.junit.Assert.*;
/**
* Tests conversion of regular attributes to namespaces and vv
*/
-public class AttrNamespaceTest extends TestCase {
+public class AttrNamespaceTest {
String sXml = "<foo at0=\"nonsattr\"></foo>";
String sXmlNS = "<foo xmlns:myns=\"http://foo.org\"><myns:bar/></foo>";
Document m_doc,
@@ -42,18 +43,13 @@ public class AttrNamespaceTest extends T
Node m_node;
- public AttrNamespaceTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return new TestSuite(AttrNamespaceTest.class);
- }
-
+ @Test
+ @Ignore
public void testDefaultNamespace() {
- //assertEquals(true,((Element)m_node).hasAttribute("xmlns"));
+ assertTrue(((Element) m_node).hasAttribute("xmlns"));
}
+ @Test
public void testAttr2Namespace() {
Attr at = (Attr) ((Element) m_node).getAttributeNode("at0");
String namespaceURI = "http://foo.org";
@@ -61,7 +57,7 @@ public class AttrNamespaceTest extends T
at.setValue(namespaceURI);
m_node.appendChild(m_doc.createElementNS(namespaceURI, qualifiedName));
Element bar = (Element) ((Element) m_node).getElementsByTagNameNS(namespaceURI, "bar").item(0);
- assertFalse(null == bar);
+ assertNotNull(bar);
assertEquals(namespaceURI, bar.getNamespaceURI());
assertEquals(qualifiedName, bar.getNodeName());
/*
@@ -72,6 +68,7 @@ public class AttrNamespaceTest extends T
*/
}
+ @Test
public void testNamespace2Attr() {
m_node = m_docNS.getFirstChild();
@@ -102,6 +99,7 @@ public class AttrNamespaceTest extends T
* ""/NULL...Do we get an error since now there is a prefix
* with NULL URI?
*/
+ @Test
public void testInsertBadAttribute() throws Exception{
String sER="<foo/>";
org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
@@ -120,9 +118,8 @@ public class AttrNamespaceTest extends T
at_xerces.setValue("");
}
-
+ @Before
public void setUp() throws Exception {
-
if (sXml == null && sXmlNS == null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
Loader loader = Loader.getLoader();
m_doc = (org.w3c.dom.Document) loader.load(sXml);
Modified: xmlbeans/trunk/test/src/dom/detailed/IDTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/IDTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/IDTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/IDTest.java Fri Jan 18 23:08:44 2019
@@ -15,28 +15,31 @@
package dom.detailed;
-import junit.framework.TestCase;
-import org.apache.xmlbeans.*;
+import common.Common;
+import org.apache.xmlbeans.XmlError;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.junit.Ignore;
+import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import tools.util.JarUtil;
import xbean.dom.id.FooDocument;
import java.io.File;
-import java.io.IOException;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
-import common.Common;
+import static org.junit.Assert.*;
-public class IDTest extends TestCase
-{
- String P = File.separator;
+public class IDTest {
+ private String P = File.separator;
// Test the getElementById() DOM API with DTDs , run with jvm arg -Dcases.location
- public void testGetElemById() throws Exception
- {
+ @Test
+ public void testGetElemById() throws Exception {
Document doc;
Element element;
String tagname;
@@ -53,25 +56,28 @@ public class IDTest extends TestCase
}
// test getElementById() with schema containing DTD with ID definition for untyped XmlObject
- public void testIDSchema() throws Exception
- {
- XmlObject o = XmlObject.Factory.parse("<!DOCTYPE xs:schema PUBLIC \"-//W3C//DTD XMLSCHEMA 200102//EN\" \"XMLSchema.dtd\" [\n" +
- "<!ELEMENT first_name (#PCDATA)>\n" +
- "<!ELEMENT hobby (#PCDATA)>\n" +
- "<!ELEMENT homepage EMPTY>\n" +
- "<!ATTLIST homepage href CDATA #REQUIRED>\n" +
- "<!ELEMENT last_name (#PCDATA)>\n" +
- "<!ELEMENT middle_initial (#PCDATA)>\n" +
- "<!ELEMENT name (first_name, middle_initial?, last_name)>\n" +
- "<!ELEMENT person (name, profession+, homepage?, hobby?)>\n" +
- "<!ATTLIST person\n" +
- " born CDATA #REQUIRED\n" +
- " died CDATA #REQUIRED\n" +
- " id ID #REQUIRED\n" +
- ">\n" +
- "<!ELEMENT profession (#PCDATA)>\n" +
- "]>" +
- "<person id=\"25\" born=\"yday\" />");
+ @Test
+ public void testIDSchema() throws Exception {
+ String dtdAndData =
+ "<!DOCTYPE xs:schema PUBLIC \"-//W3C//DTD XMLSCHEMA 200102//EN\" \"XMLSchema.dtd\" [\n" +
+ "<!ELEMENT first_name (#PCDATA)>\n" +
+ "<!ELEMENT hobby (#PCDATA)>\n" +
+ "<!ELEMENT homepage EMPTY>\n" +
+ "<!ATTLIST homepage href CDATA #REQUIRED>\n" +
+ "<!ELEMENT last_name (#PCDATA)>\n" +
+ "<!ELEMENT middle_initial (#PCDATA)>\n" +
+ "<!ELEMENT name (first_name, middle_initial?, last_name)>\n" +
+ "<!ELEMENT person (name, profession+, homepage?, hobby?)>\n" +
+ "<!ATTLIST person\n" +
+ " born CDATA #REQUIRED\n" +
+ " died CDATA #REQUIRED\n" +
+ " id ID #REQUIRED\n" +
+ ">\n" +
+ "<!ELEMENT profession (#PCDATA)>\n" +
+ "]>" +
+ "<person id=\"25\" born=\"yday\" />";
+
+ XmlObject o = XmlObject.Factory.parse(dtdAndData);
Document n = (Document) o.getDomNode();
Element elem = n.getElementById("25");
assertNotNull(elem);
@@ -82,39 +88,40 @@ public class IDTest extends TestCase
}
// typed XmlObject
- public void testSchemaWithDTD() throws Exception
- {
+ @Test
+ @Ignore("doesn't work anymore - xerces 2.11 is not calling the DeclHandler and so no ID attribute is added")
+ public void testSchemaWithDTD() throws Exception {
XmlOptions opt = new XmlOptions();
- List err = new ArrayList();
+ List err = new ArrayList();
opt.setErrorListener(err);
+ // opt.setLoadSaxSchema(true);
- String instance = "<foo xmlns='http://xbean/dom/id'>" +
- " <person id=\"25\"/>" +
- "</foo>";
- try
- {
+ String instance =
+ "<foo xmlns='http://xbean/dom/id'>" +
+ " <person id=\"abc\"><firstname>John</firstname></person>" +
+ "</foo>";
+
+ try {
FooDocument fooDoc = FooDocument.Factory.parse(instance, opt);
- Document d = (Document)fooDoc.getDomNode();
- Element elem = d.getElementById("25");
+ Document d = (Document) fooDoc.getDomNode();
+ Element elem = d.getElementById("abc");
assertNotNull(elem);
Element elemInvalid = d.getElementById("100");
assertNull(elemInvalid);
- }
- catch (XmlException xme)
- {
+ } catch (XmlException xme) {
Collection xmlerrs = xme.getErrors();
- for (Iterator iterator1 = xmlerrs.iterator(); iterator1.hasNext();) {
- XmlError xerr = (XmlError) iterator1.next();
+ for (Object xmlerr : xmlerrs) {
+ XmlError xerr = (XmlError) xmlerr;
System.out.println("Exception:" + xerr.getMessage());
}
throw (new XmlException(new Throwable("XmlException occured")));
}
// parse errors
- for (Iterator iterator = err.iterator(); iterator.hasNext();) {
- System.out.println("Err:" + iterator.next());
+ for (Object o : err) {
+ System.out.println("Err:" + o);
}
}
Modified: xmlbeans/trunk/test/src/dom/detailed/ImportUnsupportedNodesTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/ImportUnsupportedNodesTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/ImportUnsupportedNodesTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/ImportUnsupportedNodesTest.java Fri Jan 18 23:08:44 2019
@@ -16,7 +16,9 @@
package dom.detailed;
import dom.common.Loader;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -24,13 +26,10 @@ import org.xml.sax.InputSource;
import java.io.StringReader;
+import static org.junit.Assert.*;
-/**
- *
- *
- *
- */
-public class ImportUnsupportedNodesTest extends TestCase{
+
+public class ImportUnsupportedNodesTest {
String sXml="<foo at0=\"no_ns_attr\"></foo>";
// String sXmlNS="<foo><foobar xmlns:myns=\"http://foo.org\" xmlns:other=\"other.org\"><myns:bar/></foobar></foo>";
Document m_doc;
@@ -38,102 +37,95 @@ public class ImportUnsupportedNodesTest
String sER="<!DOCTYPE note [<!ENTITY ORG \"IICD\">] >"
+"<foo>&ORG;</foo>";
- public ImportUnsupportedNodesTest(String name){
- super(name);
- }
-
+ @Test
+ @Ignore("not implemented")
public void testImportEnitityNode()throws Exception{
- org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
- parser.parse(new InputSource(new StringReader(sER)));
- Document xercesDocument = parser.getDocument();
- assertFalse (xercesDocument==null);
- Node toImport=xercesDocument.getDoctype().getEntities().item(0);
- assertEquals(Node.ENTITY_NODE,toImport.getNodeType());
- Node importedNode ;
- //try{
- importedNode=m_doc.importNode(toImport, true);
- m_node.insertBefore(importedNode,m_node.getFirstChild());
-
- assertEquals(importedNode,m_node.getFirstChild());
- assertEquals(Node.ENTITY_NODE,m_node.getFirstChild().getNodeType());
+ org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
+ parser.parse(new InputSource(new StringReader(sER)));
+ Document xercesDocument = parser.getDocument();
+ assertNotNull(xercesDocument);
+ Node toImport = xercesDocument.getDoctype().getEntities().item(0);
+ assertEquals(Node.ENTITY_NODE, toImport.getNodeType());
+ Node importedNode = m_doc.importNode(toImport, true);
+ m_node.insertBefore(importedNode, m_node.getFirstChild());
+ assertEquals(importedNode, m_node.getFirstChild());
+ assertEquals(Node.ENTITY_NODE, m_node.getFirstChild().getNodeType());
}
+ @Test
+ @Ignore("not implemented")
public void testImportERNode()throws Exception{
- org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
- parser.parse(new InputSource(new StringReader(sER)));
- Document xercesDocument = parser.getDocument();
- assertFalse (xercesDocument==null);
- Node toImport=xercesDocument.getDocumentElement().getFirstChild();
-
- assertEquals(Node.ENTITY_REFERENCE_NODE,toImport.getNodeType());
- Node importedNode=m_doc.importNode(toImport, true);
- m_node.insertBefore(importedNode,m_node.getFirstChild());
+ org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
+ parser.parse(new InputSource(new StringReader(sER)));
+ Document xercesDocument = parser.getDocument();
+ assertNotNull(xercesDocument);
+ Node toImport = xercesDocument.getDocumentElement().getFirstChild();
+
+ assertEquals(Node.ENTITY_REFERENCE_NODE, toImport.getNodeType());
+ Node importedNode = m_doc.importNode(toImport, true);
+ m_node.insertBefore(importedNode, m_node.getFirstChild());
- assertEquals(importedNode,m_node.getFirstChild());
- assertEquals(Node.ENTITY_REFERENCE_NODE,m_node.getFirstChild().getNodeType());
+ assertEquals(importedNode, m_node.getFirstChild());
+ assertEquals(Node.ENTITY_REFERENCE_NODE, m_node.getFirstChild().getNodeType());
}
/**
* DOCUMENT_TYPE_NODE
* cannot be imported.
*/
-
+ @Test(expected = DOMException.class)
public void testImportDocType() throws Exception{
- org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
- parser.parse(new InputSource(new StringReader(sER)));
- Document xercesDocument = parser.getDocument();
- assertFalse (xercesDocument==null);
- Node toImport=xercesDocument.getDoctype();
-
- try{
- Node importedNode=m_doc.importNode(toImport, true);
- fail("can't import DocType Node");
- }catch (DOMException e){
-
- }
- try{
- Node importedNode=m_doc.importNode(toImport, false);
- fail("can't import DocType Node");
- }catch (DOMException e){
+ org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
+ parser.parse(new InputSource(new StringReader(sER)));
+ Document xercesDocument = parser.getDocument();
+ assertNotNull(xercesDocument);
+ Node toImport = xercesDocument.getDoctype();
+
+ try {
+ Node importedNode = m_doc.importNode(toImport, true);
+ fail("can't import DocType Node");
+ } catch (DOMException e) {
+
+ }
- }
+ m_doc.importNode(toImport, false);
}
- public void testImportCDATAType() throws Exception{
- org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
- parser.parse(new InputSource(new StringReader(sER)));
- Document xercesDocument = parser.getDocument();
- assertFalse (xercesDocument==null);
- Node toImport= xercesDocument.createCDATASection("My < CData");
- xercesDocument.getDocumentElement().appendChild(toImport);
-
- assertEquals(Node.CDATA_SECTION_NODE,toImport.getNodeType());
- Node importedNode=m_doc.importNode(toImport, true);
- m_node.insertBefore(importedNode,m_node.getFirstChild());
-
- assertEquals(importedNode,m_node.getFirstChild());
- assertEquals(Node.CDATA_SECTION_NODE,m_node.getFirstChild().getNodeType());
-
-
- assertEquals(Node.CDATA_SECTION_NODE,toImport.getNodeType());
- importedNode=m_doc.importNode(toImport, false);
- m_node.replaceChild(importedNode,m_node.getFirstChild());
+ @Test
+ public void testImportCDATAType() throws Exception{
+ org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
+ parser.parse(new InputSource(new StringReader(sER)));
+ Document xercesDocument = parser.getDocument();
+ assertNotNull(xercesDocument);
+ Node toImport = xercesDocument.createCDATASection("My < CData");
+ xercesDocument.getDocumentElement().appendChild(toImport);
+
+ assertEquals(Node.CDATA_SECTION_NODE, toImport.getNodeType());
+ Node importedNode = m_doc.importNode(toImport, true);
+ m_node.insertBefore(importedNode, m_node.getFirstChild());
+
+ assertEquals(importedNode, m_node.getFirstChild());
+ assertEquals(Node.CDATA_SECTION_NODE, m_node.getFirstChild().getNodeType());
+
+
+ assertEquals(Node.CDATA_SECTION_NODE, toImport.getNodeType());
+ importedNode = m_doc.importNode(toImport, false);
+ m_node.replaceChild(importedNode, m_node.getFirstChild());
- assertEquals(importedNode,m_node.getFirstChild());
- assertEquals(Node.CDATA_SECTION_NODE,m_node.getFirstChild().getNodeType());
+ assertEquals(importedNode, m_node.getFirstChild());
+ assertEquals(Node.CDATA_SECTION_NODE, m_node.getFirstChild().getNodeType());
}
//TODO: see if code coverage can help id gaps here...
- public void setUp() throws Exception{
+ @Before
+ public void setUp() throws Exception{
+ Loader _loader = Loader.getLoader();
+ if (sXml == null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
+ m_doc = (org.w3c.dom.Document) _loader.load(sXml);
- Loader _loader=Loader.getLoader();
- if (sXml==null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
- m_doc=(org.w3c.dom.Document)_loader.load(sXml);
-
- m_node=m_doc.getFirstChild();
+ m_node = m_doc.getFirstChild();
}
-
}
Modified: xmlbeans/trunk/test/src/dom/detailed/InsertDeleteNodesTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/InsertDeleteNodesTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/InsertDeleteNodesTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/InsertDeleteNodesTest.java Fri Jan 18 23:08:44 2019
@@ -16,164 +16,149 @@
package dom.detailed;
import dom.common.Loader;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Before;
+import org.junit.Test;
import org.w3c.dom.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
/**
* Insertion and deletion of nodes, normalization of text children
- *
- *
- *
*/
-
-public class InsertDeleteNodesTest extends TestCase{
+public class InsertDeleteNodesTest {
String sXml="<foo at0=\"no_ns_attr\"></foo>";
String sXmlNS="<foo xmlns:myns=\"http://foo.org\"><myns:bar/></foo>";
Document m_doc,
m_docNS;
Node m_node;
-
-
-
- public InsertDeleteNodesTest(String name){
- super(name);
- }
- public static Test suite() {
- return new TestSuite(InsertDeleteNodesTest.class);
- }
-
+ @Test
public void testInsertNodes(){
- //insert one of each type of node:
- Text txt0=m_doc.createTextNode("foo");
- Text txt1=m_doc.createTextNode(" ");
- Text txt2=m_doc.createTextNode("bar");
- Element elt1=m_doc.createElement("elt1");
-
- Attr attr0=m_doc.createAttributeNS("xmlns","attr0");
-
- Comment comment=m_doc.createComment("A comment");
- DocumentFragment doc_frag=m_doc.createDocumentFragment();
- //Document new_doc: what to do with this...
- //CDATASection cdata=m_doc.createCDATASection("<CDATA Section>");--Not impl
- //ProcessingInstruction pi=m_doc.createProcessingInstruction("xml","version 1.0"); --Not impl
- // DocumentType--TODO
- //Entity
- //EntityReference
- //Notation
+ //insert one of each type of node:
+ Text txt0 = m_doc.createTextNode("foo");
+ Text txt1 = m_doc.createTextNode(" ");
+ Text txt2 = m_doc.createTextNode("bar");
+ Element elt1 = m_doc.createElement("elt1");
- Text nested_txt=m_doc.createTextNode("foo");
+ Attr attr0 = m_doc.createAttributeNS("xmlns", "attr0");
+ Comment comment = m_doc.createComment("A comment");
+ DocumentFragment doc_frag = m_doc.createDocumentFragment();
+ //Document new_doc: what to do with this...
+ //CDATASection cdata=m_doc.createCDATASection("<CDATA Section>");--Not impl
+ //ProcessingInstruction pi=m_doc.createProcessingInstruction("xml","version 1.0"); --Not impl
+ // DocumentType--TODO
+ //Entity
+ //EntityReference
+ //Notation
- //m_doc.appendChild(m_doc.createElement("root"));
+ Text nested_txt = m_doc.createTextNode("foo");
- m_doc.getDocumentElement().appendChild(txt2);
- m_doc.getDocumentElement().insertBefore(elt1,txt2);
- m_doc.getDocumentElement().insertBefore(txt1,elt1);
- m_doc.getDocumentElement().insertBefore(txt0,txt1);
- //insert level 1
- System.out.println("=======Basic inserts passed ===================");
- int nAttrs=20;
- for (int i=0;i<nAttrs;i++){
- Attr insertAttr=(Attr)attr0.cloneNode(true);
- insertAttr.setValue(i+"");
- elt1.setAttributeNode(insertAttr);
- }
+ //m_doc.appendChild(m_doc.createElement("root"));
- assertEquals(1,elt1.getAttributes().getLength());
- assertEquals((nAttrs-1)+"",elt1.getAttributes().getNamedItemNS("xmlns","attr0").getNodeValue());
+ m_doc.getDocumentElement().appendChild(txt2);
+ m_doc.getDocumentElement().insertBefore(elt1, txt2);
+ m_doc.getDocumentElement().insertBefore(txt1, elt1);
+ m_doc.getDocumentElement().insertBefore(txt0, txt1);
+ //insert level 1
+ System.out.println("=======Basic inserts passed ===================");
+ int nAttrs = 20;
+ for (int i = 0; i < nAttrs; i++) {
+ Attr insertAttr = (Attr) attr0.cloneNode(true);
+ insertAttr.setValue(i + "");
+ elt1.setAttributeNode(insertAttr);
+ }
- //elt1.appendChild(cdata);
- elt1.appendChild(comment);
- //elt1.appendChild(pi);
- elt1.appendChild(nested_txt);
+ assertEquals(1, elt1.getAttributes().getLength());
+ assertEquals((nAttrs - 1) + "", elt1.getAttributes().getNamedItemNS("xmlns", "attr0").getNodeValue());
- Element childElt=m_doc.createElement("childElt");
- childElt.setAttributeNode(attr0);
- attr0.setValue("Attr0Value");
- //a chain of depth 100 under doc frag of elt w/ attr
- doc_frag.appendChild((Element)childElt.cloneNode(true));
+ //elt1.appendChild(cdata);
+ elt1.appendChild(comment);
+ //elt1.appendChild(pi);
+ elt1.appendChild(nested_txt);
- System.out.println("======= Overwriting same attr ===================");
- Element last=(Element)doc_frag.getFirstChild();
+ Element childElt = m_doc.createElement("childElt");
+ childElt.setAttributeNode(attr0);
+ attr0.setValue("Attr0Value");
+ //a chain of depth 100 under doc frag of elt w/ attr
+ doc_frag.appendChild((Element) childElt.cloneNode(true));
- int nMaxTries=100;
+ System.out.println("======= Overwriting same attr ===================");
+ Element last = (Element) doc_frag.getFirstChild();
+ int nMaxTries = 100;
- for (int i=0;i<nMaxTries;i++){
- Element deep_nested=(Element)childElt.cloneNode(true);
- last.appendChild(deep_nested);
- last=(Element)last.getFirstChild();
- }
+ for (int i = 0; i < nMaxTries; i++) {
+ Element deep_nested = (Element) childElt.cloneNode(true);
+ last.appendChild(deep_nested);
+ last = (Element) last.getFirstChild();
+ }
- elt1.appendChild(doc_frag);
+ elt1.appendChild(doc_frag);
- System.out.println("======= Inserted deep chain ===================");
- NodeList deepChain=m_doc.getDocumentElement().getElementsByTagName("childElt");
- assertEquals(nMaxTries+1,deepChain.getLength());//newly inserted + 1 original
+ System.out.println("======= Inserted deep chain ===================");
+ NodeList deepChain = m_doc.getDocumentElement().getElementsByTagName("childElt");
+ assertEquals(nMaxTries + 1, deepChain.getLength());//newly inserted + 1 original
- for (int i=0;i<nMaxTries;i++)
- assertEquals("Attr0Value",deepChain.item(i).getAttributes().getNamedItemNS("xmlns","attr0").getNodeValue());
+ for (int i = 0; i < nMaxTries; i++)
+ assertEquals("Attr0Value", deepChain.item(i).getAttributes().getNamedItemNS("xmlns", "attr0").getNodeValue());
- //check doc frag isn't there
- assertEquals("childElt",elt1.getLastChild().getNodeName());
+ //check doc frag isn't there
+ assertEquals("childElt", elt1.getLastChild().getNodeName());
+ /////Done inserting: begin deletion:
- /////Done inserting: begin deletion:
+ //1. delete the deep tree at depth 50
+ Node toRemove = deepChain.item(nMaxTries / 2);
+ toRemove.removeChild(toRemove.getFirstChild());
- //1. delete the deep tree at depth 50
- Node toRemove=deepChain.item(nMaxTries / 2);
- toRemove.removeChild(toRemove.getFirstChild());
+ assertEquals(nMaxTries / 2 + 1, deepChain.getLength());
- assertEquals(nMaxTries / 2 + 1,deepChain.getLength());
+ //test normalization with Elt node
+ Element root = m_doc.getDocumentElement();
+ assertEquals(4, root.getChildNodes().getLength());
+ root.removeChild(root.getChildNodes().item(2));
- //test normalization with Elt node
- Element root=m_doc.getDocumentElement();
- assertEquals(4,root.getChildNodes().getLength());
- root.removeChild(root.getChildNodes().item(2));
-
- assertEquals(0,deepChain.getLength());
- //TODO: normalize
- //root.normalize();
+ assertEquals(0, deepChain.getLength());
+ //TODO: normalize
+ //root.normalize();
// assertEquals(1,root.getChildNodes().getLength());
// assertEquals("foo bar",root.getFirstChild());
- //insert stuff under doc node: should be able to insert comments and PI here....
+ //insert stuff under doc node: should be able to insert comments and PI here....
- m_doc.insertBefore(comment,root);
- //m_doc.insertBefore(pi,root);
- //m_doc.insertBefore(cdata,root);
-
- try{
- m_doc.insertBefore(root,doc_frag.getLastChild());
- fail("Should except here");
- }catch (DOMException de){
- assertEquals(de.code,DOMException.HIERARCHY_REQUEST_ERR);
- }
+ m_doc.insertBefore(comment, root);
+ //m_doc.insertBefore(pi,root);
+ //m_doc.insertBefore(cdata,root);
+
+ try {
+ m_doc.insertBefore(root, doc_frag.getLastChild());
+ fail("Should except here");
+ } catch (DOMException de) {
+ assertEquals(de.code, DOMException.HIERARCHY_REQUEST_ERR);
+ }
}
//TODO: insert nodes at all illegal places:
-
+ @Before
public void setUp() throws Exception{
- Loader loader=Loader.getLoader();
- if (sXml==null && sXmlNS==null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
- m_doc=(org.w3c.dom.Document)loader.load(sXml);
- if(sXmlNS!=null && sXmlNS.length()>0)
- m_docNS=(org.w3c.dom.Document)loader.load(sXmlNS);
- m_doc=m_doc.getImplementation().createDocument(null,"root",null);
- m_node=m_doc.getFirstChild();
+ Loader loader = Loader.getLoader();
+ if (sXml == null && sXmlNS == null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
+ m_doc = (org.w3c.dom.Document) loader.load(sXml);
+ if (sXmlNS != null && sXmlNS.length() > 0)
+ m_docNS = (org.w3c.dom.Document) loader.load(sXmlNS);
+ m_doc = m_doc.getImplementation().createDocument(null, "root", null);
+ m_node = m_doc.getFirstChild();
}
-
}
Modified: xmlbeans/trunk/test/src/dom/detailed/MoveImportNodeTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/MoveImportNodeTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/MoveImportNodeTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/MoveImportNodeTest.java Fri Jan 18 23:08:44 2019
@@ -17,9 +17,8 @@
package dom.detailed;
import dom.common.Loader;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.Before;
+import org.junit.Test;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -28,123 +27,116 @@ import org.xml.sax.InputSource;
import java.io.StringReader;
+import static org.junit.Assert.*;
-/**
- *
- *
- *
- */
-public class MoveImportNodeTest extends TestCase{
+
+public class MoveImportNodeTest {
String sXmlNS="<foo><foobar xmlns:myns=\"http://foo.org\" xmlns:other=\"http://other.org\"><myns:bar/></foobar></foo>";
- String sXml="<foo at0=\"no_ns_attr\"><bar/></foo>";
+ String sXml="<foo at0=\"no_ns_attr\"><bar/></foo>";
Document m_doc,
m_docNS;
Node m_node;
- public MoveImportNodeTest(String name){
- super(name);
- }
-
//insert a node from a ns into a non-ns: node will move "as is"
//even though ns is not in scope as DOM does no prefix resolution
+ @Test
public void testMoveNodeNStoNoNS(){
- Node toMove=m_docNS.getFirstChild().getFirstChild().getFirstChild(); //bar
- assertEquals("myns:bar",toMove.getNodeName());
- Element newParent=(Element)m_docNS.getFirstChild();
- assertEquals("foo",newParent.getNodeName());
- newParent.insertBefore(toMove,newParent.getFirstChild());
-
- assertEquals(2,newParent.getChildNodes().getLength());
- assertEquals(toMove,newParent.getElementsByTagNameNS("http://foo.org","bar").item(0));
- assertEquals(newParent.getElementsByTagName("bar").item(0),
- newParent.getElementsByTagNameNS(null,"bar").item(0));
+ Node toMove = m_docNS.getFirstChild().getFirstChild().getFirstChild(); //bar
+ assertEquals("myns:bar", toMove.getNodeName());
+ Element newParent = (Element) m_docNS.getFirstChild();
+ assertEquals("foo", newParent.getNodeName());
+ newParent.insertBefore(toMove, newParent.getFirstChild());
+
+ assertEquals(2, newParent.getChildNodes().getLength());
+ assertEquals(toMove, newParent.getElementsByTagNameNS("http://foo.org", "bar").item(0));
+ assertEquals(newParent.getElementsByTagName("bar").item(0),
+ newParent.getElementsByTagNameNS(null, "bar").item(0));
}
//move node to a different namespace
//namespace of node should be unchanged -- DOM does not care
+ @Test
public void testMoveDiffNS(){
- Node toMove=m_docNS.getFirstChild().getFirstChild().getFirstChild(); //bar
- Element newParent=(Element)m_docNS.getFirstChild();
- newParent.insertBefore(toMove,newParent.getFirstChild());
- newParent.getFirstChild().setPrefix("other");
- assertEquals(2,newParent.getChildNodes().getLength());
- assertEquals(0,(newParent).getElementsByTagNameNS(null,"bar").getLength());
- assertEquals(true,(toMove==newParent.getElementsByTagNameNS("http://foo.org","bar").item(0)));
+ Node toMove = m_docNS.getFirstChild().getFirstChild().getFirstChild(); //bar
+ Element newParent = (Element) m_docNS.getFirstChild();
+ newParent.insertBefore(toMove, newParent.getFirstChild());
+ newParent.getFirstChild().setPrefix("other");
+ assertEquals(2, newParent.getChildNodes().getLength());
+ assertEquals(0, (newParent).getElementsByTagNameNS(null, "bar").getLength());
+ assertTrue((toMove == newParent.getElementsByTagNameNS("http://foo.org", "bar").item(0)));
}
//import to a doc where the given ns DNE
+ @Test
public void testMoveDiffDoc(){
- Node toMove=m_docNS.getFirstChild().getFirstChild().getFirstChild(); //bar
- try{
- m_node.insertBefore(toMove,m_node.getFirstChild());
- fail(" Cannot move nodes across docs");
- }catch(DOMException de){
- assertEquals(DOMException.WRONG_DOCUMENT_ERR,de.code);
- }
-
+ Node toMove=m_docNS.getFirstChild().getFirstChild().getFirstChild(); //bar
+ try{
+ m_node.insertBefore(toMove,m_node.getFirstChild());
+ fail(" Cannot move nodes across docs");
+ }catch(DOMException de){
+ assertEquals(DOMException.WRONG_DOCUMENT_ERR,de.code);
+ }
}
+ @Test
public void testMoveDiffImplementations() throws Exception{
- org.apache.xerces.parsers.DOMParser parser =
- new org.apache.xerces.parsers.DOMParser();
+ org.apache.xerces.parsers.DOMParser parser =
+ new org.apache.xerces.parsers.DOMParser();
- parser.parse(new InputSource(new StringReader(sXmlNS)));
+ parser.parse(new InputSource(new StringReader(sXmlNS)));
- Document xercesDocument = parser.getDocument();
- assertFalse (xercesDocument==null);
- Node toMove=xercesDocument.getFirstChild().getFirstChild().getFirstChild(); //bar
- System.out.println("=======Source Impl "+xercesDocument.getImplementation());
- System.out.println("=======Dest Impl "+m_doc.getImplementation());
+ Document xercesDocument = parser.getDocument();
+ assertNotNull(xercesDocument);
+ Node toMove = xercesDocument.getFirstChild().getFirstChild().getFirstChild(); //bar
+ System.out.println("=======Source Impl " + xercesDocument.getImplementation());
+ System.out.println("=======Dest Impl " + m_doc.getImplementation());
- try{
- m_node.insertBefore(toMove,m_node.getFirstChild());
- fail(" Cannot move nodes across implementations");
- }catch(DOMException de){
- assertEquals(DOMException.WRONG_DOCUMENT_ERR,de.code);
- }
+ try {
+ m_node.insertBefore(toMove, m_node.getFirstChild());
+ fail(" Cannot move nodes across implementations");
+ } catch (DOMException de) {
+ assertEquals(DOMException.WRONG_DOCUMENT_ERR, de.code);
+ }
- Node imported=m_doc.importNode(toMove,true);//deep would be the same here
- m_node.appendChild(imported);
+ Node imported = m_doc.importNode(toMove, true);//deep would be the same here
+ m_node.appendChild(imported);
- assertEquals(2,m_node.getChildNodes().getLength());
- //node should be imported w/ prefix and all
- assertEquals(imported,((Element)m_node).getElementsByTagNameNS("http://foo.org","bar").item(0));
- // assertEquals(((Element)m_node).getElementsByTagName("bar").item(1),imported);
- assertEquals(((Element)m_node).getElementsByTagName("bar").item(0),((Element)m_node).getElementsByTagNameNS(null,"bar").item(0));
+ assertEquals(2, m_node.getChildNodes().getLength());
+ //node should be imported w/ prefix and all
+ assertEquals(imported, ((Element) m_node).getElementsByTagNameNS("http://foo.org", "bar").item(0));
+ // assertEquals(((Element)m_node).getElementsByTagName("bar").item(1),imported);
+ assertEquals(((Element) m_node).getElementsByTagName("bar").item(0), ((Element) m_node).getElementsByTagNameNS(null, "bar").item(0));
}
- // public void
+ // public void
+ @Test
public void testImportSameDoc(){
- //inspired by nist documentimportnode10?
+ //inspired by nist documentimportnode10?
- Node toImport=m_doc.createElement("foobar");
- toImport=m_doc.importNode(toImport,true);
+ Node toImport = m_doc.createElement("foobar");
+ toImport = m_doc.importNode(toImport, true);
- toImport=m_doc.createDocumentFragment();
- toImport.appendChild(m_doc.getDocumentElement().getFirstChild());
+ toImport = m_doc.createDocumentFragment();
+ toImport.appendChild(m_doc.getDocumentElement().getFirstChild());
- m_doc.importNode(toImport,true);
- }
-
- public static Test suite() {
- return new TestSuite(MoveImportNodeTest.class);
+ m_doc.importNode(toImport, true);
}
+ @Before
public void setUp() throws Exception{
+ Loader loader = Loader.getLoader();
+ if (sXml == null && sXmlNS == null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
+ m_doc = (org.w3c.dom.Document) loader.load(sXml);
+ if (sXmlNS != null && sXmlNS.length() > 0)
+ m_docNS = (org.w3c.dom.Document) loader.load(sXmlNS);
- Loader loader=Loader.getLoader();
- if (sXml==null && sXmlNS==null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
- m_doc=(org.w3c.dom.Document)loader.load(sXml);
- if(sXmlNS!=null && sXmlNS.length()>0)
- m_docNS=(org.w3c.dom.Document)loader.load(sXmlNS);
-
- m_node=m_doc.getFirstChild();
+ m_node =m_doc.getFirstChild();
}
}
Modified: xmlbeans/trunk/test/src/dom/detailed/MultipleDocsTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/MultipleDocsTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/MultipleDocsTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/MultipleDocsTest.java Fri Jan 18 23:08:44 2019
@@ -16,7 +16,8 @@
package dom.detailed;
import dom.common.Loader;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
import org.w3c.dom.*;
@@ -25,13 +26,13 @@ import org.w3c.dom.*;
*
*
*/
-public class MultipleDocsTest extends TestCase {
- String[] sXml = new String[]{"<foo0/>",
- "<foo1 foo1_at=\"val0\"/>",
- "<foo2 foo2_at=\"val0\">text</foo2>",
- "<foo3 foo3_at=\"val0\">text <foo2 foo2_at=\"val0\">text</foo2> </foo3>",
- "<foo4 xmlns:myns=\"foo.org\" myns:foo3_at=\"val0\">text <foo2 foo2_at=\"val0\">text</foo2> </foo4>",
- "<foo5 xmlns:myns=\"foo_OUT.org\"><myns:foo4 xmlns:myns=\"foo.org\" myns:foo3_at=\"val0\">text <foo2 foo2_at=\"val0\">text</foo2> </myns:foo4></foo5>"
+public class MultipleDocsTest {
+ String[] sXml = {"<foo0/>",
+ "<foo1 foo1_at=\"val0\"/>",
+ "<foo2 foo2_at=\"val0\">text</foo2>",
+ "<foo3 foo3_at=\"val0\">text <foo2 foo2_at=\"val0\">text</foo2> </foo3>",
+ "<foo4 xmlns:myns=\"foo.org\" myns:foo3_at=\"val0\">text <foo2 foo2_at=\"val0\">text</foo2> </foo4>",
+ "<foo5 xmlns:myns=\"foo_OUT.org\"><myns:foo4 xmlns:myns=\"foo.org\" myns:foo3_at=\"val0\">text <foo2 foo2_at=\"val0\">text</foo2> </myns:foo4></foo5>"
};
Thread[] threads;
@@ -39,10 +40,7 @@ public class MultipleDocsTest extends Te
int nIterations = 100;
Document[] m_doc;
- public MultipleDocsTest(String name) {
- super(name);
- }
-
+ @Test
public void testRunThreads() {
for (int j = 0; j < nThreadCount; j++)
@@ -56,10 +54,10 @@ public class MultipleDocsTest extends Te
System.err.println("Thread " + j + " interrupted");
}
-
}
}
+ @Before
public void setUp() throws Exception {
threads = new Thread[nThreadCount];
for (int i = 0; i < nThreadCount; i++) {
@@ -73,11 +71,6 @@ public class MultipleDocsTest extends Te
}
}
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
private class Worker extends Thread {
int _ID;
Document doc;
@@ -189,16 +182,4 @@ public class MultipleDocsTest extends Te
}
}
}
-
- public static void main(String[] a) {
- try {
- MultipleDocsTest test = new MultipleDocsTest("");
- test.setUp();
- test.testRunThreads();
- }
- catch (Throwable t) {
- t.printStackTrace(System.err);
- }
- }
-
}
Modified: xmlbeans/trunk/test/src/dom/detailed/TextInsertDeleteTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/TextInsertDeleteTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/TextInsertDeleteTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/TextInsertDeleteTest.java Fri Jan 18 23:08:44 2019
@@ -17,36 +17,36 @@
package dom.detailed;
import dom.common.Loader;
-import junit.framework.TestCase;
-import org.w3c.dom.*;
import org.apache.xmlbeans.XmlObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.w3c.dom.*;
+import static org.junit.Assert.assertEquals;
-/**
- *
- *
- */
-public class TextInsertDeleteTest extends TestCase {
+public class TextInsertDeleteTest {
String sXml = "<foo>txt0<bar/>txt1<baz/>txt2</foo>";
String sXmlNS = "<foo/>";
Document m_doc,
m_docNS;
Node m_node;
+ @Test
public void testBuildMixedContent(){
- DOMImplementation domImpl = XmlObject.Factory.newDomImplementation( null );
- m_doc=domImpl.createDocument("foobar","val",null);
- Element root=m_doc.getDocumentElement();
+ DOMImplementation domImpl = XmlObject.Factory.newDomImplementation(null);
+ m_doc = domImpl.createDocument("foobar", "val", null);
+ Element root = m_doc.getDocumentElement();
//m_doc.appendChild(root);
- Element n=(Element)m_doc.createElement("foo");
- Text txt1=m_doc.createTextNode("foobar");
- Text txt2=m_doc.createTextNode("baz");
- root.appendChild(txt1);
- root.appendChild(n);
- root.appendChild(txt2);
- System.out.println(m_doc.toString()) ;
+ Element n = (Element) m_doc.createElement("foo");
+ Text txt1 = m_doc.createTextNode("foobar");
+ Text txt2 = m_doc.createTextNode("baz");
+ root.appendChild(txt1);
+ root.appendChild(n);
+ root.appendChild(txt2);
+ System.out.println(m_doc.toString());
}
+ @Test
public void testAdjacent() {
NodeList ch = m_node.getChildNodes();
m_node.removeChild(ch.item(1));
@@ -59,6 +59,7 @@ public class TextInsertDeleteTest extend
}
+ @Test
public void testInsertDelete() {
//eric test
// TODO: three children delete middle--verify length
@@ -89,10 +90,9 @@ public class TextInsertDeleteTest extend
assertEquals(1, ch.getLength());
assertEquals("bar", m_node.getLastChild().getNodeValue());
assertEquals("bar", m_node.getFirstChild().getNodeValue());
-
-
}
+ @Test
public void testInsertDeleteBulk() {
int nNodeCnt = 16;
@@ -134,13 +134,13 @@ public class TextInsertDeleteTest extend
}
+ @Before
public void setUp() throws Exception {
-
Loader loader = Loader.getLoader();
if (sXml == null && sXmlNS == null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
- m_doc = (org.w3c.dom.Document) loader.load(sXml);
+ m_doc = loader.load(sXml);
if (sXmlNS != null && sXmlNS.length() > 0)
- m_docNS = (org.w3c.dom.Document) loader.load(sXmlNS);
+ m_docNS = loader.load(sXmlNS);
m_node = m_doc.getFirstChild();
}
Modified: xmlbeans/trunk/test/src/dom/detailed/TextTest.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/TextTest.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/TextTest.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/TextTest.java Fri Jan 18 23:08:44 2019
@@ -17,56 +17,41 @@
package dom.detailed;
import dom.common.Loader;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
+import static org.junit.Assert.assertEquals;
-/**
- *
- *
- *
- */
-public class TextTest extends TestCase{
+public class TextTest {
String sXml="<foo at0=\"no_ns_attr\"></foo>";
String sXmlNS="<foo><foobar xmlns:myns=\"http://foo.org\" xmlns:other=\"other.org\">footext</foobar></foo>";
Document m_doc,
m_docNS;
Node m_node;
- public TextTest(String name){
- super(name);
- }
-
-
- //insert a node from a ns into a non-ns
- public void testMoveNodeNStoNoNS(){
-
-
-
- }
-
+ @Test
public void testTextToAttrValue(){
- m_node=m_docNS.getFirstChild().getFirstChild().getFirstChild();//footext
- Attr attrib=(Attr)m_docNS.getFirstChild().getFirstChild().getAttributes().getNamedItem("xmlns:myns");
- assertEquals("http://foo.org",attrib.getNodeValue());
- //attrib.replaceChild(m_node,attrib.getFirstChild());
- attrib.setValue(m_node.getNodeValue());
- assertEquals("footext",attrib.getNodeValue());
- //assertFalse(m_docNS.getFirstChild().getFirstChild().hasChildNodes());
+ m_node = m_docNS.getFirstChild().getFirstChild().getFirstChild();//footext
+ Attr attrib = (Attr) m_docNS.getFirstChild().getFirstChild().getAttributes().getNamedItem("xmlns:myns");
+ assertEquals("http://foo.org", attrib.getNodeValue());
+ //attrib.replaceChild(m_node,attrib.getFirstChild());
+ attrib.setValue(m_node.getNodeValue());
+ assertEquals("footext", attrib.getNodeValue());
+ //assertFalse(m_docNS.getFirstChild().getFirstChild().hasChildNodes());
}
+ @Before
+ public void setUp() throws Exception {
+ Loader loader = Loader.getLoader();
+ if (sXml == null && sXmlNS == null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
+ m_doc = loader.load(sXml);
+ if (sXmlNS != null && sXmlNS.length() > 0)
+ m_docNS = loader.load(sXmlNS);
- public void setUp() throws Exception{
-
- Loader loader=Loader.getLoader();
- if (sXml==null && sXmlNS==null) throw new IllegalArgumentException("Test bug : Initialize xml strings");
- m_doc=(org.w3c.dom.Document)loader.load(sXml);
- if(sXmlNS!=null && sXmlNS.length()>0)
- m_docNS=(org.w3c.dom.Document)loader.load(sXmlNS);
-
- m_node=m_doc.getFirstChild();
- }
+ m_node = m_doc.getFirstChild();
}
+}
Modified: xmlbeans/trunk/test/src/dom/detailed/w3c/alltests.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/test/src/dom/detailed/w3c/alltests.java?rev=1851656&r1=1851655&r2=1851656&view=diff
==============================================================================
--- xmlbeans/trunk/test/src/dom/detailed/w3c/alltests.java (original)
+++ xmlbeans/trunk/test/src/dom/detailed/w3c/alltests.java Fri Jan 18 23:08:44 2019
@@ -20,313 +20,307 @@ See W3C License http://www.w3.org/Consor
//package org.w3c.domts.level2.core;
package dom.detailed.w3c;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
import org.w3c.domts.level2.core.*;
- /**
- * Test suite
- * @author W3C DOM Test Working Group
- **/
- public class alltests extends TestCase{
-
- public static Test suite() {
- TestSuite sink= new TestSuite();
- // sink.addTestSuite(attrgetownerelement01.class);
- sink.addTestSuite(attrgetownerelement02.class);
- sink.addTestSuite(attrgetownerelement03.class);
- // sink.addTestSuite(attrgetownerelement04.class);
- sink.addTestSuite(attrgetownerelement05.class);
- sink.addTestSuite(createAttributeNS01.class);
- sink.addTestSuite(createAttributeNS02.class);
- sink.addTestSuite(createAttributeNS03.class);
- sink.addTestSuite(createAttributeNS04.class);
- sink.addTestSuite(createAttributeNS05.class);
- sink.addTestSuite(createDocument01.class);
- sink.addTestSuite(createDocument02.class);
- // sink.addTestSuite(createDocument03.class);
- // sink.addTestSuite(createDocument04.class);
- sink.addTestSuite(createDocument05.class);
- sink.addTestSuite(createDocument06.class);
- sink.addTestSuite(createDocument07.class);
- // sink.addTestSuite(createDocumentType01.class);
- // sink.addTestSuite(createDocumentType02.class);
- // sink.addTestSuite(createDocumentType03.class);
- sink.addTestSuite(createElementNS01.class);
- sink.addTestSuite(createElementNS02.class);
- sink.addTestSuite(createElementNS03.class);
- sink.addTestSuite(createElementNS04.class);
- sink.addTestSuite(createElementNS05.class);
- sink.addTestSuite(documentcreateattributeNS01.class);
- sink.addTestSuite(documentcreateattributeNS02.class);
- sink.addTestSuite(documentcreateattributeNS03.class);
- sink.addTestSuite(documentcreateattributeNS04.class);
- sink.addTestSuite(documentcreateattributeNS05.class);
- sink.addTestSuite(documentcreateattributeNS06.class);
- sink.addTestSuite(documentcreateattributeNS07.class);
- sink.addTestSuite(documentcreateelementNS01.class);
- sink.addTestSuite(documentcreateelementNS02.class);
- sink.addTestSuite(documentcreateelementNS05.class);
- sink.addTestSuite(documentcreateelementNS06.class);
- // sink.addTestSuite(documentgetelementbyid01.class);
- sink.addTestSuite(documentgetelementsbytagnameNS01.class);
- sink.addTestSuite(documentgetelementsbytagnameNS02.class);
- sink.addTestSuite(documentgetelementsbytagnameNS03.class);
- sink.addTestSuite(documentgetelementsbytagnameNS04.class);
- sink.addTestSuite(documentgetelementsbytagnameNS05.class);
- sink.addTestSuite(documentimportnode01.class);
- // sink.addTestSuite(documentimportnode02.class);
- // sink.addTestSuite(documentimportnode03.class);
- // sink.addTestSuite(documentimportnode04.class);
- sink.addTestSuite(documentimportnode05.class);
- sink.addTestSuite(documentimportnode06.class);
- // sink.addTestSuite(documentimportnode07.class);
- // sink.addTestSuite(documentimportnode08.class);
- sink.addTestSuite(documentimportnode09.class);
- sink.addTestSuite(documentimportnode10.class);
- sink.addTestSuite(documentimportnode11.class);
- sink.addTestSuite(documentimportnode12.class);
- sink.addTestSuite(documentimportnode13.class);
- sink.addTestSuite(documentimportnode14.class);
- sink.addTestSuite(documentimportnode15.class);
- sink.addTestSuite(documentimportnode17.class);
- sink.addTestSuite(documentimportnode18.class);
- // sink.addTestSuite(documentimportnode19.class);
- // sink.addTestSuite(documentimportnode20.class);
- // sink.addTestSuite(documentimportnode21.class);
- // sink.addTestSuite(documentimportnode22.class);
- // sink.addTestSuite(documenttypeinternalSubset01.class);
- // sink.addTestSuite(documenttypepublicid01.class);
- // sink.addTestSuite(documenttypesystemid01.class);
- sink.addTestSuite(domimplementationcreatedocument03.class);
- sink.addTestSuite(domimplementationcreatedocument04.class);
- sink.addTestSuite(domimplementationcreatedocument05.class);
- sink.addTestSuite(domimplementationcreatedocument07.class);
- // sink.addTestSuite(domimplementationcreatedocumenttype01.class);
- // sink.addTestSuite(domimplementationcreatedocumenttype02.class);
- // sink.addTestSuite(domimplementationcreatedocumenttype04.class);
- // sink.addTestSuite(domimplementationfeaturecore.class);
- // sink.addTestSuite(domimplementationfeaturexmlversion2.class);
- // sink.addTestSuite(domimplementationhasfeature01.class);
- // sink.addTestSuite(domimplementationhasfeature02.class);
- sink.addTestSuite(elementgetattributenodens01.class);
- sink.addTestSuite(elementgetattributenodens02.class);
- // sink.addTestSuite(elementgetattributenodens03.class);
- // sink.addTestSuite(elementgetattributens02.class);
- sink.addTestSuite(elementgetelementsbytagnamens02.class);
- sink.addTestSuite(elementgetelementsbytagnamens04.class);
- sink.addTestSuite(elementgetelementsbytagnamens05.class);
- sink.addTestSuite(elementhasattribute01.class);
- // sink.addTestSuite(elementhasattribute02.class);
- sink.addTestSuite(elementhasattribute03.class);
- sink.addTestSuite(elementhasattribute04.class);
- sink.addTestSuite(elementhasattributens01.class);
- sink.addTestSuite(elementhasattributens02.class);
- sink.addTestSuite(elementhasattributens03.class);
- sink.addTestSuite(elementremoveattributens01.class);
- sink.addTestSuite(elementsetattributenodens01.class);
- sink.addTestSuite(elementsetattributenodens02.class);
- sink.addTestSuite(elementsetattributenodens03.class);
- sink.addTestSuite(elementsetattributenodens04.class);
- sink.addTestSuite(elementsetattributenodens05.class);
- // sink.addTestSuite(elementsetattributenodens06.class);
- sink.addTestSuite(elementsetattributens01.class);
- sink.addTestSuite(elementsetattributens02.class);
- sink.addTestSuite(elementsetattributens03.class);
- sink.addTestSuite(elementsetattributens04.class);
- sink.addTestSuite(elementsetattributens05.class);
- sink.addTestSuite(elementsetattributens08.class);
- sink.addTestSuite(elementsetattributensurinull.class);
- // sink.addTestSuite(getAttributeNS01.class);
- sink.addTestSuite(getAttributeNS02.class);
- sink.addTestSuite(getAttributeNS03.class);
- sink.addTestSuite(getAttributeNS04.class);
- sink.addTestSuite(getAttributeNS05.class);
- sink.addTestSuite(getAttributeNodeNS01.class);
- sink.addTestSuite(getAttributeNodeNS02.class);
- // sink.addTestSuite(getElementById01.class);
- // sink.addTestSuite(getElementById02.class);
- // sink.addTestSuite(getElementsByTagNameNS01.class);
- sink.addTestSuite(getElementsByTagNameNS02.class);
- sink.addTestSuite(getElementsByTagNameNS03.class);
- sink.addTestSuite(getElementsByTagNameNS04.class);
- sink.addTestSuite(getElementsByTagNameNS05.class);
- sink.addTestSuite(getElementsByTagNameNS06.class);
- sink.addTestSuite(getElementsByTagNameNS07.class);
- sink.addTestSuite(getElementsByTagNameNS08.class);
- sink.addTestSuite(getElementsByTagNameNS09.class);
- sink.addTestSuite(getElementsByTagNameNS10.class);
- sink.addTestSuite(getElementsByTagNameNS11.class);
- sink.addTestSuite(getElementsByTagNameNS12.class);
- sink.addTestSuite(getElementsByTagNameNS13.class);
- sink.addTestSuite(getElementsByTagNameNS14.class);
- sink.addTestSuite(getNamedItemNS01.class);
- sink.addTestSuite(getNamedItemNS02.class);
- // sink.addTestSuite(getNamedItemNS03.class);
- // sink.addTestSuite(getNamedItemNS04.class);
- sink.addTestSuite(hasAttribute01.class);
- sink.addTestSuite(hasAttribute02.class);
- sink.addTestSuite(hasAttribute03.class);
- sink.addTestSuite(hasAttribute04.class);
- sink.addTestSuite(hasAttributeNS01.class);
- sink.addTestSuite(hasAttributeNS02.class);
- sink.addTestSuite(hasAttributeNS03.class);
- // sink.addTestSuite(hasAttributeNS04.class);
- sink.addTestSuite(hasAttributeNS05.class);
- sink.addTestSuite(hasAttributes01.class);
- sink.addTestSuite(hasAttributes02.class);
- sink.addTestSuite(hc_attrcreatedocumentfragment.class);
- sink.addTestSuite(hc_attrname.class);
- sink.addTestSuite(hc_documentcreateattribute.class);
- sink.addTestSuite(hc_elementgetattributenode.class);
- // sink.addTestSuite(hc_entitiesremovenameditemns1.class);
- // sink.addTestSuite(hc_entitiessetnameditemns1.class);
- sink.addTestSuite(hc_namednodemapgetnameditem.class);
- sink.addTestSuite(hc_nodedocumentfragmentnormalize1.class);
- sink.addTestSuite(hc_nodedocumentfragmentnormalize2.class);
- // sink.addTestSuite(hc_notationsremovenameditemns1.class);
- // sink.addTestSuite(hc_notationssetnameditemns1.class);
- // sink.addTestSuite(ibmtests.class);
- // sink.addTestSuite(importNode01.class);
- // sink.addTestSuite(importNode02.class);
- sink.addTestSuite(importNode03.class);
- sink.addTestSuite(importNode04.class);
- // sink.addTestSuite(importNode05.class);
- // sink.addTestSuite(importNode06.class);
- sink.addTestSuite(importNode07.class);
- sink.addTestSuite(importNode08.class);
- // sink.addTestSuite(importNode09.class);
- // sink.addTestSuite(importNode10.class);
- // sink.addTestSuite(importNode11.class);
- // sink.addTestSuite(importNode12.class);
- // sink.addTestSuite(importNode13.class);
- sink.addTestSuite(importNode14.class);
- sink.addTestSuite(importNode15.class);
- // sink.addTestSuite(importNode16.class);
- sink.addTestSuite(importNode17.class);
- // sink.addTestSuite(internalSubset01.class);
- sink.addTestSuite(isSupported01.class);
- sink.addTestSuite(isSupported02.class);
- sink.addTestSuite(isSupported04.class);
- sink.addTestSuite(isSupported05.class);
- sink.addTestSuite(isSupported06.class);
- sink.addTestSuite(isSupported07.class);
- sink.addTestSuite(isSupported09.class);
- sink.addTestSuite(isSupported10.class);
- sink.addTestSuite(isSupported11.class);
- sink.addTestSuite(isSupported12.class);
- sink.addTestSuite(isSupported13.class);
- sink.addTestSuite(isSupported14.class);
- sink.addTestSuite(localName01.class);
- sink.addTestSuite(localName02.class);
- sink.addTestSuite(localName03.class);
- sink.addTestSuite(localName04.class);
- // sink.addTestSuite(namednodemapgetnameditemns01.class);
- sink.addTestSuite(namednodemapgetnameditemns02.class);
- sink.addTestSuite(namednodemapgetnameditemns03.class);
- sink.addTestSuite(namednodemapgetnameditemns04.class);
- sink.addTestSuite(namednodemapgetnameditemns05.class);
- sink.addTestSuite(namednodemapgetnameditemns06.class);
- sink.addTestSuite(namednodemapremovenameditemns01.class);
- //default Attr
- // sink.addTestSuite(namednodemapremovenameditemns02.class);
- // ER
- // sink.addTestSuite(namednodemapremovenameditemns03.class);
- sink.addTestSuite(namednodemapremovenameditemns04.class);
- // sink.addTestSuite(namednodemapremovenameditemns05.class);
- sink.addTestSuite(namednodemapremovenameditemns06.class);
- sink.addTestSuite(namednodemapremovenameditemns07.class);
- sink.addTestSuite(namednodemapremovenameditemns08.class);
- sink.addTestSuite(namednodemapremovenameditemns09.class);
- sink.addTestSuite(namednodemapsetnameditemns01.class);
- sink.addTestSuite(namednodemapsetnameditemns02.class);
- sink.addTestSuite(namednodemapsetnameditemns03.class);
- sink.addTestSuite(namednodemapsetnameditemns04.class);
- // sink.addTestSuite(namednodemapsetnameditemns05.class);
- sink.addTestSuite(namednodemapsetnameditemns06.class);
- sink.addTestSuite(namednodemapsetnameditemns07.class);
- sink.addTestSuite(namednodemapsetnameditemns08.class);
- // sink.addTestSuite(namednodemapsetnameditemns09.class);
- // sink.addTestSuite(namednodemapsetnameditemns10.class);
- // sink.addTestSuite(namednodemapsetnameditemns11.class);
- sink.addTestSuite(namespaceURI01.class);
- sink.addTestSuite(namespaceURI02.class);
- sink.addTestSuite(namespaceURI03.class);
- sink.addTestSuite(namespaceURI04.class);
- sink.addTestSuite(nodegetlocalname03.class);
- sink.addTestSuite(nodegetnamespaceuri03.class);
- // sink.addTestSuite(nodegetownerdocument01.class);
- sink.addTestSuite(nodegetownerdocument02.class);
- sink.addTestSuite(nodegetprefix03.class);
- sink.addTestSuite(nodehasattributes01.class);
- // sink.addTestSuite(nodehasattributes02.class);
- sink.addTestSuite(nodehasattributes03.class);
- sink.addTestSuite(nodehasattributes04.class);
- // sink.addTestSuite(nodeissupported01.class);
- // sink.addTestSuite(nodeissupported02.class);
- // sink.addTestSuite(nodeissupported03.class);
- // sink.addTestSuite(nodeissupported04.class);
- // sink.addTestSuite(nodeissupported05.class);
- // sink.addTestSuite(nodenormalize01.class);
- sink.addTestSuite(nodesetprefix01.class);
- sink.addTestSuite(nodesetprefix02.class);
- sink.addTestSuite(nodesetprefix03.class);
- // sink.addTestSuite(nodesetprefix04.class);
- sink.addTestSuite(nodesetprefix05.class);
- sink.addTestSuite(nodesetprefix06.class);
- sink.addTestSuite(nodesetprefix07.class);
- sink.addTestSuite(nodesetprefix08.class);
- sink.addTestSuite(nodesetprefix09.class);
- sink.addTestSuite(normalize01.class);
- sink.addTestSuite(ownerDocument01.class);
- sink.addTestSuite(ownerElement01.class);
- sink.addTestSuite(ownerElement02.class);
- sink.addTestSuite(prefix01.class);
- sink.addTestSuite(prefix02.class);
- sink.addTestSuite(prefix03.class);
- sink.addTestSuite(prefix04.class);
- sink.addTestSuite(prefix05.class);
- sink.addTestSuite(prefix06.class);
- sink.addTestSuite(prefix07.class);
- // sink.addTestSuite(prefix08.class);
- sink.addTestSuite(prefix09.class);
- sink.addTestSuite(prefix10.class);
- sink.addTestSuite(prefix11.class);
- // sink.addTestSuite(publicId01.class);
- // sink.addTestSuite(removeAttributeNS01.class);
- // sink.addTestSuite(removeAttributeNS02.class);
- sink.addTestSuite(removeNamedItemNS01.class);
- sink.addTestSuite(removeNamedItemNS02.class);
- sink.addTestSuite(removeNamedItemNS03.class);
- sink.addTestSuite(setAttributeNS01.class);
- sink.addTestSuite(setAttributeNS02.class);
- //Test makes no sense w/o ER
- // sink.addTestSuite(setAttributeNS03.class);
- sink.addTestSuite(setAttributeNS04.class);
- sink.addTestSuite(setAttributeNS05.class);
- sink.addTestSuite(setAttributeNS06.class);
- sink.addTestSuite(setAttributeNS07.class);
- sink.addTestSuite(setAttributeNS09.class);
- sink.addTestSuite(setAttributeNodeNS01.class);
- //Test makes no sense w/o ER
- // sink.addTestSuite(setAttributeNodeNS02.class);
- sink.addTestSuite(setAttributeNodeNS03.class);
- sink.addTestSuite(setAttributeNodeNS04.class);
- sink.addTestSuite(setAttributeNodeNS05.class);
- sink.addTestSuite(setNamedItemNS01.class);
- sink.addTestSuite(setNamedItemNS02.class);
- sink.addTestSuite(setNamedItemNS03.class);
- //Test makes no sense w/o ER
- // sink.addTestSuite(setNamedItemNS04.class);
- sink.addTestSuite(setNamedItemNS05.class);
- // sink.addTestSuite(systemId01.class);
-
- return sink;
-
- }
-
+/**
+* Test suite
+* @author W3C DOM Test Working Group
+**/
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ // attrgetownerelement01.class,
+ attrgetownerelement02.class,
+ attrgetownerelement03.class,
+ // attrgetownerelement04.class,
+ attrgetownerelement05.class,
+ createAttributeNS01.class,
+ createAttributeNS02.class,
+ createAttributeNS03.class,
+ createAttributeNS04.class,
+ createAttributeNS05.class,
+ createDocument01.class,
+ createDocument02.class,
+ // createDocument03.class,
+ // createDocument04.class,
+ createDocument05.class,
+ createDocument06.class,
+ createDocument07.class,
+ // createDocumentType01.class,
+ // createDocumentType02.class,
+ // createDocumentType03.class,
+ createElementNS01.class,
+ createElementNS02.class,
+ createElementNS03.class,
+ createElementNS04.class,
+ createElementNS05.class,
+ documentcreateattributeNS01.class,
+ documentcreateattributeNS02.class,
+ documentcreateattributeNS03.class,
+ documentcreateattributeNS04.class,
+ documentcreateattributeNS05.class,
+ documentcreateattributeNS06.class,
+ documentcreateattributeNS07.class,
+ documentcreateelementNS01.class,
+ documentcreateelementNS02.class,
+ documentcreateelementNS05.class,
+ documentcreateelementNS06.class,
+ // documentgetelementbyid01.class,
+ documentgetelementsbytagnameNS01.class,
+ documentgetelementsbytagnameNS02.class,
+ documentgetelementsbytagnameNS03.class,
+ documentgetelementsbytagnameNS04.class,
+ documentgetelementsbytagnameNS05.class,
+ documentimportnode01.class,
+ // documentimportnode02.class,
+ // documentimportnode03.class,
+ // documentimportnode04.class,
+ documentimportnode05.class,
+ documentimportnode06.class,
+ // documentimportnode07.class,
+ // documentimportnode08.class,
+ documentimportnode09.class,
+ documentimportnode10.class,
+ documentimportnode11.class,
+ documentimportnode12.class,
+ documentimportnode13.class,
+ documentimportnode14.class,
+ documentimportnode15.class,
+ documentimportnode17.class,
+ documentimportnode18.class,
+ // documentimportnode19.class,
+ // documentimportnode20.class,
+ // documentimportnode21.class,
+ // documentimportnode22.class,
+ // documenttypeinternalSubset01.class,
+ // documenttypepublicid01.class,
+ // documenttypesystemid01.class,
+ domimplementationcreatedocument03.class,
+ domimplementationcreatedocument04.class,
+ domimplementationcreatedocument05.class,
+ domimplementationcreatedocument07.class,
+ // domimplementationcreatedocumenttype01.class,
+ // domimplementationcreatedocumenttype02.class,
+ // domimplementationcreatedocumenttype04.class,
+ // domimplementationfeaturecore.class,
+ // domimplementationfeaturexmlversion2.class,
+ // domimplementationhasfeature01.class,
+ // domimplementationhasfeature02.class,
+ elementgetattributenodens01.class,
+ elementgetattributenodens02.class,
+ // elementgetattributenodens03.class,
+ // elementgetattributens02.class,
+ elementgetelementsbytagnamens02.class,
+ elementgetelementsbytagnamens04.class,
+ elementgetelementsbytagnamens05.class,
+ elementhasattribute01.class,
+ // elementhasattribute02.class,
+ elementhasattribute03.class,
+ elementhasattribute04.class,
+ elementhasattributens01.class,
+ elementhasattributens02.class,
+ elementhasattributens03.class,
+ elementremoveattributens01.class,
+ elementsetattributenodens01.class,
+ elementsetattributenodens02.class,
+ elementsetattributenodens03.class,
+ elementsetattributenodens04.class,
+ elementsetattributenodens05.class,
+ // elementsetattributenodens06.class,
+ elementsetattributens01.class,
+ elementsetattributens02.class,
+ elementsetattributens03.class,
+ elementsetattributens04.class,
+ elementsetattributens05.class,
+ elementsetattributens08.class,
+ elementsetattributensurinull.class,
+ // getAttributeNS01.class,
+ getAttributeNS02.class,
+ getAttributeNS03.class,
+ getAttributeNS04.class,
+ getAttributeNS05.class,
+ getAttributeNodeNS01.class,
+ getAttributeNodeNS02.class,
+ // getElementById01.class,
+ // getElementById02.class,
+ // getElementsByTagNameNS01.class,
+ getElementsByTagNameNS02.class,
+ getElementsByTagNameNS03.class,
+ getElementsByTagNameNS04.class,
+ getElementsByTagNameNS05.class,
+ getElementsByTagNameNS06.class,
+ getElementsByTagNameNS07.class,
+ getElementsByTagNameNS08.class,
+ getElementsByTagNameNS09.class,
+ getElementsByTagNameNS10.class,
+ getElementsByTagNameNS11.class,
+ getElementsByTagNameNS12.class,
+ getElementsByTagNameNS13.class,
+ getElementsByTagNameNS14.class,
+ getNamedItemNS01.class,
+ getNamedItemNS02.class,
+ // getNamedItemNS03.class,
+ // getNamedItemNS04.class,
+ hasAttribute01.class,
+ hasAttribute02.class,
+ hasAttribute03.class,
+ hasAttribute04.class,
+ hasAttributeNS01.class,
+ hasAttributeNS02.class,
+ hasAttributeNS03.class,
+ // hasAttributeNS04.class,
+ hasAttributeNS05.class,
+ hasAttributes01.class,
+ hasAttributes02.class,
+ hc_attrcreatedocumentfragment.class,
+ hc_attrname.class,
+ hc_documentcreateattribute.class,
+ hc_elementgetattributenode.class,
+ // hc_entitiesremovenameditemns1.class,
+ // hc_entitiessetnameditemns1.class,
+ hc_namednodemapgetnameditem.class,
+ hc_nodedocumentfragmentnormalize1.class,
+ hc_nodedocumentfragmentnormalize2.class,
+ // hc_notationsremovenameditemns1.class,
+ // hc_notationssetnameditemns1.class,
+ // ibmtests.class,
+ // importNode01.class,
+ // importNode02.class,
+ importNode03.class,
+ importNode04.class,
+ // importNode05.class,
+ // importNode06.class,
+ importNode07.class,
+ importNode08.class,
+ // importNode09.class,
+ // importNode10.class,
+ // importNode11.class,
+ // importNode12.class,
+ // importNode13.class,
+ importNode14.class,
+ importNode15.class,
+ // importNode16.class,
+ importNode17.class,
+ // internalSubset01.class,
+ isSupported01.class,
+ isSupported02.class,
+ isSupported04.class,
+ isSupported05.class,
+ isSupported06.class,
+ isSupported07.class,
+ isSupported09.class,
+ isSupported10.class,
+ isSupported11.class,
+ isSupported12.class,
+ isSupported13.class,
+ isSupported14.class,
+ localName01.class,
+ localName02.class,
+ localName03.class,
+ localName04.class,
+ // namednodemapgetnameditemns01.class,
+ namednodemapgetnameditemns02.class,
+ namednodemapgetnameditemns03.class,
+ namednodemapgetnameditemns04.class,
+ namednodemapgetnameditemns05.class,
+ namednodemapgetnameditemns06.class,
+ namednodemapremovenameditemns01.class,
+ //default Attr
+ // namednodemapremovenameditemns02.class,
+ // ER
+ // namednodemapremovenameditemns03.class,
+ namednodemapremovenameditemns04.class,
+ // namednodemapremovenameditemns05.class,
+ namednodemapremovenameditemns06.class,
+ namednodemapremovenameditemns07.class,
+ namednodemapremovenameditemns08.class,
+ namednodemapremovenameditemns09.class,
+ namednodemapsetnameditemns01.class,
+ namednodemapsetnameditemns02.class,
+ namednodemapsetnameditemns03.class,
+ namednodemapsetnameditemns04.class,
+ // namednodemapsetnameditemns05.class,
+ namednodemapsetnameditemns06.class,
+ namednodemapsetnameditemns07.class,
+ namednodemapsetnameditemns08.class,
+ // namednodemapsetnameditemns09.class,
+ // namednodemapsetnameditemns10.class,
+ // namednodemapsetnameditemns11.class,
+ namespaceURI01.class,
+ namespaceURI02.class,
+ namespaceURI03.class,
+ namespaceURI04.class,
+ nodegetlocalname03.class,
+ nodegetnamespaceuri03.class,
+ // nodegetownerdocument01.class,
+ nodegetownerdocument02.class,
+ nodegetprefix03.class,
+ nodehasattributes01.class,
+ // nodehasattributes02.class,
+ nodehasattributes03.class,
+ nodehasattributes04.class,
+ // nodeissupported01.class,
+ // nodeissupported02.class,
+ // nodeissupported03.class,
+ // nodeissupported04.class,
+ // nodeissupported05.class,
+ // nodenormalize01.class,
+ nodesetprefix01.class,
+ nodesetprefix02.class,
+ nodesetprefix03.class,
+ // nodesetprefix04.class,
+ nodesetprefix05.class,
+ nodesetprefix06.class,
+ nodesetprefix07.class,
+ nodesetprefix08.class,
+ nodesetprefix09.class,
+ normalize01.class,
+ ownerDocument01.class,
+ ownerElement01.class,
+ ownerElement02.class,
+ prefix01.class,
+ prefix02.class,
+ prefix03.class,
+ prefix04.class,
+ prefix05.class,
+ prefix06.class,
+ prefix07.class,
+ // prefix08.class,
+ prefix09.class,
+ prefix10.class,
+ prefix11.class,
+ // publicId01.class,
+ // removeAttributeNS01.class,
+ // removeAttributeNS02.class,
+ removeNamedItemNS01.class,
+ removeNamedItemNS02.class,
+ removeNamedItemNS03.class,
+ setAttributeNS01.class,
+ setAttributeNS02.class,
+ //Test makes no sense w/o ER
+ // setAttributeNS03.class,
+ setAttributeNS04.class,
+ setAttributeNS05.class,
+ setAttributeNS06.class,
+ setAttributeNS07.class,
+ setAttributeNS09.class,
+ setAttributeNodeNS01.class,
+ //Test makes no sense w/o ER
+ // setAttributeNodeNS02.class,
+ setAttributeNodeNS03.class,
+ setAttributeNodeNS04.class,
+ setAttributeNodeNS05.class,
+ setNamedItemNS01.class,
+ setNamedItemNS02.class,
+ setNamedItemNS03.class,
+ //Test makes no sense w/o ER
+ // setNamedItemNS04.class,
+ setNamedItemNS05.class,
+ // systemId01.class,
+})
+public class alltests {
/**
* Gets URI that identifies the test suite
* @return uri identifier of test suite
@@ -334,6 +328,4 @@ import org.w3c.domts.level2.core.*;
public String getTargetURI() {
return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/alltests";
}
-
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org