diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:43:57 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-10 15:43:57 -0800 |
commit | b7926325a1c1a370c84c81db80372f59af240a53 (patch) | |
tree | b1d0214be443ea674d0ded8c502a8e074e50bdd2 /dom/src | |
parent | 687f18b91f4a0a728a027579110953ee729adcb8 (diff) | |
download | libcore-b7926325a1c1a370c84c81db80372f59af240a53.zip libcore-b7926325a1c1a370c84c81db80372f59af240a53.tar.gz libcore-b7926325a1c1a370c84c81db80372f59af240a53.tar.bz2 |
auto import from //branches/cupcake/...@130745
Diffstat (limited to 'dom/src')
3 files changed, 149 insertions, 26 deletions
diff --git a/dom/src/test/java/org/w3c/domts/JUnitTestCaseAdapter.java b/dom/src/test/java/org/w3c/domts/JUnitTestCaseAdapter.java index 6180147..7110792 100644 --- a/dom/src/test/java/org/w3c/domts/JUnitTestCaseAdapter.java +++ b/dom/src/test/java/org/w3c/domts/JUnitTestCaseAdapter.java @@ -13,10 +13,15 @@ package org.w3c.domts; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; @@ -30,14 +35,132 @@ import org.w3c.dom.NodeList; public class JUnitTestCaseAdapter extends TestCase implements DOMTestFramework { private DOMTestCase test; + + + private static DOMTestDocumentBuilderFactory defaultFactory = null; public JUnitTestCaseAdapter(DOMTestCase test) { super(test.getTargetURI()); test.setFramework(this); this.test = test; } - +//BEGIN android-added + public JUnitTestCaseAdapter() { + + } + + private String errorMessage = null; + private boolean failed = false; + + @Override + public void setName(String name) { + super.setName(name); + if (test == null) { + try { + URI uri = new URI(name); + String path = uri.getPath(); + path = path.replaceAll("/", "."); + Class<?> clazz = null; + int pos = path.indexOf('.'); + while (pos != -1) { + try { + clazz = Class.forName("org.w3c.domts." + path); + break; + } catch (ClassNotFoundException e) { + // do nothing + } + path = path.substring(pos + 1); + } + if (clazz == null) { + errorMessage = "class not found for test: " + name; + failed = true; + return; + } + + if (defaultFactory == null) { + defaultFactory = new JAXPDOMTestDocumentBuilderFactory(null, + JAXPDOMTestDocumentBuilderFactory.getConfiguration1()); + } + + Constructor<?> constructor = clazz.getConstructor(new Class<?>[] { + DOMTestDocumentBuilderFactory.class + }); + + test = (DOMTestCase)constructor.newInstance(new Object[] { + defaultFactory + }); + test.setFramework(this); + + } catch (URISyntaxException e) { + failed = true; + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } catch (IllegalAccessException e) { + failed = true; + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } catch (InstantiationException e) { + failed = true; + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } catch (DOMTestIncompatibleException e) { + failed = true; + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } catch (SecurityException e) { + failed = true; + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } catch (NoSuchMethodException e) { + failed = true; + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } catch (IllegalArgumentException e) { + failed = true; + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } catch (InvocationTargetException e) { + failed = true; + Throwable t = e.getCause(); + if (t != null) { + errorMessage = t.getMessage(); + if (errorMessage == null) { + errorMessage = "" + t.toString(); + } + } else { + errorMessage = e.getMessage(); + if (errorMessage == null) { + errorMessage = "" + e.toString(); + } + } + } + } + } +//END android-added protected void runTest() throws Throwable { + //BEGIN android-added + if (failed) { + if (errorMessage != null) { + fail(errorMessage); + } else { + fail("init failed"); + } + } + //END android-added test.runTest(); int mutationCount = test.getMutationCount(); if (mutationCount != 0) { diff --git a/dom/src/test/java/org/w3c/domts/level1/core/alltests.java b/dom/src/test/java/org/w3c/domts/level1/core/alltests.java index d5a7516..2c907f2 100644 --- a/dom/src/test/java/org/w3c/domts/level1/core/alltests.java +++ b/dom/src/test/java/org/w3c/domts/level1/core/alltests.java @@ -50,19 +50,19 @@ public class alltests extends DOMTestSuite { sink.addTest(attrcreatedocumentfragment.class); sink.addTest(attrcreatetextnode.class); sink.addTest(attrcreatetextnode2.class); - sink.addTest(attrdefaultvalue.class); +// sink.addTest(attrdefaultvalue.class); //javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(attreffectivevalue.class); // sink.addTest(attrentityreplacement.class); sink.addTest(attrname.class); sink.addTest(attrnextsiblingnull.class); - sink.addTest(attrnotspecifiedvalue.class); +// sink.addTest(attrnotspecifiedvalue.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(attrparentnodenull.class); sink.addTest(attrprevioussiblingnull.class); // sink.addTest(attrsetvaluenomodificationallowederr.class); // sink.addTest(attrsetvaluenomodificationallowederrEE.class); sink.addTest(attrspecifiedvalue.class); sink.addTest(attrspecifiedvaluechanged.class); - sink.addTest(attrspecifiedvalueremove.class); +// sink.addTest(attrspecifiedvalueremove.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(cdatasectiongetdata.class); // sink.addTest(cdatasectionnormalize.class); sink.addTest(characterdataappenddata.class); @@ -113,7 +113,7 @@ public class alltests extends DOMTestSuite { sink.addTest(documentcreatedocumentfragment.class); sink.addTest(documentcreateelement.class); sink.addTest(documentcreateelementcasesensitive.class); - sink.addTest(documentcreateelementdefaultattr.class); +// sink.addTest(documentcreateelementdefaultattr.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(documentcreateentityreference.class); // sink.addTest(documentcreateentityreferenceknown.class); sink.addTest(documentcreateprocessinginstruction.class); @@ -156,18 +156,18 @@ public class alltests extends DOMTestSuite { sink.addTest(elementinvalidcharacterexception.class); sink.addTest(elementnormalize.class); sink.addTest(elementnotfounderr.class); - sink.addTest(elementremoveattribute.class); +// sink.addTest(elementremoveattribute.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(elementremoveattributeaftercreate.class); sink.addTest(elementremoveattributenode.class); // sink.addTest(elementremoveattributenodenomodificationallowederr.class); // sink.addTest(elementremoveattributenodenomodificationallowederrEE.class); // sink.addTest(elementremoveattributenomodificationallowederr.class); // sink.addTest(elementremoveattributenomodificationallowederrEE.class); - sink.addTest(elementremoveattributerestoredefaultvalue.class); +// sink.addTest(elementremoveattributerestoredefaultvalue.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available // sink.addTest(elementreplaceattributewithself.class); // sink.addTest(elementreplaceexistingattribute.class); sink.addTest(elementreplaceexistingattributegevalue.class); - sink.addTest(elementretrieveallattributes.class); +// sink.addTest(elementretrieveallattributes.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(elementretrieveattrvalue.class); sink.addTest(elementretrievetagname.class); // sink.addTest(elementsetattributenodenomodificationallowederr.class); @@ -184,8 +184,8 @@ public class alltests extends DOMTestSuite { sink.addTest(namednodemapinuseattributeerr.class); sink.addTest(namednodemapnotfounderr.class); sink.addTest(namednodemapnumberofnodes.class); - sink.addTest(namednodemapremovenameditem.class); - sink.addTest(namednodemapremovenameditemgetvalue.class); +// sink.addTest(namednodemapremovenameditem.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available +// sink.addTest(namednodemapremovenameditemgetvalue.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(namednodemapremovenameditemreturnnodevalue.class); sink.addTest(namednodemapreturnattrnode.class); sink.addTest(namednodemapreturnfirstitem.class); diff --git a/dom/src/test/java/org/w3c/domts/level2/core/alltests.java b/dom/src/test/java/org/w3c/domts/level2/core/alltests.java index 2eb9368..8aaf13b 100644 --- a/dom/src/test/java/org/w3c/domts/level2/core/alltests.java +++ b/dom/src/test/java/org/w3c/domts/level2/core/alltests.java @@ -47,7 +47,7 @@ public class alltests extends DOMTestSuite { * @param sink test sink */ public void build(DOMTestSink sink) { - sink.addTest(attrgetownerelement01.class); +// sink.addTest(attrgetownerelement01.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(attrgetownerelement02.class); sink.addTest(attrgetownerelement03.class); sink.addTest(attrgetownerelement04.class); @@ -94,8 +94,8 @@ public class alltests extends DOMTestSuite { sink.addTest(documentgetelementsbytagnameNS05.class); // sink.addTest(documentimportnode01.class); sink.addTest(documentimportnode02.class); - sink.addTest(documentimportnode03.class); - sink.addTest(documentimportnode04.class); +// sink.addTest(documentimportnode03.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available +// sink.addTest(documentimportnode04.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(documentimportnode05.class); sink.addTest(documentimportnode06.class); sink.addTest(documentimportnode07.class); @@ -129,13 +129,13 @@ public class alltests extends DOMTestSuite { sink.addTest(domimplementationhasfeature02.class); sink.addTest(elementgetattributenodens01.class); sink.addTest(elementgetattributenodens02.class); - sink.addTest(elementgetattributenodens03.class); - sink.addTest(elementgetattributens02.class); +// sink.addTest(elementgetattributenodens03.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available +// sink.addTest(elementgetattributens02.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(elementgetelementsbytagnamens02.class); sink.addTest(elementgetelementsbytagnamens04.class); sink.addTest(elementgetelementsbytagnamens05.class); sink.addTest(elementhasattribute01.class); - sink.addTest(elementhasattribute02.class); +// sink.addTest(elementhasattribute02.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(elementhasattribute03.class); sink.addTest(elementhasattribute04.class); // sink.addTest(elementhasattributens01.class); @@ -155,14 +155,14 @@ public class alltests extends DOMTestSuite { sink.addTest(elementsetattributens05.class); sink.addTest(elementsetattributens08.class); sink.addTest(elementsetattributensurinull.class); - sink.addTest(getAttributeNS01.class); +// sink.addTest(getAttributeNS01.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(getAttributeNS02.class); sink.addTest(getAttributeNS03.class); sink.addTest(getAttributeNS04.class); sink.addTest(getAttributeNS05.class); sink.addTest(getAttributeNodeNS01.class); sink.addTest(getAttributeNodeNS02.class); - sink.addTest(getElementById01.class); +// sink.addTest(getElementById01.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(getElementById02.class); // sink.addTest(getElementsByTagNameNS01.class); sink.addTest(getElementsByTagNameNS02.class); @@ -183,13 +183,13 @@ public class alltests extends DOMTestSuite { // sink.addTest(getNamedItemNS03.class); // sink.addTest(getNamedItemNS04.class); sink.addTest(hasAttribute01.class); - sink.addTest(hasAttribute02.class); +// sink.addTest(hasAttribute02.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(hasAttribute03.class); - sink.addTest(hasAttribute04.class); +// sink.addTest(hasAttribute04.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(hasAttributeNS01.class); sink.addTest(hasAttributeNS02.class); sink.addTest(hasAttributeNS03.class); - sink.addTest(hasAttributeNS04.class); +// sink.addTest(hasAttributeNS04.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(hasAttributeNS05.class); sink.addTest(hasAttributes01.class); sink.addTest(hasAttributes02.class); @@ -206,7 +206,7 @@ public class alltests extends DOMTestSuite { sink.addTest(importNode04.class); // sink.addTest(importNode05.class); // sink.addTest(importNode06.class); - sink.addTest(importNode07.class); +// sink.addTest(importNode07.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(importNode08.class); // sink.addTest(importNode09.class); sink.addTest(importNode10.class); @@ -241,7 +241,7 @@ public class alltests extends DOMTestSuite { sink.addTest(namednodemapgetnameditemns05.class); sink.addTest(namednodemapgetnameditemns06.class); sink.addTest(namednodemapremovenameditemns01.class); - sink.addTest(namednodemapremovenameditemns02.class); +// sink.addTest(namednodemapremovenameditemns02.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(namednodemapremovenameditemns03.class); // sink.addTest(namednodemapremovenameditemns04.class); // sink.addTest(namednodemapremovenameditemns05.class); @@ -260,7 +260,7 @@ public class alltests extends DOMTestSuite { // sink.addTest(namednodemapsetnameditemns09.class); // sink.addTest(namednodemapsetnameditemns10.class); // sink.addTest(namednodemapsetnameditemns11.class); - sink.addTest(namespaceURI01.class); +// sink.addTest(namespaceURI01.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(namespaceURI02.class); sink.addTest(namespaceURI03.class); sink.addTest(namespaceURI04.class); @@ -282,7 +282,7 @@ public class alltests extends DOMTestSuite { sink.addTest(nodesetprefix01.class); sink.addTest(nodesetprefix02.class); sink.addTest(nodesetprefix03.class); - sink.addTest(nodesetprefix04.class); +// sink.addTest(nodesetprefix04.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(nodesetprefix05.class); sink.addTest(nodesetprefix06.class); sink.addTest(nodesetprefix07.class); @@ -305,7 +305,7 @@ public class alltests extends DOMTestSuite { sink.addTest(prefix11.class); sink.addTest(publicId01.class); // sink.addTest(removeAttributeNS01.class); - sink.addTest(removeAttributeNS02.class); +// sink.addTest(removeAttributeNS02.class); // javax.xml.parsers.ParserConfigurationException: No validating DocumentBuilder implementation available sink.addTest(removeNamedItemNS01.class); sink.addTest(removeNamedItemNS02.class); // sink.addTest(removeNamedItemNS03.class); |