summaryrefslogtreecommitdiffstats
path: root/xml/src/test
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:14 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:28:14 -0800
commit1c0fed63c71ddb230f3b304aac12caffbedf2f21 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /xml/src/test
parent2fb02ef3025449e24e756a7f645ea6eab7a1fd4f (diff)
downloadlibcore-1c0fed63c71ddb230f3b304aac12caffbedf2f21.zip
libcore-1c0fed63c71ddb230f3b304aac12caffbedf2f21.tar.gz
libcore-1c0fed63c71ddb230f3b304aac12caffbedf2f21.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'xml/src/test')
-rw-r--r--xml/src/test/java/org/apache/harmony/xml/ExpatParserTest.java839
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java48
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java1121
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java733
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java139
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java55
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java547
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java1171
-rw-r--r--xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java492
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/AllTests.java45
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/HandlerBaseTest.java226
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/InputSourceTest.java254
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/SAXExceptionTest.java131
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/SAXNotRecognizedExceptionTest.java55
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/SAXNotSupportedExceptionTest.java55
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/SAXParseExceptionTest.java276
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/ext/AllTests.java39
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java464
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/ext/DefaultHandler2Test.java234
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/ext/Locator2ImplTest.java153
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/AllTests.java45
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/AttributeListImplTest.java270
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/AttributesImplTest.java608
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/DefaultHandlerTest.java278
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/LocatorImplTest.java172
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/NamespaceSupportTest.java434
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/ParserAdapterTest.java468
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/ParserFactoryTest.java170
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/XMLFilterImplTest.java678
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderAdapterTest.java414
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderFactoryTest.java154
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/BrokenInputStream.java50
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/DoNothingParser.java55
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/DoNothingXMLReader.java79
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/MethodLogger.java95
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/MockFilter.java89
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/MockHandler.java147
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/MockParser.java68
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/MockReader.java128
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/MockResolver.java47
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/NoAccessParser.java55
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/NoAccessXMLReader.java79
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceParser.java58
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceXMLReader.java82
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassParser.java54
-rw-r--r--xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassXMLReader.java79
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/AllTests.java110
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java156
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java229
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/CreateDocument.java317
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java222
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java251
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DOMDocumentBuilderFactory.java94
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java177
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java208
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java147
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DOMTestCase.java230
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSetting.java281
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSettingStrategy.java158
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java313
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java169
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java150
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java72
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java699
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java76
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java97
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java95
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNS.java89
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java139
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java122
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java123
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java139
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java80
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java266
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java276
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java187
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java121
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/GetElementById.java102
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java381
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java135
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java102
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HCEntitiesSetNamedItemNS.java86
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java103
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java108
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java110
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java112
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HasAttribute.java119
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java172
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/HasAttributes.java111
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/ImportNode.java604
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/InternalSubset.java92
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/IsSupported.java272
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/LocalName.java132
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java229
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java342
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java451
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java153
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java107
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java111
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java128
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java108
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java171
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java216
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java209
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java314
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/Normalize.java106
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java88
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/OwnerElement.java118
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/Prefix.java337
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/PublicId.java91
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/RemoveAttributeNS.java147
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java178
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java353
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java237
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java248
-rw-r--r--xml/src/test/java/tests/org/w3c/dom/SystemId.java94
-rw-r--r--xml/src/test/java/tests/xml/AllTests.java38
-rw-r--r--xml/src/test/java/tests/xml/SimpleBuilderTest.java162
-rw-r--r--xml/src/test/java/tests/xml/SimpleParserTest.java289
-rw-r--r--xml/src/test/resources/SimpleBuilderTest.xml21
-rw-r--r--xml/src/test/resources/SimpleParserTest.xml19
-rw-r--r--xml/src/test/resources/hc_staff.xml60
-rw-r--r--xml/src/test/resources/nwf/staff.dtd17
-rw-r--r--xml/src/test/resources/nwf/staff.xml57
-rw-r--r--xml/src/test/resources/out_dh/staff.out45
-rw-r--r--xml/src/test/resources/out_hb/staff.out45
-rw-r--r--xml/src/test/resources/recipe.xml24
-rw-r--r--xml/src/test/resources/recipe1.xml24
-rw-r--r--xml/src/test/resources/recipt.dtd17
-rw-r--r--xml/src/test/resources/recipt.xml24
-rw-r--r--xml/src/test/resources/reciptWrong.xml21
-rw-r--r--xml/src/test/resources/simple.xml34
-rw-r--r--xml/src/test/resources/simple_ns.dtd45
-rw-r--r--xml/src/test/resources/simple_ns.xml59
-rw-r--r--xml/src/test/resources/staff.dtd17
-rw-r--r--xml/src/test/resources/staff.xml57
-rw-r--r--xml/src/test/resources/staff2.dtd24
-rw-r--r--xml/src/test/resources/staff2.xml13
-rw-r--r--xml/src/test/resources/staffEntRes.xml60
-rw-r--r--xml/src/test/resources/staffNS.dtd45
-rw-r--r--xml/src/test/resources/staffNS.xml59
-rw-r--r--xml/src/test/resources/systemid.xml24
-rw-r--r--xml/src/test/resources/systemid/recipt.dtd17
-rw-r--r--xml/src/test/resources/systemid/staff.dtd17
-rw-r--r--xml/src/test/resources/wf/staff.dtd17
-rw-r--r--xml/src/test/resources/wf/staff.xml57
-rw-r--r--xml/src/test/resources/wrong.xml1
-rw-r--r--xml/src/test/resources/xhtml1-strict.dtd65
148 files changed, 0 insertions, 26477 deletions
diff --git a/xml/src/test/java/org/apache/harmony/xml/ExpatParserTest.java b/xml/src/test/java/org/apache/harmony/xml/ExpatParserTest.java
deleted file mode 100644
index 480bca3..0000000
--- a/xml/src/test/java/org/apache/harmony/xml/ExpatParserTest.java
+++ /dev/null
@@ -1,839 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.xml;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import org.kxml2.io.KXmlParser;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.ext.DefaultHandler2;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class ExpatParserTest extends TestCase {
-
- private static final String SNIPPET = "<dagny dad=\"bob\">hello</dagny>";
-
- public void testExceptions() {
- // From startElement().
- ContentHandler contentHandler = new DefaultHandler() {
- @Override
- public void startElement(String uri, String localName,
- String qName, Attributes attributes)
- throws SAXException {
- throw new SAXException();
- }
- };
- try {
- parse(SNIPPET, contentHandler);
- fail();
- } catch (SAXException checked) { /* expected */ }
-
- // From endElement().
- contentHandler = new DefaultHandler() {
- @Override
- public void endElement(String uri, String localName,
- String qName)
- throws SAXException {
- throw new SAXException();
- }
- };
- try {
- parse(SNIPPET, contentHandler);
- fail();
- } catch (SAXException checked) { /* expected */ }
-
- // From characters().
- contentHandler = new DefaultHandler() {
- @Override
- public void characters(char ch[], int start, int length)
- throws SAXException {
- throw new SAXException();
- }
- };
- try {
- parse(SNIPPET, contentHandler);
- fail();
- } catch (SAXException checked) { /* expected */ }
- }
-
- public void testSax() {
- try {
- // Parse String.
- TestHandler handler = new TestHandler();
- parse(SNIPPET, handler);
- validate(handler);
-
- // Parse Reader.
- handler = new TestHandler();
- parse(new StringReader(SNIPPET), handler);
- validate(handler);
-
- // Parse InputStream.
- handler = new TestHandler();
- parse(new ByteArrayInputStream(SNIPPET.getBytes()),
- Encoding.UTF_8, handler);
- validate(handler);
- } catch (SAXException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- static void validate(TestHandler handler) {
- assertEquals("dagny", handler.startElementName);
- assertEquals("dagny", handler.endElementName);
- assertEquals("hello", handler.text.toString());
- }
-
- static class TestHandler extends DefaultHandler {
-
- String startElementName;
- String endElementName;
- StringBuilder text = new StringBuilder();
-
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
-
- assertNull(this.startElementName);
- this.startElementName = localName;
-
- // Validate attributes.
- assertEquals(1, attributes.getLength());
- assertEquals("", attributes.getURI(0));
- assertEquals("dad", attributes.getLocalName(0));
- assertEquals("bob", attributes.getValue(0));
- assertEquals(0, attributes.getIndex("", "dad"));
- assertEquals("bob", attributes.getValue("", "dad"));
- }
-
- @Override
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- assertNull(this.endElementName);
- this.endElementName = localName;
- }
-
- @Override
- public void characters(char ch[], int start, int length)
- throws SAXException {
- this.text.append(ch, start, length);
- }
- }
-
- public void testPullParser() {
- try {
- XmlPullParser parser = newPullParser();
-
- // Test reader.
- parser.setInput(new StringReader(SNIPPET));
- validate(parser);
-
- // Test input stream.
- parser.setInput(new ByteArrayInputStream(SNIPPET.getBytes()),
- "UTF-8");
- validate(parser);
- } catch (XmlPullParserException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- static void validate(XmlPullParser parser)
- throws XmlPullParserException, IOException {
- assertEquals(XmlPullParser.START_DOCUMENT, parser.getEventType());
-
- assertEquals(0, parser.getDepth());
-
- assertEquals(XmlPullParser.START_TAG, parser.next());
-
- assertEquals(1, parser.getDepth());
-
- assertEquals("dagny", parser.getName());
- assertEquals(1, parser.getAttributeCount());
- assertEquals("dad", parser.getAttributeName(0));
- assertEquals("bob", parser.getAttributeValue(0));
- assertEquals("bob", parser.getAttributeValue(null, "dad"));
-
- assertEquals(XmlPullParser.TEXT, parser.next());
-
- assertEquals(1, parser.getDepth());
-
- assertEquals("hello", parser.getText());
-
- assertEquals(XmlPullParser.END_TAG, parser.next());
-
- assertEquals(1, parser.getDepth());
-
- assertEquals("dagny", parser.getName());
-
- assertEquals(XmlPullParser.END_DOCUMENT, parser.next());
-
- assertEquals(0, parser.getDepth());
- }
-
- static final String XML =
- "<one xmlns='ns:default' xmlns:n1='ns:1' a='b'>\n"
- + " <n1:two c='d' n1:e='f' xmlns:n2='ns:2'>text</n1:two>\n"
- + "</one>";
-
- public void testExpatPullParserNamespaces() throws Exception {
- XmlPullParser pullParser = newPullParser();
- pullParser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
- pullParser.setInput(new StringReader(XML));
- testPullParserNamespaces(pullParser);
- }
-
- public void testKxmlPullParserNamespaces() throws Exception {
- XmlPullParser pullParser = new KXmlParser();
- pullParser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
- pullParser.setInput(new StringReader(XML));
- testPullParserNamespaces(pullParser);
- }
-
- private void testPullParserNamespaces(XmlPullParser parser) throws Exception {
- assertEquals(0, parser.getDepth());
- assertEquals(0, parser.getNamespaceCount(0));
-
- try {
- parser.getNamespaceCount(1);
- fail();
- } catch (IndexOutOfBoundsException e) { /* expected */ }
-
- // one
- assertEquals(XmlPullParser.START_TAG, parser.next());
- assertEquals(1, parser.getDepth());
-
- checkNamespacesInOne(parser);
-
- // n1:two
- assertEquals(XmlPullParser.START_TAG, parser.nextTag());
-
- assertEquals(2, parser.getDepth());
- checkNamespacesInTwo(parser);
-
- // Body of two.
- assertEquals(XmlPullParser.TEXT, parser.next());
-
- // End of two.
- assertEquals(XmlPullParser.END_TAG, parser.nextTag());
-
- // Depth should still be 2.
- assertEquals(2, parser.getDepth());
-
- // We should still be able to see the namespaces from two.
- checkNamespacesInTwo(parser);
-
- // End of one.
- assertEquals(XmlPullParser.END_TAG, parser.nextTag());
-
- // Depth should be back to 1.
- assertEquals(1, parser.getDepth());
-
- // We can still see the namespaces in one.
- checkNamespacesInOne(parser);
-
- // We shouldn't be able to see the namespaces in two anymore.
- try {
- parser.getNamespaceCount(2);
- fail();
- } catch (IndexOutOfBoundsException e) { /* expected */ }
-
- assertEquals(XmlPullParser.END_DOCUMENT, parser.next());
-
- // We shouldn't be able to see the namespaces in one anymore.
- try {
- parser.getNamespaceCount(1);
- fail();
- } catch (IndexOutOfBoundsException e) { /* expected */ }
-
- assertEquals(0, parser.getNamespaceCount(0));
- }
-
- private void checkNamespacesInOne(XmlPullParser parser) throws XmlPullParserException {
- assertEquals(2, parser.getNamespaceCount(1));
-
- // Prefix for default namespace is null.
- assertNull(parser.getNamespacePrefix(0));
- assertEquals("ns:default", parser.getNamespaceUri(0));
-
- assertEquals("n1", parser.getNamespacePrefix(1));
- assertEquals("ns:1", parser.getNamespaceUri(1));
-
- assertEquals("ns:default", parser.getNamespace(null));
-
- // KXML returns null.
- // assertEquals("ns:default", parser.getNamespace(""));
- }
-
- private void checkNamespacesInTwo(XmlPullParser parser) throws XmlPullParserException {
- // These should still be valid.
- checkNamespacesInOne(parser);
-
- assertEquals(3, parser.getNamespaceCount(2));
-
- // Default ns should still be in the stack
- assertNull(parser.getNamespacePrefix(0));
- assertEquals("ns:default", parser.getNamespaceUri(0));
- }
-
- public void testNamespaces() {
- try {
- NamespaceHandler handler = new NamespaceHandler();
- parse(XML, handler);
- handler.validate();
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- static class NamespaceHandler implements ContentHandler {
-
- Locator locator;
- boolean documentStarted;
- boolean documentEnded;
- Map<String, String> prefixMappings = new HashMap<String, String>();
-
- boolean oneStarted;
- boolean twoStarted;
- boolean oneEnded;
- boolean twoEnded;
-
- public void validate() {
- assertTrue(documentEnded);
- }
-
- public void setDocumentLocator(Locator locator) {
- this.locator = locator;
- }
-
- public void startDocument() throws SAXException {
- documentStarted = true;
- assertNotNull(locator);
- assertEquals(0, prefixMappings.size());
- assertFalse(documentEnded);
- }
-
- public void endDocument() throws SAXException {
- assertTrue(documentStarted);
- assertTrue(oneEnded);
- assertTrue(twoEnded);
- assertEquals(0, prefixMappings.size());
- documentEnded = true;
- }
-
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- prefixMappings.put(prefix, uri);
- }
-
- public void endPrefixMapping(String prefix) throws SAXException {
- assertNotNull(prefixMappings.remove(prefix));
- }
-
- public void startElement(String uri, String localName, String qName,
- Attributes atts) throws SAXException {
-
- if (localName == "one") {
- assertEquals(2, prefixMappings.size());
-
- assertEquals(1, locator.getLineNumber());
-
- assertFalse(oneStarted);
- assertFalse(twoStarted);
- assertFalse(oneEnded);
- assertFalse(twoEnded);
-
- oneStarted = true;
-
- assertSame("ns:default", uri);
- // TODO The result of the RI is "one"
- assertEquals("", qName);
-
- // Check atts.
- assertEquals(1, atts.getLength());
-
- assertSame("", atts.getURI(0));
- assertSame("a", atts.getLocalName(0));
- assertEquals("b", atts.getValue(0));
- assertEquals(0, atts.getIndex("", "a"));
- assertEquals("b", atts.getValue("", "a"));
-
- return;
- }
-
- if (localName == "two") {
- assertEquals(3, prefixMappings.size());
-
- assertTrue(oneStarted);
- assertFalse(twoStarted);
- assertFalse(oneEnded);
- assertFalse(twoEnded);
-
- twoStarted = true;
-
- assertSame("ns:1", uri);
- // TODO The result of the RI is "n1:two"
- Assert.assertEquals("", qName);
-
- // Check atts.
- assertEquals(2, atts.getLength());
-
- assertSame("", atts.getURI(0));
- assertSame("c", atts.getLocalName(0));
- assertEquals("d", atts.getValue(0));
- assertEquals(0, atts.getIndex("", "c"));
- assertEquals("d", atts.getValue("", "c"));
-
- assertSame("ns:1", atts.getURI(1));
- assertSame("e", atts.getLocalName(1));
- assertEquals("f", atts.getValue(1));
- assertEquals(1, atts.getIndex("ns:1", "e"));
- assertEquals("f", atts.getValue("ns:1", "e"));
-
- // We shouldn't find these.
- assertEquals(-1, atts.getIndex("ns:default", "e"));
- assertEquals(null, atts.getValue("ns:default", "e"));
-
- return;
- }
-
- fail();
- }
-
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- if (localName == "one") {
- assertEquals(3, locator.getLineNumber());
-
- assertTrue(oneStarted);
- assertTrue(twoStarted);
- assertTrue(twoEnded);
- assertFalse(oneEnded);
-
- oneEnded = true;
-
- assertSame("ns:default", uri);
- assertEquals("", qName);
-
- return;
- }
-
- if (localName == "two") {
- assertTrue(oneStarted);
- assertTrue(twoStarted);
- assertFalse(twoEnded);
- assertFalse(oneEnded);
-
- twoEnded = true;
-
- assertSame("ns:1", uri);
- assertEquals("", qName);
-
- return;
- }
-
- fail();
- }
-
- public void characters(char ch[], int start, int length)
- throws SAXException {
- String s = new String(ch, start, length).trim();
-
- if (!s.equals("")) {
- assertTrue(oneStarted);
- assertTrue(twoStarted);
- assertFalse(oneEnded);
- assertFalse(twoEnded);
- assertEquals("text", s);
- }
- }
-
- public void ignorableWhitespace(char ch[], int start, int length)
- throws SAXException {
- fail();
- }
-
- public void processingInstruction(String target, String data)
- throws SAXException {
- fail();
- }
-
- public void skippedEntity(String name) throws SAXException {
- fail();
- }
- }
-
- public void testDtd() throws Exception {
- Reader in = new StringReader(
- "<?xml version=\"1.0\"?><!DOCTYPE foo PUBLIC 'bar' 'tee'><a></a>");
- ExpatReader reader = new ExpatReader();
- TestDtdHandler handler = new TestDtdHandler();
- reader.setContentHandler(handler);
- reader.setLexicalHandler(handler);
- reader.parse(new InputSource(in));
-
- assertEquals("foo", handler.name);
- assertEquals("bar", handler.publicId);
- assertEquals("tee", handler.systemId);
-
- assertTrue(handler.ended);
- }
-
- static class TestDtdHandler extends DefaultHandler2 {
-
- String name;
- String publicId;
- String systemId;
-
- boolean ended;
-
- Locator locator;
-
- @Override
- public void startDTD(String name, String publicId, String systemId) {
- this.name = name;
- this.publicId = publicId;
- this.systemId = systemId;
- }
-
- @Override
- public void endDTD() {
- ended = true;
- }
-
- @Override
- public void setDocumentLocator(Locator locator) {
- this.locator = locator;
- }
- }
-
- public void testCdata() throws Exception {
- Reader in = new StringReader(
- "<a><![CDATA[<b></b>]]> <![CDATA[<c></c>]]></a>");
-
- ExpatReader reader = new ExpatReader();
- TestCdataHandler handler = new TestCdataHandler();
- reader.setContentHandler(handler);
- reader.setLexicalHandler(handler);
-
- reader.parse(new InputSource(in));
-
- assertEquals(2, handler.startCdata);
- assertEquals(2, handler.endCdata);
- assertEquals("<b></b> <c></c>", handler.buffer.toString());
- }
-
- static class TestCdataHandler extends DefaultHandler2 {
-
- int startCdata, endCdata;
- StringBuffer buffer = new StringBuffer();
-
- @Override
- public void characters(char ch[], int start, int length) {
- buffer.append(ch, start, length);
- }
-
- @Override
- public void startCDATA() throws SAXException {
- startCdata++;
- }
-
- @Override
- public void endCDATA() throws SAXException {
- endCdata++;
- }
- }
-
- public void testProcessingInstructions() throws IOException, SAXException {
- Reader in = new StringReader(
- "<?bob lee?><a></a>");
-
- ExpatReader reader = new ExpatReader();
- TestProcessingInstrutionHandler handler
- = new TestProcessingInstrutionHandler();
- reader.setContentHandler(handler);
-
- reader.parse(new InputSource(in));
-
- assertEquals("bob", handler.target);
- assertEquals("lee", handler.data);
- }
-
- static class TestProcessingInstrutionHandler extends DefaultHandler2 {
-
- String target;
- String data;
-
- @Override
- public void processingInstruction(String target, String data) {
- this.target = target;
- this.data = data;
- }
- }
-
- public void testExternalEntity() throws IOException, SAXException {
- class Handler extends DefaultHandler {
-
- List<String> elementNames = new ArrayList<String>();
- StringBuilder text = new StringBuilder();
-
- public InputSource resolveEntity(String publicId, String systemId)
- throws IOException, SAXException {
- if (publicId.equals("publicA") && systemId.equals("systemA")) {
- return new InputSource(new StringReader("<a/>"));
- } else if (publicId.equals("publicB")
- && systemId.equals("systemB")) {
- /*
- * Explicitly set the encoding here or else the parser will
- * try to use the parent parser's encoding which is utf-16.
- */
- InputSource inputSource = new InputSource(
- new ByteArrayInputStream("bob".getBytes("utf-8")));
- inputSource.setEncoding("utf-8");
- return inputSource;
- }
-
- throw new AssertionError();
- }
-
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
- elementNames.add(localName);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- elementNames.add("/" + localName);
- }
-
- @Override
- public void characters(char ch[], int start, int length)
- throws SAXException {
- text.append(ch, start, length);
- }
- }
-
- Reader in = new StringReader("<?xml version=\"1.0\"?>\n"
- + "<!DOCTYPE foo [\n"
- + " <!ENTITY a PUBLIC 'publicA' 'systemA'>\n"
- + " <!ENTITY b PUBLIC 'publicB' 'systemB'>\n"
- + "]>\n"
- + "<foo>\n"
- + " &a;<b>&b;</b></foo>");
-
- ExpatReader reader = new ExpatReader();
- Handler handler = new Handler();
- reader.setContentHandler(handler);
- reader.setEntityResolver(handler);
-
- reader.parse(new InputSource(in));
-
- assertEquals(Arrays.asList("foo", "a", "/a", "b", "/b", "/foo"),
- handler.elementNames);
- assertEquals("bob", handler.text.toString().trim());
- }
-
- public void testExternalEntityDownload() throws IOException, SAXException {
- class Server implements Runnable {
-
- private final ServerSocket serverSocket;
-
- Server() throws IOException {
- serverSocket = new ServerSocket(8080);
- }
-
- public void run() {
- try {
- Socket socket = serverSocket.accept();
-
- final InputStream in = socket.getInputStream();
- Thread inputThread = new Thread() {
- public void run() {
- try {
- byte[] buffer = new byte[1024];
- while (in.read(buffer) > -1) { /* ignore */ }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- };
- inputThread.setDaemon(true);
- inputThread.start();
-
- OutputStream out = socket.getOutputStream();
-
- String body = "<bar></bar>";
- String response = "HTTP/1.0 200 OK\n"
- + "Content-Length: " + body.length() + "\n"
- + "\n"
- + body;
-
- out.write(response.getBytes("UTF-8"));
- out.close();
- serverSocket.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- class Handler extends DefaultHandler {
-
- List<String> elementNames = new ArrayList<String>();
-
- public InputSource resolveEntity(String publicId, String systemId)
- throws IOException, SAXException {
- // The parser should have resolved the systemId.
- assertEquals("http://localhost:8080/systemBar", systemId);
- return new InputSource(systemId);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
- elementNames.add(localName);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- elementNames.add("/" + localName);
- }
- }
-
- // Start server to serve up the XML for 'systemBar'.
- Thread serverThread = new Thread(new Server());
- serverThread.setDaemon(true);
- serverThread.start();
-
- // 'systemBar', the external entity, is relative to 'systemFoo':
- Reader in = new StringReader("<?xml version=\"1.0\"?>\n"
- + "<!DOCTYPE foo [\n"
- + " <!ENTITY bar SYSTEM 'systemBar'>\n"
- + "]>\n"
- + "<foo>&bar;</foo>");
-
- ExpatReader reader = new ExpatReader();
-
- Handler handler = new Handler();
-
- reader.setContentHandler(handler);
- reader.setEntityResolver(handler);
-
- InputSource source = new InputSource(in);
- source.setSystemId("http://localhost:8080/systemFoo");
- reader.parse(source);
-
- assertEquals(Arrays.asList("foo", "bar", "/bar", "/foo"),
- handler.elementNames);
- }
-
- /**
- * Parses the given xml string and fires events on the given SAX handler.
- */
- private static void parse(String xml, ContentHandler contentHandler)
- throws SAXException {
- try {
- XMLReader reader = new ExpatReader();
- reader.setContentHandler(contentHandler);
- reader.parse(new InputSource(new StringReader(xml)));
- }
- catch (IOException e) {
- throw new AssertionError(e);
- }
- }
-
- /**
- * Parses xml from the given reader and fires events on the given SAX
- * handler.
- */
- private static void parse(Reader in, ContentHandler contentHandler)
- throws IOException, SAXException {
- XMLReader reader = new ExpatReader();
- reader.setContentHandler(contentHandler);
- reader.parse(new InputSource(in));
- }
-
- /**
- * Parses xml from the given input stream and fires events on the given SAX
- * handler.
- */
- private static void parse(InputStream in, Encoding encoding,
- ContentHandler contentHandler) throws IOException, SAXException {
- try {
- XMLReader reader = new ExpatReader();
- reader.setContentHandler(contentHandler);
- InputSource source = new InputSource(in);
- source.setEncoding(encoding.expatName);
- reader.parse(source);
- } catch (IOException e) {
- throw new AssertionError(e);
- }
- }
-
- /**
- * Supported character encodings.
- */
- private enum Encoding {
-
- US_ASCII("US-ASCII"),
- UTF_8("UTF-8"),
- UTF_16("UTF-16"),
- ISO_8859_1("ISO-8859-1");
-
- final String expatName;
-
- Encoding(String expatName) {
- this.expatName = expatName;
- }
- }
-
- /**
- * Creates a new pull parser with namespace support.
- */
- private static XmlPullParser newPullParser() {
- ExpatPullParser parser = new ExpatPullParser();
- parser.setNamespaceProcessingEnabled(true);
- return parser;
- }
-}
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java b/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java
deleted file mode 100644
index f0e8ebd..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.javax.xml.parsers;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.harmony.xml.ExpatParserTest;
-
-/**
- * This is autogenerated source file. Includes tests for package tests.api.javax.xml.parsers;
- */
-
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(AllTests.suite());
- }
-
- public static Test suite() {
- TestSuite suite = tests.TestSuiteFactory.createTestSuite("All tests for package tests.api.javax.xml.parsers;");
- // $JUnit-BEGIN$
-
- suite.addTestSuite(DocumentBuilderFactoryTest.class);
- suite.addTestSuite(DocumentBuilderTest.class);
- suite.addTestSuite(FactoryConfigurationErrorTest.class);
- suite.addTestSuite(ParserConfigurationExceptionTest.class);
- suite.addTestSuite(SAXParserFactoryTest.class);
- suite.addTestSuite(SAXParserTest.class);
- suite.addTestSuite(ExpatParserTest.class);
-
- // $JUnit-END$
- return suite;
- }
-}
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java
deleted file mode 100644
index 1e1ffdd..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java
+++ /dev/null
@@ -1,1121 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package tests.api.javax.xml.parsers;
-
-import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import junit.framework.TestCase;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import tests.api.javax.xml.parsers.SAXParserFactoryTest.MyHandler;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-
-@TestTargetClass(DocumentBuilderFactory.class)
-public class DocumentBuilderFactoryTest extends TestCase {
-
- DocumentBuilderFactory dbf;
-
- List<String> cdataElements;
-
- List<String> textElements;
-
- List<String> commentElements;
-
- protected void setUp() throws Exception {
- super.setUp();
- dbf = DocumentBuilderFactory.newInstance();
-
- cdataElements = new ArrayList<String>();
- textElements = new ArrayList<String>();
- commentElements = new ArrayList<String>();
- }
-
- protected void tearDown() throws Exception {
- dbf = null;
- cdataElements = null;
- textElements = null;
- commentElements = null;
- super.tearDown();
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#DocumentBuilderFactory().
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "DocumentBuilderFactory",
- args = {}
- )
- public void test_Constructor() {
- try {
- new DocumentBuilderFactoryChild();
- } catch (Exception e) {
- fail("Unexpected exception " + e.toString());
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#getAttribute(String).
- */
-// public void test_getAttributeLjava_lang_String() {
-// String[] attributes = {
-// "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
-// "http://java.sun.com/xml/jaxp/properties/schemaSource" };
-// Object[] values = { "http://www.w3.org/2001/XMLSchema", "source" };
-//
-// try {
-// for (int i = 0; i < attributes.length; i++) {
-// dbf.setAttribute(attributes[i], values[i]);
-// assertEquals(values[i], dbf.getAttribute(attributes[i]));
-// }
-// } catch (IllegalArgumentException e) {
-// fail("Unexpected IllegalArgumentException" + e.getMessage());
-// } catch (Exception e) {
-// fail("Unexpected exception" + e.getMessage());
-// }
-//
-// try {
-// for (int i = 0; i < attributes.length; i++) {
-// dbf.setAttribute(null, null);
-// fail("NullPointerException expected");
-// }
-// } catch (NullPointerException e) {
-// // expected
-// }
-//
-// String[] badAttributes = {"bad1", "bad2", ""};
-// try {
-// for (int i = 0; i < badAttributes.length; i++) {
-// dbf.getAttribute(badAttributes[i]);
-// fail("IllegalArgumentException expected");
-// }
-// } catch (IllegalArgumentException e) {
-// // expected
-// }
-// }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#getFeature(String).
- */
-// TODO Fails on JDK. Why?
-// public void test_getFeatureLjava_lang_String() {
-// String[] features = { "http://xml.org/sax/features/namespaces",
-// "http://xml.org/sax/features/validation",
-// "http://xml.org/sax/features/external-general-entities" };
-// try {
-// for (int i = 0; i < features.length; i++) {
-// dbf.setFeature(features[i], true);
-// assertTrue(dbf.getFeature(features[i]));
-// }
-// } catch (ParserConfigurationException e) {
-// fail("Unexpected ParserConfigurationException " + e.getMessage());
-// }
-//
-// try {
-// for (int i = 0; i < features.length; i++) {
-// dbf.setFeature(features[i], false);
-// assertFalse(dbf.getFeature(features[i]));
-// }
-// } catch (ParserConfigurationException e) {
-// fail("Unexpected ParserConfigurationException " + e.getMessage());
-// }
-//
-// try {
-// for (int i = 0; i < features.length; i++) {
-// dbf.setFeature(null, false);
-// fail("NullPointerException expected");
-// }
-// } catch (NullPointerException e) {
-// // expected
-// } catch (ParserConfigurationException e) {
-// fail("Unexpected ParserConfigurationException" + e.getMessage());
-// }
-//
-// String[] badFeatures = {"bad1", "bad2", ""};
-// try {
-// for (int i = 0; i < badFeatures.length; i++) {
-// dbf.getFeature(badFeatures[i]);
-// fail("ParserConfigurationException expected");
-// }
-// } catch (ParserConfigurationException e) {
-// // expected
-// }
-//
-// }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#getSchema().
- * TBD getSchemas() IS NOT SUPPORTED
- */
-/* public void test_getSchema() {
- assertNull(dbf.getSchema());
- SchemaFactory sf =
- SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- try {
- Schema schema = sf.newSchema();
- dbf.setSchema(schema);
- assertNotNull(dbf.getSchema());
- } catch (SAXException sax) {
- fail("Unexpected exception " + sax.toString());
- }
- }
- */
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#isCoalescing().
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isCoalescing",
- args = {}
- )
- public void test_isCoalescing() {
- dbf.setCoalescing(true);
- assertTrue(dbf.isCoalescing());
-
- dbf.setCoalescing(false);
- assertFalse(dbf.isCoalescing());
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#isExpandEntityReferences().
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isExpandEntityReferences",
- args = {}
- )
- public void test_isExpandEntityReferences() {
- dbf.setExpandEntityReferences(true);
- assertTrue(dbf.isExpandEntityReferences());
-
- dbf.setExpandEntityReferences(false);
- assertFalse(dbf.isExpandEntityReferences());
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#isIgnoringComments().
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isIgnoringComments",
- args = {}
- )
- public void test_isIgnoringComments() {
- dbf.setIgnoringComments(true);
- assertTrue(dbf.isIgnoringComments());
-
- dbf.setIgnoringComments(false);
- assertFalse(dbf.isIgnoringComments());
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#isIgnoringElementContentWhitespace().
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isIgnoringElementContentWhitespace",
- args = {}
- )
- public void test_isIgnoringElementContentWhitespace() {
- dbf.setIgnoringElementContentWhitespace(true);
- assertTrue(dbf.isIgnoringElementContentWhitespace());
-
- dbf.setIgnoringElementContentWhitespace(false);
- assertFalse(dbf.isIgnoringElementContentWhitespace());
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#isNamespaceAware().
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isNamespaceAware",
- args = {}
- )
- public void test_isNamespaceAware() {
- dbf.setNamespaceAware(true);
- assertTrue(dbf.isNamespaceAware());
-
- dbf.setNamespaceAware(false);
- assertFalse(dbf.isNamespaceAware());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isValidating",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "",
- method = "setValidating",
- args = {boolean.class}
- )
- })
- public void test_setIsValidating() {
- dbf.setValidating(true);
- assertTrue(dbf.isValidating());
-
- dbf.setValidating(false);
- assertFalse(dbf.isValidating());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isXIncludeAware",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "",
- method = "setXIncludeAware",
- args = {boolean.class}
- )
- })
- @KnownFailure("Should handle XIncludeAware flag more gracefully")
- public void test_isSetXIncludeAware() {
- dbf.setXIncludeAware(true);
- assertTrue(dbf.isXIncludeAware());
-
- dbf.setXIncludeAware(false);
- assertFalse(dbf.isXIncludeAware());
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#newInstance().
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "newInstance",
- args = {}
- )
- public void test_newInstance() {
- String className = null;
- try {
- // case 1: Try to obtain a new instance of factory by default.
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- assertNotNull(dbf);
-
- // case 2: Try to create a new instance of factory using
- // property DATATYPEFACTORY_PROPERTY
- className = System.getProperty("javax.xml.parsers.DocumentBuilderFactory");
- System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
- "org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl");
-
- dbf = DocumentBuilderFactory.newInstance();
- assertNotNull(dbf);
- assertTrue(dbf instanceof org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl);
-
- // case 3: Try to create a new instance of factory using Property
- String keyValuePair = "javax.xml.parsers.DocumentBuilderFactory"
- + "=" + "org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl";
- ByteArrayInputStream bis = new ByteArrayInputStream(keyValuePair
- .getBytes());
- Properties prop = System.getProperties();
- prop.load(bis);
- dbf = DocumentBuilderFactory.newInstance();
- assertNotNull(dbf);
- assertTrue(dbf instanceof org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl);
-
- // case 4: Check FactoryConfiguration error
- System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "");
- try {
- DocumentBuilderFactory.newInstance();
- } catch (FactoryConfigurationError fce) {
- // expected
- }
-
- } catch (Exception e) {
- fail("Unexpected exception " + e.toString());
- } finally {
- // Set default value of Datatype factory,
- // because of this test modifies it.
- if (className == null) {
- System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
- } else {
- System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
- className);
- }
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "SAXException untested; unused on Android",
- method = "newDocumentBuilder",
- args = {}
- )
- public void test_newDocumentBuilder() {
- // Ordinary case
- try {
- DocumentBuilder db = dbf.newDocumentBuilder();
- assertTrue(db instanceof DocumentBuilder);
- db.parse(getClass().getResourceAsStream("/simple.xml"));
- } catch(Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Exception case
- dbf.setValidating(true);
- try {
- DocumentBuilder db = dbf.newDocumentBuilder();
- } catch(ParserConfigurationException e) {
- // Expected, since Android doesn't have a validating parser.
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setAttribute(java.lang.String,
- * java.lang.Object).
- */
-// public void test_setAttributeLjava_lang_StringLjava_lang_Object() {
-// String[] attributes = {
-// "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
-// "http://java.sun.com/xml/jaxp/properties/schemaSource" };
-// Object[] values = { "http://www.w3.org/2001/XMLSchema", "source" };
-//
-// try {
-// for (int i = 0; i < attributes.length; i++) {
-// dbf.setAttribute(attributes[i], values[i]);
-// assertEquals(values[i], dbf.getAttribute(attributes[i]));
-// }
-// } catch (IllegalArgumentException e) {
-// fail("Unexpected IllegalArgumentException" + e.getMessage());
-// } catch (Exception e) {
-// fail("Unexpected exception" + e.getMessage());
-// }
-//
-// String[] badAttributes = {"bad1", "bad2", ""};
-// try {
-// for (int i = 0; i < badAttributes.length; i++) {
-// dbf.setAttribute(badAttributes[i], "");
-// fail("IllegalArgumentException expected");
-// }
-// } catch (IllegalArgumentException iae) {
-// // expected
-// }
-//
-// try {
-// for (int i = 0; i < attributes.length; i++) {
-// dbf.setAttribute(null, null);
-// fail("NullPointerException expected");
-// }
-// } catch (NullPointerException e) {
-// // expected
-// }
-// }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setCoalescing(boolean).
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setCoalescing",
- args = {boolean.class}
- )
- @KnownFailure("Should support coalescing")
- public void test_setCoalescingZ() {
- dbf.setCoalescing(true);
- assertTrue(dbf.isCoalescing());
-
- textElements.clear();
- cdataElements.clear();
- Exception parseException = null;
- DocumentBuilder parser = null;
-
- try {
- parser = dbf.newDocumentBuilder();
- ValidationErrorHandler errorHandler = new ValidationErrorHandler();
- parser.setErrorHandler(errorHandler);
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- parseException = errorHandler.getFirstException();
-
- goThroughDocument((Node) document, "");
- assertTrue(textElements
- .contains("BeefParmesan<title>withGarlicAngelHairPasta</title>"));
- } catch (Exception ex) {
- parseException = ex;
- }
- parser.setErrorHandler(null);
-
- if (parseException != null) {
- fail("Unexpected exception " + parseException.getMessage());
- }
-
- dbf.setCoalescing(false);
- assertFalse(dbf.isCoalescing());
-
- textElements.clear();
- cdataElements.clear();
-
- try {
- parser = dbf.newDocumentBuilder();
- ValidationErrorHandler errorHandler = new ValidationErrorHandler();
- parser.setErrorHandler(errorHandler);
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- parseException = errorHandler.getFirstException();
-
- goThroughDocument((Node) document, "");
-
- assertFalse(textElements
- .contains("BeefParmesan<title>withGarlicAngelHairPasta</title>"));
-
- } catch (Exception ex) {
- parseException = ex;
- }
- parser.setErrorHandler(null);
-
- if (parseException != null) {
- fail("Unexpected exception " + parseException.getMessage());
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setExpandEntityReferences(boolean).
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setExpandEntityReferences",
- args = {boolean.class}
- )
- public void test_setExpandEntityReferencesZ() {
- dbf.setExpandEntityReferences(true);
- assertTrue(dbf.isExpandEntityReferences());
-
- Exception parseException = null;
- DocumentBuilder parser = null;
-
- try {
- parser = dbf.newDocumentBuilder();
- ValidationErrorHandler errorHandler = new ValidationErrorHandler();
- parser.setErrorHandler(errorHandler);
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- parseException = errorHandler.getFirstException();
-
- assertNotNull(document);
-
- } catch (Exception ex) {
- parseException = ex;
- }
- parser.setErrorHandler(null);
-
- if (parseException != null) {
- fail("Unexpected exception " + parseException.getMessage());
- }
-
- dbf.setExpandEntityReferences(false);
- assertFalse(dbf.isExpandEntityReferences());
- try {
- parser = dbf.newDocumentBuilder();
- ValidationErrorHandler errorHandler = new ValidationErrorHandler();
- parser.setErrorHandler(errorHandler);
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- parseException = errorHandler.getFirstException();
-
- assertNotNull(document);
-
- } catch (Exception ex) {
- parseException = ex;
- }
- parser.setErrorHandler(null);
-
- if (parseException != null) {
- fail("Unexpected exception " + parseException.getMessage());
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setFeature(java.lang.String).
- */
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getFeature",
- args = {java.lang.String.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setFeature",
- args = {java.lang.String.class, boolean.class}
- )
- })
- public void test_getSetFeatureLjava_lang_String() {
- String[] features = { "http://xml.org/sax/features/namespaces",
- "http://xml.org/sax/features/validation" };
- try {
- for (int i = 0; i < features.length; i++) {
- dbf.setFeature(features[i], true);
- assertTrue(dbf.getFeature(features[i]));
- }
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException" + e.getMessage());
- }
-
- try {
- for (int i = 0; i < features.length; i++) {
- dbf.setFeature(features[i], false);
- assertFalse(dbf.getFeature(features[i]));
- }
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException" + e.getMessage());
- }
-
- try {
- for (int i = 0; i < features.length; i++) {
- dbf.setFeature(null, false);
- fail("NullPointerException expected");
- }
- } catch (NullPointerException e) {
- // expected
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException" + e.getMessage());
- }
-
- String[] badFeatures = { "bad1", "bad2", "" };
- try {
- for (int i = 0; i < badFeatures.length; i++) {
- dbf.setFeature(badFeatures[i], false);
- fail("ParserConfigurationException expected");
- }
- } catch (ParserConfigurationException e) {
- // expected
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setIgnoringComments(boolean).
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setIgnoringComments",
- args = {boolean.class}
- )
- public void test_setIgnoringCommentsZ() {
- commentElements.clear();
-
- dbf.setIgnoringComments(true);
- assertTrue(dbf.isIgnoringComments());
-
- try {
- DocumentBuilder parser = dbf.newDocumentBuilder();
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- goThroughDocument((Node) document, "");
- assertFalse(commentElements.contains("comment1"));
- assertFalse(commentElements.contains("comment2"));
-
- } catch (IOException e) {
- fail("Unexpected IOException " + e.getMessage());
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException " + e.getMessage());
- } catch (SAXException e) {
- fail("Unexpected SAXException " + e.getMessage());
- }
-
- commentElements.clear();
-
- dbf.setIgnoringComments(false);
- assertFalse(dbf.isIgnoringComments());
-
- try {
- DocumentBuilder parser = dbf.newDocumentBuilder();
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- goThroughDocument((Node) document, "");
- assertTrue(commentElements.contains("comment1"));
- assertTrue(commentElements.contains("comment2"));
-
- } catch (IOException e) {
- fail("Unexpected IOException " + e.getMessage());
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException " + e.getMessage());
- } catch (SAXException e) {
- fail("Unexpected SAXException " + e.getMessage());
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setIgnoringElementContentWhitespace(boolean).
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setIgnoringElementContentWhitespace",
- args = {boolean.class}
- )
- public void test_setIgnoringElementContentWhitespaceZ() {
- dbf.setIgnoringElementContentWhitespace(true);
- assertTrue(dbf.isIgnoringElementContentWhitespace());
-
- try {
- DocumentBuilder parser = dbf.newDocumentBuilder();
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- assertNotNull(document);
-
- } catch (IOException e) {
- fail("Unexpected IOException " + e.getMessage());
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException " + e.getMessage());
- } catch (SAXException e) {
- fail("Unexpected SAXException " + e.getMessage());
- }
-
- dbf.setIgnoringElementContentWhitespace(false);
- assertFalse(dbf.isIgnoringElementContentWhitespace());
-
- try {
- DocumentBuilder parser = dbf.newDocumentBuilder();
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- assertNotNull(document);
-
- } catch (IOException e) {
- fail("Unexpected IOException " + e.getMessage());
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException " + e.getMessage());
- } catch (SAXException e) {
- fail("Unexpected SAXException " + e.getMessage());
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setNamespaceAware(boolean).
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setNamespaceAware",
- args = {boolean.class}
- )
- public void test_setNamespaceAwareZ() {
- dbf.setNamespaceAware(true);
- assertTrue(dbf.isNamespaceAware());
-
- try {
- DocumentBuilder parser = dbf.newDocumentBuilder();
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- assertNotNull(document);
-
- } catch (IOException e) {
- fail("Unexpected IOException " + e.getMessage());
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException " + e.getMessage());
- } catch (SAXException e) {
- fail("Unexpected SAXException " + e.getMessage());
- }
-
- dbf.setNamespaceAware(false);
- assertFalse(dbf.isNamespaceAware());
-
- try {
- DocumentBuilder parser = dbf.newDocumentBuilder();
-
- Document document = parser.parse(getClass().getResourceAsStream(
- "/recipt.xml"));
-
- assertNotNull(document);
-
- } catch (IOException e) {
- fail("Unexpected IOException " + e.getMessage());
- } catch (ParserConfigurationException e) {
- fail("Unexpected ParserConfigurationException " + e.getMessage());
- } catch (SAXException e) {
- fail("Unexpected SAXException " + e.getMessage());
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getAttribute",
- args = {java.lang.String.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setAttribute",
- args = {java.lang.String.class, Object.class}
- )
- })
- public void test_getSetAttribute() {
- // Android SAX implementation doesn't support attributes, so
- // we can only make sure the expected exception is thrown.
- try {
- dbf.setAttribute("foo", new Object());
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException e) {
- // Expected
- }
-
- try {
- dbf.getAttribute("foo");
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setSchema(javax.xml.validation.Schema).
- */
- /* public void test_setSchemaLjavax_xml_validation_Schema() {
- SchemaFactory sf =
- SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- try {
- Schema schema = sf.newSchema();
- dbf.setSchema(schema);
- assertNotNull(dbf.getSchema());
- } catch (SAXException sax) {
- fail("Unexpected exception " + sax.toString());
- }
- }
-*/
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setValidating(boolean).
- */
-// public void test_setValidatingZ() {
-// Exception parseException = null;
-// DocumentBuilder parser = null;
-// Document document = null;
-//
-// ValidationErrorHandler errorHandler = new ValidationErrorHandler();
-//
-// dbf.setValidating(false);
-// assertFalse(dbf.isValidating());
-//
-// // case 1: Validation is not set. Correct xml-file
-// try {
-//
-// parser = dbf.newDocumentBuilder();
-// parser.setErrorHandler(errorHandler);
-//
-// document = parser.parse(getClass().getResourceAsStream(
-// "/recipt.xml"));
-//
-// parseException = errorHandler.getFirstException();
-//
-// assertNotNull(document);
-//
-// document = parser.parse(getClass().getResourceAsStream(
-// "/reciptWrong.xml"));
-//
-// parseException = errorHandler.getFirstException();
-//
-// assertNotNull(document);
-//
-// } catch (Exception ex) {
-// parseException = ex;
-// }
-// parser.setErrorHandler(null);
-//
-// if (parseException != null) {
-// fail("Unexpected exception " + parseException.getMessage());
-// }
-//
-// // case 2: Validation is not set. Wrong xml-file
-// try {
-//
-// parser = dbf.newDocumentBuilder();
-// parser.setErrorHandler(errorHandler);
-//
-// document = parser.parse(getClass().getResourceAsStream(
-// "/reciptWrong.xml"));
-// parseException = errorHandler.getFirstException();
-//
-// assertNotNull(document);
-//
-// } catch (Exception ex) {
-// parseException = ex;
-// }
-// parser.setErrorHandler(null);
-//
-// if (parseException != null) {
-// fail("Unexpected exception " + parseException.getMessage());
-// }
-//
-// // case 3: Validation is set. Correct xml-file
-// dbf.setValidating(true);
-// assertTrue(dbf.isValidating());
-//
-// try {
-//
-// parser = dbf.newDocumentBuilder();
-// parser.setErrorHandler(errorHandler);
-//
-// document = parser.parse(getClass().getResourceAsStream(
-// "/recipt.xml"));
-// parseException = errorHandler.getFirstException();
-//
-// assertNotNull(document);
-//
-// } catch (Exception ex) {
-// parseException = ex;
-// }
-// parser.setErrorHandler(null);
-//
-// if (parseException != null) {
-// fail("Unexpected exception " + parseException.getMessage());
-// }
-//
-// // case 4: Validation is set. Wrong xml-file
-// try {
-//
-// parser = dbf.newDocumentBuilder();
-// parser.setErrorHandler(errorHandler);
-//
-// document = parser.parse(getClass().getResourceAsStream(
-// "/reciptWrong.xml"));
-// parseException = errorHandler.getFirstException();
-//
-// assertNotNull(document);
-//
-// } catch (Exception ex) {
-// parseException = ex;
-// }
-// parser.setErrorHandler(null);
-//
-// if (parseException == null) {
-// fail("Unexpected exception " + parseException.getMessage());
-// } else {
-// assertTrue(parseException
-// .getMessage()
-// .contains(
-// "The content of element type \"collection\" must match \"(description,recipe+)\""));
-// }
-//
-// }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilderFactory#setXIncludeAware().
- */
-// public void test_setXIncludeAware() {
-// dbf.setXIncludeAware(true);
-// assertTrue(dbf.isXIncludeAware());
-//
-// try {
-// DocumentBuilder parser = dbf.newDocumentBuilder();
-//
-// Document document = parser.parse(getClass().getResourceAsStream(
-// "/recipt.xml"));
-//
-// assertNotNull(document);
-//
-// } catch (IOException e) {
-// fail("Unexpected IOException " + e.getMessage());
-// } catch (ParserConfigurationException e) {
-// fail("Unexpected ParserConfigurationException " + e.getMessage());
-// } catch (SAXException e) {
-// fail("Unexpected SAXException " + e.getMessage());
-// }
-//
-// dbf.setXIncludeAware(false);
-// assertFalse(dbf.isXIncludeAware());
-//
-// try {
-// DocumentBuilder parser = dbf.newDocumentBuilder();
-//
-// Document document = parser.parse(getClass().getResourceAsStream(
-// "/recipt.xml"));
-//
-// assertNotNull(document);
-//
-// } catch (IOException e) {
-// fail("Unexpected IOException " + e.getMessage());
-// } catch (ParserConfigurationException e) {
-// fail("Unexpected ParserConfigurationException " + e.getMessage());
-// } catch (SAXException e) {
-// fail("Unexpected SAXException " + e.getMessage());
-// }
-// }
-
- private void goThroughDocument(Node node, String indent) {
- String value = node.getNodeValue();
-
- if (value != null) {
- value = value.replaceAll(" ", "");
- value = value.replaceAll("\n", "");
- }
-
- switch (node.getNodeType()) {
- case Node.CDATA_SECTION_NODE:
- cdataElements.add(value);
- // System.out.println(indent + "CDATA_SECTION_NODE " + value);
- break;
- case Node.COMMENT_NODE:
- commentElements.add(value);
- // System.out.println(indent + "COMMENT_NODE " + value);
- break;
- case Node.DOCUMENT_FRAGMENT_NODE:
- // System.out.println(indent + "DOCUMENT_FRAGMENT_NODE " + value);
- break;
- case Node.DOCUMENT_NODE:
- // System.out.println(indent + "DOCUMENT_NODE " + value);
- break;
- case Node.DOCUMENT_TYPE_NODE:
- // System.out.println(indent + "DOCUMENT_TYPE_NODE " + value);
- break;
- case Node.ELEMENT_NODE:
- // System.out.println(indent + "ELEMENT_NODE " + value);
- break;
- case Node.ENTITY_NODE:
- // System.out.println(indent + "ENTITY_NODE " + value);
- break;
- case Node.ENTITY_REFERENCE_NODE:
- // System.out.println(indent + "ENTITY_REFERENCE_NODE " + value);
- break;
- case Node.NOTATION_NODE:
- // System.out.println(indent + "NOTATION_NODE " + value);
- break;
- case Node.PROCESSING_INSTRUCTION_NODE:
- // System.out.println(indent + "PROCESSING_INSTRUCTION_NODE " +
- // value);
- break;
- case Node.TEXT_NODE:
- textElements.add(value);
- // System.out.println(indent + "TEXT_NODE " + value);
- break;
- default:
- // System.out.println(indent + "Unknown node " + value);
- break;
- }
- NodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++)
- goThroughDocument(list.item(i), indent + " ");
- }
-
- private class ValidationErrorHandler implements ErrorHandler {
- private SAXException parseException;
-
- private int errorCount;
-
- private int warningCount;
-
- public ValidationErrorHandler() {
- parseException = null;
- errorCount = 0;
- warningCount = 0;
- }
-
- public void error(SAXParseException ex) {
- errorCount++;
- if (parseException == null) {
- parseException = ex;
- }
- }
-
- public void warning(SAXParseException ex) {
- warningCount++;
- }
-
- public void fatalError(SAXParseException ex) {
- if (parseException == null) {
- parseException = ex;
- }
- }
-
- public SAXException getFirstException() {
- return parseException;
- }
- }
-
- private class DocumentBuilderFactoryChild extends DocumentBuilderFactory {
- public DocumentBuilderFactoryChild() {
- super();
- }
-
- public Object getAttribute(String name) {
- return null;
- }
-
- public boolean getFeature(String name) {
- return false;
- }
-
- public DocumentBuilder newDocumentBuilder() {
- return null;
- }
-
- public void setAttribute(String name, Object value) {
- }
-
- public void setFeature(String name, boolean value) {
- }
-
- }
-}
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java
deleted file mode 100644
index 181e8f5..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.javax.xml.parsers;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import junit.framework.TestCase;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.Text;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import tests.api.org.xml.sax.support.MethodLogger;
-import tests.api.org.xml.sax.support.MockHandler;
-import tests.api.org.xml.sax.support.MockResolver;
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(DocumentBuilder.class)
-public class DocumentBuilderTest extends TestCase {
-
- private class MockDocumentBuilder extends DocumentBuilder {
-
- public MockDocumentBuilder() {
- super();
- }
-
- /*
- * @see javax.xml.parsers.DocumentBuilder#getDOMImplementation()
- */
- @Override
- public DOMImplementation getDOMImplementation() {
- // it is a fake
- return null;
- }
-
- /*
- * @see javax.xml.parsers.DocumentBuilder#isNamespaceAware()
- */
- @Override
- public boolean isNamespaceAware() {
- // it is a fake
- return false;
- }
-
- /*
- * @see javax.xml.parsers.DocumentBuilder#isValidating()
- */
- @Override
- public boolean isValidating() {
- // it is a fake
- return false;
- }
-
- /*
- * @see javax.xml.parsers.DocumentBuilder#newDocument()
- */
- @Override
- public Document newDocument() {
- // it is a fake
- return null;
- }
-
- /*
- * @see javax.xml.parsers.DocumentBuilder#parse(org.xml.sax.InputSource)
- */
- @Override
- public Document parse(InputSource is) throws SAXException, IOException {
- // it is a fake
- return null;
- }
-
- /*
- * @see javax.xml.parsers.DocumentBuilder#setEntityResolver(
- * org.xml.sax.EntityResolver)
- */
- @Override
- public void setEntityResolver(EntityResolver er) {
- // it is a fake
- }
-
- /*
- * @see javax.xml.parsers.DocumentBuilder#setErrorHandler(
- * org.xml.sax.ErrorHandler)
- */
- @Override
- public void setErrorHandler(ErrorHandler eh) {
- // it is a fake
- }
-
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- }
-
- DocumentBuilderFactory dbf;
-
- DocumentBuilder db;
-
- protected void setUp() throws Exception {
- dbf = DocumentBuilderFactory.newInstance();
-
- dbf.setIgnoringElementContentWhitespace(true);
-
- db = dbf.newDocumentBuilder();
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "DocumentBuilder",
- args = {}
- )
- public void testDocumentBuilder() {
- try {
- new MockDocumentBuilder();
- } catch (Exception e) {
- fail("unexpected exception " + e.toString());
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilder#getSchema()
- * TBD getSchema() is not supported
- */
- /* public void test_getSchema() {
- assertNull(db.getSchema());
- SchemaFactory sf =
- SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- try {
- Schema schema = sf.newSchema();
- dbf.setSchema(schema);
- assertNotNull(dbf.newDocumentBuilder().getSchema());
- } catch (ParserConfigurationException pce) {
- fail("Unexpected ParserConfigurationException " + pce.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "newDocument",
- args = { }
- )
- public void testNewDocument() {
- Document d;
-
- try {
- d = dbf.newDocumentBuilder().newDocument();
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertNotNull(d);
- assertNull(d.getDoctype());
- assertNull(d.getDocumentElement());
- assertNull(d.getNamespaceURI());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getDOMImplementation",
- args = { }
- )
- public void testGetImplementation() {
- DOMImplementation d;
-
- try {
- d = dbf.newDocumentBuilder().getDOMImplementation();
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertNotNull(d);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isNamespaceAware",
- args = {}
- )
- public void testIsNamespaceAware() {
- try {
- dbf.setNamespaceAware(true);
- assertTrue(dbf.newDocumentBuilder().isNamespaceAware());
- dbf.setNamespaceAware(false);
- assertFalse(dbf.newDocumentBuilder().isNamespaceAware());
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "No validating parser in Android, hence not tested",
- method = "isValidating",
- args = {}
- )
- public void testIsValidating() {
- try {
- dbf.setValidating(false);
- assertFalse(dbf.newDocumentBuilder().isValidating());
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "No XInclude-aware parser in Android, hence not tested",
- method = "isXIncludeAware",
- args = {}
- )
- @KnownFailure("Should handle XIncludeAware flag more gracefully")
- public void testIsXIncludeAware() {
- try {
- dbf.setXIncludeAware(false);
- assertFalse(dbf.newDocumentBuilder().isXIncludeAware());
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilder#parse(java.io.File)
- * Case 1: Try to parse correct xml document.
- * Case 2: Try to call parse() with null argument.
- * Case 3: Try to parse a non-existent file.
- * Case 4: Try to parse incorrect xml file.
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "parse",
- args = {java.io.File.class}
- )
- @BrokenTest("Need to use XML file from correct location")
- public void test_parseLjava_io_File() {
- File f = new File("/tmp/xml_source/simple.xml");
- // case 1: Trivial use.
- try {
- Document d = db.parse(f);
- assertNotNull(d);
- // TBD getXmlEncoding() IS NOT SUPPORTED
- // assertEquals("ISO-8859-1", d.getXmlEncoding());
- assertEquals(2, d.getChildNodes().getLength());
- assertEquals("#comment",
- d.getChildNodes().item(0).getNodeName());
- assertEquals("breakfast_menu",
- d.getChildNodes().item(1).getNodeName());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 2: Try to call parse with null argument
- try {
- db.parse((File)null);
- fail("Expected IllegalArgumentException was not thrown");
- } catch (IllegalArgumentException iae) {
- // expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 3: Try to parse a non-existent file
- try {
- db.parse(new File("_"));
- fail("Expected IOException was not thrown");
- } catch (IOException ioe) {
- // expected
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 4: Try to parse incorrect xml file
- try {
- f = new File("/tmp/xml_source/wrong.xml");
- db.parse(f);
- fail("Expected SAXException was not thrown");
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- // expected
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream)
- * Case 1: Try to parse correct xml document.
- * Case 2: Try to call parse() with null argument.
- * Case 3: Try to parse a non-existent file.
- * Case 4: Try to parse incorrect xml file.
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "parse",
- args = {java.io.InputStream.class}
- )
- public void test_parseLjava_io_InputStream() {
- InputStream is = getClass().getResourceAsStream("/simple.xml");
- // case 1: Trivial use.
- try {
- Document d = db.parse(is);
- assertNotNull(d);
- // TBD getXmlEncoding() IS NOT SUPPORTED
- // assertEquals("ISO-8859-1", d.getXmlEncoding());
- assertEquals(2, d.getChildNodes().getLength());
- assertEquals("#comment",
- d.getChildNodes().item(0).getNodeName());
- assertEquals("breakfast_menu",
- d.getChildNodes().item(1).getNodeName());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 2: Try to call parse with null argument
- try {
- db.parse((InputStream)null);
- fail("Expected IllegalArgumentException was not thrown");
- } catch (IllegalArgumentException iae) {
- // expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 3: Try to parse a non-existent file
- try {
- db.parse(new FileInputStream("_"));
- fail("Expected IOException was not thrown");
- } catch (IOException ioe) {
- // expected
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 4: Try to parse incorrect xml file
- try {
- is = getClass().getResourceAsStream("/wrong.xml");
- db.parse(is);
- fail("Expected SAXException was not thrown");
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- // expected
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream)
- * Case 1: Try to parse correct xml document.
- * Case 2: Try to call parse() with null argument.
- * Case 3: Try to parse a non-existent file.
- * Case 4: Try to parse incorrect xml file.
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "parse",
- args = { InputSource.class }
- )
- public void testParseInputSource() {
- InputStream stream = getClass().getResourceAsStream("/simple.xml");
- InputSource is = new InputSource(stream);
-
- // case 1: Trivial use.
- try {
- Document d = db.parse(is);
- assertNotNull(d);
- // TBD getXmlEncoding() IS NOT SUPPORTED
- // assertEquals("ISO-8859-1", d.getXmlEncoding());
- assertEquals(2, d.getChildNodes().getLength());
- assertEquals("#comment",
- d.getChildNodes().item(0).getNodeName());
- assertEquals("breakfast_menu",
- d.getChildNodes().item(1).getNodeName());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 2: Try to call parse with null argument
- try {
- db.parse((InputSource)null);
- fail("Expected IllegalArgumentException was not thrown");
- } catch (IllegalArgumentException iae) {
- // expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 3: Try to parse a non-existent file
- try {
- db.parse(new InputSource(new FileInputStream("_")));
- fail("Expected IOException was not thrown");
- } catch (IOException ioe) {
- // expected
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 4: Try to parse incorrect xml file
- try {
- is = new InputSource(getClass().getResourceAsStream("/wrong.xml"));
- db.parse(is);
- fail("Expected SAXException was not thrown");
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- // expected
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream,
- * java.lang.String)
- * Case 1: Try to parse correct xml document.
- * Case 2: Try to call parse() with null argument.
- * Case 3: Try to parse a non-existent file.
- * Case 4: Try to parse incorrect xml file.
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "parse",
- args = {java.io.InputStream.class, java.lang.String.class}
- )
- public void test_parseLjava_io_InputStreamLjava_lang_String() {
- InputStream is = getClass().getResourceAsStream("/systemid.xml");
- // case 1: Trivial use.
- try {
- Document d = db.parse(is, SAXParserTestSupport.XML_SYSTEM_ID);
- assertNotNull(d);
-// TBD getXmlEncoding() is not supported
-// assertEquals("UTF-8", d.getXmlEncoding());
- assertEquals(4, d.getChildNodes().getLength());
- assertEquals("collection",
- d.getChildNodes().item(0).getNodeName());
- assertEquals("#comment",
- d.getChildNodes().item(1).getNodeName());
- assertEquals("collection",
- d.getChildNodes().item(2).getNodeName());
- assertEquals("#comment",
- d.getChildNodes().item(3).getNodeName());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 2: Try to call parse with null argument
- try {
- db.parse((InputStream)null, SAXParserTestSupport.XML_SYSTEM_ID);
- fail("Expected IllegalArgumentException was not thrown");
- } catch (IllegalArgumentException iae) {
- // expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 3: Try to parse a non-existent file
-// Doesn't make sense this way...
-// try {
-// db.parse(is, "/");
-// fail("Expected IOException was not thrown");
-// } catch (IOException ioe) {
-// // expected
-// } catch (SAXException sax) {
-// fail("Unexpected SAXException " + sax.toString());
-// }
-
- // case 4: Try to parse incorrect xml file
- try {
- is = getClass().getResourceAsStream("/wrong.xml");
- db.parse(is, SAXParserTestSupport.XML_SYSTEM_ID);
- fail("Expected SAXException was not thrown");
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- // expected
- }
- }
-
- /**
- * @tests javax.xml.parsers.DocumentBuilder#parse(java.lang.String)
- * Case 1: Try to parse correct xml document.
- * Case 2: Try to call parse() with null argument.
- * Case 3: Try to parse a non-existent uri.
- * Case 4: Try to parse incorrect xml file.
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "parse",
- args = {java.lang.String.class}
- )
- @KnownFailure("Android DocumentBuilder should support File sources")
- public void test_parseLjava_lang_String() {
- // case 1: Trivial use.
- File f = new File(getClass().getResource("/simple.xml").getFile());
- try {
- Document d = db.parse(f.getAbsolutePath());
- assertNotNull(d);
-// TBD getXmlEncoding() is not supported
-// assertEquals("ISO-8859-1", d.getXmlEncoding());
- assertEquals(2, d.getChildNodes().getLength());
- assertEquals("#comment",
- d.getChildNodes().item(0).getNodeName());
- assertEquals("breakfast_menu",
- d.getChildNodes().item(1).getNodeName());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 2: Try to call parse with null argument
- try {
- db.parse((String)null);
- fail("Expected IllegalArgumentException was not thrown");
- } catch (IllegalArgumentException iae) {
- // expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 3: Try to parse a non-existent uri
- try {
- db.parse("_");
- fail("Expected IOException was not thrown");
- } catch (IOException ioe) {
- // expected
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // case 4: Try to parse incorrect xml file
- try {
- f = new File(getClass().getResource("/wrong.xml").getFile());
- db.parse(f.getAbsolutePath());
- fail("Expected SAXException was not thrown");
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- // expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "reset",
- args = { }
- )
- @KnownFailure("Android DocumentBuilder should implement reset() properly")
- public void testReset() {
- // Make sure EntityResolver gets reset
- InputStream source = new ByteArrayInputStream("<a>&foo;</a>".getBytes());
- InputStream entity = new ByteArrayInputStream("bar".getBytes());
-
- MockResolver resolver = new MockResolver();
- resolver.addEntity("foo", "foo", new InputSource(entity));
-
- Document d;
-
- try {
- db = dbf.newDocumentBuilder();
- db.setEntityResolver(resolver);
- db.reset();
- d = db.parse(source);
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- Element root = (Element)d.getElementsByTagName("a").item(0);
- assertEquals("foo", ((EntityReference)root.getFirstChild()).getNodeName());
-
- // Make sure ErrorHandler gets reset
- source = new ByteArrayInputStream("</a>".getBytes());
-
- MethodLogger logger = new MethodLogger();
- ErrorHandler handler = new MockHandler(logger);
-
- try {
- db = dbf.newDocumentBuilder();
- db.setErrorHandler(handler);
- db.reset();
- d = db.parse(source);
- } catch (SAXParseException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(0, logger.size());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setErrorHandler",
- args = { ErrorHandler.class }
- )
- public void testSetErrorHandler() {
- // Ordinary case
- InputStream source = new ByteArrayInputStream("</a>".getBytes());
-
- MethodLogger logger = new MethodLogger();
- ErrorHandler handler = new MockHandler(logger);
-
- try {
- db = dbf.newDocumentBuilder();
- db.setErrorHandler(handler);
- db.parse(source);
- } catch (SAXParseException e) {
- // Expected, ErrorHandler does not mask exception
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals("error", logger.getMethod());
- assertTrue(logger.getArgs()[0] instanceof SAXParseException);
-
- // null case
- source = new ByteArrayInputStream("</a>".getBytes());
-
- try {
- db = dbf.newDocumentBuilder();
- db.setErrorHandler(null);
- db.parse(source);
- } catch (SAXParseException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setEntityResolver",
- args = { EntityResolver.class }
- )
- @KnownFailure("Android DocumentBuilder should support entity resolving")
- public void testSetEntityResolver() {
- // Ordinary case
- InputStream source = new ByteArrayInputStream("<a>&foo;</a>".getBytes());
- InputStream entity = new ByteArrayInputStream("bar".getBytes());
-
- MockResolver resolver = new MockResolver();
- resolver.addEntity("foo", "foo", new InputSource(entity));
-
- Document d;
-
- try {
- db = dbf.newDocumentBuilder();
- db.setEntityResolver(resolver);
- d = db.parse(source);
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- Element root = (Element)d.getElementsByTagName("a").item(0);
- assertEquals("bar", ((Text)root.getFirstChild()).getData());
-
- // null case
- source = new ByteArrayInputStream("<a>&foo;</a>".getBytes());
-
- try {
- db = dbf.newDocumentBuilder();
- db.setEntityResolver(null);
- d = db.parse(source);
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- root = (Element)d.getElementsByTagName("a").item(0);
- assertEquals("foo", ((EntityReference)root.getFirstChild()).getNodeName());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java
deleted file mode 100644
index 0b5f230..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package tests.api.javax.xml.parsers;
-
-import javax.xml.parsers.FactoryConfigurationError;
-
-import junit.framework.TestCase;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(FactoryConfigurationError.class)
-public class FactoryConfigurationErrorTest extends TestCase {
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "FactoryConfigurationError",
- args = {}
- )
- public void test_Constructor() {
- FactoryConfigurationError fce = new FactoryConfigurationError();
- assertNull(fce.getMessage());
- assertNull(fce.getLocalizedMessage());
- assertNull(fce.getCause());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "FactoryConfigurationError",
- args = {java.lang.Exception.class}
- )
- public void test_ConstructorLjava_lang_Exception() {
- Exception e = new Exception();
- // case 1: Try to create FactoryConfigurationError
- // which is based on Exception without parameters.
- FactoryConfigurationError fce = new FactoryConfigurationError(e);
- assertNotNull(fce.getMessage());
- assertNotNull(fce.getLocalizedMessage());
- assertEquals(e.getCause(), fce.getCause());
-
- // case 2: Try to create FactoryConfigurationError
- // which is based on Exception with String parameter.
- e = new Exception("test message");
- fce = new FactoryConfigurationError(e);
- assertEquals(e.toString(), fce.getMessage());
- assertEquals(e.toString(), fce.getLocalizedMessage());
- assertEquals(e.getCause(), fce.getCause());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "FactoryConfigurationError",
- args = {java.lang.Exception.class, java.lang.String.class}
- )
- public void test_ConstructorLjava_lang_ExceptionLjava_lang_String() {
- Exception e = new Exception();
- // case 1: Try to create FactoryConfigurationError
- // which is based on Exception without parameters.
- FactoryConfigurationError fce = new FactoryConfigurationError(e, "msg");
- assertNotNull(fce.getMessage());
- assertNotNull(fce.getLocalizedMessage());
- assertEquals(e.getCause(), fce.getCause());
-
- // case 2: Try to create FactoryConfigurationError
- // which is based on Exception with String parameter.
- e = new Exception("test message");
- fce = new FactoryConfigurationError(e, "msg");
- assertEquals("msg", fce.getMessage());
- assertEquals("msg", fce.getLocalizedMessage());
- assertEquals(e.getCause(), fce.getCause());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "FactoryConfigurationError",
- args = {java.lang.String.class}
- )
- public void test_ConstructorLjava_lang_String() {
- FactoryConfigurationError fce = new FactoryConfigurationError("Oops!");
- assertEquals("Oops!", fce.getMessage());
- assertEquals("Oops!", fce.getLocalizedMessage());
- assertNull(fce.getCause());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getException",
- args = {}
- )
- public void test_getException() {
- FactoryConfigurationError fce = new FactoryConfigurationError();
- assertNull(fce.getException());
- fce = new FactoryConfigurationError("test");
- assertNull(fce.getException());
- Exception e = new Exception("msg");
- fce = new FactoryConfigurationError(e);
- assertEquals(e, fce.getException());
- NullPointerException npe = new NullPointerException();
- fce = new FactoryConfigurationError(npe);
- assertEquals(npe, fce.getException());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getMessage",
- args = {}
- )
- public void test_getMessage() {
- assertNull(new FactoryConfigurationError().getMessage());
- assertEquals("msg1",
- new FactoryConfigurationError("msg1").getMessage());
- assertEquals(new Exception("msg2").toString(),
- new FactoryConfigurationError(
- new Exception("msg2")).getMessage());
- assertEquals(new NullPointerException().toString(),
- new FactoryConfigurationError(
- new NullPointerException()).getMessage());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java
deleted file mode 100644
index 63b87a7..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package tests.api.javax.xml.parsers;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import junit.framework.TestCase;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(ParserConfigurationException.class)
-public class ParserConfigurationExceptionTest extends TestCase{
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "ParserConfigurationException",
- args = {}
- )
- public void test_Constructor() {
- ParserConfigurationException pce = new ParserConfigurationException();
- assertNull(pce.getMessage());
- assertNull(pce.getLocalizedMessage());
- assertNull(pce.getCause());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "ParserConfigurationException",
- args = {java.lang.String.class}
- )
- public void test_ConstructorLjava_lang_String() {
- ParserConfigurationException pce =
- new ParserConfigurationException("Oops!");
- assertEquals("Oops!", pce.getMessage());
- assertEquals("Oops!", pce.getLocalizedMessage());
- assertNull(pce.getCause());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java
deleted file mode 100644
index 5d41356..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java
+++ /dev/null
@@ -1,547 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package tests.api.javax.xml.parsers;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Properties;
-import java.util.Vector;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import dalvik.annotation.AndroidOnly;
-import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@TestTargetClass(SAXParserFactory.class)
-public class SAXParserFactoryTest extends TestCase {
-
- SAXParserFactory spf;
-
- InputStream is1;
-
- static HashMap<String, String> ns;
-
- static Vector<String> el;
-
- static HashMap<String, String> attr;
-
- public void setUp() throws Exception {
- spf = SAXParserFactory.newInstance();
-
- is1 = getClass().getResourceAsStream("/simple.xml");
-
- ns = new HashMap<String, String>();
- attr = new HashMap<String, String>();
- el = new Vector<String>();
- }
-
- public void tearDown() throws Exception {
- is1.close();
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "SAXParserFactory",
- args = {}
- )
- @AndroidOnly("Android SAX implementation is non-validating")
- public void test_Constructor() {
- MySAXParserFactory mpf = new MySAXParserFactory();
- assertTrue(mpf instanceof SAXParserFactory);
- assertFalse(mpf.isValidating());
- }
-
- /**
- * @tests javax.xml.parsers.SAXParserFactory#getSchema().
- * TBD getSchema() IS NOT SUPPORTED
- */
- /* public void test_getSchema() {
- assertNull(spf.getSchema());
- SchemaFactory sf =
- SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- try {
- Schema schema = sf.newSchema();
- spf.setSchema(schema);
- assertNotNull(spf.getSchema());
- } catch (SAXException sax) {
- fail("Unexpected exception " + sax.toString());
- }
- }
- */
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isNamespaceAware",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "setNamespaceAware",
- args = {boolean.class}
- )
- })
- public void test_setIsNamespaceAware() {
- spf.setNamespaceAware(true);
- assertTrue(spf.isNamespaceAware());
- spf.setNamespaceAware(false);
- assertFalse(spf.isNamespaceAware());
- spf.setNamespaceAware(true);
- assertTrue(spf.isNamespaceAware());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isValidating",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "",
- method = "setValidating",
- args = {boolean.class}
- )
- })
- public void test_setIsValidating() {
- spf.setValidating(true);
- assertTrue(spf.isValidating());
- spf.setValidating(false);
- assertFalse(spf.isValidating());
- spf.setValidating(true);
- assertTrue(spf.isValidating());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isXIncludeAware",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "",
- method = "setXIncludeAware",
- args = {boolean.class}
- )
- })
- @KnownFailure("Should handle XIncludeAware flag more gracefully")
- public void test_setIsXIncludeAware() {
- spf.setXIncludeAware(true);
- assertTrue(spf.isXIncludeAware());
- spf.setXIncludeAware(false);
- assertFalse(spf.isXIncludeAware());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "newInstance",
- args = {}
- )
- public void test_newInstance() {
- String className = null;
- try {
- SAXParserFactory dtf = SAXParserFactory.newInstance();
- assertNotNull("New Instance of DatatypeFactory is null", dtf);
-
- className = System.getProperty("javax.xml.parsers.SAXParserFactory");
-
- System.setProperty("javax.xml.parsers.SAXParserFactory",
- "org.apache.harmony.xml.parsers.SAXParserFactoryImpl");
-
- SAXParserFactory spf1 = SAXParserFactory.newInstance();
- assertTrue(spf1 instanceof org.apache.harmony.xml.parsers.SAXParserFactoryImpl);
-
- String key = "javax.xml.parsers.SAXParserFactory = org.apache.harmony.xml.parsers.SAXParserFactoryImpl";
-
- ByteArrayInputStream bis = new ByteArrayInputStream(key.getBytes());
- Properties prop = System.getProperties();
- prop.load(bis);
- SAXParserFactory spf2 = SAXParserFactory.newInstance();
- assertTrue(spf2 instanceof org.apache.harmony.xml.parsers.SAXParserFactoryImpl);
-
- System.setProperty("javax.xml.parsers.SAXParserFactory", "");
- try {
- SAXParserFactory.newInstance();
- fail("Expected FactoryConfigurationError was not thrown");
- } catch (FactoryConfigurationError e) {
- // expected
- }
- } catch (IOException ioe) {
- fail("Unexpected exception " + ioe.toString());
- } finally {
- if (className == null) {
- System.clearProperty("javax.xml.parsers.SAXParserFactory");
- } else {
- System.setProperty("javax.xml.parsers.SAXParserFactory",
- className);
- }
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "SAXException untested; unused on Android",
- method = "newSAXParser",
- args = {}
- )
- public void test_newSAXParser() {
- // Ordinary case
- try {
- SAXParser sp = spf.newSAXParser();
- assertTrue(sp instanceof SAXParser);
- sp.parse(is1, new MyHandler());
- } catch(Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Exception case
- spf.setValidating(true);
- try {
- SAXParser sp = spf.newSAXParser();
- } catch(ParserConfigurationException e) {
- // Expected, since Android doesn't have a validating parser.
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- method = "setFeature",
- notes = "ParserConfigurationException untested; unused on Android",
- args = {java.lang.String.class, boolean.class}
- ),
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- method = "getFeature",
- notes = "ParserConfigurationException untested; unused on Android",
- args = {java.lang.String.class}
- )
- })
- public void test_setFeatureLjava_lang_StringZ() {
- // We can't verify ParserConfigurationException and
- // SAXNotSupportedException since these are never
- // thrown by Android.
-
- String[] features = {
- "http://xml.org/sax/features/namespaces",
- "http://xml.org/sax/features/validation" };
- for (int i = 0; i < features.length; i++) {
- try {
- spf.setFeature(features[i], true);
- assertTrue(spf.getFeature(features[i]));
- spf.setFeature(features[i], false);
- assertFalse(spf.getFeature(features[i]));
- } catch (ParserConfigurationException pce) {
- fail("ParserConfigurationException is thrown");
- } catch (SAXNotRecognizedException snre) {
- fail("SAXNotRecognizedException is thrown");
- } catch (SAXNotSupportedException snse) {
- fail("SAXNotSupportedException is thrown");
- }
- }
-
- try {
- spf.setFeature("", true);
- fail("SAXNotRecognizedException is not thrown");
- } catch (ParserConfigurationException pce) {
- fail("ParserConfigurationException is thrown");
- } catch (SAXNotRecognizedException snre) {
- //expected
- } catch (SAXNotSupportedException snse) {
- fail("SAXNotSupportedException is thrown");
- } catch (NullPointerException npe) {
- fail("NullPointerException is thrown");
- }
-
- try {
- spf.setFeature("http://xml.org/sax/features/unknown-feature", true);
- } catch (ParserConfigurationException pce) {
- fail("ParserConfigurationException is thrown");
- } catch (SAXNotRecognizedException snre) {
- fail("SAXNotRecognizedException is thrown");
- } catch (SAXNotSupportedException snse) {
- // Acceptable, although this doesn't happen an Android.
- } catch (NullPointerException npe) {
- fail("NullPointerException is thrown");
- }
-
- try {
- spf.setFeature(null, true);
- fail("NullPointerException is not thrown");
- } catch (ParserConfigurationException pce) {
- fail("ParserConfigurationException is thrown");
- } catch (SAXNotRecognizedException snre) {
- fail("SAXNotRecognizedException is thrown");
- } catch (SAXNotSupportedException snse) {
- fail("SAXNotSupportedException is thrown");
- } catch (NullPointerException npe) {
- // expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setNamespaceAware",
- args = {boolean.class}
- )
- @KnownFailure("Error in namespace feature handling (for ExpatParser)")
- public void test_setNamespaceAwareZ() {
-
- spf.setNamespaceAware(true);
- MyHandler mh = new MyHandler();
- InputStream is = getClass().getResourceAsStream("/simple_ns.xml");
- try {
- spf.newSAXParser().parse(is, mh);
- } catch(javax.xml.parsers.ParserConfigurationException pce) {
- fail("ParserConfigurationException was thrown during parsing");
- } catch(org.xml.sax.SAXException se) {
- fail("SAXException was thrown during parsing");
- } catch(IOException ioe) {
- fail("IOException was thrown during parsing");
- } finally {
- try {
- is.close();
- } catch(Exception e) {}
- }
- spf.setNamespaceAware(false);
- is = getClass().getResourceAsStream("/simple_ns.xml");
- try {
- is = getClass().getResourceAsStream("/simple_ns.xml");
- spf.newSAXParser().parse(is, mh);
- } catch(javax.xml.parsers.ParserConfigurationException pce) {
- fail("ParserConfigurationException was thrown during parsing");
- } catch(org.xml.sax.SAXException se) {
- se.printStackTrace();
- fail("SAXException was thrown during parsing");
- } catch(IOException ioe) {
- fail("IOException was thrown during parsing");
- } finally {
- try {
- is.close();
- } catch(Exception ioee) {}
- }
- is = getClass().getResourceAsStream("/simple_ns.xml");
- try {
- spf.setNamespaceAware(true);
- spf.newSAXParser().parse(is, mh);
- } catch(javax.xml.parsers.ParserConfigurationException pce) {
- fail("ParserConfigurationException was thrown during parsing");
- } catch(org.xml.sax.SAXException se) {
- fail("SAXException was thrown during parsing");
- } catch(IOException ioe) {
- fail("IOException was thrown during parsing");
- } finally {
- try {
- is.close();
- } catch(Exception ioee) {}
- }
- }
-
- /* public void test_setSchemaLjavax_xml_validation_Schema() {
- SchemaFactory sf =
- SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- try {
- Schema schema = sf.newSchema();
- spf.setSchema(schema);
- assertNotNull(spf.getSchema());
- } catch (SAXException sax) {
- fail("Unexpected exception " + sax.toString());
- }
- }
- */
-
-// public void test_setValidatingZ() {
-// MyHandler mh = new MyHandler();
-// InputStream is2 = getClass().getResourceAsStream("/recipe.xml");
-// try {
-// spf.setValidating(true);
-// assertTrue(spf.isValidating());
-// spf.newSAXParser().parse(is2, mh);
-// } catch (org.xml.sax.SAXException se) {
-// fail("SAXException was thrown during parsing");
-// } catch (javax.xml.parsers.ParserConfigurationException pce) {
-// fail("ParserConfigurationException was thrown during parsing");
-// } catch (IOException ioe) {
-// fail("IOException was thrown during parsing");
-// } finally {
-// try {
-// is2.close();
-// } catch(Exception ioee) {}
-// }
-// InputStream is3 = getClass().getResourceAsStream("/recipe1.xml");
-// try {
-// assertTrue(spf.isValidating());
-// spf.newSAXParser().parse(is3, mh);
-// } catch (org.xml.sax.SAXException se) {
-// fail("SAXException was thrown during parsing");
-// } catch (javax.xml.parsers.ParserConfigurationException pce) {
-// fail("ParserConfigurationException was thrown during parsing");
-// } catch (IOException ioe) {
-// fail("IOEXception was thrown during parsing: " + ioe.getMessage());
-// } finally {
-// try {
-// is3.close();
-// } catch(Exception ioee) {}
-// }
-// is2 = getClass().getResourceAsStream("/recipe.xml");
-// try {
-// spf.setValidating(false);
-// assertFalse(spf.isValidating());
-// spf.newSAXParser().parse(is2, mh);
-// } catch (org.xml.sax.SAXException se) {
-// fail("SAXException was thrown during parsing");
-// } catch (javax.xml.parsers.ParserConfigurationException pce) {
-// fail("ParserConfigurationException was thrown during parsing");
-// } catch (IOException ioe) {
-// fail("IOException was thrown during parsing");
-// } finally {
-// try {
-// is2.close();
-// } catch(Exception ioee) {}
-// }
-// is3 = getClass().getResourceAsStream("/recipe1.xml");
-// try {
-// assertFalse(spf.isValidating());
-// spf.newSAXParser().parse(is3, mh);
-// } catch (org.xml.sax.SAXException se) {
-// fail("SAXException was thrown during parsing");
-// } catch (javax.xml.parsers.ParserConfigurationException pce) {
-// fail("ParserConfigurationException was thrown during parsing");
-// } catch (IOException ioe) {
-// fail("IOEXception was thrown during parsing: " + ioe.getMessage());
-// } finally {
-// try {
-// is3.close();
-// } catch(Exception ioee) {}
-// }
-// }
-
-// public void test_setXIncludeAwareZ() {
-// spf.setXIncludeAware(true);
-// MyHandler mh = new MyHandler();
-// InputStream is = getClass().getResourceAsStream("/simple_ns.xml");
-// try {
-// spf.newSAXParser().parse(is, mh);
-// } catch(javax.xml.parsers.ParserConfigurationException pce) {
-// fail("ParserConfigurationException was thrown during parsing");
-// } catch(org.xml.sax.SAXException se) {
-// fail("SAXException was thrown during parsing");
-// } catch(IOException ioe) {
-// fail("IOException was thrown during parsing");
-// } finally {
-// try {
-// is.close();
-// } catch(Exception ioee) {}
-// }
-// spf.setXIncludeAware(false);
-// is = getClass().getResourceAsStream("/simple_ns.xml");
-// try {
-// is = getClass().getResourceAsStream("/simple_ns.xml");
-// spf.newSAXParser().parse(is, mh);
-// } catch(javax.xml.parsers.ParserConfigurationException pce) {
-// fail("ParserConfigurationException was thrown during parsing");
-// } catch(org.xml.sax.SAXException se) {
-// fail("SAXException was thrown during parsing");
-// } catch(IOException ioe) {
-// fail("IOException was thrown during parsing");
-// } finally {
-// try {
-// is.close();
-// } catch(Exception ioee) {}
-// }
-// is = getClass().getResourceAsStream("/simple_ns.xml");
-// try {
-// spf.setXIncludeAware(true);
-// spf.newSAXParser().parse(is, mh);
-// } catch(javax.xml.parsers.ParserConfigurationException pce) {
-// fail("ParserConfigurationException was thrown during parsing");
-// } catch(org.xml.sax.SAXException se) {
-// fail("SAXException was thrown during parsing");
-// } catch(IOException ioe) {
-// fail("IOException was thrown during parsing");
-// } finally {
-// try {
-// is.close();
-// } catch(Exception ioee) {}
-// }
-// }
-
- static class MyHandler extends DefaultHandler {
-
- public void startElement(String uri, String localName, String qName,
- Attributes atts) {
-
- el.add(qName);
- if (!uri.equals(""))
- ns.put(qName, uri);
- for (int i = 0; i < atts.getLength(); i++) {
- attr.put(atts.getQName(i), atts.getValue(i));
- }
-
- }
- }
-
- class MySAXParserFactory extends SAXParserFactory {
-
- public MySAXParserFactory() {
- super();
- }
-
- public SAXParser newSAXParser() {
- return null;
- }
-
- public void setFeature(String name, boolean value) throws
- ParserConfigurationException, SAXNotRecognizedException,
- SAXNotSupportedException {
-
- }
-
- public boolean getFeature(String name) throws
- ParserConfigurationException, SAXNotRecognizedException,
- SAXNotSupportedException {
- return true;
- }
-
- }
-
-}
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java
deleted file mode 100644
index 4ca0f1f..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java
+++ /dev/null
@@ -1,1171 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package tests.api.javax.xml.parsers;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Vector;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.HandlerBase;
-import org.xml.sax.InputSource;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.ext.LexicalHandler;
-import org.xml.sax.helpers.DefaultHandler;
-
-import tests.api.javax.xml.parsers.SAXParserTestSupport.MyDefaultHandler;
-import tests.api.javax.xml.parsers.SAXParserTestSupport.MyHandler;
-import tests.api.org.xml.sax.support.BrokenInputStream;
-import tests.api.org.xml.sax.support.MethodLogger;
-import tests.api.org.xml.sax.support.MockHandler;
-import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@SuppressWarnings("deprecation")
-@TestTargetClass(SAXParser.class)
-public class SAXParserTest extends TestCase {
-
- private class MockSAXParser extends SAXParser {
- public MockSAXParser() {
- super();
- }
-
- /*
- * @see javax.xml.parsers.SAXParser#getParser()
- */
- @Override
- public Parser getParser() throws SAXException {
- // it is a fake
- return null;
- }
-
- /*
- * @see javax.xml.parsers.SAXParser#getProperty(java.lang.String)
- */
- @Override
- public Object getProperty(String name) throws SAXNotRecognizedException,
- SAXNotSupportedException {
- // it is a fake
- return null;
- }
-
- /*
- * @see javax.xml.parsers.SAXParser#getXMLReader()
- */
- @Override
- public XMLReader getXMLReader() throws SAXException {
- // it is a fake
- return null;
- }
-
- /*
- * @see javax.xml.parsers.SAXParser#isNamespaceAware()
- */
- @Override
- public boolean isNamespaceAware() {
- // it is a fake
- return false;
- }
-
- /*
- * @see javax.xml.parsers.SAXParser#isValidating()
- */
- @Override
- public boolean isValidating() {
- // it is a fake
- return false;
- }
-
- /*
- * @see javax.xml.parsers.SAXParser#setProperty(java.lang.String,
- * java.lang.Object)
- */
- @Override
- public void setProperty(String name, Object value) throws
- SAXNotRecognizedException, SAXNotSupportedException {
- // it is a fake
- }
- }
-
- private static final String LEXICAL_HANDLER_PROPERTY
- = "http://xml.org/sax/properties/lexical-handler";
-
- SAXParserFactory spf;
-
- SAXParser parser;
-
- static HashMap<String, String> ns;
-
- static Vector<String> el;
-
- static HashMap<String, String> attr;
-
- SAXParserTestSupport sp = new SAXParserTestSupport();
-
- File [] list_wf;
- File [] list_nwf;
- File [] list_out_dh;
- File [] list_out_hb;
-
- boolean validating = false;
-
- private InputStream getResource(String name) {
- return this.getClass().getResourceAsStream(name);
- }
-
- public SAXParserTest() throws Exception{
- // we differntiate between a validating and a non validating parser
- try {
- SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
- validating = parser.isValidating();
- } catch (Exception e) {
- fail("could not obtain a SAXParser");
- }
-
- // nwf = non well formed, wf = well formed
- list_wf = new File[] {File.createTempFile(
- SAXParserTestSupport.XML_WF + "staff","xml")};
- list_nwf = new File[] {File.createTempFile(
- SAXParserTestSupport.XML_NWF + "staff","xml")};
-
- copyFile(getResource(SAXParserTestSupport.XML_WF + "staff.xml"),
- list_wf[0].getAbsolutePath());
- copyFile(getResource(SAXParserTestSupport.XML_WF + "staff.dtd"),
- File.createTempFile(SAXParserTestSupport.XML_WF + "staff",
- "dtd").getAbsolutePath());
- copyFile(getResource(SAXParserTestSupport.XML_NWF + "staff.xml"),
- list_nwf[0].getAbsolutePath());
- copyFile(getResource(SAXParserTestSupport.XML_NWF + "staff.dtd"),
- File.createTempFile(SAXParserTestSupport.XML_NWF + "staff",
- "dtd").getAbsolutePath());
-
- list_out_dh = new File[] {File.createTempFile(
- SAXParserTestSupport.XML_WF_OUT_DH + "staff", "out")};
- list_out_hb = new File[] {File.createTempFile(
- SAXParserTestSupport.XML_WF_OUT_HB + "staff", "out")};
- copyFile(getResource(SAXParserTestSupport.XML_WF_OUT_HB + "staff.out"),
- list_out_hb[0].getAbsolutePath());
- copyFile(getResource(SAXParserTestSupport.XML_WF_OUT_DH + "staff.out"),
- list_out_dh[0].getAbsolutePath());
- }
-
- private void copyFile(InputStream toCopy, String target) throws Exception {
- new File(target).getParentFile().mkdirs();
- OutputStream writer = new FileOutputStream(target);
- byte[] buffer = new byte[512];
- int i = toCopy.read(buffer);
- while (i >= 0) {
- writer.write(buffer,0,i);
- i = toCopy.read(buffer);
- }
- writer.flush();
- writer.close();
- toCopy.close();
- }
-
- @Override
- protected void setUp() throws Exception {
- spf = SAXParserFactory.newInstance();
- parser = spf.newSAXParser();
- assertNotNull(parser);
-
- ns = new HashMap<String, String>();
- attr = new HashMap<String, String>();
- el = new Vector<String>();
- }
-
- @Override
- protected void tearDown() throws Exception {
- }
-
-// public static void main(String[] args) throws Exception {
-// SAXParserTest st = new SAXParserTest();
-// st.setUp();
-// st.generateDataFromReferenceImpl();
-//
-// }
-//
-// private void generateDataFromReferenceImpl() {
-// try {
-// for(int i = 0; i < list_wf.length; i++) {
-// MyDefaultHandler dh = new MyDefaultHandler();
-// InputStream is = new FileInputStream(list_wf[i]);
-// parser.parse(is, dh, ParsingSupport.XML_SYSTEM_ID);
-// HashMap refHm = dh.createData();
-//
-// StringBuilder sb = new StringBuilder();
-// for (int j = 0; j < ParsingSupport.KEYS.length; j++) {
-// String key = ParsingSupport.KEYS[j];
-// sb.append(refHm.get(key)).append(
-// ParsingSupport.SEPARATOR_DATA);
-// }
-// FileWriter fw = new FileWriter("/tmp/build_dh"+i+".out");
-// fw.append(sb.toString());
-// fw.close();
-// }
-//
-// for(int i = 0; i < list_nwf.length; i++) {
-// MyHandler hb = new MyHandler();
-// InputStream is = new FileInputStream(list_wf[i]);
-// parser.parse(is, hb, ParsingSupport.XML_SYSTEM_ID);
-// HashMap refHm = hb.createData();
-//
-// StringBuilder sb = new StringBuilder();
-// for (int j = 0; j < ParsingSupport.KEYS.length; j++) {
-// String key = ParsingSupport.KEYS[j];
-// sb.append(refHm.get(key)).append(
-// ParsingSupport.SEPARATOR_DATA);
-// }
-// FileWriter fw = new FileWriter("/tmp/build_hb"+i+".out");
-// fw.append(sb.toString());
-// fw.close();
-// }
-//
-//
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "SAXParser",
- args = {}
- )
- public void testSAXParser() {
- try {
- new MockSAXParser();
- } catch (Exception e) {
- fail("unexpected exception " + e.toString());
- }
- }
-
- /**
- * @tests javax.xml.parser.SAXParser#getSchema().
- * TODO getSchema() IS NOT SUPPORTED
- */
- /* public void test_getSchema() {
- assertNull(parser.getSchema());
- SchemaFactory sf =
- SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- try {
- Schema schema = sf.newSchema();
- spf.setSchema(schema);
- assertNotNull(spf.newSAXParser().getSchema());
- } catch (ParserConfigurationException pce) {
- fail("Unexpected ParserConfigurationException " + pce.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
- */
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "isNamespaceAware",
- args = {}
- )
- public void testIsNamespaceAware() {
- try {
- spf.setNamespaceAware(true);
- assertTrue(spf.newSAXParser().isNamespaceAware());
- spf.setNamespaceAware(false);
- assertFalse(spf.newSAXParser().isNamespaceAware());
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "No validating parser in Android, hence not tested",
- method = "isValidating",
- args = {}
- )
- public void testIsValidating() {
- try {
- spf.setValidating(false);
- assertFalse(spf.newSAXParser().isValidating());
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "No XInclude-aware parser in Android, hence not tested",
- method = "isXIncludeAware",
- args = {}
- )
- @KnownFailure("Should handle XIncludeAware flag more gracefully")
- public void testIsXIncludeAware() {
- try {
- spf.setXIncludeAware(false);
- assertFalse(spf.newSAXParser().isXIncludeAware());
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- /**
- * @test javax.xml.parsers.SAXParser#parse(java.io.File,
- * org.xml.sax.helpers.DefaultHandler)
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify positive functionality properly; not all exceptions are verified.",
- method = "parse",
- args = {java.io.File.class, org.xml.sax.helpers.DefaultHandler.class}
- )
- public void _test_parseLjava_io_FileLorg_xml_sax_helpers_DefaultHandler()
- throws Exception {
-
- for(int i = 0; i < list_wf.length; i++) {
- HashMap<String, String> hm =
- new SAXParserTestSupport().readFile(list_out_dh[i].getPath());
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse(list_wf[i], dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData()));
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse(list_nwf[i], dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- }
- }
-
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse((File) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- }
-
- try {
- parser.parse(list_wf[0], (DefaultHandler) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "Sufficient while XML parser situation is still unclear",
- method = "parse",
- args = {java.io.File.class, org.xml.sax.HandlerBase.class}
- )
- public void testParseFileHandlerBase() {
- for(int i = 0; i < list_wf.length; i++) {
- try {
- HashMap<String, String> hm = sp.readFile(
- list_out_hb[i].getPath());
- MyHandler dh = new MyHandler();
- parser.parse(list_wf[i], dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm,
- dh.createData()));
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyHandler dh = new MyHandler();
- parser.parse(list_nwf[i], dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- }
- }
-
- try {
- MyHandler dh = new MyHandler();
- parser.parse((File) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- try {
- parser.parse(list_wf[0], (HandlerBase) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- /**
- * @test javax.xml.parsers.SAXParser#parse(org.xml.sax.InputSource,
- * org.xml.sax.helpers.DefaultHandler)
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify IOException.",
- method = "parse",
- args = {org.xml.sax.InputSource.class, org.xml.sax.helpers.DefaultHandler.class}
- )
-
- public void _test_parseLorg_xml_sax_InputSourceLorg_xml_sax_helpers_DefaultHandler()
- throws Exception {
-
- for(int i = 0; i < list_wf.length; i++) {
-
- HashMap<String, String> hm = new SAXParserTestSupport().readFile(
- list_out_dh[i].getPath());
- MyDefaultHandler dh = new MyDefaultHandler();
- InputSource is = new InputSource(new FileInputStream(list_wf[i]));
- parser.parse(is, dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData()));
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- InputSource is = new InputSource(
- new FileInputStream(list_nwf[i]));
- parser.parse(is, dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- }
- }
-
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse((InputSource) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- }
-
- try {
- InputSource is = new InputSource(new FileInputStream(list_wf[0]));
- parser.parse(is, (DefaultHandler) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- }
-
- try {
- InputSource is = new InputSource(new BrokenInputStream(new FileInputStream(list_wf[0]), 10));
- parser.parse(is, (DefaultHandler) null);
- fail("IOException expected");
- } catch(IOException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "Sufficient while XML parser situation is still unclear",
- method = "parse",
- args = {org.xml.sax.InputSource.class, org.xml.sax.HandlerBase.class}
- )
- public void testParseInputSourceHandlerBase() {
- for(int i = 0; i < list_wf.length; i++) {
- try {
- HashMap<String, String> hm = sp.readFile(
- list_out_hb[i].getPath());
- MyHandler dh = new MyHandler();
- InputSource is = new InputSource(new FileInputStream(list_wf[i]));
- parser.parse(is, dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm,
- dh.createData()));
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyHandler dh = new MyHandler();
- InputSource is = new InputSource(new FileInputStream(list_nwf[i]));
- parser.parse(is, dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- }
- }
-
- try {
- MyHandler dh = new MyHandler();
- parser.parse((InputSource) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- try {
- InputSource is = new InputSource(new FileInputStream(list_wf[0]));
- parser.parse(is, (HandlerBase) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // Reader case
- try {
- InputSource is = new InputSource(new InputStreamReader(
- new FileInputStream(list_wf[0])));
- parser.parse(is, (HandlerBase) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // SystemID case
- try {
- InputSource is = new InputSource(list_wf[0].toURI().toString());
- parser.parse(is, (HandlerBase) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // Inject IOException
- try {
- InputStream is = new BrokenInputStream(
- new FileInputStream(list_wf[0]), 10);
- parser.parse(is, (HandlerBase) null,
- SAXParserTestSupport.XML_SYSTEM_ID);
- fail("IOException expected");
- } catch(IOException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- /**
- * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream,
- * org.xml.sax.helpers.DefaultHandler)
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify IOException.",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class}
- )
- public void _test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandler()
- throws Exception {
-
- for(int i = 0; i < list_wf.length; i++) {
-
- HashMap<String, String> hm = new SAXParserTestSupport().readFile(
- list_out_dh[i].getPath());
- MyDefaultHandler dh = new MyDefaultHandler();
- InputStream is = new FileInputStream(list_wf[i]);
- parser.parse(is, dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData()));
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- InputStream is = new FileInputStream(list_nwf[i]);
- parser.parse(is, dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- }
- }
-
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse((InputStream) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- }
-
- try {
- InputStream is = new FileInputStream(list_wf[0]);
- parser.parse(is, (DefaultHandler) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- }
- }
-
- /**
- * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream,
- * org.xml.sax.helpers.DefaultHandler, java.lang.String)
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify IOException.",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class, java.lang.String.class}
- )
- public void _test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandlerLjava_lang_String() {
- for(int i = 0; i < list_wf.length; i++) {
- try {
- HashMap<String, String> hm = sp.readFile(
- list_out_hb[i].getPath());
- MyDefaultHandler dh = new MyDefaultHandler();
- InputStream is = new FileInputStream(list_wf[i]);
- parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID);
- assertTrue(SAXParserTestSupport.equalsMaps(hm,
- dh.createData()));
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- InputStream is = new FileInputStream(list_nwf[i]);
- parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- }
- }
-
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse((InputStream) null, dh,
- SAXParserTestSupport.XML_SYSTEM_ID);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- try {
- InputStream is = new FileInputStream(list_wf[0]);
- parser.parse(is, (DefaultHandler) null,
- SAXParserTestSupport.XML_SYSTEM_ID);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-//
-// for(int i = 0; i < list_wf.length; i++) {
-//
-// HashMap<String, String> hm = new SAXParserTestSupport().readFile(
-// list_out_dh[i].getPath());
-// MyDefaultHandler dh = new MyDefaultHandler();
-// InputStream is = new FileInputStream(list_wf[i]);
-// parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID);
-// assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData()));
-// }
-//
-// for(int i = 0; i < list_nwf.length; i++) {
-// try {
-// MyDefaultHandler dh = new MyDefaultHandler();
-// InputStream is = new FileInputStream(list_nwf[i]);
-// parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID);
-// fail("SAXException is not thrown");
-// } catch(org.xml.sax.SAXException se) {
-// //expected
-// }
-// }
-//
-// try {
-// MyDefaultHandler dh = new MyDefaultHandler();
-// parser.parse((InputStream) null, dh,
-// SAXParserTestSupport.XML_SYSTEM_ID);
-// fail("java.lang.IllegalArgumentException is not thrown");
-// } catch(java.lang.IllegalArgumentException iae) {
-// //expected
-// }
-//
-// try {
-// InputStream is = new FileInputStream(list_wf[0]);
-// parser.parse(is, (DefaultHandler) null,
-// SAXParserTestSupport.XML_SYSTEM_ID);
-// } catch(java.lang.IllegalArgumentException iae) {
-// fail("java.lang.IllegalArgumentException is thrown");
-// }
-//
-// // TODO commented out since our parser is nonvalidating and thus never
-// // tries to load staff.dtd in "/" ... and therefore never can fail with
-// // an IOException
-// /*try {
-// MyDefaultHandler dh = new MyDefaultHandler();
-// InputStream is = new FileInputStream(list_wf[0]);
-// parser.parse(is, dh, "/");
-// fail("Expected IOException was not thrown");
-// } catch(IOException ioe) {
-// // expected
-// }*/
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "Sufficient while XML parser situation is still unclear",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.HandlerBase.class}
- )
- public void testParseInputStreamHandlerBase() {
- for(int i = 0; i < list_wf.length; i++) {
- try {
- HashMap<String, String> hm = sp.readFile(
- list_out_hb[i].getPath());
- MyHandler dh = new MyHandler();
- InputStream is = new FileInputStream(list_wf[i]);
- parser.parse(is, dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm,
- dh.createData()));
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyHandler dh = new MyHandler();
- InputStream is = new FileInputStream(list_nwf[i]);
- parser.parse(is, dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- }
- }
-
- try {
- MyHandler dh = new MyHandler();
- parser.parse((InputStream) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- try {
- InputStream is = new FileInputStream(list_wf[0]);
- parser.parse(is, (HandlerBase) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // Inject IOException
- try {
- InputStream is = new BrokenInputStream(
- new FileInputStream(list_wf[0]), 10);
- parser.parse(is, (HandlerBase) null);
- fail("IOException expected");
- } catch(IOException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "Sufficient while XML parser situation is still unclear",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.HandlerBase.class, java.lang.String.class}
- )
- public void testParseInputStreamHandlerBaseString() {
- for(int i = 0; i < list_wf.length; i++) {
- try {
- HashMap<String, String> hm = sp.readFile(
- list_out_hb[i].getPath());
- MyHandler dh = new MyHandler();
- InputStream is = new FileInputStream(list_wf[i]);
- parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID);
- assertTrue(SAXParserTestSupport.equalsMaps(hm,
- dh.createData()));
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyHandler dh = new MyHandler();
- InputStream is = new FileInputStream(list_nwf[i]);
- parser.parse(is, dh, SAXParserTestSupport.XML_SYSTEM_ID);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- }
- }
-
- try {
- MyHandler dh = new MyHandler();
- parser.parse((InputStream) null, dh,
- SAXParserTestSupport.XML_SYSTEM_ID);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- try {
- InputStream is = new FileInputStream(list_wf[0]);
- parser.parse(is, (HandlerBase) null,
- SAXParserTestSupport.XML_SYSTEM_ID);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- // Inject IOException
- try {
- InputStream is = new BrokenInputStream(
- new FileInputStream(list_wf[0]), 10);
- parser.parse(is, (HandlerBase) null,
- SAXParserTestSupport.XML_SYSTEM_ID);
- fail("IOException expected");
- } catch(IOException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- /**
- * @test javax.xml.parsers.SAXParser#parse(java.lang.String,
- * org.xml.sax.helpers.DefaultHandler)
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify IOException.",
- method = "parse",
- args = {java.lang.String.class, org.xml.sax.helpers.DefaultHandler.class}
- )
- public void _test_parseLjava_lang_StringLorg_xml_sax_helpers_DefaultHandler()
- throws Exception {
-
- for(int i = 0; i < list_wf.length; i++) {
-
- HashMap<String, String> hm = new SAXParserTestSupport().readFile(
- list_out_dh[i].getPath());
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse(list_wf[i].getPath(), dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm, dh.createData()));
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse(list_nwf[i].getPath(), dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- }
- }
-
- try {
- MyDefaultHandler dh = new MyDefaultHandler();
- parser.parse((String) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- }
-
- try {
- parser.parse(list_wf[0].getPath(), (DefaultHandler) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- }
- }
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- notes = "Sufficient while XML parser situation is still unclear",
- method = "parse",
- args = {java.lang.String.class, org.xml.sax.HandlerBase.class}
- )
- public void testParseStringHandlerBase() {
- for(int i = 0; i < list_wf.length; i++) {
- try {
- HashMap<String, String> hm = sp.readFile(
- list_out_hb[i].getPath());
- MyHandler dh = new MyHandler();
- parser.parse(list_wf[i].toURI().toString(), dh);
- assertTrue(SAXParserTestSupport.equalsMaps(hm,
- dh.createData()));
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch (SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- for(int i = 0; i < list_nwf.length; i++) {
- try {
- MyHandler dh = new MyHandler();
- parser.parse(list_nwf[i].toURI().toString(), dh);
- fail("SAXException is not thrown");
- } catch(org.xml.sax.SAXException se) {
- //expected
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- }
- }
-
- try {
- MyHandler dh = new MyHandler();
- parser.parse((String) null, dh);
- fail("java.lang.IllegalArgumentException is not thrown");
- } catch(java.lang.IllegalArgumentException iae) {
- //expected
- } catch (IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
-
- try {
- parser.parse(list_wf[0].toURI().toString(), (HandlerBase) null);
- } catch(java.lang.IllegalArgumentException iae) {
- fail("java.lang.IllegalArgumentException is thrown");
- } catch (FileNotFoundException fne) {
- fail("Unexpected FileNotFoundException " + fne.toString());
- } catch(IOException ioe) {
- fail("Unexpected IOException " + ioe.toString());
- } catch(SAXException sax) {
- fail("Unexpected SAXException " + sax.toString());
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "reset",
- args = { }
- )
- @KnownFailure("Android DocumentBuilder should implement reset() properly")
- public void testReset() {
- try {
- spf = SAXParserFactory.newInstance();
- parser = spf.newSAXParser();
-
- parser.setProperty(LEXICAL_HANDLER_PROPERTY, new MockHandler(new MethodLogger()));
- parser.reset();
- assertEquals(null, parser.getProperty(LEXICAL_HANDLER_PROPERTY));
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getParser",
- args = { }
- )
- public void testGetParser() {
- spf = SAXParserFactory.newInstance();
- try {
- Parser parser = spf.newSAXParser().getParser();
- assertNotNull(parser);
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getXMLReader",
- args = { }
- )
- public void testGetReader() {
- spf = SAXParserFactory.newInstance();
- try {
- XMLReader reader = spf.newSAXParser().getXMLReader();
- assertNotNull(reader);
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getProperty",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setProperty",
- args = { String.class, Object.class }
- )
- })
- @KnownFailure("ExpatParser should allow to clear properties")
- public void testSetGetProperty() {
- // Ordinary case
- String validName = "http://xml.org/sax/properties/lexical-handler";
- LexicalHandler validValue = new MockHandler(new MethodLogger());
-
- try {
- SAXParser parser = spf.newSAXParser();
- parser.setProperty(validName, validValue);
- assertEquals(validValue, parser.getProperty(validName));
-
- parser.setProperty(validName, null);
- assertEquals(null, parser.getProperty(validName));
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Unsupported property
- try {
- SAXParser parser = spf.newSAXParser();
- parser.setProperty("foo", "bar");
- fail("SAXNotRecognizedException expected");
- } catch (SAXNotRecognizedException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- try {
- SAXParser parser = spf.newSAXParser();
- parser.getProperty("foo");
- fail("SAXNotRecognizedException expected");
- } catch (SAXNotRecognizedException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // No name case
- try {
- SAXParser parser = spf.newSAXParser();
- parser.setProperty(null, "bar");
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- try {
- SAXParser parser = spf.newSAXParser();
- parser.getProperty(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
-}
-
diff --git a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java
deleted file mode 100644
index bc5e6a1..0000000
--- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTestSupport.java
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.javax.xml.parsers;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.HandlerBase;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Support for SAXParserTest. Shares the element keys used in the golden files.
- * Compares the result of the parser with golden data.
- * Contains the handler classes used to track the output of the parser.
- */
-class SAXParserTestSupport {
-
- public static final char SEPARATOR_ELEMENT = '^';
- public static final char SEPARATOR_STRING = '$';
- public static final char SEPARATOR_DATA = '#';
-
- public static final String XML_WF = "/wf/";
- public static final String XML_NWF = "/nwf/";
-
- public static final String XML_WF_OUT_DH = "/out_dh/";
- public static final String XML_WF_OUT_HB = "/out_hb/";
-
- public static final String XML_SYSTEM_ID = "." + "/systemid/";
-
- public static final String KEY_IS_START_DOC = "isEndDocument";
- public static final String KEY_IS_END_DOC = "isStartDocument";
- public static final String KEY_TEXT = "text";
- public static final String KEY_ERROR = "error";
- public static final String KEY_FATAL_ERROR = "fatalError";
- public static final String KEY_WARNING = "warning";
- public static final String KEY_END_ELEMENT = "endEement";
- public static final String KEY_END_PREFIX_MAPPING = "endPrefixMapping";
- public static final String KEY_IGNORABLE_WHITE_SPACE =
- "ignorableWhitespace";
- public static final String KEY_NOTATION_DECL = "notationDecl";
- public static final String KEY_PROCESSING_INSTRUCTION =
- "processingInstruction";
- public static final String KEY_RESOLVE_ENTITY = "resolveEntity";
- public static final String KEY_DOCUMENT_LOCATORS = "documentLocators";
- public static final String KEY_SKIPPED_ENTITY = "skippedEntity";
- public static final String KEY_START_ELEMENT = "startElement";
- public static final String KEY_START_PREFIX_MAPPING = "startPrefixMapping";
- public static final String KEY_UNPARSED_ENTITY_DECL = "unparsedEntityDecl";
-
- static String [] KEYS = {KEY_IS_START_DOC, KEY_IS_END_DOC, KEY_TEXT,
- KEY_ERROR, KEY_FATAL_ERROR, KEY_WARNING, KEY_END_ELEMENT,
- KEY_END_PREFIX_MAPPING, KEY_PROCESSING_INSTRUCTION,
- KEY_SKIPPED_ENTITY, KEY_START_ELEMENT,
- KEY_START_PREFIX_MAPPING};
-
- static {
- String tmp = System.getProperty("java.io.tmpdir", ".");
-
- new File(tmp).mkdirs();
- new File(tmp, XML_WF).mkdirs();
- new File(tmp, XML_NWF).mkdirs();
- new File(tmp, XML_WF_OUT_DH).mkdirs();
- new File(tmp, XML_WF_OUT_HB).mkdirs();
- }
-
- /**
- * Initialize the SAXParserTest reference by filling in the data from the
- * file passed to the method. This will be the reference to compare
- * against with the output of the parser.
- */
- public HashMap<String, String> readFile(String fileName) {
- HashMap<String, String> storage = new HashMap<String, String>();
- try {
-
- InputStream is = new FileInputStream(fileName);
-
- int c = is.read();
-
- StringBuffer str = new StringBuffer();
- int i = 0;
- while(c != -1) {
- if((char)c == SEPARATOR_DATA) {
- // if(str.length() > 0) {
- if(i < KEYS.length) {
- storage.put(KEYS[i], str.toString());
- // System.out.println(str.toString());
- str.setLength(0);
- i++;
- }
- // }
- } else {
- str.append((char)c);
- }
- try {
- c = is.read();
- } catch (Exception e) {
- c = -1;
- }
- }
- try {
- is.close();
- } catch (IOException e) {
- }
-
- } catch(IOException ioe) {
- System.out.println("IOException during processing the file: "
- + fileName);
- }
- return storage;
- }
-
- /**
- * Compares the content of two HashMaps. One map should be the reference
- * containing the correct string for each xml document element and the other
- * should contain the elements filled with output from the parser.
- *
- * @param original the reference
- * @param result the result of the parser
- * @return true if they're equal.
- */
- public static boolean equalsMaps(HashMap<String, String> original,
- HashMap<String, String> result) {
-
- if(original == null && result == null) {
- return true;
- } else {
- if(original.size() != result.size()) return false;
-
- for(int i = 0; i < KEYS.length; i++) {
- if(!original.get(KEYS[i]).equals(result.get(KEYS[i]))) {
- System.out.println("for "+KEYS[i]+": original:" +
- original.get(KEYS[i]));
- System.out.println();
- System.out.println(" result:" + result.get(KEYS[i]));
- System.out.println();
- return false;
- }
- }
- return true;
- }
- }
-
- static class MyDefaultHandler extends DefaultHandler {
-
- public StringBuffer data_isEndDocument = new StringBuffer();
- public StringBuffer data_isStartDocument = new StringBuffer();
- public StringBuffer data_text = new StringBuffer();
- public StringBuffer data_error = new StringBuffer();
- public StringBuffer data_fatalError = new StringBuffer();
- public StringBuffer data_warning = new StringBuffer();
- public StringBuffer data_endElement = new StringBuffer();
- public StringBuffer data_endPrefixMapping = new StringBuffer();
- public StringBuffer data_processingInstruction = new StringBuffer();
- public StringBuffer data_skippedEntity = new StringBuffer();
- public StringBuffer data_startElement = new StringBuffer();
- public StringBuffer data_startPrefixMapping = new StringBuffer();
-
- public HashMap<String, String> createData() {
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put(KEY_IS_END_DOC, data_isEndDocument.toString());
- hm.put(KEY_IS_START_DOC, data_isStartDocument.toString());
- hm.put(KEY_TEXT, data_text.toString());
- hm.put(KEY_ERROR, data_error.toString());
- hm.put(KEY_FATAL_ERROR, data_fatalError.toString());
- hm.put(KEY_WARNING, data_warning.toString());
- hm.put(KEY_END_ELEMENT, data_endElement.toString());
- hm.put(KEY_END_PREFIX_MAPPING, data_endPrefixMapping.toString());
-
- hm.put(KEY_PROCESSING_INSTRUCTION,
- data_processingInstruction.toString());
- hm.put(KEY_SKIPPED_ENTITY, data_skippedEntity.toString());
- hm.put(KEY_START_ELEMENT, data_startElement.toString());
- hm.put(KEY_START_PREFIX_MAPPING,
- data_startPrefixMapping.toString());
- return hm;
- }
-
- public void printMap() {
- System.out.print(data_isStartDocument.toString() + SEPARATOR_DATA +
- data_isEndDocument.toString() + SEPARATOR_DATA +
- data_text.toString() + SEPARATOR_DATA +
- data_error.toString()+ SEPARATOR_DATA +
- data_fatalError.toString()+ SEPARATOR_DATA +
- data_warning.toString()+ SEPARATOR_DATA +
- data_endElement.toString() + SEPARATOR_DATA+
- data_endPrefixMapping.toString()+ SEPARATOR_DATA +
- data_processingInstruction.toString() + SEPARATOR_DATA +
- data_skippedEntity.toString() + SEPARATOR_DATA +
- data_startElement.toString() + SEPARATOR_DATA +
- data_startPrefixMapping.toString()+ SEPARATOR_DATA);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- String str = new String(ch, start, length);
- data_text.append(str);
- // different sax parsers are allowed to handle chunking differently,
- // therefore we cannot rely on identical chunks being delivered.
- //data_text.append(ParsingSupport.SEPARATOR_ELEMENT);
- }
-
- @Override
- public void endDocument() {
- data_isEndDocument.append(true);
- data_isEndDocument.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) {
- StringBuffer sb = new StringBuffer();
- sb.append(uri);
- sb.append(SEPARATOR_STRING);
- sb.append(localName);
- sb.append(SEPARATOR_STRING);
- sb.append(qName);
- data_endElement.append(sb);
- data_endElement.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void endPrefixMapping(String prefix) {
- data_endPrefixMapping.append(prefix);
- data_endPrefixMapping.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void error(SAXParseException e) {
- data_error.append(e);
- data_error.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void fatalError(SAXParseException e) {
- data_fatalError.append(e);
- data_fatalError.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void ignorableWhitespace(char[] ch, int start, int length) {
- /* String s = new String(ch, start, length);
- ignorableWhitespace.append(s);
- ignorableWhitespace.append(ParsingSupport.SEPARATOR_ELEMENT);*/
- }
-
- @Override
- public void notationDecl(String name, String publicId,
- String systemId) {
- /* data_notationDecl.append(name + ParsingSupport.SEPARATOR_STRING +
- publicId + ParsingSupport.SEPARATOR_STRING +
- systemId + ParsingSupport.SEPARATOR_STRING);
- data_notationDecl.append(ParsingSupport.SEPARATOR_ELEMENT);*/
- }
-
- @Override
- public void processingInstruction(String target, String data) {
- data_processingInstruction.append(target + SEPARATOR_STRING + data);
- data_processingInstruction.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public InputSource resolveEntity(String publicId, String systemId) {
- // data_resolveEntity.append(publicId +
- // ParsingSupport.SEPARATOR_STRING + systemId);
- // data_resolveEntity.append(ParsingSupport.SEPARATOR_ELEMENT);
- return null;
- }
-
- @Override
- public void setDocumentLocator(Locator locator) {
- // data_documentLocators.append(locator);
- // data_documentLocators.append(ParsingSupport.SEPARATOR_ELEMENT);
- }
-
- @Override
- public void skippedEntity(String name) {
- data_skippedEntity.append(name);
- data_skippedEntity.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void startDocument() {
- data_isStartDocument.append(true);
- data_isStartDocument.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) {
- data_startElement.append(uri);
- data_startElement.append(SEPARATOR_STRING);
- data_startElement.append(localName);
- data_startElement.append(SEPARATOR_STRING);
- data_startElement.append(qName);
-
- for(int i = 0; i < attributes.getLength(); i ++)
- data_startElement.append(
- SEPARATOR_STRING +attributes.getQName(i) +
- SEPARATOR_STRING + attributes.getValue(i));
-
- data_isStartDocument.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void startPrefixMapping(String prefix, String uri) {
- data_startPrefixMapping.append(prefix + SEPARATOR_STRING + uri);
- }
-
- @Override
- public void unparsedEntityDecl(String name, String publicId,
- String systemId, String notationName) {
- // data_unparsedEntityDecl.append(name
- // + ParsingSupport.SEPARATOR_STRING + publicId
- // + ParsingSupport.SEPARATOR_STRING
- // + systemId + ParsingSupport.SEPARATOR_STRING + notationName);
- }
-
- @Override
- public void warning(SAXParseException e) {
- data_warning.append(e);
- }
- }
-
- @SuppressWarnings("deprecation")
- static class MyHandler extends HandlerBase {
-
- public StringBuffer data_isEndDocument = new StringBuffer();
- public StringBuffer data_isStartDocument = new StringBuffer();
- public StringBuffer data_text = new StringBuffer();
- public StringBuffer data_error = new StringBuffer();
- public StringBuffer data_fatalError = new StringBuffer();
- public StringBuffer data_warning = new StringBuffer();
- public StringBuffer data_endElement = new StringBuffer();
- public StringBuffer data_endPrefixMapping = new StringBuffer();
- public StringBuffer data_processingInstruction = new StringBuffer();
- public StringBuffer data_skippedEntity = new StringBuffer();
- public StringBuffer data_startElement = new StringBuffer();
- public StringBuffer data_startPrefixMapping = new StringBuffer();
-
- public void printMap() {
- System.out.print(data_isStartDocument.toString() + SEPARATOR_DATA +
- data_isEndDocument.toString() + SEPARATOR_DATA +
- data_text.toString() + SEPARATOR_DATA +
- data_error.toString()+ SEPARATOR_DATA +
- data_fatalError.toString()+ SEPARATOR_DATA +
- data_warning.toString()+ SEPARATOR_DATA +
- data_endElement.toString() + SEPARATOR_DATA+
- data_endPrefixMapping.toString()+ SEPARATOR_DATA +
- data_processingInstruction.toString() + SEPARATOR_DATA +
- data_skippedEntity.toString() + SEPARATOR_DATA +
- data_startElement.toString() + SEPARATOR_DATA +
- data_startPrefixMapping.toString()+ SEPARATOR_DATA);
- }
-
- public HashMap<String, String> createData() {
- HashMap<String, String> hm = new HashMap<String, String>();
- hm.put(KEY_IS_END_DOC, data_isEndDocument.toString());
- hm.put(KEY_IS_START_DOC, data_isStartDocument.toString());
- hm.put(KEY_TEXT, data_text.toString());
- hm.put(KEY_ERROR, data_error.toString());
- hm.put(KEY_FATAL_ERROR, data_fatalError.toString());
- hm.put(KEY_WARNING, data_warning.toString());
- hm.put(KEY_END_ELEMENT, data_endElement.toString());
- hm.put(KEY_END_PREFIX_MAPPING, data_endPrefixMapping.toString());
- hm.put(KEY_PROCESSING_INSTRUCTION,
- data_processingInstruction.toString());
- hm.put(KEY_SKIPPED_ENTITY, data_skippedEntity.toString());
- hm.put(KEY_START_ELEMENT, data_startElement.toString());
- hm.put(KEY_START_PREFIX_MAPPING,
- data_startPrefixMapping.toString());
- return hm;
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- String str = new String(ch, start, length);
- data_text.append(str);
- // different sax parsers are allowed to handle chunking differently,
- // therefore we cannot rely on identical chunks being delivered.
- //data_text.append(ParsingSupport.SEPARATOR_ELEMENT);
- }
-
- @Override
- public void endDocument() {
- data_isEndDocument.append(true);
- data_isEndDocument.append(SEPARATOR_ELEMENT);
- }
-
- public void endElement(String uri, String localName, String qName) {
- StringBuffer sb = new StringBuffer();
- sb.append(uri);
- sb.append(SEPARATOR_STRING);
- sb.append(localName);
- sb.append(SEPARATOR_STRING);
- sb.append(qName);
- data_endElement.append(sb);
- data_endElement.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void error(SAXParseException e) {
- data_error.append(e);
- data_error.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void fatalError(SAXParseException e) {
- data_fatalError.append(e);
- data_fatalError.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void ignorableWhitespace(char[] ch, int start, int length) {
-
- }
-
- @Override
- public void notationDecl(String name, String publicId,
- String systemId) {
-
- }
-
- @Override
- public void processingInstruction(String target, String data) {
- data_processingInstruction.append(target + SEPARATOR_STRING + data);
- data_processingInstruction.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public InputSource resolveEntity(String publicId, String systemId) {
- return null;
- }
-
- @Override
- public void setDocumentLocator(Locator locator) {
-
- }
-
- @Override
- public void startDocument() {
- data_isStartDocument.append(true);
- data_isStartDocument.append(SEPARATOR_ELEMENT);
- }
-
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) {
- data_startElement.append(uri);
- data_startElement.append(SEPARATOR_STRING);
- data_startElement.append(localName);
- data_startElement.append(SEPARATOR_STRING);
- data_startElement.append(qName);
-
- for(int i = 0; i < attributes.getLength(); i ++)
- data_startElement.append(SEPARATOR_STRING
- + attributes.getQName(i) +
- SEPARATOR_STRING + attributes.getValue(i));
-
- data_isStartDocument.append(SEPARATOR_ELEMENT);
- }
-
- @Override
- public void unparsedEntityDecl(String name, String publicId,
- String systemId, String notationName) {
-
- }
-
- @Override
- public void warning(SAXParseException e) {
- data_warning.append(e);
- }
- }
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/AllTests.java b/xml/src/test/java/tests/api/org/xml/sax/AllTests.java
deleted file mode 100644
index 9c29178..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/AllTests.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(AllTests.suite());
- }
-
- public static Test suite() {
- TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for org.xml.sax package");
- // $JUnit-BEGIN$
-
- suite.addTestSuite(HandlerBaseTest.class);
- suite.addTestSuite(InputSourceTest.class);
- suite.addTestSuite(SAXExceptionTest.class);
- suite.addTestSuite(SAXNotRecognizedExceptionTest.class);
- suite.addTestSuite(SAXNotSupportedExceptionTest.class);
- suite.addTestSuite(SAXParseExceptionTest.class);
-
- suite.addTest(tests.api.org.xml.sax.ext.AllTests.suite());
- suite.addTest(tests.api.org.xml.sax.helpers.AllTests.suite());
-
- // $JUnit-END$
- return suite;
- }
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/HandlerBaseTest.java b/xml/src/test/java/tests/api/org/xml/sax/HandlerBaseTest.java
deleted file mode 100644
index 7c7f591..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/HandlerBaseTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.AttributeList;
-import org.xml.sax.HandlerBase;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.AttributeListImpl;
-import org.xml.sax.helpers.LocatorImpl;
-
-@SuppressWarnings("deprecation")
-@TestTargetClass(HandlerBase.class)
-public class HandlerBaseTest extends TestCase {
-
- /*
- * Note: most of the tests have to check for an empty implementation of the
- * respective methods and, as a result, are somewhat trivial.
- */
-
- private HandlerBase h = new HandlerBase();
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "resolveEntity",
- args = { String.class, String.class }
- )
- public void testResolveEntity() {
- try {
- h.resolveEntity("publicID", "systemID");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "notationDecl",
- args = { String.class, String.class, String.class }
- )
- public void testNotationDecl() {
- h.notationDecl("name", "publicID", "systemID");
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "unparsedEntityDecl",
- args = { String.class, String.class, String.class, String.class }
- )
- public void testUnparsedEntityDecl() {
- h.unparsedEntityDecl("name", "publicID", "systemID", "notationName");
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDocumentLocator",
- args = { org.xml.sax.Locator.class }
- )
- public void testSetDocumentLocator() {
- h.setDocumentLocator(new LocatorImpl());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startDocument",
- args = { }
- )
- public void testStartDocument() {
- try {
- h.startDocument();
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endDocument",
- args = { }
- )
- public void testEndDocument() {
- try {
- h.endDocument();
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startElement",
- args = { String.class, AttributeList.class }
- )
- public void testStartElement() {
- try {
- h.startElement("name", new AttributeListImpl());
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endElement",
- args = { String.class }
- )
- public void testEndElement() {
- try {
- h.endElement("name");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "characters",
- args = { char[].class, int.class, int.class }
- )
- public void testCharacters() {
- try {
- h.characters("The quick brown fox".toCharArray(), 4, 11);
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "ignorableWhitespace",
- args = { char[].class, int.class, int.class }
- )
- public void testIgnorableWhitespace() {
- try {
- h.ignorableWhitespace(" ".toCharArray(), 4, 11);
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "processingInstruction",
- args = { String.class, String.class }
- )
- public void testProcessingInstruction() {
- try {
- h.processingInstruction("target", "data");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "warning",
- args = { org.xml.sax.SAXParseException.class }
- )
- public void testWarning() {
- try {
- h.warning(new SAXParseException("Foo", new LocatorImpl()));
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "error",
- args = { org.xml.sax.SAXParseException.class }
- )
- public void testError() {
- try {
- h.error(new SAXParseException("Foo", new LocatorImpl()));
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "fatalError",
- args = { org.xml.sax.SAXParseException.class }
- )
- public void testFatalError() {
- // Ordinary case
- try {
- h.fatalError(new SAXParseException("Foo", new LocatorImpl()));
- fail("SAXException expected");
- } catch (SAXException e) {
- // Expected
- }
-
- // No exception
- try {
- h.fatalError(null);
- fail("NullPointerException expected");
- } catch (SAXException e) {
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
-
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/InputSourceTest.java b/xml/src/test/java/tests/api/org/xml/sax/InputSourceTest.java
deleted file mode 100644
index 7c73b52..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/InputSourceTest.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.InputSource;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@TestTargetClass(InputSource.class)
-public class InputSourceTest extends TestCase {
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputSource",
- args = { }
- )
- public void testInputSource() {
- InputSource i = new InputSource();
-
- assertNull(i.getByteStream());
- assertNull(i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertNull(i.getSystemId());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputSource",
- args = { String.class }
- )
- public void testInputSourceString() {
- InputSource i = new InputSource("Foo");
-
- assertNull(i.getByteStream());
- assertNull(i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertEquals("Foo", i.getSystemId());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputSource",
- args = { InputStream.class }
- )
- public void testInputSourceInputStream() {
- ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
-
- // Ordinary case
- InputSource i = new InputSource(bais);
-
- assertEquals(bais, i.getByteStream());
- assertNull(i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertNull(i.getSystemId());
-
- // No input stream
- i = new InputSource((InputStream)null);
-
- assertNull(i.getByteStream());
- assertNull(i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertNull(i.getSystemId());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "InputSource",
- args = { Reader.class }
- )
- public void testInputSourceReader() {
- StringReader sr = new StringReader("Hello, world.");
-
- // Ordinary case
- InputSource i = new InputSource(sr);
-
- assertNull(i.getByteStream());
- assertEquals(sr, i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertNull(i.getSystemId());
-
- // No reader
- i = new InputSource((Reader)null);
-
- assertNull(i.getByteStream());
- assertNull(i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertNull(i.getSystemId());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setPublicId",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPublicId",
- args = { }
- )
- })
- public void testSetPublicIdGetPublicId() {
- InputSource i = new InputSource();
-
- i.setPublicId("Foo");
- assertEquals("Foo", i.getPublicId());
-
- i.setPublicId(null);
- assertNull(i.getPublicId());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setSystemId",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getSystemId",
- args = { }
- )
- })
- public void testSetSystemIdGetSystemId() {
- InputSource i = new InputSource();
-
- i.setSystemId("Foo");
- assertEquals("Foo", i.getSystemId());
-
- i.setSystemId(null);
- assertNull(i.getSystemId());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setByteStream",
- args = { InputStream.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getByteStream",
- args = { }
- )
- })
- public void testSetByteStreamGetByteStream() {
- ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
-
- InputSource i = new InputSource();
-
- // Ordinary case
- i.setByteStream(bais);
-
- assertEquals(bais, i.getByteStream());
-
- // No input stream
- i.setByteStream(null);
-
- assertNull(i.getByteStream());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setEncoding",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getEncoding",
- args = { }
- )
- })
- public void testSetEncodingGetEncoding() {
- InputSource i = new InputSource();
-
- // Ordinary case
- i.setEncoding("Klingon");
-
- assertEquals("Klingon", i.getEncoding());
-
- // No encoding
- i.setEncoding(null);
-
- assertNull(i.getEncoding());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setCharacterStream",
- args = { Reader.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getCharacterStream",
- args = { }
- )
- })
- public void testSetCharacterStreamGetCharacterStream() {
- StringReader sr = new StringReader("Hello, world.");
-
- InputSource i = new InputSource();
-
- // Ordinary case
- i.setCharacterStream(sr);
-
- assertNull(i.getByteStream());
- assertEquals(sr, i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertNull(i.getSystemId());
-
- // No reader
- i.setCharacterStream(null);
-
- assertNull(i.getByteStream());
- assertNull(i.getCharacterStream());
- assertNull(i.getEncoding());
- assertNull(i.getPublicId());
- assertNull(i.getSystemId());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXExceptionTest.java
deleted file mode 100644
index afc1f8d..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/SAXExceptionTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(SAXException.class)
-public class SAXExceptionTest extends TestCase {
-
- public static final String ERR = "Houston, we have a problem";
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXException",
- args = { }
- )
- public void testSAXParseException() {
- SAXException e = new SAXException();
-
- assertNull(e.getMessage());
- assertNull(e.getException());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXException",
- args = { String.class, Exception.class }
- )
- public void testSAXException_String_Exception() {
- Exception c = new Exception();
-
- // Ordinary case
- SAXException e = new SAXException(ERR, c);
-
- assertEquals(ERR, e.getMessage());
- assertEquals(c, e.getException());
-
- // No message
- e = new SAXException(null, c);
-
- assertNull(e.getMessage());
- assertEquals(c, e.getException());
-
- // No cause
- e = new SAXParseException(ERR, null);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXException",
- args = { String.class }
- )
- public void testSAXException_String() {
- // Ordinary case
- SAXException e = new SAXException(ERR);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
-
- // No message
- e = new SAXException((String)null);
-
- assertNull(e.getMessage());
- assertNull(e.getException());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXException",
- args = { Exception.class }
- )
- public void testSAXException_Exception() {
- Exception c = new Exception();
-
- // Ordinary case
- SAXException e = new SAXException(c);
-
- assertNull(e.getMessage());
- assertEquals(c, e.getException());
-
- // No cause
- e = new SAXException((Exception)null);
-
- assertNull(e.getMessage());
- assertNull(e.getException());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "toString",
- args = { }
- )
- public void testToString() {
- // Ordinary case
- SAXException e = new SAXException(ERR);
- String s = e.toString();
-
- assertTrue(s.contains(ERR));
-
- // No message
- e = new SAXException();
- s = e.toString();
-
- assertFalse(s.contains(ERR));
- }
-
-} \ No newline at end of file
diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXNotRecognizedExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXNotRecognizedExceptionTest.java
deleted file mode 100644
index 1fab7bf..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/SAXNotRecognizedExceptionTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.SAXNotRecognizedException;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(SAXNotRecognizedException.class)
-public class SAXNotRecognizedExceptionTest extends TestCase {
-
- public static final String ERR = "Houston, we have a problem";
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXNotRecognizedException",
- args = { }
- )
- public void testSAXNotRecognizedException() {
- SAXNotRecognizedException e = new SAXNotRecognizedException();
- assertNull(e.getMessage());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXNotRecognizedException",
- args = { String.class }
- )
- public void testSAXNotRecognizedException_String() {
- SAXNotRecognizedException e = new SAXNotRecognizedException(ERR);
- assertEquals(ERR, e.getMessage());
-
- e = new SAXNotRecognizedException(null);
- assertNull(e.getMessage());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXNotSupportedExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXNotSupportedExceptionTest.java
deleted file mode 100644
index 9060a14..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/SAXNotSupportedExceptionTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.SAXNotSupportedException;
-
-@TestTargetClass(SAXNotSupportedException.class)
-public class SAXNotSupportedExceptionTest extends TestCase {
-
- public static final String ERR = "Houston, we have a problem";
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXNotSupportedException",
- args = { }
- )
- public void testSAXNotSupportedException() {
- SAXNotSupportedException e = new SAXNotSupportedException();
- assertNull(e.getMessage());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXNotSupportedException",
- args = { String.class }
- )
- public void testSAXNotSupportedException_String() {
- SAXNotSupportedException e = new SAXNotSupportedException(ERR);
- assertEquals(ERR, e.getMessage());
-
- e = new SAXNotSupportedException(null);
- assertNull(e.getMessage());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/SAXParseExceptionTest.java b/xml/src/test/java/tests/api/org/xml/sax/SAXParseExceptionTest.java
deleted file mode 100644
index aff0c7f..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/SAXParseExceptionTest.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.LocatorImpl;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@TestTargetClass(SAXParseException.class)
-public class SAXParseExceptionTest extends TestCase {
-
- public static final String ERR = "Houston, we have a problem";
-
- public static final String SYS = "mySystemID";
-
- public static final String PUB = "myPublicID";
-
- public static final int ROW = 1;
-
- public static final int COL = 2;
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXParseException",
- args = { String.class, Locator.class, Exception.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getMessage",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getException",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPublicId",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getSystemId",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getLineNumber",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getColumnNumber",
- args = { }
- )
- })
- public void testSAXParseException_String_Locator_Exception() {
- LocatorImpl l = new LocatorImpl();
- l.setPublicId(PUB);
- l.setSystemId(SYS);
- l.setLineNumber(ROW);
- l.setColumnNumber(COL);
-
- Exception c = new Exception();
-
- // Ordinary case
- SAXParseException e = new SAXParseException(ERR, l, c);
-
- assertEquals(ERR, e.getMessage());
- assertEquals(c, e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No message
- e = new SAXParseException(null, l, c);
-
- assertNull(e.getMessage());
- assertEquals(c, e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No locator
- e = new SAXParseException(ERR, null, c);
-
- assertEquals(ERR, e.getMessage());
- assertEquals(c, e.getException());
-
- assertNull(e.getPublicId());
- assertNull(e.getSystemId());
- assertEquals(-1, e.getLineNumber());
- assertEquals(-1, e.getColumnNumber());
-
- // No cause
- e = new SAXParseException(ERR, l, null);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXParseException",
- args = { String.class, Locator.class }
- )
- public void testSAXParseException_String_Locator() {
- LocatorImpl l = new LocatorImpl();
- l.setPublicId(PUB);
- l.setSystemId(SYS);
- l.setLineNumber(ROW);
- l.setColumnNumber(COL);
-
- // Ordinary case
- SAXParseException e = new SAXParseException(ERR, l);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No message
- e = new SAXParseException(null, l);
-
- assertNull(e.getMessage());
- assertNull(e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No locator
- e = new SAXParseException(ERR, null);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
-
- assertNull(e.getPublicId());
- assertNull(e.getSystemId());
- assertEquals(-1, e.getLineNumber());
- assertEquals(-1, e.getColumnNumber());
-
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXParseException",
- args = { String.class, String.class, String.class, int.class, int.class,
- Exception.class }
- )
- public void testSAXParseException_String_String_String_int_int_Exception() {
- Exception c = new Exception();
-
- // Ordinary case
- SAXParseException e = new SAXParseException(ERR, PUB, SYS, ROW, COL, c);
-
- assertEquals(ERR, e.getMessage());
- assertEquals(c, e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No message
- e = new SAXParseException(null, PUB, SYS, ROW, COL, c);
-
- assertNull(e.getMessage());
- assertEquals(c, e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No locator
- e = new SAXParseException(ERR, null, null, -1, -1, c);
-
- assertEquals(ERR, e.getMessage());
- assertEquals(c, e.getException());
-
- assertNull(e.getPublicId());
- assertNull(e.getSystemId());
- assertEquals(-1, e.getLineNumber());
- assertEquals(-1, e.getColumnNumber());
-
- // No cause
- e = new SAXParseException(ERR, PUB, SYS, ROW, COL, null);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "SAXParseException",
- args = { String.class, String.class, String.class, int.class,
- int.class }
- )
- public void testSAXParseException_String_String_String_int_int() {
- // Ordinary case
- SAXParseException e = new SAXParseException(ERR, PUB, SYS, ROW, COL);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No message
- e = new SAXParseException(null, PUB, SYS, ROW, COL);
-
- assertNull(e.getMessage());
- assertNull(e.getException());
-
- assertEquals(PUB, e.getPublicId());
- assertEquals(SYS, e.getSystemId());
- assertEquals(ROW, e.getLineNumber());
- assertEquals(COL, e.getColumnNumber());
-
- // No locator
- e = new SAXParseException(ERR, null, null, -1, -1);
-
- assertEquals(ERR, e.getMessage());
- assertNull(e.getException());
-
- assertNull(e.getPublicId());
- assertNull(e.getSystemId());
- assertEquals(-1, e.getLineNumber());
- assertEquals(-1, e.getColumnNumber());
- }
-
-} \ No newline at end of file
diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/AllTests.java b/xml/src/test/java/tests/api/org/xml/sax/ext/AllTests.java
deleted file mode 100644
index f4b34b8..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/ext/AllTests.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.ext;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(AllTests.suite());
- }
-
- public static Test suite() {
- TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for org.xml.sax.ext package");
- // $JUnit-BEGIN$
-
- suite.addTestSuite(Attributes2ImplTest.class);
- suite.addTestSuite(DefaultHandler2Test.class);
- suite.addTestSuite(Locator2ImplTest.class);
-
- // $JUnit-END$
- return suite;
- }
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java
deleted file mode 100644
index 9ccdc8a..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/ext/Attributes2ImplTest.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.ext;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ext.Attributes2Impl;
-import org.xml.sax.helpers.AttributesImpl;
-
-import dalvik.annotation.KnownFailure;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(Attributes2Impl.class)
-public class Attributes2ImplTest extends TestCase {
-
- // Note: The original SAX2 implementation of Attributes2Impl is
- // severely broken. Thus all of these tests will probably fail
- // unless the Android implementation of the class gets fixed.
-
- private Attributes2Impl empty = new Attributes2Impl();
-
- private Attributes2Impl multi = new Attributes2Impl();
-
- private Attributes2Impl cdata = new Attributes2Impl();
-
- @Override
- public void setUp() {
- multi.addAttribute("http://some.uri", "foo", "ns1:foo",
- "string", "abc");
- multi.addAttribute("http://some.uri", "bar", "ns1:bar",
- "string", "xyz");
- multi.addAttribute("http://some.other.uri", "answer", "ns2:answer",
- "int", "42");
- multi.addAttribute("http://yet.another.uri", "gabba", "ns3:gabba",
- "string", "gabba");
-
- multi.setDeclared(0, false);
- multi.setSpecified(0, false);
-
- multi.setDeclared(1, true);
- multi.setSpecified(1, false);
-
- multi.setDeclared(2, false);
- multi.setSpecified(2, true);
-
- multi.setDeclared(3, true);
- multi.setSpecified(3, true);
-
- cdata.addAttribute("http://yet.another.uri", "hey", "ns3:hey",
- "CDATA", "hey");
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setAttributes",
- args = { Attributes.class }
- )
- public void testSetAttributes() {
- // Ordinary case with Attributes2Impl
- Attributes2Impl attrs = new Attributes2Impl();
- attrs.addAttribute("", "", "john", "string", "doe");
-
- attrs.setAttributes(empty);
- assertEquals(0, attrs.getLength());
-
- attrs.setAttributes(multi);
- for (int i = 0; i < multi.getLength(); i++) {
- assertEquals(multi.getURI(i), attrs.getURI(i));
- assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
- assertEquals(multi.getQName(i), attrs.getQName(i));
- assertEquals(multi.getType(i), attrs.getType(i));
- assertEquals(multi.getValue(i), attrs.getValue(i));
- assertEquals(multi.isDeclared(i), attrs.isDeclared(i));
- assertEquals(multi.isSpecified(i), attrs.isSpecified(i));
- }
-
- attrs.setAttributes(empty);
- assertEquals(0, attrs.getLength());
-
- // Ordinary case with AttributesImpl
- attrs.setAttributes(new AttributesImpl(multi));
- assertEquals(multi.getLength(), attrs.getLength());
-
- for (int i = 0; i < multi.getLength(); i++) {
- assertEquals(multi.getURI(i), attrs.getURI(i));
- assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
- assertEquals(multi.getQName(i), attrs.getQName(i));
- assertEquals(multi.getType(i), attrs.getType(i));
- assertEquals(multi.getValue(i), attrs.getValue(i));
- assertEquals(true, attrs.isDeclared(i));
- assertEquals(true, attrs.isSpecified(i));
- }
-
- // Special case with CDATA
- attrs.setAttributes(new AttributesImpl(cdata));
- assertEquals(1, attrs.getLength());
- assertEquals(false, attrs.isDeclared(0));
- assertEquals(true, attrs.isSpecified(0));
-
- // null case
- try {
- attrs.setAttributes(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "addAttribute",
- args = { String.class, String.class, String.class, String.class,
- String.class }
- )
- public void testAddAttribute() {
- Attributes2Impl attrs = new Attributes2Impl();
-
- // Ordinary case
- attrs.addAttribute("http://yet.another.uri", "doe", "john:doe",
- "string", "abc");
-
- assertEquals(1, attrs.getLength());
-
- assertEquals("http://yet.another.uri", attrs.getURI(0));
- assertEquals("doe", attrs.getLocalName(0));
- assertEquals("john:doe", attrs.getQName(0));
- assertEquals("string", attrs.getType(0));
- assertEquals("abc", attrs.getValue(0));
-
- assertEquals(true, attrs.isDeclared(0));
- assertEquals(true, attrs.isSpecified(0));
-
- // CDATA case
- attrs.addAttribute("http://yet.another.uri", "doe", "jane:doe",
- "CDATA", "abc");
-
- assertEquals(2, attrs.getLength());
-
- assertEquals("http://yet.another.uri", attrs.getURI(1));
- assertEquals("doe", attrs.getLocalName(1));
- assertEquals("jane:doe", attrs.getQName(1));
- assertEquals("CDATA", attrs.getType(1));
- assertEquals("abc", attrs.getValue(1));
-
- assertEquals(false, attrs.isDeclared(1));
- assertEquals(true, attrs.isSpecified(1));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "removeAttribute",
- args = { int.class }
- )
- public void testRemoveAttribute() {
- Attributes2Impl attrs = new Attributes2Impl(multi);
-
- // Ordinary case
- attrs.removeAttribute(1);
-
- assertEquals(3, attrs.getLength());
-
- assertEquals(multi.getURI(0), attrs.getURI(0));
- assertEquals(multi.getLocalName(0), attrs.getLocalName(0));
- assertEquals(multi.getQName(0), attrs.getQName(0));
- assertEquals(multi.getType(0), attrs.getType(0));
- assertEquals(multi.getValue(0), attrs.getValue(0));
- assertEquals(multi.isDeclared(0), attrs.isDeclared(0));
- assertEquals(multi.isSpecified(0), attrs.isSpecified(0));
-
- assertEquals(multi.getURI(2), attrs.getURI(1));
- assertEquals(multi.getLocalName(2), attrs.getLocalName(1));
- assertEquals(multi.getQName(2), attrs.getQName(1));
- assertEquals(multi.getType(2), attrs.getType(1));
- assertEquals(multi.getValue(2), attrs.getValue(1));
- assertEquals(multi.isDeclared(2), attrs.isDeclared(1));
- assertEquals(multi.isSpecified(2), attrs.isSpecified(1));
-
- // Out of range
- try {
- attrs.removeAttribute(-1);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- attrs.removeAttribute(3);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Attributes2Impl",
- args = { }
- )
- public void testAttributes2Impl() {
- assertEquals(0, empty.getLength());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Attributes2Impl",
- args = { Attributes.class }
- )
- public void testAttributes2ImplAttributes() {
- // Ordinary case with Attributes2Impl
- Attributes2Impl attrs = new Attributes2Impl(multi);
- assertEquals(multi.getLength(), attrs.getLength());
-
- for (int i = 0; i < multi.getLength(); i++) {
- assertEquals(multi.getURI(i), attrs.getURI(i));
- assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
- assertEquals(multi.getQName(i), attrs.getQName(i));
- assertEquals(multi.getType(i), attrs.getType(i));
- assertEquals(multi.getValue(i), attrs.getValue(i));
- assertEquals(multi.isDeclared(i), attrs.isDeclared(i));
- assertEquals(multi.isSpecified(i), attrs.isSpecified(i));
- }
-
- attrs = new Attributes2Impl(empty);
- assertEquals(0, attrs.getLength());
-
- // Ordinary case with AttributesImpl
- attrs = new Attributes2Impl(new AttributesImpl(multi));
- assertEquals(multi.getLength(), attrs.getLength());
-
- for (int i = 0; i < multi.getLength(); i++) {
- assertEquals(multi.getURI(i), attrs.getURI(i));
- assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
- assertEquals(multi.getQName(i), attrs.getQName(i));
- assertEquals(multi.getType(i), attrs.getType(i));
- assertEquals(multi.getValue(i), attrs.getValue(i));
- assertEquals(true, attrs.isDeclared(i));
- assertEquals(true, attrs.isSpecified(i));
- }
-
- // Special case with CDATA
- attrs = new Attributes2Impl(new AttributesImpl(cdata));
- assertEquals(1, attrs.getLength());
- assertEquals(false, attrs.isDeclared(0));
- assertEquals(true, attrs.isSpecified(0));
-
- // null case
- try {
- attrs = new Attributes2Impl(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isDeclared",
- args = { int.class }
- )
- public void testIsDeclaredInt() {
- // Ordinary cases
- assertEquals(false, multi.isDeclared(0));
- assertEquals(true, multi.isDeclared(1));
-
- // Out of range
- try {
- multi.isDeclared(-1);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.isDeclared(4);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isDeclared",
- args = { String.class, String.class }
- )
- public void testIsDeclaredStringString() {
- // Ordinary cases
- assertEquals(false, multi.isDeclared("http://some.uri", "foo"));
- assertEquals(true, multi.isDeclared("http://some.uri", "bar"));
-
- // Not found
- try {
- assertFalse(multi.isDeclared("not", "found"));
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isDeclared",
- args = { String.class }
- )
- public void testIsDeclaredString() {
- // Ordinary cases
- assertEquals(false, multi.isDeclared("ns1:foo"));
- assertEquals(true, multi.isDeclared("ns1:bar"));
-
- // Not found
- try {
- assertFalse(multi.isDeclared("notfound"));
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isSpecified",
- args = { int.class }
- )
- public void testIsSpecifiedInt() {
- // Ordinary cases
- assertEquals(false, multi.isSpecified(1));
- assertEquals(true, multi.isSpecified(2));
-
- // Out of range
- try {
- multi.isSpecified(-1);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.isSpecified(4);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isSpecified",
- args = { String.class, String.class }
- )
- public void testIsSpecifiedStringString() {
- // Ordinary cases
- assertEquals(false, multi.isSpecified("http://some.uri", "bar"));
- assertEquals(true, multi.isSpecified("http://some.other.uri", "answer"));
-
- // Not found
- try {
- assertFalse(multi.isSpecified("not", "found"));
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isSpecified",
- args = { String.class }
- )
- public void testIsSpecifiedString() {
- // Ordinary cases
- assertEquals(false, multi.isSpecified("ns1:bar"));
- assertEquals(true, multi.isSpecified("ns2:answer"));
-
- // Not found
- try {
- assertFalse(multi.isSpecified("notfound"));
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDeclared",
- args = { int.class, boolean.class }
- )
- public void testSetDeclared() {
- // Ordinary cases
- multi.setSpecified(0, false);
- assertEquals(false, multi.isSpecified(0));
-
- multi.setSpecified(0, true);
- assertEquals(true, multi.isSpecified(0));
-
- multi.setSpecified(0, false);
- assertEquals(false, multi.isSpecified(0));
-
- // Out of range
- try {
- multi.setSpecified(-1, true);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setSpecified(5, true);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setSpecified",
- args = { int.class, boolean.class }
- )
- public void testSetSpecified() {
- // Ordinary cases
- multi.setSpecified(0, false);
- assertEquals(false, multi.isSpecified(0));
-
- multi.setSpecified(0, true);
- assertEquals(true, multi.isSpecified(0));
-
- multi.setSpecified(0, false);
- assertEquals(false, multi.isSpecified(0));
-
- // Out of range
- try {
- multi.setSpecified(-1, true);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setSpecified(5, true);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/DefaultHandler2Test.java b/xml/src/test/java/tests/api/org/xml/sax/ext/DefaultHandler2Test.java
deleted file mode 100644
index 52a5972..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/ext/DefaultHandler2Test.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.ext;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.DefaultHandler2;
-
-import java.io.IOException;
-
-@TestTargetClass(DefaultHandler2.class)
-public class DefaultHandler2Test extends TestCase {
-
- private DefaultHandler2 h = new DefaultHandler2();
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "DefaultHandler2",
- args = { }
- )
- public void testDefaultHandler2() {
- new DefaultHandler2();
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startCDATA",
- args = { }
- )
- public void testStartCDATA() {
- try {
- h.startCDATA();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endCDATA",
- args = { }
- )
- public void testEndCDATA() {
- try {
- h.endCDATA();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startDTD",
- args = { String.class, String.class, String.class }
- )
- public void testStartDTD() {
- try {
- h.startDTD("name", "publicId", "systemId");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endDTD",
- args = { }
- )
- public void testEndDTD() {
- try {
- h.endDTD();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startEntity",
- args = { String.class }
- )
- public void testStartEntity() {
- try {
- h.startEntity("name");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endEntity",
- args = { String.class }
- )
- public void testEndEntity() {
- try {
- h.endEntity("name");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "comment",
- args = { char[].class, int.class, int.class }
- )
- public void testComment() {
- try {
- h.comment("<!-- Comment -->".toCharArray(), 0, 15);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "attributeDecl",
- args = { String.class, String.class, String.class, String.class,
- String.class }
- )
- public void testAttributeDecl() {
- try {
- h.attributeDecl("eName", "aName", "type", "mode", "value");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "elementDecl",
- args = { String.class, String.class }
- )
- public void testElementDecl() {
- try {
- h.elementDecl("name", "model");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "externalEntityDecl",
- args = { String.class, String.class, String.class }
- )
- public void testExternalEntityDecl() {
- try {
- h.externalEntityDecl("name", "publicId", "systemId");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "internalEntityDecl",
- args = { String.class, String.class }
- )
- public void testInternalEntityDecl() {
- try {
- h.internalEntityDecl("name", "value");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getExternalSubset",
- args = { String.class, String.class }
- )
- public void testGetExternalSubset() {
- try {
- assertNull(h.getExternalSubset("name", "http://some.uri"));
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "resolveEntity",
- args = { String.class, String.class }
- )
- public void testResolveEntityStringString() {
- try {
- assertNull(h.resolveEntity("publicId", "systemId"));
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "resolveEntity",
- args = { String.class, String.class, String.class, String.class }
- )
- public void testResolveEntityStringStringStringString() {
- try {
- assertNull(h.resolveEntity("name", "publicId", "http://some.uri",
- "systemId"));
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/ext/Locator2ImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/ext/Locator2ImplTest.java
deleted file mode 100644
index b018f59..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/ext/Locator2ImplTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.ext;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Locator;
-import org.xml.sax.ext.Locator2Impl;
-import org.xml.sax.helpers.LocatorImpl;
-
-@TestTargetClass(Locator2Impl.class)
-public class Locator2ImplTest extends TestCase {
-
- public static final String SYS = "mySystemID";
-
- public static final String PUB = "myPublicID";
-
- public static final int ROW = 1;
-
- public static final int COL = 2;
-
- public static final String ENC = "Klingon";
-
- public static final String XML = "1.0";
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Locator2Impl",
- args = { }
- )
- public void testLocatorImpl() {
- Locator2Impl l = new Locator2Impl();
-
- assertEquals(null, l.getPublicId());
- assertEquals(null, l.getSystemId());
- assertEquals(0, l.getLineNumber());
- assertEquals(0, l.getColumnNumber());
-
- assertEquals(null, l.getEncoding());
- assertEquals(null, l.getXMLVersion());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Locator2Impl",
- args = { Locator.class }
- )
- public void testLocatorImplLocator() {
- Locator2Impl inner = new Locator2Impl();
-
- inner.setPublicId(PUB);
- inner.setSystemId(SYS);
- inner.setLineNumber(ROW);
- inner.setColumnNumber(COL);
-
- inner.setEncoding(ENC);
- inner.setXMLVersion(XML);
-
- // Ordinary case
- Locator2Impl outer = new Locator2Impl(inner);
-
- assertEquals(PUB, outer.getPublicId());
- assertEquals(SYS, outer.getSystemId());
- assertEquals(ROW, outer.getLineNumber());
- assertEquals(COL, outer.getColumnNumber());
-
- assertEquals(ENC, outer.getEncoding());
- assertEquals(XML, outer.getXMLVersion());
-
- // Instance of old locator
- outer = new Locator2Impl(new LocatorImpl(inner));
-
- assertEquals(PUB, outer.getPublicId());
- assertEquals(SYS, outer.getSystemId());
- assertEquals(ROW, outer.getLineNumber());
- assertEquals(COL, outer.getColumnNumber());
-
- assertEquals(null, outer.getEncoding());
- assertEquals(null, outer.getXMLVersion());
-
- // No locator
- try {
- outer = new Locator2Impl(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setXMLVersion",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getXMLVersion",
- args = { }
- )
- })
- public void testSetXMLVersionGetXMLVersion() {
- Locator2Impl l = new Locator2Impl();
-
- l.setXMLVersion(XML);
- assertEquals(XML, l.getXMLVersion());
-
- l.setXMLVersion(null);
- assertEquals(null, l.getXMLVersion());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setEncoding",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getEncoding",
- args = { }
- )
- })
- public void testSetEncodingGetEncoding() {
- Locator2Impl l = new Locator2Impl();
-
- l.setEncoding(ENC);
- assertEquals(ENC, l.getEncoding());
-
- l.setEncoding(null);
- assertEquals(null, l.getEncoding());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/AllTests.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/AllTests.java
deleted file mode 100644
index 5bf63bf..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/AllTests.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(AllTests.suite());
- }
-
- public static Test suite() {
- TestSuite suite = tests.TestSuiteFactory.createTestSuite("Tests for org.xml.sax.helpers package");
- // $JUnit-BEGIN$
-
- suite.addTestSuite(AttributeListImplTest.class);
- suite.addTestSuite(AttributesImplTest.class);
- suite.addTestSuite(ParserFactoryTest.class);
- suite.addTestSuite(DefaultHandlerTest.class);
- suite.addTestSuite(LocatorImplTest.class);
- suite.addTestSuite(NamespaceSupportTest.class);
- suite.addTestSuite(XMLFilterImplTest.class);
- suite.addTestSuite(XMLReaderAdapterTest.class);
- suite.addTestSuite(XMLReaderFactoryTest.class);
-
- // $JUnit-END$
- return suite;
- }
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributeListImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributeListImplTest.java
deleted file mode 100644
index 00658cb..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributeListImplTest.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.AttributeList;
-import org.xml.sax.helpers.AttributeListImpl;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@SuppressWarnings("deprecation")
-@TestTargetClass(AttributeListImpl.class)
-public class AttributeListImplTest extends TestCase {
-
- private AttributeListImpl empty = new AttributeListImpl();
-
- private AttributeListImpl multi = new AttributeListImpl();
-
- @Override
- public void setUp() {
- multi.addAttribute("foo", "string", "abc");
- multi.addAttribute("bar", "string", "xyz");
- multi.addAttribute("answer", "int", "42");
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "AttributeListImpl",
- args = { }
- )
- public void testAttributeListImpl() {
- assertEquals(0, empty.getLength());
- assertEquals(3, multi.getLength());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "AttributeListImpl",
- args = { AttributeList.class }
- )
- public void testAttributeListImplAttributeList() {
- // Ordinary case
- AttributeListImpl ai = new AttributeListImpl(empty);
- assertEquals(0, ai.getLength());
-
- // Another ordinary case
- ai = new AttributeListImpl(multi);
- assertEquals(3, ai.getLength());
-
- // No Attributes
- try {
- ai = new AttributeListImpl(null);
- assertEquals(0, ai.getLength());
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setAttributeList",
- args = { AttributeList.class }
- )
- public void testSetAttributeList() {
- // Ordinary cases
- AttributeListImpl attrs = new AttributeListImpl();
- attrs.addAttribute("doe", "boolean", "false");
-
- attrs.setAttributeList(empty);
- assertEquals(0, attrs.getLength());
-
- attrs.setAttributeList(multi);
- assertEquals(multi.getLength(), attrs.getLength());
-
- for (int i = 0; i < multi.getLength(); i++) {
- assertEquals(multi.getName(i), attrs.getName(i));
- assertEquals(multi.getType(i), attrs.getType(i));
- assertEquals(multi.getValue(i), attrs.getValue(i));
- }
-
- // null case
- try {
- attrs.setAttributeList(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected, must still have old elements
- assertEquals(3, attrs.getLength());
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "addAttribute",
- args = { String.class, String.class, String.class }
- )
- public void testAddAttribute() {
- // Ordinary case
- multi.addAttribute("doe", "boolean", "false");
-
- assertEquals("doe", multi.getName(3));
- assertEquals("boolean", multi.getType(3));
- assertEquals("false", multi.getValue(3));
-
- // Duplicate case
- multi.addAttribute("doe", "boolean", "false");
-
- assertEquals("doe", multi.getName(4));
- assertEquals("boolean", multi.getType(4));
- assertEquals("false", multi.getValue(4));
-
- // null case
- multi.addAttribute(null, null, null);
- assertEquals(null, multi.getName(5));
- assertEquals(null, multi.getType(5));
- assertEquals(null, multi.getValue(5));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "removeAttribute",
- args = { String.class }
- )
- public void testRemoveAttribute() {
- // Ordinary case
- multi.removeAttribute("foo");
- assertEquals("bar", multi.getName(0));
- assertEquals("string", multi.getType(0));
- assertEquals("xyz", multi.getValue(0));
-
- // Unknown attribute
- multi.removeAttribute("john");
- assertEquals(2, multi.getLength());
-
- // null case
- multi.removeAttribute(null);
- assertEquals(2, multi.getLength());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "clear",
- args = { }
- )
- public void testClear() {
- assertEquals(3, multi.getLength());
- multi.clear();
- assertEquals(0, multi.getLength());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getLength",
- args = { }
- )
- public void testGetLength() {
- AttributeListImpl ai = new AttributeListImpl(empty);
- assertEquals(0, ai.getLength());
-
- ai = new AttributeListImpl(multi);
- assertEquals(3, ai.getLength());
-
- for (int i = 2; i >= 0; i--) {
- ai.removeAttribute(ai.getName(i));
- assertEquals(i, ai.getLength());
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getName",
- args = { int.class }
- )
- public void testGetName() {
- // Ordinary cases
- assertEquals("foo", multi.getName(0));
- assertEquals("bar", multi.getName(1));
- assertEquals("answer", multi.getName(2));
-
- // Out of range
- assertEquals(null, multi.getName(-1));
- assertEquals(null, multi.getName(3));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getType",
- args = { int.class }
- )
- public void testGetTypeInt() {
- // Ordinary cases
- assertEquals("string", multi.getType(0));
- assertEquals("string", multi.getType(1));
- assertEquals("int", multi.getType(2));
-
- // Out of range
- assertEquals(null, multi.getType(-1));
- assertEquals(null, multi.getType(3));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getValue",
- args = { int.class }
- )
- public void testGetValueInt() {
- // Ordinary cases
- assertEquals("abc", multi.getValue(0));
- assertEquals("xyz", multi.getValue(1));
- assertEquals("42", multi.getValue(2));
-
- // Out of range
- assertEquals(null, multi.getValue(-1));
- assertEquals(null, multi.getValue(5));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getType",
- args = { String.class }
- )
- public void testGetTypeString() {
- // Ordinary cases
- assertEquals("string", multi.getType("foo"));
- assertEquals("string", multi.getType("bar"));
- assertEquals("int", multi.getType("answer"));
-
- // Not found
- assertEquals(null, multi.getType("john"));
-
- // null case
- assertEquals(null, multi.getType(null));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getValue",
- args = { String.class }
- )
- public void testGetValueString() {
- // Ordinary cases
- assertEquals("abc", multi.getValue("foo"));
- assertEquals("xyz", multi.getValue("bar"));
- assertEquals("42", multi.getValue("answer"));
-
- // Not found
- assertEquals(null, multi.getValue("john"));
-
- // null case
- assertEquals(null, multi.getValue(null));
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributesImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributesImplTest.java
deleted file mode 100644
index 0efe25f..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/AttributesImplTest.java
+++ /dev/null
@@ -1,608 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.AttributesImpl;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@TestTargetClass(AttributesImpl.class)
-public class AttributesImplTest extends TestCase {
-
- private AttributesImpl empty = new AttributesImpl();
-
- private AttributesImpl multi = new AttributesImpl();
-
- @Override
- public void setUp() {
- multi.addAttribute("http://some.uri", "foo", "ns1:foo",
- "string", "abc");
- multi.addAttribute("http://some.uri", "bar", "ns1:bar",
- "string", "xyz");
- multi.addAttribute("http://some.other.uri", "answer", "ns2:answer",
- "int", "42");
-
- multi.addAttribute("", "gabbaHey", "", "string", "1-2-3-4");
- multi.addAttribute("", "", "gabba:hey", "string", "1-2-3-4");
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "AttributesImpl",
- args = { }
- )
- public void testAttributesImpl() {
- assertEquals(0, empty.getLength());
- assertEquals(5, multi.getLength());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "AttributesImpl",
- args = { Attributes.class }
- )
- public void testAttributesImplAttributes() {
- // Ordinary case
- AttributesImpl ai = new AttributesImpl(empty);
- assertEquals(0, ai.getLength());
-
- // Another ordinary case
- ai = new AttributesImpl(multi);
- assertEquals(5, ai.getLength());
-
- // No Attributes
- try {
- ai = new AttributesImpl(null);
- assertEquals(0, ai.getLength());
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getLength",
- args = { }
- )
- public void testGetLength() {
- AttributesImpl ai = new AttributesImpl(empty);
- assertEquals(0, ai.getLength());
-
- ai = new AttributesImpl(multi);
- assertEquals(5, ai.getLength());
-
- for (int i = 4; i >= 0; i--) {
- ai.removeAttribute(i);
- assertEquals(i, ai.getLength());
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getURI",
- args = { int.class }
- )
- public void testGetURI() {
- // Ordinary cases
- assertEquals("http://some.uri", multi.getURI(0));
- assertEquals("http://some.uri", multi.getURI(1));
- assertEquals("http://some.other.uri", multi.getURI(2));
- assertEquals("", multi.getURI(3));
- assertEquals("", multi.getURI(4));
-
- // Out of range
- assertEquals(null, multi.getURI(-1));
- assertEquals(null, multi.getURI(5));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getLocalName",
- args = { int.class }
- )
- public void testGetLocalName() {
- // Ordinary cases
- assertEquals("foo", multi.getLocalName(0));
- assertEquals("bar", multi.getLocalName(1));
- assertEquals("answer", multi.getLocalName(2));
- assertEquals("gabbaHey", multi.getLocalName(3));
- assertEquals("", multi.getLocalName(4));
-
- // Out of range
- assertEquals(null, multi.getLocalName(-1));
- assertEquals(null, multi.getLocalName(5));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getQName",
- args = { int.class }
- )
- public void testGetQName() {
- // Ordinary cases
- assertEquals("ns1:foo", multi.getQName(0));
- assertEquals("ns1:bar", multi.getQName(1));
- assertEquals("ns2:answer", multi.getQName(2));
- assertEquals("", multi.getQName(3));
- assertEquals("gabba:hey", multi.getQName(4));
-
- // Out of range
- assertEquals(null, multi.getQName(-1));
- assertEquals(null, multi.getQName(5));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getType",
- args = { int.class }
- )
- public void testGetTypeInt() {
- // Ordinary cases
- assertEquals("string", multi.getType(0));
- assertEquals("string", multi.getType(1));
- assertEquals("int", multi.getType(2));
- assertEquals("string", multi.getType(3));
- assertEquals("string", multi.getType(4));
-
- // Out of range
- assertEquals(null, multi.getType(-1));
- assertEquals(null, multi.getType(5));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getValue",
- args = { int.class }
- )
- public void testGetValueInt() {
- // Ordinary cases
- assertEquals("abc", multi.getValue(0));
- assertEquals("xyz", multi.getValue(1));
- assertEquals("42", multi.getValue(2));
- assertEquals("1-2-3-4", multi.getValue(3));
- assertEquals("1-2-3-4", multi.getValue(4));
-
- // Out of range
- assertEquals(null, multi.getValue(-1));
- assertEquals(null, multi.getValue(5));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getIndex",
- args = { String.class, String.class }
- )
- public void testGetIndexStringString() {
- // Ordinary cases
- assertEquals(0, multi.getIndex("http://some.uri", "foo"));
- assertEquals(1, multi.getIndex("http://some.uri", "bar"));
- assertEquals(2, multi.getIndex("http://some.other.uri", "answer"));
-
- // Not found
- assertEquals(-1, multi.getIndex("john", "doe"));
-
- // null cases
- assertEquals(-1, multi.getIndex("http://some.uri", null));
- assertEquals(-1, multi.getIndex(null, "foo"));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getIndex",
- args = { String.class }
- )
- public void testGetIndexString() {
- // Ordinary cases
- assertEquals(0, multi.getIndex("ns1:foo"));
- assertEquals(1, multi.getIndex("ns1:bar"));
- assertEquals(2, multi.getIndex("ns2:answer"));
- assertEquals(4, multi.getIndex("gabba:hey"));
-
- // Not found
- assertEquals(-1, multi.getIndex("john:doe"));
-
- // null case
- assertEquals(-1, multi.getIndex(null));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getType",
- args = { String.class, String.class }
- )
- public void testGetTypeStringString() {
- // Ordinary cases
- assertEquals("string", multi.getType("http://some.uri", "foo"));
- assertEquals("string", multi.getType("http://some.uri", "bar"));
- assertEquals("int", multi.getType("http://some.other.uri", "answer"));
-
- // Not found
- assertEquals(null, multi.getType("john", "doe"));
-
- // null cases
- assertEquals(null, multi.getType("http://some.uri", null));
- assertEquals(null, multi.getType(null, "foo"));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getType",
- args = { String.class }
- )
- public void testGetTypeString() {
- // Ordinary cases
- assertEquals("string", multi.getType("ns1:foo"));
- assertEquals("string", multi.getType("ns1:bar"));
- assertEquals("int", multi.getType("ns2:answer"));
- assertEquals("string", multi.getType("gabba:hey"));
-
- // Not found
- assertEquals(null, multi.getType("john:doe"));
-
- // null case
- assertEquals(null, multi.getType(null));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getValue",
- args = { String.class, String.class }
- )
- public void testGetValueStringString() {
- // Ordinary cases
- assertEquals("abc", multi.getValue("http://some.uri", "foo"));
- assertEquals("xyz", multi.getValue("http://some.uri", "bar"));
- assertEquals("42", multi.getValue("http://some.other.uri", "answer"));
-
- // Not found
- assertEquals(null, multi.getValue("john", "doe"));
-
- // null cases
- assertEquals(null, multi.getValue("http://some.uri", null));
- assertEquals(null, multi.getValue(null, "foo"));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getValue",
- args = { String.class }
- )
- public void testGetValueString() {
- // Ordinary cases
- assertEquals("abc", multi.getValue("ns1:foo"));
- assertEquals("xyz", multi.getValue("ns1:bar"));
- assertEquals("42", multi.getValue("ns2:answer"));
- assertEquals("1-2-3-4", multi.getValue("gabba:hey"));
-
- // Not found
- assertEquals(null, multi.getValue("john:doe"));
-
- // null case
- assertEquals(null, multi.getValue(null));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "clear",
- args = { }
- )
- public void testClear() {
- assertEquals(5, multi.getLength());
- multi.clear();
- assertEquals(0, multi.getLength());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setAttributes",
- args = { Attributes.class }
- )
- public void testSetAttributes() {
- // Ordinary cases
- AttributesImpl attrs = new AttributesImpl();
- attrs.addAttribute("http://yet.another.uri", "doe", "john:doe",
- "boolean", "false");
-
- attrs.setAttributes(empty);
- assertEquals(0, attrs.getLength());
-
- attrs.setAttributes(multi);
- assertEquals(multi.getLength(), attrs.getLength());
-
- for (int i = 0; i < multi.getLength(); i++) {
- assertEquals(multi.getURI(i), attrs.getURI(i));
- assertEquals(multi.getLocalName(i), attrs.getLocalName(i));
- assertEquals(multi.getQName(i), attrs.getQName(i));
- assertEquals(multi.getType(i), attrs.getType(i));
- assertEquals(multi.getValue(i), attrs.getValue(i));
- }
-
- // null case
- try {
- attrs.setAttributes(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected, but must be empty now
- assertEquals(0, attrs.getLength());
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "addAttribute",
- args = { String.class, String.class, String.class, String.class,
- String.class }
- )
- public void testAddAttribute() {
- // Ordinary case
- multi.addAttribute("http://yet.another.uri", "doe", "john:doe",
- "boolean", "false");
-
- assertEquals("http://yet.another.uri", multi.getURI(5));
- assertEquals("doe", multi.getLocalName(5));
- assertEquals("john:doe", multi.getQName(5));
- assertEquals("boolean", multi.getType(5));
- assertEquals("false", multi.getValue(5));
-
- // Duplicate case
- multi.addAttribute("http://yet.another.uri", "doe", "john:doe",
- "boolean", "false");
-
- assertEquals("http://yet.another.uri", multi.getURI(6));
- assertEquals("doe", multi.getLocalName(6));
- assertEquals("john:doe", multi.getQName(6));
- assertEquals("boolean", multi.getType(6));
- assertEquals("false", multi.getValue(6));
-
- // null case
- multi.addAttribute(null, null, null, null, null);
- assertEquals(null, multi.getURI(7));
- assertEquals(null, multi.getLocalName(7));
- assertEquals(null, multi.getQName(7));
- assertEquals(null, multi.getType(7));
- assertEquals(null, multi.getValue(7));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setAttribute",
- args = { int.class, String.class, String.class, String.class,
- String.class, String.class }
- )
- public void testSetAttribute() {
- // Ordinary case
- multi.setAttribute(0, "http://yet.another.uri", "doe", "john:doe",
- "boolean", "false");
- assertEquals("http://yet.another.uri", multi.getURI(0));
- assertEquals("doe", multi.getLocalName(0));
- assertEquals("john:doe", multi.getQName(0));
- assertEquals("boolean", multi.getType(0));
- assertEquals("false", multi.getValue(0));
-
- // null case
- multi.setAttribute(1, null, null, null, null, null);
- assertEquals(null, multi.getURI(1));
- assertEquals(null, multi.getLocalName(1));
- assertEquals(null, multi.getQName(1));
- assertEquals(null, multi.getType(1));
- assertEquals(null, multi.getValue(1));
-
- // Out of range
- try {
- multi.setAttribute(-1, "http://yet.another.uri", "doe", "john:doe",
- "boolean", "false");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setAttribute(5, "http://yet.another.uri", "doe", "john:doe",
- "boolean", "false");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "removeAttribute",
- args = { int.class }
- )
- public void testRemoveAttribute() {
- // Ordinary case
- multi.removeAttribute(0);
- assertEquals("http://some.uri", multi.getURI(0));
- assertEquals("bar", multi.getLocalName(0));
- assertEquals("ns1:bar", multi.getQName(0));
- assertEquals("string", multi.getType(0));
- assertEquals("xyz", multi.getValue(0));
-
- // Out of range
- try {
- multi.removeAttribute(-1);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.removeAttribute(4);
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setURI",
- args = { int.class, String.class }
- )
- public void testSetURI() {
- // Ordinary case
- multi.setURI(0, "http://yet.another.uri");
- assertEquals("http://yet.another.uri", multi.getURI(0));
-
- // null case
- multi.setURI(1, null);
- assertEquals(null, multi.getURI(1));
-
- // Out of range
- try {
- multi.setURI(-1, "http://yet.another.uri");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setURI(5, "http://yet.another.uri");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setLocalName",
- args = { int.class, String.class }
- )
- public void testSetLocalName() {
- // Ordinary case
- multi.setLocalName(0, "john");
- assertEquals("john", multi.getLocalName(0));
-
- // null case
- multi.setLocalName(1, null);
- assertEquals(null, multi.getLocalName(1));
-
- // Out of range
- try {
- multi.setLocalName(-1, "john");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setLocalName(5, "john");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setQName",
- args = { int.class, String.class }
- )
- public void testSetQName() {
- // Ordinary case
- multi.setQName(0, "john:doe");
- assertEquals("john:doe", multi.getQName(0));
-
- // null case
- multi.setQName(1, null);
- assertEquals(null, multi.getQName(1));
-
- // Out of range
- try {
- multi.setQName(-1, "john:doe");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setQName(5, "john:doe");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setType",
- args = { int.class, String.class }
- )
- public void testSetType() {
- // Ordinary case
- multi.setType(0, "float");
- assertEquals("float", multi.getType(0));
-
- // null case
- multi.setType(1, null);
- assertEquals(null, multi.getType(1));
-
- // Out of range
- try {
- multi.setType(-1, "float");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setType(5, "float");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setValue",
- args = { int.class, String.class }
- )
- public void testSetValue() {
- // Ordinary case
- multi.setValue(0, "too much");
- assertEquals("too much", multi.getValue(0));
-
- // null case
- multi.setValue(1, null);
- assertEquals(null, multi.getValue(1));
-
- // Out of range
- try {
- multi.setValue(-1, "too much");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
-
- try {
- multi.setValue(5, "too much");
- fail("ArrayIndexOutOfBoundsException expected");
- } catch (ArrayIndexOutOfBoundsException e) {
- // Expected
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/DefaultHandlerTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/DefaultHandlerTest.java
deleted file mode 100644
index 527048f..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/DefaultHandlerTest.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.LocatorImpl;
-
-import java.io.IOException;
-
-@TestTargetClass(DefaultHandler.class)
-public class DefaultHandlerTest extends TestCase {
-
- /*
- * Note: most of the tests have to check for an empty implementation of the
- * respective methods and, as a result, are somewhat trivial.
- */
-
- private DefaultHandler h = new DefaultHandler();
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "resolveEntity",
- args = { String.class, String.class }
- )
- public void testResolveEntity() {
- try {
- h.resolveEntity("publicID", "systemID");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "notationDecl",
- args = { String.class, String.class, String.class }
- )
- public void testNotationDecl() {
- try {
- h.notationDecl("name", "publicID", "systemID");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "unparsedEntityDecl",
- args = { String.class, String.class, String.class, String.class }
- )
- public void testUnparsedEntityDecl() {
- try {
- h.unparsedEntityDecl("name", "publicID", "systemID",
- "notationName");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDocumentLocator",
- args = { org.xml.sax.Locator.class }
- )
- public void testSetDocumentLocator() {
- h.setDocumentLocator(new LocatorImpl());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startDocument",
- args = { }
- )
- public void testStartDocument() {
- try {
- h.startDocument();
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endDocument",
- args = { }
- )
- public void testEndDocument() {
- try {
- h.endDocument();
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startPrefixMapping",
- args = { String.class, String.class }
- )
- public void testStartPrefixMapping() {
- try {
- h.startPrefixMapping("prefix", "uri");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endPrefixMapping",
- args = { String.class }
- )
- public void testEndPrefixMapping() {
- try {
- h.endPrefixMapping("prefix");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startElement",
- args = { String.class, String.class, String.class,
- Attributes.class }
- )
- public void testStartElement() {
- try {
- h.startElement("uri", "name", "qname", new AttributesImpl());
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endElement",
- args = { String.class, String.class, String.class }
- )
- public void testEndElement() {
- try {
- h.endElement("uri", "name", "qname");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "characters",
- args = { char[].class, int.class, int.class }
- )
- public void testCharacters() {
- try {
- h.characters("The quick brown fox".toCharArray(), 4, 11);
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "ignorableWhitespace",
- args = { char[].class, int.class, int.class }
- )
- public void testIgnorableWhitespace() {
- try {
- h.ignorableWhitespace(" ".toCharArray(), 4, 11);
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "processingInstruction",
- args = { String.class, String.class }
- )
- public void testProcessingInstruction() {
- try {
- h.processingInstruction("target", "data");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "skippedEntity",
- args = { String.class }
- )
- public void testSkippedEntity() {
- try {
- h.skippedEntity("name");
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "warning",
- args = { org.xml.sax.SAXParseException.class }
- )
- public void testWarning() {
- try {
- h.warning(new SAXParseException("Foo", new LocatorImpl()));
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "error",
- args = { org.xml.sax.SAXParseException.class }
- )
- public void testError() {
- try {
- h.error(new SAXParseException("Foo", new LocatorImpl()));
- } catch (SAXException e) {
- throw new RuntimeException(e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "fatalError",
- args = { org.xml.sax.SAXParseException.class }
- )
- public void testFatalError() {
- // Ordinary case
- try {
- h.fatalError(new SAXParseException("Foo", new LocatorImpl()));
- fail("SAXException expected");
- } catch (SAXException e) {
- // Expected
- }
-
- // No exception
- try {
- h.fatalError(null);
- fail("NullPointerException expected");
- } catch (SAXException e) {
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
-
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/LocatorImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/LocatorImplTest.java
deleted file mode 100644
index e6b243c..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/LocatorImplTest.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Locator;
-import org.xml.sax.helpers.LocatorImpl;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@TestTargetClass(LocatorImpl.class)
-public class LocatorImplTest extends TestCase {
-
- public static final String SYS = "mySystemID";
-
- public static final String PUB = "myPublicID";
-
- public static final int ROW = 1;
-
- public static final int COL = 2;
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "LocatorImpl",
- args = { }
- )
- public void testLocatorImpl() {
- LocatorImpl l = new LocatorImpl();
-
- assertEquals(null, l.getPublicId());
- assertEquals(null, l.getSystemId());
- assertEquals(0, l.getLineNumber());
- assertEquals(0, l.getColumnNumber());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "LocatorImpl",
- args = { Locator.class }
- )
- public void testLocatorImplLocator() {
- LocatorImpl inner = new LocatorImpl();
-
- inner.setPublicId(PUB);
- inner.setSystemId(SYS);
- inner.setLineNumber(ROW);
- inner.setColumnNumber(COL);
-
- // Ordinary case
- LocatorImpl outer = new LocatorImpl(inner);
-
- assertEquals(PUB, outer.getPublicId());
- assertEquals(SYS, outer.getSystemId());
- assertEquals(ROW, outer.getLineNumber());
- assertEquals(COL, outer.getColumnNumber());
-
- // No locator
- try {
- outer = new LocatorImpl(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setPublicId",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPublicId",
- args = { }
- )
- })
- public void testSetPublicIdGetPublicId() {
- LocatorImpl l = new LocatorImpl();
-
- l.setPublicId(PUB);
- assertEquals(PUB, l.getPublicId());
-
- l.setPublicId(null);
- assertEquals(null, l.getPublicId());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setSystemId",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getSystemId",
- args = { }
- )
- })
- public void testSetSystemIdGetSystemId() {
- LocatorImpl l = new LocatorImpl();
-
- l.setSystemId(SYS);
- assertEquals(SYS, l.getSystemId());
-
- l.setSystemId(null);
- assertEquals(null, l.getSystemId());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setLineNumber",
- args = { int.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getLineNumber",
- args = { }
- )
- })
- public void testSetLineNumberGetLineNumber() {
- LocatorImpl l = new LocatorImpl();
-
- l.setLineNumber(ROW);
- assertEquals(ROW, l.getLineNumber());
-
- l.setLineNumber(0);
- assertEquals(0, l.getLineNumber());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setColumnNumber",
- args = { int.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getColumnNumber",
- args = { }
- )
- })
- public void testSetColumnNumberGetColumnNumber() {
- LocatorImpl l = new LocatorImpl();
-
- l.setColumnNumber(COL);
- assertEquals(COL, l.getColumnNumber());
-
- l.setColumnNumber(0);
- assertEquals(0, l.getColumnNumber());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/NamespaceSupportTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/NamespaceSupportTest.java
deleted file mode 100644
index b163b54..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/NamespaceSupportTest.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.EmptyStackException;
-import java.util.Enumeration;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.helpers.NamespaceSupport;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@TestTargetClass(
- value = NamespaceSupport.class,
- untestedMethods = {
- }
-)
-public class NamespaceSupportTest extends TestCase {
-
- final static String defaultUri = "http://www.android.com";
- final static String marketUri = "http://www.android.com/market";
-
- NamespaceSupport ns;
- ArrayList<String> expected;
-
- @Override
- public void setUp() {
- expected = new ArrayList<String>();
- expected.add("ak");
- expected.add("bk");
-
- ns = new NamespaceSupport();
- ns.pushContext();
-
- ns.declarePrefix("ak", marketUri);
- ns.declarePrefix("bk", marketUri);
- ns.declarePrefix("", defaultUri);
- }
-
- @SuppressWarnings("unchecked")
- @TestTargets ({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "Checks that a new NamespaceSupport object contains a " +
- "default context with two predefined prefixes.",
- method = "NamespaceSupport",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "popContext",
- args = {}
- )
- })
- public void testConstructor() {
- String prefix;
- boolean xmlPrefixExists = false;
-
- ns = new NamespaceSupport();
- Enumeration<String> prefixes = ns.getDeclaredPrefixes();
-
- while (prefixes.hasMoreElements()) {
- prefix = prefixes.nextElement();
- if (prefix.equals("xml")) xmlPrefixExists = true;
- }
-
- assertTrue("Test 1: xml prefix does not exist.", xmlPrefixExists);
-
- // Check that only one context has been created by the constructor.
- try {
- ns.popContext();
- fail("Test 2: EmptyStackException expected.");
- } catch (EmptyStackException e) {
- // Expected.
- }
- }
-
- @TestTargets ({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "pushContext",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "popContext",
- args = {}
- )
- })
- public void testPush_PopContext() {
- int count;
-
- ns = new NamespaceSupport();
- count = countPrefixes();
-
- ns.pushContext();
- ns.declarePrefix("dc", "http://www.purl.org/dc#");
- assertEquals("Test 1: Incorrect prefix count;",
- count + 1, countPrefixes());
-
- ns.popContext();
- assertEquals("Test 2: Incorrect prefix count;",
- count, countPrefixes());
-
- // Check that only one context has been created by pushContext().
- try {
- ns.popContext();
- fail("Test 3: EmptyStackException expected.");
- } catch (EmptyStackException e) {
- // Expected.
- }
- }
-
- @TestTargets ({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "reset",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "popContext",
- args = {}
- )
- })
- public void testReset() {
- int count;
-
- ns = new NamespaceSupport();
- count = countPrefixes();
-
- ns.pushContext();
- ns.declarePrefix("dc", "http://www.purl.org/dc#");
-
- assertEquals("Test 1: Incorrect prefix count;",
- count + 1, countPrefixes());
-
- ns.reset();
- assertEquals("Test 2: Incorrect prefix count;",
- count, countPrefixes());
-
- // Check that only one context has been created by reset().
- try {
- ns.popContext();
- fail("Test 3: EmptyStackException expected.");
- } catch (EmptyStackException e) {
- // Expected.
- }
- }
-
- @TestTargets ({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "declarePrefix",
- args = {String.class, String.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPrefix",
- args = {String.class}
- )
- })
- public void testDeclare_GetPrefix() {
- ns.pushContext();
-
- // Part 1: Check that xml and xmlns are not accepted as prefixes.
- assertFalse("Test 1: Invalid prefix accepted.",
- ns.declarePrefix("xml", marketUri));
-
- assertFalse("Test 2: Invalid prefix accepted.",
- ns.declarePrefix("xmlns", marketUri));
-
- // Part 2: Check that declarePrefix and getPrefix work for valid
- // prefixes.
- assertTrue("Test 3: Valid prefix not accepted.",
- ns.declarePrefix("ak", marketUri));
-
- assertTrue("Test 4: Incorrect prefix returned.",
- ns.getPrefix(marketUri).equals("ak"));
-
- assertTrue("Test 5: Valid prefix not accepted.",
- ns.declarePrefix("bk", marketUri));
-
- assertTrue("Test 6: Incorrect prefix returned.",
- expected.contains(ns.getPrefix(marketUri)));
-
- assertTrue("Test 7: Valid prefix not accepted.",
- ns.declarePrefix("", defaultUri));
-
- // Part 3: Negative Tests for getPrefix.
- assertNull("Test 8: Non-null value returned for the URI that is " +
- "assigned to the default namespace.",
- ns.getPrefix(defaultUri));
-
- assertNull("Test 9: Non-null value returned for an unassigned URI.",
- ns.getPrefix(defaultUri + "/42"));
- }
-
- @SuppressWarnings("unchecked")
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPrefixes",
- args = {String.class}
- )
- public void testGetPrefixesLjava_lang_String() {
- ArrayList<String> prefixes;
-
- prefixes = Collections.list(ns.getPrefixes(marketUri));
- assertTrue("Test 1: Incorrect set of prefixes returned.",
- expected.containsAll(prefixes) && prefixes.containsAll(expected));
-
- prefixes = Collections.list(ns.getPrefixes(defaultUri));
- assertTrue("Test 2: Default namespace prefix should not be returned.",
- prefixes.size() == 0);
-
- prefixes = Collections.list(ns.getPrefixes(NamespaceSupport.XMLNS));
- assertTrue("Test 3: xml prefix is missing.",
- prefixes.contains("xml") && prefixes.size() == 1);
-
- prefixes = Collections.list(ns.getPrefixes(defaultUri + "/42"));
- assertTrue("Test 4: Non-empty enumeration returned for an unassigned URI.",
- prefixes.size() == 0);
- }
-
- @SuppressWarnings("unchecked")
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getPrefixes",
- args = {}
- )
- public void testGetPrefixes() {
- ArrayList<String> prefixes;
-
- expected.add("xml");
-
- prefixes = Collections.list(ns.getPrefixes());
- assertTrue("Test 1: Incorrect set of prefixes returned.",
- expected.containsAll(prefixes) && prefixes.containsAll(expected));
- }
-
- @SuppressWarnings("unchecked")
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getDeclaredPrefixes",
- args = {}
- )
- public void testGetDeclaredPrefixes() {
- ArrayList<String> prefixes;
-
- expected.add("");
-
- prefixes = Collections.list(ns.getDeclaredPrefixes());
- assertTrue("Test 1: Incorrect set of prefixes returned.",
- expected.containsAll(prefixes) && prefixes.containsAll(expected));
- }
-
- @TestTargets ({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getURI",
- args = {String.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "popContext",
- args = {}
- )
- })
- public void testGetUri() {
- assertEquals("Test 1: Incorrect URI returned;",
- marketUri, ns.getURI("bk"));
- assertEquals("Test 2: Incorrect URI returned;",
- defaultUri, ns.getURI(""));
- assertNull("Test 3: Null expected for not-existing prefix.",
- ns.getURI("ck"));
-
- ns.popContext();
- assertNull("Test 4: Null expected for not-existing prefix.",
- ns.getURI("bk"));
- assertEquals("Test 5: Incorrect URI returned;",
- NamespaceSupport.XMLNS, ns.getURI("xml"));
- }
-
- @TestTargets ({
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "setNamespaceDeclUris",
- args = {boolean.class}
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "isNamespaceDeclUris",
- args = {}
- )
- })
- public void testNamespaceDeclUris() {
-
- assertFalse("Test 1: Incorrect default value returned by isNamespaceDeclUris().",
- ns.isNamespaceDeclUris());
-
- try {
- ns.setNamespaceDeclUris(true);
- fail("Test 2: IllegalStateException expected since a context has already been pushed in setUp().");
- } catch (IllegalStateException e) {
- // Expected.
- }
-
- ns = new NamespaceSupport();
- ns.setNamespaceDeclUris(true);
- assertTrue("Test 3: Incorrect value returned by isNamespaceDeclUris().",
- ns.isNamespaceDeclUris());
-
- ns.setNamespaceDeclUris(false);
- assertFalse("Test 4: Incorrect value returned by isNamespaceDeclUris().",
- ns.isNamespaceDeclUris());
- }
-
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "processName",
- args = {String.class, String[].class, boolean.class}
- )
- public void testProcessName_Element() {
- String[] parts = new String[3];
-
- assertNotNull("Test 1: Non-null value expected.",
- ns.processName("ak:hello", parts, false));
- assertEquals("Test 2: Incorrect namespace URI;", marketUri, parts[0]);
- assertEquals("Test 3: Incorrect local name;", "hello", parts[1]);
- assertEquals("Test 4: Incorrect raw name;", "ak:hello", parts[2]);
-
- assertNotNull("Test 5: Non-null value expected.",
- ns.processName("bk:", parts, false));
- assertEquals("Test 6: Incorrect namespace URI;", marketUri, parts[0]);
- assertEquals("Test 7: Incorrect local name;", "", parts[1]);
- assertEquals("Test 8: Incorrect raw name;", "bk:", parts[2]);
-
- assertNotNull("Test 9: Non-null value expected.",
- ns.processName("world", parts, false));
- assertEquals("Test 10: Incorrect namespace URI;", defaultUri, parts[0]);
- assertEquals("Test 11: Incorrect local name;", "world", parts[1]);
- assertEquals("Test 12: Incorrect raw name;", "world", parts[2]);
-
- assertNull("Test 13: Null expected for undeclared prefix.",
- ns.processName("ck:lorem", parts, false));
-
- assertNull("Test 14: Null expected for xmlns prefix.",
- ns.processName("xmlns:ipsum", parts, false));
-
- ns = new NamespaceSupport();
- ns.pushContext();
- assertNotNull("Test 15: Non-null value expected.",
- ns.processName("world", parts, false));
- assertEquals("Test 16: Incorrect namespace URI;", "", parts[0]);
- assertEquals("Test 17: Incorrect local name;", "world", parts[1]);
- assertEquals("Test 18: Incorrect raw name;", "world", parts[2]);
- }
-
- @TestTargets ({
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "setNamespaceDeclUris",
- args = {boolean.class}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- method = "processName",
- args = {String.class, String[].class, boolean.class}
- )
- })
- public void testProcessName_Attribute() {
- String[] parts = new String[3];
-
- assertNotNull("Test 1: Non-null value expected.",
- ns.processName("ak:hello", parts, true));
- assertEquals("Test 2: Incorrect namespace URI;", marketUri, parts[0]);
- assertEquals("Test 3: Incorrect local name;", "hello", parts[1]);
- assertEquals("Test 4: Incorrect raw name;", "ak:hello", parts[2]);
-
- assertNotNull("Test 5: Non-null value expected.",
- ns.processName("bk:", parts, true));
- assertEquals("Test 6: Incorrect namespace URI;", marketUri, parts[0]);
- assertEquals("Test 7: Incorrect local name;", "", parts[1]);
- assertEquals("Test 8: Incorrect raw name;", "bk:", parts[2]);
-
- assertNotNull("Test 9: Non-null value expected.",
- ns.processName("world", parts, true));
- assertEquals("Test 10: Incorrect namespace URI;", "", parts[0]);
- assertEquals("Test 11: Incorrect local name;", "world", parts[1]);
- assertEquals("Test 12: Incorrect raw name;", "world", parts[2]);
-
- assertNull("Test 13: Null expected for undeclared prefix.",
- ns.processName("ck:lorem", parts, true));
-
- assertNull("Test 14: Null expected for xmlns prefix.",
- ns.processName("xmlns:ipsum", parts, true));
-
- ns = new NamespaceSupport();
- ns.setNamespaceDeclUris(true);
- ns.pushContext();
- assertNotNull("Test 15: Non-null value expected.",
- ns.processName("xmlns", parts, true));
- assertEquals("Test 16: Incorrect namespace URI;", NamespaceSupport.NSDECL, parts[0]);
- assertEquals("Test 17: Incorrect local name;", "xmlns", parts[1]);
- assertEquals("Test 18: Incorrect raw name;", "xmlns", parts[2]);
- }
-
- @SuppressWarnings("unchecked")
- private int countPrefixes()
- {
- ArrayList<String> prefixes = Collections.list(ns.getPrefixes());
- return prefixes.size();
- }
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserAdapterTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserAdapterTest.java
deleted file mode 100644
index 27a7e78..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserAdapterTest.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.AttributeList;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.helpers.AttributeListImpl;
-import org.xml.sax.helpers.LocatorImpl;
-import org.xml.sax.helpers.ParserAdapter;
-
-import tests.api.org.xml.sax.support.MethodLogger;
-import tests.api.org.xml.sax.support.MockHandler;
-import tests.api.org.xml.sax.support.MockParser;
-import tests.api.org.xml.sax.support.MockResolver;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@SuppressWarnings("deprecation")
-@TestTargetClass(ParserAdapter.class)
-public class ParserAdapterTest extends TestCase {
-
- // Note: In many cases we can only test that delegation works
- // properly. The rest is outside the scope of the specification.
-
- private final static String FEATURES = "http://xml.org/sax/features/";
-
- private final static String NAMESPACES = FEATURES + "namespaces";
-
- private final static String NAMESPACE_PREFIXES = FEATURES
- + "namespace-prefixes";
-
- private final static String XMLNS_URIs = FEATURES + "xmlns-uris";
-
- private MethodLogger logger = new MethodLogger();
-
- private MockHandler handler = new MockHandler(logger);
-
- private Parser parser = new MockParser(logger);
-
- private ParserAdapter adapter = new ParserAdapter(parser);
-
- private void assertEquals(Object[] a, Object[] b) {
- assertEquals(a.length, b.length);
-
- for (int i = 0; i < a.length; i++) {
- assertEquals("Element #" + i + " must be equal", a[i], b[i]);
- }
- }
-
- @Override
- public void setUp() {
- adapter.setContentHandler(handler);
- adapter.setDTDHandler(handler);
- adapter.setErrorHandler(handler);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "ParserAdapter",
- args = { }
- )
- public void testParserAdapter() {
- System.setProperty("org.xml.sax.parser",
- "tests.api.org.xml.sax.support.DoNothingParser");
-
- try {
- new ParserAdapter();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "ParserAdapter",
- args = { Parser.class }
- )
- public void testParserAdapterParser() {
- // Ordinary case
- @SuppressWarnings("unused")
- ParserAdapter adapter = new ParserAdapter(parser);
-
- // Null case
- try {
- adapter = new ParserAdapter(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getFeature",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setFeature",
- args = { String.class, boolean.class }
- )
- })
- public void testGetSetFeature() {
- String[] features = new String[] { NAMESPACES, NAMESPACE_PREFIXES,
- XMLNS_URIs };
-
- for (String s: features) {
- try {
- adapter.setFeature(s, true);
- assertEquals(true, adapter.getFeature(s));
-
- adapter.setFeature(s, false);
- assertEquals(false, adapter.getFeature(s));
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- try {
- adapter.setFeature("http://argle.bargle", true);
- fail("SAXNotRecognizedException expected");
- } catch (SAXNotRecognizedException e) {
- // Expected
- } catch (SAXNotSupportedException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getProperty",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setProperty",
- args = { String.class, Object.class }
- )
- })
- public void testGetSetProperty() {
- try {
- adapter.setProperty("http://argle.bargle", ":)");
- fail("SAXNotRecognizedException expected");
- } catch (SAXNotRecognizedException e) {
- // Expected
- } catch (SAXNotSupportedException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- try {
- adapter.getProperty("http://argle.bargle");
- fail("SAXNotRecognizedException expected");
- } catch (SAXNotRecognizedException e) {
- // Expected
- } catch (SAXNotSupportedException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getEntityResolver",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setEntityResolver",
- args = { EntityResolver.class }
- )
- })
- public void testGetSetEntityResolver() {
- EntityResolver resolver = new MockResolver();
-
- adapter.setEntityResolver(resolver);
- assertEquals(resolver, adapter.getEntityResolver());
-
- adapter.setEntityResolver(null);
- assertEquals(null, adapter.getEntityResolver());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getDTDHandler",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDTDHandler",
- args = { DTDHandler.class }
- )
- })
- public void testGetSetDTDHandler() {
- adapter.setDTDHandler(null);
- assertEquals(null, adapter.getDTDHandler());
-
- adapter.setDTDHandler(handler);
- assertEquals(handler, adapter.getDTDHandler());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getContentHandler",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setContentHandler",
- args = { ContentHandler.class }
- )
- })
- public void testGetSetContentHandler() {
- adapter.setContentHandler(null);
- assertEquals(null, adapter.getContentHandler());
-
- adapter.setContentHandler(handler);
- assertEquals(handler, adapter.getContentHandler());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getErrorHandler",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setErrorHandler",
- args = { ErrorHandler.class }
- )
- })
- public void testGetSetErrorHandler() {
- adapter.setErrorHandler(null);
- assertEquals(null, adapter.getErrorHandler());
-
- adapter.setErrorHandler(handler);
- assertEquals(handler, adapter.getErrorHandler());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "parse",
- args = { String.class }
- )
- public void testParseString() {
- try {
- adapter.parse("foo");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // The SAX RI creates an InputSource itself and then delegates to the
- // "other" parse method.
- assertEquals("parse", logger.getMethod());
- assertEquals(InputSource.class, logger.getArgs()[0].getClass());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "parse",
- args = { InputSource.class }
- )
- public void testParseInputSource() {
- InputSource source = new InputSource("foo");
-
- try {
- adapter.parse(source);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals("parse", logger.getMethod());
- assertEquals(new Object[] { source }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDocumentLocator",
- args = { Locator.class }
- )
- public void testSetDocumentLocator() {
- Locator l = new LocatorImpl();
-
- adapter.setDocumentLocator(l);
-
- assertEquals(logger.size(), 1);
- assertEquals("setDocumentLocator", logger.getMethod());
- assertEquals(new Object[] { l }, logger.getArgs());
-
- adapter.setDocumentLocator(null);
-
- assertEquals(logger.size(), 2);
- assertEquals("setDocumentLocator", logger.getMethod());
- assertEquals(new Object[] { null }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startDocument",
- args = { }
- )
- public void testStartDocument() {
- try {
- adapter.startDocument();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("startDocument", logger.getMethod());
- assertEquals(new Object[] {}, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endDocument",
- args = { }
- )
- public void testEndDocument() {
- try {
- adapter.endDocument();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("endDocument", logger.getMethod());
- assertEquals(new Object[] {}, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startElement",
- args = { String.class, AttributeList.class }
- )
- public void testStartElement() {
- AttributeListImpl atts = new AttributeListImpl();
- atts.addAttribute("john:doe", "int", "42");
-
- try {
- adapter.startDocument();
- adapter.startElement("foo:bar", atts);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals("startElement", logger.getMethod());
- assertEquals("", logger.getArgs()[0]);
- assertEquals("", logger.getArgs()[1]);
- assertEquals("foo:bar", logger.getArgs()[2]);
- assertEquals("john:doe", ((Attributes)logger.getArgs()[3]).getQName(0));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endElement",
- args = { String.class }
- )
- public void testEndElement() {
- AttributeListImpl atts = new AttributeListImpl();
- atts.addAttribute("john:doe", "int", "42");
-
- try {
- adapter.startDocument();
- adapter.startElement("foo:bar", atts);
- adapter.endElement("foo:bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals("endElement", logger.getMethod());
- assertEquals(new String[] { "", "", "foo:bar" }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "characters",
- args = { char[].class, int.class, int.class }
- )
- public void testCharacters() {
- char[] ch = "Android".toCharArray();
-
- try {
- adapter.characters(ch, 2, 5);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("characters", logger.getMethod());
- assertEquals(new Object[] { ch, 2, 5 }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "ignorableWhitespace",
- args = { char[].class, int.class, int.class }
- )
- public void testIgnorableWhitespace() {
- char[] ch = " ".toCharArray();
-
- try {
- adapter.ignorableWhitespace(ch, 0, 5);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("ignorableWhitespace", logger.getMethod());
- assertEquals(new Object[] { ch, 0, 5 }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "processingInstruction",
- args = { String.class, String.class }
- )
- public void testProcessingInstruction() {
- try {
- adapter.processingInstruction("foo", "bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("processingInstruction", logger.getMethod());
- assertEquals(new Object[] { "foo" , "bar" }, logger.getArgs());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserFactoryTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserFactoryTest.java
deleted file mode 100644
index ebf2a04..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/ParserFactoryTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.helpers.ParserFactory;
-
-@SuppressWarnings("deprecation")
-@TestTargetClass(ParserFactory.class)
-public class ParserFactoryTest extends TestCase {
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "makeParser",
- args = { },
- notes = "Checks everything except META-INF case"
- )
- public void testMakeParser() {
- // Property not set at all
- try {
- ParserFactory.makeParser();
- } catch (NullPointerException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Unknown class
- System.setProperty("org.xml.sax.parser", "foo.bar.SAXParser");
-
- try {
- ParserFactory.makeParser();
- } catch (ClassNotFoundException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Non-accessible class
- System.setProperty("org.xml.sax.parser",
- "tests.api.org.xml.sax.support.NoAccessParser");
-
- try {
- ParserFactory.makeParser();
- } catch (IllegalAccessException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Non-instantiable class
- System.setProperty("org.xml.sax.parser",
- "tests.api.org.xml.sax.support.NoInstanceParser");
-
- try {
- ParserFactory.makeParser();
- } catch (InstantiationException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Non-Parser class
- System.setProperty("org.xml.sax.parser",
- "tests.api.org.xml.sax.support.NoSubclassParser");
-
- try {
- ParserFactory.makeParser();
- } catch (ClassCastException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Good one, finally
- System.setProperty("org.xml.sax.parser",
- "tests.api.org.xml.sax.support.DoNothingParser");
-
- try {
- ParserFactory.makeParser();
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "makeParser",
- args = { String.class }
- )
- public void testMakeParserString() {
- // No class
- try {
- ParserFactory.makeParser(null);
- } catch (NullPointerException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Unknown class
- try {
- ParserFactory.makeParser("foo.bar.SAXParser");
- } catch (ClassNotFoundException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Non-accessible class
- try {
- ParserFactory.makeParser(
- "tests.api.org.xml.sax.support.NoAccessParser");
- } catch (IllegalAccessException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Non-instantiable class
- try {
- ParserFactory.makeParser(
- "tests.api.org.xml.sax.support.NoInstanceParser");
- } catch (InstantiationException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Non-Parser class
- try {
- ParserFactory.makeParser(
- "tests.api.org.xml.sax.support.NoSubclassParser");
- } catch (ClassCastException e) {
- // Expected
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Good one, finally
- try {
- ParserFactory.makeParser(
- "tests.api.org.xml.sax.support.DoNothingParser");
- } catch (Exception e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLFilterImplTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLFilterImplTest.java
deleted file mode 100644
index 6586461..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLFilterImplTest.java
+++ /dev/null
@@ -1,678 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.LocatorImpl;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-import tests.api.org.xml.sax.support.MethodLogger;
-import tests.api.org.xml.sax.support.MockFilter;
-import tests.api.org.xml.sax.support.MockHandler;
-import tests.api.org.xml.sax.support.MockResolver;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargets;
-
-@TestTargetClass(XMLFilterImpl.class)
-public class XMLFilterImplTest extends TestCase {
-
- // Note: In many cases we can only test that delegation works
- // properly. The rest is outside the scope of the specification.
-
- private MethodLogger logger = new MethodLogger();
-
- private MockHandler handler = new MockHandler(logger);
-
- private XMLFilterImpl parent = new MockFilter(logger);
-
- private XMLFilterImpl child = new XMLFilterImpl(parent);
-
- private XMLFilterImpl orphan = new XMLFilterImpl();
-
- private void assertEquals(Object[] a, Object[] b) {
- assertEquals(a.length, b.length);
-
- for (int i = 0; i < a.length; i++) {
- assertEquals("Element #" + i + " must be equal", a[i], b[i]);
- }
- }
-
- public void setUp() {
- parent.setContentHandler(handler);
- parent.setDTDHandler(handler);
- parent.setErrorHandler(handler);
-
- child.setContentHandler(handler);
- child.setDTDHandler(handler);
- child.setErrorHandler(handler);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "XMLFilterImpl",
- args = { }
- )
- public void testXMLFilterImpl() {
- assertEquals(null, parent.getParent());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "XMLFilterImpl",
- args = { XMLReader.class }
- )
- public void testXMLFilterImplXMLReader() {
- // Ordinary case
- assertEquals(null, parent.getParent());
-
- // null case
- XMLFilterImpl filter = new XMLFilterImpl(null);
- assertEquals(null, filter.getParent());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getParent",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setParent",
- args = { XMLReader.class }
- )
- })
- public void testGetSetParent() {
- child.setParent(null);
- assertEquals(null, child.getParent());
-
- child.setParent(parent);
- assertEquals(parent, child.getParent());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getFeature",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setFeature",
- args = { String.class, boolean.class }
- )
- })
- public void testGetSetFeature() {
- // Ordinary case
- try {
- child.setFeature("foo", true);
- assertEquals(true, child.getFeature("foo"));
-
- child.setFeature("foo", false);
- assertEquals(false, child.getFeature("foo"));
- } catch (SAXNotRecognizedException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (SAXNotSupportedException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // No parent case
- try {
- orphan.setFeature("foo", false);
- fail("SAXNotRecognizedException expected");
- } catch (SAXNotRecognizedException e) {
- // Expected
- } catch (SAXNotSupportedException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getProperty",
- args = { String.class }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setProperty",
- args = { String.class, Object.class }
- )
- })
- public void testGetSetProperty() {
- // Ordinary case
- try {
- child.setProperty("foo", "bar");
- assertEquals("bar", child.getProperty("foo"));
-
- child.setProperty("foo", null);
- assertEquals(null, child.getProperty("foo"));
- } catch (SAXNotRecognizedException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (SAXNotSupportedException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // No parent case
- try {
- orphan.setProperty("foo", "bar");
- fail("SAXNotRecognizedException expected");
- } catch (SAXNotRecognizedException e) {
- // Expected
- } catch (SAXNotSupportedException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getEntityResolver",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setEntityResolver",
- args = { EntityResolver.class }
- )
- })
- public void testGetSetEntityResolver() {
- EntityResolver resolver = new MockResolver();
-
- parent.setEntityResolver(resolver);
- assertEquals(resolver, parent.getEntityResolver());
-
- parent.setEntityResolver(null);
- assertEquals(null, parent.getEntityResolver());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getDTDHandler",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDTDHandler",
- args = { DTDHandler.class }
- )
- })
- public void testGetSetDTDHandler() {
- parent.setDTDHandler(null);
- assertEquals(null, parent.getDTDHandler());
-
- parent.setDTDHandler(handler);
- assertEquals(handler, parent.getDTDHandler());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getContentHandler",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setContentHandler",
- args = { ContentHandler.class }
- )
- })
- public void testGetSetContentHandler() {
- parent.setContentHandler(null);
- assertEquals(null, parent.getContentHandler());
-
- parent.setContentHandler(handler);
- assertEquals(handler, parent.getContentHandler());
- }
-
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "getErrorHandler",
- args = { }
- ),
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setErrorHandler",
- args = { ErrorHandler.class }
- )
- })
- public void testGetSetErrorHandler() {
- parent.setErrorHandler(null);
- assertEquals(null, parent.getErrorHandler());
-
- parent.setErrorHandler(handler);
- assertEquals(handler, parent.getErrorHandler());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "parse",
- args = { InputSource.class }
- )
- public void testParseInputSource() {
- InputSource is = new InputSource();
-
- // Ordinary case
- try {
- child.parse(is);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(1, logger.size());
- assertEquals("parse", logger.getMethod());
-
- // No parent case
- try {
- orphan.parse(is);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "parse",
- args = { String.class }
- )
- public void testParseString() {
- // Ordinary case
- try {
- child.parse("foo");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(1, logger.size());
- assertEquals("parse", logger.getMethod());
-
- // No parent case
- try {
- orphan.parse("foo");
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "resolveEntity",
- args = { String.class, String.class }
- )
- public void testResolveEntity() {
- InputSource expected = new InputSource();
-
- MockResolver resolver = new MockResolver();
- resolver.addEntity("foo", "bar", expected);
-
- InputSource result = null;
-
- parent.setEntityResolver(resolver);
-
- // Ordinary case
- try {
- result = parent.resolveEntity("foo", "bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(expected, result);
-
- // No entity resolver case
- parent.setEntityResolver(null);
-
- try {
- result = parent.resolveEntity("foo", "bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(null, result);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "notationDecl",
- args = { String.class, String.class, String.class }
- )
- public void testNotationDecl() {
- try {
- parent.notationDecl("foo", "bar", "foobar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("notationDecl", logger.getMethod());
- assertEquals(new Object[] { "foo", "bar", "foobar" },
- logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "unparsedEntityDecl",
- args = { String.class, String.class, String.class, String.class }
- )
- public void testUnparsedEntityDecl() {
- try {
- parent.unparsedEntityDecl("foo", "bar", "gabba", "hey");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("unparsedEntityDecl", logger.getMethod());
- assertEquals(new Object[] { "foo", "bar", "gabba", "hey" },
- logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDocumentLocator",
- args = { Locator.class }
- )
- public void testSetDocumentLocator() {
- Locator l = new LocatorImpl();
-
- child.setDocumentLocator(l);
-
- assertEquals(logger.size(), 1);
- assertEquals("setDocumentLocator", logger.getMethod());
- assertEquals(new Object[] { l }, logger.getArgs());
-
- child.setDocumentLocator(null);
-
- assertEquals(logger.size(), 2);
- assertEquals("setDocumentLocator", logger.getMethod());
- assertEquals(new Object[] { null }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startDocument",
- args = { }
- )
- public void testStartDocument() {
- try {
- parent.startDocument();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("startDocument", logger.getMethod());
- assertEquals(new Object[] {}, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endDocument",
- args = { }
- )
- public void testEndDocument() {
- try {
- parent.endDocument();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("endDocument", logger.getMethod());
- assertEquals(new Object[] {}, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startPrefixMapping",
- args = { String.class, String.class }
- )
- public void testStartPrefixMapping() {
- try {
- parent.startPrefixMapping("foo", "http://some.uri");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("startPrefixMapping", logger.getMethod());
- assertEquals(new Object[] { "foo", "http://some.uri" },
- logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endPrefixMapping",
- args = { String.class }
- )
- public void testEndPrefixMapping() {
- try {
- parent.endPrefixMapping("foo");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("endPrefixMapping", logger.getMethod());
- assertEquals(new Object[] { "foo" }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startElement",
- args = { String.class, String.class, String.class, Attributes.class }
- )
- public void testStartElement() {
- Attributes atts = new AttributesImpl();
-
- try {
- parent.startElement("http://some.uri", "bar", "foo:bar", atts);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("startElement", logger.getMethod());
- assertEquals(new Object[] { "http://some.uri", "bar", "foo:bar", atts },
- logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endElement",
- args = { String.class, String.class, String.class }
- )
- public void testEndElement() {
- try {
- parent.endElement("http://some.uri", "bar", "foo:bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("endElement", logger.getMethod());
- assertEquals(new Object[] { "http://some.uri", "bar", "foo:bar" },
- logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "characters",
- args = { char[].class, int.class, int.class }
- )
- public void testCharacters() {
- char[] ch = "Android".toCharArray();
-
- try {
- parent.characters(ch, 2, 5);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("characters", logger.getMethod());
- assertEquals(new Object[] { ch, 2, 5 }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "ignorableWhitespace",
- args = { char[].class, int.class, int.class }
- )
- public void testIgnorableWhitespace() {
- char[] ch = " ".toCharArray();
-
- try {
- parent.ignorableWhitespace(ch, 0, 5);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("ignorableWhitespace", logger.getMethod());
- assertEquals(new Object[] { ch, 0, 5 }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "processingInstruction",
- args = { String.class, String.class }
- )
- public void testProcessingInstruction() {
- try {
- parent.processingInstruction("foo", "bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("processingInstruction", logger.getMethod());
- assertEquals(new Object[] { "foo", "bar" }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "skippedEntity",
- args = { String.class }
- )
- public void testSkippedEntity() {
- try {
- parent.skippedEntity("foo");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("skippedEntity", logger.getMethod());
- assertEquals(new Object[] { "foo" }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "warning",
- args = { SAXParseException.class }
- )
- public void testWarning() {
- SAXParseException exception = new SAXParseException("Oops!", null);
-
- try {
- parent.warning(exception);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("warning", logger.getMethod());
- assertEquals(new Object[] { exception }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "error",
- args = { SAXParseException.class }
- )
- public void testError() {
- SAXParseException exception = new SAXParseException("Oops!", null);
-
- try {
- parent.error(exception);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("error", logger.getMethod());
- assertEquals(new Object[] { exception }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "fatalError",
- args = { SAXParseException.class }
- )
- public void testFatalError() {
- SAXParseException exception = new SAXParseException("Oops!", null);
-
- try {
- parent.fatalError(exception);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("fatalError", logger.getMethod());
- assertEquals(new Object[] { exception }, logger.getArgs());
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderAdapterTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderAdapterTest.java
deleted file mode 100644
index 20488c5..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderAdapterTest.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.AttributeList;
-import org.xml.sax.Attributes;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.LocatorImpl;
-import org.xml.sax.helpers.XMLReaderAdapter;
-
-import tests.api.org.xml.sax.support.MethodLogger;
-import tests.api.org.xml.sax.support.MockHandler;
-import tests.api.org.xml.sax.support.MockReader;
-import tests.api.org.xml.sax.support.MockResolver;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-@SuppressWarnings("deprecation")
-@TestTargetClass(XMLReaderAdapter.class)
-public class XMLReaderAdapterTest extends TestCase {
-
- // Note: In many cases we can only test that delegation works
- // properly. The rest is outside the scope of the specification.
-
- private MethodLogger logger = new MethodLogger();
-
- private MockHandler handler = new MockHandler(logger);
-
- private XMLReader reader = new MockReader(logger);
-
- private XMLReaderAdapter adapter = new XMLReaderAdapter(reader);
-
- private void assertEquals(Object[] a, Object[] b) {
- assertEquals(a.length, b.length);
-
- for (int i = 0; i < a.length; i++) {
- assertEquals("Element #" + i + " must be equal", a[i], b[i]);
- }
- }
-
- @Override
- public void setUp() {
- adapter.setDocumentHandler(handler);
- adapter.setDTDHandler(handler);
- adapter.setErrorHandler(handler);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "XMLReaderAdapter",
- args = { }
- )
- public void testXMLReaderAdapter() {
- System.setProperty("org.xml.sax.driver",
- "tests.api.org.xml.sax.support.DoNothingXMLReader");
-
- try {
- new XMLReaderAdapter();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "XMLReaderAdapter",
- args = { XMLReader.class }
- )
- public void testXMLReaderAdapterXMLReader() {
- // Ordinary case
- @SuppressWarnings("unused")
- XMLReaderAdapter adapter = new XMLReaderAdapter(reader);
-
- // Null case
- try {
- adapter = new XMLReaderAdapter(null);
- fail("NullPointerException expected");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setLocale",
- args = { Locale.class }
- )
- public void testSetLocale() {
- // SAX RI does not support this, hence always expect exception
- try {
- adapter.setLocale(Locale.getDefault());
- fail("SAXException expected");
- } catch (SAXException e) {
- // Expected
- }
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setEntityResolver",
- args = { EntityResolver.class }
- )
- public void testSetEntityResolver() {
- EntityResolver resolver = new MockResolver();
-
- // Ordinary case
- adapter.setEntityResolver(resolver);
- assertEquals(resolver, reader.getEntityResolver());
-
- // null case
- adapter.setEntityResolver(null);
- assertEquals(null, reader.getEntityResolver());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDTDHandler",
- args = { DTDHandler.class }
- )
- public void testSetDTDHandler() {
- // Ordinary case
- assertEquals(handler, reader.getDTDHandler());
-
- // null case
- adapter.setDTDHandler(null);
- assertEquals(null, reader.getDTDHandler());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDocumentHandler",
- args = { DocumentHandler.class }
- )
- public void testSetDocumentHandler() {
- // There is no getter for the DocumentHandler, so we can only test
- // indirectly whether is has been set correctly.
- try {
- adapter.startDocument();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals("startDocument", logger.getMethod());
- assertEquals(new Object[] { }, logger.getArgs());
-
- // null case
- adapter.setDocumentHandler(null);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setErrorHandler",
- args = { ErrorHandler.class }
- )
- public void testSetErrorHandler() {
- // Ordinary case
- assertEquals(handler, reader.getErrorHandler());
-
- // null case
- adapter.setErrorHandler(null);
- assertEquals(null, reader.getErrorHandler());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "parse",
- args = { String.class }
- )
- public void testParseString() {
- try {
- adapter.parse("foo");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // The SAX RI creates an InputSource itself and then delegates to the
- // "other" parse method.
- assertEquals("parse", logger.getMethod(0));
- assertEquals(InputSource.class, logger.getArgs(0)[0].getClass());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "parse",
- args = { InputSource.class }
- )
- public void testParseInputSource() {
- InputSource source = new InputSource("foo");
-
- try {
- adapter.parse(source);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- } catch (IOException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals("parse", logger.getMethod());
- assertEquals(new Object[] { source }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "setDocumentLocator",
- args = { Locator.class }
- )
- public void testSetDocumentLocator() {
- // Ordinary case
- LocatorImpl locator = new LocatorImpl();
- adapter.setDocumentLocator(locator);
-
- assertEquals("setDocumentLocator", logger.getMethod());
- assertEquals(new Object[] { locator }, logger.getArgs());
-
- // null case (for the DocumentHandler itself!)
- adapter.setDocumentHandler(null);
- adapter.setDocumentLocator(locator);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startDocument",
- args = { }
- )
- public void testStartDocument() {
- try {
- adapter.startDocument();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("startDocument", logger.getMethod());
- assertEquals(new Object[] {}, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endDocument",
- args = { }
- )
- public void testEndDocument() {
- try {
- adapter.endDocument();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("endDocument", logger.getMethod());
- assertEquals(new Object[] {}, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startPrefixMapping",
- args = { String.class, String.class }
- )
- public void testStartPrefixMapping() {
- adapter.startPrefixMapping("foo", "http://some.uri");
- assertEquals(logger.size(), 0);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endPrefixMapping",
- args = { String.class }
- )
- public void testEndPrefixMapping() {
- adapter.endPrefixMapping("foo");
- assertEquals(logger.size(), 0);
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "startElement",
- args = { String.class, String.class, String.class, Attributes.class }
- )
- public void testStartElement() {
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("http://some.other.uri", "gabba", "gabba:hey",
- "int", "42");
-
- try {
- adapter.startElement("http://some.uri", "bar", "foo:bar", atts);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("startElement", logger.getMethod());
- assertEquals("foo:bar", logger.getArgs()[0]);
- assertEquals("gabba:hey",
- ((AttributeList)logger.getArgs()[1]).getName(0));
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "endElement",
- args = { String.class, String.class, String.class }
- )
- public void testEndElement() {
- try {
- adapter.endElement("http://some.uri", "bar", "foo:bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("endElement", logger.getMethod());
- assertEquals(new Object[] { "foo:bar" }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "characters",
- args = { char[].class, int.class, int.class }
- )
- public void testCharacters() {
- char[] ch = "Android".toCharArray();
-
- try {
- adapter.characters(ch, 2, 5);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("characters", logger.getMethod());
- assertEquals(new Object[] { ch, 2, 5 }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "ignorableWhitespace",
- args = { char[].class, int.class, int.class }
- )
- public void testIgnorableWhitespace() {
- char[] ch = " ".toCharArray();
-
- try {
- adapter.ignorableWhitespace(ch, 0, 5);
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("ignorableWhitespace", logger.getMethod());
- assertEquals(new Object[] { ch, 0, 5 }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "processingInstruction",
- args = { String.class, String.class }
- )
- public void testProcessingInstruction() {
- try {
- adapter.processingInstruction("foo", "bar");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 1);
- assertEquals("processingInstruction", logger.getMethod());
- assertEquals(new Object[] { "foo" , "bar" }, logger.getArgs());
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "skippedEntity",
- args = { String.class }
- )
- public void testSkippedEntity() {
- try {
- adapter.skippedEntity("foo");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- assertEquals(logger.size(), 0);
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderFactoryTest.java b/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderFactoryTest.java
deleted file mode 100644
index bfb1bd1..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/helpers/XMLReaderFactoryTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.helpers;
-
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-@TestTargetClass(XMLReaderFactory.class)
-public class XMLReaderFactoryTest extends TestCase {
-
- @TestTargetNew(
- level = TestLevel.SUFFICIENT,
- method = "createXMLReader",
- args = { },
- notes = "Checks everything except META-INF case"
- )
- public void testCreateXMLReader() {
- // Property not set at all
- try {
- XMLReaderFactory.createXMLReader();
- } catch (SAXException e) {
- // Expected
- }
-
- // Unknown class
- System.setProperty("org.xml.sax.driver", "foo.bar.XMLReader");
-
- try {
- XMLReaderFactory.createXMLReader();
- } catch (SAXException e) {
- // Expected
- }
-
- // Non-accessible class
- System.setProperty("org.xml.sax.driver",
- "tests.api.org.xml.sax.support.NoAccessXMLReader");
-
- try {
- XMLReaderFactory.createXMLReader();
- } catch (SAXException e) {
- // Expected
- }
-
- // Non-instantiable class
- System.setProperty("org.xml.sax.driver",
- "tests.api.org.xml.sax.support.NoInstanceXMLReader");
-
- try {
- XMLReaderFactory.createXMLReader();
- } catch (SAXException e) {
- // Expected
- }
-
- // Non-XMLReader class
- System.setProperty("org.xml.sax.driver",
- "tests.api.org.xml.sax.support.NoSubclassXMLReader");
-
- try {
- XMLReaderFactory.createXMLReader();
- } catch (ClassCastException e) {
- // Expected
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Good one, finally
- System.setProperty("org.xml.sax.driver",
- "tests.api.org.xml.sax.support.DoNothingXMLReader");
-
- try {
- XMLReaderFactory.createXMLReader();
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- }
-
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "createXMLReader",
- args = { String.class }
- )
- public void testMakeParserString() {
- // No class
- try {
- XMLReaderFactory.createXMLReader(null);
- } catch (NullPointerException e) {
- // Expected
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- // Unknown class
- try {
- XMLReaderFactory.createXMLReader("foo.bar.XMLReader");
- } catch (SAXException e) {
- // Expected
- }
-
- // Non-accessible class
- try {
- XMLReaderFactory.createXMLReader(
- "tests.api.org.xml.sax.support.NoAccessXMLReader");
- } catch (SAXException e) {
- // Expected
- }
-
- // Non-instantiable class
- try {
- XMLReaderFactory.createXMLReader(
- "tests.api.org.xml.sax.support.NoInstanceXMLReader");
- } catch (SAXException e) {
- // Expected
- }
-
- // Non-Parser class
- try {
- XMLReaderFactory.createXMLReader(
- "tests.api.org.xml.sax.support.NoSubclassXMLReader");
- } catch (SAXException e) {
- // Expected
- }
-
- // Good one, finally
- try {
- XMLReaderFactory.createXMLReader(
- "tests.api.org.xml.sax.support.DoNothingXMLReader");
- } catch (SAXException e) {
- throw new RuntimeException("Unexpected exception", e);
- }
-
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/BrokenInputStream.java b/xml/src/test/java/tests/api/org/xml/sax/support/BrokenInputStream.java
deleted file mode 100644
index daa36f9..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/BrokenInputStream.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Implements an InputStream what wraps another InputStream and throws an
- * IOException after having read a specified number of bytes. Used for
- * injecting IOExceptions on lower levels.
- */
-public class BrokenInputStream extends InputStream {
-
- private InputStream stream;
-
- private int offset;
-
- public BrokenInputStream(InputStream stream, int offset) {
- super();
-
- this.stream = stream;
- this.offset = offset;
- }
-
- @Override
- public int read() throws IOException {
- if (offset == 0) {
- throw new IOException("Injected exception");
- }
-
- offset--;
- return stream.read();
- }
-
-} \ No newline at end of file
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingParser.java
deleted file mode 100644
index 6049cc6..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingParser.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Parser;
-
-import java.util.Locale;
-
-/**
- * A SAX Parser that does nothing, but can be instantiated properly.
- */
-@SuppressWarnings("deprecation")
-public class DoNothingParser implements Parser {
-
- public void parse(InputSource source) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setDocumentHandler(DocumentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setLocale(Locale locale) {
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingXMLReader.java
deleted file mode 100644
index 8687bff..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/DoNothingXMLReader.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
-/**
- * An XMLReader that does nothing, but can be instantiated properly.
- */
-public class DoNothingXMLReader implements XMLReader {
-
- public ContentHandler getContentHandler() {
- return null;
- }
-
- public DTDHandler getDTDHandler() {
- return null;
- }
-
- public EntityResolver getEntityResolver() {
- return null;
- }
-
- public ErrorHandler getErrorHandler() {
- return null;
- }
-
- public boolean getFeature(String name) {
- return false;
- }
-
- public Object getProperty(String name) {
- return null;
- }
-
- public void parse(InputSource input) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setContentHandler(ContentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setFeature(String name, boolean value) {
- }
-
- public void setProperty(String name, Object value) {
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MethodLogger.java b/xml/src/test/java/tests/api/org/xml/sax/support/MethodLogger.java
deleted file mode 100644
index 198172b..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/MethodLogger.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A simple helper class that logs method calls by storing method names and
- * parameter lists. Used as a foundation for various simple SAX handlers.
- */
-public class MethodLogger {
-
- /**
- * The names of the invoked methods, in order.
- */
- private List<String> methods = new ArrayList<String>();
-
- /**
- * The parameter lists of the invoked methods, in order.
- */
- private List<Object[]> argLists = new ArrayList<Object[]>();
-
- /**
- * Adds a method call with a variable list of arguments.
- */
- public void add(String method, Object ... args) {
- Object[] argsCopy = new Object[args.length];
- System.arraycopy(args, 0, argsCopy, 0, args.length);
-
- methods.add(method);
- argLists.add(argsCopy);
- }
-
- /**
- * Returns the number of method invoked so far.
- */
- public int size() {
- return methods.size();
- }
-
- /**
- * Returns the method name stored at the given index.
- */
- public String getMethod(int index) {
- return methods.get(index);
- }
-
- /**
- * Returns the name of the last method that was invoked. Returns null if no
- * method calls have been logged so far.
- */
- public String getMethod() {
- return (size() == 0 ? null : getMethod(size() - 1));
- }
-
- /**
- * Returns the argument array stored at the given index. May be empty, but
- * not null.
- */
- public Object[] getArgs(int index) {
- return argLists.get(index);
- }
-
- /**
- * Returns the argument array of the last method that was invoked. Returns
- * null if no method has been invoked so far.
- */
- public Object[] getArgs() {
- return (size() == 0 ? null : getArgs(size() - 1));
- }
-
- /**
- * Clears the log.
- */
- public void clear() {
- methods.clear();
- argLists.clear();
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockFilter.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockFilter.java
deleted file mode 100644
index 0b54bf8..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/MockFilter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-/**
- * A helper class that extends XMLFilterImpl, provides dummy feature/property
- * management, and logs some method calls.
- */
-public class MockFilter extends XMLFilterImpl {
-
- private MethodLogger logger;
-
- private Set<String> features = new HashSet<String>();
-
- private Map<String, Object> properties = new HashMap<String, Object>();
-
- public MockFilter(MethodLogger logger) {
- super();
- this.logger = logger;
- }
-
- @Override
- public boolean getFeature(String name) throws SAXNotRecognizedException,
- SAXNotSupportedException {
- return features.contains(name);
- }
-
- @Override
- public Object getProperty(String name) throws SAXNotRecognizedException,
- SAXNotSupportedException {
- return properties.get(name);
- }
-
- @Override
- public void setFeature(String name, boolean value) {
- if (value) {
- features.add(name);
- } else {
- features.remove(name);
- }
- }
-
- @Override
- public void setProperty(String name, Object value) throws SAXNotRecognizedException,
- SAXNotSupportedException {
- if (value == null) {
- properties.remove(name);
- } else {
- properties.put(name, value);
- }
- }
-
- @Override
- public void parse(InputSource input) throws SAXException, IOException {
- logger.add("parse", input);
- }
-
- @Override
- public void parse(String systemId) throws SAXException, IOException {
- logger.add("parse", systemId);
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockHandler.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockHandler.java
deleted file mode 100644
index 98b024a..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/MockHandler.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.AttributeList;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.ext.LexicalHandler;
-
-/**
- * A helper class that implements the various SAX callback interfaces and logs
- * method calls.
- */
-@SuppressWarnings("deprecation")
-public class MockHandler implements ContentHandler, DTDHandler, DocumentHandler,
- ErrorHandler, LexicalHandler {
-
- private MethodLogger logger;
-
- public MockHandler(MethodLogger logger) {
- super();
- this.logger = logger;
- }
-
- public void characters(char[] ch, int start, int length) throws SAXException {
- logger.add("characters", ch, start, length);
- }
-
- public void endDocument() throws SAXException {
- logger.add("endDocument");
- }
-
- public void endElement(String name) throws SAXException {
- logger.add("endElement", name);
- }
-
- public void endElement(String uri, String localName, String name) throws SAXException {
- logger.add("endElement", uri, localName, name);
- }
-
- public void endPrefixMapping(String prefix) throws SAXException {
- logger.add("endPrefixMapping", prefix);
- }
-
- public void error(SAXParseException exception) throws SAXException {
- logger.add("error", exception);
- }
-
- public void fatalError(SAXParseException exception) throws SAXException {
- logger.add("fatalError", exception);
- }
-
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
- logger.add("ignorableWhitespace", ch, start, length);
- }
-
- public void notationDecl(String name, String publicId, String systemId) throws SAXException {
- logger.add("notationDecl", name, publicId, systemId);
- }
-
- public void processingInstruction(String target, String data) throws SAXException {
- logger.add("processingInstruction", target, data);
- }
-
- public void setDocumentLocator(Locator locator) {
- logger.add("setDocumentLocator", locator);
- }
-
- public void skippedEntity(String name) throws SAXException {
- logger.add("skippedEntity", name);
- }
-
- public void startDocument() throws SAXException {
- logger.add("startDocument");
- }
-
- public void startElement(String name, AttributeList atts) throws SAXException {
- logger.add("startElement", name, atts);
- }
-
- public void startElement(String uri, String localName, String name, Attributes atts)
- throws SAXException {
- logger.add("startElement", uri, localName, name, atts);
- }
-
- public void startPrefixMapping(String prefix, String uri) throws SAXException {
- logger.add("startPrefixMapping", prefix, uri);
- }
-
- public void unparsedEntityDecl(String name, String publicId, String systemId,
- String notationName) throws SAXException {
- logger.add("unparsedEntityDecl", name, publicId, systemId, notationName);
- }
-
- public void warning(SAXParseException exception) throws SAXException {
- logger.add("warning", exception);
- }
-
- public void comment(char[] ch, int start, int length) throws SAXException {
- logger.add("comment", ch, start, length);
- }
-
- public void endCDATA() throws SAXException {
- logger.add("endCDATA");
- }
-
- public void endDTD() throws SAXException {
- logger.add("endDTD");
- }
-
- public void endEntity(String name) throws SAXException {
- logger.add("endEntity", name);
- }
-
- public void startCDATA() throws SAXException {
- logger.add("startCDATA");
- }
-
- public void startDTD(String name, String publicId, String systemId) throws SAXException {
- logger.add("startDTD", name, publicId, systemId);
- }
-
- public void startEntity(String name) throws SAXException {
- logger.add("startEntity", name);
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockParser.java
deleted file mode 100644
index 01520f8..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/MockParser.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Parser;
-import org.xml.sax.SAXException;
-
-@SuppressWarnings("deprecation")
-public class MockParser implements Parser {
-
- private MethodLogger logger;
-
- public MockParser(MethodLogger logger) {
- super();
- this.logger = logger;
- }
-
- public void parse(InputSource source) throws SAXException, IOException {
- logger.add("parse", source);
- }
-
- public void parse(String systemId) throws SAXException, IOException {
- logger.add("parse", systemId);
- }
-
- public void setDTDHandler(DTDHandler handler) {
- logger.add("setDTDHandler", handler);
- }
-
- public void setDocumentHandler(DocumentHandler handler) {
- logger.add("setDocumentHandler", handler);
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- logger.add("setEntityResolver", resolver);
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- logger.add("setErrorHandler", handler);
- }
-
- public void setLocale(Locale locale) throws SAXException {
- logger.add("setLocale", locale);
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockReader.java
deleted file mode 100644
index 22a6a57..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/MockReader.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.XMLReader;
-
-/**
- * A helper class that implements the SAX XMLReader interface and logs method
- * calls.
- */
-public class MockReader implements XMLReader {
-
- private MethodLogger logger;
-
- private ContentHandler contentHandler;
-
- private DTDHandler dtdHandler;
-
- private EntityResolver resolver;
-
- private ErrorHandler errorHandler;
-
- private Set<String> features = new HashSet<String>();
-
- private Map<String, Object> properties = new HashMap<String, Object>();
-
- public MockReader(MethodLogger logger) {
- super();
- this.logger = logger;
- }
-
-
- public ContentHandler getContentHandler() {
- return contentHandler;
- }
-
- public DTDHandler getDTDHandler() {
- return dtdHandler;
- }
-
- public EntityResolver getEntityResolver() {
- return resolver;
- }
-
- public ErrorHandler getErrorHandler() {
- return errorHandler;
- }
-
- public boolean getFeature(String name) throws SAXNotRecognizedException,
- SAXNotSupportedException {
- return features.contains(name);
- }
-
- public Object getProperty(String name) throws SAXNotRecognizedException,
- SAXNotSupportedException {
- return properties.get(name);
- }
-
- public void parse(InputSource input) throws IOException, SAXException {
- logger.add("parse", input);
- }
-
- public void parse(String systemId) throws IOException, SAXException {
- logger.add("parse", systemId);
- }
-
- public void setContentHandler(ContentHandler handler) {
- this.contentHandler = handler;
- }
-
- public void setDTDHandler(DTDHandler handler) {
- this.dtdHandler = handler;
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- this.resolver = resolver;
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- this.errorHandler = handler;
- }
-
- public void setFeature(String name, boolean value) {
- if (value) {
- features.add(name);
- } else {
- features.remove(name);
- }
- }
-
- public void setProperty(String name, Object value) throws SAXNotRecognizedException,
- SAXNotSupportedException {
- if (value == null) {
- properties.remove(name);
- } else {
- properties.put(name, value);
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/MockResolver.java b/xml/src/test/java/tests/api/org/xml/sax/support/MockResolver.java
deleted file mode 100644
index ae0066e..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/MockResolver.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * A helper class for resolving entities.
- */
-public class MockResolver implements EntityResolver {
-
- private Map<String, InputSource> entities = new HashMap<String, InputSource>();
-
- public void addEntity(String publicId, String systemId, InputSource source) {
- entities.put("[" + publicId + ":" + systemId + "]", source);
- }
-
- public void removeEntity(String publicId, String systemId) {
- entities.remove("[" + publicId + ":" + systemId + "]");
- }
-
- public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
- return entities.get("[" + publicId + ":" + systemId + "]");
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessParser.java
deleted file mode 100644
index 5aac9af..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessParser.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Parser;
-
-import java.util.Locale;
-
-/**
- * A SAX Parser that can't be accessed.
- */
-@SuppressWarnings("deprecation")
-class NoAccessParser implements Parser {
-
- public void parse(InputSource source) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setDocumentHandler(DocumentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setLocale(Locale locale) {
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessXMLReader.java
deleted file mode 100644
index b6a0a68..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/NoAccessXMLReader.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
-/**
- * An XMLReader that is not accessible.
- */
-class NoAccessXMLReader implements XMLReader {
-
- public ContentHandler getContentHandler() {
- return null;
- }
-
- public DTDHandler getDTDHandler() {
- return null;
- }
-
- public EntityResolver getEntityResolver() {
- return null;
- }
-
- public ErrorHandler getErrorHandler() {
- return null;
- }
-
- public boolean getFeature(String name) {
- return false;
- }
-
- public Object getProperty(String name) {
- return null;
- }
-
- public void parse(InputSource input) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setContentHandler(ContentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setFeature(String name, boolean value) {
- }
-
- public void setProperty(String name, Object value) {
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceParser.java
deleted file mode 100644
index 8f1692f..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceParser.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Parser;
-
-import java.util.Locale;
-
-/**
- * A SAX Parser that can be accessed, but not instantiated.
- */
-@SuppressWarnings("deprecation")
-public class NoInstanceParser implements Parser {
-
- public NoInstanceParser(int i) {
- }
-
- public void parse(InputSource source) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setDocumentHandler(DocumentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setLocale(Locale locale) {
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceXMLReader.java
deleted file mode 100644
index 764c451..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/NoInstanceXMLReader.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
-/**
- * An XMLReader that is accessible, but can't be instantiated.
- */
-public class NoInstanceXMLReader implements XMLReader {
-
- public NoInstanceXMLReader(int i) {
- }
-
- public ContentHandler getContentHandler() {
- return null;
- }
-
- public DTDHandler getDTDHandler() {
- return null;
- }
-
- public EntityResolver getEntityResolver() {
- return null;
- }
-
- public ErrorHandler getErrorHandler() {
- return null;
- }
-
- public boolean getFeature(String name) {
- return false;
- }
-
- public Object getProperty(String name) {
- return null;
- }
-
- public void parse(InputSource input) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setContentHandler(ContentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setFeature(String name, boolean value) {
- }
-
- public void setProperty(String name, Object value) {
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassParser.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassParser.java
deleted file mode 100644
index f178998..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassParser.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-
-import java.util.Locale;
-
-/**
- * A SAX Parser that does not implement the Parser interface.
- */
-@SuppressWarnings("deprecation")
-public class NoSubclassParser {
-
- public void parse(InputSource source) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setDocumentHandler(DocumentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setLocale(Locale locale) {
- }
-
-}
diff --git a/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassXMLReader.java b/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassXMLReader.java
deleted file mode 100644
index acdbd88..0000000
--- a/xml/src/test/java/tests/api/org/xml/sax/support/NoSubclassXMLReader.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.api.org.xml.sax.support;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
-/**
- * An XMLReader that does not implement the XMLReader interface.
- */
-public class NoSubclassXMLReader implements XMLReader {
-
- public ContentHandler getContentHandler() {
- return null;
- }
-
- public DTDHandler getDTDHandler() {
- return null;
- }
-
- public EntityResolver getEntityResolver() {
- return null;
- }
-
- public ErrorHandler getErrorHandler() {
- return null;
- }
-
- public boolean getFeature(String name) {
- return false;
- }
-
- public Object getProperty(String name) {
- return null;
- }
-
- public void parse(InputSource input) {
- }
-
- public void parse(String systemId) {
- }
-
- public void setContentHandler(ContentHandler handler) {
- }
-
- public void setDTDHandler(DTDHandler handler) {
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- }
-
- public void setFeature(String name, boolean value) {
- }
-
- public void setProperty(String name, Object value) {
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/AllTests.java b/xml/src/test/java/tests/org/w3c/dom/AllTests.java
deleted file mode 100644
index a4299a7..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/AllTests.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.org.w3c.dom;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * This is autogenerated source file. Includes tests for package org.w3c.dom;
- */
-
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(AllTests.suite());
- }
-
- public static Test suite() {
- TestSuite suite = tests.TestSuiteFactory.createTestSuite("All tests for package org.w3c.dom;");
- // $JUnit-BEGIN$
-
- suite.addTestSuite(AttrGetOwnerElement.class);
- suite.addTestSuite(CreateAttributeNS.class);
- suite.addTestSuite(CreateDocument.class);
- suite.addTestSuite(CreateDocumentType.class);
- suite.addTestSuite(CreateElementNS.class);
- suite.addTestSuite(DOMImplementationCreateDocument.class);
- suite.addTestSuite(DOMImplementationCreateDocumentType.class);
- suite.addTestSuite(DOMImplementationHasFeature.class);
- suite.addTestSuite(DocumentCreateAttributeNS.class);
- suite.addTestSuite(DocumentCreateElementNS.class);
- suite.addTestSuite(DocumentGetElementsByTagnameNS.class);
- suite.addTestSuite(DocumentGeteEementById.class);
- suite.addTestSuite(DocumentImportNode.class);
- suite.addTestSuite(DocumentTypeInternalSubset.class);
- suite.addTestSuite(DocumentTypePublicId.class);
- suite.addTestSuite(DocumentTypeSystemId.class);
-// Is empty. Only test assumes validation. Leave disabled.
-// suite.addTestSuite(ElementGetAttributeNS.class);
- suite.addTestSuite(ElementGetAttributeNodeNS.class);
- suite.addTestSuite(ElementGetElementsByTagNameNS.class);
- suite.addTestSuite(ElementHasAttribute.class);
- suite.addTestSuite(ElementHasAttributeNS.class);
- suite.addTestSuite(ElementRemoveAttributeNS.class);
- suite.addTestSuite(ElementSetAttributeNS.class);
- suite.addTestSuite(ElementSetAttributeNodeNS.class);
- suite.addTestSuite(GetAttributeNS.class);
- suite.addTestSuite(GetAttributeNodeNS.class);
- suite.addTestSuite(GetElementById.class);
- suite.addTestSuite(GetElementsByTagNameNS.class);
- suite.addTestSuite(GetNamedItemNS.class);
-// Is empty. Only test assumes validation. Leave disabled.
-// suite.addTestSuite(HCEntitiesRemoveNamedItemNS.class);
-// Is empty. Only test assumes validation. Leave disabled.
-// suite.addTestSuite(HCEntitiesSetNamedItemNS.class);
- suite.addTestSuite(HCNamedNodeMapInvalidType.class);
- suite.addTestSuite(HCNodeDocumentFragmentNormalize.class);
-// Is empty. Only test assumes validation. Leave disabled.
-// suite.addTestSuite(HCNotationsRemoveNamedItemNS.class);
-// Is empty. Only test assumes validation. Leave disabled.
-// suite.addTestSuite(HCNotationsSetNamedItemNS.class);
- suite.addTestSuite(HasAttribute.class);
- suite.addTestSuite(HasAttributeNS.class);
- suite.addTestSuite(HasAttributes.class);
- suite.addTestSuite(ImportNode.class);
- suite.addTestSuite(InternalSubset.class);
- suite.addTestSuite(IsSupported.class);
- suite.addTestSuite(LocalName.class);
- suite.addTestSuite(NamedNodeMapGetNamedItemNS.class);
- suite.addTestSuite(NamedNodeMapRemoveNamedItemNS.class);
- suite.addTestSuite(NamedNodeMapSetNamedItemNS.class);
- suite.addTestSuite(NamespaceURI.class);
- suite.addTestSuite(NodeGetLocalName.class);
- suite.addTestSuite(NodeGetNamespaceURI.class);
- suite.addTestSuite(NodeGetOwnerDocument.class);
- suite.addTestSuite(NodeGetPrefix.class);
- suite.addTestSuite(NodeHasAttributes.class);
- suite.addTestSuite(NodeIsSupported.class);
- suite.addTestSuite(NodeNormalize.class);
- suite.addTestSuite(NodeSetPrefix.class);
- suite.addTestSuite(Normalize.class);
- suite.addTestSuite(OwnerDocument.class);
- suite.addTestSuite(OwnerElement.class);
- suite.addTestSuite(Prefix.class);
- suite.addTestSuite(PublicId.class);
-// Is empty. Only test assumes validation. Leave disabled.
-// suite.addTestSuite(RemoveAttributeNS.class);
- suite.addTestSuite(RemoveNamedItemNS.class);
- suite.addTestSuite(SetAttributeNS.class);
- suite.addTestSuite(SetAttributeNodeNS.class);
- suite.addTestSuite(SetNamedItemNS.class);
- suite.addTestSuite(SystemId.class);
- // $JUnit-END$
- return suite;
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java b/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java
deleted file mode 100644
index bb42121..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.NamedNodeMap;
-
-import javax.xml.parsers.DocumentBuilder;
-
-@TestTargetClass(Attr.class)
-public final class AttrGetOwnerElement extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception " + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
-// Assumes validation.
-// public void testGetOwnerElement1() throws Throwable {
-// Document doc;
-// Attr attr;
-// Element element;
-// Element ownerElement;
-// String ownerElementName;
-// NodeList elementList;
-// NamedNodeMap attributes;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-//
-// elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "employee");
-// element = (Element) elementList.item(1);
-// attributes = element.getAttributes();
-// attr = (Attr) attributes.getNamedItemNS(nullNS, "defaultAttr");
-// ownerElement = attr.getOwnerElement();
-// ownerElementName = ownerElement.getNodeName();
-// assertEquals("attrgetownerelement01", "emp:employee", ownerElementName);
-//
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that getOwnerElement returns null if an attribute is not in use.",
- method = "getOwnerElement",
- args = {}
- )
- public void testGetOwnerElement2() throws Throwable {
- Document doc;
- Element element;
- Element ownerElement;
- String ownerElementName;
- Attr attr;
-
- doc = (Document) load("staffNS", builder);
- element = doc.createElement("root");
- attr = doc.createAttributeNS("http://www.w3.org/DOM/L1", "L1:att");
- element.setAttributeNodeNS(attr);
- ownerElement = attr.getOwnerElement();
- ownerElementName = ownerElement.getNodeName();
- assertEquals("attrgetownerelement02", "root", ownerElementName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getOwnerElement returns null if an attribute is not in use.",
- method = "getOwnerElement",
- args = {}
- )
- public void testGetOwnerElement3() throws Throwable {
- Document doc;
- Node ownerElement;
- Attr attr;
- doc = (Document) load("staffNS", builder);
- attr = doc.createAttributeNS("http://www.w3.org/DOM", "dom:attr");
- ownerElement = attr.getOwnerElement();
- assertNull("attrgetownerelement03", ownerElement);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getOwnerElement returns null if an attribute is not in use.",
- method = "getOwnerElement",
- args = {}
- )
- public void testGetOwnerElement4() throws Throwable {
- Document doc;
- Document docImp;
- Node ownerElement;
- Element element;
- Attr attr;
- Attr attrImp;
- NodeList addresses;
-
- doc = (Document) load("staffNS", builder);
- docImp = (Document) load("staff", builder);
-
- addresses = doc
- .getElementsByTagNameNS("http://www.nist.gov", "address");
- element = (Element) addresses.item(1);
- assertNotNull("empAddressNotNull", element);
- attr = element.getAttributeNodeNS("http://www.nist.gov", "zone");
- attrImp = (Attr) docImp.importNode(attr, true);
- ownerElement = attrImp.getOwnerElement();
- assertNull("attrgetownerelement04", ownerElement);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that getOwnerElement returns null if an attribute is not in use.",
- method = "getOwnerElement",
- args = {}
- )
- public void testGetOwnerElement5() throws Throwable {
- Document doc;
- Node element;
- Element ownerElement;
- Element parentElement;
- NodeList elementList;
- String ownerElementName;
- Attr attr;
-
- NamedNodeMap nodeMap;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = elementList.item(1);
- parentElement = (Element) element.getParentNode();
- nodeMap = element.getAttributes();
- parentElement.removeChild(element);
- attr = (Attr) nodeMap.getNamedItemNS(nullNS, "street");
- ownerElement = attr.getOwnerElement();
- ownerElementName = ownerElement.getNodeName();
- assertEquals("attrgetownerelement05", "address", ownerElementName);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java
deleted file mode 100644
index c7e0d34..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-@TestTargetClass(Document.class)
-public final class CreateAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies NAMESPACE_ERR exception code.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS1() throws Throwable {
- String namespaceURI = "http://www.ecommerce.org/";
- String malformedName = "prefix::local";
- Document doc;
-
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, malformedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies createAttributeNS method with null as the fisrt parameter.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS2() throws Throwable {
- String namespaceURI = null;
-
- String qualifiedName = "prefix:local";
- Document doc;
-
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createAttributeNS throws DOMException.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS3() throws Throwable {
- String namespaceURI = "http://www.wedding.com/";
- String qualifiedName;
- Document doc;
-
- List<String> illegalQNames = new ArrayList<String>();
- illegalQNames.add("person:{");
- illegalQNames.add("person:}");
- illegalQNames.add("person:~");
- illegalQNames.add("person:'");
- illegalQNames.add("person:!");
- illegalQNames.add("person:@");
- illegalQNames.add("person:#");
- illegalQNames.add("person:$");
- illegalQNames.add("person:%");
- illegalQNames.add("person:^");
- illegalQNames.add("person:&");
- illegalQNames.add("person:*");
- illegalQNames.add("person:(");
- illegalQNames.add("person:)");
- illegalQNames.add("person:+");
- illegalQNames.add("person:=");
- illegalQNames.add("person:[");
- illegalQNames.add("person:]");
- illegalQNames.add("person:\\");
- illegalQNames.add("person:/");
- illegalQNames.add("person:;");
- illegalQNames.add("person:`");
- illegalQNames.add("person:<");
- illegalQNames.add("person:>");
- illegalQNames.add("person:,");
- illegalQNames.add("person:a ");
- illegalQNames.add("person:\"");
-
- doc = (Document) load("staffNS", builder);
- for (int indexN10090 = 0; indexN10090 < illegalQNames.size(); indexN10090++) {
- qualifiedName = (String) illegalQNames.get(indexN10090);
- {
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify exceptions.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS4() throws Throwable {
- String namespaceURI = "http://www.w3.org/XML/1998/namespaces";
- String qualifiedName = "xml:attr1";
- Document doc;
-
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify exceptions.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS5() throws Throwable {
- String namespaceURI = "http://www.ecommerce.org/";
- String qualifiedName = "econm:local";
- Document doc;
- Attr newAttr;
- String attrName;
- doc = (Document) load("staffNS", builder);
- newAttr = doc.createAttributeNS(namespaceURI, qualifiedName);
- attrName = newAttr.getName();
- assertEquals("throw_Equals", qualifiedName, attrName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS6() throws Throwable {
- String namespaceURI = "http://www.example.com/";
- Document doc;
-
- doc = (Document) load("hc_staff", builder);
-
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, "");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java b/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java
deleted file mode 100644
index 157b394..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "createDocument(namespaceURI,qualifiedName,doctype)" method for a
- * DOMImplementation should raise NAMESPACE_ERR DOMException if parameter
- * qualifiedName is malformed.
- *
- * Retrieve the DOMImplementation on the XMLNS Document. Invoke method
- * createDocument(namespaceURI,qualifiedName,doctype) on the retrieved
- * DOMImplementation with namespaceURI being the literal string
- * "http://www.ecommerce.org/", qualifiedName as "prefix::local", and doctype as
- * null. Method should raise NAMESPACE_ERR DOMException.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocument')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a>
- */
-@TestTargetClass(DOMImplementation.class)
-public final class CreateDocument extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument1() throws Throwable {
- String namespaceURI = "http://www.ecommerce.org/";
- String malformedName = "prefix::local";
- Document doc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
-
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, malformedName, docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
-
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument2() throws Throwable {
- String namespaceURI = null;
-
- String qualifiedName = "k:local";
- Document doc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
-
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, qualifiedName, docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
-
- }
-
-// public void testCreateDocument3() throws Throwable {
-// String namespaceURI = "http://www.ecommerce.org/schema";
-// String qualifiedName = "namespaceURI:x";
-// Document doc;
-// DocumentType docType;
-// DOMImplementation domImpl;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// domImpl = doc.getImplementation();
-//
-// boolean success = false;
-// try {
-// domImpl.createDocument(namespaceURI, qualifiedName, docType);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
-// }
-// assertTrue("throw_WRONG_DOCUMENT_ERR", success);
-//
-// }
-
-// public void testCreateDocument4() throws Throwable {
-// String namespaceURI = "http://www.ecommerce.org/schema";
-// String qualifiedName = "namespaceURI:x";
-// Document doc;
-// DocumentType docType;
-// DOMImplementation domImpl;
-// Document aNewDoc;
-// doc = (Document) load("staffNS", builder);
-// aNewDoc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// domImpl = aNewDoc.getImplementation();
-//
-// boolean success = false;
-// try {
-// aNewDoc = domImpl.createDocument(namespaceURI, qualifiedName,
-// docType);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
-// }
-// assertTrue("throw_WRONG_DOCUMENT_ERR", success);
-//
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument5() throws Throwable {
- String namespaceURI = "http://www.ecommerce.org/schema";
- String qualifiedName;
- Document doc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- List<String> illegalQNames = new ArrayList<String>();
- illegalQNames.add("namespaceURI:{");
- illegalQNames.add("namespaceURI:}");
- illegalQNames.add("namespaceURI:~");
- illegalQNames.add("namespaceURI:'");
- illegalQNames.add("namespaceURI:!");
- illegalQNames.add("namespaceURI:@");
- illegalQNames.add("namespaceURI:#");
- illegalQNames.add("namespaceURI:$");
- illegalQNames.add("namespaceURI:%");
- illegalQNames.add("namespaceURI:^");
- illegalQNames.add("namespaceURI:&");
- illegalQNames.add("namespaceURI:*");
- illegalQNames.add("namespaceURI:(");
- illegalQNames.add("namespaceURI:)");
- illegalQNames.add("namespaceURI:+");
- illegalQNames.add("namespaceURI:=");
- illegalQNames.add("namespaceURI:[");
- illegalQNames.add("namespaceURI:]");
- illegalQNames.add("namespaceURI:\\");
- illegalQNames.add("namespaceURI:/");
- illegalQNames.add("namespaceURI:;");
- illegalQNames.add("namespaceURI:`");
- illegalQNames.add("namespaceURI:<");
- illegalQNames.add("namespaceURI:>");
- illegalQNames.add("namespaceURI:,");
- illegalQNames.add("namespaceURI:a ");
- illegalQNames.add("namespaceURI:\"");
-
- doc = (Document) load("staffNS", builder);
- for (int indexN1009A = 0; indexN1009A < illegalQNames.size(); indexN1009A++) {
- qualifiedName = (String) illegalQNames.get(indexN1009A);
- domImpl = doc.getImplementation();
-
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, qualifiedName, docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
-
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument6() throws Throwable {
- String namespaceURI = "http://ecommerce.org/schema";
- String qualifiedName = "xml:local";
- Document doc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
-
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, qualifiedName, docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
-
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument7() throws Throwable {
- String namespaceURI = "http://www.ecommerce.org/schema";
- String qualifiedName = "y:x";
- Document doc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
- Document aNewDoc;
- String nodeName;
- String nodeValue;
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- aNewDoc = domImpl.createDocument(namespaceURI, qualifiedName, docType);
- nodeName = aNewDoc.getNodeName();
- nodeValue = aNewDoc.getNodeValue();
- assertEquals("nodeName", "#document", nodeName);
- assertNull("nodeValue", nodeValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument8() throws Throwable {
- String namespaceURI = "http://www.example.org/schema";
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- domImpl = builder.getDOMImplementation();
-
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, "", docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
-
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java b/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java
deleted file mode 100644
index c5061b8..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentType;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "createDocumentType(qualifiedName,publicId,systemId)" method for a
- * DOMImplementation should raise NAMESPACE_ERR DOMException if qualifiedName is
- * malformed.
- *
- * Retrieve the DOMImplementation on the XMLNS Document. Invoke method
- * createDocumentType(qualifiedName,publicId,systemId) on the retrieved
- * DOMImplementation with qualifiedName being the literal string
- * "prefix::local", publicId as "STAFF", and systemId as "staff". Method should
- * raise NAMESPACE_ERR DOMException.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocType</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('Level-2-Core-DOM-createDocType')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a>
- */
-@TestTargetClass(DOMImplementation.class)
-public final class CreateDocumentType extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocumentType",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testCreateDocumentType1() throws Throwable {
- String publicId = "STAFF";
- String systemId = "staff.xml";
- String malformedName = "prefix::local";
- Document doc;
- DOMImplementation domImpl;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
-
- {
- boolean success = false;
- try {
- domImpl.createDocumentType(malformedName, publicId, systemId);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocumentType",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testCreateDocumentType2() throws Throwable {
- String publicId = "http://www.localhost.com/";
- String systemId = "myDoc.dtd";
- String qualifiedName;
- Document doc;
-
- DOMImplementation domImpl;
- List<String> illegalQNames = new ArrayList<String>();
- illegalQNames.add("edi:{");
- illegalQNames.add("edi:}");
- illegalQNames.add("edi:~");
- illegalQNames.add("edi:'");
- illegalQNames.add("edi:!");
- illegalQNames.add("edi:@");
- illegalQNames.add("edi:#");
- illegalQNames.add("edi:$");
- illegalQNames.add("edi:%");
- illegalQNames.add("edi:^");
- illegalQNames.add("edi:&");
- illegalQNames.add("edi:*");
- illegalQNames.add("edi:(");
- illegalQNames.add("edi:)");
- illegalQNames.add("edi:+");
- illegalQNames.add("edi:=");
- illegalQNames.add("edi:[");
- illegalQNames.add("edi:]");
- illegalQNames.add("edi:\\");
- illegalQNames.add("edi:/");
- illegalQNames.add("edi:;");
- illegalQNames.add("edi:`");
- illegalQNames.add("edi:<");
- illegalQNames.add("edi:>");
- illegalQNames.add("edi:,");
- illegalQNames.add("edi:a ");
- illegalQNames.add("edi:\"");
-
- doc = (Document) load("staffNS", builder);
- for (int indexN1009A = 0; indexN1009A < illegalQNames.size(); indexN1009A++) {
- qualifiedName = (String) illegalQNames.get(indexN1009A);
- domImpl = doc.getImplementation();
-
- {
- boolean success = false;
- try {
- domImpl.createDocumentType(qualifiedName, publicId,
- systemId);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocumentType",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testCreateDocumentType3() throws Throwable {
-
- String qualifiedName = "prefix:myDoc";
- String publicId = "http://www.localhost.com";
- String systemId = "myDoc.dtd";
- Document doc;
- DOMImplementation domImpl;
- DocumentType newType = null;
-
- String nodeName;
- String nodeValue;
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- newType = domImpl.createDocumentType(qualifiedName, publicId, systemId);
- nodeName = newType.getNodeName();
- assertEquals("nodeName", "prefix:myDoc", nodeName);
- nodeValue = newType.getNodeValue();
- assertNull("nodeValue", nodeValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify null as parameters.",
- method = "createDocumentType",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testCreateDocumentType4() throws Throwable {
- String publicId = "http://www.example.com/";
- String systemId = "myDoc.dtd";
-
- DOMImplementation domImpl;
- domImpl = builder.getDOMImplementation();
-
- {
- boolean success = false;
- try {
- domImpl.createDocumentType("", publicId, systemId);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java b/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java
deleted file mode 100644
index 8d8bb4d..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "createElementNS(namespaceURI,qualifiedName)" method for a Document
- * should raise NAMESPACE_ERR DOMException if qualifiedName is malformed.
- *
- * Invoke method createElementNS(namespaceURI,qualifiedName) on the XMLNS
- * Document with namespaceURI being the literal string
- * "http://www.ecommerce.org/", and qualifiedName as "prefix::local". Method
- * should raise NAMESPACE_ERR DOMException.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NAMESPACE_ERR'])</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-DocCrElNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NAMESPACE_ERR'])</a>
- */
-@TestTargetClass(Document.class)
-public final class CreateElementNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify null as a parameters, and other types of DOMException.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS1() throws Throwable {
- String namespaceURI = "http://www.ecommerce.org/";
- String malformedName = "prefix::local";
- Document doc;
-
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createElementNS(namespaceURI, malformedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify null as a parameters, and other types of DOMException.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS2() throws Throwable {
- String namespaceURI = null;
-
- String qualifiedName = "prefix:local";
- Document doc;
-
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createElementNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify null as a parameters, and other types of DOMException.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS3() throws Throwable {
- String namespaceURI = "http://www.wedding.com/";
- String qualifiedName;
- Document doc;
-
- List<String> illegalQNames = new ArrayList<String>();
- illegalQNames.add("person:{");
- illegalQNames.add("person:}");
- illegalQNames.add("person:~");
- illegalQNames.add("person:'");
- illegalQNames.add("person:!");
- illegalQNames.add("person:@");
- illegalQNames.add("person:#");
- illegalQNames.add("person:$");
- illegalQNames.add("person:%");
- illegalQNames.add("person:^");
- illegalQNames.add("person:&");
- illegalQNames.add("person:*");
- illegalQNames.add("person:(");
- illegalQNames.add("person:)");
- illegalQNames.add("person:+");
- illegalQNames.add("person:=");
- illegalQNames.add("person:[");
- illegalQNames.add("person:]");
- illegalQNames.add("person:\\");
- illegalQNames.add("person:/");
- illegalQNames.add("person:;");
- illegalQNames.add("person:`");
- illegalQNames.add("person:<");
- illegalQNames.add("person:>");
- illegalQNames.add("person:,");
- illegalQNames.add("person:a ");
- illegalQNames.add("person:\"");
-
- doc = (Document) load("staffNS", builder);
- for (int indexN10098 = 0; indexN10098 < illegalQNames.size(); indexN10098++) {
- qualifiedName = (String) illegalQNames.get(indexN10098);
-
- {
- boolean success = false;
- try {
- doc.createElementNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify null as a parameters, and other types of DOMException.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS4() throws Throwable {
- String namespaceURI = "http://www.w3.org/XML/1998/namespaces";
- String qualifiedName = "xml:element1";
- Document doc;
-
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createElementNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify null as a parameters, and other types of DOMException.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS5() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String qualifiedName = "gov:faculty";
- Document doc;
- Element newElement;
- String elementName;
- doc = (Document) load("staffNS", builder);
- newElement = doc.createElementNS(namespaceURI, qualifiedName);
- elementName = newElement.getTagName();
- assertEquals("throw_Equals", qualifiedName, elementName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify null as a parameters, and other types of DOMException.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS6() throws Throwable {
- String namespaceURI = "http://www.example.com/";
-
- Document doc;
-
- doc = (Document) load("hc_staff", builder);
-
- {
- boolean success = false;
- try {
- doc.createElementNS(namespaceURI, "");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMDocumentBuilderFactory.java b/xml/src/test/java/tests/org/w3c/dom/DOMDocumentBuilderFactory.java
deleted file mode 100644
index d28b2d7..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DOMDocumentBuilderFactory.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package tests.org.w3c.dom;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-public class DOMDocumentBuilderFactory {
- /**
- * Parser configuration
- */
- private DocumentBuilderSetting[] settings = null;
-
- private DocumentBuilder builder = null;
-
- private DocumentBuilderFactory factory = null;
-
- public DOMDocumentBuilderFactory(DocumentBuilderSetting[] settings) {
- if (settings == null) {
- settings = new DocumentBuilderSetting[0];
- } else {
- settings = (DocumentBuilderSetting[]) settings.clone();
- }
-
- factory = DocumentBuilderFactory.newInstance();
-
- if (factory == null) {
- throw new RuntimeException("DocumentBuilderFactory must not be null");
- }
-
- if (settings != null) {
- for (int i = 0; i < settings.length; i++) {
- settings[i].applySetting(factory);
- }
- }
- try {
- builder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- }
-
- if (builder == null) {
- throw new RuntimeException("DocumentBuilder must not be null");
- }
-
- }
-
- public DocumentBuilder getBuilder() {
- return builder;
- }
-
- public boolean hasFeature(String feature, String version) {
- return builder.getDOMImplementation().hasFeature(feature, version);
- }
-
- public boolean isCoalescing() {
- return factory.isCoalescing();
- }
-
- public boolean isExpandEntityReferences() {
- return factory.isExpandEntityReferences();
- }
-
- public boolean isIgnoringElementContentWhitespace() {
- return factory.isIgnoringElementContentWhitespace();
- }
-
- public boolean isNamespaceAware() {
- return factory.isNamespaceAware();
- }
-
- public boolean isValidating() {
- return factory.isValidating();
- }
-
- public static DocumentBuilderSetting[] getConfiguration1() {
- return new DocumentBuilderSetting[] {
- DocumentBuilderSetting.notCoalescing,
- DocumentBuilderSetting.notExpandEntityReferences,
- DocumentBuilderSetting.notIgnoringElementContentWhitespace,
- DocumentBuilderSetting.notNamespaceAware,
- DocumentBuilderSetting.notValidating };
- }
-
- public static DocumentBuilderSetting[] getConfiguration2() {
- return new DocumentBuilderSetting[] {
- DocumentBuilderSetting.notCoalescing,
- DocumentBuilderSetting.notExpandEntityReferences,
- DocumentBuilderSetting.notIgnoringElementContentWhitespace,
- DocumentBuilderSetting.namespaceAware,
- DocumentBuilderSetting.notValidating };
-
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java
deleted file mode 100644
index d2650a4..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The createDocument method with valid arguments, should create a DOM Document
- * of the specified type.
- *
- * Call the createDocument on this DOMImplementation with createDocument
- * ("http://www.w3.org/DOMTest/L2",see the array below for valid QNames,null).
- * Check if the returned Document object is is empty with no Document Element.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument</a>
- */
-@TestTargetClass(DOMImplementation.class)
-public final class DOMImplementationCreateDocument extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument3() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- Document newDoc;
- DocumentType docType = null;
-
- String namespaceURI = "http://www.w3.org/DOMTest/L2";
- String qualifiedName;
- List<String> qualifiedNames = new ArrayList<String>();
- qualifiedNames.add("_:_");
- qualifiedNames.add("_:h0");
- qualifiedNames.add("_:test");
- qualifiedNames.add("l_:_");
- qualifiedNames.add("ns:_0");
- qualifiedNames.add("ns:a0");
- qualifiedNames.add("ns0:test");
- qualifiedNames.add("a.b:c");
- qualifiedNames.add("a-b:c");
- qualifiedNames.add("a-b:c");
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- for (int indexN1006B = 0; indexN1006B < qualifiedNames.size(); indexN1006B++) {
- qualifiedName = (String) qualifiedNames.get(indexN1006B);
- newDoc = domImpl.createDocument(namespaceURI, qualifiedName,
- docType);
- assertNotNull("domimplementationcreatedocument03", newDoc);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument4() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
-
- String namespaceURI = null;
-
- String qualifiedName = "dom:root";
- DocumentType docType = null;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
-
- {
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, qualifiedName, docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("domimplementationcreatedocument04", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument5() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
-
- String namespaceURI = "http://www.w3.org/xml/1998/namespace";
- String qualifiedName = "xml:root";
- DocumentType docType = null;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
-
- {
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, qualifiedName, docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("domimplementationcreatedocument05", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "createDocument",
- args = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class}
- )
- public void testCreateDocument7() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
-
- String namespaceURI = "http://www.w3.org/DOMTest/level2";
- DocumentType docType = null;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
-
- {
- boolean success = false;
- try {
- domImpl.createDocument(namespaceURI, ":", docType);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("domimplementationcreatedocument07", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java
deleted file mode 100644
index 286e75d..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method createDocumentType with valid values for qualifiedName, publicId
- * and systemId should create an empty DocumentType node.
- *
- * Invoke createDocument on this DOMImplementation with a valid qualifiedName
- * and different publicIds and systemIds. Check if the the DocumentType node was
- * created with its ownerDocument attribute set to null.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-DOM-createDocument</a>
- */
-@TestTargetClass(DOMImplementation.class)
-public final class DOMImplementationCreateDocumentType extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "createDocumentType",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testCreateDocumentType1() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- DocumentType newDocType;
- Document ownerDocument;
- String qualifiedName = "test:root";
- String publicId;
- String systemId;
- List<String> publicIds = new ArrayList<String>();
- publicIds.add("1234");
- publicIds.add("test");
-
- List<String> systemIds = new ArrayList<String>();
- systemIds.add("");
- systemIds.add("test");
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- for (int indexN1005D = 0; indexN1005D < publicIds.size(); indexN1005D++) {
- publicId = (String) publicIds.get(indexN1005D);
- for (int indexN10061 = 0; indexN10061 < systemIds.size(); indexN10061++) {
- systemId = (String) systemIds.get(indexN10061);
- newDocType = domImpl.createDocumentType(qualifiedName,
- publicId, systemId);
- assertNotNull(
- "domimplementationcreatedocumenttype01_newDocType",
- newDocType);
- ownerDocument = newDocType.getOwnerDocument();
- assertNull(
- "domimplementationcreatedocumenttype01_ownerDocument",
- ownerDocument);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "createDocumentType",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testCreateDocumentType2() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- DocumentType newDocType;
- Document ownerDocument;
- String publicId = "http://www.w3.org/DOM/Test/dom2.dtd";
- String systemId = "dom2.dtd";
- String qualifiedName;
- List<String> qualifiedNames = new ArrayList<String>();
- qualifiedNames.add("_:_");
- qualifiedNames.add("_:h0");
- qualifiedNames.add("_:test");
- qualifiedNames.add("_:_.");
- qualifiedNames.add("_:a-");
- qualifiedNames.add("l_:_");
- qualifiedNames.add("ns:_0");
- qualifiedNames.add("ns:a0");
- qualifiedNames.add("ns0:test");
- qualifiedNames.add("ns:EEE.");
- qualifiedNames.add("ns:_-");
- qualifiedNames.add("a.b:c");
- qualifiedNames.add("a-b:c.j");
- qualifiedNames.add("a-b:c");
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- for (int indexN10077 = 0; indexN10077 < qualifiedNames.size(); indexN10077++) {
- qualifiedName = (String) qualifiedNames.get(indexN10077);
- newDocType = domImpl.createDocumentType(qualifiedName, publicId,
- systemId);
- assertNotNull("domimplementationcreatedocumenttype02_newDocType",
- newDocType);
- ownerDocument = newDocType.getOwnerDocument();
- assertNull("domimplementationcreatedocumenttype02_ownerDocument",
- ownerDocument);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "createDocumentType",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testCreateDocumentType4() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- DocumentType newDocType;
- Document ownerDocument;
- String publicId = "http://www.w3.org/DOM/Test/dom2.dtd";
- String systemId = "dom2.dtd";
- String qualifiedName;
- List<String> qualifiedNames = new ArrayList<String>();
- qualifiedNames.add("_:_");
- qualifiedNames.add("_:h0");
- qualifiedNames.add("_:test");
- qualifiedNames.add("_:_.");
- qualifiedNames.add("_:a-");
- qualifiedNames.add("l_:_");
- qualifiedNames.add("ns:_0");
- qualifiedNames.add("ns:a0");
- qualifiedNames.add("ns0:test");
- qualifiedNames.add("ns:EEE.");
- qualifiedNames.add("ns:_-");
- qualifiedNames.add("a.b:c");
- qualifiedNames.add("a-b:c.j");
- qualifiedNames.add("a-b:c");
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- for (int indexN10077 = 0; indexN10077 < qualifiedNames.size(); indexN10077++) {
- qualifiedName = (String) qualifiedNames.get(indexN10077);
- newDocType = domImpl.createDocumentType(qualifiedName, publicId,
- systemId);
- assertNotNull("domimplementationcreatedocumenttype02_newDocType",
- newDocType);
- ownerDocument = newDocType.getOwnerDocument();
- assertNull("domimplementationcreatedocumenttype02_ownerDocument",
- ownerDocument);
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java
deleted file mode 100644
index 257555b..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "feature" parameter in the "hasFeature(feature,version)" method is the
- * package name of the feature. Legal values are XML and HTML and CORE. (Test
- * for feature core, lower case)
- *
- * Retrieve the entire DOM document and invoke its "getImplementation()" method.
- * This should create a DOMImplementation object whose "hasFeature(feature,
- * version)" method is invoked with feature equal to "core". The method should
- * return a boolean "true".
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-5CED94D7</a>
- */
-@TestTargetClass(DOMImplementation.class)
-public final class DOMImplementationHasFeature extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that hasFeature returns true value.",
- method = "hasFeature",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasFeatureCore() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- boolean state;
- doc = (Document) load("staff", builder);
- domImpl = doc.getImplementation();
- state = domImpl.hasFeature("core", "2.0");
- assertTrue("domimplementationFeaturecoreAssert", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that hasFeature returns true value.",
- method = "hasFeature",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasFeatureXml() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- boolean state;
- doc = (Document) load("staff", builder);
- domImpl = doc.getImplementation();
- state = domImpl.hasFeature("xml", "2.0");
- assertTrue("domimplementationFeaturexmlVersion2Assert", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that hasFeature method returns false.",
- method = "hasFeature",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasFeature1() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- String version = "";
- String version1 = "1.0";
- String version2 = "2.0";
- String featureCore;
- String featureXML;
- boolean success;
- List<String> featuresXML = new ArrayList<String>();
- featuresXML.add("XML");
- featuresXML.add("xmL");
-
- List<String> featuresCore = new ArrayList<String>();
- featuresCore.add("Core");
- featuresCore.add("CORE");
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- for (int indexN10063 = 0; indexN10063 < featuresXML.size(); indexN10063++) {
- featureXML = (String) featuresXML.get(indexN10063);
- success = domImpl.hasFeature(featureXML, version);
- assertTrue("domimplementationhasfeature01_XML_1", success);
- success = domImpl.hasFeature(featureXML, version1);
- assertTrue("domimplementationhasfeature01_XML_2", success);
- }
- for (int indexN1007C = 0; indexN1007C < featuresCore.size(); indexN1007C++) {
- featureCore = (String) featuresCore.get(indexN1007C);
- success = domImpl.hasFeature(featureCore, version);
- assertTrue("domimplementationhasfeature01_Core_1", success);
- success = domImpl.hasFeature(featureCore, version1);
- success = domImpl.hasFeature(featureCore, version2);
- assertTrue("domimplementationhasfeature01_Core_3", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that hasFeature method returns false.",
- method = "hasFeature",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasFeature2() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- boolean success;
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- success = domImpl.hasFeature("Blah Blah", "");
- assertFalse("domimplementationhasfeature02", success);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DOMTestCase.java b/xml/src/test/java/tests/org/w3c/dom/DOMTestCase.java
deleted file mode 100644
index 041b67b..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DOMTestCase.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargetClass;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import junit.framework.TestCase;
-
-@TestTargetClass(Document.class)
-public class DOMTestCase extends TestCase {
-
- public Document load(String docURI, DocumentBuilder builder) {
- Document doc = load(resolveURI(docURI), builder);
- return doc;
- }
-
- public Document load(URL url, DocumentBuilder builder) {
- Document doc = null;
- Exception parseException = null;
- try {
- LoadErrorHandler errorHandler = new LoadErrorHandler();
- builder.setErrorHandler(errorHandler);
- doc = builder.parse(url.openStream());
- parseException = errorHandler.getFirstException();
- } catch (Exception ex) {
- parseException = ex;
- }
- builder.setErrorHandler(null);
- if (parseException != null) {
- // fail("Unexpected exception " + parseException.getMessage());
- throw new RuntimeException("Unexpected exception " + parseException.getMessage(), parseException);
- }
- return doc;
- }
-
- public void preload(String contentType, String docURI,
- boolean willBeModified) {
- if ("text/html".equals(contentType)
- || "application/xhtml+xml".equals(contentType)) {
- if (docURI.startsWith("staff")
- || docURI.equals("datatype_normalization")) {
-
- }
- }
- }
-
- private URL resolveURI(String baseURI) {
- String docURI = baseURI + ".xml";
-
- URL resolvedURI = null;
- try {
- resolvedURI = new URL(docURI);
- if (resolvedURI.getProtocol() != null) {
- return resolvedURI;
- }
- } catch (MalformedURLException ex) {
- // fail("Unexpected exception " + ex.getMessage());
- }
- //
- // build a URL for a test file in the JAR
- //
- resolvedURI = getClass().getResource("/" + docURI);
- if (resolvedURI == null) {
- //
- // see if it is an absolute URI
- //
- int firstSlash = docURI.indexOf('/');
- try {
- if (firstSlash == 0
- || (firstSlash >= 1 && docURI.charAt(firstSlash - 1) == ':')) {
- resolvedURI = new URL(docURI);
- } else {
- //
- // try the files/level?/spec directory
- //
- String filename = getClass().getPackage().getName();
- filename = "tests/"
- + filename.substring(14).replace('.', '/')
- + "/files/" + docURI;
- resolvedURI = new java.io.File(filename).toURL();
- }
- } catch (MalformedURLException ex) {
- fail("Unexpected exception " + ex.getMessage());
- }
- }
-
- if (resolvedURI == null) {
- fail("resolvedURI is null ");
- }
- return resolvedURI;
- }
-
-
- public String getContentType() {
- return "xml";
- }
-
- public void assertURIEquals(String assertID, String scheme, String path,
- String host, String file, String name, String query,
- String fragment, Boolean isAbsolute, String actual) {
- //
- // URI must be non-null
- assertNotNull(assertID, actual);
-
- String uri = actual;
-
- int lastPound = actual.lastIndexOf("#");
- String actualFragment = "";
- if (lastPound != -1) {
- //
- // substring before pound
- //
- uri = actual.substring(0, lastPound);
- actualFragment = actual.substring(lastPound + 1);
- }
- if (fragment != null) {
- assertEquals(assertID, fragment, actualFragment);
-
- }
- int lastQuestion = uri.lastIndexOf("?");
- String actualQuery = "";
- if (lastQuestion != -1) {
- //
- // substring before pound
- //
- uri = actual.substring(0, lastQuestion);
- actualQuery = actual.substring(lastQuestion + 1);
- }
- if (query != null) {
- assertEquals(assertID, query, actualQuery);
-
- }
- int firstColon = uri.indexOf(":");
- int firstSlash = uri.indexOf("/");
- String actualPath = uri;
- String actualScheme = "";
- if (firstColon != -1 && firstColon < firstSlash) {
- actualScheme = uri.substring(0, firstColon);
- actualPath = uri.substring(firstColon + 1);
- }
-
- if (scheme != null) {
- assertEquals(assertID, scheme, actualScheme);
- }
-
- if (path != null) {
- assertEquals(assertID, path, actualPath);
- }
-
- if (host != null) {
- String actualHost = "";
- if (actualPath.startsWith("//")) {
- int termSlash = actualPath.indexOf("/", 2);
- actualHost = actualPath.substring(0, termSlash);
- }
- assertEquals(assertID, host, actualHost);
- }
-
- String actualFile = actualPath;
- if (file != null || name != null) {
- int finalSlash = actualPath.lastIndexOf("/");
- if (finalSlash != -1) {
- actualFile = actualPath.substring(finalSlash + 1);
- }
- if (file != null) {
- assertEquals(assertID, file, actualFile);
- }
- }
-
- if (name != null) {
- String actualName = actualFile;
- int finalPeriod = actualFile.lastIndexOf(".");
- if (finalPeriod != -1) {
- actualName = actualFile.substring(0, finalPeriod);
- }
- assertEquals(assertID, name, actualName);
- }
-
- if (isAbsolute != null) {
- //
- // Jar URL's will have any actual path like file:/c:/somedrive...
- assertEquals(assertID, isAbsolute.booleanValue(), actualPath
- .startsWith("/")
- || actualPath.startsWith("file:/"));
- }
- }
-
-
- private class LoadErrorHandler implements org.xml.sax.ErrorHandler {
- private SAXException parseException;
-
- private int errorCount;
-
- private int warningCount;
-
- public LoadErrorHandler() {
- parseException = null;
- errorCount = 0;
- warningCount = 0;
- }
-
- public void error(SAXParseException ex) {
- errorCount++;
- if (parseException == null) {
- parseException = ex;
- }
- }
-
- public void warning(SAXParseException ex) {
- warningCount++;
- }
-
- public void fatalError(SAXParseException ex) {
- if (parseException == null) {
- parseException = ex;
- }
- }
-
- public SAXException getFirstException() {
- return parseException;
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSetting.java b/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSetting.java
deleted file mode 100644
index bbb7190..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSetting.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute
- * of Technology, Institut National de Recherche en Informatique et en
- * Automatique, Keio University). All Rights Reserved. This program is
- * distributed under the W3C's Software Intellectual Property License. This
- * program is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See W3C License
- * http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package tests.org.w3c.dom;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-/**
- * This class is an parser setting, such as non-validating or entity-expanding.
- *
- * @author Curt Arnold @date 2 Feb 2002
- */
-public final class DocumentBuilderSetting {
- /**
- * property name.
- */
- private final String property;
-
- /**
- * property value.
- */
- private final boolean value;
-
- /**
- * strategy used to set or get property value.
- */
- private final DocumentBuilderSettingStrategy strategy;
-
- /**
- * coalescing = true.
- */
- public static final DocumentBuilderSetting coalescing =
- new DocumentBuilderSetting(
- "coalescing",
- true,
- DocumentBuilderSettingStrategy.coalescing);
-
- /**
- * coalescing = false.
- */
- public static final DocumentBuilderSetting notCoalescing =
- new DocumentBuilderSetting(
- "coalescing",
- false,
- DocumentBuilderSettingStrategy.coalescing);
-
- /**
- * expandEntityReferences = false.
- */
- public static final DocumentBuilderSetting expandEntityReferences =
- new DocumentBuilderSetting(
- "expandEntityReferences",
- true,
- DocumentBuilderSettingStrategy.expandEntityReferences);
-
- /**
- * expandEntityReferences = true.
- */
- public static final DocumentBuilderSetting notExpandEntityReferences =
- new DocumentBuilderSetting(
- "expandEntityReferences",
- false,
- DocumentBuilderSettingStrategy.expandEntityReferences);
-
- /**
- * ignoringElementContentWhitespace = true.
- */
- public static final DocumentBuilderSetting ignoringElementContentWhitespace =
- new DocumentBuilderSetting(
- "ignoringElementContentWhitespace",
- true,
- DocumentBuilderSettingStrategy.ignoringElementContentWhitespace);
-
- /**
- * ignoringElementContentWhitespace = false.
- */
- public static final DocumentBuilderSetting
- notIgnoringElementContentWhitespace =
- new DocumentBuilderSetting(
- "ignoringElementContentWhitespace",
- false,
- DocumentBuilderSettingStrategy.ignoringElementContentWhitespace);
-
- /**
- * namespaceAware = true.
- */
- public static final DocumentBuilderSetting namespaceAware =
- new DocumentBuilderSetting(
- "namespaceAware",
- true,
- DocumentBuilderSettingStrategy.namespaceAware);
-
- /**
- * namespaceAware = false.
- */
- public static final DocumentBuilderSetting notNamespaceAware =
- new DocumentBuilderSetting(
- "namespaceAware",
- false,
- DocumentBuilderSettingStrategy.namespaceAware);
-
- /**
- * validating = true.
- */
- public static final DocumentBuilderSetting validating =
- new DocumentBuilderSetting(
- "validating",
- true,
- DocumentBuilderSettingStrategy.validating);
-
- /**
- * validating = false.
- */
- public static final DocumentBuilderSetting notValidating =
- new DocumentBuilderSetting(
- "validating",
- false,
- DocumentBuilderSettingStrategy.validating);
-
- /**
- * signed = true.
- */
- public static final DocumentBuilderSetting signed =
- new DocumentBuilderSetting(
- "signed",
- true,
- DocumentBuilderSettingStrategy.signed);
-
- /**
- * signed = false.
- */
- public static final DocumentBuilderSetting notSigned =
- new DocumentBuilderSetting(
- "signed",
- false,
- DocumentBuilderSettingStrategy.signed);
-
- /**
- * hasNullString = true.
- */
- public static final DocumentBuilderSetting hasNullString =
- new DocumentBuilderSetting(
- "hasNullString",
- true,
- DocumentBuilderSettingStrategy.hasNullString);
-
- /**
- * hasNullString = false.
- */
- public static final DocumentBuilderSetting notHasNullString =
- new DocumentBuilderSetting(
- "hasNullString",
- false,
- DocumentBuilderSettingStrategy.hasNullString);
-
- /**
- * Schema validating enabled.
- */
- public static final DocumentBuilderSetting schemaValidating =
- new DocumentBuilderSetting(
- "schemaValidating",
- true,
- DocumentBuilderSettingStrategy.schemaValidating);
-
- /**
- * Schema validating disabled.
- */
- public static final DocumentBuilderSetting notSchemaValidating =
- new DocumentBuilderSetting(
- "schemaValidating",
- false,
- DocumentBuilderSettingStrategy.schemaValidating);
-
- /**
- * Comments ignored.
- */
- public static final DocumentBuilderSetting ignoringComments =
- new DocumentBuilderSetting(
- "ignoringComments",
- true,
- DocumentBuilderSettingStrategy.ignoringComments);
-
- /**
- * Comments preserved.
- */
- public static final DocumentBuilderSetting notIgnoringComments =
- new DocumentBuilderSetting(
- "ignoringComments",
- false,
- DocumentBuilderSettingStrategy.ignoringComments);
-
- /**
- * Protected constructor, use static members for supported settings.
- * @param property property name, follows JAXP.
- * @param value property value
- * @param strategy strategy, may not be null
- */
- protected DocumentBuilderSetting(
- String property,
- boolean value,
- DocumentBuilderSettingStrategy strategy) {
- if (property == null) {
- throw new NullPointerException("property");
- }
- this.property = property;
- this.value = value;
- this.strategy = strategy;
- }
-
- /**
- * Returns true if the settings have a conflict or are identical.
- *
- * @param other
- * other setting, may not be null.
- * @return true if this setting and the specified setting conflict
- */
- public final boolean hasConflict(DocumentBuilderSetting other) {
- if (other == null) {
- throw new NullPointerException("other");
- }
- if (other == this) {
- return true;
- }
- return strategy.hasConflict(other.strategy);
- }
-
- /**
- * Determines current value of setting.
- * @param factory DOMTestDocumentBuilderFactory factory
- * @return boolean true if property enabled.
- */
- public final boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return strategy.hasSetting(factory) == value;
- }
-
- /**
- * Attempts to change builder to have this setting.
- * @param factory DocumentBuilderFactory Factory for DOM builders
- * @throws DOMTestIncompatibleException
- * if factory does not support the setting
- */
- public final void applySetting(DocumentBuilderFactory factory) {
- strategy.applySetting(factory, value);
- }
-
- /**
- * Gets the property name.
- * @return property name
- */
- public final String getProperty() {
- return property;
- }
-
- /**
- * Gets the property value.
- * @return property value
- */
- public final boolean getValue() {
- return value;
- }
-
- /**
- * Gets a string representation of the setting.
- * @return string representation
- */
- public final String toString() {
- StringBuffer builder = new StringBuffer(property);
- builder.append('=');
- builder.append(String.valueOf(value));
- return builder.toString();
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSettingStrategy.java b/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSettingStrategy.java
deleted file mode 100644
index 77bbce8..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSettingStrategy.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package tests.org.w3c.dom;
-
-import java.lang.reflect.Method;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-
-public abstract class DocumentBuilderSettingStrategy {
- protected DocumentBuilderSettingStrategy() {
- }
-
- private static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
-
- private static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
-
- public boolean hasConflict(DocumentBuilderSettingStrategy other) {
- return (other == this);
- }
-
- public abstract void applySetting(DocumentBuilderFactory factory,
- boolean value);
-
- public abstract boolean hasSetting(DOMDocumentBuilderFactory factory);
-
- public static final DocumentBuilderSettingStrategy coalescing = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory,
- boolean value) {
- factory.setCoalescing(value);
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return factory.isCoalescing();
- }
-
- };
-
- public static final DocumentBuilderSettingStrategy expandEntityReferences = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value) {
- factory.setExpandEntityReferences(value);
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return factory.isExpandEntityReferences();
- }
- };
-
- public static final DocumentBuilderSettingStrategy ignoringElementContentWhitespace = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value) {
- factory.setIgnoringElementContentWhitespace(value);
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return factory.isIgnoringElementContentWhitespace();
- }
- };
-
- public static final DocumentBuilderSettingStrategy ignoringComments = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value) {
- if (value) {
- System.out.println("ignoreComments=true not supported");
- }
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return false;
- }
- };
-
- public static final DocumentBuilderSettingStrategy namespaceAware = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value)
- {
- factory.setNamespaceAware(value);
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return factory.isNamespaceAware();
- }
- };
-
- public static final DocumentBuilderSettingStrategy validating = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value)
- {
- factory.setValidating(value);
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return factory.isValidating();
- }
- };
-
- public static final DocumentBuilderSettingStrategy signed = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value)
- {
- if (!value) {
- System.out.println("DocumentBuilderSetting.notSigned");
- }
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return true;
- }
- };
-
- public static final DocumentBuilderSettingStrategy hasNullString = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value)
- {
- if (!value) {
- System.out.println("DocumentBuilderSetting.notHasNullString");
- }
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- return true;
- }
- };
-
- public static final DocumentBuilderSettingStrategy schemaValidating = new DocumentBuilderSettingStrategy() {
- public void applySetting(DocumentBuilderFactory factory, boolean value)
- {
- if (value) {
- factory.setNamespaceAware(true);
- factory.setValidating(true);
- factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
- } else {
- factory.setAttribute(JAXP_SCHEMA_LANGUAGE,
- "http://www.w3.org/TR/REC-xml");
- }
- }
-
- public boolean hasSetting(DOMDocumentBuilderFactory factory) {
- try {
- if (factory.isValidating()) {
- Method getAttrMethod = factory.getClass().getMethod(
- "getAttribute", new Class[] { String.class });
- String val = (String) getAttrMethod.invoke(factory,
- new Object[] { JAXP_SCHEMA_LANGUAGE });
- return W3C_XML_SCHEMA.equals(val);
- }
- } catch (Exception ex) {
- }
- return false;
- }
-
- //
- // schema validating conflicts with namespaceAware
- // and validating
- //
- public boolean hasConflict(DocumentBuilderSettingStrategy other) {
- if (other == this
- || other == DocumentBuilderSettingStrategy.namespaceAware
- || other == DocumentBuilderSettingStrategy.validating) {
- return true;
- }
- return false;
- }
-
- };
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java
deleted file mode 100644
index e46f3b3..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method createAttributeNS creates an attribute of the given qualified name
- * and namespace URI
- *
- * Invoke the createAttributeNS method on this Document object with a null
- * namespaceURI, and a qualifiedName without a prefix. This should return a
- * valid Attr node object.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core">http://www.w3.org/TR/DOM-Level-2-Core/core</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrAttrNS</a>
- */
-@TestTargetClass(Document.class)
-public final class DocumentCreateAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS1() throws Throwable {
- Document doc;
- Attr attribute;
- String namespaceURI = null;
-
- String qualifiedName = "test";
-
- String nodeName;
-
- doc = (Document) load("staffNS", builder);
- attribute = doc.createAttributeNS(namespaceURI, qualifiedName);
- nodeName = attribute.getNodeName();
-
- assertEquals("documentcreateattributeNS01", "test", nodeName);
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS2() throws Throwable {
- Document doc;
- Attr attribute1;
- Attr attribute2;
- String name;
- String nodeName;
- String nodeValue;
- String prefix;
- String namespaceURI;
- doc = (Document) load("staffNS", builder);
- attribute1 = doc.createAttributeNS(
- "http://www.w3.org/XML/1998/namespace", "xml:xml");
- name = attribute1.getName();
- nodeName = attribute1.getNodeName();
- nodeValue = attribute1.getNodeValue();
- prefix = attribute1.getPrefix();
- namespaceURI = attribute1.getNamespaceURI();
- assertEquals("documentcreateattributeNS02_att1_name", "xml:xml", name);
- assertEquals("documentcreateattributeNS02_att1_nodeName", "xml:xml",
- nodeName);
- assertEquals("documentcreateattributeNS02_att1_nodeValue", "",
- nodeValue);
- assertEquals("documentcreateattributeNS02_att1_prefix", "xml", prefix);
- assertEquals("documentcreateattributeNS02_att1_namespaceURI",
- "http://www.w3.org/XML/1998/namespace", namespaceURI);
- attribute2 = doc.createAttributeNS("http://www.w3.org/2000/xmlns/",
- "xmlns");
- name = attribute2.getName();
- nodeName = attribute2.getNodeName();
- nodeValue = attribute2.getNodeValue();
- prefix = attribute2.getPrefix();
- namespaceURI = attribute2.getNamespaceURI();
- assertEquals("documentcreateattributeNS02_att2_name", "xmlns", name);
- assertEquals("documentcreateattributeNS02_att2_nodeName", "xmlns",
- nodeName);
- assertEquals("documentcreateattributeNS02_att2_nodeValue", "",
- nodeValue);
- assertEquals("documentcreateattributeNS02_att2_namespaceURI",
- "http://www.w3.org/2000/xmlns/", namespaceURI);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createAttributeNS throws DOMException with INVALID_CHARACTER_ERR code.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS3() throws Throwable {
- Document doc;
-
- String namespaceURI = "http://www.w3.org/DOM/Test/Level2";
- String qualifiedName;
- List<String> qualifiedNames = new ArrayList<String>();
- qualifiedNames.add("/");
- qualifiedNames.add("//");
- qualifiedNames.add("\\");
- qualifiedNames.add(";");
- qualifiedNames.add("&");
- qualifiedNames.add("*");
- qualifiedNames.add("]]");
- qualifiedNames.add(">");
- qualifiedNames.add("<");
-
- doc = (Document) load("staffNS", builder);
- for (int indexN1005A = 0; indexN1005A < qualifiedNames.size(); indexN1005A++) {
- qualifiedName = (String) qualifiedNames.get(indexN1005A);
-
- {
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("documentcreateattributeNS03", success);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS4() throws Throwable {
- Document doc;
-
- String namespaceURI = "http://www.w3.org/DOM/Test/Level2";
- String qualifiedName;
- List<String> qualifiedNames = new ArrayList<String>();
- qualifiedNames.add("_:");
- qualifiedNames.add(":0a");
- qualifiedNames.add(":");
- qualifiedNames.add("a:b:c");
- qualifiedNames.add("_::a");
-
- doc = (Document) load("staffNS", builder);
- for (int indexN1004E = 0; indexN1004E < qualifiedNames.size(); indexN1004E++) {
- qualifiedName = (String) qualifiedNames.get(indexN1004E);
-
- {
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("documentcreateattributeNS04", success);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS5() throws Throwable {
- Document doc;
- Document newDoc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- String namespaceURI = null;
-
- String qualifiedName = "abc:def";
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test",
- "dom:doc", docType);
-
- {
- boolean success = false;
- try {
- newDoc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("documentcreateattributeNS05", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS6() throws Throwable {
- Document doc;
- Document newDoc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- String namespaceURI = "http://www.w3.org/XML/1998 /namespace";
- String qualifiedName = "xml:root";
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test",
- "dom:doc", docType);
-
- {
- boolean success = false;
- try {
- newDoc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("documentcreateattributeNS06", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createAttributeNS throws DOMException with NAMESPACE_ERR code.",
- method = "createAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateAttributeNS7() throws Throwable {
- Document doc;
-
- String namespaceURI = "http://www.W3.org/2000/xmlns";
- String qualifiedName = "xmlns";
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createAttributeNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("documentcreateattributeNS07", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java
deleted file mode 100644
index 85f2fff..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method createElementNS creates an element of the given valid
- * qualifiedName and NamespaceURI.
- *
- * Invoke the createElementNS method on this Document object with a valid
- * namespaceURI and qualifiedName. Check if a valid Element object is returned
- * with the same node attributes.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core">http://www.w3.org/TR/DOM-Level-2-Core/core</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-DocCrElNS</a>
- */
-@TestTargetClass(Document.class)
-public final class DocumentCreateElementNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS1() throws Throwable {
- Document doc;
- Element element;
- String namespaceURI = "http://www.w3.org/DOM/Test/level2";
- String qualifiedName = "XML:XML";
- String nodeName;
- String nsURI;
- String localName;
- String prefix;
- String tagName;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS(namespaceURI, qualifiedName);
- nodeName = element.getNodeName();
- nsURI = element.getNamespaceURI();
- localName = element.getLocalName();
- prefix = element.getPrefix();
- tagName = element.getTagName();
- assertEquals("documentcreateelementNS01_nodeName", "XML:XML", nodeName);
- assertEquals("documentcreateelementNS01_namespaceURI",
- "http://www.w3.org/DOM/Test/level2", nsURI);
- assertEquals("documentcreateelementNS01_localName", "XML", localName);
- assertEquals("documentcreateelementNS01_prefix", "XML", prefix);
- assertEquals("documentcreateelementNS01_tagName", "XML:XML", tagName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createElementNS throws DOMException with INVALID_CHARACTER_ERR code.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS2() throws Throwable {
- Document doc;
-
- String namespaceURI = null;
-
- String qualifiedName = "^^";
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createElementNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("documentcreateelementNS02", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createElementNS throws DOMException with NAMESPACE_ERR code.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS5() throws Throwable {
- Document doc;
-
- String namespaceURI = null;
-
- String qualifiedName = "null:xml";
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.createElementNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("documentcreateelementNS05", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that createElementNS throws DOMException with NAMESPACE_ERR code.",
- method = "createElementNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testCreateElementNS6() throws Throwable {
- Document doc;
- Document newDoc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
-
- String namespaceURI = "http://www.w3.org/xml/1998/namespace ";
- String qualifiedName = "xml:root";
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test",
- "dom:doc", docType);
-
- {
- boolean success = false;
- try {
- newDoc.createElementNS(namespaceURI, qualifiedName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("documentcreateelementNS06", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java
deleted file mode 100644
index 390bf11..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getElementsByTagNameNS returns a NodeList of all the Elements with
- * a given local name and namespace URI in the order in which they are
- * encountered in a preorder traversal of the Document tree.
- *
- * Invoke the getElementsByTagNameNS method on a new Document object with the
- * values of namespaceURI=* and localName=*. This should return a nodeList of 1
- * item.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core">http://www.w3.org/TR/DOM-Level-2-Core/core</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
- */
-@TestTargetClass(Document.class)
-public final class DocumentGetElementsByTagnameNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies '*' as parameters.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS1() throws Throwable {
- Document doc;
- Document newDoc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
- NodeList childList;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- newDoc = domImpl.createDocument(nullNS, "root", docType);
- childList = newDoc.getElementsByTagNameNS("*", "*");
- assertEquals("documentgetelementsbytagnameNS01", 1, childList
- .getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies '*' as the first parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS2() throws Throwable {
- Document doc;
- Element docElem;
- Element element;
- NodeList childList;
-
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- element = doc.createElementNS("test", "employeeId");
- docElem.appendChild(element);
- childList = doc.getElementsByTagNameNS("*", "employeeId");
- assertEquals("documentgetelementsbytagnameNS02", 6, childList
- .getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies wrong namespaceURI as a parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS3() throws Throwable {
- Document doc;
- NodeList childList;
- doc = (Document) load("staffNS", builder);
- childList = doc.getElementsByTagNameNS("**", "*");
- assertEquals("documentgetelementsbytagnameNS03", 0, childList
- .getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS4() throws Throwable {
- Document doc;
- NodeList childList;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- childList = doc.getElementsByTagNameNS(nullNS, "0");
- assertEquals("documentgetelementsbytagnameNS04", 0, childList
- .getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS5() throws Throwable {
- Document doc;
- NodeList childList;
- doc = (Document) load("staffNS", builder);
- childList = doc.getElementsByTagNameNS("null", "elementId");
- assertEquals("documentgetelementsbytagnameNS05", 0, childList
- .getLength());
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java b/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java
deleted file mode 100644
index 7c82ac7..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getElementById returns the element whose ID is given by elementId.
- * If not such element exists, returns null.
- *
- * Invoke the getElementById method on this Document object with an invalid
- * elementId. This should return a null element.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core">http://www.w3.org/TR/DOM-Level-2-Core/core</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBId</a>
- */
-@TestTargetClass(Document.class)
-public final class DocumentGeteEementById extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify getElementById method for existent element.",
- method = "getElementById",
- args = {java.lang.String.class}
- )
- public void testGetElementById() throws Throwable {
- Document doc;
- Element element;
- String elementId = "---";
- doc = (Document) load("staffNS", builder);
- element = doc.getElementById(elementId);
- assertNull("documentgetelementbyid01", element);
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java b/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java
deleted file mode 100644
index 426a0ad..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java
+++ /dev/null
@@ -1,699 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.ProcessingInstruction;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The importNode method imports a node from another document to this document.
- * The returned node has no parent; (parentNode is null). The source node is not
- * altered or removed from the original document but a new copy of the source
- * node is created.
- *
- * Using the method importNode with deep=true, import the attribute, "street" of
- * the second element node, from a list of nodes whose local names are "address"
- * and namespaceURI "http://www.nist.gov" into the same document. Check the
- * parentNode, nodeName, nodeType and nodeValue of the imported node to verify
- * if it has been imported correctly.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core">http://www.w3.org/TR/DOM-Level-2-Core/core</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode">http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode</a>
- */
-@TestTargetClass(Document.class)
-public final class DocumentImportNode extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testImportNode1() throws Throwable {
-// Document doc;
-// Element element;
-// Attr attr;
-// NodeList childList;
-// Node importedAttr;
-// String nodeName;
-// int nodeType;
-// String nodeValue;
-// doc = (Document) load("staffNS", builder);
-// childList = doc
-// .getElementsByTagNameNS("http://www.nist.gov", "address");
-// element = (Element) childList.item(1);
-// attr = element.getAttributeNode("street");
-// importedAttr = doc.importNode(attr, false);
-// nodeName = importedAttr.getNodeName();
-// nodeValue = importedAttr.getNodeValue();
-// nodeType = (int) importedAttr.getNodeType();
-// assertEquals("documentimportnode01_nodeName", "street", nodeName);
-// assertEquals("documentimportnode01_nodeType", 2, nodeType);
-// assertEquals("documentimportnode01_nodeValue", "Yes", nodeValue);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException exception.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode2() throws Throwable {
- Document doc;
- Document docImported;
- Element element;
- Attr attr;
- Node importedAttr;
- String nodeName;
- int nodeType;
- String nodeValue;
- NodeList addresses;
- Node attrsParent;
- doc = (Document) load("staffNS", builder);
- docImported = (Document) load("staff", builder);
- addresses = doc
- .getElementsByTagNameNS("http://www.nist.gov", "address");
- element = (Element) addresses.item(1);
- attr = element.getAttributeNodeNS("http://www.nist.gov", "zone");
- importedAttr = docImported.importNode(attr, false);
- nodeName = importedAttr.getNodeName();
- nodeType = (int) importedAttr.getNodeType();
- nodeValue = importedAttr.getNodeValue();
- attrsParent = importedAttr.getParentNode();
- assertNull("documentimportnode02_parentNull", attrsParent);
- assertEquals("documentimportnode02_nodeName", "emp:zone", nodeName);
- assertEquals("documentimportnode02_nodeType", 2, nodeType);
- assertEquals("documentimportnode02_nodeValue", "CANADA", nodeValue);
- }
-
-// Assumes validation.
-// public void testImportNode3() throws Throwable {
-// Document doc;
-// Element element;
-// Attr attr;
-// NodeList childList;
-// Node importedAttr;
-// String nodeName;
-// int nodeType;
-// String nodeValue;
-// doc = (Document) load("staffNS", builder);
-// childList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "employee");
-// element = (Element) childList.item(1);
-// attr = element.getAttributeNode("defaultAttr");
-// importedAttr = doc.importNode(attr, false);
-// nodeName = importedAttr.getNodeName();
-// nodeValue = importedAttr.getNodeValue();
-// nodeType = (int) importedAttr.getNodeType();
-// assertEquals("documentimportnode03_nodeName", "defaultAttr", nodeName);
-// assertEquals("documentimportnode03_nodeType", 2, nodeType);
-// assertEquals("documentimportnode03_nodeValue", "defaultVal", nodeValue);
-// }
-
-// Assumes validation.
-// public void testImportNode4() throws Throwable {
-// Document doc;
-// Document newDoc;
-// DocumentType docType = null;
-//
-// DOMImplementation domImpl;
-// Element element;
-// Attr attr;
-// NodeList childList;
-// Node importedAttr;
-// String nodeName;
-// int nodeType;
-// String nodeValue;
-// doc = (Document) load("staffNS", builder);
-// domImpl = doc.getImplementation();
-// newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test",
-// "l2:root", docType);
-// childList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "employee");
-// element = (Element) childList.item(1);
-// attr = element.getAttributeNode("defaultAttr");
-// importedAttr = newDoc.importNode(attr, true);
-// nodeName = importedAttr.getNodeName();
-// nodeValue = importedAttr.getNodeValue();
-// nodeType = (int) importedAttr.getNodeType();
-// assertEquals("documentimportnode04_nodeName", "defaultAttr", nodeName);
-// assertEquals("documentimportnode04_nodeType", 2, nodeType);
-// assertEquals("documentimportnode04_nodeValue", "defaultVal", nodeValue);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException exception.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode5() throws Throwable {
- Document doc;
- Document docImported;
- Attr attr;
- Node importedAttr;
- String nodeName;
- int nodeType;
- String nodeValue;
- String namespaceURI;
- doc = (Document) load("staffNS", builder);
- docImported = (Document) load("staff", builder);
- attr = doc.createAttributeNS("http://www.w3.org/DOM/Test", "a_:b0");
- importedAttr = docImported.importNode(attr, false);
- nodeName = importedAttr.getNodeName();
- nodeValue = importedAttr.getNodeValue();
- nodeType = (int) importedAttr.getNodeType();
- namespaceURI = importedAttr.getNamespaceURI();
- assertEquals("documentimportnode05_nodeName", "a_:b0", nodeName);
- assertEquals("documentimportnode05_nodeType", 2, nodeType);
- assertEquals("documentimportnode05_nodeValue", "", nodeValue);
- assertEquals("documentimportnode05_namespaceURI",
- "http://www.w3.org/DOM/Test", namespaceURI);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode6() throws Throwable {
- Document doc;
-
- doc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.importNode(doc, false);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
- }
- assertTrue("throw_NOT_SUPPORTED_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode7() throws Throwable {
- Document doc;
-
- DocumentType docType;
- doc = (Document) load("staffNS", builder);
- docType = doc.getDoctype();
-
- {
- boolean success = false;
- try {
- doc.importNode(docType, true);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
- }
- assertTrue("throw_NOT_SUPPORTED_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode8() throws Throwable {
- Document doc;
-
- DocumentType docType;
- DOMImplementation domImpl;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- docType = domImpl.createDocumentType("test:root", nullNS, nullNS);
-
- {
- boolean success = false;
- try {
- doc.importNode(docType, true);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
- }
- assertTrue("throw_NOT_SUPPORTED_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException exception.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode9() throws Throwable {
- Document doc;
- DocumentFragment docFragment;
- NodeList childList;
- boolean success;
- Node addressNode;
-
- Node importedDocFrag;
- doc = (Document) load("staffNS", builder);
- docFragment = doc.createDocumentFragment();
- childList = doc.getElementsByTagNameNS("*", "address");
- addressNode = childList.item(0);
- docFragment.appendChild(addressNode);
- importedDocFrag = doc.importNode(docFragment, false);
- success = importedDocFrag.hasChildNodes();
- assertFalse("documentimportnode09", success);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality; doesn't verify DOMException exceptions.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode10() throws Throwable {
- Document doc;
- DocumentFragment docFragment;
- NodeList childList;
- boolean success;
- Node addressNode;
-
- Node importedDocFrag;
- doc = (Document) load("staffNS", builder);
- docFragment = doc.createDocumentFragment();
- childList = doc.getElementsByTagNameNS("*", "address");
- addressNode = childList.item(0);
- docFragment.appendChild(addressNode);
- importedDocFrag = doc.importNode(docFragment, true);
- success = importedDocFrag.hasChildNodes();
- assertTrue("documentimportnode10", success);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException exception.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode11() throws Throwable {
- Document doc;
- Element docElement;
- Node imported;
- boolean success;
- String nodeNameOrig;
- String nodeNameImported;
- doc = (Document) load("staffNS", builder);
- docElement = doc.getDocumentElement();
- imported = doc.importNode(docElement, false);
- success = imported.hasChildNodes();
- assertFalse("documentimportnode11", success);
- nodeNameImported = imported.getNodeName();
- nodeNameOrig = docElement.getNodeName();
- assertEquals("documentimportnode11_NodeName", nodeNameImported,
- nodeNameOrig);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException exception.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode12() throws Throwable {
- Document doc;
- NodeList childList;
- Node imported;
- Node addressElem;
- NodeList addressElemChildren;
- NodeList importedChildren;
- int addressElemLen;
- int importedLen;
- doc = (Document) load("staffNS", builder);
- childList = doc.getElementsByTagNameNS("*", "address");
- addressElem = childList.item(0);
- imported = doc.importNode(addressElem, true);
- addressElemChildren = addressElem.getChildNodes();
- importedChildren = imported.getChildNodes();
- addressElemLen = (int) addressElemChildren.getLength();
- importedLen = (int) importedChildren.getLength();
- assertEquals("documentimportnode12", importedLen, addressElemLen);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException exception.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode13() throws Throwable {
- Document doc;
- NodeList childList;
- Node imported;
- NodeList importedList;
- Node employeeElem;
- int importedLen;
- doc = (Document) load("staffNS", builder);
- childList = doc.getElementsByTagNameNS("*", "employee");
- employeeElem = childList.item(0);
- imported = doc.importNode(employeeElem, false);
- importedList = imported.getChildNodes();
- importedLen = (int) importedList.getLength();
- assertEquals("documentimportnode13", 0, importedLen);
- }
-
-// Assumes validation.
-// public void testImportNode14() throws Throwable {
-// Document doc;
-// Document newDoc;
-// DOMImplementation domImpl;
-// DocumentType nullDocType = null;
-//
-// NodeList childList;
-// Node imported;
-// Node employeeElem;
-// Attr attrNode;
-// String attrValue;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// childList = doc.getElementsByTagNameNS("*", "employee");
-// employeeElem = childList.item(3);
-// domImpl = builder.getDOMImplementation();
-// newDoc = domImpl.createDocument(nullNS, "staff", nullDocType);
-// imported = newDoc.importNode(employeeElem, true);
-// attrNode = ((Element) /* Node */imported).getAttributeNodeNS(nullNS,
-// "defaultAttr");
-// assertNull("defaultAttrNotImported", attrNode);
-// attrValue = ((Element) /* Node */imported).getAttributeNS(
-// "http://www.w3.org/2000/xmlns/", "emp");
-// assertEquals("explicitAttrImported", "http://www.nist.gov", attrValue);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies import of TEXT_NODE.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode15() throws Throwable {
- Document doc;
-
- Node textImport;
- Node textToImport;
- String nodeValue;
- doc = (Document) load("staffNS", builder);
-
- textToImport = doc
- .createTextNode("Document.importNode test for a TEXT_NODE");
- textImport = doc.importNode(textToImport, true);
- nodeValue = textImport.getNodeValue();
- assertEquals("documentimportnode15",
- "Document.importNode test for a TEXT_NODE", nodeValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies import of COMMENT_NODE",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode17() throws Throwable {
- Document doc;
-
- Node commentImport;
- Node commentToImport;
- String nodeValue;
- doc = (Document) load("staffNS", builder);
-
- commentToImport = doc
- .createComment("Document.importNode test for a COMMENT_NODE");
- commentImport = doc.importNode(commentToImport, true);
- nodeValue = commentImport.getNodeValue();
- assertEquals("documentimportnode17",
- "Document.importNode test for a COMMENT_NODE", nodeValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException exception.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode18() throws Throwable {
- Document doc;
-
- ProcessingInstruction piImport;
- ProcessingInstruction piToImport;
- String piData;
- String piTarget;
- doc = (Document) load("staffNS", builder);
-
- piToImport = doc.createProcessingInstruction("Target", "Data");
- piImport = (ProcessingInstruction) doc.importNode(piToImport, false);
- piTarget = piImport.getTarget();
- piData = piImport.getData();
- assertEquals("documentimportnode18_Target", "Target", piTarget);
- assertEquals("documentimportnode18_Data", "Data", piData);
- }
-
-// Assumes validation.
-// public void testImportNode19() throws Throwable {
-// Document doc;
-// DocumentType docTypeNull = null;
-//
-// Document docImp;
-// DOMImplementation domImpl;
-// DocumentType docType;
-// NamedNodeMap nodeMap;
-// Entity entity2;
-// Entity entity6;
-// Entity entityImp2;
-// Entity entityImp6;
-// String nodeName;
-// String systemId;
-// String notationName;
-// String nodeNameImp;
-// String systemIdImp;
-// String notationNameImp;
-// doc = (Document) load("staffNS", builder);
-// domImpl = doc.getImplementation();
-// docType = doc.getDoctype();
-// docImp = domImpl.createDocument("http://www.w3.org/DOM/Test", "a:b",
-// docTypeNull);
-// nodeMap = docType.getEntities();
-// assertNotNull("entitiesNotNull", nodeMap);
-// entity2 = (Entity) nodeMap.getNamedItem("ent2");
-// entity6 = (Entity) nodeMap.getNamedItem("ent6");
-// entityImp2 = (Entity) docImp.importNode(entity2, false);
-// entityImp6 = (Entity) docImp.importNode(entity6, true);
-// nodeName = entity2.getNodeName();
-// nodeNameImp = entityImp2.getNodeName();
-// assertEquals("documentimportnode19_Ent2NodeName", nodeName, nodeNameImp);
-// nodeName = entity6.getNodeName();
-// nodeNameImp = entityImp6.getNodeName();
-// assertEquals("documentimportnode19_Ent6NodeName", nodeName, nodeNameImp);
-// systemId = entity2.getSystemId();
-// systemIdImp = entityImp2.getSystemId();
-// assertEquals("documentimportnode19_Ent2SystemId", systemId, systemIdImp);
-// systemId = entity6.getSystemId();
-// systemIdImp = entityImp6.getSystemId();
-// assertEquals("documentimportnode19_Ent6SystemId", systemId, systemIdImp);
-// notationName = entity2.getNotationName();
-// notationNameImp = entityImp2.getNotationName();
-// assertEquals("documentimportnode19_Ent2NotationName", notationName,
-// notationNameImp);
-// notationName = entity6.getNotationName();
-// notationNameImp = entityImp6.getNotationName();
-// assertEquals("documentimportnode19_Ent6NotationName", notationName,
-// notationNameImp);
-// }
-
-// Assumes validation.
-// public void testImportNode20() throws Throwable {
-// Document doc;
-// Document docImp;
-// DOMImplementation domImpl;
-// DocumentType docType;
-// DocumentType docTypeNull = null;
-//
-// NamedNodeMap nodeMap;
-// Entity entity4;
-// Entity entityImp4;
-// Element element;
-// CharacterData cdata;
-// ProcessingInstruction pi;
-// NodeList childList;
-// NodeList elemchildList;
-// String ent4Name;
-// String ent4ImpName;
-// String cdataVal;
-// String piTargetVal;
-// String piDataVal;
-// doc = (Document) load("staffNS", builder);
-// domImpl = doc.getImplementation();
-// docType = doc.getDoctype();
-// docImp = domImpl.createDocument("http://www.w3.org/DOM/Test", "a:b",
-// docTypeNull);
-// nodeMap = docType.getEntities();
-// entity4 = (Entity) nodeMap.getNamedItem("ent4");
-// entityImp4 = (Entity) docImp.importNode(entity4, true);
-// childList = entityImp4.getChildNodes();
-// element = (Element) childList.item(0);
-// elemchildList = element.getChildNodes();
-// cdata = (CharacterData) elemchildList.item(0);
-// pi = (ProcessingInstruction) childList.item(1);
-// ent4Name = entity4.getNodeName();
-// ent4ImpName = entityImp4.getNodeName();
-// cdataVal = cdata.getData();
-// piTargetVal = pi.getTarget();
-// piDataVal = pi.getData();
-// assertEquals("documentimportnode20_Ent4NodeName", ent4Name, ent4ImpName);
-// assertEquals("documentimportnode20_Cdata", "Element data", cdataVal);
-// assertEquals("documentimportnode20_PITarget", "PItarget", piTargetVal);
-// assertEquals("documentimportnode20_PIData", "PIdata", piDataVal);
-// }
-
-// TODO Fails on JDK. Why?
-// public void testImportNode21() throws Throwable {
-//
-//
-// Document doc;
-// DocumentType docTypeNull = null;
-//
-// Document docImp;
-// DOMImplementation domImpl;
-// NodeList addressList;
-// NodeList addressChildList;
-// Element element;
-// EntityReference entRef2;
-// EntityReference entRefImp2;
-// EntityReference entRef3;
-// EntityReference entRefImp3;
-// String nodeName2;
-// String nodeName3;
-// String nodeNameImp2;
-// String nodeNameImp3;
-// NodeList nodes;
-// Node nodeImp3;
-// Node nodeImp2;
-// String nodeValueImp2;
-// String nodeValueImp3;
-// doc = (Document) load("staffNS", builder);
-// domImpl = doc.getImplementation();
-// docImp = domImpl.createDocument("http://www.w3.org/DOM/Test", "a:b",
-// docTypeNull);
-// addressList = doc.getElementsByTagName("address");
-// element = (Element) addressList.item(1);
-// addressChildList = element.getChildNodes();
-// entRef2 = (EntityReference) addressChildList.item(0);
-// entRef3 = (EntityReference) addressChildList.item(2);
-// entRefImp2 = (EntityReference) docImp.importNode(entRef2, true);
-// entRefImp3 = (EntityReference) docImp.importNode(entRef3, false);
-// nodeName2 = entRef2.getNodeName();
-// nodeName3 = entRef3.getNodeName();
-// nodeNameImp2 = entRefImp2.getNodeName();
-// nodeNameImp3 = entRefImp3.getNodeName();
-// assertEquals("documentimportnode21_Ent2NodeName", nodeName2,
-// nodeNameImp2);
-// assertEquals("documentimportnode21_Ent3NodeName", nodeName3,
-// nodeNameImp3);
-// entRefImp2 = (EntityReference) doc.importNode(entRef2, true);
-// entRefImp3 = (EntityReference) doc.importNode(entRef3, false);
-// nodes = entRefImp2.getChildNodes();
-// nodeImp2 = nodes.item(0);
-// nodeValueImp2 = nodeImp2.getNodeValue();
-// nodes = entRefImp3.getChildNodes();
-// nodeImp3 = nodes.item(0);
-// nodeValueImp3 = nodeImp3.getNodeValue();
-// assertEquals("documentimportnode21_Ent2NodeValue", "1900 Dallas Road",
-// nodeValueImp2);
-// assertEquals("documentimportnode21_Ent3Nodevalue", "Texas",
-// nodeValueImp3);
-//
-// }
-
-// Assumes validation.
-// public void testImportNode22() throws Throwable {
-// Document doc;
-// DocumentType docTypeNull = null;
-//
-// Document docImp;
-// DOMImplementation domImpl;
-// DocumentType docType;
-// NamedNodeMap nodeMap;
-// Notation notation1;
-// Notation notation2;
-//
-// String publicId1;
-// String publicId1Imp;
-// String publicId1NewImp;
-// String publicId2Imp;
-//
-// String systemId1Imp;
-// String systemId1NewImp;
-// String systemId2;
-// String systemId2Imp;
-// String systemId2NewImp;
-// doc = (Document) load("staffNS", builder);
-// domImpl = doc.getImplementation();
-// docType = doc.getDoctype();
-// docImp = domImpl.createDocument("http://www.w3.org/DOM/Test", "a:b",
-// docTypeNull);
-// nodeMap = docType.getNotations();
-// assertNotNull("notationsNotNull", nodeMap);
-// notation1 = (Notation) nodeMap.getNamedItem("notation1");
-// notation2 = (Notation) nodeMap.getNamedItem("notation2");
-// doc.importNode(notation1, true);
-// doc.importNode(notation2, false);
-// docImp.importNode(notation1, false);
-// docImp.importNode(notation2, true);
-// publicId1 = notation1.getPublicId();
-// publicId1Imp = notation1.getPublicId();
-// publicId1NewImp = notation1.getPublicId();
-// systemId1Imp = notation1.getSystemId();
-// systemId1NewImp = notation1.getSystemId();
-// publicId2Imp = notation2.getPublicId();
-// notation2.getPublicId();
-// systemId2 = notation2.getSystemId();
-// systemId2Imp = notation2.getSystemId();
-// systemId2NewImp = notation2.getSystemId();
-// assertEquals("documentimportnode22_N1PID", publicId1, publicId1Imp);
-// assertEquals("documentimportnode22_N1NPID", publicId1, publicId1NewImp);
-// assertNull("documentimportnode22_N1SID", systemId1Imp);
-// assertNull("documentimportnode22_N1NSID", systemId1NewImp);
-// assertEquals("documentimportnode22_N2SID", systemId2, systemId2Imp);
-// assertEquals("documentimportnode22_N2NSID", systemId2, systemId2NewImp);
-// assertNull("documentimportnode22_N2PID", publicId2Imp);
-// assertNull("documentimportnode22_N2NPID", publicId2Imp);
-// }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java
deleted file mode 100644
index 9e79788..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMImplementation;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getInternalSubset() returns the internal subset as a string.
- *
- * Create a new DocumentType node with null values for publicId and systemId.
- * Verify that its internal subset is null.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-internalSubset">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-internalSubset</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
- */
-@TestTargetClass(DocumentType.class)
-public final class DocumentTypeInternalSubset extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't check positive case.",
- method = "getInternalSubset",
- args = {}
- )
- public void testGetInternalSubset() throws Throwable {
- Document doc;
- DocumentType docType;
- DOMImplementation domImpl;
- String internal;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- docType = domImpl.createDocumentType("l2:root", nullNS, nullNS);
- internal = docType.getInternalSubset();
- assertNull("internalSubsetNull", internal);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java
deleted file mode 100644
index 26e9a5f..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java
+++ /dev/null
@@ -1,97 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001-2003 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-
-import javax.xml.parsers.DocumentBuilder;
-
-
-
-/**
- * The method getInternalSubset() returns the public identifier of the external subset.
- *
- * Create a new DocumentType node with the value "PUB" for its publicId.
- * Check the value of the publicId attribute using getPublicId().
-* @author IBM
-* @author Neil Delima
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId</a>
-* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
-*/
-@TestTargetClass(DocumentType.class)
-public final class DocumentTypePublicId extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getPublicId",
- args = {}
- )
- public void testGetPublicId() throws Throwable {
- Document doc;
- DocumentType docType;
- DOMImplementation domImpl;
- String publicId;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- docType = domImpl.createDocumentType("l2:root", "PUB", nullNS);
- publicId = docType.getPublicId();
- assertEquals("documenttypepublicid01", "PUB", publicId);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java
deleted file mode 100644
index fcad024..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java
+++ /dev/null
@@ -1,95 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Document;
-import org.w3c.dom.DOMImplementation;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getInternalSubset() returns the public identifier of the external subset.
- *
- * Create a new DocumentType node with the value "SYS" for its systemId and PUB for
- * its publicId. Check the value of the systemId and pbulicId attributes.
-* @author IBM
-* @author Neil Delima
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId</a>
-*/
-@TestTargetClass(DocumentType.class)
-public final class DocumentTypeSystemId extends DOMTestCase {
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getSystemId",
- args = {}
- )
- public void testGetSystemId() throws Throwable {
- Document doc;
- DocumentType docType;
- DOMImplementation domImpl;
- String publicId;
- String systemId;
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- docType = domImpl.createDocumentType("l2:root", "PUB", "SYS");
- publicId = docType.getPublicId();
- systemId = docType.getSystemId();
- assertEquals("documenttypepublicid01", "PUB", publicId);
- assertEquals("documenttypesystemid01", "SYS", systemId);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNS.java
deleted file mode 100644
index 8505459..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNS.java
+++ /dev/null
@@ -1,89 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001-2004 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargetClass;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * The method getAttributeNS retrieves an attribute value by local name and namespace URI.
- * Using the getAttributeNodeNS, retreive and verify the value of the default
- * attribute node.
- *
-* @author IBM
-* @author Neil Delima
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS</a>
-* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
-*/
-@TestTargetClass(Element.class)
-public final class ElementGetAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testGetAttributeNS() throws Throwable {
-// Document doc;
-// Element element;
-// String attrValue;
-// NodeList childList;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// childList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "employee");
-// element = (Element) childList.item(1);
-// attrValue = element.getAttributeNS(nullNS, "defaultAttr");
-// assertEquals("elementgetattributens02", "defaultVal", attrValue);
-// }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java
deleted file mode 100644
index 7760ba8..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getAttributeNodeNS retrieves an Attr node by local name and
- * namespace URI. Create a new element node and add 2 new attribute nodes to it
- * that have the same local name but different namespaceURIs and prefixes.
- * Retrieve an attribute using namespace and localname and check its value, name
- * and namespaceURI.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS</a>
- */
-@TestTargetClass(Element.class)
-public final class ElementGetAttributeNodeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNodeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNodeNS1() throws Throwable {
- Document doc;
- Element element;
- Attr attribute1;
- Attr attribute2;
-
-
- Attr attribute;
- String attrValue;
- String attrName;
- String attNodeName;
- String attrLocalName;
- String attrNS;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("namespaceURI", "root");
- attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Level2",
- "l2:att");
- element.setAttributeNodeNS(attribute1);
- attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Level1",
- "att");
- element.setAttributeNodeNS(attribute2);
- attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2",
- "att");
- attrValue = attribute.getNodeValue();
- attrName = attribute.getName();
- attNodeName = attribute.getNodeName();
- attrLocalName = attribute.getLocalName();
- attrNS = attribute.getNamespaceURI();
- assertEquals("elementgetattributenodens01_attrValue", "", attrValue);
- assertEquals("elementgetattributenodens01_attrName", "l2:att", attrName);
- assertEquals("elementgetattributenodens01_attrNodeName", "l2:att",
- attNodeName);
- assertEquals("elementgetattributenodens01_attrLocalName", "att",
- attrLocalName);
- assertEquals("elementgetattributenodens01_attrNs",
- "http://www.w3.org/DOM/Level2", attrNS);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNodeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNodeNS2() throws Throwable {
- Document doc;
- Element element;
- Attr attribute;
-
- String attrValue;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("namespaceURI", "root");
- attribute = doc.createAttributeNS("http://www.w3.org/DOM/Level2",
- "l2:att");
- element.setAttributeNodeNS(attribute);
- attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Level2",
- "att");
- attrValue = attribute.getNodeValue();
- assertEquals("elementgetattributenodens02", "", attrValue);
- }
-
-// Assumes validation.
-// public void testGetAttributeNodeNS3() throws Throwable {
-// Document doc;
-// Element element;
-// Attr attribute;
-// String attrValue;
-// NodeList childList;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// childList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "employee");
-// element = (Element) childList.item(1);
-// attribute = element.getAttributeNodeNS(nullNS, "defaultAttr");
-// attrValue = attribute.getNodeValue();
-// assertEquals("elementgetattributenodens03", "defaultVal", attrValue);
-// }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java
deleted file mode 100644
index f03007a..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getElementsByTagNameNS returns a NodeList of all the Elements with
- * a given local name and namespace URI in the order in which they are
- * encountered in a preorder traversal of the Document tree. Invoke
- * getElementsByTagNameNS on the documentElement with values for namespaceURI
- * '*' and localName '*'. Verify if this returns a nodeList of 0 elements.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS</a>
- */
-@TestTargetClass(Element.class)
-public final class ElementGetElementsByTagNameNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS1() throws Throwable {
- Document doc;
- Element element;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- element = doc.getDocumentElement();
- elementList = element.getElementsByTagNameNS("**", "*");
- assertEquals("elementgetelementsbytagnamens02", 0, elementList
- .getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS4() throws Throwable {
- Document doc;
- Element element;
- Element child1;
- Element child2;
- Element child3;
-
- NodeList elementList;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM", "root");
- child1 = doc.createElementNS("http://www.w3.org/DOM/Level1",
- "dom:child");
- child2 = doc.createElementNS(nullNS, "child");
- child3 = doc.createElementNS("http://www.w3.org/DOM/Level2",
- "dom:child");
- element.appendChild(child1);
- element.appendChild(child2);
- element.appendChild(child3);
- elementList = element.getElementsByTagNameNS(nullNS, "child");
- assertEquals("elementgetelementsbytagnamens04_1", 1, elementList
- .getLength());
- elementList = element.getElementsByTagNameNS("*", "child");
- assertEquals("elementgetelementsbytagnamens04_2", 3, elementList
- .getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS5() throws Throwable {
- Document doc;
- Element element;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- element = doc.getDocumentElement();
- elementList = element.getElementsByTagNameNS(
- "http://www.altavista.com", "*");
- assertEquals("elementgetelementsbytagnamens05", 1, elementList
- .getLength());
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java
deleted file mode 100644
index 711a1ab..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method hasAttribute returns true when an attribute with a given name is
- * specified on this element or has a default value, false otherwise Invoke the
- * hasAttribute method to check if the documentElement has attributres.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs</a>
- */
-@TestTargetClass(Element.class)
-public final class ElementHasAttribute extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies hasAttribute method with empty string as a parameter.",
- method = "hasAttribute",
- args = {java.lang.String.class}
- )
- public void testHasAttribute1() throws Throwable {
- Document doc;
- Element element;
- boolean state;
- doc = (Document) load("staff", builder);
- element = doc.getDocumentElement();
- state = element.hasAttribute("");
- assertFalse("elementhasattribute01", state);
- }
-
-// Assumes validation.
-// public void testHasAttribute2() throws Throwable {
-// Document doc;
-// Element element;
-// boolean state;
-// NodeList elementList;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("emp:employee");
-// element = (Element) elementList.item(0);
-// assertNotNull("empEmployeeNotNull", element);
-// state = element.hasAttribute("defaultAttr");
-// assertTrue("elementhasattribute02", state);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "hasAttribute",
- args = {java.lang.String.class}
- )
- public void testHasAttribute3() throws Throwable {
- Document doc;
- Element element;
- boolean state;
- Attr attribute;
-
- doc = (Document) load("staff", builder);
- element = doc.createElement("address");
- attribute = doc.createAttribute("domestic");
- state = element.hasAttribute("domestic");
- assertFalse("elementhasattribute03_False", state);
- element.setAttributeNode(attribute);
- state = element.hasAttribute("domestic");
- assertTrue("elementhasattribute03_True", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "hasAttribute",
- args = {java.lang.String.class}
- )
- public void testHasAttribute4() throws Throwable {
- Document doc;
- Element element;
- boolean state;
- Attr attribute;
-
- doc = (Document) load("staff", builder);
- element = doc.createElement("address");
- attribute = doc.createAttribute("domestic");
- element.setAttributeNode(attribute);
- state = element.hasAttribute("domestic");
- assertTrue("elementhasattribute04", state);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java
deleted file mode 100644
index e0c9fd9..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method hasAttributeNS returns true when an attribute with a given local
- * name and namespace URI is specified on this element or has a default value,
- * false otherwise.
- *
- * Retreive the first employee element node. Invoke the hasAttributeNS method to
- * check if it has the xmlns attribute that belongs to the namespace
- * http://www.w3.org/2000/xmlns/.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS</a>
- */
-@TestTargetClass(Element.class)
-public final class ElementHasAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "hasAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void _testHasAttributeNS1() throws Throwable {
- Document doc;
- Element element;
- boolean state;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "employee");
- element = (Element) elementList.item(0);
- state = element
- .hasAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns");
- assertTrue("elementhasattributens01", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "hasAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasAttributeNS2() throws Throwable {
- Document doc;
- Element element;
- boolean state;
- Attr attribute;
-
- doc = (Document) load("staff", builder);
- element = doc.createElementNS("http://www.w3.org/DOM", "address");
- attribute = doc.createAttributeNS("http://www.w3.org/DOM", "domestic");
- element.setAttributeNode(attribute);
- state = element.hasAttributeNS("http://www.w3.org/DOM", "domestic");
- assertTrue("hasDomesticAttr", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "hasAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasAttributeNS3() throws Throwable {
- Document doc;
- Element element;
- boolean state;
- Attr attribute;
-
- String nullNS = null;
-
- doc = (Document) load("staff", builder);
- element = doc.createElementNS("http://www.w3.org/DOM", "address");
- assertNotNull("createElementNotNull", element);
- attribute = doc.createAttributeNS(nullNS, "domestic");
- element.setAttributeNode(attribute);
- state = element.hasAttributeNS(nullNS, "domestic");
- assertTrue("elementhasattributens03", state);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java
deleted file mode 100644
index 72c56e9..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method removeAttributeNS removes an attribute by local name and namespace
- * URI. Create a new element and add a new attribute node to it. Remove the
- * attribute node using the removeAttributeNodeNS method. Check if the attribute
- * was remove by invoking the hasAttributeNS method on the element and check if
- * it returns false.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS</a>
- */
-@TestTargetClass(Element.class)
-public final class ElementRemoveAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "removeAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveAttributeNS() throws Throwable {
- Document doc;
- Element element;
- boolean state;
- Attr attribute;
-
- doc = (Document) load("staff", builder);
- element = doc.createElementNS("http://www.w3.org/DOM", "elem");
- attribute = doc.createAttributeNS(
- "http://www.w3.org/DOM/Test/createAttributeNS", "attr");
- element.setAttributeNodeNS(attribute);
- element.removeAttributeNS(
- "http://www.w3.org/DOM/Test/createAttributeNS", "attr");
- state = element.hasAttributeNS(
- "http://www.w3.org/DOM/Test/createAttributeNS", "attr");
- assertFalse("elementremoveattributens01", state);
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java
deleted file mode 100644
index babd6f1..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java
+++ /dev/null
@@ -1,266 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method setAttributeNS adds a new attribute. Create a new element and add
- * a new attribute node to it using the setAttributeNS method. Check if the
- * attribute was correctly set by invoking the getAttributeNodeNS method and
- * checking the nodeName and nodeValue of the returned nodes.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a>
- */
-@TestTargetClass(Element.class)
-public final class ElementSetAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS1() throws Throwable {
- Document doc;
- Element element;
- Attr attribute;
- String attrName;
- String attrValue;
- doc = (Document) load("staff", builder);
- element = doc.createElementNS("http://www.w3.org/DOM", "dom:elem");
- element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS",
- "attr", "value");
- attribute = element.getAttributeNodeNS(
- "http://www.w3.org/DOM/Test/setAttributeNS", "attr");
- attrName = attribute.getNodeName();
- attrValue = attribute.getNodeValue();
- assertEquals("elementsetattributens01_attrName", "attr", attrName);
- assertEquals("elementsetattributens01_attrValue", "value", attrValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS2() throws Throwable {
- Document doc;
- Element element;
- Attr attribute;
- NodeList elementList;
- String attrName;
- String attrValue;
- doc = (Document) load("staff", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = (Element) elementList.item(0);
- element.setAttributeNS("http://www.w3.org/DOM/Test/setAttributeNS",
- "this:street", "Silver Street");
- attribute = element.getAttributeNodeNS(
- "http://www.w3.org/DOM/Test/setAttributeNS", "street");
- attrName = attribute.getNodeName();
- attrValue = attribute.getNodeValue();
- assertEquals("elementsetattributens02_attrName", "this:street",
- attrName);
- assertEquals("elementsetattributens02_attrValue", "Silver Street",
- attrValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS3() throws Throwable {
- Document doc;
- Element element;
- Attr attribute;
- NodeList elementList;
- String attrName;
- String attrValue;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:employee");
- element = (Element) elementList.item(0);
- assertNotNull("empEmployeeNotNull", element);
- element.setAttributeNS("http://www.w3.org/DOM/Test/1", "defaultAttr",
- "default1");
- element.setAttributeNS("http://www.w3.org/DOM/Test/2", "defaultAttr",
- "default2");
- attribute = element.getAttributeNodeNS("http://www.w3.org/DOM/Test/1",
- "defaultAttr");
- attrName = attribute.getNodeName();
- attrValue = attribute.getNodeValue();
- assertEquals("elementsetattributens03_attrName", "defaultAttr",
- attrName);
- assertEquals("elementsetattributens03_attrValue", "default1", attrValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with INVALID_CHARACTER_ERR.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS4() throws Throwable {
- Document doc;
- Element element;
- String qualifiedName;
- List<String> qualifiedNames = new ArrayList<String>();
- qualifiedNames.add("/");
- qualifiedNames.add("//");
- qualifiedNames.add("\\");
- qualifiedNames.add(";");
- qualifiedNames.add("&");
- qualifiedNames.add("*");
- qualifiedNames.add("]]");
- qualifiedNames.add(">");
- qualifiedNames.add("<");
-
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/L2",
- "dom:elem");
- for (int indexN10058 = 0; indexN10058 < qualifiedNames.size(); indexN10058++) {
- qualifiedName = (String) qualifiedNames.get(indexN10058);
-
- {
- boolean success = false;
- try {
- element.setAttributeNS("http://www.w3.org/DOM/Test/L2",
- qualifiedName, "test");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("elementsetattributens04", success);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS5() throws Throwable {
- Document doc;
- Element element;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/L2",
- "dom:elem");
-
- {
- boolean success = false;
- try {
- element.setAttributeNS(nullNS, "dom:root", "test");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("elementsetattributens05", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS8() throws Throwable {
- Document doc;
- Element element;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOMTest/level2",
- "dom:elem");
-
- {
- boolean success = false;
- try {
- element.setAttributeNS("http://www.w3.org/DOMTest/level2",
- "xmlns", "test");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("elementsetattributens08_Err1", success);
- }
-
- {
- boolean success = false;
- try {
- element.setAttributeNS("http://www.w3.org/DOMTest/level2",
- "xmlns:root", "test");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("elementsetattributens08_Err2", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNSURINull() throws Throwable {
- String namespaceURI = null;
-
- String qualifiedName = "emp:qualifiedName";
- Document doc;
- NodeList elementList;
- Node testAddr;
- doc = (Document) load("staff", builder);
- elementList = doc.getElementsByTagName("employee");
- testAddr = elementList.item(0);
-
- {
- boolean success = false;
- try {
- ((Element) /*Node */testAddr).setAttributeNS(namespaceURI, qualifiedName, "newValue");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java
deleted file mode 100644
index 2a115e0..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.EntityReference;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * Testing Element.setAttributeNodeNS: If an attribute with that local name and
- * that namespace URI is already present in the element, it is replaced by the
- * new one. Create a new element and two new attribute nodes (in the same
- * namespace and same localNames). Add the two new attribute nodes to the
- * element node using the setAttributeNodeNS method. Check that only one
- * attribute is added, check the value of this attribute.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
- */
-@TestTargetClass(Element.class)
-public final class ElementSetAttributeNodeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNodeNS1() throws Throwable {
- Document doc;
- Element element;
- Attr attribute1;
- Attr attribute2;
- Attr attrNode;
- String attrName;
- String attrNS;
-
- NamedNodeMap attributes;
-
- int length;
- doc = (Document) load("staff", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/Level2",
- "new:element");
- attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1",
- "p1:att");
- attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test/att1",
- "p2:att");
- attribute2.setValue("value2");
- element.setAttributeNodeNS(attribute1);
- element.setAttributeNodeNS(attribute2);
- attrNode = element.getAttributeNodeNS(
- "http://www.w3.org/DOM/Test/att1", "att");
- attrName = attrNode.getNodeName();
- attrNS = attrNode.getNamespaceURI();
- assertEquals("elementsetattributenodens01_attrName", "p2:att", attrName);
- assertEquals("elementsetattributenodens01_attrNS",
- "http://www.w3.org/DOM/Test/att1", attrNS);
- attributes = element.getAttributes();
- length = (int) attributes.getLength();
- assertEquals("length", 1, length);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNodeNS2() throws Throwable {
- Document doc;
- Element element;
- Element element2;
- Attr attribute;
- Attr attributeCloned;
- Attr newAttr;
- NodeList elementList;
- String attrName;
- String attrValue;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- element = (Element) elementList.item(1);
- attribute = element.getAttributeNodeNS(nullNS, "street");
- attributeCloned = (Attr) attribute.cloneNode(true);
- element2 = (Element) elementList.item(2);
- newAttr = element2.setAttributeNodeNS(attributeCloned);
- attrName = newAttr.getNodeName();
- attrValue = newAttr.getNodeValue();
- assertEquals("elementsetattributenodens02_attrName", "street", attrName);
- assertEquals("elementsetattributenodens02_attrValue", "Yes", attrValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNodeNS3() throws Throwable {
- Document doc;
- Element element1;
- Element element2;
- Attr attribute;
-
- NodeList elementList;
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- element1 = (Element) elementList.item(1);
- attribute = element1.getAttributeNodeNS(nullNS, "street");
- element2 = (Element) elementList.item(2);
-
- {
- boolean success = false;
- try {
- element2.setAttributeNodeNS(attribute);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
- }
- assertTrue("elementsetattributenodens03", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNodeNS4() throws Throwable {
- Document doc;
- Element element1;
- Element element2;
- Attr attribute;
-
- doc = (Document) load("staffNS", builder);
- element1 = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
- element2 = doc.createElementNS("http://www.w3.org/DOM/Test", "elem2");
- attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test", "attr");
- element1.setAttributeNodeNS(attribute);
-
- {
- boolean success = false;
- try {
- element2.setAttributeNodeNS(attribute);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
- }
- assertTrue("elementsetattributenodens04", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with WRONG_DOCUMENT_ERR code.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNodeNS5() throws Throwable {
- Document doc;
- Document docAlt;
- Element element;
- Attr attribute;
-
- doc = (Document) load("staffNS", builder);
- docAlt = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
- attribute = docAlt.createAttributeNS("http://www.w3.org/DOM/Test",
- "attr");
-
- {
- boolean success = false;
- try {
- element.setAttributeNodeNS(attribute);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
- }
- assertTrue("throw_WRONG_DOCUMENT_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NO_MODIFICATION_ALLOWED_ERR code.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void _testSetAttributeNodeNS6() throws Throwable {
- Document doc;
- Element element;
- Attr attribute;
- Attr attribute2;
- EntityReference entRef;
- NodeList elementList;
-
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
- attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test", "attr");
- entRef = doc.createEntityReference("ent4");
- attribute.appendChild(entRef);
- element.setAttributeNodeNS(attribute);
- elementList = entRef.getChildNodes();
- element = (Element) elementList.item(0);
- attribute2 = doc.createAttributeNS("http://www.w3.org/DOM/Test",
- "attr2");
-
- {
- boolean success = false;
- try {
- element.setAttributeNodeNS(attribute2);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
- }
- assertTrue("elementsetattributenodens06", success);
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java
deleted file mode 100644
index ae5936c..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2003 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getAttributeNS(namespaceURI,localName)" method retrieves an attribute
- * value by local name and NamespaceURI.
- *
- * Retrieve the first "emp:address" element. The value returned by the
- * "getAttributeNS()" method should be the value "DISTRICT" since the attribute
- * has a default value.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=238">http://www.w3.org/Bugs/Public/show_bug.cgi?id=238</a>
- */
-@TestTargetClass(Element.class)
-public final class GetAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testGetAttributeNS1() throws Throwable {
-// String namespaceURI = "http://www.nist.gov";
-// String localName = "district";
-//
-// Document doc;
-// NodeList elementList;
-// Element testAddr;
-// String attrValue;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("emp:address");
-// testAddr = (Element) elementList.item(0);
-// attrValue = testAddr.getAttributeNS(namespaceURI, localName);
-// assertEquals("attrValue", "DISTRICT", attrValue);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNS2() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String localName = "district";
- String qualifiedName = "emp:district";
- Document doc;
- Attr newAttribute;
- NodeList elementList;
- Element testAddr;
-
- String attrValue;
- doc = (Document) load("staffNS", builder);
- newAttribute = doc.createAttributeNS(namespaceURI, qualifiedName);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- testAddr.setAttributeNodeNS(newAttribute);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- attrValue = testAddr.getAttributeNS(namespaceURI, localName);
- assertEquals("throw_Equals", "", attrValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNS3() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String localName = "domestic";
- Document doc;
- NodeList elementList;
- Element testAddr;
- String attrValue;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- testAddr.removeAttributeNS(namespaceURI, localName);
- attrValue = testAddr.getAttributeNS(namespaceURI, localName);
- assertEquals("throw_Equals", "", attrValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNS4() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String localName = "blank";
- String qualifiedName = "emp:blank";
- Document doc;
-
- NodeList elementList;
- Element testAddr;
-
- String attrValue;
- doc = (Document) load("staffNS", builder);
- doc.createAttributeNS(namespaceURI, qualifiedName);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- testAddr.setAttributeNS(namespaceURI, qualifiedName, "NewValue");
- attrValue = testAddr.getAttributeNS(namespaceURI, localName);
- assertEquals("throw_Equals", "NewValue", attrValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNS5() throws Throwable {
- Document doc;
- NodeList elementList;
- Element testAddr;
- String attrValue;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- attrValue = testAddr.getAttributeNS("http://www.nist.gov", "domestic");
- assertEquals("attrValue", "Yes", attrValue);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java
deleted file mode 100644
index 7c72fe5..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getAttributeNodeNS(namespaceURI,localName)" method retrieves an
- * attribute node by local name and NamespaceURI.
- *
- * Retrieve the first emp:address element node. The getAttributeNodeNS method
- * returns an Attr node, the "value" can be examined to ensure the proper
- * attribute node was retrieved. This attribute value should be null since there
- * is no such attribute.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAtNodeNS</a>
- */
-@TestTargetClass(Element.class)
-public final class GetAttributeNodeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNodeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNodeNS1() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String localName = "invalidlocalname";
- Document doc;
- NodeList elementList;
- Element testAddr;
- Attr attribute;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- attribute = testAddr.getAttributeNodeNS(namespaceURI, localName);
- assertNull("throw_Null", attribute);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getAttributeNodeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetAttributeNodeNS2() throws Throwable {
- Document doc;
- NodeList elementList;
- Element testAddr;
- Attr attribute;
- String attrName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- attribute = testAddr.getAttributeNodeNS("http://www.nist.gov",
- "domestic");
- attrName = attribute.getNodeName();
- assertEquals("attrName", "emp:domestic", attrName);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/GetElementById.java b/xml/src/test/java/tests/org/w3c/dom/GetElementById.java
deleted file mode 100644
index 073df2f..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/GetElementById.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2003 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getElementById(elementId)" method for a Document should return an
- * element whose ID matches elementId.
- *
- * Invoke method getElementById(elementId) on this document with elementId
- * equals "CANADA". Method should return an element whose tag name is
- * "emp:address".
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-104682815</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=383">http://www.w3.org/Bugs/Public/show_bug.cgi?id=383</a>
- */
-@TestTargetClass(Document.class)
-public final class GetElementById extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testGetElementById1() throws Throwable {
-// Document doc;
-// Element element;
-// String tagname;
-// doc = (Document) load("staffNS", builder);
-// element = doc.getElementById("CANADA");
-// tagname = element.getTagName();
-// assertEquals("throw_Equals", "emp:address", tagname);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify getElementById method for existent element.",
- method = "getElementById",
- args = {java.lang.String.class}
- )
- public void testGetElementById2() throws Throwable {
- Document doc;
- Element element;
- doc = (Document) load("staffNS", builder);
- element = doc.getElementById("Cancun");
- assertNull("throw_Null", element);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java b/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java
deleted file mode 100644
index d5fa0bf..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getElementsByTagNameNS(namespaceURI,localName)" method for a Document
- * should return a new NodeList of all Elements that have a namespace when local
- * name is specified as ' '.
- *
- * Invoke method getElementsByTagNameNS(namespaceURI,localName) on this document
- * with namespaceURI and localName as " ". Method should return a new NodeList
- * of 37 elements.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getElBTNNS</a>
- */
-@TestTargetClass(Document.class)
-public final class GetElementsByTagNameNS extends DOMTestCase {
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS method with * as parameters.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS1() throws Throwable {
- String namespaceURI = "*";
- String localName = "*";
- Document doc;
- NodeList newList;
- doc = (Document) load("staffNS", builder);
- newList = doc.getElementsByTagNameNS(namespaceURI, localName);
- // BEGIN android-changed: Was 37, but that assumed validation.
- assertEquals("throw_Size", 36, newList.getLength());
- // END android-changed
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS with '*' as the first parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS2() throws Throwable {
- Document doc;
- NodeList newList;
- Element newElement;
- String prefix;
- String lname;
- doc = (Document) load("staffNS", builder);
- newList = doc.getElementsByTagNameNS("*", "employee");
- assertEquals("employeeCount", 5, newList.getLength());
- newElement = (Element) newList.item(3);
- prefix = newElement.getPrefix();
- assertEquals("prefix", "emp", prefix);
- lname = newElement.getLocalName();
- assertEquals("lname", "employee", lname);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS with '*' as the second parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS3() throws Throwable {
- Document doc;
- NodeList elementList;
- Node child;
- String childName;
- List<String> result = new ArrayList<String>();
-
- List<String> expectedResult = new ArrayList<String>();
- expectedResult.add("employee");
- expectedResult.add("employeeId");
- expectedResult.add("name");
- expectedResult.add("position");
- expectedResult.add("salary");
- expectedResult.add("gender");
- expectedResult.add("address");
- expectedResult.add("emp:employee");
- expectedResult.add("emp:employeeId");
- expectedResult.add("emp:position");
- expectedResult.add("emp:salary");
- expectedResult.add("emp:gender");
- expectedResult.add("emp:address");
- expectedResult.add("address");
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "*");
- for (int indexN10076 = 0; indexN10076 < elementList.getLength(); indexN10076++) {
- child = (Node) elementList.item(indexN10076);
- childName = child.getNodeName();
- result.add(childName);
- }
- assertEquals("nodeNames", expectedResult, result);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS with '*' as the first parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS4() throws Throwable {
- Document doc;
- NodeList elementList;
- Node child;
- String childName;
- List<String> result = new ArrayList<String>();
-
- List<String> expectedResult = new ArrayList<String>();
- expectedResult.add("address");
- expectedResult.add("address");
- expectedResult.add("address");
- expectedResult.add("emp:address");
- expectedResult.add("address");
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- for (int indexN10059 = 0; indexN10059 < elementList.getLength(); indexN10059++) {
- child = (Node) elementList.item(indexN10059);
- childName = child.getNodeName();
- result.add(childName);
- }
- assertEquals("nodeNames", expectedResult, result);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies negative case of getElementsByTagNameNS method.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS5() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String localName = "nomatch";
- Document doc;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS(namespaceURI, localName);
- assertEquals("throw_Size", 0, elementList.getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies negative case of getElementsByTagNameNS method.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS6() throws Throwable {
- Document doc;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nomatch.com",
- "address");
- assertEquals("matchSize", 0, elementList.getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive case of getElementsByTagNameNS method.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS7() throws Throwable {
- Document doc;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- assertEquals("addresses", 3, elementList.getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS method with '*' as parameters; positive case.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS8() throws Throwable {
- Document doc;
- Element docElem;
- NodeList newList;
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- newList = docElem.getElementsByTagNameNS("*", "*");
- assertEquals("listSize", 36, newList.getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS method with '*' as the first parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS9() throws Throwable {
- Document doc;
- NodeList newList;
- Element newElement;
- String prefix;
- String lname;
- Element docElem;
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- newList = docElem.getElementsByTagNameNS("*", "employee");
- assertEquals("employeeCount", 5, newList.getLength());
- newElement = (Element) newList.item(3);
- prefix = newElement.getPrefix();
- assertEquals("prefix", "emp", prefix);
- lname = newElement.getLocalName();
- assertEquals("lname", "employee", lname);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS method with '*' as the second parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS10() throws Throwable {
- Document doc;
- Element docElem;
- NodeList elementList;
- Node child;
- String childName;
- List<String> result = new ArrayList<String>();
-
- List<String> expectedResult = new ArrayList<String>();
- expectedResult.add("employee");
- expectedResult.add("employeeId");
- expectedResult.add("name");
- expectedResult.add("position");
- expectedResult.add("salary");
- expectedResult.add("gender");
- expectedResult.add("address");
- expectedResult.add("emp:employee");
- expectedResult.add("emp:employeeId");
- expectedResult.add("emp:position");
- expectedResult.add("emp:salary");
- expectedResult.add("emp:gender");
- expectedResult.add("emp:address");
- expectedResult.add("address");
-
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- elementList = docElem
- .getElementsByTagNameNS("http://www.nist.gov", "*");
- for (int indexN1007E = 0; indexN1007E < elementList.getLength(); indexN1007E++) {
- child = (Node) elementList.item(indexN1007E);
- childName = child.getNodeName();
- result.add(childName);
- }
- assertEquals("nodeNames", expectedResult, result);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies getElementsByTagNameNS method with '*' as the first parameter.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS11() throws Throwable {
- Document doc;
- Element docElem;
- NodeList elementList;
- Node child;
- String childName;
- List<String> result = new ArrayList<String>();
-
- List<String> expectedResult = new ArrayList<String>();
- expectedResult.add("address");
- expectedResult.add("address");
- expectedResult.add("address");
- expectedResult.add("emp:address");
- expectedResult.add("address");
-
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- elementList = docElem.getElementsByTagNameNS("*", "address");
- for (int indexN1005E = 0; indexN1005E < elementList.getLength(); indexN1005E++) {
- child = (Node) elementList.item(indexN1005E);
- childName = child.getNodeName();
- result.add(childName);
- }
- assertEquals("nodeNames", expectedResult, result);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies negative case for getElementsByTagNameNS method.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS12() throws Throwable {
- Document doc;
- Element docElem;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- elementList = docElem.getElementsByTagNameNS("http://www.nist.gov",
- "nomatch");
- assertEquals("size", 0, elementList.getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies negative case for getElementsByTagNameNS method.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS13() throws Throwable {
- Document doc;
- Element docElem;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- elementList = docElem.getElementsByTagNameNS("http://www.nomatch.com",
- "address");
- assertEquals("matchSize", 0, elementList.getLength());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive case for getElementsByTagNameNS method.",
- method = "getElementsByTagNameNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetElementsByTagNameNS14() throws Throwable {
- Document doc;
- Element docElem;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- docElem = doc.getDocumentElement();
- elementList = docElem.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- assertEquals("addresses", 3, elementList.getLength());
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java
deleted file mode 100644
index 270fe04..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getNamedItemNS(namespaceURI,localName)" method for a NamedNodeMap should
- * return a node specified by localName and namespaceURI
- *
- * Retrieve a list of elements with tag name "address". Access the second
- * element from the list and get its attributes. Try to retrieve the attribute
- * node with local name "domestic" and namespace uri "http://www.usa.com" with
- * method getNamedItemNS(namespaceURI,localName).
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class GetNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getNamedItem",
- args = {java.lang.String.class}
- )
- public void testGetNamedItemNS1() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- NamedNodeMap attributes;
- Attr domesticAttr;
- String attrName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testEmployee = elementList.item(1);
- attributes = testEmployee.getAttributes();
- domesticAttr = (Attr) attributes.getNamedItemNS("http://www.usa.com",
- "domestic");
- attrName = domesticAttr.getNodeName();
- assertEquals("attrName", "dmstc:domestic", attrName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetNamedItemNS2() throws Throwable {
- String namespaceURI = "http://www.usa.com";
- String localName = "domest";
- Document doc;
- NodeList elementList;
- Node testEmployee;
- NamedNodeMap attributes;
- Attr newAttr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testEmployee = elementList.item(1);
- attributes = testEmployee.getAttributes();
- newAttr = (Attr) attributes.getNamedItemNS(namespaceURI, localName);
- assertNull("throw_Null", newAttr);
- }
-
-// Assumes validation.
-// public void testGetNamedItemNS3() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap entities;
-// Entity entity;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// entities = docType.getEntities();
-// assertNotNull("entitiesNotNull", entities);
-// entity = (Entity) entities.getNamedItemNS(nullNS, "ent1");
-// assertNotNull("entityNull", entity);
-// }
-
-// Assumes validation.
-// public void testGetNamedItemNS4() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap notations;
-// Notation notation;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// notations = docType.getNotations();
-// assertNotNull("notationsNotNull", notations);
-// notation = (Notation) notations.getNamedItemNS(nullNS, "notation1");
-// assertNotNull("notationNull", notation);
-// }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java
deleted file mode 100644
index 1cdd20f..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
- Copyright (c) 2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargetClass;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.NamedNodeMap;
-
-/**
- * An attempt to add remove an entity using removeNamedItemNS should result in a
- * NO_MODIFICATION_ERR or a NOT_FOUND_ERR.
- *
- * @author Curt Arnold
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class HCEntitiesRemoveNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testRemoveNamedItemNS() throws Throwable {
-// Document doc;
-// NamedNodeMap entities;
-// DocumentType docType;
-//
-// doc = (Document) load("hc_staff", builder);
-// docType = doc.getDoctype();
-//
-// if (!(("text/html".equals(getContentType())))) {
-// assertNotNull("docTypeNotNull", docType);
-// entities = docType.getEntities();
-// assertNotNull("entitiesNotNull", entities);
-//
-// try {
-// entities.removeNamedItemNS(
-// "http://www.w3.org/1999/xhtml", "alpha");
-// fail("throw_NO_MOD_OR_NOT_FOUND_ERR");
-//
-// } catch (DOMException ex) {
-// switch (ex.code) {
-// case 7:
-// break;
-// case 8:
-// break;
-// default:
-// throw ex;
-// }
-// }
-// }
-// }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HCEntitiesSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCEntitiesSetNamedItemNS.java
deleted file mode 100644
index 7e2917a..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HCEntitiesSetNamedItemNS.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargetClass;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-
-/**
- * An attempt to add an element to the named node map returned by entities
- * should result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR.
- *
- * @author Curt Arnold
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1788794630</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class HCEntitiesSetNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testSetNamedItemNS() throws Throwable {
-// Document doc;
-// NamedNodeMap entities;
-// DocumentType docType;
-//
-// Element elem;
-// doc = (Document) load("hc_staff", builder);
-// docType = doc.getDoctype();
-//
-// if (!(("text/html".equals(getContentType())))) {
-// assertNotNull("docTypeNotNull", docType);
-// entities = docType.getEntities();
-// assertNotNull("entitiesNotNull", entities);
-// elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");
-//
-// try {
-// entities.setNamedItemNS(elem);
-// fail("throw_HIER_OR_NO_MOD_ERR");
-//
-// } catch (DOMException ex) {
-// switch (ex.code) {
-// case 3:
-// break;
-// case 7:
-// break;
-// default:
-// throw ex;
-// }
-// }
-// }
-// }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java b/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java
deleted file mode 100644
index d968bc4..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
- Copyright (c) 2001-2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * Attempt to insert an element into an attribute list, should raise a
- * HIERARCHY_REQUEST_ERR.
- *
- * @author Curt Arnold
- * @see <a
- * href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-258A00AF')/constant[@name='HIERARCHY_REQUEST_ERR'])</a>
- * @see <a
- * href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788</a>
- * @see <a
- * href="http://www.w3.org/2000/11/DOM-Level-2-errata#core-4">http://www.w3.org/2000/11/DOM-Level-2-errata#core-4</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class HCNamedNodeMapInvalidType extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that setNamedItem method throws DOMException with HIERARCHY_REQUEST_ERR code.",
- method = "setNamedItem",
- args = {org.w3c.dom.Node.class}
- )
- public void testNamedNodeMapInvalidType() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Element docElem;
- Element newElem;
-
- doc = (Document) load("hc_staff", builder);
- docElem = doc.getDocumentElement();
- attributes = docElem.getAttributes();
- newElem = doc.createElement("html");
-
- {
- boolean success = false;
- try {
- attributes.setNamedItem(newElem);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR);
- }
- assertTrue("throw_HIERARCHY_REQUEST_ERR", success);
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java b/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java
deleted file mode 100644
index 53317b3..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Text;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * Create a document fragment with two adjacent text nodes, normalize and see if
- * the text nodes were combined.
- *
- * @author Curt Arnold
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-B63ED1A3">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-B63ED1A3</a>
- */
-@TestTargetClass(Node.class)
-public final class HCNodeDocumentFragmentNormalize extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies positive functionality of getNodeValue method, and that getNextSibling method returns null.",
- method = "getNodeValue",
- args = {}
- ),
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies positive functionality of getNodeValue method, and that getNextSibling method returns null.",
- method = "getNextSibling",
- args = {}
- )
- })
- public void testNodeDocumentFragmentNormalize1() throws Throwable {
- Document doc;
- DocumentFragment docFragment;
- String nodeValue;
- Text txtNode;
- Node retval;
-
- doc = (Document) load("hc_staff", builder);
- docFragment = doc.createDocumentFragment();
- txtNode = doc.createTextNode("foo");
- retval = docFragment.appendChild(txtNode);
- txtNode = doc.createTextNode("bar");
- retval = docFragment.appendChild(txtNode);
- docFragment.normalize();
- txtNode = (Text) docFragment.getFirstChild();
- nodeValue = txtNode.getNodeValue();
- assertEquals("normalizedNodeValue", "foobar", nodeValue);
- retval = txtNode.getNextSibling();
- assertNull("singleChild", retval);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getFirstChild method returns null.",
- method = "getFirstChild",
- args = {}
- )
- public void testNodeDocumentFragmentNormalize2() throws Throwable {
- Document doc;
- DocumentFragment docFragment;
- Text txtNode;
-
- doc = (Document) load("hc_staff", builder);
- docFragment = doc.createDocumentFragment();
- txtNode = doc.createTextNode("");
- docFragment.appendChild(txtNode);
- docFragment.normalize();
- txtNode = (Text) docFragment.getFirstChild();
- assertNull("noChild", txtNode);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java
deleted file mode 100644
index 3eab5fc..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
- Copyright (c) 2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * An attempt to add remove an notation using removeNamedItemNS should result in
- * a NO_MODIFICATION_ERR or a NOT_FOUND_ERR.
- *
- * @author Curt Arnold
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-removeNamedItemNS</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class HCNotationsRemoveNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that removeNamedItemNS method throws DOMException.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS() throws Throwable {
- Document doc;
- NamedNodeMap notations;
- DocumentType docType;
-
- doc = (Document) load("hc_staff", builder);
- docType = doc.getDoctype();
-
- if (!(("text/html".equals(getContentType())))) {
- assertNotNull("docTypeNotNull", docType);
- notations = docType.getNotations();
- assertNotNull("notationsNotNull", notations);
-
- try {
- notations.removeNamedItemNS("http://www.w3.org/1999/xhtml",
- "alpha");
- fail("throw_NO_MOD_OR_NOT_FOUND_ERR");
-
- } catch (DOMException ex) {
- switch (ex.code) {
- case 7:
- break;
- case 8:
- break;
- default:
- throw ex;
- }
- }
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java
deleted file mode 100644
index d5daee4..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
- Copyright (c) 2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * An attempt to add an element to the named node map returned by notations
- * should result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR.
- *
- * @author Curt Arnold
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class HCNotationsSetNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that setNamedItemNS throws DOMException.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testNotationsSetNamedItemNS() throws Throwable {
- Document doc;
- NamedNodeMap notations;
- DocumentType docType;
-
- Element elem;
- doc = (Document) load("hc_staff", builder);
- docType = doc.getDoctype();
-
- if (!(("text/html".equals(getContentType())))) {
- assertNotNull("docTypeNotNull", docType);
- notations = docType.getNotations();
- assertNotNull("notationsNotNull", notations);
- elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");
-
- try {
- notations.setNamedItemNS(elem);
- fail("throw_HIER_OR_NO_MOD_ERR");
-
- } catch (DOMException ex) {
- switch (ex.code) {
- case 3:
- break;
- case 7:
- break;
- default:
- throw ex;
- }
- }
- }
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java b/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java
deleted file mode 100644
index 89eef88..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "hasAttribute()" method for an Element should return true if the element
- * has an attribute with the given name. Retrieve the first "address" element
- * and the "hasAttribute()" method should return false since the element does
- * not have a default value.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttr</a>
- */
-@TestTargetClass(Element.class)
-public final class HasAttribute extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that hasAttribute method returns false.",
- method = "hasAttribute",
- args = {java.lang.String.class}
- )
- public void testHasAttribute1() throws Throwable {
- Document doc;
- NodeList elementList;
- Element testNode;
- boolean state;
- doc = (Document) load("staff", builder);
- elementList = doc.getElementsByTagName("address");
- testNode = (Element) elementList.item(4);
- state = testNode.hasAttribute("domestic");
- assertFalse("throw_False", state);
- }
-
-// Assumes validation.
-// public void testHasAttribute2() throws Throwable {
-// Document doc;
-// NodeList elementList;
-// Element testNode;
-// boolean state;
-// doc = (Document) load("staff", builder);
-// elementList = doc.getElementsByTagName("address");
-// testNode = (Element) elementList.item(0);
-// state = testNode.hasAttribute("street");
-// assertTrue("throw_True", state);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that hasAttribute method returns false.",
- method = "hasAttribute",
- args = {java.lang.String.class}
- )
- public void testHasAttribute3() throws Throwable {
- Document doc;
- NodeList elementList;
- Element testNode;
- boolean state;
- doc = (Document) load("staff", builder);
- elementList = doc.getElementsByTagName("address");
- testNode = (Element) elementList.item(0);
- state = testNode.hasAttribute("nomatch");
- assertFalse("throw_False", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that hasAttribute method returns true.",
- method = "hasAttribute",
- args = {java.lang.String.class}
- )
- public void testHasAttribute4() throws Throwable {
- Document doc;
- NodeList elementList;
- Element testNode;
- boolean state;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testNode = (Element) elementList.item(0);
- state = testNode.hasAttribute("dmstc:domestic");
- assertTrue("hasDomesticAttr", state);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java
deleted file mode 100644
index cf1b90e..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- *
- * The "hasAttributeNS()" method for an Element should return false if the
- * element does not have an attribute with the given local name and/or a
- * namespace URI specified on this element or does not have a default value.
- * Retrieve the first "address" element and the "hasAttributeNS()" method should
- * return false since the element has "nomatch" as the local name and
- * "http://www.usa.com" as the namespace URI.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElHasAttrNS</a>
- */
-@TestTargetClass(Element.class)
-public final class HasAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "hasAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasAttributeNS1() throws Throwable {
- String localName = "nomatch";
- String namespaceURI = "http://www.usa.com";
- Document doc;
- NodeList elementList;
- Element testNode;
- boolean state;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testNode = (Element) elementList.item(0);
- state = testNode.hasAttributeNS(namespaceURI, localName);
- assertFalse("throw_False", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "hasAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasAttributeNS2() throws Throwable {
- String localName = "domestic";
- String namespaceURI = "http://www.nomatch.com";
- Document doc;
- NodeList elementList;
- Element testNode;
- boolean state;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testNode = (Element) elementList.item(0);
- state = testNode.hasAttributeNS(namespaceURI, localName);
- assertFalse("throw_False", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "hasAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasAttributeNS3() throws Throwable {
- String localName = "blank";
- String namespaceURI = "http://www.nist.gov";
- Document doc;
- NodeList elementList;
- Element testNode;
- boolean state;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testNode = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testNode);
- state = testNode.hasAttributeNS(namespaceURI, localName);
- assertFalse("throw_False", state);
- }
-
-// Assumes validation.
-// public void testHasAttributeNS4() throws Throwable {
-// String localName = "district";
-// String namespaceURI = "http://www.nist.gov";
-// Document doc;
-// NodeList elementList;
-// Element testNode;
-// boolean state;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("emp:address");
-// testNode = (Element) elementList.item(0);
-// assertNotNull("empAddressNotNull", testNode);
-// state = testNode.hasAttributeNS(namespaceURI, localName);
-// assertTrue("hasAttribute", state);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "hasAttributeNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testHasAttributeNS5() throws Throwable {
- String localName = "domestic";
- String namespaceURI = "http://www.usa.com";
- Document doc;
- NodeList elementList;
- Element testNode;
- boolean state;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testNode = (Element) elementList.item(0);
- state = testNode.hasAttributeNS(namespaceURI, localName);
- assertTrue("hasAttribute", state);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java b/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java
deleted file mode 100644
index 5d3954d..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "hasAttributes()" method for a node should return false if the node does
- * not have an attribute. Retrieve the first "name" node and invoke the
- * "hasAttributes()" method. The method should return false since the node does
- * not have an attribute.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs</a>
- */
-@TestTargetClass(Node.class)
-public final class HasAttributes extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that hasAttributes method returns false value.",
- method = "hasAttributes",
- args = {}
- )
- public void testHasAttributes1() throws Throwable {
- Document doc;
- NodeList addrList;
- Node addrNode;
- boolean state;
- doc = (Document) load("staff", builder);
- addrList = doc.getElementsByTagName("name");
- addrNode = addrList.item(0);
- state = addrNode.hasAttributes();
- assertFalse("throw_False", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that hasAttributes method returns true value.",
- method = "hasAttributes",
- args = {}
- )
- public void testHasAttributes2() throws Throwable {
- Document doc;
- NodeList addrList;
- Node addrNode;
- boolean state;
- doc = (Document) load("staff", builder);
- addrList = doc.getElementsByTagName("address");
- addrNode = addrList.item(0);
- state = addrNode.hasAttributes();
- assertTrue("throw_True", state);
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/ImportNode.java b/xml/src/test/java/tests/org/w3c/dom/ImportNode.java
deleted file mode 100644
index de39392..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/ImportNode.java
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Text;
-import org.w3c.dom.Node;
-import org.w3c.dom.Element;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.Comment;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "importNode(importedNode,deep)" method for a Document should import the
- * given importedNode into that Document. The importedNode is of type Attr. The
- * ownerElement is set to null. Specified flag is set to true. Children is
- * imported.
- *
- * Create a new attribute whose name is "elem:attr1" in a different document.
- * Create a child Text node with value "importedText" for the attribute node
- * above. Invoke method importNode(importedNode,deep) on this document with
- * importedNode being the newly created attribute. Method should return a node
- * whose name matches "elem:attr1" and a child node whose value equals
- * "importedText". The returned node should belong to this document whose
- * systemId is "staff.dtd"
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode">http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode</a>
- */
-@TestTargetClass(Document.class)
-public final class ImportNode extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void _testImportNode1() throws Throwable {
- Document doc;
- Document aNewDoc;
- Attr newAttr;
- Text importedChild;
- Node aNode;
- Document ownerDocument;
- Element attrOwnerElement;
- DocumentType docType;
- String system;
- boolean specified;
- NodeList childList;
- String nodeName;
- Node child;
- String childValue;
- List<String> expectedResult = new ArrayList<String>();
- expectedResult.add("elem:attr1");
- expectedResult.add("importedText");
-
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- newAttr = aNewDoc.createAttribute("elem:attr1");
- importedChild = aNewDoc.createTextNode("importedText");
- aNode = newAttr.appendChild(importedChild);
- aNode = doc.importNode(newAttr, false);
- ownerDocument = aNode.getOwnerDocument();
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertNotNull("aNode", aNode);
- assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
- null, null, null, system);
- attrOwnerElement = ((Attr) /* Node */aNode).getOwnerElement();
- assertNull("ownerElement", attrOwnerElement);
- specified = ((Attr) /* Node */aNode).getSpecified();
- assertTrue("specified", specified);
- childList = aNode.getChildNodes();
- assertEquals("childList", 1, childList.getLength());
- nodeName = aNode.getNodeName();
- assertEquals("nodeName", "elem:attr1", nodeName);
- child = aNode.getFirstChild();
- childValue = child.getNodeValue();
- assertEquals("childValue", "importedText", childValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode2() throws Throwable {
- Document doc;
- Document aNewDoc;
- CDATASection cDataSec;
- Node aNode;
- Document ownerDocument;
- DocumentType docType;
- String system;
- String value;
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- cDataSec = aNewDoc.createCDATASection("this is CDATASection data");
- aNode = doc.importNode(cDataSec, false);
- ownerDocument = aNode.getOwnerDocument();
- assertNotNull("ownerDocumentNotNull", ownerDocument);
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertURIEquals("dtdSystemId", null, null, null, "staffNS.dtd", null,
- null, null, null, system);
- value = aNode.getNodeValue();
- assertEquals("nodeValue", "this is CDATASection data", value);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode3() throws Throwable {
- Document doc;
- Document aNewDoc;
- Comment comment;
- Node aNode;
- Document ownerDocument;
- DocumentType docType;
- String system;
- String value;
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- comment = aNewDoc.createComment("this is a comment");
- aNode = doc.importNode(comment, false);
- ownerDocument = aNode.getOwnerDocument();
- assertNotNull("ownerDocumentNotNull", ownerDocument);
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
- null, null, null, system);
- value = aNode.getNodeValue();
- assertEquals("nodeValue", "this is a comment", value);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode4() throws Throwable {
- Document doc;
- Document aNewDoc;
- DocumentFragment docFrag;
- Comment comment;
- Node aNode;
- NodeList children;
- Node child;
- String childValue;
- doc = (Document) load("staff", builder);
- aNewDoc = (Document) load("staff", builder);
- docFrag = aNewDoc.createDocumentFragment();
- comment = aNewDoc.createComment("descendant1");
- aNode = docFrag.appendChild(comment);
- aNode = doc.importNode(docFrag, true);
- children = aNode.getChildNodes();
- assertEquals("throw_Size", 1, children.getLength());
- child = aNode.getFirstChild();
- childValue = child.getNodeValue();
- assertEquals("descendant1", "descendant1", childValue);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode5() throws Throwable {
- Document doc;
- Document aNewDoc;
- Element element;
- Node aNode;
- boolean hasChild;
- Document ownerDocument;
- DocumentType docType;
- String system;
- String name;
- NodeList addresses;
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- addresses = aNewDoc.getElementsByTagName("emp:address");
- element = (Element) addresses.item(0);
- assertNotNull("empAddressNotNull", element);
- aNode = doc.importNode(element, false);
- hasChild = aNode.hasChildNodes();
- assertFalse("hasChild", hasChild);
- ownerDocument = aNode.getOwnerDocument();
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertURIEquals("dtdSystemId", null, null, null, "staffNS.dtd", null,
- null, null, null, system);
- name = aNode.getNodeName();
- assertEquals("nodeName", "emp:address", name);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode6() throws Throwable {
- Document doc;
- Document aNewDoc;
- Element element;
- Node aNode;
- boolean hasChild;
- String name;
- Node child;
- String value;
- NodeList addresses;
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- addresses = aNewDoc.getElementsByTagName("emp:address");
- element = (Element) addresses.item(0);
- assertNotNull("empAddressNotNull", element);
- aNode = doc.importNode(element, true);
- hasChild = aNode.hasChildNodes();
- assertTrue("throw_True", hasChild);
- name = aNode.getNodeName();
- assertEquals("nodeName", "emp:address", name);
- child = aNode.getFirstChild();
- value = child.getNodeValue();
- assertEquals("nodeValue", "27 South Road. Dallas, texas 98556", value);
- }
-
-// Assumes validation.
-// public void testImportNode7() throws Throwable {
-// Document doc;
-// Document aNewDoc;
-// Element element;
-// Node aNode;
-// NamedNodeMap attributes;
-// String name;
-// Node attr;
-// String lname;
-// String namespaceURI = "http://www.nist.gov";
-// String qualifiedName = "emp:employee";
-// doc = (Document) load("staffNS", builder);
-// aNewDoc = (Document) load("staff", builder);
-// element = aNewDoc.createElementNS(namespaceURI, qualifiedName);
-// aNode = doc.importNode(element, false);
-// attributes = aNode.getAttributes();
-// assertEquals("throw_Size", 1, attributes.getLength());
-// name = aNode.getNodeName();
-// assertEquals("nodeName", "emp:employee", name);
-// attr = attributes.item(0);
-// lname = attr.getLocalName();
-// assertEquals("lname", "defaultAttr", lname);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode8() throws Throwable {
- Document doc;
- Document aNewDoc;
- DocumentFragment docFrag;
- Node aNode;
- boolean hasChild;
- Document ownerDocument;
- DocumentType docType;
- String system;
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- docFrag = aNewDoc.createDocumentFragment();
- aNode = doc.importNode(docFrag, false);
- hasChild = aNode.hasChildNodes();
- assertFalse("hasChild", hasChild);
- ownerDocument = aNode.getOwnerDocument();
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertURIEquals("system", null, null, null, "staffNS.dtd", null, null,
- null, null, system);
- }
-
-// Assumes validation.
-// public void testImportNode9() throws Throwable {
-// Document doc;
-// Document aNewDoc;
-//
-// NamedNodeMap entityList;
-// Entity entity2;
-// Entity entity1;
-// Document ownerDocument;
-// DocumentType docType;
-// String system;
-// String entityName;
-// String publicVal;
-// String notationName;
-// doc = (Document) load("staffNS", builder);
-// aNewDoc = (Document) load("staffNS", builder);
-// docType = aNewDoc.getDoctype();
-// entityList = docType.getEntities();
-// assertNotNull("entitiesNotNull", entityList);
-// entity2 = (Entity) entityList.getNamedItem("ent6");
-// entity1 = (Entity) doc.importNode(entity2, false);
-// ownerDocument = entity1.getOwnerDocument();
-// docType = ownerDocument.getDoctype();
-// system = docType.getSystemId();
-// assertURIEquals("dtdSystemId", null, null, null, "staffNS.dtd", null,
-// null, null, null, system);
-// entityName = entity1.getNodeName();
-// assertEquals("entityName", "ent6", entityName);
-// publicVal = entity1.getPublicId();
-// assertEquals("entityPublicId", "uri", publicVal);
-// system = entity1.getSystemId();
-// assertURIEquals("entitySystemId", null, null, null, "file", null, null,
-// null, null, system);
-// notationName = entity1.getNotationName();
-// assertEquals("notationName", "notation2", notationName);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode10() throws Throwable {
- Document doc;
- Document aNewDoc;
- EntityReference entRef;
- Node aNode;
- Document ownerDocument;
- DocumentType docType;
- String system;
- String name;
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- entRef = aNewDoc.createEntityReference("entRef1");
- assertNotNull("createdEntRefNotNull", entRef);
- entRef.setNodeValue("entRef1Value");
- aNode = doc.importNode(entRef, false);
- ownerDocument = aNode.getOwnerDocument();
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
- null, null, null, system);
- name = aNode.getNodeName();
- assertEquals("nodeName", "entRef1", name);
- }
-
-// Assumes validation
-// public void testImportNode11() throws Throwable {
-// Document doc;
-// Document aNewDoc;
-// EntityReference entRef;
-// Node aNode;
-// String name;
-// Node child;
-// String childValue;
-// doc = (Document) load("staff", builder);
-// aNewDoc = (Document) load("staff", builder);
-// entRef = aNewDoc.createEntityReference("ent3");
-// assertNotNull("createdEntRefNotNull", entRef);
-// aNode = doc.importNode(entRef, true);
-// name = aNode.getNodeName();
-// assertEquals("entityName", "ent3", name);
-// child = aNode.getFirstChild();
-// assertNotNull("child", child);
-// childValue = child.getNodeValue();
-// assertEquals("childValue", "Texas", childValue);
-// }
-
-// Assumes validation.
-// public void testImportNode12() throws Throwable {
-// Document doc;
-// Document aNewDoc;
-// DocumentType doc1Type;
-// NamedNodeMap entityList;
-// Entity entity2;
-// Entity entity1;
-// Document ownerDocument;
-// DocumentType docType;
-// String system;
-// String entityName;
-// Node child;
-// String childName;
-// doc = (Document) load("staffNS", builder);
-// aNewDoc = (Document) load("staffNS", builder);
-// doc1Type = aNewDoc.getDoctype();
-// entityList = doc1Type.getEntities();
-// assertNotNull("entitiesNotNull", entityList);
-// entity2 = (Entity) entityList.getNamedItem("ent4");
-// entity1 = (Entity) doc.importNode(entity2, true);
-// ownerDocument = entity1.getOwnerDocument();
-// docType = ownerDocument.getDoctype();
-// system = docType.getSystemId();
-// assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
-// null, null, null, system);
-// entityName = entity1.getNodeName();
-// assertEquals("entityName", "ent4", entityName);
-// child = entity1.getFirstChild();
-// assertNotNull("notnull", child);
-// childName = child.getNodeName();
-// assertEquals("childName", "entElement1", childName);
-// }
-
-// Assumes validation
-// public void testImportNode13() throws Throwable {
-// Document doc;
-// Document aNewDoc;
-// DocumentType doc1Type;
-// NamedNodeMap notationList;
-// Notation notation;
-// Notation aNode;
-// Document ownerDocument;
-// DocumentType docType;
-// String system;
-// String publicVal;
-// doc = (Document) load("staffNS", builder);
-// aNewDoc = (Document) load("staffNS", builder);
-// doc1Type = aNewDoc.getDoctype();
-// notationList = doc1Type.getNotations();
-// assertNotNull("notationsNotNull", notationList);
-// notation = (Notation) notationList.getNamedItem("notation1");
-// aNode = (Notation) doc.importNode(notation, false);
-// ownerDocument = aNode.getOwnerDocument();
-// docType = ownerDocument.getDoctype();
-// system = docType.getSystemId();
-// assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
-// null, null, null, system);
-// publicVal = aNode.getPublicId();
-// assertEquals("publicId", "notation1File", publicVal);
-// system = aNode.getSystemId();
-// assertNull("notationSystemId", system);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode14() throws Throwable {
- Document doc;
- Document aNewDoc;
- ProcessingInstruction pi;
- ProcessingInstruction aNode;
- Document ownerDocument;
- DocumentType docType;
- String system;
- String target;
- String data;
-
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- pi = aNewDoc.createProcessingInstruction("target1", "data1");
- aNode = (ProcessingInstruction) doc.importNode(pi, false);
- ownerDocument = aNode.getOwnerDocument();
- assertNotNull("ownerDocumentNotNull", ownerDocument);
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
- null, null, null, system);
- target = aNode.getTarget();
- assertEquals("piTarget", "target1", target);
- data = aNode.getData();
- assertEquals("piData", "data1", data);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode15() throws Throwable {
- Document doc;
- Document aNewDoc;
- Text text;
- Node aNode;
- Document ownerDocument;
- DocumentType docType;
- String system;
- String value;
- doc = (Document) load("staffNS", builder);
- aNewDoc = (Document) load("staffNS", builder);
- text = aNewDoc.createTextNode("this is text data");
- aNode = doc.importNode(text, false);
- ownerDocument = aNode.getOwnerDocument();
- assertNotNull("ownerDocumentNotNull", ownerDocument);
- docType = ownerDocument.getDoctype();
- system = docType.getSystemId();
- assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
- null, null, null, system);
- value = aNode.getNodeValue();
- assertEquals("nodeValue", "this is text data", value);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode16() throws Throwable {
- Document doc;
- Document anotherDoc;
- DocumentType docType;
-
- doc = (Document) load("staffNS", builder);
- anotherDoc = (Document) load("staffNS", builder);
- docType = anotherDoc.getDoctype();
-
- {
- boolean success = false;
- try {
- doc.importNode(docType, false);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
- }
- assertTrue("throw_NOT_SUPPORTED_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that importNode method throws DOMException with NOT_SUPPORTED_ERR code.",
- method = "importNode",
- args = {org.w3c.dom.Node.class, boolean.class}
- )
- public void testImportNode17() throws Throwable {
- Document doc;
- Document anotherDoc;
-
- doc = (Document) load("staffNS", builder);
- anotherDoc = (Document) load("staffNS", builder);
-
- {
- boolean success = false;
- try {
- doc.importNode(anotherDoc, false);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
- }
- assertTrue("throw_NOT_SUPPORTED_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java b/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java
deleted file mode 100644
index f8f306c..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java
+++ /dev/null
@@ -1,92 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001-2004 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getInternalSubset()" method returns
- * the internal subset as a string or null if there is none.
- * This does not contain the delimiting brackets.
- *
- * Retrieve the documenttype.
- * Apply the "getInternalSubset()" method. Null is returned since there
- * is not an internal subset.
-* @author NIST
-* @author Mary Brady
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-internalSubset">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-internalSubset</a>
-*/
-@TestTargetClass(DocumentType.class)
-public final class InternalSubset extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that getInternalSubset method returns the internal subset as a string.",
- method = "getInternalSubset",
- args = {}
- )
- public void testGetInternalSubset() throws Throwable {
- Document doc;
- DocumentType docType;
- String internal;
- doc = (Document) load("staff2", builder);
- docType = doc.getDoctype();
- internal = docType.getInternalSubset();
- assertNull("internalSubsetNull", internal);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/IsSupported.java b/xml/src/test/java/tests/org/w3c/dom/IsSupported.java
deleted file mode 100644
index 318a81d..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/IsSupported.java
+++ /dev/null
@@ -1,272 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "feature" parameter in the isSupported(feature,version)" method is the
- * name of the feature and the version is the version number of the feature to
- * test. XXX is NOT a legal value for the feature parameter. The method should
- * return "false" since XXX is not a valid feature.
- *
- * Retrieve the root node of the DOM document by invoking the
- * "getDocumentElement()" method. This should create a node object on which the
- * "isSupported(feature,version)" method is invoked with "feature" equal to
- * "XXX" and version to "1.0". The method should return a boolean "false" since
- * XXX is not a valid feature.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a>
- */
-@TestTargetClass(Document.class)
-public final class IsSupported extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns false.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported1() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("XXX", "1.0");
- assertFalse("throw_False", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns false value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported2() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("XML", "9.0");
- assertFalse("throw_False", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns true value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported4() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("xml", "1.0");
- assertTrue("throw_True", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns true value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported5() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("core", "2.0");
- assertTrue("throw_True", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns true value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported6() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("xml", "2.0");
- assertTrue("throw_True", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns true value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported7() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("XML", "");
- assertTrue("throw_True", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns true value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported9() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("XML", "1.0");
- assertTrue("throw_True", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns true.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported10() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("CORE", "2.0");
- assertTrue("throw_True", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns true.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported11() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("XML", "2.0");
- assertTrue("throw_True", state);
- }
-
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported12() throws Throwable {
- List<String> features = new ArrayList<String>();
- features.add("Core");
- features.add("XML");
- features.add("HTML");
- features.add("Views");
- features.add("StyleSheets");
- features.add("CSS");
- features.add("CSS2");
- features.add("Events");
- features.add("UIEvents");
- features.add("MouseEvents");
- features.add("MutationEvents");
- features.add("HTMLEvents");
- features.add("Range");
- features.add("Traversal");
- features.add("bogus.bogus.bogus");
-
- Document doc;
- Node rootNode;
- String featureElement;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("Core", "2.0");
- assertTrue("Core2", state);
- for (int indexN10078 = 0; indexN10078 < features.size(); indexN10078++) {
- featureElement = (String) features.get(indexN10078);
- state = rootNode.isSupported(featureElement, "1.0");
- }
- for (int indexN10083 = 0; indexN10083 < features.size(); indexN10083++) {
- featureElement = (String) features.get(indexN10083);
- state = rootNode.isSupported(featureElement, "2.0");
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns correct value if it has empty string as a version parameter.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported13() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("Core", "");
- assertTrue("Core", state);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns correct value if it has null as a version parameter.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported14() throws Throwable {
- Document doc;
- Node rootNode;
- boolean state;
- String nullString = null;
-
- doc = (Document) load("staff", builder);
- rootNode = doc.getDocumentElement();
- state = rootNode.isSupported("Core", nullString);
- assertTrue("Core", state);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/LocalName.java b/xml/src/test/java/tests/org/w3c/dom/LocalName.java
deleted file mode 100644
index 3f1d9c3..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/LocalName.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getLocalName()" method for a Node returns the local part of the
- * qualified name of this node, and for nodes of any type other than
- * ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method,
- * this is null.
- *
- * Retrieve the first emp:address node and get the attributes of this node."
- * Then apply the getLocalName() method to the emp:domestic attribute. The
- * method should return "domestic".
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN</a>
- */
-@TestTargetClass(Node.class)
-public final class LocalName extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "getLocalName",
- args = {}
- )
- public void testGetLocalName1() throws Throwable {
- Document doc;
- NodeList elementList;
- Element testAddr;
- Attr addrAttr;
- String localName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- addrAttr = testAddr.getAttributeNode("emp:domestic");
- localName = addrAttr.getLocalName();
- assertEquals("localName", "domestic", localName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that getLocalName method returns null.",
- method = "getLocalName",
- args = {}
- )
- public void testGetLocalName2() throws Throwable {
- Document doc;
- Node createdNode;
- String localName;
- doc = (Document) load("staffNS", builder);
- createdNode = doc.createElement("test:employee");
- localName = createdNode.getLocalName();
- assertNull("localNameNull", localName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that getLocalName method returns null.",
- method = "getLocalName",
- args = {}
- )
- public void testGetLocalName3() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- Node textNode;
- String localName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employeeId");
- testEmployee = elementList.item(0);
- textNode = testEmployee.getFirstChild();
- localName = textNode.getLocalName();
- assertNull("textNodeLocalName", localName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "getLocalName",
- args = {}
- )
- public void testGetLocalName4() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- String employeeLocalName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- testEmployee = elementList.item(0);
- employeeLocalName = testEmployee.getLocalName();
- assertEquals("lname", "employee", employeeLocalName);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java
deleted file mode 100644
index e4ab1df..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * Using the method getNamedItemNS, retreive the entity "ent1" and notation
- * "notation1" from a NamedNodeMap of this DocumentTypes entities and notations.
- * Both should be null since entities and notations are not namespaced.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=407">http://www.w3.org/Bugs/Public/show_bug.cgi?id=407</a>
- * @see <a
- * href="http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html">http://lists.w3.org/Archives/Member/w3c-dom-ig/2003Nov/0016.html</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class NamedNodeMapGetNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testGetNamedItemNS1() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap entities;
-// NamedNodeMap notations;
-// Entity entity;
-// Notation notation;
-//
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// entities = docType.getEntities();
-// assertNotNull("entitiesNotNull", entities);
-// notations = docType.getNotations();
-// assertNotNull("notationsNotNull", notations);
-// entity = (Entity) entities.getNamedItemNS(nullNS, "ent1");
-// assertNotNull("entityNull", entity);
-// notation = (Notation) notations.getNamedItemNS(nullNS, "notation1");
-// assertNotNull("notationNull", notation);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetNamedItemNS2() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
- Attr attribute;
- NodeList elementList;
- String attrName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- element = elementList.item(1);
- attributes = element.getAttributes();
- attribute = (Attr) attributes.getNamedItemNS("http://www.nist.gov",
- "domestic");
- attrName = attribute.getNodeName();
- assertEquals("namednodemapgetnameditemns02", "emp:domestic", attrName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetNamedItemNS3() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
- Attr attribute;
- Attr newAttr1;
- Attr newAttr2;
-
- String attrName;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test", "root");
- newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1", "L1:att");
- ((Element) /* Node */element).setAttributeNodeNS(newAttr1);
- newAttr2 = doc.createAttributeNS("http://www.w3.org/DOM/L2", "L2:att");
- ((Element) /* Node */element).setAttributeNodeNS(newAttr2);
- attributes = element.getAttributes();
- attribute = (Attr) attributes.getNamedItemNS(
- "http://www.w3.org/DOM/L2", "att");
- attrName = attribute.getNodeName();
- assertEquals("namednodemapgetnameditemns03", "L2:att", attrName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetNamedItemNS4() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Element element;
- Attr attribute;
- Attr newAttr1;
- NodeList elementList;
- String attrName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = (Element) elementList.item(1);
- newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1", "street");
- element.setAttributeNodeNS(newAttr1);
- attributes = element.getAttributes();
- attribute = (Attr) attributes.getNamedItemNS(
- "http://www.w3.org/DOM/L1", "street");
- attrName = attribute.getNodeName();
- assertEquals("namednodemapgetnameditemns04", "street", attrName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "getNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testGetNamedItemNS5() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
- Attr attribute;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = elementList.item(1);
- attributes = element.getAttributes();
- attribute = (Attr) attributes.getNamedItemNS("*", "street");
- assertNull("namednodemapgetnameditemns05", attribute);
- }
-
-// Assumes validation.
-// public void testGetNamedItemNS6() throws Throwable {
-// Document doc;
-// NamedNodeMap attributesMap1;
-// NamedNodeMap attributesMap2;
-// Element element;
-// Attr attribute;
-// Attr newAttr1;
-//
-// NodeList elementList;
-// String attrName;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagNameNS("*", "address");
-// element = (Element) elementList.item(1);
-// attributesMap1 = element.getAttributes();
-// attributesMap2 = element.getAttributes();
-// newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1", "street");
-// element.setAttributeNodeNS(newAttr1);
-// attribute = (Attr) attributesMap1.getNamedItemNS(
-// "http://www.w3.org/DOM/L1", "street");
-// attrName = attribute.getNodeName();
-// assertEquals("namednodemapgetnameditemnsMap106", "street", attrName);
-// attribute = (Attr) attributesMap2.getNamedItemNS(
-// "http://www.w3.org/DOM/L1", "street");
-// attrName = attribute.getNodeName();
-// assertEquals("namednodemapgetnameditemnsMap206", "street", attrName);
-// }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java
deleted file mode 100644
index 16a6cda..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method removeNamedItemNS removes a node specified by local name and
- * namespace
- *
- * Retreive an attribute node and then remove from the NamedNodeMap. Verify if
- * the attribute node was actually remove from the node map.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS1() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
- Attr attribute;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- element = elementList.item(1);
- attributes = element.getAttributes();
- attribute = (Attr) attributes.removeNamedItemNS("http://www.nist.gov",
- "domestic");
- attribute = (Attr) attributes.getNamedItemNS("http://www.nist.gov",
- "domestic");
- assertNull("namednodemapremovenameditemns01", attribute);
- }
-
-// Assumes validation.
-// public void testRemoveNamedItemNS2() throws Throwable {
-// Document doc;
-// NamedNodeMap attributes;
-// Node element;
-// Attr attribute;
-// NodeList elementList;
-// String attrValue;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "employee");
-// element = elementList.item(1);
-// attributes = element.getAttributes();
-// attribute = (Attr) attributes.removeNamedItemNS(nullNS, "defaultAttr");
-// attribute = (Attr) attributes.getNamedItemNS(nullNS, "defaultAttr");
-// attrValue = attribute.getNodeValue();
-// assertNotNull("namednodemapremovenameditemns02", attribute);
-// assertEquals("namednodemapremovenameditemns02_attrValue", "defaultVal",
-// attrValue);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS3() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
- Attr attribute;
-
- Attr attribute1;
- Attr attribute2;
- String nodeName;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test", "root");
- attribute1 = doc
- .createAttributeNS("http://www.w3.org/DOM/L1", "L1:att");
- ((Element) /* Node */element).setAttributeNodeNS(attribute1);
- attribute2 = doc
- .createAttributeNS("http://www.w3.org/DOM/L2", "L2:att");
- ((Element) /* Node */element).setAttributeNodeNS(attribute2);
- attributes = element.getAttributes();
- attribute = (Attr) attributes.removeNamedItemNS(
- "http://www.w3.org/DOM/L1", "att");
- attribute = (Attr) attributes.getNamedItemNS(
- "http://www.w3.org/DOM/L2", "att");
- nodeName = attribute.getNodeName();
- assertEquals("namednodemapremovenameditemns02", "L2:att", nodeName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void _testRemoveNamedItemNS4() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
- Attr attribute;
-
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "employee");
- element = elementList.item(0);
- attributes = element.getAttributes();
- attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/", "xmlns");
- attribute = (Attr) attributes.getNamedItemNS(
- "http://www.w3.org/2000/xmlns/", "xmlns");
- assertNull("namednodemapremovenameditemns04_1", attribute);
- attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/", "dmstc");
- attribute = (Attr) attributes.getNamedItemNS(
- "http://www.w3.org/2000/xmlns/", "dmstc");
- assertNull("namednodemapremovenameditemns04_2", attribute);
- }
-
-// Assumes validation.
-// public void testRemoveNamedItemNS5() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap entities;
-// NamedNodeMap notations;
-//
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// entities = docType.getEntities();
-// assertNotNull("entitiesNotNull", entities);
-// notations = docType.getNotations();
-// assertNotNull("notationsNotNull", notations);
-//
-// try {
-// entities.removeNamedItemNS(nullNS, "ent1");
-// fail("entity_throw_DOMException");
-//
-// } catch (DOMException ex) {
-// switch (ex.code) {
-// case 8:
-// break;
-// case 7:
-// break;
-// default:
-// throw ex;
-// }
-// }
-//
-// try {
-// notations.removeNamedItemNS(nullNS, "notation1");
-// fail("notation_throw_DOMException");
-//
-// } catch (DOMException ex) {
-// switch (ex.code) {
-// case 8:
-// break;
-// case 7:
-// break;
-// default:
-// throw ex;
-// }
-// }
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS6() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
-
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "employee");
- element = elementList.item(1);
- attributes = element.getAttributes();
-
- {
- boolean success = false;
- try {
- attributes.removeNamedItemNS("http://www.Nist.gov", "domestic");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_FOUND_ERR);
- }
- assertTrue("throw_NOT_FOUND_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS7() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
-
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "employee");
- element = elementList.item(1);
- attributes = element.getAttributes();
-
- {
- boolean success = false;
- try {
- attributes.removeNamedItemNS("http://www.nist.gov", "domestic");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_FOUND_ERR);
- }
- assertTrue("throw_NOT_FOUND_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS8() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Element element;
-
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- element = (Element) elementList.item(1);
- attributes = element.getAttributes();
- element.removeAttributeNS("http://www.nist.gov", "domestic");
-
- {
- boolean success = false;
- try {
- attributes.removeNamedItemNS("http://www.nist.gov", "domestic");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_FOUND_ERR);
- }
- assertTrue("throw_NOT_FOUND_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS9() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- NamedNodeMap newAttributes;
- Element element;
- Attr attribute;
- NodeList elementList;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- element = (Element) elementList.item(1);
- attributes = element.getAttributes();
- attribute = (Attr) attributes.removeNamedItemNS("http://www.nist.gov",
- "domestic");
- newAttributes = element.getAttributes();
- attribute = (Attr) newAttributes.getNamedItemNS("http://www.nist.gov",
- "domestic");
- assertNull("namednodemapremovenameditemns09", attribute);
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java
deleted file mode 100644
index e0ec0df..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DocumentType;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method setNamedItemNS adds a node using its namespaceURI and localName.
- * If a node with that namespace URI and that local name is already present in
- * this map, it is replaced by the new one.
- *
- * Retreive the first element whose localName is address and namespaceURI
- * http://www.nist.gov", and put its attributes into a named node map. Create a
- * new attribute node and add it to this map. Verify if the attr node was
- * successfully added by checking the nodeName of the retreived atttribute.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-getNamedItemNS</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class NamedNodeMapSetNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- // Changed to configuration #2. This test case just doesn't make
- // sense without a namespace-aware parser. It actually fails even
- // on the JDK in that case.
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS1() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Node element;
- Attr attribute;
-
- Attr newAttr1;
- NodeList elementList;
- String attrName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
- "address");
- element = elementList.item(0);
- attributes = element.getAttributes();
- newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1", "streets");
- ((Element) /* Node */element).setAttributeNodeNS(newAttr1);
- attribute = (Attr) attributes.getNamedItemNS(
- "http://www.w3.org/DOM/L1", "streets");
- attrName = attribute.getNodeName();
- assertEquals("namednodemapsetnameditemns01", "streets", attrName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS2() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- Element element;
- Attr attribute;
- Attr attribute1;
-
- String attrName;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test", "root");
- attribute1 = doc
- .createAttributeNS("http://www.w3.org/DOM/L1", "L1:att");
- attributes = element.getAttributes();
- attributes.setNamedItemNS(attribute1);
- attribute = (Attr) attributes.getNamedItemNS(
- "http://www.w3.org/DOM/L1", "att");
- attrName = attribute.getNodeName();
- assertEquals("namednodemapsetnameditemns02", "L1:att", attrName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that setNamedItemNS throws DOMException with WRONG_DOCUMENT_ERR code.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS3() throws Throwable {
-
- Document doc;
- Document docAlt;
- NamedNodeMap attributes;
- NamedNodeMap attributesAlt;
- NodeList elementList;
- NodeList elementListAlt;
- Element element;
- Element elementAlt;
- Attr attr;
-
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = (Element) elementList.item(1);
- attributes = element.getAttributes();
- docAlt = (Document) load("staffNS", builder);
- elementListAlt = docAlt.getElementsByTagNameNS("*", "address");
- elementAlt = (Element) elementListAlt.item(1);
- attributesAlt = elementAlt.getAttributes();
- attr = (Attr) attributesAlt.getNamedItemNS(nullNS, "street");
- attributesAlt.removeNamedItemNS(nullNS, "street");
-
- {
- boolean success = false;
- try {
- attributes.setNamedItemNS(attr);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
- }
- assertTrue("throw_WRONG_DOCUMENT_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that setNamedItemNS throws DOMException with WRONG_DOCUMENT_ERR code.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS4() throws Throwable {
- Document doc;
- DOMImplementation domImpl;
- Document docAlt;
- DocumentType docType = null;
-
- NamedNodeMap attributes;
- NodeList elementList;
- Element element;
- Attr attrAlt;
-
- String nullNS = null;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = (Element) elementList.item(1);
- attributes = element.getAttributes();
- domImpl = doc.getImplementation();
- docAlt = domImpl.createDocument(nullNS, "newDoc", docType);
- attrAlt = docAlt.createAttributeNS(nullNS, "street");
-
- {
- boolean success = false;
- try {
- attributes.setNamedItemNS(attrAlt);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
- }
- assertTrue("throw_WRONG_DOCUMENT_ERR", success);
- }
- }
-
-// Assumes validation.
-// public void testSetNamedItemNS5() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap entities;
-// NamedNodeMap notations;
-// Entity entity;
-// Notation notation;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// entities = docType.getEntities();
-// assertNotNull("entitiesNotNull", entities);
-// notations = docType.getNotations();
-// assertNotNull("notationsNotNull", notations);
-// entity = (Entity) entities.getNamedItem("ent1");
-// notation = (Notation) notations.getNamedItem("notation1");
-//
-// {
-// boolean success = false;
-// try {
-// entities.setNamedItemNS(entity);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities", success);
-// }
-//
-// {
-// boolean success = false;
-// try {
-// notations.setNamedItemNS(notation);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations", success);
-// }
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that setNamedItemNS throws DOMException with INUSE_ATTRIBUTE_ERR code.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS6() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- NodeList elementList;
- Element element;
- Attr attr;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = (Element) elementList.item(0);
- attributes = element.getAttributes();
- attr = (Attr) attributes.getNamedItemNS("http://www.usa.com",
- "domestic");
- element = (Element) elementList.item(1);
- attributes = element.getAttributes();
-
- {
- boolean success = false;
- try {
- attributes.setNamedItemNS(attr);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
- }
- assertTrue("namednodemapsetnameditemns06", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that setNamedItemNS throws DOMException with INUSE_ATTRIBUTE_ERR code.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS7() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- NodeList elementList;
- Element element;
- Attr attr;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = (Element) elementList.item(0);
- attributes = element.getAttributes();
- attr = (Attr) attributes.getNamedItemNS("http://www.usa.com",
- "domestic");
- element = (Element) elementList.item(1);
- attributes = element.getAttributes();
-
- {
- boolean success = false;
- try {
- attributes.setNamedItemNS(attr);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
- }
- assertTrue("namednodemapsetnameditemns07", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that setNamedItemNS throws DOMException with INUSE_ATTRIBUTE_ERR code.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS8() throws Throwable {
- Document doc;
- NamedNodeMap attributes;
- NodeList elementList;
- Element element;
- Attr attr;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagNameNS("*", "address");
- element = (Element) elementList.item(0);
- attributes = element.getAttributes();
- attr = (Attr) attributes.getNamedItemNS("http://www.usa.com",
- "domestic");
- element = (Element) elementList.item(1);
- attributes = element.getAttributes();
-
- {
- boolean success = false;
- try {
- attributes.setNamedItemNS(attr);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
- }
- assertTrue("namednodemapsetnameditemns08", success);
- }
- }
-
-// Assumes validation.
-// public void testSetNamedItemNS9() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap entities;
-// NamedNodeMap notations;
-// Attr attr;
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// entities = docType.getEntities();
-// notations = docType.getNotations();
-// attr = doc.createAttributeNS("http://www.w3.org/DOM/Test", "test");
-//
-// {
-// boolean success = false;
-// try {
-// entities.setNamedItemNS(attr);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities", success);
-// }
-//
-// {
-// boolean success = false;
-// try {
-// notations.setNamedItemNS(attr);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations", success);
-// }
-// }
-
-// Assumes validation.
-// public void testSetNamedItemNS10() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap entities;
-// NamedNodeMap attributes;
-// Entity entity;
-//
-// Element element;
-// NodeList elementList;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// entities = docType.getEntities();
-// assertNotNull("entitiesNotNull", entities);
-// entity = (Entity) entities.getNamedItem("ent1");
-// elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "address");
-// element = (Element) elementList.item(0);
-// attributes = element.getAttributes();
-//
-// {
-// boolean success = false;
-// try {
-// attributes.setNamedItemNS(entity);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR);
-// }
-// assertTrue("throw_HIERARCHY_REQUEST_ERR", success);
-// }
-// }
-
-// Assumes validation.
-// public void testSetNamedItemNS11() throws Throwable {
-// Document doc;
-// DocumentType docType;
-// NamedNodeMap notations;
-// NamedNodeMap attributes;
-// Notation notation;
-// Element element;
-// NodeList elementList;
-//
-// doc = (Document) load("staffNS", builder);
-// docType = doc.getDoctype();
-// notations = docType.getNotations();
-// assertNotNull("notationsNotNull", notations);
-// notation = (Notation) notations.getNamedItem("notation1");
-// elementList = doc.getElementsByTagNameNS("http://www.nist.gov",
-// "address");
-// element = (Element) elementList.item(0);
-// attributes = element.getAttributes();
-//
-// {
-// boolean success = false;
-// try {
-// attributes.setNamedItemNS(notation);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR);
-// }
-// assertTrue("throw_HIERARCHY_REQUEST_ERR", success);
-// }
-// }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java b/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java
deleted file mode 100644
index dba8b86..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2003 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getNamespaceURI()" method for an Attribute returns the namespace URI of
- * this node, or null if unspecified.
- *
- * Retrieve the first "emp:address" node which has an attribute of
- * "emp:district" that is specified in the DTD. Invoke the "getNamespaceURI()"
- * method on the attribute. The method should return "http://www.nist.gov".
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=238">http://www.w3.org/Bugs/Public/show_bug.cgi?id=238</a>
- */
-@TestTargetClass(Attr.class)
-public final class NamespaceURI extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testGetNamespaceURI1() throws Throwable {
-// Document doc;
-// NodeList elementList;
-// Element testAddr;
-// Attr addrAttr;
-// String attrNamespaceURI;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("emp:address");
-// testAddr = (Element) elementList.item(0);
-// addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov",
-// "district");
-// attrNamespaceURI = addrAttr.getNamespaceURI();
-// assertEquals("namespaceURI", "http://www.nist.gov", attrNamespaceURI);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that getNamespaceURI method returns null.",
- method = "getNamespaceURI",
- args = {}
- )
- public void testGetNamespaceURI2() throws Throwable {
- Document doc;
- NodeList elementList;
- Element testAddr;
- Attr addrAttr;
- String attrNamespaceURI;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = (Element) elementList.item(0);
- assertNotNull("empAddressNotNull", testAddr);
- addrAttr = testAddr.getAttributeNodeNS("http://www.nist.gov",
- "domestic");
- attrNamespaceURI = addrAttr.getNamespaceURI();
- assertEquals("namespaceURI", "http://www.nist.gov", attrNamespaceURI);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that getNamespaceURI method returns null.",
- method = "getNamespaceURI",
- args = {}
- )
- public void testGetNamespaceURI3() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- String employeeNamespace;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- testEmployee = elementList.item(0);
- assertNotNull("employeeNotNull", testEmployee);
- employeeNamespace = testEmployee.getNamespaceURI();
- assertEquals("namespaceURI", "http://www.nist.gov", employeeNamespace);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getNamespaceURI method returns null.",
- method = "getNamespaceURI",
- args = {}
- )
- public void testGetNamespaceURI4() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- String employeeNamespace;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- testEmployee = elementList.item(1);
- employeeNamespace = testEmployee.getNamespaceURI();
- assertNull("throw_Null", employeeNamespace);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java
deleted file mode 100644
index d508465..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java
+++ /dev/null
@@ -1,107 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getLocalName returns the local part of the qualified name of this node.
- *
- * Ceate two new element nodes and atribute nodes, with and without namespace prefixes.
- * Retreive the local part of their qualified names using getLocalName and verrify
- * if it is correct.
-* @author IBM
-* @author Neil Delima
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSLocalN</a>
-*/
-@TestTargetClass(Node.class)
-public final class NodeGetLocalName extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify that getLocalName method returns null.",
- method = "getLocalName",
- args = {}
- )
- public void testGetLocalName() throws Throwable {
- Document doc;
- Element element;
- Element qelement;
- Attr attr;
- Attr qattr;
- String localElemName;
- String localQElemName;
- String localAttrName;
- String localQAttrName;
- doc = (Document) load("staff", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/elem", "elem");
- qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem", "qual:qelem");
- attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr", "attr");
- qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr", "qual:qattr");
- localElemName = element.getLocalName();
- localQElemName = qelement.getLocalName();
- localAttrName = attr.getLocalName();
- localQAttrName = qattr.getLocalName();
- assertEquals("nodegetlocalname03_localElemName", "elem", localElemName);
- assertEquals("nodegetlocalname03_localQElemName", "qelem", localQElemName);
- assertEquals("nodegetlocalname03_localAttrName", "attr", localAttrName);
- assertEquals("nodegetlocalname03_localQAttrName", "qattr", localQAttrName);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java
deleted file mode 100644
index 5ed1e29..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java
+++ /dev/null
@@ -1,111 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001-2003 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getNamespaceURI returns the namespace URI of this node, or null if it is unspecified
- * For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with
- * a DOM Level 1 method, such as createElement from the Document interface, this is always null.
- *
- * Ceate two new element nodes and atribute nodes, with and without namespace prefixes.
- * Retreive their namespaceURI's using getNamespaceURI and verrify if it is correct.
-* @author IBM
-* @author Neil Delima
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSname</a>
-* @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
-*/
-@TestTargetClass(Node.class)
-public final class NodeGetNamespaceURI extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getNamespaceURI",
- args = {}
- )
- public void testGetNamespaceURI() throws Throwable {
- Document doc;
- Element element;
- Element elementNS;
- Attr attr;
- Attr attrNS;
- String elemNSURI;
- String elemNSURINull;
- String attrNSURI;
- String attrNSURINull;
- String nullNS = null;
-
- doc = (Document) load("staff", builder);
- element = doc.createElementNS(nullNS, "elem");
- elementNS = doc.createElementNS("http://www.w3.org/DOM/Test/elem", "qual:qelem");
- attr = doc.createAttributeNS(nullNS, "attr");
- attrNS = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr", "qual:qattr");
- elemNSURI = elementNS.getNamespaceURI();
- elemNSURINull = element.getNamespaceURI();
- attrNSURI = attrNS.getNamespaceURI();
- attrNSURINull = attr.getNamespaceURI();
- assertEquals("nodegetnamespaceuri03_elemNSURI", "http://www.w3.org/DOM/Test/elem", elemNSURI);
- assertNull("nodegetnamespaceuri03_1", elemNSURINull);
- assertEquals("nodegetnamespaceuri03_attrNSURI", "http://www.w3.org/DOM/Test/attr", attrNSURI);
- assertNull("nodegetnamespaceuri03_2", attrNSURINull);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java
deleted file mode 100644
index 3579c15..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2003 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getOwnerDocument returns the Document object associated with this
- * node
- *
- * Create a new DocumentType node. Since this node is not used with any Document
- * yet verify if the ownerDocument is null.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc">http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc</a>
- * @see <a
- * href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a>
- */
-@TestTargetClass(Node.class)
-public final class NodeGetOwnerDocument extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getOwnerDocument method returns null.",
- method = "getOwnerDocument",
- args = {}
- )
- public void testGetOwnerDocument1() throws Throwable {
- Document doc;
- Document ownerDoc;
- DOMImplementation domImpl;
- DocumentType docType;
- String nullID = null;
-
- doc = (Document) load("staff", builder);
- domImpl = doc.getImplementation();
- docType = domImpl.createDocumentType("mydoc", nullID, nullID);
- ownerDoc = docType.getOwnerDocument();
- assertNull("nodegetownerdocument01", ownerDoc);
- }
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getOwnerDocument",
- args = {}
- )
- public void testGetOwnerDocument2() throws Throwable {
- Document doc;
- Document newDoc;
- Element newElem;
- Document ownerDocDoc;
- Document ownerDocElem;
- DOMImplementation domImpl;
- DocumentType docType;
- String nullNS = null;
-
- doc = (Document) load("staff", builder);
- domImpl = doc.getImplementation();
- docType = domImpl.createDocumentType("mydoc", nullNS, nullNS);
- newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "mydoc",
- docType);
- ownerDocDoc = newDoc.getOwnerDocument();
- assertNull("nodegetownerdocument02_1", ownerDocDoc);
- newElem = newDoc
- .createElementNS("http://www.w3.org/DOM/Test", "myelem");
- ownerDocElem = newElem.getOwnerDocument();
- assertNotNull("nodegetownerdocument02_2", ownerDocElem);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java
deleted file mode 100644
index bcf8bba..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java
+++ /dev/null
@@ -1,108 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method getPrefix returns the namespace prefix of this node, or null if it is unspecified.
- *
- * Ceate two new element nodes and atribute nodes, with and without namespace prefixes.
- * Retreive the prefix part of their qualified names using getPrefix and verify
- * if it is correct.
-* @author IBM
-* @author Neil Delima
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a>
-*/
-@TestTargetClass(Node.class)
-public final class NodeGetPrefix extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix() throws Throwable {
- Document doc;
- Element element;
- Element qelement;
- Attr attr;
- Attr qattr;
- String elemNoPrefix;
- String elemPrefix;
- String attrNoPrefix;
- String attrPrefix;
- doc = (Document) load("staff", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/elem", "elem");
- qelement = doc.createElementNS("http://www.w3.org/DOM/Test/elem", "qual:qelem");
- attr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr", "attr");
- qattr = doc.createAttributeNS("http://www.w3.org/DOM/Test/attr", "qual:qattr");
- elemNoPrefix = element.getPrefix();
- elemPrefix = qelement.getPrefix();
- attrNoPrefix = attr.getPrefix();
- attrPrefix = qattr.getPrefix();
- assertNull("nodegetprefix03_1", elemNoPrefix);
- assertEquals("nodegetprefix03_2", "qual", elemPrefix);
- assertNull("nodegetprefix03_3", attrNoPrefix);
- assertEquals("nodegetprefix03_4", "qual", attrPrefix);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java b/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java
deleted file mode 100644
index 514b205..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMImplementation;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method hasAttributes returns whether this node (if it is an element) has
- * any attributes. Retreive an element node without attributes. Verify if
- * hasAttributes returns false. Retreive another element node with attributes.
- * Verify if hasAttributes returns true.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeHasAttrs</a>
- */
-@TestTargetClass(Node.class)
-public final class NodeHasAttributes extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "hasAttributes",
- args = {}
- )
- public void testHasAttributes1() throws Throwable {
- Document doc;
- Element element;
- NodeList elementList;
- boolean hasAttributes;
- doc = (Document) load("staff", builder);
- elementList = doc.getElementsByTagName("employee");
- element = (Element) elementList.item(0);
- hasAttributes = element.hasAttributes();
- assertFalse("nodehasattributes01_1", hasAttributes);
- elementList = doc.getElementsByTagName("address");
- element = (Element) elementList.item(0);
- hasAttributes = element.hasAttributes();
- assertTrue("nodehasattributes01_2", hasAttributes);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that hasAttributes method returns false value.",
- method = "hasAttributes",
- args = {}
- )
- public void testHasAttributes2() throws Throwable {
- Document doc;
- DocumentType docType;
- boolean hasAttributes;
- doc = (Document) load("staffNS", builder);
- docType = doc.getDoctype();
- hasAttributes = docType.hasAttributes();
- assertFalse("nodehasattributes02", hasAttributes);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that hasAttributes method returns true value.",
- method = "hasAttributes",
- args = {}
- )
- public void testHasAttributes3() throws Throwable {
- Document doc;
- Element element;
- NodeList elementList;
- boolean hasAttributes;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:employee");
- element = (Element) elementList.item(0);
- assertNotNull("empEmployeeNotNull", element);
- hasAttributes = element.hasAttributes();
- assertTrue("hasAttributes", hasAttributes);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that hasAttributes method returns true value.",
- method = "hasAttributes",
- args = {}
- )
- public void testHasAttributes4() throws Throwable {
- Document doc;
- Document newDoc;
- DocumentType docType = null;
-
- DOMImplementation domImpl;
- Element element;
- Element elementTest;
- Element elementDoc;
- Attr attribute;
-
-
- NodeList elementList;
- boolean hasAttributes;
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test", "test",
- docType);
- element = newDoc.createElementNS("http://www.w3.org/DOM/Test",
- "dom:elem");
- attribute = newDoc.createAttribute("attr");
- element.setAttributeNode(attribute);
- elementDoc = newDoc.getDocumentElement();
- elementDoc.appendChild(element);
- elementList = newDoc.getElementsByTagNameNS(
- "http://www.w3.org/DOM/Test", "elem");
- elementTest = (Element) elementList.item(0);
- hasAttributes = elementTest.hasAttributes();
- assertTrue("nodehasattributes04", hasAttributes);
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java b/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java
deleted file mode 100644
index d88cb86..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2003 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.ProcessingInstruction;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method "isSupported(feature,version)" Tests whether the DOM
- * implementation implements a specific feature and that feature is supported by
- * this node.
- *
- * Call the isSupported method on the document element node with a combination
- * of features versions and versions as below. Valid feature names are case
- * insensitive and versions "2.0", "1.0" and if the version is not specified,
- * supporting any version of the feature should return true. Check if the value
- * returned value was true.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a>
- */
-@TestTargetClass(Node.class)
-public final class NodeIsSupported extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that isSupported method can return false value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported1() throws Throwable {
- Document doc;
- Element element;
- String version = "";
- String version1 = "1.0";
- String version2 = "2.0";
- String featureCore;
- String featureXML;
- boolean success;
- List<String> featuresXML = new ArrayList<String>();
- featuresXML.add("XML");
- featuresXML.add("xmL");
-
- List<String> featuresCore = new ArrayList<String>();
- featuresCore.add("Core");
- featuresCore.add("CORE");
-
- doc = (Document) load("staffNS", builder);
- element = doc.getDocumentElement();
- for (int indexN10063 = 0; indexN10063 < featuresXML.size(); indexN10063++) {
- featureXML = (String) featuresXML.get(indexN10063);
- success = element.isSupported(featureXML, version);
- assertTrue("nodeissupported01_XML1", success);
- success = element.isSupported(featureXML, version1);
- assertTrue("nodeissupported01_XML2", success);
- }
- for (int indexN1007C = 0; indexN1007C < featuresCore.size(); indexN1007C++) {
- featureCore = (String) featuresCore.get(indexN1007C);
- success = element.isSupported(featureCore, version);
- assertTrue("nodeissupported01_Core1", success);
- success = element.isSupported(featureCore, version1);
- success = element.isSupported(featureCore, version2);
- assertTrue("nodeissupported01_Core3", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify that isSupported method can return false value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported2() throws Throwable {
- Document doc;
- Attr attribute;
- String version = "";
- String version1 = "1.0";
- String version2 = "2.0";
- String featureCore;
- String featureXML;
- boolean success;
- List<String> featuresXML = new ArrayList<String>();
- featuresXML.add("XML");
- featuresXML.add("xmL");
-
- List<String> featuresCore = new ArrayList<String>();
- featuresCore.add("Core");
- featuresCore.add("CORE");
-
- doc = (Document) load("staffNS", builder);
- attribute = doc.createAttribute("TestAttr");
- for (int indexN10064 = 0; indexN10064 < featuresXML.size(); indexN10064++) {
- featureXML = (String) featuresXML.get(indexN10064);
- success = attribute.isSupported(featureXML, version);
- assertTrue("nodeissupported02_XML1", success);
- success = attribute.isSupported(featureXML, version1);
- assertTrue("nodeissupported02_XML2", success);
- }
- for (int indexN1007D = 0; indexN1007D < featuresCore.size(); indexN1007D++) {
- featureCore = (String) featuresCore.get(indexN1007D);
- success = attribute.isSupported(featureCore, version);
- assertTrue("nodeissupported02_Core1", success);
- success = attribute.isSupported(featureCore, version1);
- success = attribute.isSupported(featureCore, version2);
- assertTrue("nodeissupported02_Core3", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns false value if it's called with empty strings as parameters.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported3() throws Throwable {
- Document doc;
- DocumentType docType;
- boolean success;
- doc = (Document) load("staffNS", builder);
- docType = doc.getDoctype();
- success = docType.isSupported("", "");
- assertFalse("nodeissupported03", success);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns false value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported4() throws Throwable {
- Document doc;
- EntityReference entRef;
- boolean success;
- doc = (Document) load("staffNS", builder);
- entRef = doc.createEntityReference("ent1");
- assertNotNull("createdEntRefNotNull", entRef);
- success = entRef.isSupported("XML CORE", "");
- assertFalse("nodeissupported04", success);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that isSupported method returns false value.",
- method = "isSupported",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testIsSupported5() throws Throwable {
- Document doc;
- ProcessingInstruction pi;
- boolean success;
- doc = (Document) load("staffNS", builder);
- pi = doc.createProcessingInstruction("PITarget", "PIData");
- success = pi.isSupported("-", "+");
- assertFalse("nodeissupported05", success);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java b/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java
deleted file mode 100644
index d66ce58..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Text;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.EntityReference;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.CDATASection;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Comment;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method "normalize" puts all Text nodes in the full depth of the sub-tree
- * underneath this Node, including attribute nodes, into a "normal" form where
- * only structure (e.g., elements, comments, processing instructions, CDATA
- * sections, and entity references) separates Text nodes, i.e., there are
- * neither adjacent Text nodes nor empty Text nodes.
- *
- * Create a dom tree consisting of elements, comments, processing instructions,
- * CDATA sections, and entity references nodes seperated by text nodes. Check
- * the length of the node list of each before and after normalize has been
- * called.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize</a>
- */
-@TestTargetClass(Node.class)
-public final class NodeNormalize extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "normalize",
- args = {}
- )
- public void testNormalize() throws Throwable {
- Document doc;
- Document newDoc;
- DOMImplementation domImpl;
-
- DocumentType docTypeNull = null;
-
- Element documentElement;
- Element element1;
- Element element2;
- Element element3;
- Element element4;
- Element element5;
- Element element6;
- Element element7;
- Text text1;
- Text text2;
- Text text3;
- ProcessingInstruction pi;
- CDATASection cData;
- Comment comment;
- EntityReference entRef;
- NodeList elementList;
-
- doc = (Document) load("staffNS", builder);
- domImpl = doc.getImplementation();
- newDoc = domImpl.createDocument("http://www.w3.org/DOM/Test",
- "dom:root", docTypeNull);
- element1 = newDoc.createElement("element1");
- element2 = newDoc.createElement("element2");
- element3 = newDoc.createElement("element3");
- element4 = newDoc.createElement("element4");
- element5 = newDoc.createElement("element5");
- element6 = newDoc.createElement("element6");
- element7 = newDoc.createElement("element7");
- text1 = newDoc.createTextNode("text1");
- text2 = newDoc.createTextNode("text2");
- text3 = newDoc.createTextNode("text3");
- cData = newDoc.createCDATASection("Cdata");
- comment = newDoc.createComment("comment");
- pi = newDoc.createProcessingInstruction("PITarget", "PIData");
- entRef = newDoc.createEntityReference("EntRef");
- assertNotNull("createdEntRefNotNull", entRef);
- documentElement = newDoc.getDocumentElement();
- documentElement.appendChild(element1);
- element2.appendChild(text1);
- element2.appendChild(text2);
- element2.appendChild(text3);
- element1.appendChild(element2);
- text1 = (Text) text1.cloneNode(false);
- text2 = (Text) text2.cloneNode(false);
- element3.appendChild(entRef);
- element3.appendChild(text1);
- element3.appendChild(text2);
- element1.appendChild(element3);
- text1 = (Text) text1.cloneNode(false);
- text2 = (Text) text2.cloneNode(false);
- element4.appendChild(cData);
- element4.appendChild(text1);
- element4.appendChild(text2);
- element1.appendChild(element4);
- text2 = (Text) text2.cloneNode(false);
- text3 = (Text) text3.cloneNode(false);
- element5.appendChild(comment);
- element5.appendChild(text2);
- element5.appendChild(text3);
- element1.appendChild(element5);
- text2 = (Text) text2.cloneNode(false);
- text3 = (Text) text3.cloneNode(false);
- element6.appendChild(pi);
- element6.appendChild(text2);
- element6.appendChild(text3);
- element1.appendChild(element6);
- entRef = (EntityReference) entRef.cloneNode(false);
- text1 = (Text) text1.cloneNode(false);
- text2 = (Text) text2.cloneNode(false);
- text3 = (Text) text3.cloneNode(false);
- element7.appendChild(entRef);
- element7.appendChild(text1);
- element7.appendChild(text2);
- element7.appendChild(text3);
- element1.appendChild(element7);
- elementList = element1.getChildNodes();
- assertEquals("nodeNormalize01_1Bef", 6, elementList.getLength());
- elementList = element2.getChildNodes();
- assertEquals("nodeNormalize01_2Bef", 3, elementList.getLength());
- elementList = element3.getChildNodes();
- assertEquals("nodeNormalize01_3Bef", 3, elementList.getLength());
- elementList = element4.getChildNodes();
- assertEquals("nodeNormalize01_4Bef", 3, elementList.getLength());
- elementList = element5.getChildNodes();
- assertEquals("nodeNormalize01_5Bef", 3, elementList.getLength());
- elementList = element6.getChildNodes();
- assertEquals("nodeNormalize01_6Bef", 3, elementList.getLength());
- elementList = element7.getChildNodes();
- assertEquals("nodeNormalize01_7Bef", 4, elementList.getLength());
- newDoc.normalize();
- elementList = element1.getChildNodes();
- assertEquals("nodeNormalize01_1Aft", 6, elementList.getLength());
- elementList = element2.getChildNodes();
- assertEquals("nodeNormalize01_2Aft", 1, elementList.getLength());
- elementList = element3.getChildNodes();
- assertEquals("nodeNormalize01_3Aft", 2, elementList.getLength());
- elementList = element4.getChildNodes();
- assertEquals("nodeNormalize01_4Aft", 2, elementList.getLength());
- elementList = element5.getChildNodes();
- assertEquals("nodeNormalize01_5Aft", 2, elementList.getLength());
- elementList = element6.getChildNodes();
- assertEquals("nodeNormalize01_6Aft", 2, elementList.getLength());
- elementList = element7.getChildNodes();
- assertEquals("nodeNormalize01_7Aft", 2, elementList.getLength());
- }
-
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java b/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java
deleted file mode 100644
index dbecc30..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NodeList;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The method setPrefix sets the namespace prefix of this node. Note that
- * setting this attribute, when permitted, changes the nodeName attribute, which
- * holds the qualified name, as well as the tagName and name attributes of the
- * Element and Attr interfaces, when applicable.
- *
- * Create a new element node with a namespace prefix. Add it to a new
- * DocumentFragment Node without a prefix. Call setPrefix on the elemen node.
- * Check if the prefix was set correctly on the element.
- *
- * @author IBM
- * @author Neil Delima
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a>
- */
-@TestTargetClass(Node.class)
-public final class NodeSetPrefix extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setPrefix",
- args = {java.lang.String.class}
- )
- public void testSetPrefix1() throws Throwable {
- Document doc;
- DocumentFragment docFragment;
- Element element;
- String elementTagName;
- String elementNodeName;
-
- doc = (Document) load("staff", builder);
- docFragment = doc.createDocumentFragment();
- element = doc.createElementNS("http://www.w3.org/DOM/Test",
- "emp:address");
- docFragment.appendChild(element);
- element.setPrefix("dmstc");
- elementTagName = element.getTagName();
- elementNodeName = element.getNodeName();
- assertEquals("nodesetprefix01_tagname", "dmstc:address", elementTagName);
- assertEquals("nodesetprefix01_nodeName", "dmstc:address",
- elementNodeName);
- }
-
-// TODO Fails on JDK. Why?
-// public void testSetPrefix2() throws Throwable {
-// Document doc;
-// Element element;
-// Attr attribute;
-// Attr newAttribute;
-//
-// NodeList elementList;
-// String attrName;
-// String newAttrName;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("address");
-// element = (Element) elementList.item(1);
-// newAttribute = doc.createAttributeNS("http://www.w3.org/DOM/Test",
-// "test:address");
-// element.setAttributeNodeNS(newAttribute);
-// newAttribute.setPrefix("dom");
-// attribute = element
-// .getAttributeNodeNS("http://www.usa.com", "domestic");
-// attrName = attribute.getNodeName();
-// newAttrName = newAttribute.getNodeName();
-// assertEquals("nodesetprefix02_attrName", "dmstc:domestic", attrName);
-// assertEquals("nodesetprefix02_newAttrName", "dom:address", newAttrName);
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setPrefix",
- args = {java.lang.String.class}
- )
- public void testSetPrefix3() throws Throwable {
- Document doc;
- Element element;
- doc = (Document) load("staffNS", builder);
- element = doc.createElement("address");
-
- {
- boolean success = false;
- try {
- element.setPrefix("test");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-
-// Relies on validation, which we don't support.
-// public void testSetPrefix4() throws Throwable {
-// Document doc;
-// Element element;
-// Attr attribute;
-// NodeList elementList;
-// String nullNS = null;
-//
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("emp:employee");
-// element = (Element) elementList.item(0);
-// assertNotNull("empEmployeeNotNull", element);
-// attribute = element.getAttributeNodeNS(nullNS, "defaultAttr");
-//
-// {
-// boolean success = false;
-// try {
-// attribute.setPrefix("test");
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NAMESPACE_ERR);
-// }
-// assertTrue("nodesetprefix04", success);
-// }
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setPrefix",
- args = {java.lang.String.class}
- )
- public void testSetPrefix5() throws Throwable {
- Document doc;
- Element element;
- String prefixValue;
- List<String> prefixValues = new ArrayList<String>();
- prefixValues.add("_:");
- prefixValues.add(":0");
- prefixValues.add(":");
- prefixValues.add("_::");
- prefixValues.add("a:0:c");
-
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/L2",
- "dom:elem");
- for (int indexN10050 = 0; indexN10050 < prefixValues.size(); indexN10050++) {
- prefixValue = (String) prefixValues.get(indexN10050);
-
- {
- boolean success = false;
- try {
- element.setPrefix(prefixValue);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setPrefix",
- args = {java.lang.String.class}
- )
- public void testSetPrefix6() throws Throwable {
- Document doc;
- Element element;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/L2",
- "dom:elem");
-
- {
- boolean success = false;
- try {
- element.setPrefix("xml");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setPrefix",
- args = {java.lang.String.class}
- )
- public void testSetPrefix7() throws Throwable {
- Document doc;
- Attr attribute;
- doc = (Document) load("staffNS", builder);
- attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test/L2",
- "abc:elem");
-
- {
- boolean success = false;
- try {
- attribute.setPrefix("xmlns");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR.",
- method = "setPrefix",
- args = {java.lang.String.class}
- )
- public void testSetPrefix8() throws Throwable {
- Document doc;
- Element element;
- NodeList elementList;
- Attr attribute;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- element = (Element) elementList.item(0);
- attribute = element.getAttributeNode("xmlns");
-
- {
- boolean success = false;
- try {
- attribute.setPrefix("xml");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with INVALID_CHARACTER_ERR code.",
- method = "setPrefix",
- args = {java.lang.String.class}
- )
- public void _testSetPrefix9() throws Throwable {
- Document doc;
- String value = "#$%&'()@";
- Element element;
- doc = (Document) load("staffNS", builder);
- element = doc.createElementNS("http://www.w3.org/DOM/Test/L2",
- "dom:elem");
-
- {
- boolean success = false;
- try {
- element.setPrefix(value);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/Normalize.java b/xml/src/test/java/tests/org/w3c/dom/Normalize.java
deleted file mode 100644
index 36ff43c..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/Normalize.java
+++ /dev/null
@@ -1,106 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.CharacterData;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "normalize()" method puts all the nodes in the full
- * depth of the sub-tree underneath this element into a
- * "normal" form.
- *
- * Retrieve the third employee and access its second child.
- * This child contains a block of text that is spread
- * across multiple lines. The content of the "name" child
- * should be parsed and treated as a single Text node.
- * This appears to be a duplicate of elementnormalize.xml in DOM L1 Test Suite
-* @author NIST
-* @author Mary Brady
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-normalize</a>
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-72AB8359">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-72AB8359</a>
-*/
-@TestTargetClass(Element.class)
-public final class Normalize extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "normalize",
- args = {}
- )
- public void testNormalize() throws Throwable {
- Document doc;
- Element root;
- NodeList elementList;
- Node firstChild;
- NodeList textList;
- CharacterData textNode;
- String data;
- doc = (Document) load("staff", builder);
- root = doc.getDocumentElement();
- root.normalize();
- elementList = root.getElementsByTagName("name");
- firstChild = elementList.item(2);
- textList = firstChild.getChildNodes();
- textNode = (CharacterData) textList.item(0);
- data = textNode.getData();
- assertEquals("data", "Roger\n Jones", data);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java b/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java
deleted file mode 100644
index b5b0e94..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java
+++ /dev/null
@@ -1,88 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getOwnerDocument()" method returns null if the target
- * node itself is a DocumentType which is not used with any document yet.
- *
- * Invoke the "getOwnerDocument()" method on the master
- * document. The DocumentType returned should be null.
-* @author NIST
-* @author Mary Brady
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc">http://www.w3.org/TR/DOM-Level-2-Core/core#node-ownerDoc</a>
-*/
-@TestTargetClass(Document.class)
-public final class OwnerDocument extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Dosn't verify that getOwnerDocument can return not null value.",
- method = "getOwnerDocument",
- args = {}
- )
- public void testGetOwnerDocument() throws Throwable {
- Document doc;
- DocumentType ownerDocument;
- doc = (Document) load("staff", builder);
- ownerDocument = (DocumentType) doc.getOwnerDocument();
- assertNull("throw_Null", ownerDocument);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java b/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java
deleted file mode 100644
index a4af36a..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getOwnerElement()" will return the Element node this attribute is
- * attached to or null if this attribute is not in use. Get the "domestic"
- * attribute from the first "address" node. Apply the "getOwnerElement()" method
- * to get the Element associated with the attribute. The value returned should
- * be "address".
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095</a>
- */
-@TestTargetClass(Attr.class)
-public final class OwnerElement extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies positive functionlity.",
- method = "getOwnerElement",
- args = {}
- )
- public void testGetOwnerElement1() throws Throwable {
- Document doc;
- NodeList addressList;
- Node testNode;
- NamedNodeMap attributes;
- Attr domesticAttr;
- Element elementNode;
- String name;
- doc = (Document) load("staff", builder);
- addressList = doc.getElementsByTagName("address");
- testNode = addressList.item(0);
- attributes = testNode.getAttributes();
- domesticAttr = (Attr) attributes.getNamedItem("domestic");
- elementNode = domesticAttr.getOwnerElement();
- name = elementNode.getNodeName();
- assertEquals("throw_Equals", "address", name);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getOwnerElement method returns null.",
- method = "getOwnerElement",
- args = {}
- )
- public void testGetOwnerElement2() throws Throwable {
- Document doc;
- Attr newAttr;
- Element elementNode;
- doc = (Document) load("staff", builder);
- newAttr = doc.createAttribute("newAttribute");
- elementNode = newAttr.getOwnerElement();
- assertNull("throw_Null", elementNode);
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/Prefix.java b/xml/src/test/java/tests/org/w3c/dom/Prefix.java
deleted file mode 100644
index f45144a..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/Prefix.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getPrefix()" method for a Node returns the namespace prefix of the node,
- * and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and
- * nodes created with a DOM Level 1 method, this is null.
- *
- * Create an new Element with the createElement() method. Invoke the
- * "getPrefix()" method on the newly created element node will cause "null" to
- * be returned.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-NodeNSPrefix</a>
- */
-@TestTargetClass(Node.class)
-public final class Prefix extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method can return null.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix1() throws Throwable {
- Document doc;
- Node createdNode;
- String prefix;
- doc = (Document) load("staffNS", builder);
- createdNode = doc.createElement("test:employee");
- prefix = createdNode.getPrefix();
- assertNull("throw_Null", prefix);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies positive functionality of getPrefix method.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix2() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- Node textNode;
- String prefix;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:employeeId");
- testEmployee = elementList.item(0);
- assertNotNull("empEmployeeNotNull", testEmployee);
- textNode = testEmployee.getFirstChild();
- prefix = textNode.getPrefix();
- assertNull("textNodePrefix", prefix);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies positive functionality of getPrefix method.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix3() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- String prefix;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:employee");
- testEmployee = elementList.item(0);
- assertNotNull("empEmployeeNotNull", testEmployee);
- prefix = testEmployee.getPrefix();
- assertEquals("prefix", "emp", prefix);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method returns null.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix4() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testEmployee;
- String prefix;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- testEmployee = elementList.item(0);
- prefix = testEmployee.getPrefix();
- assertNull("throw_Null", prefix);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix5() throws Throwable {
- Document doc;
- NodeList elementList;
- Element addrNode;
- Attr addrAttr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- addrNode = (Element) elementList.item(0);
- assertNotNull("empAddrNotNull", addrNode);
- addrAttr = addrNode.getAttributeNode("emp:domestic");
-
- {
- boolean success = false;
- try {
- addrAttr.setPrefix("xmlns");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method throws DOMException with INVALID_CHARACTER_ERR code.",
- method = "getPrefix",
- args = {}
- )
- public void _testGetPrefix6() throws Throwable {
- Document doc;
- NodeList elementList;
- Node employeeNode;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- employeeNode = elementList.item(0);
-
- {
- boolean success = false;
- try {
- employeeNode.setPrefix("pre^fix xmlns='http//www.nist.gov'");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix7() throws Throwable {
- Document doc;
- NodeList elementList;
- Node employeeNode;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- employeeNode = elementList.item(0);
-
- {
- boolean success = false;
- try {
- employeeNode.setPrefix("emp::");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-
-// Assumes validation.
-// public void testGetPrefix8() throws Throwable {
-// Document doc;
-// NodeList genderList;
-// Node genderNode;
-// Node entRef;
-// Node entElement;
-//
-// int nodeType;
-// doc = (Document) load("staff", builder);
-// genderList = doc.getElementsByTagName("gender");
-// genderNode = genderList.item(2);
-// entRef = genderNode.getFirstChild();
-// nodeType = (int) entRef.getNodeType();
-//
-// if (1 == nodeType) {
-// entRef = doc.createEntityReference("ent4");
-// assertNotNull("createdEntRefNotNull", entRef);
-// }
-// entElement = entRef.getFirstChild();
-// assertNotNull("entElement", entElement);
-// doc.createElement("text3");
-//
-// {
-// boolean success = false;
-// try {
-// entElement.setPrefix("newPrefix");
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success);
-// }
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.",
- method = "getPrefix",
- args = {}
- )
- public void _testGetPrefix9() throws Throwable {
- Document doc;
- NodeList elementList;
- Element addrNode;
- Attr addrAttr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- addrNode = (Element) elementList.item(3);
- addrAttr = addrNode.getAttributeNode("xmlns");
-
- {
- boolean success = false;
- try {
- addrAttr.setPrefix("xxx");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix10() throws Throwable {
- Document doc;
- NodeList elementList;
- Node employeeNode;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- employeeNode = elementList.item(1);
-
- {
- boolean success = false;
- try {
- employeeNode.setPrefix("xml");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies that getPrefix method throws DOMException with NAMESPACE_ERR code.",
- method = "getPrefix",
- args = {}
- )
- public void testGetPrefix11() throws Throwable {
- Document doc;
- NodeList elementList;
- Node employeeNode;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- employeeNode = elementList.item(1);
- employeeNode.getNamespaceURI();
-
- {
- boolean success = false;
- try {
- employeeNode.setPrefix("employee1");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/PublicId.java b/xml/src/test/java/tests/org/w3c/dom/PublicId.java
deleted file mode 100644
index 8165b2c..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/PublicId.java
+++ /dev/null
@@ -1,91 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getPublicId()" method of a documenttype node contains
- * the public identifier associated with the external subset.
- *
- * Retrieve the documenttype.
- * Apply the "getPublicId()" method. The string "STAFF" should be
- * returned.
-* @author NIST
-* @author Mary Brady
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-publicId</a>
-*/
-@TestTargetClass(DocumentType.class)
-public final class PublicId extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getPublicId",
- args = {}
- )
- public void testGetPublicId() throws Throwable {
- Document doc;
- DocumentType docType;
- String publicId;
- doc = (Document) load("staffNS", builder);
- docType = doc.getDoctype();
- publicId = docType.getPublicId();
- assertEquals("throw_Equals", "STAFF", publicId);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/RemoveAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/RemoveAttributeNS.java
deleted file mode 100644
index 6a84d1b..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/RemoveAttributeNS.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargetClass;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * The "removeAttributeNS(namespaceURI,localName)" method for an attribute
- * causes the DOMException NO_MODIFICATION_ALLOWED_ERR to be raised if the node
- * is readonly.
- *
- * Obtain the children of the THIRD "gender" element. The elements content is an
- * entity reference. Try to remove an attribute from the entity reference by
- * executing the "removeAttributeNS(namespaceURI,localName)" method. This causes
- * a NO_MODIFICATION_ALLOWED_ERR DOMException to be thrown.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='NO_MODIFICATION_ALLOWED_ERR'])</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElRemAtNS</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElRemAtNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElRemAtNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='NO_MODIFICATION_ALLOWED_ERR'])</a>
- */
-@TestTargetClass(Attr.class)
-public final class RemoveAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
-// Assumes validation.
-// public void testRemoveAttributeNS1() throws Throwable {
-// Document doc;
-// NodeList genderList;
-// Node gender;
-// Node gen;
-// NodeList gList;
-// Element genElement;
-// int nodeType;
-// doc = (Document) load("staffNS", builder);
-// genderList = doc.getElementsByTagName("gender");
-// gender = genderList.item(2);
-// gen = gender.getFirstChild();
-// nodeType = (int) gen.getNodeType();
-//
-// if (1 == nodeType) {
-// gen = doc.createEntityReference("ent4");
-// assertNotNull("createdEntRefNotNull", gen);
-// }
-// gList = gen.getChildNodes();
-// genElement = (Element) gList.item(0);
-// assertNotNull("notnull", genElement);
-//
-// {
-// boolean success = false;
-// try {
-// genElement.removeAttributeNS("www.xyz.com", "local1");
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success);
-// }
-// }
-
-// Assumes validation
-// public void testRemoveAttributeNS2() throws Throwable {
-// Document doc;
-// NodeList elementList;
-// Node testAddr;
-// Attr addrAttr;
-// String attr;
-// String namespaceURI;
-// String localName;
-// String prefix;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("emp:address");
-// testAddr = elementList.item(0);
-// ((Element) /* Node */testAddr).removeAttributeNS("http://www.nist.gov",
-// "local1");
-// elementList = doc.getElementsByTagName("emp:address");
-// testAddr = elementList.item(0);
-// addrAttr = ((Element) /* Node */testAddr).getAttributeNodeNS(
-// "http://www.nist.gov", "local1");
-// attr = ((Element) /* Node */testAddr).getAttributeNS(
-// "http://www.nist.gov", "local1");
-// namespaceURI = addrAttr.getNamespaceURI();
-// localName = addrAttr.getLocalName();
-// prefix = testAddr.getPrefix();
-// assertEquals("attr", "FALSE", attr);
-// assertEquals("uri", "http://www.nist.gov", namespaceURI);
-// assertEquals("lname", "local1", localName);
-// assertEquals("prefix", "emp", prefix);
-// }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java
deleted file mode 100644
index e745e74..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "removeNamedItemNS(namespaceURI,localName)" method for a NamedNodeMap
- * should remove a node specified by localName and namespaceURI.
- *
- * Retrieve a list of elements with tag name "address". Access the second
- * element from the list and get its attributes. Try to remove the attribute
- * node with local name "domestic" and namespace uri "http://www.usa.com" with
- * method removeNamedItemNS(namespaceURI,localName). Check to see if the node
- * has been removed.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1074577549">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-1074577549</a>
- */
-@TestTargetClass(NamedNodeMap.class)
-public final class RemoveNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify DOMException exception.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS1() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testAddress;
- NamedNodeMap attributes;
- Attr newAttr;
- Node removedNode;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testAddress = elementList.item(1);
- attributes = testAddress.getAttributes();
- removedNode = attributes.removeNamedItemNS("http://www.usa.com",
- "domestic");
- assertNotNull("retval", removedNode);
- newAttr = (Attr) attributes.getNamedItem("dmstc:domestic");
- assertNull("nodeRemoved", newAttr);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Verifies DOMException with NOT_FOUND_ERR code.",
- method = "removeNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testRemoveNamedItemNS2() throws Throwable {
- String namespaceURI = "http://www.usa.com";
- String localName = "domest";
- Document doc;
- NodeList elementList;
- Node testAddress;
- NamedNodeMap attributes;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- testAddress = elementList.item(1);
- attributes = testAddress.getAttributes();
-
- {
- boolean success = false;
- try {
- attributes.removeNamedItemNS(namespaceURI,
- localName);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NOT_FOUND_ERR);
- }
- assertTrue("throw_NOT_FOUND_ERR", success);
- }
- }
-
-// Assumes validation.
-// public void testRemoveNamedItemNS3() throws Throwable {
-// String namespaceURI = "http://www.w3.org/2000/xmlns/";
-// String localName = "local1";
-// Document doc;
-// NodeList elementList;
-// Node testAddress;
-// NodeList nList;
-// Node child;
-// NodeList n2List;
-// Node child2;
-// NamedNodeMap attributes;
-//
-// int nodeType;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("gender");
-// testAddress = elementList.item(2);
-// nList = testAddress.getChildNodes();
-// child = nList.item(0);
-// nodeType = (int) child.getNodeType();
-//
-// if (1 == nodeType) {
-// child = doc.createEntityReference("ent4");
-// assertNotNull("createdEntRefNotNull", child);
-// }
-// n2List = child.getChildNodes();
-// child2 = n2List.item(0);
-// assertNotNull("notnull", child2);
-// attributes = child2.getAttributes();
-//
-// {
-// boolean success = false;
-// try {
-// attributes.removeNamedItemNS(namespaceURI,
-// localName);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success);
-// }
-// }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java
deleted file mode 100644
index 58c146f..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Attr;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "setAttributeNS(namespaceURI,qualifiedName,Value)" method raises a
- * INVALID_CHARACTER_ERR DOMException if the specified prefix contains an
- * illegal character.
- *
- * Attempt to add a new attribute on the first employee node. An exception
- * should be raised since the "qualifiedName" has an invalid character.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAttrNS</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAttrNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR'])</a>
- */
-@TestTargetClass(Element.class)
-public final class SetAttributeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with INVALID_CHARACTER_ERR code.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS1() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String qualifiedName = "emp:qual?name";
- Document doc;
- NodeList elementList;
- Node testAddr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- testAddr = elementList.item(0);
-
- {
- boolean success = false;
- try {
- ((Element) /* Node */testAddr).setAttributeNS(namespaceURI,
- qualifiedName, "newValue");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
- }
- assertTrue("throw_INVALID_CHARACTER_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS2() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String qualifiedName = "emp:";
- Document doc;
- NodeList elementList;
- Node testAddr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:employee");
- testAddr = elementList.item(0);
-
- {
- boolean success = false;
- try {
- ((Element) /* Node */testAddr).setAttributeNS(namespaceURI,
- qualifiedName, "newValue");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-
-// Assumes validation.
-// public void testSetAttributeNS3() throws Throwable {
-// String namespaceURI = "www.xyz.com";
-// String qualifiedName = "emp:local1";
-// Document doc;
-// NodeList genderList;
-// Node gender;
-// NodeList genList;
-// Node gen;
-// NodeList gList;
-// Element genElement;
-// int nodeType;
-// doc = (Document) load("staffNS", builder);
-// genderList = doc.getElementsByTagName("gender");
-// gender = genderList.item(2);
-// genList = gender.getChildNodes();
-// gen = genList.item(0);
-// nodeType = (int) gen.getNodeType();
-//
-// if (1 == nodeType) {
-// gen = doc.createEntityReference("ent4");
-// assertNotNull("createdEntRefNotNull", gen);
-// }
-// gList = gen.getChildNodes();
-// genElement = (Element) gList.item(0);
-// assertNotNull("notnull", genElement);
-//
-// {
-// boolean success = false;
-// try {
-// genElement.setAttributeNS(namespaceURI, qualifiedName,
-// "newValue");
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success);
-// }
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "setAttributeNS",
- args = {String.class, String.class, String.class}
- )
- public void testSetAttributeNS4() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testAddr;
- Attr addrAttr;
- String resultAttr;
- String resultNamespaceURI;
- String resultLocalName;
- String resultPrefix;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- ((Element) /* Node */testAddr).setAttributeNS("http://www.nist.gov",
- "newprefix:zone", "newValue");
- addrAttr = ((Element) /* Node */testAddr).getAttributeNodeNS(
- "http://www.nist.gov", "zone");
- resultAttr = ((Element) /* Node */testAddr).getAttributeNS(
- "http://www.nist.gov", "zone");
- assertEquals("attrValue", "newValue", resultAttr);
- resultNamespaceURI = addrAttr.getNamespaceURI();
- assertEquals("nsuri", "http://www.nist.gov", resultNamespaceURI);
- resultLocalName = addrAttr.getLocalName();
- assertEquals("lname", "zone", resultLocalName);
- resultPrefix = addrAttr.getPrefix();
- assertEquals("prefix", "newprefix", resultPrefix);
- }
-
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS5() throws Throwable {
- String localName = "newAttr";
- String namespaceURI = "http://www.newattr.com";
- String qualifiedName = "emp:newAttr";
- Document doc;
- NodeList elementList;
- Node testAddr;
-
- String resultAttr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- ((Element) /* Node */testAddr).setAttributeNS(namespaceURI,
- qualifiedName, "<newValue>");
- resultAttr = ((Element) /* Node */testAddr).getAttributeNS(
- namespaceURI, localName);
- assertEquals("throw_Equals", "<newValue>", resultAttr);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS6() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String qualifiedName = "xml:qualifiedName";
- Document doc;
- NodeList elementList;
- Node testAddr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- testAddr = elementList.item(0);
-
- {
- boolean success = false;
- try {
- ((Element) /* Node */testAddr).setAttributeNS(namespaceURI,
- qualifiedName, "newValue");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS7() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String qualifiedName = "xmlns";
- Document doc;
- NodeList elementList;
- Node testAddr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("employee");
- testAddr = elementList.item(0);
-
- {
- boolean success = false;
- try {
- ((Element) /* Node */testAddr).setAttributeNS(namespaceURI,
- qualifiedName, "newValue");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive functionality.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS9() throws Throwable {
- String localName = "newAttr";
- String namespaceURI = "http://www.newattr.com";
- String qualifiedName = "emp:newAttr";
- Document doc;
- NodeList elementList;
- Node testAddr;
- Attr addrAttr;
- String resultAttr;
- String resultNamespaceURI;
- String resultLocalName;
- String resultPrefix;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- ((Element) /* Node */testAddr).setAttributeNS(namespaceURI,
- qualifiedName, "newValue");
- addrAttr = ((Element) /* Node */testAddr).getAttributeNodeNS(
- namespaceURI, localName);
- resultAttr = ((Element) /* Node */testAddr).getAttributeNS(
- namespaceURI, localName);
- assertEquals("attrValue", "newValue", resultAttr);
- resultNamespaceURI = addrAttr.getNamespaceURI();
- assertEquals("nsuri", "http://www.newattr.com", resultNamespaceURI);
- resultLocalName = addrAttr.getLocalName();
- assertEquals("lname", "newAttr", resultLocalName);
- resultPrefix = addrAttr.getPrefix();
- assertEquals("prefix", "emp", resultPrefix);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with NAMESPACE_ERR code.",
- method = "setAttributeNS",
- args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
- )
- public void testSetAttributeNS10() throws Throwable {
- String namespaceURI = "http://www.example.gov";
- Document doc;
- NodeList elementList;
- Node testAddr;
- doc = (Document) load("hc_staff", builder);
- elementList = doc.getElementsByTagName("em");
- testAddr = elementList.item(0);
-
- {
- boolean success = false;
- try {
- ((Element) /* Node */testAddr).setAttributeNS(namespaceURI, "",
- "newValue");
- } catch (DOMException ex) {
- success = (ex.code == DOMException.NAMESPACE_ERR);
- }
- assertTrue("throw_NAMESPACE_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java
deleted file mode 100644
index 3960a4f..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001-2004 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Attr;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "setAttributeNode(newAttr)" method raises an "INUSE_ATTRIBUTE_ERR
- * DOMException if the "newAttr" is already an attribute of another element.
- *
- * Retrieve the first emp:address and append a newly created element. The
- * "createAttributeNS(namespaceURI,qualifiedName)" and
- * "setAttributeNodeNS(newAttr)" methods are invoked to create and add a new
- * attribute to the newly created Element. The "setAttributeNodeNS(newAttr)"
- * method is once again called to add the new attribute causing an exception to
- * be raised since the attribute is already an attribute of another element.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElSetAtNodeNS</a>
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-ElSetAtNodeNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])</a>
- */
-@TestTargetClass(Element.class)
-public final class SetAttributeNodeNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNode1() throws Throwable {
- String namespaceURI = "http://www.newattr.com";
- String qualifiedName = "emp:newAttr";
- Document doc;
- Element newElement;
- Attr newAttr;
- NodeList elementList;
- Node testAddr;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- newElement = doc.createElement("newElement");
- testAddr.appendChild(newElement);
- newAttr = doc.createAttributeNS(namespaceURI, qualifiedName);
- newElement.setAttributeNodeNS(newAttr);
-
- {
- boolean success = false;
- try {
- ((Element) /* Node */testAddr).setAttributeNodeNS(newAttr);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
- }
- assertTrue("throw_INUSE_ATTRIBUTE_ERR", success);
- }
- }
-
-// Assumes validation.
-// public void testSetAttributeNode2() throws Throwable {
-// Document doc;
-// NodeList genderList;
-// Node gender;
-// NodeList genList;
-// Node gen;
-// NodeList gList;
-// Element genElement;
-// Attr newAttr;
-//
-// doc = (Document) load("staffNS", builder);
-//
-// if (!factory.isExpandEntityReferences()) {
-// genderList = doc.getElementsByTagName("gender");
-// gender = genderList.item(2);
-// genList = gender.getChildNodes();
-// gen = genList.item(0);
-// } else {
-// gen = doc.createEntityReference("ent4");
-// }
-//
-// gList = gen.getChildNodes();
-// genElement = (Element) gList.item(0);
-// assertNotNull("notnull", genElement);
-// newAttr = doc.createAttributeNS("www.xyz.com", "emp:local1");
-//
-// {
-// boolean success = false;
-// try {
-// genElement.setAttributeNodeNS(newAttr);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success);
-// }
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNode3() throws Throwable {
- String namespaceURI = "http://www.newattr.com";
- String qualifiedName = "emp:newAttr";
- Document doc;
- NodeList elementList;
- Node testAddr;
- Attr newAttr;
- Attr newAddrAttr;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- newAttr = doc.createAttributeNS(namespaceURI, qualifiedName);
- newAddrAttr = ((Element) /* Node */testAddr)
- .setAttributeNodeNS(newAttr);
- assertNull("throw_Null", newAddrAttr);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Doesn't verify DOMException.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNode4() throws Throwable {
- Document doc;
- NodeList elementList;
- Node testAddr;
- Attr newAttr;
- Attr newAddrAttr;
- String newName;
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("emp:address");
- testAddr = elementList.item(0);
- assertNotNull("empAddrNotNull", testAddr);
- newAttr = doc.createAttributeNS("http://www.nist.gov", "xxx:domestic");
- newAddrAttr = ((Element) /* Node */testAddr)
- .setAttributeNodeNS(newAttr);
- newName = newAddrAttr.getNodeName();
- assertEquals("nodeName", "emp:domestic", newName);
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with WRONG_DOCUMENT_ERR code.",
- method = "setAttributeNodeNS",
- args = {org.w3c.dom.Attr.class}
- )
- public void testSetAttributeNode5() throws Throwable {
- String namespaceURI = "http://www.newattr.com";
- String qualifiedName = "emp:newAttr";
- Document doc1;
- Document doc2;
- Attr newAttr;
- NodeList elementList;
- Node testAddr;
-
- doc1 = (Document) load("staffNS", builder);
- doc2 = (Document) load("staffNS", builder);
- newAttr = doc2.createAttributeNS(namespaceURI, qualifiedName);
- elementList = doc1.getElementsByTagName("emp:address");
- testAddr = elementList.item(0);
-
- {
- boolean success = false;
- try {
- ((Element) /* Node */testAddr).setAttributeNodeNS(newAttr);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
- }
- assertTrue("throw_WRONG_DOCUMENT_ERR", success);
- }
- }
-}
diff --git a/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java
deleted file mode 100644
index ae364ec..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java
+++ /dev/null
@@ -1,248 +0,0 @@
-
-/*
-This Java source file was generated by test-to-java.xsl
-and is a derived work from the source document.
-The source document contained the following notice:
-
-
-
-Copyright (c) 2001 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
-*/
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.DOMException;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "setNamedItemNS(arg)" method for a
- * NamedNodeMap should raise INUSE_ATTRIBUTE_ERR DOMException if
- * arg is an Attr that is already an attribute of another Element object.
- *
- * Retrieve an attr node from the third "address" element whose local name
- * is "domestic" and namespaceURI is "http://www.netzero.com".
- * Invoke method setNamedItemNS(arg) on the map of the first "address" element with
- * arg being the attr node from above. Method should raise
- * INUSE_ATTRIBUTE_ERR DOMException.
-* @author NIST
-* @author Mary Brady
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-258A00AF')/constant[@name='INUSE_ATTRIBUTE_ERR'])</a>
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS</a>
-* @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])">http://www.w3.org/TR/DOM-Level-2-Core/core#xpointer(id('ID-setNamedItemNS')/raises/exception[@name='DOMException']/descr/p[substring-before(.,':')='INUSE_ATTRIBUTE_ERR'])</a>
-*/
-@TestTargetClass(NamedNodeMap.class)
-public final class SetNamedItemNS extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration2());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- * @throws Throwable Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS1() throws Throwable {
- Document doc;
- NodeList elementList;
- Node anotherElement;
- NamedNodeMap anotherMap;
- Node arg;
- Node testAddress;
- NamedNodeMap map;
-
- doc = (Document) load("staffNS", builder);
- elementList = doc.getElementsByTagName("address");
- anotherElement = elementList.item(2);
- anotherMap = anotherElement.getAttributes();
- arg = anotherMap.getNamedItemNS("http://www.netzero.com", "domestic");
- testAddress = elementList.item(0);
- map = testAddress.getAttributes();
-
- {
- boolean success = false;
- try {
- map.setNamedItemNS(arg);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
- }
- assertTrue("throw_INUSE_ATTRIBUTE_ERR", success);
- }
-}
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies DOMException with WRONG_DOCUMENT_ERR code.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS2() throws Throwable {
- String namespaceURI = "http://www.usa.com";
- String qualifiedName = "dmstc:domestic";
- Document doc;
- Document anotherDoc;
- Node arg;
- NodeList elementList;
- Node testAddress;
- NamedNodeMap attributes;
-
- doc = (Document) load("staffNS", builder);
- anotherDoc = (Document) load("staffNS", builder);
- arg = anotherDoc.createAttributeNS(namespaceURI, qualifiedName);
- arg.setNodeValue("Maybe");
- elementList = doc.getElementsByTagName("address");
- testAddress = elementList.item(0);
- attributes = testAddress.getAttributes();
-
- {
- boolean success = false;
- try {
- attributes.setNamedItemNS(arg);
- } catch (DOMException ex) {
- success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
- }
- assertTrue("throw_WRONG_DOCUMENT_ERR", success);
- }
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive fnctionality.",
- method = "getNamedItemNS",
- args = {java.lang.String.class, java.lang.String.class}
- )
- public void testSetNamedItemNS3() throws Throwable {
- String namespaceURI = "http://www.nist.gov";
- String qualifiedName = "prefix:newAttr";
- Document doc;
- Node arg;
- NodeList elementList;
- Node testAddress;
- NamedNodeMap attributes;
- Node retnode;
- String value;
-
- doc = (Document) load("staffNS", builder);
- arg = doc.createAttributeNS(namespaceURI, qualifiedName);
- arg.setNodeValue("newValue");
- elementList = doc.getElementsByTagName("address");
- testAddress = elementList.item(0);
- attributes = testAddress.getAttributes();
- attributes.setNamedItemNS(arg);
- retnode = attributes.getNamedItemNS(namespaceURI, "newAttr");
- value = retnode.getNodeValue();
- assertEquals("throw_Equals", "newValue", value);
- }
-
-// Assumes validation.
-// public void testSetNamedItemNS4() throws Throwable {
-// String namespaceURI = "http://www.w3.org/2000/xmlns/";
-// String localName = "local1";
-// Document doc;
-// NodeList elementList;
-// Node testAddress;
-// NodeList nList;
-// Node child;
-// NodeList n2List;
-// Node child2;
-// NamedNodeMap attributes;
-// Node arg;
-//
-// int nodeType;
-// doc = (Document) load("staffNS", builder);
-// elementList = doc.getElementsByTagName("gender");
-// testAddress = elementList.item(2);
-// nList = testAddress.getChildNodes();
-// child = nList.item(0);
-// nodeType = (int) child.getNodeType();
-//
-// if (1 == nodeType) {
-// child = doc.createEntityReference("ent4");
-// assertNotNull("createdEntRefNotNull", child);
-// }
-// n2List = child.getChildNodes();
-// child2 = n2List.item(0);
-// assertNotNull("notnull", child2);
-// attributes = child2.getAttributes();
-// arg = attributes.getNamedItemNS(namespaceURI, localName);
-//
-// {
-// boolean success = false;
-// try {
-// attributes.setNamedItemNS(arg);
-// } catch (DOMException ex) {
-// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
-// }
-// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success);
-// }
-// }
- @TestTargetNew(
- level = TestLevel.PARTIAL_COMPLETE,
- notes = "Verifies positive fnctionality.",
- method = "setNamedItemNS",
- args = {org.w3c.dom.Node.class}
- )
- public void testSetNamedItemNS5() throws Throwable {
- String namespaceURI = "http://www.usa.com";
- String qualifiedName = "dmstc:domestic";
- Document doc;
- Node arg;
- NodeList elementList;
- Node testAddress;
- NamedNodeMap attributes;
- Node retnode;
- String value;
- doc = (Document) load("staffNS", builder);
- arg = doc.createAttributeNS(namespaceURI, qualifiedName);
- arg.setNodeValue("newValue");
- elementList = doc.getElementsByTagName("address");
- testAddress = elementList.item(0);
- attributes = testAddress.getAttributes();
- retnode = attributes.setNamedItemNS(arg);
- value = retnode.getNodeValue();
- assertEquals("throw_Equals", "Yes", value);
- }
-
-}
-
diff --git a/xml/src/test/java/tests/org/w3c/dom/SystemId.java b/xml/src/test/java/tests/org/w3c/dom/SystemId.java
deleted file mode 100644
index 3e1b903..0000000
--- a/xml/src/test/java/tests/org/w3c/dom/SystemId.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- This Java source file was generated by test-to-java.xsl
- and is a derived work from the source document.
- The source document contained the following notice:
-
-
-
- Copyright (c) 2001 World Wide Web Consortium,
- (Massachusetts Institute of Technology, Institut National de
- Recherche en Informatique et en Automatique, Keio University). All
- Rights Reserved. This program is distributed under the W3C's Software
- Intellectual Property License. This program is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE.
-
- See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-
- */
-
-package tests.org.w3c.dom;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Document;
-
-import javax.xml.parsers.DocumentBuilder;
-
-/**
- * The "getSystemId()" method of a documenttype node contains the system
- * identifier associated with the external subset.
- *
- * Retrieve the documenttype. Apply the "getSystemId()" method. The string
- * "staffNS.dtd" should be returned.
- *
- * @author NIST
- * @author Mary Brady
- * @see <a
- * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId</a>
- */
-@TestTargetClass(DocumentType.class)
-public final class SystemId extends DOMTestCase {
-
- DOMDocumentBuilderFactory factory;
-
- DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- super.setUp();
- try {
- factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
- .getConfiguration1());
- builder = factory.getBuilder();
- } catch (Exception e) {
- fail("Unexpected exception" + e.getMessage());
- }
- }
-
- protected void tearDown() throws Exception {
- factory = null;
- builder = null;
- super.tearDown();
- }
-
- /**
- * Runs the test case.
- *
- * @throws Throwable
- * Any uncaught exception causes test to fail
- */
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
- method = "getSystemId",
- args = {}
- )
- public void testGetSystemId() throws Throwable {
- Document doc;
- DocumentType docType;
- String systemId;
-
- doc = (Document) load("staffNS", builder);
- docType = doc.getDoctype();
- systemId = docType.getSystemId();
- assertURIEquals("systemId", null, null, null, "staffNS.dtd", null,
- null, null, null, systemId);
- }
-
-}
diff --git a/xml/src/test/java/tests/xml/AllTests.java b/xml/src/test/java/tests/xml/AllTests.java
deleted file mode 100644
index eefae50..0000000
--- a/xml/src/test/java/tests/xml/AllTests.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.xml;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static Test suite() {
- TestSuite suite = tests.TestSuiteFactory.createTestSuite();
-
- suite.addTestSuite(SimpleParserTest.class);
- suite.addTestSuite(SimpleBuilderTest.class);
-
- //suite.addTest(tests.org.w3c.dom.AllTests.suite());
- suite.addTest(tests.api.javax.xml.parsers.AllTests.suite());
-
- suite.addTest(tests.api.org.xml.sax.AllTests.suite());
-
- return suite;
- }
-
-}
diff --git a/xml/src/test/java/tests/xml/SimpleBuilderTest.java b/xml/src/test/java/tests/xml/SimpleBuilderTest.java
deleted file mode 100644
index 1a555c6..0000000
--- a/xml/src/test/java/tests/xml/SimpleBuilderTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.xml;
-
-import dalvik.annotation.BrokenTest;
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import junit.framework.TestCase;
-
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-@TestTargetClass(DocumentBuilder.class)
-public class SimpleBuilderTest extends TestCase {
-
- private DocumentBuilder builder;
-
- protected void setUp() throws Exception {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- factory.setNamespaceAware(true);
-
- builder = factory.newDocumentBuilder();
- }
-
- protected void tearDown() throws Exception {
- builder = null;
- }
-
- private String getTextContent(Node node) {
- String result = (node instanceof Text ? ((Text) node).getData() : "");
-
- Node child = node.getFirstChild();
- while (child != null) {
- result = result + getTextContent(child);
- child = child.getNextSibling();
- }
-
- return result;
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Regression test.",
- method = "parse",
- args = {java.io.InputStream.class}
- )
- public void testGoodFile1() throws Exception {
- Document document = builder.parse(getClass().getResourceAsStream(
- "/SimpleBuilderTest.xml"));
-
- Element root = document.getDocumentElement();
- assertNotNull(root);
- assertEquals("http://www.foo.bar", root.getNamespaceURI());
- assertEquals("t", root.getPrefix());
- assertEquals("stuff", root.getLocalName());
-
- NodeList list = root.getElementsByTagName("nestedStuff");
- assertNotNull(list);
- assertEquals(list.getLength(), 4);
-
- Element one = (Element) list.item(0);
- Element two = (Element) list.item(1);
- Element three = (Element) list.item(2);
- Element four = (Element) list.item(3);
-
- assertEquals("This space intentionally left blank.",
- getTextContent(one));
- assertEquals("Nothing to see here - please get along!",
- getTextContent(two));
- assertEquals("Rent this space!", getTextContent(three));
- assertEquals("", getTextContent(four));
-
- assertEquals("eins", one.getAttribute("one"));
- assertEquals("zwei", two.getAttribute("two"));
- assertEquals("drei", three.getAttribute("three"));
-
- assertEquals("vier", four.getAttribute("t:four"));
- assertEquals("vier", four.getAttributeNS("http://www.foo.bar", "four"));
-
- list = document.getChildNodes();
- assertNotNull(list);
-
- String proinst = "";
- String comment = "";
-
- for (int i = 0; i < list.getLength(); i++) {
- Node node = list.item(i);
-
- if (node instanceof ProcessingInstruction) {
- proinst = proinst + node.getNodeValue();
- } else if (node instanceof Comment) {
- comment = comment + node.getNodeValue();
- }
- }
-
- assertEquals("The quick brown fox jumps over the lazy dog.", proinst);
- assertEquals(" Fragile! Handle me with care! ", comment);
- }
- @TestTargetNew(
- level = TestLevel.ADDITIONAL,
- method = "!todo parse",
- args = {java.io.InputStream.class}
- )
- @BrokenTest("Doesn't verify anything.")
- public void testGoodFile2() throws Exception {
- Document document = builder.parse(getClass().getResourceAsStream(
- "/staffNS.xml"));
-
- Element root = document.getDocumentElement();
- assertNotNull(root);
-
- // dump("", root);
- }
-
- private void dump(String prefix, Element element) {
- System.out.print(prefix + "<" + element.getTagName());
-
- NamedNodeMap attrs = element.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- Node item = attrs.item(i);
- System.out.print(" " + item.getNodeName() + "=" + item.getNodeValue());
- }
-
- System.out.println(">");
-
- NodeList children = element.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node item = children.item(i);
- if (item instanceof Element) {
- dump(prefix + " ", (Element)item);
- }
- }
-
- System.out.println(prefix + "</" + element.getTagName() + ">");
- }
-}
diff --git a/xml/src/test/java/tests/xml/SimpleParserTest.java b/xml/src/test/java/tests/xml/SimpleParserTest.java
deleted file mode 100644
index 4651039..0000000
--- a/xml/src/test/java/tests/xml/SimpleParserTest.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package tests.xml;
-
-import dalvik.annotation.TestTargets;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetNew;
-import dalvik.annotation.TestTargetClass;
-
-import junit.framework.TestCase;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-@TestTargetClass(SAXParser.class)
-public class SimpleParserTest extends TestCase implements ContentHandler {
-
- private SAXParser parser;
-
- private StringBuffer instructions;
-
- private Map<String, String> namespaces1;
- private Map<String, String> namespaces2;
-
- private StringBuffer elements1;
- private StringBuffer elements2;
-
- private Map<String, String> attributes1;
- private Map<String, String> attributes2;
-
- private StringBuffer text;
-
- @Override
- protected void setUp() throws Exception {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setValidating(false);
- factory.setNamespaceAware(true);
-
- parser = factory.newSAXParser();
- parser.getXMLReader().setContentHandler(this);
-
- instructions = new StringBuffer();
- namespaces1 = new HashMap<String, String>();
- namespaces2 = new HashMap<String, String>();
- elements1 = new StringBuffer();
- elements2 = new StringBuffer();
- attributes1 = new HashMap<String, String>();
- attributes2 = new HashMap<String, String>();
- text = new StringBuffer();
- }
-
- @Override
- protected void tearDown() throws Exception {
- instructions = null;
- parser = null;
- namespaces1 = null;
- namespaces2 = null;
- attributes1 = null;
- attributes2 = null;
- elements1 = null;
- elements2 = null;
- text = null;
- }
-
- public void characters(char[] ch, int start, int length) {
-
- String s = new String(ch, start, length).trim();
- if (s.length() != 0) {
- if (text.length() != 0) {
- text.append(",");
- }
-
- text.append(s);
- }
- }
-
- public void endDocument() {
- }
-
- public void endElement(String uri, String localName, String qName) {
- }
-
- public void endPrefixMapping(String prefix) {
- }
-
- public void ignorableWhitespace(char[] ch, int start, int length) {
- }
-
- public void processingInstruction(String target, String data) {
- String s = target + ":" + data;
-
- if (instructions.length() != 0) {
- instructions.append(",");
- }
-
- instructions.append(s);
- }
-
- public void setDocumentLocator(Locator locator) {
- }
-
- public void skippedEntity(String name) {
- }
-
- public void startDocument() {
- }
-
- public void startElement(String uri, String localName, String qName,
- Attributes atts) {
-
- if (elements1.length() != 0) {
- elements1.append(",");
- }
-
- elements1.append(localName);
-
- if (!"".equals(uri)) {
- namespaces1.put(localName, uri);
- }
-
- for (int i = 0; i < atts.getLength(); i++) {
- attributes1.put(atts.getLocalName(i), atts.getValue(i));
- }
-
- if (elements2.length() != 0) {
- elements2.append(",");
- }
-
- elements2.append(qName);
-
- if (!"".equals(uri)) {
- namespaces2.put(qName, uri);
- }
-
- for (int i = 0; i < atts.getLength(); i++) {
- attributes2.put(atts.getQName(i), atts.getValue(i));
- }
- }
-
- public void startPrefixMapping(String prefix, String uri) {
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class}
- )
- public void testWorkingFile1() throws Exception {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setValidating(false);
- factory.setNamespaceAware(true);
-
- SAXParser parser = factory.newSAXParser();
- parser.getXMLReader().setContentHandler(this);
-
- parser.parse(getClass().getResourceAsStream("/SimpleParserTest.xml"),
- (DefaultHandler) null);
-
- assertEquals("The:quick,brown:fox", instructions.toString());
-
- assertEquals("stuff,nestedStuff,nestedStuff,nestedStuff", elements1
- .toString());
-
- assertEquals("Some text here,some more here...", text.toString());
-
- assertEquals("eins", attributes1.get("one"));
- assertEquals("zwei", attributes1.get("two"));
- assertEquals("drei", attributes1.get("three"));
-
- assertEquals("http://www.foobar.org", namespaces1.get("stuff"));
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class}
- )
- public void testWorkingFile2() throws Exception {
- SAXParserFactory factory = SAXParserFactory.newInstance();
-
- factory.setValidating(false);
- factory.setNamespaceAware(false);
- factory.setFeature("http://xml.org/sax/features/namespace-prefixes",
- true);
-
- SAXParser parser = factory.newSAXParser();
- parser.getXMLReader().setContentHandler(this);
- parser.parse(getClass().getResourceAsStream("/SimpleParserTest.xml"),
- (DefaultHandler) null);
-
- assertFalse(parser.isNamespaceAware());
-
- assertEquals("The:quick,brown:fox", instructions.toString());
-
- assertEquals("t:stuff,nestedStuff,nestedStuff,nestedStuff", elements2
- .toString());
-
- assertEquals("Some text here,some more here...", text.toString());
-
- assertEquals("eins", attributes2.get("one"));
- assertEquals("zwei", attributes2.get("two"));
- assertEquals("drei", attributes2.get("three"));
-
- assertEquals(0, namespaces2.size());
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify exceptions.",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class}
- )
- public void testEntityResolver() throws Exception {
- final StringBuilder text = new StringBuilder();
- DefaultHandler handler = new DefaultHandler() {
- public void characters(char[] ch, int start, int length) {
- String s = new String(ch, start, length).trim();
- if (s.length() != 0) {
- if (text.length() != 0) {
- text.append(",");
- }
- text.append(s);
- }
- }
-
- public InputSource resolveEntity(String publicId, String systemId)
- throws IOException, SAXException {
- return new InputSource(new InputStreamReader(
- new ByteArrayInputStream("test".getBytes())));
- }
- };
-
- SAXParserFactory spf = SAXParserFactory.newInstance();
- spf.setValidating(false);
- parser = spf.newSAXParser();
- parser.parse(this.getClass().getResourceAsStream("/staffEntRes.xml"),
- handler);
- assertTrue(
- "resolved external entity must be in parser character stream",
- text.toString().contains("test"));
- }
- @TestTargetNew(
- level = TestLevel.PARTIAL,
- notes = "Doesn't verify exceptions.",
- method = "parse",
- args = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class}
- )
- public void testGetValue() throws Exception{
- parser.parse(getClass().getResourceAsStream("/staffNS.xml"),
- new DefaultHandler() {
- boolean firstAddressElem = true;
- @Override
- public void startElement (String uri, String localName,
- String qName, Attributes attributes) {
- if(firstAddressElem && localName.equals("address")) {
- firstAddressElem = false;
- assertNotNull(attributes.getValue("http://www.usa.com",
- "domestic"));
- }
- }
- });
- }
-}
diff --git a/xml/src/test/resources/SimpleBuilderTest.xml b/xml/src/test/resources/SimpleBuilderTest.xml
deleted file mode 100644
index 23edce7..0000000
--- a/xml/src/test/resources/SimpleBuilderTest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- Fragile! -->
-
-<!-- Handle me with care! -->
-
-<?cmd The quick brown fox ?>
-
-<t:stuff xmlns:t="http://www.foo.bar" xmlns:u="http://www.bar.foo">
-
- <nestedStuff one="eins">This space intentionally left blank.</nestedStuff>
-
- <nestedStuff two="zwei">Nothing to see here - please get along!</nestedStuff>
-
- <nestedStuff three="drei" title="">Rent this space!</nestedStuff>
-
- <nestedStuff t:four="vier"/>
-
-</t:stuff>
-
-<?cmd jumps over the lazy dog.?>
diff --git a/xml/src/test/resources/SimpleParserTest.xml b/xml/src/test/resources/SimpleParserTest.xml
deleted file mode 100644
index e18bf3e..0000000
--- a/xml/src/test/resources/SimpleParserTest.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- This space intentionally left blank. -->
-
-<?The quick?>
-
-<t:stuff xmlns:t="http://www.foobar.org">
-
- <nestedStuff one="eins"> Some text here </nestedStuff>
-
- <nestedStuff two="zwei"></nestedStuff>
-
- some more here...
-
- <nestedStuff three="drei" />
-
-</t:stuff>
-
-<?brown fox?>
diff --git a/xml/src/test/resources/hc_staff.xml b/xml/src/test/resources/hc_staff.xml
deleted file mode 100644
index 2df9a74..0000000
--- a/xml/src/test/resources/hc_staff.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "xhtml1-strict.dtd" [
- <!ENTITY alpha "&#945;">
- <!ENTITY beta "&#946;">
- <!ENTITY gamma "&#947;">
- <!ENTITY delta "&#948;">
- <!ENTITY epsilon "&#949;">
- <!ENTITY alpha "&#950;">
- <!NOTATION notation1 PUBLIC "notation1File">
- <!NOTATION notation2 SYSTEM "notation2File">
- <!ATTLIST acronym dir CDATA "ltr">
-]>
-<!-- This is comment number 1.-->
-<html xmlns='http://www.w3.org/1999/xhtml'><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>hc_staff</title><script type="text/javascript" src="svgunit.js"/><script charset="UTF-8" type="text/javascript" src="svgtest.js"/><script type='text/javascript'>function loadComplete() { startTest(); }</script></head><body onload="parent.loadComplete()">
- <p>
- <em>EMP0001</em>
- <strong>Margaret Martin</strong>
- <code>Accountant</code>
- <sup>56,000</sup>
- <var>Female</var>
- <acronym title="Yes">1230 North Ave. Dallas, Texas 98551</acronym>
- </p>
- <p>
- <em>EMP0002</em>
- <strong>Martha RaynoldsThis is a CDATASection with EntityReference number 2 &amp;ent2;
-This is an adjacent CDATASection with a reference to a tab &amp;tab;</strong>
- <code>Secretary</code>
- <sup>35,000</sup>
- <var>Female</var>
- <acronym title="Yes" class="Yes">&beta; Dallas, &gamma;
- 98554</acronym>
- </p>
- <p>
- <em>EMP0003</em>
- <strong>Roger
- Jones</strong>
- <code>Department Manager</code>
- <sup>100,000</sup>
- <var>&delta;</var>
- <acronym title="Yes" class="No">PO Box 27 Irving, texas 98553</acronym>
- </p>
- <p>
- <em>EMP0004</em>
- <strong>Jeny Oconnor</strong>
- <code>Personnel Director</code>
- <sup>95,000</sup>
- <var>Female</var>
- <acronym title="Yes" class="Y&alpha;">27 South Road. Dallas, Texas 98556</acronym>
- </p>
- <p>
- <em>EMP0005</em>
- <strong>Robert Myers</strong>
- <code>Computer Specialist</code>
- <sup>90,000</sup>
- <var>male</var>
- <acronym title="Yes">1821 Nordic. Road, Irving Texas 98558</acronym>
- </p>
-</body></html>
diff --git a/xml/src/test/resources/nwf/staff.dtd b/xml/src/test/resources/nwf/staff.dtd
deleted file mode 100644
index 02a994d..0000000
--- a/xml/src/test/resources/nwf/staff.dtd
+++ /dev/null
@@ -1,17 +0,0 @@
-<!ELEMENT employeeId (#PCDATA)>
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT position (#PCDATA)>
-<!ELEMENT salary (#PCDATA)>
-<!ELEMENT address (#PCDATA)>
-<!ELEMENT entElement ( #PCDATA ) >
-<!ELEMENT gender ( #PCDATA | entElement )* >
-<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
-<!ELEMENT staff (employee)+>
-<!ATTLIST entElement
- attr1 CDATA "Attr">
-<!ATTLIST address
- domestic CDATA #IMPLIED
- street CDATA "Yes">
-<!ATTLIST entElement
- domestic CDATA "MALE" >
-
diff --git a/xml/src/test/resources/nwf/staff.xml b/xml/src/test/resources/nwf/staff.xml
deleted file mode 100644
index b600fcf..0000000
--- a/xml/src/test/resources/nwf/staff.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE staff SYSTEM "staff.dtd" [
- <!ENTITY ent1 "es">
- <!ENTITY ent2 "1900 Dallas Road">
- <!ENTITY ent3 "Texas">
- <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>">
- <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
- <!ENTITY ent1 "This entity should be discarded">
- <!NOTATION notation1 PUBLIC "notation1File">
- <!NOTATION notation2 SYSTEM "notation2File">
-]>
-<!-- This is comment number 1.-->
-<staff>
- <employee22>
- <employeeId>EMP0001</employeeId>
- <name>Margaret Martin</name>
- <position>Accountant</position>
- <salary>56,000</salary>
- <gender>Female</gender>
- <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
- </employee>
- <employee>
- <employeeId>EMP0002</employeeId>
- <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
-<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
- <position>Secretary</position>
- <salary>35,000</salary>
- <gender>Female</gender>
- <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
- 98554</address>
- </employee>
- <employee>
- <employeeId>EMP0003</employeeId>
- <name>Roger
- Jones</name>
- <position>Department Manager</position>
- <salary>100,000</salary>
- <gender>&ent4;</gender>
- <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
- </employee>
- <employee>
- <employeeId>EMP0004</employeeId>
- <name>Jeny Oconnor</name>
- <position>Personnel Director</position>
- <salary>95,000</salary>
- <gender>Female</gender>
- <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address>
- </employee>
- <employee>
- <employeeId>EMP0005</employeeId>
- <name>Robert Myers</name>
- <position>Computer Specialist</position>
- <salary>90,000</salary>
- <gender>male</gender>
- <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address>
- </employee>
- </staff>
diff --git a/xml/src/test/resources/out_dh/staff.out b/xml/src/test/resources/out_dh/staff.out
deleted file mode 100644
index 467fd08..0000000
--- a/xml/src/test/resources/out_dh/staff.out
+++ /dev/null
@@ -1,45 +0,0 @@
-true^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^#true^#
-
- EMP0001
- Margaret Martin
- Accountant
- 56,000
- Female
- 1230 North Ave. Dallas, Texas 98551
-
-
- EMP0002
- Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2;
-This is an adjacent CDATASection with a reference to a tab &tab;
- Secretary
- 35,000
- Female
- 1900 Dallas Road Dallas, Texas
- 98554
-
-
- EMP0003
- Roger
- Jones
- Department Manager
- 100,000
- Element data
- PO Box 27 Irving, texas 98553
-
-
- EMP0004
- Jeny Oconnor
- Personnel Director
- 95,000
- Female
- 27 South Road. Dallas, Texas 98556
-
-
- EMP0005
- Robert Myers
- Computer Specialist
- 90,000
- male
- 1821 Nordic. Road, Irving Texas 98558
-
- ####$employeeId$employeeId^$name$name^$position$position^$salary$salary^$gender$gender^$address$address^$employee$employee^$employeeId$employeeId^$name$name^$position$position^$salary$salary^$gender$gender^$address$address^$employee$employee^$employeeId$employeeId^$name$name^$position$position^$salary$salary^$entElement$entElement^$gender$gender^$address$address^$employee$employee^$employeeId$employeeId^$name$name^$position$position^$salary$salary^$gender$gender^$address$address^$employee$employee^$employeeId$employeeId^$name$name^$position$position^$salary$salary^$gender$gender^$address$address^$employee$employee^$staff$staff^##TEST-STYLE$PIDATA^PItarget$PIdata^##$staff$staff$employee$employee$employeeId$employeeId$name$name$position$position$salary$salary$gender$gender$address$address$domestic$Yes$employee$employee$employeeId$employeeId$name$name$position$position$salary$salary$gender$gender$address$address$domestic$Yes$street$Yes$employee$employee$employeeId$employeeId$name$name$position$position$salary$salary$gender$gender$entElement$entElement$domestic$Yes$address$address$domestic$Yes$street$No$employee$employee$employeeId$employeeId$name$name$position$position$salary$salary$gender$gender$address$address$domestic$Yes$street$Yes$employee$employee$employeeId$employeeId$name$name$position$position$salary$salary$gender$gender$address$address$street$Yes##
diff --git a/xml/src/test/resources/out_hb/staff.out b/xml/src/test/resources/out_hb/staff.out
deleted file mode 100644
index c6d61ad..0000000
--- a/xml/src/test/resources/out_hb/staff.out
+++ /dev/null
@@ -1,45 +0,0 @@
-true^#true^#
-
- EMP0001
- Margaret Martin
- Accountant
- 56,000
- Female
- 1230 North Ave. Dallas, Texas 98551
-
-
- EMP0002
- Martha RaynoldsThis is a CDATASection with EntityReference number 2 &ent2;
-This is an adjacent CDATASection with a reference to a tab &tab;
- Secretary
- 35,000
- Female
- 1900 Dallas Road Dallas, Texas
- 98554
-
-
- EMP0003
- Roger
- Jones
- Department Manager
- 100,000
- Element data
- PO Box 27 Irving, texas 98553
-
-
- EMP0004
- Jeny Oconnor
- Personnel Director
- 95,000
- Female
- 27 South Road. Dallas, Texas 98556
-
-
- EMP0005
- Robert Myers
- Computer Specialist
- 90,000
- male
- 1821 Nordic. Road, Irving Texas 98558
-
- ######TEST-STYLE$PIDATA^PItarget$PIdata^####
diff --git a/xml/src/test/resources/recipe.xml b/xml/src/test/resources/recipe.xml
deleted file mode 100644
index d7cf0fb..0000000
--- a/xml/src/test/resources/recipe.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE collection SYSTEM "./recipt.dtd">
-<!--comment1 -->
-<collection>
- <description>
- Some recipes used for the XML tutorial.
- </description>
- <recipe>
- <title>Beef Parmesan<![CDATA[<title> with Garlic Angel Hair Pasta</title>]]></title>
- <ingredient name="beef cube steak" amount="1.5" unit="pound"/>
- <preparation>
- <step>
- Preheat oven to 350 degrees F (175 degrees C).
- </step>
- </preparation>
- <comment>
- Make the meat ahead of time, and refrigerate over night, the acid in the
- tomato sauce will tenderize the meat even more. If you do this, save the
- mozzarella till the last minute.
- </comment>
- <nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
- </recipe>
-</collection>
-<!--comment2 -->
diff --git a/xml/src/test/resources/recipe1.xml b/xml/src/test/resources/recipe1.xml
deleted file mode 100644
index d7cf0fb..0000000
--- a/xml/src/test/resources/recipe1.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE collection SYSTEM "./recipt.dtd">
-<!--comment1 -->
-<collection>
- <description>
- Some recipes used for the XML tutorial.
- </description>
- <recipe>
- <title>Beef Parmesan<![CDATA[<title> with Garlic Angel Hair Pasta</title>]]></title>
- <ingredient name="beef cube steak" amount="1.5" unit="pound"/>
- <preparation>
- <step>
- Preheat oven to 350 degrees F (175 degrees C).
- </step>
- </preparation>
- <comment>
- Make the meat ahead of time, and refrigerate over night, the acid in the
- tomato sauce will tenderize the meat even more. If you do this, save the
- mozzarella till the last minute.
- </comment>
- <nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
- </recipe>
-</collection>
-<!--comment2 -->
diff --git a/xml/src/test/resources/recipt.dtd b/xml/src/test/resources/recipt.dtd
deleted file mode 100644
index 370112c..0000000
--- a/xml/src/test/resources/recipt.dtd
+++ /dev/null
@@ -1,17 +0,0 @@
-<!ELEMENT collection (description,recipe+)>
-<!ELEMENT description ANY>
-<!ELEMENT recipe (title,ingredient*,preparation,comment?,nutrition)>
-<!ELEMENT title (#PCDATA)>
-<!ELEMENT ingredient (ingredient*,preparation)?>
-<!ATTLIST ingredient name CDATA #REQUIRED
- amount CDATA #IMPLIED
- unit CDATA #IMPLIED>
-<!ELEMENT preparation (step*)>
-<!ELEMENT step (#PCDATA)>
-<!ELEMENT comment (#PCDATA)>
-<!ELEMENT nutrition EMPTY>
-<!ATTLIST nutrition protein CDATA #REQUIRED
- carbohydrates CDATA #REQUIRED
- fat CDATA #REQUIRED
- calories CDATA #REQUIRED
- alcohol CDATA #IMPLIED>
diff --git a/xml/src/test/resources/recipt.xml b/xml/src/test/resources/recipt.xml
deleted file mode 100644
index d7cf0fb..0000000
--- a/xml/src/test/resources/recipt.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE collection SYSTEM "./recipt.dtd">
-<!--comment1 -->
-<collection>
- <description>
- Some recipes used for the XML tutorial.
- </description>
- <recipe>
- <title>Beef Parmesan<![CDATA[<title> with Garlic Angel Hair Pasta</title>]]></title>
- <ingredient name="beef cube steak" amount="1.5" unit="pound"/>
- <preparation>
- <step>
- Preheat oven to 350 degrees F (175 degrees C).
- </step>
- </preparation>
- <comment>
- Make the meat ahead of time, and refrigerate over night, the acid in the
- tomato sauce will tenderize the meat even more. If you do this, save the
- mozzarella till the last minute.
- </comment>
- <nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
- </recipe>
-</collection>
-<!--comment2 -->
diff --git a/xml/src/test/resources/reciptWrong.xml b/xml/src/test/resources/reciptWrong.xml
deleted file mode 100644
index ce32d09..0000000
--- a/xml/src/test/resources/reciptWrong.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE collection SYSTEM "./recipt.dtd">
-<!--comment1 -->
-<collection>
- <recipe>
- <title>Beef Parmesan<![CDATA[<title> with Garlic Angel Hair Pasta</title>]]></title>
- <ingredient name="beef cube steak" amount="1.5" unit="pound"/>
- <preparation>
- <step>
- Preheat oven to 350 degrees F (175 degrees C).
- </step>
- </preparation>
- <comment>
- Make the meat ahead of time, and refrigerate over night, the acid in the
- tomato sauce will tenderize the meat even more. If you do this, save the
- mozzarella till the last minute.
- </comment>
- <nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
- </recipe>
-</collection>
-<!--comment2 -->
diff --git a/xml/src/test/resources/simple.xml b/xml/src/test/resources/simple.xml
deleted file mode 100644
index de39181..0000000
--- a/xml/src/test/resources/simple.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!-- Edited with XML Spy v2007 (http://www.altova.com) -->
-<breakfast_menu>
- <food>
- <name>Belgian Waffles</name>
- <price>$5.95</price>
- <description>two of our famous Belgian Waffles with plenty of real maple syrup</description>
- <calories>650</calories>
- </food>
- <food>
- <name>Strawberry Belgian Waffles</name>
- <price>$7.95</price>
- <description>light Belgian waffles covered with strawberries and whipped cream</description>
- <calories>900</calories>
- </food>
- <food>
- <name>Berry-Berry Belgian Waffles</name>
- <price>$8.95</price>
- <description>light Belgian waffles covered with an assortment of fresh berries and whipped cream</description>
- <calories>900</calories>
- </food>
- <food>
- <name>French Toast</name>
- <price>$4.50</price>
- <description>thick slices made from our homemade sourdough bread</description>
- <calories>600</calories>
- </food>
- <food>
- <name>Homestyle Breakfast</name>
- <price>$6.95</price>
- <description>two eggs, bacon or sausage, toast, and our ever-popular hash browns</description>
- <calories>950</calories>
- </food>
-</breakfast_menu>
diff --git a/xml/src/test/resources/simple_ns.dtd b/xml/src/test/resources/simple_ns.dtd
deleted file mode 100644
index 7643773..0000000
--- a/xml/src/test/resources/simple_ns.dtd
+++ /dev/null
@@ -1,45 +0,0 @@
-<!ELEMENT staff (employee+,emp:employee,employee) >
-<!ELEMENT employee (employeeId,name,position,salary,gender,address) >
-<!ATTLIST employee xmlns CDATA #IMPLIED>
-<!ATTLIST employee xmlns:dmstc CDATA #IMPLIED>
-<!ATTLIST employee xmlns:emp2 CDATA #IMPLIED>
-
-<!ELEMENT employeeId (#PCDATA) >
-
-<!ELEMENT name (#PCDATA) >
-
-<!ELEMENT position (#PCDATA) >
-
-<!ELEMENT salary (#PCDATA) >
-
-<!ELEMENT entElement1 (#PCDATA) >
-<!ELEMENT gender (#PCDATA | entElement1)* >
-<!ATTLIST entElement1 xmlns:local1 CDATA #IMPLIED >
-
-<!ELEMENT address (#PCDATA) >
-<!ATTLIST address dmstc:domestic CDATA #IMPLIED>
-<!ATTLIST address street CDATA #IMPLIED>
-<!ATTLIST address domestic CDATA #IMPLIED>
-<!ATTLIST address xmlns CDATA #IMPLIED>
-
-<!ELEMENT emp:employee (emp:employeeId,nm:name,emp:position,emp:salary,emp:gender,emp:address) >
-<!ATTLIST emp:employee xmlns:emp CDATA #IMPLIED>
-<!ATTLIST emp:employee xmlns:nm CDATA #IMPLIED>
-<!ATTLIST emp:employee defaultAttr CDATA 'defaultVal'>
-
-<!ELEMENT emp:employeeId (#PCDATA) >
-
-<!ELEMENT nm:name (#PCDATA) >
-
-<!ELEMENT emp:position (#PCDATA) >
-
-<!ELEMENT emp:salary (#PCDATA) >
-
-<!ELEMENT emp:gender (#PCDATA) >
-
-<!ELEMENT emp:address (#PCDATA) >
-<!ATTLIST emp:address emp:domestic CDATA #IMPLIED>
-<!ATTLIST emp:address street CDATA #IMPLIED>
-<!ATTLIST emp:address emp:zone ID #IMPLIED>
-<!ATTLIST emp:address emp:district CDATA 'DISTRICT'>
-<!ATTLIST emp:address emp:local1 CDATA 'FALSE'>
diff --git a/xml/src/test/resources/simple_ns.xml b/xml/src/test/resources/simple_ns.xml
deleted file mode 100644
index a5dc4a3..0000000
--- a/xml/src/test/resources/simple_ns.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE staff PUBLIC "STAFF" "simple_ns.dtd"
-[
- <!ENTITY ent1 "es">
- <!ENTITY ent2 "1900 Dallas Road">
- <!ENTITY ent3 "Texas">
- <!ENTITY ent4 "<entElement1 xmlns:local1='www.xyz.com'>Element data</entElement1><?PItarget PIdata?>">
- <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
- <!ENTITY ent6 PUBLIC "uri" "file" NDATA notation2>
- <!ENTITY ent1 "This entity should be discarded">
- <!NOTATION notation1 PUBLIC "notation1File">
- <!NOTATION notation2 SYSTEM "notation2File">
-]>
-<!-- This is comment number 1.-->
-<staff>
- <employee xmlns="http://www.nist.gov" xmlns:dmstc="http://www.usa.com">
- <employeeId>EMP0001</employeeId>
- <name>Margaret Martin</name>
- <position>Accountant</position>
- <salary>56,000</salary>
- <gender>Female</gender>
- <address dmstc:domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
- </employee>
- <employee xmlns:dmstc="http://www.usa.com">
- <employeeId>EMP0002</employeeId>
- <name>Martha Raynolds
-<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
-<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
- <position>Secretary</position>
- <salary>35,000</salary>
- <gender>Female</gender>
- <address dmstc:domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
- 98554</address>
- </employee>
- <employee xmlns:dmstc="http://www.netzero.com">
- <employeeId>EMP0003</employeeId>
- <name>Roger
- Jones</name>
- <position>Department Manager</position>
- <salary>100,000</salary>
- <gender>&ent4;</gender>
- <address dmstc:domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
- </employee>
- <emp:employee xmlns:emp="http://www.nist.gov" xmlns:nm="http://www.altavista.com" > <emp:employeeId>EMP0004</emp:employeeId>
- <nm:name>Jeny Oconnor</nm:name>
- <emp:position>Personnel Director</emp:position>
- <emp:salary>95,000</emp:salary>
- <emp:gender>Female</emp:gender>
- <emp:address emp:domestic="Yes" street="Y&ent1;" emp:zone="CANADA" emp:local1="TRUE">27 South Road. Dallas, texas 98556</emp:address>
- </emp:employee>
- <employee xmlns:emp2="http://www.nist.gov">
- <employeeId>EMP0005</employeeId>
- <name>Robert Myers</name>
- <position>Computer Specialist</position>
- <salary>90,000</salary>
- <gender>male</gender>
- <address street="Yes" xmlns="http://www.nist.gov">1821 Nordic. Road, Irving Texas 98558</address>
- </employee>
- </staff>
diff --git a/xml/src/test/resources/staff.dtd b/xml/src/test/resources/staff.dtd
deleted file mode 100644
index 02a994d..0000000
--- a/xml/src/test/resources/staff.dtd
+++ /dev/null
@@ -1,17 +0,0 @@
-<!ELEMENT employeeId (#PCDATA)>
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT position (#PCDATA)>
-<!ELEMENT salary (#PCDATA)>
-<!ELEMENT address (#PCDATA)>
-<!ELEMENT entElement ( #PCDATA ) >
-<!ELEMENT gender ( #PCDATA | entElement )* >
-<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
-<!ELEMENT staff (employee)+>
-<!ATTLIST entElement
- attr1 CDATA "Attr">
-<!ATTLIST address
- domestic CDATA #IMPLIED
- street CDATA "Yes">
-<!ATTLIST entElement
- domestic CDATA "MALE" >
-
diff --git a/xml/src/test/resources/staff.xml b/xml/src/test/resources/staff.xml
deleted file mode 100644
index f89c510..0000000
--- a/xml/src/test/resources/staff.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE staff SYSTEM "staff.dtd" [
- <!ENTITY ent1 "es">
- <!ENTITY ent2 "1900 Dallas Road">
- <!ENTITY ent3 "Texas">
- <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>">
- <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
- <!ENTITY ent1 "This entity should be discarded">
- <!NOTATION notation1 PUBLIC "notation1File">
- <!NOTATION notation2 SYSTEM "notation2File">
-]>
-<!-- This is comment number 1.-->
-<staff>
- <employee>
- <employeeId>EMP0001</employeeId>
- <name>Margaret Martin</name>
- <position>Accountant</position>
- <salary>56,000</salary>
- <gender>Female</gender>
- <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
- </employee>
- <employee>
- <employeeId>EMP0002</employeeId>
- <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
-<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
- <position>Secretary</position>
- <salary>35,000</salary>
- <gender>Female</gender>
- <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
- 98554</address>
- </employee>
- <employee>
- <employeeId>EMP0003</employeeId>
- <name>Roger
- Jones</name>
- <position>Department Manager</position>
- <salary>100,000</salary>
- <gender>&ent4;</gender>
- <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
- </employee>
- <employee>
- <employeeId>EMP0004</employeeId>
- <name>Jeny Oconnor</name>
- <position>Personnel Director</position>
- <salary>95,000</salary>
- <gender>Female</gender>
- <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address>
- </employee>
- <employee>
- <employeeId>EMP0005</employeeId>
- <name>Robert Myers</name>
- <position>Computer Specialist</position>
- <salary>90,000</salary>
- <gender>male</gender>
- <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address>
- </employee>
- </staff>
diff --git a/xml/src/test/resources/staff2.dtd b/xml/src/test/resources/staff2.dtd
deleted file mode 100644
index 0bac8f2..0000000
--- a/xml/src/test/resources/staff2.dtd
+++ /dev/null
@@ -1,24 +0,0 @@
-<!ELEMENT employeeId (#PCDATA)>
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT position (#PCDATA)>
-<!ELEMENT salary (#PCDATA)>
-<!ELEMENT address (#PCDATA)>
-<!ELEMENT gender ( #PCDATA)>
-<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
-<!ATTLIST employee xmlns CDATA #IMPLIED>
-<!ELEMENT staff (employee)+>
-<!ELEMENT svg (rect, script, employee+)>
-<!ATTLIST svg
- xmlns CDATA #FIXED "http://www.w3.org/2000/svg"
- name CDATA #IMPLIED>
-<!ELEMENT rect EMPTY>
-<!ATTLIST rect
- x CDATA #REQUIRED
- y CDATA #REQUIRED
- width CDATA #REQUIRED
- height CDATA #REQUIRED>
-<!ELEMENT script (#PCDATA)>
-<!ATTLIST script type CDATA #IMPLIED>
-<!ENTITY svgunit SYSTEM "svgunit.js">
-<!ENTITY svgtest SYSTEM "internalSubset01.js">
-
diff --git a/xml/src/test/resources/staff2.xml b/xml/src/test/resources/staff2.xml
deleted file mode 100644
index d3d9a13..0000000
--- a/xml/src/test/resources/staff2.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE staff SYSTEM "staff2.dtd" []>
-<!-- This is comment number 1.-->
-<staff>
- <employee>
- <employeeId>EMP0001</employeeId>
- <name>Margaret Martin</name>
- <position>Accountant</position>
- <salary>56,000</salary>
- <gender>Female</gender>
- <address>1230 North Ave. Dallas, Texas 98551</address>
- </employee>
- </staff>
diff --git a/xml/src/test/resources/staffEntRes.xml b/xml/src/test/resources/staffEntRes.xml
deleted file mode 100644
index 0c24c83..0000000
--- a/xml/src/test/resources/staffEntRes.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE staff
-[
- <!ENTITY ent1 "es">
- <!ENTITY ent2 "1900 Dallas Road">
- <!ENTITY ent3 "Texas">
- <!ENTITY chap1 SYSTEM "chap1.xml">
- <!ENTITY ent4 "<entElement1 xmlns:local1='www.xyz.com'>Element data</entElement1><?PItarget PIdata?>">
- <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
- <!ENTITY ent6 PUBLIC "uri" "file" NDATA notation2>
- <!ENTITY ent1 "This entity should be discarded">
- <!NOTATION notation1 PUBLIC "notation1File">
- <!NOTATION notation2 SYSTEM "notation2File">
-]>
-<!-- This is comment number 1.-->
-<staff>
- <employee xmlns="http://www.nist.gov" xmlns:dmstc="http://www.usa.com">
- <employeeId>EMP0001</employeeId>
- <name>Margaret Martin</name>
- <position>Accountant</position>
- <salary>56,000</salary>
- <gender>Female</gender>
- <address dmstc:domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
- </employee>
- <employee xmlns:dmstc="http://www.usa.com">
- <employeeId>EMP0002</employeeId>
- <name>Martha Raynolds &chap1;
-<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
-<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
- <position>Secretary</position>
- <salary>35,000</salary>
- <gender>Female</gender>
- <address dmstc:domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
- 98554</address>
- </employee>
- <employee xmlns:dmstc="http://www.netzero.com">
- <employeeId>EMP0003</employeeId>
- <name>Roger
- Jones</name>
- <position>Department Manager</position>
- <salary>100,000</salary>
- <gender>&ent4;</gender>
- <address dmstc:domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
- </employee>
- <emp:employee xmlns:emp="http://www.nist.gov" xmlns:nm="http://www.altavista.com" > <emp:employeeId>EMP0004</emp:employeeId>
- <nm:name>Jeny Oconnor</nm:name>
- <emp:position>Personnel Director</emp:position>
- <emp:salary>95,000</emp:salary>
- <emp:gender>Female</emp:gender>
- <emp:address emp:domestic="Yes" street="Y&ent1;" emp:zone="CANADA" emp:local1="TRUE">27 South Road. Dallas, texas 98556</emp:address>
- </emp:employee>
- <employee xmlns:emp2="http://www.nist.gov">
- <employeeId>EMP0005</employeeId>
- <name>Robert Myers</name>
- <position>Computer Specialist</position>
- <salary>90,000</salary>
- <gender>male</gender>
- <address street="Yes" xmlns="http://www.nist.gov">1821 Nordic. Road, Irving Texas 98558</address>
- </employee>
- </staff>
diff --git a/xml/src/test/resources/staffNS.dtd b/xml/src/test/resources/staffNS.dtd
deleted file mode 100644
index 7643773..0000000
--- a/xml/src/test/resources/staffNS.dtd
+++ /dev/null
@@ -1,45 +0,0 @@
-<!ELEMENT staff (employee+,emp:employee,employee) >
-<!ELEMENT employee (employeeId,name,position,salary,gender,address) >
-<!ATTLIST employee xmlns CDATA #IMPLIED>
-<!ATTLIST employee xmlns:dmstc CDATA #IMPLIED>
-<!ATTLIST employee xmlns:emp2 CDATA #IMPLIED>
-
-<!ELEMENT employeeId (#PCDATA) >
-
-<!ELEMENT name (#PCDATA) >
-
-<!ELEMENT position (#PCDATA) >
-
-<!ELEMENT salary (#PCDATA) >
-
-<!ELEMENT entElement1 (#PCDATA) >
-<!ELEMENT gender (#PCDATA | entElement1)* >
-<!ATTLIST entElement1 xmlns:local1 CDATA #IMPLIED >
-
-<!ELEMENT address (#PCDATA) >
-<!ATTLIST address dmstc:domestic CDATA #IMPLIED>
-<!ATTLIST address street CDATA #IMPLIED>
-<!ATTLIST address domestic CDATA #IMPLIED>
-<!ATTLIST address xmlns CDATA #IMPLIED>
-
-<!ELEMENT emp:employee (emp:employeeId,nm:name,emp:position,emp:salary,emp:gender,emp:address) >
-<!ATTLIST emp:employee xmlns:emp CDATA #IMPLIED>
-<!ATTLIST emp:employee xmlns:nm CDATA #IMPLIED>
-<!ATTLIST emp:employee defaultAttr CDATA 'defaultVal'>
-
-<!ELEMENT emp:employeeId (#PCDATA) >
-
-<!ELEMENT nm:name (#PCDATA) >
-
-<!ELEMENT emp:position (#PCDATA) >
-
-<!ELEMENT emp:salary (#PCDATA) >
-
-<!ELEMENT emp:gender (#PCDATA) >
-
-<!ELEMENT emp:address (#PCDATA) >
-<!ATTLIST emp:address emp:domestic CDATA #IMPLIED>
-<!ATTLIST emp:address street CDATA #IMPLIED>
-<!ATTLIST emp:address emp:zone ID #IMPLIED>
-<!ATTLIST emp:address emp:district CDATA 'DISTRICT'>
-<!ATTLIST emp:address emp:local1 CDATA 'FALSE'>
diff --git a/xml/src/test/resources/staffNS.xml b/xml/src/test/resources/staffNS.xml
deleted file mode 100644
index 1cb1459..0000000
--- a/xml/src/test/resources/staffNS.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE staff PUBLIC "STAFF" "staffNS.dtd"
-[
- <!ENTITY ent1 "es">
- <!ENTITY ent2 "1900 Dallas Road">
- <!ENTITY ent3 "Texas">
- <!ENTITY ent4 "<entElement1 xmlns:local1='www.xyz.com'>Element data</entElement1><?PItarget PIdata?>">
- <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
- <!ENTITY ent6 PUBLIC "uri" "file" NDATA notation2>
- <!ENTITY ent1 "This entity should be discarded">
- <!NOTATION notation1 PUBLIC "notation1File">
- <!NOTATION notation2 SYSTEM "notation2File">
-]>
-<!-- This is comment number 1.-->
-<staff>
- <employee xmlns="http://www.nist.gov" xmlns:dmstc="http://www.usa.com">
- <employeeId>EMP0001</employeeId>
- <name>Margaret Martin</name>
- <position>Accountant</position>
- <salary>56,000</salary>
- <gender>Female</gender>
- <address dmstc:domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
- </employee>
- <employee xmlns:dmstc="http://www.usa.com">
- <employeeId>EMP0002</employeeId>
- <name>Martha Raynolds
-<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
-<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
- <position>Secretary</position>
- <salary>35,000</salary>
- <gender>Female</gender>
- <address dmstc:domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
- 98554</address>
- </employee>
- <employee xmlns:dmstc="http://www.netzero.com">
- <employeeId>EMP0003</employeeId>
- <name>Roger
- Jones</name>
- <position>Department Manager</position>
- <salary>100,000</salary>
- <gender>&ent4;</gender>
- <address dmstc:domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
- </employee>
- <emp:employee xmlns:emp="http://www.nist.gov" xmlns:nm="http://www.altavista.com" > <emp:employeeId>EMP0004</emp:employeeId>
- <nm:name>Jeny Oconnor</nm:name>
- <emp:position>Personnel Director</emp:position>
- <emp:salary>95,000</emp:salary>
- <emp:gender>Female</emp:gender>
- <emp:address emp:domestic="Yes" street="Y&ent1;" emp:zone="CANADA" emp:local1="TRUE">27 South Road. Dallas, texas 98556</emp:address>
- </emp:employee>
- <employee xmlns:emp2="http://www.nist.gov">
- <employeeId>EMP0005</employeeId>
- <name>Robert Myers</name>
- <position>Computer Specialist</position>
- <salary>90,000</salary>
- <gender>male</gender>
- <address street="Yes" xmlns="http://www.nist.gov">1821 Nordic. Road, Irving Texas 98558</address>
- </employee>
- </staff>
diff --git a/xml/src/test/resources/systemid.xml b/xml/src/test/resources/systemid.xml
deleted file mode 100644
index d7cf0fb..0000000
--- a/xml/src/test/resources/systemid.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE collection SYSTEM "./recipt.dtd">
-<!--comment1 -->
-<collection>
- <description>
- Some recipes used for the XML tutorial.
- </description>
- <recipe>
- <title>Beef Parmesan<![CDATA[<title> with Garlic Angel Hair Pasta</title>]]></title>
- <ingredient name="beef cube steak" amount="1.5" unit="pound"/>
- <preparation>
- <step>
- Preheat oven to 350 degrees F (175 degrees C).
- </step>
- </preparation>
- <comment>
- Make the meat ahead of time, and refrigerate over night, the acid in the
- tomato sauce will tenderize the meat even more. If you do this, save the
- mozzarella till the last minute.
- </comment>
- <nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
- </recipe>
-</collection>
-<!--comment2 -->
diff --git a/xml/src/test/resources/systemid/recipt.dtd b/xml/src/test/resources/systemid/recipt.dtd
deleted file mode 100644
index 370112c..0000000
--- a/xml/src/test/resources/systemid/recipt.dtd
+++ /dev/null
@@ -1,17 +0,0 @@
-<!ELEMENT collection (description,recipe+)>
-<!ELEMENT description ANY>
-<!ELEMENT recipe (title,ingredient*,preparation,comment?,nutrition)>
-<!ELEMENT title (#PCDATA)>
-<!ELEMENT ingredient (ingredient*,preparation)?>
-<!ATTLIST ingredient name CDATA #REQUIRED
- amount CDATA #IMPLIED
- unit CDATA #IMPLIED>
-<!ELEMENT preparation (step*)>
-<!ELEMENT step (#PCDATA)>
-<!ELEMENT comment (#PCDATA)>
-<!ELEMENT nutrition EMPTY>
-<!ATTLIST nutrition protein CDATA #REQUIRED
- carbohydrates CDATA #REQUIRED
- fat CDATA #REQUIRED
- calories CDATA #REQUIRED
- alcohol CDATA #IMPLIED>
diff --git a/xml/src/test/resources/systemid/staff.dtd b/xml/src/test/resources/systemid/staff.dtd
deleted file mode 100644
index 02a994d..0000000
--- a/xml/src/test/resources/systemid/staff.dtd
+++ /dev/null
@@ -1,17 +0,0 @@
-<!ELEMENT employeeId (#PCDATA)>
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT position (#PCDATA)>
-<!ELEMENT salary (#PCDATA)>
-<!ELEMENT address (#PCDATA)>
-<!ELEMENT entElement ( #PCDATA ) >
-<!ELEMENT gender ( #PCDATA | entElement )* >
-<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
-<!ELEMENT staff (employee)+>
-<!ATTLIST entElement
- attr1 CDATA "Attr">
-<!ATTLIST address
- domestic CDATA #IMPLIED
- street CDATA "Yes">
-<!ATTLIST entElement
- domestic CDATA "MALE" >
-
diff --git a/xml/src/test/resources/wf/staff.dtd b/xml/src/test/resources/wf/staff.dtd
deleted file mode 100644
index 02a994d..0000000
--- a/xml/src/test/resources/wf/staff.dtd
+++ /dev/null
@@ -1,17 +0,0 @@
-<!ELEMENT employeeId (#PCDATA)>
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT position (#PCDATA)>
-<!ELEMENT salary (#PCDATA)>
-<!ELEMENT address (#PCDATA)>
-<!ELEMENT entElement ( #PCDATA ) >
-<!ELEMENT gender ( #PCDATA | entElement )* >
-<!ELEMENT employee (employeeId, name, position, salary, gender, address) >
-<!ELEMENT staff (employee)+>
-<!ATTLIST entElement
- attr1 CDATA "Attr">
-<!ATTLIST address
- domestic CDATA #IMPLIED
- street CDATA "Yes">
-<!ATTLIST entElement
- domestic CDATA "MALE" >
-
diff --git a/xml/src/test/resources/wf/staff.xml b/xml/src/test/resources/wf/staff.xml
deleted file mode 100644
index f89c510..0000000
--- a/xml/src/test/resources/wf/staff.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0"?><?TEST-STYLE PIDATA?>
-<!DOCTYPE staff SYSTEM "staff.dtd" [
- <!ENTITY ent1 "es">
- <!ENTITY ent2 "1900 Dallas Road">
- <!ENTITY ent3 "Texas">
- <!ENTITY ent4 "<entElement domestic='Yes'>Element data</entElement><?PItarget PIdata?>">
- <!ENTITY ent5 PUBLIC "entityURI" "entityFile" NDATA notation1>
- <!ENTITY ent1 "This entity should be discarded">
- <!NOTATION notation1 PUBLIC "notation1File">
- <!NOTATION notation2 SYSTEM "notation2File">
-]>
-<!-- This is comment number 1.-->
-<staff>
- <employee>
- <employeeId>EMP0001</employeeId>
- <name>Margaret Martin</name>
- <position>Accountant</position>
- <salary>56,000</salary>
- <gender>Female</gender>
- <address domestic="Yes">1230 North Ave. Dallas, Texas 98551</address>
- </employee>
- <employee>
- <employeeId>EMP0002</employeeId>
- <name>Martha Raynolds<![CDATA[This is a CDATASection with EntityReference number 2 &ent2;]]>
-<![CDATA[This is an adjacent CDATASection with a reference to a tab &tab;]]></name>
- <position>Secretary</position>
- <salary>35,000</salary>
- <gender>Female</gender>
- <address domestic="Yes" street="Yes">&ent2; Dallas, &ent3;
- 98554</address>
- </employee>
- <employee>
- <employeeId>EMP0003</employeeId>
- <name>Roger
- Jones</name>
- <position>Department Manager</position>
- <salary>100,000</salary>
- <gender>&ent4;</gender>
- <address domestic="Yes" street="No">PO Box 27 Irving, texas 98553</address>
- </employee>
- <employee>
- <employeeId>EMP0004</employeeId>
- <name>Jeny Oconnor</name>
- <position>Personnel Director</position>
- <salary>95,000</salary>
- <gender>Female</gender>
- <address domestic="Yes" street="Y&ent1;">27 South Road. Dallas, Texas 98556</address>
- </employee>
- <employee>
- <employeeId>EMP0005</employeeId>
- <name>Robert Myers</name>
- <position>Computer Specialist</position>
- <salary>90,000</salary>
- <gender>male</gender>
- <address street="Yes">1821 Nordic. Road, Irving Texas 98558</address>
- </employee>
- </staff>
diff --git a/xml/src/test/resources/wrong.xml b/xml/src/test/resources/wrong.xml
deleted file mode 100644
index 9d4b41d..0000000
--- a/xml/src/test/resources/wrong.xml
+++ /dev/null
@@ -1 +0,0 @@
-<wrong1>wrong</wrong2> \ No newline at end of file
diff --git a/xml/src/test/resources/xhtml1-strict.dtd b/xml/src/test/resources/xhtml1-strict.dtd
deleted file mode 100644
index 60bbaf7..0000000
--- a/xml/src/test/resources/xhtml1-strict.dtd
+++ /dev/null
@@ -1,65 +0,0 @@
-<!--
-
-Copyright (c) 2001-2004 World Wide Web Consortium,
-(Massachusetts Institute of Technology, Institut National de
-Recherche en Informatique et en Automatique, Keio University). All
-Rights Reserved. This program is distributed under the W3C's Software
-Intellectual Property License. This program is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
--->
-
-<!--
-
-This is a radically simplified DTD for use in the DOM Test Suites
-due to a XML non-conformance of one implementation in processing
-parameter entities. When that non-conformance is resolved,
-this DTD can be replaced by the normal DTD for XHTML.
-
--->
-
-
-<!ELEMENT html (head, body)>
-<!ATTLIST html xmlns CDATA #IMPLIED>
-<!ELEMENT head (meta,title,script*)>
-<!ELEMENT meta EMPTY>
-<!ATTLIST meta
- http-equiv CDATA #IMPLIED
- content CDATA #IMPLIED>
-<!ELEMENT title (#PCDATA)>
-<!ELEMENT body (p*)>
-<!ATTLIST body onload CDATA #IMPLIED>
-<!ELEMENT p (#PCDATA|em|strong|code|sup|var|acronym|abbr)*>
-<!ATTLIST p
- xmlns:dmstc CDATA #IMPLIED
- xmlns:nm CDATA #IMPLIED
- xmlns:emp2 CDATA #IMPLIED
- id ID #IMPLIED
->
-<!ELEMENT em (#PCDATA)>
-<!ELEMENT span (#PCDATA)>
-<!ELEMENT strong (#PCDATA)>
-<!ELEMENT code (#PCDATA)>
-<!ELEMENT sup (#PCDATA)>
-<!ELEMENT var (#PCDATA|span)*>
-<!ELEMENT acronym (#PCDATA)>
-<!ATTLIST acronym
- title CDATA #IMPLIED
- class CDATA #IMPLIED
- id ID #IMPLIED
->
-<!ELEMENT abbr (#PCDATA)>
-<!ATTLIST abbr
- title CDATA #IMPLIED
- class CDATA #IMPLIED
- id ID #IMPLIED
->
-<!ELEMENT script (#PCDATA)>
-<!ATTLIST script
- type CDATA #IMPLIED
- src CDATA #IMPLIED
- charset CDATA #IMPLIED>