diff options
Diffstat (limited to 'xml')
-rw-r--r-- | xml/src/main/java/javax/xml/package.html | 8 | ||||
-rw-r--r-- | xml/src/main/java/javax/xml/parsers/DocumentBuilder.java | 129 | ||||
-rw-r--r-- | xml/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java | 200 | ||||
-rw-r--r-- | xml/src/main/java/javax/xml/parsers/FactoryConfigurationError.java | 74 | ||||
-rw-r--r-- | xml/src/main/java/javax/xml/parsers/ParserConfigurationException.java | 15 | ||||
-rw-r--r-- | xml/src/main/java/javax/xml/parsers/SAXParser.java | 215 | ||||
-rw-r--r-- | xml/src/main/java/javax/xml/parsers/SAXParserFactory.java | 145 | ||||
-rw-r--r-- | xml/src/main/java/javax/xml/parsers/package.html | 1 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/io/KXmlParser.java | 12 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/kdom/Element.java | 37 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/kdom/Node.java | 12 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/wap/WbxmlParser.java | 121 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/wap/WbxmlSerializer.java | 166 | ||||
-rw-r--r-- | xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp | 4 | ||||
-rw-r--r-- | xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java | 2 | ||||
-rw-r--r-- | xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java | 152 | ||||
-rw-r--r-- | xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java | 81 | ||||
-rw-r--r-- | xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java | 62 | ||||
-rw-r--r-- | xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java | 26 | ||||
-rw-r--r-- | xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java | 100 | ||||
-rw-r--r-- | xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java | 193 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/AllTests.java (renamed from xml/src/test/java/org/w3c/dom/AllTests.java) | 4 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java (renamed from xml/src/test/java/org/w3c/dom/AttrGetOwnerElement.java) | 56 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/CreateAttributeNS.java) | 76 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/CreateDocument.java (renamed from xml/src/test/java/org/w3c/dom/CreateDocument.java) | 73 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java (renamed from xml/src/test/java/org/w3c/dom/CreateDocumentType.java) | 53 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java (renamed from xml/src/test/java/org/w3c/dom/CreateElementNS.java) | 79 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DOMDocumentBuilderFactory.java (renamed from xml/src/test/java/org/w3c/dom/DOMDocumentBuilderFactory.java) | 6 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java (renamed from xml/src/test/java/org/w3c/dom/DOMImplementationCreateDocument.java) | 53 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java (renamed from xml/src/test/java/org/w3c/dom/DOMImplementationCreateDocumentType.java) | 41 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java (renamed from xml/src/test/java/org/w3c/dom/DOMImplementationHasFeature.java) | 51 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DOMTestCase.java (renamed from xml/src/test/java/org/w3c/dom/DOMTestCase.java) | 6 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSetting.java (renamed from xml/src/test/java/org/w3c/dom/DocumentBuilderSetting.java) | 2 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSettingStrategy.java (renamed from xml/src/test/java/org/w3c/dom/DocumentBuilderSettingStrategy.java) | 2 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/DocumentCreateAttributeNS.java) | 89 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java (renamed from xml/src/test/java/org/w3c/dom/DocumentCreateElementNS.java) | 58 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java (renamed from xml/src/test/java/org/w3c/dom/DocumentGetElementsByTagnameNS.java) | 63 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java (renamed from xml/src/test/java/org/w3c/dom/DocumentGeteEementById.java) | 19 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java (renamed from xml/src/test/java/org/w3c/dom/DocumentImportNode.java) | 159 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java (renamed from xml/src/test/java/org/w3c/dom/DocumentTypeInternalSubset.java) | 23 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java (renamed from xml/src/test/java/org/w3c/dom/DocumentTypePublicId.java) | 21 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java (renamed from xml/src/test/java/org/w3c/dom/DocumentTypeSystemId.java) | 23 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/ElementGetAttributeNS.java) | 5 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java (renamed from xml/src/test/java/org/w3c/dom/ElementGetAttributeNodeNS.java) | 34 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java (renamed from xml/src/test/java/org/w3c/dom/ElementGetElementsByTagNameNS.java) | 41 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java (renamed from xml/src/test/java/org/w3c/dom/ElementHasAttribute.java) | 45 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/ElementHasAttributeNS.java) | 45 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/ElementRemoveAttributeNS.java) | 21 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/ElementSetAttributeNS.java) | 86 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java (renamed from xml/src/test/java/org/w3c/dom/ElementSetAttributeNodeNS.java) | 79 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/GetAttributeNS.java) | 52 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java (renamed from xml/src/test/java/org/w3c/dom/GetAttributeNodeNS.java) | 33 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/GetElementById.java (renamed from xml/src/test/java/org/w3c/dom/GetElementById.java) | 20 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java (renamed from xml/src/test/java/org/w3c/dom/GetElementsByTagNameNS.java) | 161 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/GetNamedItemNS.java) | 36 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java) | 5 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HCEntitiesSetNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/HCEntitiesSetNamedItemNS.java) | 5 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java (renamed from xml/src/test/java/org/w3c/dom/HCNamedNodeMapInvalidType.java) | 24 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java (renamed from xml/src/test/java/org/w3c/dom/HCNodeDocumentFragmentNormalize.java) | 37 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/HCNotationsRemoveNamedItemNS.java) | 23 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/HCNotationsSetNamedItemNS.java) | 23 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HasAttribute.java (renamed from xml/src/test/java/org/w3c/dom/HasAttribute.java) | 41 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/HasAttributeNS.java) | 51 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/HasAttributes.java (renamed from xml/src/test/java/org/w3c/dom/HasAttributes.java) | 31 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/ImportNode.java (renamed from xml/src/test/java/org/w3c/dom/ImportNode.java) | 152 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/InternalSubset.java (renamed from xml/src/test/java/org/w3c/dom/InternalSubset.java) | 22 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/IsSupported.java (renamed from xml/src/test/java/org/w3c/dom/IsSupported.java) | 134 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/LocalName.java (renamed from xml/src/test/java/org/w3c/dom/LocalName.java) | 55 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/NamedNodeMapGetNamedItemNS.java) | 59 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java) | 93 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/NamedNodeMapSetNamedItemNS.java) | 98 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java (renamed from xml/src/test/java/org/w3c/dom/NamespaceURI.java) | 42 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java (renamed from xml/src/test/java/org/w3c/dom/NodeGetLocalName.java) | 22 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java (renamed from xml/src/test/java/org/w3c/dom/NodeGetNamespaceURI.java) | 22 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java (renamed from xml/src/test/java/org/w3c/dom/NodeGetOwnerDocument.java) | 32 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java (renamed from xml/src/test/java/org/w3c/dom/NodeGetPrefix.java) | 22 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java (renamed from xml/src/test/java/org/w3c/dom/NodeHasAttributes.java) | 56 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java (renamed from xml/src/test/java/org/w3c/dom/NodeIsSupported.java) | 67 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java (renamed from xml/src/test/java/org/w3c/dom/NodeNormalize.java) | 30 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java (renamed from xml/src/test/java/org/w3c/dom/NodeSetPrefix.java) | 88 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/Normalize.java (renamed from xml/src/test/java/org/w3c/dom/Normalize.java) | 23 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java (renamed from xml/src/test/java/org/w3c/dom/OwnerDocument.java) | 19 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/OwnerElement.java (renamed from xml/src/test/java/org/w3c/dom/OwnerElement.java) | 35 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/Prefix.java (renamed from xml/src/test/java/org/w3c/dom/Prefix.java) | 127 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/PublicId.java (renamed from xml/src/test/java/org/w3c/dom/PublicId.java) | 21 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/RemoveAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/RemoveAttributeNS.java) | 5 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/RemoveNamedItemNS.java) | 35 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java (renamed from xml/src/test/java/org/w3c/dom/SetAttributeNS.java) | 95 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java (renamed from xml/src/test/java/org/w3c/dom/SetAttributeNodeNS.java) | 55 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java (renamed from xml/src/test/java/org/w3c/dom/SetNamedItemNS.java) | 51 | ||||
-rw-r--r-- | xml/src/test/java/tests/org/w3c/dom/SystemId.java (renamed from xml/src/test/java/org/w3c/dom/SystemId.java) | 21 | ||||
-rw-r--r-- | xml/src/test/java/tests/xml/AllTests.java | 4 | ||||
-rw-r--r-- | xml/src/test/java/tests/xml/SimpleBuilderTest.java | 26 | ||||
-rw-r--r-- | xml/src/test/java/tests/xml/SimpleParserTest.java | 47 |
94 files changed, 4224 insertions, 944 deletions
diff --git a/xml/src/main/java/javax/xml/package.html b/xml/src/main/java/javax/xml/package.html new file mode 100644 index 0000000..5a4621d --- /dev/null +++ b/xml/src/main/java/javax/xml/package.html @@ -0,0 +1,8 @@ +<html> + <body> + <p> + Provides a utility class with useful XML constants. + </p> + @since Android 1.0 + </body> +</html>
\ No newline at end of file diff --git a/xml/src/main/java/javax/xml/parsers/DocumentBuilder.java b/xml/src/main/java/javax/xml/parsers/DocumentBuilder.java index ad35256..6fd6550 100644 --- a/xml/src/main/java/javax/xml/parsers/DocumentBuilder.java +++ b/xml/src/main/java/javax/xml/parsers/DocumentBuilder.java @@ -31,81 +31,104 @@ import java.io.InputStream; /** * Defines a bridge from XML sources (files, stream etc.) to DOM trees. Can be - * used for easily obtaining a Document for the input. The class itself is - * abstract. The class DocumentBuilderFactory is able to provide instances (of - * concrete subclasses known to the system). + * used for easily obtaining a {@link org.w3c.dom.Document} for the input. The + * class itself is abstract. The class {@link DocumentBuilderFactory} is able to + * provide instances (of concrete subclasses known to the system). + * + * @since Android 1.0 */ public abstract class DocumentBuilder { /** * Do-nothing constructor. Prevents instantiation. To be overridden by * concrete subclasses. + * + * @since Android 1.0 */ protected DocumentBuilder() { // Does nothing. } /** - * Queries the DOM implementation this DocumentBuilder is working on. + * Queries the DOM implementation this {@code DocumentBuilder} is working + * on. + * + * @return the DOM implementation * - * @return The DOM implementation + * @since Android 1.0 */ public abstract DOMImplementation getDOMImplementation(); +// TODO No XSchema support in Android 1.0. Maybe later. +// /** +// * Queries the XML schema used by the DocumentBuilder. +// * +// * @return The XML schema +// * +// * @throws UnsupportedOperationException when the underlying implementation +// * doesn't support XML schemas. +// */ +// public javax.xml.validation.Schema getSchema() throws +// UnsupportedOperationException { +// throw new UnsupportedOperationException(); +// } + /** - * Queries the XML schema used by the DocumentBuilder. + * Queries whether the {@code DocumentBuilder} has namespace support + * enabled. * - * @return The XML schema - * - * @throws UnsupportedOperationException when the underlying implementation - * doesn't support XML schemas. - */ - // TODO Do we want the validation package in? - // public javax.xml.validation.Schema getSchema() throws - // UnsupportedOperationException { - // throw new UnsupportedOperationException(); - // } - /** - * Queries whether the DocumentBuilder has namespaces enabled. + * @return {@code true} if namespaces are turned on, {@code false} + * otherwise. * - * @return true if namespaces are turned on, false otherwise. + * @since Android 1.0 */ public abstract boolean isNamespaceAware(); /** - * Queries whether the DocumentBuilder has validating enabled. + * Queries whether the {@code DocumentBuilder} has validation support + * enabled. + * + * @return {@code true} if validation is turned on, {@code false} otherwise. * - * @return true if validating is turned on, false otherwise. + * @since Android 1.0 */ public abstract boolean isValidating(); /** - * Queries whether the DocumentBuilder has XInclude support enabled. + * Queries whether the {@code DocumentBuilder} has XInclude support enabled. * - * @return true if XInclude support is turned on, false otherwise. + * @return {@code true} if XInclude support is turned on, {@code false} + * otherwise. * - * @throws UnsupportedOperationException when the underlying imlementation + * @throws UnsupportedOperationException if the underlying implementation * doesn't support XInclude. + * + * @since Android 1.0 */ public boolean isXIncludeAware() throws UnsupportedOperationException { throw new UnsupportedOperationException(); } /** - * Creates a new document, serving as the starting point for a DOM tree. + * Creates a new, empty document, serving as the starting point for a DOM + * tree. + * + * @return the document. * - * @return The document. + * @since Android 1.0 */ public abstract Document newDocument(); /** * Parses a given XML file and builds a DOM tree from it. * - * @param file The file to be parsed. - * @return The document element that represents the root of the DOM tree. + * @param file the file to be parsed. + * @return the document element that represents the root of the DOM tree. * * @throws SAXException if the XML parsing fails. * @throws IOException if an input/output error occurs. + * + * @since Android 1.0 */ public Document parse(File file) throws SAXException, IOException { if (file == null) { @@ -118,11 +141,13 @@ public abstract class DocumentBuilder { /** * Parses a given XML input stream and builds a DOM tree from it. * - * @param stream The stream to be parsed. - * @return The document element that represents the root of the DOM tree. + * @param stream the stream to be parsed. + * @return the document element that represents the root of the DOM tree. * * @throws SAXException if the XML parsing fails. * @throws IOException if an input/output error occurs. + * + * @since Android 1.0 */ public Document parse(InputStream stream) throws SAXException, IOException { if (stream == null) { @@ -135,12 +160,14 @@ public abstract class DocumentBuilder { /** * Parses a given XML input stream and builds a DOM tree from it. * - * @param stream The stream to be parsed. - * @param systemId The base for resolving relative URIs. - * @return The document element that represents the root of the DOM tree. + * @param stream the stream to be parsed. + * @param systemId the base for resolving relative URIs. + * @return the document element that represents the root of the DOM tree. * * @throws SAXException if the XML parsing fails. * @throws IOException if an input/output error occurs. + * + * @since Android 1.0 */ public org.w3c.dom.Document parse(InputStream stream, String systemId) throws SAXException, IOException { @@ -157,11 +184,13 @@ public abstract class DocumentBuilder { * Parses an XML input stream from a given URI and builds a DOM tree from * it. * - * @param uri The URI to fetch the XML stream from. - * @return The document element that represents the root of the DOM tree. + * @param uri the URI to fetch the XML stream from. + * @return the document element that represents the root of the DOM tree. * * @throws SAXException if the XML parsing fails. * @throws IOException if an input/output error occurs. + * + * @since Android 1.0 */ public org.w3c.dom.Document parse(String uri) throws SAXException, IOException { @@ -175,11 +204,13 @@ public abstract class DocumentBuilder { /** * Parses an XML input source and builds a DOM tree from it. * - * @param source The input source to parse. - * @return The document element that represents the root of the DOM tree. + * @param source the input source to parse. + * @return the document element that represents the root of the DOM tree. * * @throws SAXException if the XML parsing fails. * @throws IOException if an input/output error occurs. + * + * @since Android 1.0 */ public abstract org.w3c.dom.Document parse(InputSource source) throws SAXException, IOException; @@ -187,26 +218,34 @@ public abstract class DocumentBuilder { /** * Resets the DocumentBuilder to the same state is was in after its * creation. + * + * @since Android 1.0 */ public void reset() { // Do nothing. } /** - * Sets the EntityResolver used for resolving entities encountered during - * the parse process. Passing null results in the DocumentBuilder's own - * EntityResolver being used. + * Sets the {@link EntityResolver} used for resolving entities encountered + * during the parse process. Passing {@code null} results in the + * {@code DocumentBuilder}'s own {@code EntityResolver} being used. * - * @param resolver The EntityResolver to use, or null for the built-in one. + * @param resolver the {@code EntityResolver} to use, or null for the + * built-in one. + * + * @since Android 1.0 */ public abstract void setEntityResolver(EntityResolver resolver); /** - * Sets the ErrorHandler used for dealing with errors encountered during the - * parse process. Passing null results in the DocumentBuilder's own - * ErrorHandler being used. + * Sets the {@link ErrorHandler} used for dealing with errors encountered + * during the parse process. Passing {@code null} results in the + * {@code DocumentBuilder}'s own {@code ErrorHandler} being used. + * + * @param handler the {@code ErrorHandler} to use, or {@code null} for the + * built-in one. * - * @param handler The ErrorHandler to use, or null for the built-in one. + * @since Android 1.0 */ public abstract void setErrorHandler(ErrorHandler handler); diff --git a/xml/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java b/xml/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java index 5e8d8cd..4e186c1 100644 --- a/xml/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java +++ b/xml/src/main/java/javax/xml/parsers/DocumentBuilderFactory.java @@ -19,12 +19,15 @@ package javax.xml.parsers; import org.apache.harmony.xml.parsers.DocumentBuilderFactoryImpl; /** - * Provides a factory for DocumentBuilder instances. The class first needs to be - * instantiated using the newInstance() method. The instance can be configured - * as desired. A call to newDocumentBuilder () then provides a DocumentBuilder + * Provides a factory for {@link DocumentBuilder} instances. The class first + * needs to be instantiated using the {@link #newInstance()} method. The + * instance can be configured as desired. A call to + * {@link #newDocumentBuilder()} then provides a {@code DocumentBuilder} * instance matching this configuration (if possible). + * + * @since Android 1.0 */ -public abstract class DocumentBuilderFactory extends java.lang.Object { +public abstract class DocumentBuilderFactory extends Object { private boolean coalesce; @@ -40,6 +43,8 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { /** * Do-nothing constructor. To be overridden by concrete document builders. + * + * @since Android 1.0 */ protected DocumentBuilderFactory() { // Does nothing. @@ -48,11 +53,13 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { /** * Queries an attribute from the underlying implementation. * - * @param name The name of the attribute. - * @return The value of the attribute. + * @param name the name of the attribute. + * @return the value of the attribute. * - * @throws java.lang.IllegalArgumentException if the argument is unknown to - * the underlying implementation. + * @throws IllegalArgumentException if the argument is unknown to the + * underlying implementation. + * + * @since Android 1.0 */ public abstract Object getAttribute(String name) throws IllegalArgumentException; @@ -61,7 +68,7 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Queries a feature from the underlying implementation. * * @param name The name of the feature. The default Android implementation - * of DocumentBuilder supports only the following three + * of {@link DocumentBuilder} supports only the following three * features: * * <dl> @@ -85,32 +92,37 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * namespace prefixes can be enabled, but not both at the same * time. * - * @return The status of the feature. + * @return the status of the feature. * - * @throws java.lang.IllegalArgumentException if the feature is unknown to + * @throws IllegalArgumentException if the feature is unknown to * the underlying implementation. - * @throws javax.xml.parsers.ParserConfigurationException if the feature is + * @throws ParserConfigurationException if the feature is * known, but not supported. + * + * @since Android 1.0 */ public abstract boolean getFeature(String name) - throws javax.xml.parsers.ParserConfigurationException; + throws ParserConfigurationException; - /** - * Queries the desired XML Schema object. - * - * @return The XML Schema object, if it has been set by a call to setSchema, - * or null otherwise. - */ - // TODO Do we want the validation package in? - // public javax.xml.validation.Schema getSchema() { - // return schema; - // } +// TODO No XSchema support in Android 1.0. Maybe later. +// /** +// * Queries the desired XML Schema object. +// * +// * @return The XML Schema object, if it has been set by a call to setSchema, +// * or null otherwise. +// */ +// public javax.xml.validation.Schema getSchema() { +// return schema; +// } /** * Queries whether the factory is configured to deliver parsers that convert - * CDATA nodes to text nodes and melt them with neighbouring nodes. + * CDATA nodes to text nodes and melt them with neighboring nodes. This is + * called "coalescing". + * + * @return {@code true} if coalescing is desired, {@code false} otherwise. * - * @return true if coalescing is desired, false otherwise. + * @since Android 1.0 */ public boolean isCoalescing() { return coalesce; @@ -120,7 +132,10 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Queries whether the factory is configured to deliver parsers that expand * entity references. * - * @return true if entity expansion is desired, false otherwise. + * @return {@code true} if entity expansion is desired, {@code false} + * otherwise. + * + * @since Android 1.0 */ public boolean isExpandEntityReferences() { return expandEntityReferences; @@ -130,7 +145,10 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Queries whether the factory is configured to deliver parsers that ignore * comments. * - * @return true if comment ignorance is desired, false otherwise. + * @return {@code true} if comment ignorance is desired, {@code false} + * otherwise. + * + * @since Android 1.0 */ public boolean isIgnoringComments() { return ignoreComments; @@ -140,7 +158,10 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Queries whether the factory is configured to deliver parsers that ignore * whitespace in elements. * - * @return true if whitespace ignorance is desired, false otherwise. + * @return {@code true} if whitespace ignorance is desired, {@code false} + * otherwise. + * + * @since Android 1.0 */ public boolean isIgnoringElementContentWhitespace() { return ignoreElementContentWhitespace; @@ -150,7 +171,10 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Queries whether the factory is configured to deliver parsers that are * namespace-aware. * - * @return true if namespace-awareness is desired, false otherwise. + * @return {@code true} if namespace-awareness is desired, {@code false} + * otherwise. + * + * @since Android 1.0 */ public boolean isNamespaceAware() { return namespaceAware; @@ -160,7 +184,9 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Queries whether the factory is configured to deliver parsers that are * validating. * - * @return true if validating is desired, false otherwise. + * @return {@code true} if validating is desired, {@code false} otherwise. + * + * @since Android 1.0 */ public boolean isValidating() { return validate; @@ -170,31 +196,44 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Queries whether the factory is configured to deliver parsers that are * XInclude-aware. * - * @return true if XInclude-awareness is desired, false otherwise. + * @return {@code true} if XInclude-awareness is desired, {@code false} + * otherwise. + * + * @since Android 1.0 */ public boolean isXIncludeAware() { throw new UnsupportedOperationException(); } /** - * Creates a new DocumentBuilder that matches the current configuration. + * Creates a new {@link DocumentBuilder} that matches the current + * configuration of the factory. + * + * @return the DocumentBuilder. + * @throws ParserConfigurationException if no matching + * {@code DocumentBuilder} could be found. * - * @return The DocumentBuilder. - * @throws javax.xml.parsers.ParserConfigurationException if no matching - * DocumentBuilder could be found. + * @since Android 1.0 */ - public abstract javax.xml.parsers.DocumentBuilder newDocumentBuilder() - throws javax.xml.parsers.ParserConfigurationException; + public abstract DocumentBuilder newDocumentBuilder() + throws ParserConfigurationException; /** * Creates a new DocumentBuilderFactory that can be configured and then be - * used for creating DocumentBuilder objects. + * used for creating DocumentBuilder objects. The method first checks the + * value of the {@code DocumentBuilderFactory} property. + * If this is non-{@code null}, it is assumed to be the name of a class + * that serves as the factory. The class is instantiated, and the instance + * is returned. If the property value is {@code null}, the system's default + * factory implementation is returned. * - * @return The DocumentBuilderFactory. - * @throws FactoryConfigurationError If no DocumentBuilderFactory can be - * created. + * @return the DocumentBuilderFactory. + * @throws FactoryConfigurationError if no {@code DocumentBuilderFactory} + * can be created. + * + * @since Android 1.0 */ - public static javax.xml.parsers.DocumentBuilderFactory newInstance() + public static DocumentBuilderFactory newInstance() throws FactoryConfigurationError { // TODO Properties file and META-INF case missing here. See spec. String factory = System @@ -221,20 +260,25 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { /** * Sets an attribute in the underlying implementation. * - * @param name The name of the attribute. - * @param value The value of the attribute. + * @param name the name of the attribute. + * @param value the value of the attribute. * - * @throws java.lang.IllegalArgumentException if the argument is unknown to - * the underlying implementation. + * @throws IllegalArgumentException if the argument is unknown to the + * underlying implementation. + * + * @since Android 1.0 */ public abstract void setAttribute(String name, Object value) throws IllegalArgumentException; /** * Determines whether the factory is configured to deliver parsers that - * convert CDATA nodes to text nodes and melt them with neighbouring nodes. + * convert CDATA nodes to text nodes and melt them with neighboring nodes. + * This is called "coalescing". + * + * @param value turns coalescing on or off. * - * @param value Turns coalescing on or off. + * @since Android 1.0 */ public void setCoalescing(boolean value) { coalesce = value; @@ -244,7 +288,9 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Determines whether the factory is configured to deliver parsers that * expands entity references. * - * @param value Turns entity reference expansion on or off. + * @param value turns entity reference expansion on or off. + * + * @since Android 1.0 */ public void setExpandEntityReferences(boolean value) { expandEntityReferences = value; @@ -253,33 +299,35 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { /** * Sets a feature in the underlying implementation. * - * @param name The name of the feature. The default Android implementation - * of DocumentBuilder supports only the following three + * @param name the name of the feature. The default Android implementation + * of {@link DocumentBuilder} supports only the following three * features: * * <dl> * <dt>{@code http://xml.org/sax/features/namespaces}</dt> - * <dd>Queries the state of namespace-awareness.</dd> - * + * <dd>Sets the state of namespace-awareness.</dd> + * * <dt> * {@code http://xml.org/sax/features/namespace-prefixes} * </dt> - * <dd>Queries the state of namespace prefix processing</dd> + * <dd>Sets the state of namespace prefix processing</dd> * * <dt>{@code http://xml.org/sax/features/validation}</dt> - * <dd>Queries the state of validation.</dd> + * <dd>Sets the state of validation.</dd> * </dl> * - * Note that despite the ability to query the validation + * Note that despite the ability to set the validation * feature, there is currently no validating parser available. * Also note that currently either namespaces or * namespace prefixes can be enabled, but not both at the same * time. * - * @param value The value of the feature. + * @param value the value of the feature. * * @throws ParserConfigurationException if the feature is unknown to the * underlying implementation. + * + * @since Android 1.0 */ public abstract void setFeature(String name, boolean value) throws ParserConfigurationException; @@ -288,7 +336,9 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Determines whether the factory is configured to deliver parsers that * ignore comments. * - * @param value Turns comment ignorance on or off. + * @param value turns comment ignorance on or off. + * + * @since Android 1.0 */ public void setIgnoringComments(boolean value) { ignoreComments = value; @@ -298,7 +348,9 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Determines whether the factory is configured to deliver parsers that * ignores element whitespace. * - * @param value Turns element whitespace ignorance on or off. + * @param value turns element whitespace ignorance on or off. + * + * @since Android 1.0 */ public void setIgnoringElementContentWhitespace(boolean value) { ignoreElementContentWhitespace = value; @@ -308,27 +360,31 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Determines whether the factory is configured to deliver parsers that are * namespace-aware. * - * @param value Turns namespace-awareness on or off. + * @param value turns namespace-awareness on or off. + * + * @since Android 1.0 */ public void setNamespaceAware(boolean value) { namespaceAware = value; } - /** - * Sets the desired XML Schema object. - * - * @param schema The XML Schema object. - */ - // TODO Do we want the validation package in? - // public void setSchema(Schema schema) { - // this.schema = schema; - // } +// TODO No XSchema support in Android 1.0. Maybe later. +// /** +// * Sets the desired XML Schema object. +// * +// * @param schema The XML Schema object. +// */ +// public void setSchema(Schema schema) { +// this.schema = schema; +// } /** * Determines whether the factory is configured to deliver parsers that are * validating. * - * @param value Turns validation on or off. + * @param value turns validation on or off. + * + * @since Android 1.0 */ public void setValidating(boolean value) { validate = value; @@ -338,7 +394,9 @@ public abstract class DocumentBuilderFactory extends java.lang.Object { * Determines whether the factory is configured to deliver parsers that are * XInclude-aware. * - * @param value Turns XInclude-awareness on or off. + * @param value turns XInclude-awareness on or off. + * + * @since Android 1.0 */ public void setXIncludeAware(boolean value) { throw new UnsupportedOperationException(); diff --git a/xml/src/main/java/javax/xml/parsers/FactoryConfigurationError.java b/xml/src/main/java/javax/xml/parsers/FactoryConfigurationError.java index 56023e1..f5e0c03 100644 --- a/xml/src/main/java/javax/xml/parsers/FactoryConfigurationError.java +++ b/xml/src/main/java/javax/xml/parsers/FactoryConfigurationError.java @@ -17,36 +17,42 @@ package javax.xml.parsers; /** - * Represents an error that occured during the configuration of parser factory. + * Represents an error that occurred during the configuration of parser factory. + * + * @since Android 1.0 */ public class FactoryConfigurationError extends Error { /** * The nested exception that caused this exception. Note that the nested - * exception will be stored in a special attribute, and can be queried - * using the getException() method. It does not use the facility the - * Exception class provides for storing nested exceptions, since the XML - * API predates that facility. + * exception will be stored in a special attribute, and can be queried using + * the {@link #getException()} method. It does not use the facility the + * {@link Exception} class provides for storing nested exceptions, since the + * XML API predates that facility. */ private Exception cause; /** - * Creates a new FactoryConfigurationError with no error message an no - * cause. + * Creates a new {@code FactoryConfigurationError} with no error message and + * no cause. + * + * @since Android 1.0 */ public FactoryConfigurationError() { super(); } /** - * Creates a new FactoryConfigurationError with no error message and a given - * cause. + * Creates a new {@code FactoryConfigurationError} with no error message and + * a given cause. + * + * @param cause the cause of the error. Note that the nested exception will + * be stored in a special attribute, and can be queried using the + * {@link #getException()} method. It does not use the facility the + * Exception class provides for storing nested exceptions, since the + * XML API predates that facility. * - * @param cause The cause of the error. Note that the nested - * exception will be stored in a special attribute, and can be - * queried using the getException() method. It does not use the - * facility the Exception class provides for storing nested - * exceptions, since the XML API predates that facility. + * @since Android 1.0 */ public FactoryConfigurationError(Exception cause) { super(); @@ -54,15 +60,17 @@ public class FactoryConfigurationError extends Error { } /** - * Creates a new FactoryConfigurationError with a given error message and - * cause. + * Creates a new {@code FactoryConfigurationError} with a given error + * message and cause. * - * @param cause The cause of the error. Note that the nested - * exception will be stored in a special attribute, and can be - * queried using the getException() method. It does not use the - * facility the Exception class provides for storing nested - * exceptions, since the XML API predates that facility. + * @param cause the cause of the error. Note that the nested exception will + * be stored in a special attribute, and can be queried using the + * {@link #getException()} method. It does not use the facility the + * {@link Exception} class provides for storing nested exceptions, + * since the XML API predates that facility. * @param message The error message. + * + * @since Android 1.0 */ public FactoryConfigurationError(Exception cause, String message) { super(message); @@ -70,10 +78,12 @@ public class FactoryConfigurationError extends Error { } /** - * Creates a new FactoryConfigurationError with a given error message and no - * cause. + * Creates a new {@code FactoryConfigurationError} with a given error + * message and no cause. * - * @param message The error message. + * @param message the error message. + * + * @since Android 1.0 */ public FactoryConfigurationError(String message) { super(message); @@ -82,21 +92,27 @@ public class FactoryConfigurationError extends Error { /** * Returns the cause of the error, in case there is one. * - * @return The exception that caused the error, or null if none is set. + * @return the exception that caused the error, or {@code null} if none is + * set. + * + * @since Android 1.0 */ - public java.lang.Exception getException() { + public Exception getException() { return cause; } /** * Returns the message of the error, in case there is one. * - * @return The message. If an explicit error message has been assigned to + * @return the message. If an explicit error message has been assigned to * the exception, this one is returned. If not, and there is an * underlying exception (the cause), then the result of invoking - * toString() for that is returned. Otherwise, null is returned. + * {@link #toString()} on that object is returned. Otherwise, {@code + * null} is returned. + * + * @since Android 1.0 */ - public java.lang.String getMessage() { + public String getMessage() { String message = super.getMessage(); if (message != null) { diff --git a/xml/src/main/java/javax/xml/parsers/ParserConfigurationException.java b/xml/src/main/java/javax/xml/parsers/ParserConfigurationException.java index 2028d2c..49875d6 100644 --- a/xml/src/main/java/javax/xml/parsers/ParserConfigurationException.java +++ b/xml/src/main/java/javax/xml/parsers/ParserConfigurationException.java @@ -17,21 +17,28 @@ package javax.xml.parsers; /** - * Represents an exception that occured during the configuration of parser. + * Represents an exception that occurred during the configuration of parser. + * + * @since Android 1.0 */ public class ParserConfigurationException extends Exception { /** - * Creates a new ParserConfigurationException with no error message. + * Creates a new {@code ParserConfigurationException} with no error message. + * + * @since Android 1.0 */ public ParserConfigurationException() { super(); } /** - * Creates a new ParserConfigurationException with a given error message. + * Creates a new {@code ParserConfigurationException} with a given error + * message. + * + * @param msg the error message. * - * @param msg The error message. + * @since Android 1.0 */ public ParserConfigurationException(String msg) { super(msg); diff --git a/xml/src/main/java/javax/xml/parsers/SAXParser.java b/xml/src/main/java/javax/xml/parsers/SAXParser.java index bbee754..73cc0eb 100644 --- a/xml/src/main/java/javax/xml/parsers/SAXParser.java +++ b/xml/src/main/java/javax/xml/parsers/SAXParser.java @@ -25,89 +25,110 @@ import org.xml.sax.SAXNotSupportedException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; +import java.io.BufferedInputStream; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; /** - * Provides a wrapper around a SAX XMLReader. This abstract class only defines - * the interface, whereas the SAXParserFactory class is used to obtain instances - * of concrete subclasses. + * Provides a wrapper around a SAX {@link XMLReader}. This abstract + * class only defines the interface, whereas the {@link SAXParserFactory} class + * is used to obtain instances of concrete subclasses. + * + * @since Android 1.0 */ public abstract class SAXParser extends java.lang.Object { /** * Do-nothing constructor. Prevents instantiation. To be overridden by * concrete subclasses. + * + * @since Android 1.0 */ protected SAXParser() { // Does nothing. } /** - * Queries the underlying SAX Parser object. + * Queries the underlying SAX {@link Parser} object. + * + * @return the SAX {@code Parser}. * - * @return The SAX Parser. + * @throws SAXException if a problem occurs. * - * @throws org.xml.sax.SAXException if a problem occurs. + * @since Android 1.0 */ - public abstract org.xml.sax.Parser getParser() - throws org.xml.sax.SAXException; + public abstract Parser getParser() + throws SAXException; /** - * Queries a property of the underlying SAX XMLReader. + * Queries a property of the underlying SAX {@link XMLReader}. + * + * @param name the name of the property. + * @return the value of the property. * - * @param name The name of the property. - * @return The value of the property. + * @throws SAXNotRecognizedException if the property is not known to the + * underlying SAX {@code XMLReader}. + * @throws SAXNotSupportedException if the property is known, but not + * supported by the underlying SAX {@code XMLReader}. * - * @throws SAXNotRecognizedException If the property is not known to the - * underlying SAX XMLReader. - * @throws SAXNotSupportedException If the property is known, but not - * supported by the underlying SAX XMLReader. + * @since Android 1.0 */ public abstract Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException; - /** - * Queries the XML Schema used by the underlying XMLReader. - * - * @return The XML Schema. - */ - // TODO Do we want the validation package in? - // public Schema getSchema() { - // return schema; - // } +// TODO No XSchema support in Android 1.0. Maybe later. +// /** +// * Queries the XML Schema used by the underlying XMLReader. +// * +// * @return The XML Schema. +// */ +// public Schema getSchema() { +// return schema; +// } /** * Queries the underlying SAX XMLReader object. * - * @return The SAX XMLREader. + * @return the SAX XMLREader. * - * @throws org.xml.sax.SAXException if a problem occurs. + * @throws SAXException if a problem occurs. + * + * @since Android 1.0 */ public abstract XMLReader getXMLReader() throws SAXException; /** - * Reflects whether this SAXParser is namespace-aware. + * Reflects whether this {@code SAXParser} is namespace-aware. + * + * @return {@code true} if the {@code SAXParser} is namespace-aware, or + * {@code false} otherwise. * - * @return true if the SAXParser is namespace-aware, or false otherwise. + * @since Android 1.0 */ public abstract boolean isNamespaceAware(); /** - * Reflects whether this SAXParser is validating. + * Reflects whether this {@code SAXParser} is validating. + * + * @return {@code true} if the {@code SAXParser} is validating, or {@code + * false} otherwise. * - * @return true if the SAXParser is validating, or false otherwise. + * @since Android 1.0 */ public abstract boolean isValidating(); /** - * Reflects whether this SAXParser is XInclude-aware. + * Reflects whether this {@code SAXParser} is XInclude-aware. * - * @return true if the SAXParser is XInclude-aware, or false otherwise. + * @return {@code true} if the {@code SAXParser} is XInclude-aware, or + * {@code false} otherwise. * * @throws UnsupportedOperationException if the underlying implementation * doesn't know about XInclude at all (backwards compatibility). + * + * @since Android 1.0 */ public boolean isXIncludeAware() throws UnsupportedOperationException { throw new UnsupportedOperationException(); @@ -116,11 +137,13 @@ public abstract class SAXParser extends java.lang.Object { /** * Parses the given XML file using the given SAX event handler. * - * @param file The file. - * @param handler The SAX handler. + * @param file the file containing the XML document. + * @param handler the SAX handler. + * + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @since Android 1.0 */ public void parse(File file, HandlerBase handler) throws SAXException, IOException { @@ -137,11 +160,13 @@ public abstract class SAXParser extends java.lang.Object { /** * Parses the given XML file using the given SAX event handler. * - * @param file The file. - * @param handler The SAX handler. + * @param file the file containing the XML document. + * @param handler the SAX handler. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. + * + * @since Android 1.0 */ public void parse(File file, DefaultHandler handler) throws SAXException, IOException { @@ -158,11 +183,13 @@ public abstract class SAXParser extends java.lang.Object { /** * Parses the given XML InputStream using the given SAX event handler. * - * @param stream The InputStream. - * @param handler The SAX handler. + * @param stream the InputStream containing the XML document. + * @param handler the SAX handler. + * + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @since Android 1.0 */ public void parse(InputStream stream, HandlerBase handler) throws SAXException, IOException { @@ -176,12 +203,14 @@ public abstract class SAXParser extends java.lang.Object { * Parses the given XML InputStream using the given SAX event handler and * system ID. * - * @param stream The InputStream. - * @param handler The SAX handler. - * @param systemId The system ID. + * @param stream the InputStream containing the XML document. + * @param handler the SAX handler. + * @param systemId the system ID. + * + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @since Android 1.0 */ public void parse(InputStream stream, HandlerBase handler, String systemId) throws SAXException, IOException { @@ -198,11 +227,13 @@ public abstract class SAXParser extends java.lang.Object { /** * Parses the given XML InputStream using the given SAX event handler. * - * @param stream The InputStream. - * @param handler The SAX handler. + * @param stream the InputStream containing the XML document. + * @param handler the SAX handler. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. + * + * @since Android 1.0 */ public void parse(InputStream stream, DefaultHandler handler) throws SAXException, IOException { @@ -213,12 +244,14 @@ public abstract class SAXParser extends java.lang.Object { * Parses the given XML InputStream using the given SAX event handler and * system ID. * - * @param stream The InputStream. - * @param handler The SAX handler. - * @param systemId The system ID. + * @param stream the InputStream containing the XML document. + * @param handler the SAX handler. + * @param systemId the system ID. + * + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @since Android 1.0 */ public void parse(InputStream stream, DefaultHandler handler, String systemId) throws SAXException, IOException { @@ -235,11 +268,13 @@ public abstract class SAXParser extends java.lang.Object { /** * Parses the contents of the given URI using the given SAX event handler. * - * @param uri The URI. - * @param handler The SAX handler. + * @param uri the URI pointing to the XML document. + * @param handler the SAX handler. + * + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @since Android 1.0 */ public void parse(String uri, HandlerBase handler) throws SAXException, IOException { @@ -252,11 +287,13 @@ public abstract class SAXParser extends java.lang.Object { /** * Parses the contents of the given URI using the given SAX event handler. * - * @param uri The URI. - * @param handler The SAX handler. + * @param uri the URI pointing to the XML document. + * @param handler the SAX handler. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. + * + * @since Android 1.0 */ public void parse(String uri, DefaultHandler handler) throws SAXException, IOException { @@ -267,13 +304,16 @@ public abstract class SAXParser extends java.lang.Object { } /** - * Parses the given SAX InputSource using the given SAX event handler. + * Parses the given SAX {@link InputSource} using the given SAX event + * handler. + * + * @param source the SAX {@code InputSource} containing the XML document. + * @param handler the SAX handler. * - * @param source The SAX InputSource. - * @param handler The SAX handler. + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @since Android 1.0 */ public void parse(InputSource source, HandlerBase handler) throws SAXException, IOException { @@ -293,13 +333,16 @@ public abstract class SAXParser extends java.lang.Object { } /** - * Parses the given SAX InputSource using the given SAX event handler. + * Parses the given SAX {@link InputSource} using the given SAX event + * handler. + * + * @param source the SAX {@code InputSource} containing the XML document. + * @param handler the SAX handler. * - * @param source The SAX HandlerBase. - * @param handler The SAX handler. + * @throws SAXException if a problem occurs during SAX parsing. + * @throws IOException if a general IO problem occurs. * - * @throws SAXException If a problem occurs during SAX parsing. - * @throws IOException If a general IO problem occurs. + * @since Android 1.0 */ public void parse(InputSource source, DefaultHandler handler) throws SAXException, IOException { @@ -319,23 +362,27 @@ public abstract class SAXParser extends java.lang.Object { } /** - * Resets the DocumentBuilder to the same state is was in after its + * Resets the {@code SAXParser} to the same state is was in after its * creation. + * + * @since Android 1.0 */ public void reset() { // Do nothing. } /** - * Sets a property of the underlying SAX XMLReader. + * Sets a property of the underlying SAX {@link XMLReader}. + * + * @param name the name of the property. + * @param value the value of the property. * - * @param name The name of the property. - * @param value The value of the property. + * @throws SAXNotRecognizedException if the property is not known to the + * underlying SAX {@code XMLReader}. + * @throws SAXNotSupportedException if the property is known, but not + * supported by the underlying SAX {@code XMLReader}. * - * @throws SAXNotRecognizedException If the property is not known to the - * underlying SAX XMLReader. - * @throws SAXNotSupportedException If the property is known, but not - * supported by the underlying SAX XMLReader. + * @since Android 1.0 */ public abstract void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException; diff --git a/xml/src/main/java/javax/xml/parsers/SAXParserFactory.java b/xml/src/main/java/javax/xml/parsers/SAXParserFactory.java index 435b89c..ebf0531 100644 --- a/xml/src/main/java/javax/xml/parsers/SAXParserFactory.java +++ b/xml/src/main/java/javax/xml/parsers/SAXParserFactory.java @@ -23,10 +23,12 @@ import org.xml.sax.SAXNotSupportedException; import org.xml.sax.SAXException; /** - * Provides a factory for SAXParser instances. The class first needs to be - * instantiated using the newInstance() method. The instance can be - * configured as desired. A call to newSAXParser() then provides a SAXParser - * instance matching this configuration. + * Provides a factory for {@link SAXParser} instances. The class first needs to + * be instantiated using the {@link #newInstance()} method. The instance can be + * configured as desired. A call to its {@link #newSAXParser()} then provides a + * {@code SAXParser} instance matching this configuration, if possible. + * + * @since Android 1.0 */ public abstract class SAXParserFactory { @@ -39,6 +41,8 @@ public abstract class SAXParserFactory { /** * Do-nothing constructor. Prevents instantiation. To be overridden by * concrete subclasses. + * + * @since Android 1.0 */ protected SAXParserFactory() { // Does nothing. @@ -48,7 +52,8 @@ public abstract class SAXParserFactory { * Queries a feature from the underlying implementation. * * @param name The name of the feature. The default Android implementation - * of SAXParser supports only the following three features: + * of {@link SAXParser} supports only the following three + * features: * * <dl> * <dt>{@code http://xml.org/sax/features/namespaces}</dt> @@ -69,35 +74,40 @@ public abstract class SAXParserFactory { * namespace prefixes can be enabled, but not both at the same * time. * - * @return The status of the feature. + * @return the status of the feature. * - * @throws ParserConfigurationException if no SAXParser matching the given - * criteria is available. - * @throws SAXNotRecognizedException If the given feature is not known to + * @throws ParserConfigurationException if no {@code SAXParser} matching the + * given criteria is available. + * @throws SAXNotRecognizedException if the given feature is not known to * the underlying implementation. - * @throws SAXNotSupportedException If the given features is known, but not + * @throws SAXNotSupportedException if the given features is known, but not * supported by the underlying implementation. + * + * @since Android 1.0 */ public abstract boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException; - /** - * Queries the desired XML Schema object. - * - * @return The XML Schema object, if it has been set by a call to setSchema, - * or null otherwise. - */ - // TODO Do we want the validation package in? - // public javax.xml.validation.Schema getSchema() { - // return schema; - // } +// TODO No XSchema support in Android 1.0. Maybe later. +// /** +// * Queries the desired XML Schema object. +// * +// * @return The XML Schema object, if it has been set by a call to setSchema, +// * or null otherwise. +// */ +// public javax.xml.validation.Schema getSchema() { +// return schema; +// } /** * Queries whether the factory is configured to deliver parsers that are * namespace-aware. * - * @return true if namespace-awareness is desired, false otherwise. + * @return {@code true} if namespace-awareness is desired, {@code false} + * otherwise. + * + * @since Android 1.0 */ public boolean isNamespaceAware() { return namespaceAware; @@ -107,7 +117,9 @@ public abstract class SAXParserFactory { * Queries whether the factory is configured to deliver parsers that are * validating. * - * @return true if validating is desired, false otherwise. + * @return {@code true} if validating is desired, {@code false} otherwise. + * + * @since Android 1.0 */ public boolean isValidating() { return validating; @@ -117,19 +129,30 @@ public abstract class SAXParserFactory { * Queries whether the factory is configured to deliver parsers that are * XInclude-aware. * - * @return true if XInclude-awareness is desired, false otherwise. + * @return {@code true} if XInclude-awareness is desired, {@code false} + * otherwise. + * + * @since Android 1.0 */ public boolean isXIncludeAware() { throw new UnsupportedOperationException(); } /** - * Creates a new SAXParserFactory that can be configured and then be used - * for creating SAXPArser objects. + * Creates a new {@code SAXParserFactory} that can be configured and then be + * used for creating {@link SAXParser} objects. The method first checks the + * value of the {@code SAXParserFactory} property. If this + * is non-{@code null}, it is assumed to be the name of a class that serves + * as the factory. The class is instantiated, and the instance is returned. + * If the property value is {@code null}, the system's default factory + * implementation is returned. * - * @return The SAXParserFactory. + * @return the {@code SAXParserFactory}. * - * @throws FactoryConfigurationError If no SAXParserFactory can be created. + * @throws FactoryConfigurationError if no {@code SAXParserFactory} can be + * created. + * + * @since Android 1.0 */ public static SAXParserFactory newInstance() throws FactoryConfigurationError { @@ -154,13 +177,17 @@ public abstract class SAXParserFactory { } /** - * Creates a new SAXParser that matches the current configuration. + * Creates a new {@link SAXParser} that matches the current configuration of + * the factory. + * + * @return the {@code SAXParser}. * - * @return The SAXParser. + * @throws ParserConfigurationException if no matching {@code SAXParser} + * could be found. + * @throws SAXException if creating the {@code SAXParser} failed due to some + * other reason. * - * @throws ParserConfigurationException if no matching SAXParser could be - * found. - * @throws SAXException If a problem occurs during SAX parsing. + * @since Android 1.0 */ public abstract SAXParser newSAXParser() throws ParserConfigurationException, SAXException; @@ -168,20 +195,21 @@ public abstract class SAXParserFactory { /** * Sets a feature in the underlying implementation. * - * @param name The name of the feature. The default Android implementation - * of SAXParser supports only the following three features: + * @param name the name of the feature. The default Android implementation + * of {@link SAXParser} supports only the following three + * features: * * <dl> * <dt>{@code http://xml.org/sax/features/namespaces}</dt> - * <dd>Queries the state of namespace-awareness.</dd> + * <dd>Sets the state of namespace-awareness.</dd> * * <dt> * {@code http://xml.org/sax/features/namespace-prefixes} * </dt> - * <dd>Queries the state of namespace prefix processing</dd> + * <dd>Sets the state of namespace prefix processing</dd> * * <dt>{@code http://xml.org/sax/features/validation}</dt> - * <dd>Queries the state of validation.</dd> + * <dd>Sets the state of validation.</dd> * </dl> * * Note that despite the ability to query the validation @@ -190,14 +218,16 @@ public abstract class SAXParserFactory { * namespace prefixes can be enabled, but not both at the same * time. * - * @param value The status of the feature. + * @param value the status of the feature. * - * @throws ParserConfigurationException if no SAXParser matching the given - * criteria is available. - * @throws SAXNotRecognizedException If the given feature is not known to + * @throws ParserConfigurationException if no {@code SAXParser} matching + * the given criteria is available. + * @throws SAXNotRecognizedException if the given feature is not known to * the underlying implementation. - * @throws SAXNotSupportedException If the given features is known, but not + * @throws SAXNotSupportedException if the given features is known, but not * supported by the underlying implementation. + * + * @since Android 1.0 */ public abstract void setFeature(String name, boolean value) throws ParserConfigurationException, SAXNotRecognizedException, @@ -207,26 +237,31 @@ public abstract class SAXParserFactory { * Determines whether the factory is configured to deliver parsers that are * namespace-aware. * - * @param value Turns namespace-awareness on or off. + * @param value turns namespace-awareness on or off. + * + * @since Android 1.0 */ public void setNamespaceAware(boolean value) { namespaceAware = value; } - /** - * Sets the desired XML Schema object. - * - * @param schema The XML Schema object. - */ - // TODO Do we want the validation package in? - // public void setSchema(Schema schema) { - // this.schema = schema; - // } +// TODO No XSchema support in Android 1.0. Maybe later. +// /** +// * Sets the desired XML Schema object. +// * +// * @param schema The XML Schema object. +// */ +// public void setSchema(Schema schema) { +// this.schema = schema; +// } + /** * Determines whether the factory is configured to deliver parsers that are * validating. * - * @param value Turns validation on or off. + * @param value turns validation on or off. + * + * @since Android 1.0 */ public void setValidating(boolean value) { validating = value; @@ -236,7 +271,9 @@ public abstract class SAXParserFactory { * Determines whether the factory is configured to deliver parsers that are * XInclude-aware. * - * @param value Turns XInclude-awareness on or off. + * @param value turns XInclude-awareness on or off. + * + * @since Android 1.0 */ public void setXIncludeAware(boolean value) { throw new UnsupportedOperationException(); diff --git a/xml/src/main/java/javax/xml/parsers/package.html b/xml/src/main/java/javax/xml/parsers/package.html index 1522e5a..7e0921d 100644 --- a/xml/src/main/java/javax/xml/parsers/package.html +++ b/xml/src/main/java/javax/xml/parsers/package.html @@ -19,5 +19,6 @@ various DOM classes might differ from other implementations and (b) requesting a validating parser will always fail. </p> + @since Android 1.0 </body> </html>
\ No newline at end of file diff --git a/xml/src/main/java/org/kxml2/io/KXmlParser.java b/xml/src/main/java/org/kxml2/io/KXmlParser.java index 8125745..0727bc7 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlParser.java +++ b/xml/src/main/java/org/kxml2/io/KXmlParser.java @@ -45,7 +45,7 @@ public class KXmlParser implements XmlPullParser { private boolean processNsp; private boolean relaxed; - private HashMap entityMap; + private Hashtable entityMap; private int depth; private String[] elementStack = new String[16]; private String[] nspStack = new String[8]; @@ -95,10 +95,12 @@ public class KXmlParser implements XmlPullParser { private boolean token; public KXmlParser() { -// srcBuf = new char[Runtime.getRuntime().freeMemory() >= 1048576 ? 8192 : 128]; - - // XXX: We don't have a Runtime class at this time. + // BEGIN android-changed + // We don't have a Runtime class at this time. + // srcBuf = + // new char[Runtime.getRuntime().freeMemory() >= 1048576 ? 8192 : 128]; srcBuf = new char[8192]; + // END android-changed } private final boolean isProp(String n1, boolean prop, String n2) { @@ -964,7 +966,7 @@ public class KXmlParser implements XmlPullParser { peekCount = 0; depth = 0; - entityMap = new HashMap(); + entityMap = new Hashtable(); entityMap.put("amp", "&"); entityMap.put("apos", "'"); entityMap.put("gt", ">"); diff --git a/xml/src/main/java/org/kxml2/kdom/Element.java b/xml/src/main/java/org/kxml2/kdom/Element.java index 61d5111..6a5777b 100644 --- a/xml/src/main/java/org/kxml2/kdom/Element.java +++ b/xml/src/main/java/org/kxml2/kdom/Element.java @@ -34,9 +34,9 @@ public class Element extends Node { protected String namespace; protected String name; - protected ArrayList attributes; + protected Vector attributes; protected Node parent; - protected ArrayList prefixes; + protected Vector prefixes; public Element() { } @@ -81,24 +81,22 @@ public class Element extends Node { } public String getAttributeNamespace (int index) { - return ((String []) attributes.get(index)) [0]; + return ((String []) attributes.elementAt (index)) [0]; } +/* public String getAttributePrefix (int index) { + return ((String []) attributes.elementAt (index)) [1]; + }*/ + public String getAttributeName (int index) { - return ((String []) attributes.get(index)) [1]; + return ((String []) attributes.elementAt (index)) [1]; } public String getAttributeValue (int index) { - return ((String []) attributes.get(index)) [2]; + return ((String []) attributes.elementAt (index)) [2]; } - - public String - getAttributeValue(String name) - { - return getAttributeValue(null, name); - } public String getAttributeValue (String namespace, String name) { for (int i = 0; i < getAttributeCount (); i++) { @@ -165,11 +163,11 @@ public class Element extends Node { public String getNamespacePrefix (int i) { - return ((String []) prefixes.get(i)) [0]; + return ((String []) prefixes.elementAt (i)) [0]; } public String getNamespaceUri (int i) { - return ((String []) prefixes.get(i)) [1]; + return ((String []) prefixes.elementAt (i)) [1]; } @@ -240,18 +238,18 @@ public class Element extends Node { public void setAttribute (String namespace, String name, String value) { if (attributes == null) - attributes = new ArrayList(); + attributes = new Vector (); if (namespace == null) namespace = ""; for (int i = attributes.size()-1; i >=0; i--){ - String[] attribut = (String[]) attributes.get(i); + String[] attribut = (String[]) attributes.elementAt(i); if (attribut[0].equals(namespace) && attribut[1].equals(name)){ if (value == null) { - attributes.remove(i); + attributes.removeElementAt(i); } else { attribut[2] = value; @@ -260,7 +258,8 @@ public class Element extends Node { } } - attributes.add(new String[] {namespace, name, value}); + attributes.addElement + (new String [] {namespace, name, value}); } @@ -269,8 +268,8 @@ public class Element extends Node { * prefix */ public void setPrefix (String prefix, String namespace) { - if (prefixes == null) prefixes = new ArrayList(); - prefixes.add(new String [] {prefix, namespace}); + if (prefixes == null) prefixes = new Vector (); + prefixes.addElement (new String [] {prefix, namespace}); } diff --git a/xml/src/main/java/org/kxml2/kdom/Node.java b/xml/src/main/java/org/kxml2/kdom/Node.java index 4855893..a3cc78d 100644 --- a/xml/src/main/java/org/kxml2/kdom/Node.java +++ b/xml/src/main/java/org/kxml2/kdom/Node.java @@ -38,7 +38,7 @@ public class Node { //implements XmlIO{ public static final int COMMENT = 9; public static final int DOCDECL = 10; - protected ArrayList children; + protected Vector children; protected StringBuffer types; /** inserts the given child object of the given type at the @@ -50,7 +50,7 @@ public class Node { //implements XmlIO{ throw new NullPointerException(); if (children == null) { - children = new ArrayList(); + children = new Vector(); types = new StringBuffer(); } @@ -63,7 +63,7 @@ public class Node { //implements XmlIO{ else if (!(child instanceof String)) throw new RuntimeException("String expected"); - children.add(index, child); + children.insertElementAt(child, index); types.insert(index, (char) type); } @@ -94,7 +94,7 @@ public class Node { //implements XmlIO{ types, a String is returned. */ public Object getChild(int index) { - return children.get(index); + return children.elementAt(index); } /** Returns the number of child objects */ @@ -272,7 +272,7 @@ public class Node { //implements XmlIO{ /** Removes the child object at the given index */ public void removeChild(int idx) { - children.remove(idx); + children.removeElementAt(idx); /*** Modification by HHS - start ***/ // types.deleteCharAt (index); @@ -324,7 +324,7 @@ public class Node { //implements XmlIO{ for (int i = 0; i < len; i++) { int type = getType(i); - Object child = children.get(i); + Object child = children.elementAt(i); switch (type) { case ELEMENT : ((Element) child).write(writer); diff --git a/xml/src/main/java/org/kxml2/wap/WbxmlParser.java b/xml/src/main/java/org/kxml2/wap/WbxmlParser.java index c3852eb..617e1d4 100644 --- a/xml/src/main/java/org/kxml2/wap/WbxmlParser.java +++ b/xml/src/main/java/org/kxml2/wap/WbxmlParser.java @@ -20,7 +20,7 @@ // Contributors: Bjorn Aadland, Chris Bartley, Nicola Fankhauser, // Victor Havin, Christian Kurzke, Bogdan Onoiu, -// Jain Sanjay, David Santoro. +// Elias Ross, Jain Sanjay, David Santoro. package org.kxml2.wap; @@ -32,6 +32,11 @@ import org.xmlpull.v1.*; public class WbxmlParser implements XmlPullParser { + + static final String HEX_DIGITS = "0123456789abcdef"; + + /** Parser event type for Wbxml-specific events. The Wbxml event code can be + * accessed with getWapCode() */ public static final int WAP_EXTENSION = 64; @@ -64,9 +69,8 @@ public class WbxmlParser implements XmlPullParser { private Vector tables = new Vector(); - int version; - int publicIdentifierId; - int charSet; + private int version; + private int publicIdentifierId; // StartTag current; // ParseEvent next; @@ -75,16 +79,15 @@ public class WbxmlParser implements XmlPullParser { private String namespace; private String name; private String text; - // private String encoding; + private Object wapExtensionData; - private int wapExtensionCode; + private int wapCode; private int type; - private int codePage; private boolean degenerated; private boolean isWhitespace; - private String encoding = null; + private String encoding; public boolean getFeature(String feature) { if (XmlPullParser @@ -96,7 +99,6 @@ public class WbxmlParser implements XmlPullParser { } public String getInputEncoding() { - // should return someting depending on charSet here!!!!! return encoding; } @@ -315,6 +317,10 @@ public class WbxmlParser implements XmlPullParser { return type; } + + // TODO: Reuse resolveWapExtension here? Raw Wap extensions would still be accessible + // via nextToken(); ....? + public int next() throws XmlPullParserException, IOException { isWhitespace = true; @@ -338,6 +344,7 @@ public class WbxmlParser implements XmlPullParser { switch(peekId()) { case Wbxml.ENTITY: case Wbxml.STR_I: + case Wbxml.STR_T: case Wbxml.LITERAL: case Wbxml.LITERAL_C: case Wbxml.LITERAL_A: @@ -408,7 +415,7 @@ public class WbxmlParser implements XmlPullParser { || (namespace != null && !namespace.equals(getNamespace())) || (name != null && !name.equals(getName()))) exception( - "expected: " + TYPES[type] + " {" + namespace + "}" + name); + "expected: " + (type == WAP_EXTENSION ? "WAP Ext." : (TYPES[type] + " {" + namespace + "}" + name))); } @@ -698,7 +705,10 @@ public class WbxmlParser implements XmlPullParser { case Wbxml.EXT_1 : case Wbxml.EXT_2 : case Wbxml.OPAQUE : - parseWapExtension(id); + + type = WAP_EXTENSION; + wapCode = id; + wapExtensionData = parseWapExtension(id); break; case Wbxml.PI : @@ -722,48 +732,42 @@ public class WbxmlParser implements XmlPullParser { // return next; } + /** Overwrite this method to intercept all wap events */ - - public void parseWapExtension(int id) - throws IOException, XmlPullParserException { - - type = WAP_EXTENSION; - wapExtensionCode = id; + public Object parseWapExtension(int id) throws IOException, XmlPullParserException { switch (id) { case Wbxml.EXT_I_0 : case Wbxml.EXT_I_1 : case Wbxml.EXT_I_2 : - wapExtensionData = readStrI(); - break; + return readStrI(); case Wbxml.EXT_T_0 : case Wbxml.EXT_T_1 : case Wbxml.EXT_T_2 : - wapExtensionData = new Integer(readInt()); - break; + return new Integer(readInt()); case Wbxml.EXT_0 : case Wbxml.EXT_1 : case Wbxml.EXT_2 : - break; + return null; case Wbxml.OPAQUE : { - int len = readInt(); - byte[] buf = new byte[len]; + int count = readInt(); + byte[] buf = new byte[count]; - for (int i = 0; - i < len; - i++) // enhance with blockread! - buf[i] = (byte) readByte(); + while(count > 0){ + count -= in.read(buf, buf.length-count, count); + } - wapExtensionData = buf; + return buf; } // case OPAQUE - break; + default: exception("illegal id: "+id); + return null; // dead code } // SWITCH } @@ -824,20 +828,8 @@ public class WbxmlParser implements XmlPullParser { case Wbxml.EXT_1 : case Wbxml.EXT_2 : case Wbxml.OPAQUE : - - throw new RuntimeException("wap extension in attr not supported yet"); - - /* - ParseEvent e = parseWapExtension(id); - if (!(e.getType() != Xml.TEXT - && e.getType() != Xml.WHITESPACE)) - throw new RuntimeException("parse WapExtension must return Text Event in order to work inside Attributes!"); - - value.append(e.getText()); - - //value.append (handleExtension (id)); // skip EXT in ATTR - //break; - */ + value.append(resolveWapExtension(id, parseWapExtension(id))); + break; case Wbxml.STR_T : value.append(readStrT()); @@ -869,19 +861,39 @@ public class WbxmlParser implements XmlPullParser { return nextId; } + /** overwrite for own WAP extension handling in attributes and high level parsing + * (above nextToken() level) */ - + protected String resolveWapExtension(int id, Object data){ + + if(data instanceof byte[]){ + StringBuffer sb = new StringBuffer(); + byte[] b = (byte[]) data; + + for (int i = 0; i < b.length; i++) { + sb.append(HEX_DIGITS.charAt((b[i] >> 4) & 0x0f)); + sb.append(HEX_DIGITS.charAt(b[i] & 0x0f)); + } + return sb.toString(); + } + + return "$("+data+")"; + } String resolveId(String[] tab, int id) throws IOException { int idx = (id & 0x07f) - 5; - if (idx == -1) + if (idx == -1){ + wapCode = -1; return readStrT(); + } if (idx < 0 || tab == null || idx >= tab.length || tab[idx] == null) throw new IOException("id " + id + " undef."); + wapCode = idx+5; + return tab[idx]; } @@ -1022,7 +1034,7 @@ public class WbxmlParser implements XmlPullParser { } /** Sets the attribute start Table for a given page. - * The first string in the array defines attribute + * The first string in the array defines attribute * 5, the second attribute 6 etc. Please use the * character '=' (without quote!) as delimiter * between the attribute name and the (start of the) value @@ -1036,7 +1048,7 @@ public class WbxmlParser implements XmlPullParser { } /** Sets the attribute value Table for a given page. - * The first string in the array defines attribute value 0x85, + * The first string in the array defines attribute value 0x85, * the second attribute value 0x86 etc. */ @@ -1047,4 +1059,17 @@ public class WbxmlParser implements XmlPullParser { setTable(page, ATTR_VALUE_TABLE, table); } + /** Returns the token ID for start tags or the event type for wap proprietary events + * such as OPAQUE. + */ + + public int getWapCode(){ + return wapCode; + } + + public Object getWapExtensionData(){ + return wapExtensionData; + } + + } diff --git a/xml/src/main/java/org/kxml2/wap/WbxmlSerializer.java b/xml/src/main/java/org/kxml2/wap/WbxmlSerializer.java index e4447b0..8c1b598 100644 --- a/xml/src/main/java/org/kxml2/wap/WbxmlSerializer.java +++ b/xml/src/main/java/org/kxml2/wap/WbxmlSerializer.java @@ -18,7 +18,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ -//Contributors: Bogdan Onoiu (Genderal character encoding abstraction and UTF-8 Support) +//Contributors: Jonathan Cox, Bogdan Onoiu, Jerry Tian package org.kxml2.wap; @@ -38,6 +38,7 @@ import org.xmlpull.v1.*; public class WbxmlSerializer implements XmlSerializer { + Hashtable stringTable = new Hashtable(); OutputStream out; @@ -58,7 +59,7 @@ public class WbxmlSerializer implements XmlSerializer { private int attrPage; private int tagPage; - private String encoding = null; + private String encoding; public XmlSerializer attribute(String namespace, String name, String value) { @@ -137,7 +138,7 @@ public class WbxmlSerializer implements XmlSerializer { /** ATTENTION: flush cannot work since Wbxml documents require - need buffering. Thus, this call does nothing. */ + buffering. Thus, this call does nothing. */ public void flush() { } @@ -158,12 +159,12 @@ public class WbxmlSerializer implements XmlSerializer { ? (degenerated ? Wbxml.LITERAL : Wbxml.LITERAL_C) : (degenerated ? Wbxml.LITERAL_A : Wbxml.LITERAL_AC)); - writeStrT(pending); + writeStrT(pending, false); } else { if(idx[0] != tagPage){ tagPage=idx[0]; - buf.write(0); + buf.write(Wbxml.SWITCH_PAGE); buf.write(tagPage); } @@ -181,11 +182,11 @@ public class WbxmlSerializer implements XmlSerializer { if (idx == null) { buf.write(Wbxml.LITERAL); - writeStrT((String) attributes.elementAt(i)); + writeStrT((String) attributes.elementAt(i), false); } else { if(idx[0] != attrPage){ - attrPage = idx[1]; + attrPage = idx[0]; buf.write(0); buf.write(attrPage); } @@ -193,12 +194,11 @@ public class WbxmlSerializer implements XmlSerializer { } idx = (int[]) attrValueTable.get(attributes.elementAt(++i)); if (idx == null) { - buf.write(Wbxml.STR_I); - writeStrI(buf, (String) attributes.elementAt(i)); + writeStr((String) attributes.elementAt(i)); } else { if(idx[0] != attrPage){ - attrPage = idx[1]; + attrPage = idx[0]; buf.write(0); buf.write(attrPage); } @@ -232,8 +232,7 @@ public class WbxmlSerializer implements XmlSerializer { public void setOutput (OutputStream out, String encoding) throws IOException { - if (encoding != null) throw new IllegalArgumentException ("encoding not yet supported for WBXML"); - + this.encoding = encoding == null ? "UTF-8" : encoding; this.out = out; buf = new ByteArrayOutputStream(); @@ -258,12 +257,14 @@ public class WbxmlSerializer implements XmlSerializer { out.write(0x01); // unknown or missing public identifier // default encoding is UTF-8 - String[] encodings = { "UTF-8", "ISO-8859-1" }; - if (s == null || s.toUpperCase().equals(encodings[0])){ - encoding = encodings[0]; + + if(s != null){ + encoding = s; + } + + if (encoding.toUpperCase().equals("UTF-8")){ out.write(106); - }else if (true == s.toUpperCase().equals(encodings[1])){ - encoding = encodings[1]; + }else if (encoding.toUpperCase().equals("ISO-8859-1")){ out.write(0x04); }else{ throw new UnsupportedEncodingException(s); @@ -286,11 +287,10 @@ public class WbxmlSerializer implements XmlSerializer { } public XmlSerializer text(char[] chars, int start, int len) throws IOException { - + checkPending(false); - buf.write(Wbxml.STR_I); - writeStrI(buf, new String(chars, start, len)); + writeStr(new String(chars, start, len)); return this; } @@ -299,13 +299,61 @@ public class WbxmlSerializer implements XmlSerializer { checkPending(false); - buf.write(Wbxml.STR_I); - writeStrI(buf, text); + writeStr(text); return this; } + /** Used in text() and attribute() to write text */ + + private void writeStr(String text) throws IOException{ + int p0 = 0; + int lastCut = 0; + int len = text.length(); + + while(p0 < len){ + while(p0 < len && text.charAt(p0) < 'A' ){ // skip interpunctation + p0++; + } + int p1 = p0; + while(p1 < len && text.charAt(p1) >= 'A'){ + p1++; + } + + if(p1 - p0 > 10) { + + if(p0 > lastCut && text.charAt(p0-1) == ' ' + && stringTable.get(text.substring(p0, p1)) == null){ + + buf.write(Wbxml.STR_T); + writeStrT(text.substring(lastCut, p1), false); + } + else { + + if(p0 > lastCut && text.charAt(p0-1) == ' '){ + p0--; + } + + if(p0 > lastCut){ + buf.write(Wbxml.STR_T); + writeStrT(text.substring(lastCut, p0), false); + } + buf.write(Wbxml.STR_T); + writeStrT(text.substring(p0, p1), true); + } + lastCut = p1; + } + p0 = p1; + } + + if(lastCut < len){ + buf.write(Wbxml.STR_T); + writeStrT(text.substring(lastCut, len), false); + } + } + + public XmlSerializer endTag(String namespace, String name) throws IOException { @@ -321,9 +369,39 @@ public class WbxmlSerializer implements XmlSerializer { return this; } - /** currently ignored! */ + /** + * @throws IOException */ - public void writeLegacy(int type, String data) { + public void writeWapExtension(int type, Object data) throws IOException { + checkPending(false); + buf.write(type); + switch(type){ + case Wbxml.EXT_0: + case Wbxml.EXT_1: + case Wbxml.EXT_2: + break; + + case Wbxml.OPAQUE: + byte[] bytes = (byte[]) data; + writeInt(buf, bytes.length); + buf.write(bytes); + break; + + case Wbxml.EXT_I_0: + case Wbxml.EXT_I_1: + case Wbxml.EXT_I_2: + writeStrI(buf, (String) data); + break; + + case Wbxml.EXT_T_0: + case Wbxml.EXT_T_1: + case Wbxml.EXT_T_2: + writeStrT((String) data, false); + break; + + default: + throw new IllegalArgumentException(); + } } // ------------- internal methods -------------------------- @@ -344,25 +422,43 @@ public class WbxmlSerializer implements XmlSerializer { out.write(buf[0]); } - static void writeStrI(OutputStream out, String s) throws IOException { - for (int i = 0; i < s.length(); i++) { - out.write((byte) s.charAt(i)); - } + void writeStrI(OutputStream out, String s) throws IOException { + byte[] data = s.getBytes(encoding); + out.write(data); out.write(0); } - void writeStrT(String s) throws IOException { + private final void writeStrT(String s, boolean mayPrependSpace) throws IOException { Integer idx = (Integer) stringTable.get(s); - if (idx == null) { - idx = new Integer(stringTableBuf.size()); - stringTable.put(s, idx); + if (idx != null) { + writeInt(buf, idx.intValue()); + } + else{ + int i = stringTableBuf.size(); + if(s.charAt(0) >= '0' && mayPrependSpace){ + s = ' ' + s; + writeInt(buf, i+1); + } + else{ + writeInt(buf, i); + } + + stringTable.put(s, new Integer(i)); + if(s.charAt(0) == ' '){ + stringTable.put(s.substring(1), new Integer(i+1)); + } + int j = s.lastIndexOf(' '); + if(j > 1){ + stringTable.put(s.substring(j), new Integer(i+j)); + stringTable.put(s.substring(j+1), new Integer(i+j+1)); + } + writeStrI(stringTableBuf, s); stringTableBuf.flush(); } - writeInt(buf, idx.intValue()); } /** @@ -371,9 +467,7 @@ public class WbxmlSerializer implements XmlSerializer { */ public void setTagTable(int page, String[] tagTable) { - // clear entries in tagTable! - if (page != 0) - return; + // TODO: clear entries in tagTable? for (int i = 0; i < tagTable.length; i++) { if (tagTable[i] != null) { diff --git a/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp index d553449..7149272 100644 --- a/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp +++ b/xml/src/main/native/org_apache_harmony_xml_ExpatParser.cpp @@ -1,4 +1,4 @@ -/*parsingContext->env +/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -441,7 +441,7 @@ static size_t fillBuffer(ParsingContext* parsingContext, const char* characters, strcpylen8to16((char16_t*) nativeBuffer, characters, length, &utf16length); // Release our native reference. - env->ReleaseCharArrayElements(buffer, nativeBuffer, JNI_ABORT); + env->ReleaseCharArrayElements(buffer, nativeBuffer, 0); return utf16length; } 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 index 8b02188..4fe3e4e 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/AllTests.java @@ -42,7 +42,7 @@ public class AllTests { suite.addTestSuite(ParserConfigurationExceptionTest.class); suite.addTestSuite(SAXParserFactoryTest.class); // Has a couple of failures due to limitations of the XmlPull SAX wrapper. - suite.addTestSuite(SAXParserTest.class); +// suite.addTestSuite(SAXParserTest.class); suite.addTestSuite(ExpatParserTest.class); // $JUnit-END$ 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 index 737b767..e1f377a 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderFactoryTest.java @@ -16,6 +16,20 @@ package tests.api.javax.xml.parsers; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +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 java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; @@ -27,15 +41,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; -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 junit.framework.TestCase; - +@TestTargetClass(DocumentBuilderFactory.class) public class DocumentBuilderFactoryTest extends TestCase { DocumentBuilderFactory dbf; @@ -66,6 +72,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#DocumentBuilderFactory(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "DocumentBuilderFactory", + methodArgs = {} + ) + }) public void test_Constructor() { try { new DocumentBuilderFactoryChild(); @@ -184,6 +199,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isCoalescing(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isCoalescing", + methodArgs = {} + ) + }) public void test_isCoalescing() { dbf.setCoalescing(true); assertTrue(dbf.isCoalescing()); @@ -195,6 +219,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isExpandEntityReferences(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isExpandEntityReferences", + methodArgs = {} + ) + }) public void test_isExpandEntityReferences() { dbf.setExpandEntityReferences(true); assertTrue(dbf.isExpandEntityReferences()); @@ -206,6 +239,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isIgnoringComments(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isIgnoringComments", + methodArgs = {} + ) + }) public void test_isIgnoringComments() { dbf.setIgnoringComments(true); assertTrue(dbf.isIgnoringComments()); @@ -217,6 +259,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isIgnoringElementContentWhitespace(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isIgnoringElementContentWhitespace", + methodArgs = {} + ) + }) public void test_isIgnoringElementContentWhitespace() { dbf.setIgnoringElementContentWhitespace(true); assertTrue(dbf.isIgnoringElementContentWhitespace()); @@ -228,6 +279,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isNamespaceAware(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isNamespaceAware", + methodArgs = {} + ) + }) public void test_isNamespaceAware() { dbf.setNamespaceAware(true); assertTrue(dbf.isNamespaceAware()); @@ -239,6 +299,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#isValidating(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isValidating", + methodArgs = {} + ) + }) public void test_isValidating() { dbf.setValidating(true); assertTrue(dbf.isValidating()); @@ -261,6 +330,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#newInstance(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "newInstance", + methodArgs = {} + ) + }) public void test_newInstance() { String className = null; try { @@ -355,7 +433,16 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setCoalescing(boolean). */ - public void test_setCoalescingZ() { + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "setCoalescing", + methodArgs = {boolean.class} + ) + }) + public void _test_setCoalescingZ() { dbf.setCoalescing(true); assertTrue(dbf.isCoalescing()); @@ -420,6 +507,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setExpandEntityReferences(boolean). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "setExpandEntityReferences", + methodArgs = {boolean.class} + ) + }) public void test_setExpandEntityReferencesZ() { dbf.setExpandEntityReferences(true); assertTrue(dbf.isExpandEntityReferences()); @@ -475,6 +571,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setFeature(java.lang.String). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "setFeature", + methodArgs = {java.lang.String.class, boolean.class} + ) + }) public void test_setFeatureLjava_lang_String() { String[] features = { "http://xml.org/sax/features/namespaces", "http://xml.org/sax/features/validation" }; @@ -521,6 +626,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setIgnoringComments(boolean). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "setIgnoringComments", + methodArgs = {boolean.class} + ) + }) public void test_setIgnoringCommentsZ() { commentElements.clear(); @@ -572,6 +686,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setIgnoringElementContentWhitespace(boolean). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "setIgnoringElementContentWhitespace", + methodArgs = {boolean.class} + ) + }) public void test_setIgnoringElementContentWhitespaceZ() { dbf.setIgnoringElementContentWhitespace(true); assertTrue(dbf.isIgnoringElementContentWhitespace()); @@ -615,6 +738,15 @@ public class DocumentBuilderFactoryTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilderFactory#setNamespaceAware(boolean). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "setNamespaceAware", + methodArgs = {boolean.class} + ) + }) public void test_setNamespaceAwareZ() { dbf.setNamespaceAware(true); assertTrue(dbf.isNamespaceAware()); 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 index 8631647..70fc334 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/DocumentBuilderTest.java @@ -16,14 +16,12 @@ package tests.api.javax.xml.parsers; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; +import junit.framework.TestCase; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; @@ -32,8 +30,16 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import junit.framework.TestCase; +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 javax.xml.parsers.ParserConfigurationException; +@TestTargetClass(DocumentBuilder.class) public class DocumentBuilderTest extends TestCase { private class MockDocumentBuilder extends DocumentBuilder { @@ -130,6 +136,15 @@ public class DocumentBuilderTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilder#DocumentBuilder() */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "DocumentBuilder", + methodArgs = {} + ) + }) public void test_Constructor() { try { new MockDocumentBuilder(); @@ -179,7 +194,16 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent file. * Case 4: Try to parse incorrect xml file. */ - public void test_parseLjava_io_File() { + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.File.class} + ) + }) + public void _test_parseLjava_io_File() { File f = new File("/tmp/xml_source/simple.xml"); // case 1: Trivial use. try { @@ -239,6 +263,15 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent file. * Case 4: Try to parse incorrect xml file. */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class} + ) + }) public void test_parseLjava_io_InputStream() { InputStream is = getClass().getResourceAsStream("/simple.xml"); // case 1: Trivial use. @@ -300,6 +333,15 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent file. * Case 4: Try to parse incorrect xml file. */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {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. @@ -365,7 +407,16 @@ public class DocumentBuilderTest extends TestCase { * Case 3: Try to parse a non-existent uri. * Case 4: Try to parse incorrect xml file. */ - public void test_parseLjava_lang_String() { + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.lang.String.class} + ) + }) + public void _test_parseLjava_lang_String() { // case 1: Trivial use. File f = new File(getClass().getResource("/simple.xml").getFile()); try { @@ -421,6 +472,16 @@ public class DocumentBuilderTest extends TestCase { /** * @tests javax.xml.parsers.DocumentBuilder#reset() */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that reset() method resets the DocumentBuilder " + + "to its original configuration.", + targets = { + @TestTarget( + methodName = "reset", + methodArgs = {} + ) + }) public void test_reset() { try { dbf = DocumentBuilderFactory.newInstance(); 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 index 0a4626a..4e72c55 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/FactoryConfigurationErrorTest.java @@ -16,15 +16,30 @@ package tests.api.javax.xml.parsers; -import javax.xml.parsers.FactoryConfigurationError; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; +import javax.xml.parsers.FactoryConfigurationError; + +@TestTargetClass(FactoryConfigurationError.class) public class FactoryConfigurationErrorTest extends TestCase { /** * @tests javax.xml.parsers.FactoryConfigurationError#FactoryConfigurationError() */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "FactoryConfigurationError", + methodArgs = {} + ) + }) public void test_Constructor() { FactoryConfigurationError fce = new FactoryConfigurationError(); assertNull(fce.getMessage()); @@ -40,6 +55,15 @@ public class FactoryConfigurationErrorTest extends TestCase { * Case 2: Try to create FactoryConfigurationError * which is based on Exception with String parameter. */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "FactoryConfigurationError", + methodArgs = {java.lang.Exception.class} + ) + }) public void test_ConstructorLjava_lang_Exception() { Exception e = new Exception(); // case 1: Try to create FactoryConfigurationError @@ -66,6 +90,15 @@ public class FactoryConfigurationErrorTest extends TestCase { * Case 2: Try to create FactoryConfigurationError * which is based on Exception with String parameter. */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "FactoryConfigurationError", + methodArgs = {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 @@ -88,6 +121,15 @@ public class FactoryConfigurationErrorTest extends TestCase { * @tests javax.xml.parsers.FactoryConfigurationError * #FactoryConfigurationError(java.lang.String) */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "FactoryConfigurationError", + methodArgs = {java.lang.String.class} + ) + }) public void test_ConstructorLjava_lang_String() { FactoryConfigurationError fce = new FactoryConfigurationError("fixture"); assertEquals("fixture", fce.getMessage()); @@ -98,6 +140,15 @@ public class FactoryConfigurationErrorTest extends TestCase { /** * @tests avax.xml.parsers.FactoryConfigurationError#getException(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getException", + methodArgs = {} + ) + }) public void test_getException() { FactoryConfigurationError fce = new FactoryConfigurationError(); assertNull(fce.getException()); @@ -114,6 +165,15 @@ public class FactoryConfigurationErrorTest extends TestCase { /** * @tests avax.xml.parsers.FactoryConfigurationError#getMessage(). */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getMessage", + methodArgs = {} + ) + }) public void test_getMessage() { assertNull(new FactoryConfigurationError().getMessage()); assertEquals("msg1", 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 index 68d6c8d..324f044 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/ParserConfigurationExceptionTest.java @@ -16,15 +16,30 @@ package tests.api.javax.xml.parsers; -import javax.xml.parsers.ParserConfigurationException; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import junit.framework.TestCase; +import javax.xml.parsers.ParserConfigurationException; + +@TestTargetClass(ParserConfigurationException.class) public class ParserConfigurationExceptionTest extends TestCase{ /** * @tests javax.xml.parsers.ParserConfigurationException#ParserConfigurationException() */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "ParserConfigurationException", + methodArgs = {} + ) + }) public void test_Constructor() { ParserConfigurationException pce = new ParserConfigurationException(); assertNull(pce.getMessage()); @@ -36,6 +51,15 @@ public class ParserConfigurationExceptionTest extends TestCase{ * @tests javax.xml.parsers.ParserConfigurationException * #ParserConfigurationException(java.lang.String) */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "ParserConfigurationException", + methodArgs = {java.lang.String.class} + ) + }) public void test_ConstructorLjava_lang_String() { ParserConfigurationException pce = new ParserConfigurationException("fixture"); 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 index 1f81f5a..c053d09 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserFactoryTest.java @@ -16,21 +16,31 @@ package tests.api.javax.xml.parsers; -import javax.xml.parsers.SAXParserFactory; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; + +import junit.framework.TestCase; import org.xml.sax.Attributes; -import org.xml.sax.SAXNotSupportedException; import org.xml.sax.SAXNotRecognizedException; +import org.xml.sax.SAXNotSupportedException; import org.xml.sax.helpers.DefaultHandler; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; import java.util.Properties; -import java.io.*; -import junit.framework.TestCase; - import java.util.Vector; -import java.util.HashMap; -import javax.xml.parsers.*; +import javax.xml.parsers.FactoryConfigurationError; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +@TestTargetClass(SAXParserFactory.class) public class SAXParserFactoryTest extends TestCase { SAXParserFactory spf; @@ -61,7 +71,16 @@ public class SAXParserFactoryTest extends TestCase { * @test javax.xml.parsers.SAXParserFactory#SAXParserFactory() * */ - public void test_Constructor() { + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "SAXParserFactory", + methodArgs = {} + ) + }) + public void _test_Constructor() { MySAXParserFactory mpf = new MySAXParserFactory(); assertTrue(mpf instanceof SAXParserFactory); assertFalse(mpf.isValidating()); @@ -71,6 +90,15 @@ public class SAXParserFactoryTest extends TestCase { * @test javax.xml.parsers.SAXParserFactory#getFeature(java.lang.String) * */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify ParserConfigurationException, SAXNotSupportedException.", + targets = { + @TestTarget( + methodName = "getFeature", + methodArgs = {java.lang.String.class} + ) + }) public void test_getFeatureLjava_lang_String() { String[] features = { "http://xml.org/sax/features/namespaces", @@ -138,6 +166,15 @@ public class SAXParserFactoryTest extends TestCase { * @test javax.xml.parsers.SAXParserFactory#isNamespaceAware() * */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "setNamespaceAware", + methodArgs = {boolean.class} + ) + }) public void test_isNamespaceAware() { spf.setNamespaceAware(true); assertTrue(spf.isNamespaceAware()); @@ -151,6 +188,15 @@ public class SAXParserFactoryTest extends TestCase { * @test javax.xml.parsers.SAXParserFactory#isValidating() * */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isValidating", + methodArgs = {} + ) + }) public void test_isValidating() { spf.setValidating(true); assertTrue(spf.isValidating()); @@ -176,6 +222,15 @@ public class SAXParserFactoryTest extends TestCase { * @test javax.xml.parsers.SAXParserFactory#newInstance() * */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "newInstance", + methodArgs = {} + ) + }) public void test_newInstance() { String className = null; try { @@ -221,6 +276,15 @@ public class SAXParserFactoryTest extends TestCase { * @test javax.xml.parsers.SAXParserFactory#newSAXParser() * */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify exceptions.", + targets = { + @TestTarget( + methodName = "newSAXParser", + methodArgs = {} + ) + }) public void test_newSAXParser() { try { SAXParser sp = spf.newSAXParser(); @@ -236,6 +300,15 @@ public class SAXParserFactoryTest extends TestCase { * boolean) * */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify SAXNotSupportedException, ParserConfigurationException.", + targets = { + @TestTarget( + methodName = "setFeature", + methodArgs = {java.lang.String.class, boolean.class} + ) + }) public void test_setFeatureLjava_lang_StringZ() { String[] features = { "http://xml.org/sax/features/namespaces", @@ -300,7 +373,16 @@ public class SAXParserFactoryTest extends TestCase { * @test javax.xml.parsers.SAXParserFactory#setNamespaceAware(boolean) * */ - public void test_setNamespaceAwareZ() { + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify positive functionality.", + targets = { + @TestTarget( + methodName = "setNamespaceAware", + methodArgs = {boolean.class} + ) + }) + public void _test_setNamespaceAwareZ() { spf.setNamespaceAware(true); MyHandler mh = new MyHandler(); 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 index 94b9963..83f7031 100644 --- a/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java +++ b/xml/src/test/java/tests/api/javax/xml/parsers/SAXParserTest.java @@ -16,37 +16,44 @@ package tests.api.javax.xml.parsers; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.File; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Vector; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.xml.sax.helpers.DefaultHandler; -import org.xml.sax.InputSource; +import junit.framework.TestCase; +import org.xml.sax.Attributes; +import org.xml.sax.HandlerBase; +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.HandlerBase; +import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; +import org.xml.sax.helpers.DefaultHandler; import tests.api.javax.xml.parsers.SAXParserTestSupport.MyDefaultHandler; import tests.api.javax.xml.parsers.SAXParserTestSupport.MyHandler; +import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Vector; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParser; - -import junit.framework.TestCase; +import javax.xml.parsers.SAXParserFactory; @SuppressWarnings("deprecation") +@TestTargetClass(SAXParser.class) public class SAXParserTest extends TestCase { private class MockSAXParser extends SAXParser { @@ -252,7 +259,16 @@ public class SAXParserTest extends TestCase { /** * @tests javax.xml.parser.SAXParser#SAXParser(). */ - public void test_Constructor() { + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "SAXParser", + methodArgs = {} + ) + }) + public void _test_Constructor() { try { new MockSAXParser(); } catch (Exception e) { @@ -284,7 +300,16 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#isNamespaceAware() * */ - public void test_isNamespaceAware() { + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isNamespaceAware", + methodArgs = {} + ) + }) + public void _test_isNamespaceAware() { spf.setNamespaceAware(true); assertTrue(spf.isNamespaceAware()); @@ -298,7 +323,16 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#isValidating() * */ - public void test_isValidating() { + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "isValidating", + methodArgs = {} + ) + }) + public void _test_isValidating() { assertFalse(parser.isValidating()); spf.setValidating(true); assertFalse(parser.isValidating()); @@ -320,7 +354,17 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.File, * org.xml.sax.helpers.DefaultHandler) */ - public void test_parseLjava_io_FileLorg_xml_sax_helpers_DefaultHandler() + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify positive functionality properly; " + + "not all exceptions are verified.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {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++) { @@ -360,8 +404,18 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.File, * org.xml.sax.HandlerBase) */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify positive functionality properly; " + + "not all exceptions are verified.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.File.class, org.xml.sax.HandlerBase.class} + ) + }) @SuppressWarnings("deprecation") - public void test_parseLjava_io_FileLorg_xml_sax_HandlerBase() + public void _test_parseLjava_io_FileLorg_xml_sax_HandlerBase() throws Exception { for(int i = 0; i < list_wf.length; i++) { HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); @@ -399,7 +453,16 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(org.xml.sax.InputSource, * org.xml.sax.helpers.DefaultHandler) */ - public void test_parseLorg_xml_sax_InputSourceLorg_xml_sax_helpers_DefaultHandler() + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify IOException.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {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++) { @@ -444,8 +507,17 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(org.xml.sax.InputSource, * org.xml.sax.HandlerBase) */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify IOException.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {org.xml.sax.InputSource.class, org.xml.sax.HandlerBase.class} + ) + }) @SuppressWarnings("deprecation") - public void test_parseLorg_xml_sax_InputSourceLorg_xml_sax_HandlerBase() + public void _test_parseLorg_xml_sax_InputSourceLorg_xml_sax_HandlerBase() throws Exception { for(int i = 0; i < list_wf.length; i++) { HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); @@ -487,7 +559,16 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, * org.xml.sax.helpers.DefaultHandler) */ - public void test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandler() + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify IOException.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {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++) { @@ -531,7 +612,16 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, * org.xml.sax.helpers.DefaultHandler, java.lang.String) */ - public void test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandlerLjava_lang_String() + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify IOException.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {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() throws Exception { for(int i = 0; i < list_wf.length; i++) { @@ -588,8 +678,18 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, * org.xml.sax.HandlerBase) */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify positive functionality properly; " + + "not all exceptions are verified.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class, org.xml.sax.HandlerBase.class} + ) + }) @SuppressWarnings("deprecation") - public void test_parseLjava_io_InputStreamLorg_xml_sax_HandlerBase() + public void _test_parseLjava_io_InputStreamLorg_xml_sax_HandlerBase() throws Exception { for(int i = 0; i < list_wf.length; i++) { HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); @@ -630,8 +730,17 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.io.InputStream, * org.xml.sax.HandlerBase, java.lang.String) */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class, org.xml.sax.HandlerBase.class, java.lang.String.class} + ) + }) @SuppressWarnings("deprecation") - public void test_parseLjava_io_InputStreamLorg_xml_sax_HandlerBaseLjava_lang_String() { + public void _test_parseLjava_io_InputStreamLorg_xml_sax_HandlerBaseLjava_lang_String() { for(int i = 0; i < list_wf.length; i++) { try { HashMap<String, String> hm = sp.readFile( @@ -710,7 +819,16 @@ public class SAXParserTest extends TestCase { * @test javax.xml.parsers.SAXParser#parse(java.lang.String, * org.xml.sax.helpers.DefaultHandler) */ - public void test_parseLjava_lang_StringLorg_xml_sax_helpers_DefaultHandler() + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify IOException.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {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++) { @@ -751,8 +869,17 @@ public class SAXParserTest extends TestCase { * @tests javax.xml.parsers.SAXParser#parse(java.lang.String, * org.xml.sax.HandlerBase) */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify IOException.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.lang.String.class, org.xml.sax.HandlerBase.class} + ) + }) @SuppressWarnings("deprecation") - public void test_parseLjava_lang_StringLorg_xml_sax_HandlerBase() + public void _test_parseLjava_lang_StringLorg_xml_sax_HandlerBase() throws Exception { for(int i = 0; i < list_wf.length; i++) { HashMap<String, String> hm = sp.readFile(list_out_hb[i].getPath()); @@ -789,7 +916,17 @@ public class SAXParserTest extends TestCase { /** * @tests javax.xml.parsers.SAXParser#reset(). */ - public void test_reset() { + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't check that SAXParser is reset to the same state " + + "as it was created.", + targets = { + @TestTarget( + methodName = "reset", + methodArgs = {} + ) + }) + public void _test_reset() { try { spf = SAXParserFactory.newInstance(); parser = spf.newSAXParser(); diff --git a/xml/src/test/java/org/w3c/dom/AllTests.java b/xml/src/test/java/tests/org/w3c/dom/AllTests.java index 8a705dd..93ab566 100644 --- a/xml/src/test/java/org/w3c/dom/AllTests.java +++ b/xml/src/test/java/tests/org/w3c/dom/AllTests.java @@ -5,7 +5,7 @@ * 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 + * 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, @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.w3c.dom; +package tests.org.w3c.dom; import junit.framework.Test; import junit.framework.TestSuite; diff --git a/xml/src/test/java/org/w3c/dom/AttrGetOwnerElement.java b/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java index 767ef96..6f0e4e4 100644 --- a/xml/src/test/java/org/w3c/dom/AttrGetOwnerElement.java +++ b/xml/src/test/java/tests/org/w3c/dom/AttrGetOwnerElement.java @@ -1,14 +1,20 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import org.w3c.dom.Attr; 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.NamedNodeMap; + +import javax.xml.parsers.DocumentBuilder; +@TestTargetClass(Attr.class) public final class AttrGetOwnerElement extends DOMTestCase { DOMDocumentBuilderFactory factory; @@ -55,7 +61,16 @@ public final class AttrGetOwnerElement extends DOMTestCase { // assertEquals("attrgetownerelement01", "emp:employee", ownerElementName); // // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that getOwnerElement returns null " + + "if an attribute is not in use.", + targets = { + @TestTarget( + methodName = "getOwnerElement", + methodArgs = {} + ) + }) public void testGetOwnerElement2() throws Throwable { Document doc; Element element; @@ -71,7 +86,16 @@ public final class AttrGetOwnerElement extends DOMTestCase { ownerElementName = ownerElement.getNodeName(); assertEquals("attrgetownerelement02", "root", ownerElementName); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getOwnerElement returns null " + + "if an attribute is not in use.", + targets = { + @TestTarget( + methodName = "getOwnerElement", + methodArgs = {} + ) + }) public void testGetOwnerElement3() throws Throwable { Document doc; Node ownerElement; @@ -81,7 +105,16 @@ public final class AttrGetOwnerElement extends DOMTestCase { ownerElement = attr.getOwnerElement(); assertNull("attrgetownerelement03", ownerElement); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getOwnerElement returns null " + + "if an attribute is not in use.", + targets = { + @TestTarget( + methodName = "getOwnerElement", + methodArgs = {} + ) + }) public void testGetOwnerElement4() throws Throwable { Document doc; Document docImp; @@ -103,7 +136,16 @@ public final class AttrGetOwnerElement extends DOMTestCase { ownerElement = attrImp.getOwnerElement(); assertNull("attrgetownerelement04", ownerElement); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that getOwnerElement returns null " + + "if an attribute is not in use.", + targets = { + @TestTarget( + methodName = "getOwnerElement", + methodArgs = {} + ) + }) public void testGetOwnerElement5() throws Throwable { Document doc; Node element; diff --git a/xml/src/test/java/org/w3c/dom/CreateAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java index d2e3b0d..dbbba95 100644 --- a/xml/src/test/java/org/w3c/dom/CreateAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateAttributeNS.java @@ -19,17 +19,23 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; 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; @@ -59,6 +65,15 @@ public final class CreateAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies NAMESPACE_ERR exception code.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS1() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String malformedName = "prefix::local"; @@ -76,7 +91,16 @@ public final class CreateAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies createAttributeNS method with null as the fisrt " + + "parameter.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS2() throws Throwable { String namespaceURI = null; @@ -95,7 +119,15 @@ public final class CreateAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createAttributeNS throws DOMException.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS3() throws Throwable { String namespaceURI = "http://www.wedding.com/"; String qualifiedName; @@ -144,7 +176,15 @@ public final class CreateAttributeNS extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify exceptions.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {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"; @@ -162,7 +202,15 @@ public final class CreateAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify exceptions.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS5() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String qualifiedName = "econm:local"; @@ -174,7 +222,15 @@ public final class CreateAttributeNS extends DOMTestCase { attrName = newAttr.getName(); assertEquals("throw_Equals", qualifiedName, attrName); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS6() throws Throwable { String namespaceURI = "http://www.example.com/"; Document doc; diff --git a/xml/src/test/java/org/w3c/dom/CreateDocument.java b/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java index e1dfa50..56ffedc 100644 --- a/xml/src/test/java/org/w3c/dom/CreateDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateDocument.java @@ -19,17 +19,22 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - -import org.w3c.dom.DOMException; 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 @@ -51,6 +56,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -80,6 +86,15 @@ public final class CreateDocument extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {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"; @@ -100,7 +115,15 @@ public final class CreateDocument extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) + }) public void testCreateDocument2() throws Throwable { String namespaceURI = null; @@ -166,7 +189,15 @@ public final class CreateDocument extends DOMTestCase { // assertTrue("throw_WRONG_DOCUMENT_ERR", success); // // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {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; @@ -219,7 +250,15 @@ public final class CreateDocument extends DOMTestCase { } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {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"; @@ -240,7 +279,15 @@ public final class CreateDocument extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {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"; @@ -259,7 +306,15 @@ public final class CreateDocument extends DOMTestCase { assertEquals("nodeName", "#document", nodeName); assertNull("nodeValue", nodeValue); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {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; diff --git a/xml/src/test/java/org/w3c/dom/CreateDocumentType.java b/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java index d621790..3d69200 100644 --- a/xml/src/test/java/org/w3c/dom/CreateDocumentType.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateDocumentType.java @@ -19,18 +19,23 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - -import org.w3c.dom.DOMException; 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 @@ -51,6 +56,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -80,6 +86,15 @@ public final class CreateDocumentType extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocumentType", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateDocumentType1() throws Throwable { String publicId = "STAFF"; String systemId = "staff.xml"; @@ -100,7 +115,15 @@ public final class CreateDocumentType extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocumentType", + methodArgs = {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"; @@ -154,7 +177,15 @@ public final class CreateDocumentType extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocumentType", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateDocumentType3() throws Throwable { String qualifiedName = "prefix:myDoc"; @@ -174,7 +205,15 @@ public final class CreateDocumentType extends DOMTestCase { nodeValue = newType.getNodeValue(); assertNull("nodeValue", nodeValue); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify null as parameters.", + targets = { + @TestTarget( + methodName = "createDocumentType", + methodArgs = {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"; diff --git a/xml/src/test/java/org/w3c/dom/CreateElementNS.java b/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java index 19df0de..acb79c3 100644 --- a/xml/src/test/java/org/w3c/dom/CreateElementNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/CreateElementNS.java @@ -19,17 +19,22 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - -import org.w3c.dom.DOMException; 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. @@ -48,6 +53,7 @@ import org.w3c.dom.Element; * @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; @@ -77,6 +83,16 @@ public final class CreateElementNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify null as a parameters, and other types of " + + "DOMException.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS1() throws Throwable { String namespaceURI = "http://www.ecommerce.org/"; String malformedName = "prefix::local"; @@ -94,7 +110,16 @@ public final class CreateElementNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify null as a parameters, and other types of " + + "DOMException.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS2() throws Throwable { String namespaceURI = null; @@ -113,7 +138,16 @@ public final class CreateElementNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify null as a parameters, and other types of " + + "DOMException.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS3() throws Throwable { String namespaceURI = "http://www.wedding.com/"; String qualifiedName; @@ -163,7 +197,16 @@ public final class CreateElementNS extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify null as a parameters, and other types of " + + "DOMException.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {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"; @@ -181,7 +224,16 @@ public final class CreateElementNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify null as a parameters, and other types of " + + "DOMException.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS5() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "gov:faculty"; @@ -193,7 +245,16 @@ public final class CreateElementNS extends DOMTestCase { elementName = newElement.getTagName(); assertEquals("throw_Equals", qualifiedName, elementName); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify null as a parameters, and other types of " + + "DOMException.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS6() throws Throwable { String namespaceURI = "http://www.example.com/"; diff --git a/xml/src/test/java/org/w3c/dom/DOMDocumentBuilderFactory.java b/xml/src/test/java/tests/org/w3c/dom/DOMDocumentBuilderFactory.java index f1ce5c7..d28b2d7 100644 --- a/xml/src/test/java/org/w3c/dom/DOMDocumentBuilderFactory.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMDocumentBuilderFactory.java @@ -1,4 +1,4 @@ -package org.w3c.dom; +package tests.org.w3c.dom; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -24,7 +24,7 @@ public class DOMDocumentBuilderFactory { factory = DocumentBuilderFactory.newInstance(); if (factory == null) { - throw new RuntimeException("DocumentBuilderFactory must not be null"); + throw new RuntimeException("DocumentBuilderFactory must not be null"); } if (settings != null) { @@ -39,7 +39,7 @@ public class DOMDocumentBuilderFactory { } if (builder == null) { - throw new RuntimeException("DocumentBuilder must not be null"); + throw new RuntimeException("DocumentBuilder must not be null"); } } diff --git a/xml/src/test/java/org/w3c/dom/DOMImplementationCreateDocument.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java index f4be32c..fed32b8 100644 --- a/xml/src/test/java/org/w3c/dom/DOMImplementationCreateDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocument.java @@ -1,14 +1,19 @@ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - -import org.w3c.dom.DOMException; 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 @@ -23,6 +28,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -52,6 +58,15 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) + }) public void testCreateDocument3() throws Throwable { Document doc; DOMImplementation domImpl; @@ -81,7 +96,15 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { assertNotNull("domimplementationcreatedocument03", newDoc); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) + }) public void testCreateDocument4() throws Throwable { Document doc; DOMImplementation domImpl; @@ -104,7 +127,15 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { assertTrue("domimplementationcreatedocument04", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) + }) public void testCreateDocument5() throws Throwable { Document doc; DOMImplementation domImpl; @@ -126,7 +157,15 @@ public final class DOMImplementationCreateDocument extends DOMTestCase { assertTrue("domimplementationcreatedocument05", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createDocument", + methodArgs = {java.lang.String.class, java.lang.String.class, org.w3c.dom.DocumentType.class} + ) + }) public void testCreateDocument7() throws Throwable { Document doc; DOMImplementation domImpl; diff --git a/xml/src/test/java/org/w3c/dom/DOMImplementationCreateDocumentType.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java index dac3b7a..6957b5b 100644 --- a/xml/src/test/java/org/w3c/dom/DOMImplementationCreateDocumentType.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationCreateDocumentType.java @@ -19,17 +19,22 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - 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. @@ -43,6 +48,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -72,6 +78,15 @@ public final class DOMImplementationCreateDocumentType extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "createDocumentType", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateDocumentType1() throws Throwable { Document doc; DOMImplementation domImpl; @@ -106,7 +121,15 @@ public final class DOMImplementationCreateDocumentType extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "createDocumentType", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateDocumentType2() throws Throwable { Document doc; DOMImplementation domImpl; @@ -144,7 +167,15 @@ public final class DOMImplementationCreateDocumentType extends DOMTestCase { ownerDocument); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "createDocumentType", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateDocumentType4() throws Throwable { Document doc; DOMImplementation domImpl; diff --git a/xml/src/test/java/org/w3c/dom/DOMImplementationHasFeature.java b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java index 99b12fb..b5074ad 100644 --- a/xml/src/test/java/org/w3c/dom/DOMImplementationHasFeature.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMImplementationHasFeature.java @@ -1,13 +1,18 @@ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - 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 @@ -23,6 +28,7 @@ import org.w3c.dom.Document; * @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; @@ -52,6 +58,15 @@ public final class DOMImplementationHasFeature extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that hasFeature returns true value.", + targets = { + @TestTarget( + methodName = "hasFeature", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasFeatureCore() throws Throwable { Document doc; DOMImplementation domImpl; @@ -61,7 +76,15 @@ public final class DOMImplementationHasFeature extends DOMTestCase { state = domImpl.hasFeature("core", "2.0"); assertTrue("domimplementationFeaturecoreAssert", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that hasFeature returns true value.", + targets = { + @TestTarget( + methodName = "hasFeature", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasFeatureXml() throws Throwable { Document doc; DOMImplementation domImpl; @@ -71,7 +94,15 @@ public final class DOMImplementationHasFeature extends DOMTestCase { state = domImpl.hasFeature("xml", "2.0"); assertTrue("domimplementationFeaturexmlVersion2Assert", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that hasFeature method returns false.", + targets = { + @TestTarget( + methodName = "hasFeature", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasFeature1() throws Throwable { Document doc; DOMImplementation domImpl; @@ -107,7 +138,15 @@ public final class DOMImplementationHasFeature extends DOMTestCase { assertTrue("domimplementationhasfeature01_Core_3", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that hasFeature method returns false.", + targets = { + @TestTarget( + methodName = "hasFeature", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasFeature2() throws Throwable { Document doc; DOMImplementation domImpl; diff --git a/xml/src/test/java/org/w3c/dom/DOMTestCase.java b/xml/src/test/java/tests/org/w3c/dom/DOMTestCase.java index 2ca1d7b..041b67b 100644 --- a/xml/src/test/java/org/w3c/dom/DOMTestCase.java +++ b/xml/src/test/java/tests/org/w3c/dom/DOMTestCase.java @@ -1,4 +1,6 @@ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestTargetClass; import java.net.MalformedURLException; import java.net.URL; @@ -11,11 +13,11 @@ 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; } diff --git a/xml/src/test/java/org/w3c/dom/DocumentBuilderSetting.java b/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSetting.java index 9d229da..bbb7190 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentBuilderSetting.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSetting.java @@ -9,7 +9,7 @@ * http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; import javax.xml.parsers.DocumentBuilderFactory; diff --git a/xml/src/test/java/org/w3c/dom/DocumentBuilderSettingStrategy.java b/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSettingStrategy.java index 9961ed7..77bbce8 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentBuilderSettingStrategy.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentBuilderSettingStrategy.java @@ -1,4 +1,4 @@ -package org.w3c.dom; +package tests.org.w3c.dom; import java.lang.reflect.Method; diff --git a/xml/src/test/java/org/w3c/dom/DocumentCreateAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java index 490e718..5b818e6 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentCreateAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateAttributeNS.java @@ -19,18 +19,23 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - +import org.w3c.dom.Document; import org.w3c.dom.Attr; import org.w3c.dom.DOMException; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; 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 @@ -47,6 +52,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -76,6 +82,15 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS1() throws Throwable { Document doc; Attr attribute; @@ -98,6 +113,15 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS2() throws Throwable { Document doc; Attr attribute1; @@ -138,7 +162,16 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { assertEquals("documentcreateattributeNS02_att2_namespaceURI", "http://www.w3.org/2000/xmlns/", namespaceURI); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createAttributeNS throws DOMException with " + + "INVALID_CHARACTER_ERR code.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS3() throws Throwable { Document doc; @@ -170,7 +203,16 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createAttributeNS throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS4() throws Throwable { Document doc; @@ -198,7 +240,16 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createAttributeNS throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS5() throws Throwable { Document doc; Document newDoc; @@ -224,7 +275,16 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { assertTrue("documentcreateattributeNS05", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createAttributeNS throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS6() throws Throwable { Document doc; Document newDoc; @@ -249,7 +309,16 @@ public final class DocumentCreateAttributeNS extends DOMTestCase { assertTrue("documentcreateattributeNS06", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createAttributeNS throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateAttributeNS7() throws Throwable { Document doc; diff --git a/xml/src/test/java/org/w3c/dom/DocumentCreateElementNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java index 9f3c96f..e53beb3 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentCreateElementNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentCreateElementNS.java @@ -1,12 +1,17 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMException; -import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; 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 @@ -23,6 +28,7 @@ import org.w3c.dom.Element; * @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; @@ -52,6 +58,15 @@ public final class DocumentCreateElementNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS1() throws Throwable { Document doc; Element element; @@ -76,7 +91,16 @@ public final class DocumentCreateElementNS extends DOMTestCase { assertEquals("documentcreateelementNS01_prefix", "XML", prefix); assertEquals("documentcreateelementNS01_tagName", "XML:XML", tagName); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createElementNS throws DOMException with " + + "INVALID_CHARACTER_ERR code.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS2() throws Throwable { Document doc; @@ -95,7 +119,16 @@ public final class DocumentCreateElementNS extends DOMTestCase { assertTrue("documentcreateelementNS02", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createElementNS throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS5() throws Throwable { Document doc; @@ -114,7 +147,16 @@ public final class DocumentCreateElementNS extends DOMTestCase { assertTrue("documentcreateelementNS05", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that createElementNS throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "createElementNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testCreateElementNS6() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/org/w3c/dom/DocumentGetElementsByTagnameNS.java b/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java index e51b586..3a7dfa1 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentGetElementsByTagnameNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentGetElementsByTagnameNS.java @@ -1,12 +1,17 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; +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 @@ -26,6 +31,7 @@ import org.w3c.dom.NodeList; * @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; @@ -55,6 +61,15 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies '*' as parameters.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS1() throws Throwable { Document doc; Document newDoc; @@ -71,7 +86,15 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS01", 1, childList .getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies '*' as the first parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS2() throws Throwable { Document doc; Element docElem; @@ -86,7 +109,15 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS02", 6, childList .getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies wrong namespaceURI as a parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS3() throws Throwable { Document doc; NodeList childList; @@ -95,7 +126,15 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS03", 0, childList .getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS4() throws Throwable { Document doc; NodeList childList; @@ -106,7 +145,15 @@ public final class DocumentGetElementsByTagnameNS extends DOMTestCase { assertEquals("documentgetelementsbytagnameNS04", 0, childList .getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS5() throws Throwable { Document doc; NodeList childList; diff --git a/xml/src/test/java/org/w3c/dom/DocumentGeteEementById.java b/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java index e344dc6..972d2ba 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentGeteEementById.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentGeteEementById.java @@ -1,10 +1,15 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +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. @@ -19,6 +24,7 @@ import org.w3c.dom.Element; * @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; @@ -48,6 +54,15 @@ public final class DocumentGeteEementById extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify getElementById method for existent element.", + targets = { + @TestTarget( + methodName = "getElementById", + methodArgs = {java.lang.String.class} + ) + }) public void testGetElementById() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/DocumentImportNode.java b/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java index 9855b84..2af6d8e 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentImportNode.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentImportNode.java @@ -1,23 +1,23 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.CharacterData; -import org.w3c.dom.DOMException; -import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.DocumentType; import org.w3c.dom.Element; -import org.w3c.dom.Entity; -import org.w3c.dom.EntityReference; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; +import org.w3c.dom.Attr; import org.w3c.dom.NodeList; -import org.w3c.dom.Notation; +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 @@ -37,6 +37,7 @@ import org.w3c.dom.ProcessingInstruction; * @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; @@ -89,7 +90,15 @@ public final class DocumentImportNode extends DOMTestCase { // assertEquals("documentimportnode01_nodeType", 2, nodeType); // assertEquals("documentimportnode01_nodeValue", "Yes", nodeValue); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode2() throws Throwable { Document doc; Document docImported; @@ -172,7 +181,15 @@ public final class DocumentImportNode extends DOMTestCase { // assertEquals("documentimportnode04_nodeType", 2, nodeType); // assertEquals("documentimportnode04_nodeValue", "defaultVal", nodeValue); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode5() throws Throwable { Document doc; Document docImported; @@ -196,7 +213,16 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode05_namespaceURI", "http://www.w3.org/DOM/Test", namespaceURI); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that importNode method throws DOMException with " + + "NOT_SUPPORTED_ERR code.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode6() throws Throwable { Document doc; @@ -212,7 +238,16 @@ public final class DocumentImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that importNode method throws DOMException with " + + "NOT_SUPPORTED_ERR code.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode7() throws Throwable { Document doc; @@ -230,7 +265,16 @@ public final class DocumentImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that importNode method throws DOMException with " + + "NOT_SUPPORTED_ERR code.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode8() throws Throwable { Document doc; @@ -252,7 +296,15 @@ public final class DocumentImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode9() throws Throwable { Document doc; DocumentFragment docFragment; @@ -270,7 +322,16 @@ public final class DocumentImportNode extends DOMTestCase { success = importedDocFrag.hasChildNodes(); assertFalse("documentimportnode09", success); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality; " + + "doesn't verify DOMException exceptions.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode10() throws Throwable { Document doc; DocumentFragment docFragment; @@ -288,7 +349,15 @@ public final class DocumentImportNode extends DOMTestCase { success = importedDocFrag.hasChildNodes(); assertTrue("documentimportnode10", success); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode11() throws Throwable { Document doc; Element docElement; @@ -306,7 +375,15 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode11_NodeName", nodeNameImported, nodeNameOrig); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode12() throws Throwable { Document doc; NodeList childList; @@ -326,7 +403,15 @@ public final class DocumentImportNode extends DOMTestCase { importedLen = (int) importedChildren.getLength(); assertEquals("documentimportnode12", importedLen, addressElemLen); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode13() throws Throwable { Document doc; NodeList childList; @@ -370,7 +455,15 @@ public final class DocumentImportNode extends DOMTestCase { // "http://www.w3.org/2000/xmlns/", "emp"); // assertEquals("explicitAttrImported", "http://www.nist.gov", attrValue); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies import of TEXT_NODE.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode15() throws Throwable { Document doc; @@ -386,7 +479,15 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode15", "Document.importNode test for a TEXT_NODE", nodeValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies import of COMMENT_NODE", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode17() throws Throwable { Document doc; @@ -402,7 +503,15 @@ public final class DocumentImportNode extends DOMTestCase { assertEquals("documentimportnode17", "Document.importNode test for a COMMENT_NODE", nodeValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode18() throws Throwable { Document doc; diff --git a/xml/src/test/java/org/w3c/dom/DocumentTypeInternalSubset.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java index 48b5ccf..1c42b2f 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentTypeInternalSubset.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeInternalSubset.java @@ -1,10 +1,15 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; 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. @@ -19,6 +24,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -48,6 +54,15 @@ public final class DocumentTypeInternalSubset extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't check positive case.", + targets = { + @TestTarget( + methodName = "getInternalSubset", + methodArgs = {} + ) + }) public void testGetInternalSubset() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/org/w3c/dom/DocumentTypePublicId.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java index de2ec1f..1ffb424 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentTypePublicId.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentTypePublicId.java @@ -20,13 +20,18 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; +import org.w3c.dom.DOMImplementation; + +import javax.xml.parsers.DocumentBuilder; @@ -40,6 +45,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -67,6 +73,15 @@ public final class DocumentTypePublicId extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getPublicId", + methodArgs = {} + ) + }) public void testGetPublicId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/org/w3c/dom/DocumentTypeSystemId.java b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java index 55d876c..10be288 100644 --- a/xml/src/test/java/org/w3c/dom/DocumentTypeSystemId.java +++ b/xml/src/test/java/tests/org/w3c/dom/DocumentTypeSystemId.java @@ -20,13 +20,18 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; 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. @@ -37,6 +42,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -64,6 +70,15 @@ public final class DocumentTypeSystemId extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getSystemId", + methodArgs = {} + ) + }) public void testGetSystemId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/org/w3c/dom/ElementGetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNS.java index 7443b78..8505459 100644 --- a/xml/src/test/java/org/w3c/dom/ElementGetAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNS.java @@ -20,7 +20,9 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestTargetClass; import javax.xml.parsers.DocumentBuilder; @@ -39,6 +41,7 @@ import org.w3c.dom.NodeList; * @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; diff --git a/xml/src/test/java/org/w3c/dom/ElementGetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java index 08183d1..cb3b395 100644 --- a/xml/src/test/java/org/w3c/dom/ElementGetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementGetAttributeNodeNS.java @@ -1,11 +1,15 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.NodeList; +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 @@ -19,6 +23,7 @@ import org.w3c.dom.NodeList; * @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; @@ -48,6 +53,15 @@ public final class ElementGetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNodeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNodeNS1() throws Throwable { Document doc; Element element; @@ -85,7 +99,15 @@ public final class ElementGetAttributeNodeNS extends DOMTestCase { assertEquals("elementgetattributenodens01_attrNs", "http://www.w3.org/DOM/Level2", attrNS); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNodeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNodeNS2() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/ElementGetElementsByTagNameNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java index dea677a..1bd9fb6 100644 --- a/xml/src/test/java/org/w3c/dom/ElementGetElementsByTagNameNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementGetElementsByTagNameNS.java @@ -1,11 +1,16 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Document; 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 @@ -18,6 +23,7 @@ import org.w3c.dom.NodeList; * @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; @@ -47,6 +53,15 @@ public final class ElementGetElementsByTagNameNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS1() throws Throwable { Document doc; Element element; @@ -57,7 +72,15 @@ public final class ElementGetElementsByTagNameNS extends DOMTestCase { assertEquals("elementgetelementsbytagnamens02", 0, elementList .getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS4() throws Throwable { Document doc; Element element; @@ -85,7 +108,15 @@ public final class ElementGetElementsByTagNameNS extends DOMTestCase { assertEquals("elementgetelementsbytagnamens04_2", 3, elementList .getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS5() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/ElementHasAttribute.java b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java index 1c897f4..0be1a9a 100644 --- a/xml/src/test/java/org/w3c/dom/ElementHasAttribute.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttribute.java @@ -1,11 +1,15 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.NodeList; +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 @@ -17,6 +21,7 @@ import org.w3c.dom.NodeList; * @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; @@ -46,6 +51,16 @@ public final class ElementHasAttribute extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies hasAttribute method with empty string " + + "as a parameter.", + targets = { + @TestTarget( + methodName = "hasAttribute", + methodArgs = {java.lang.String.class} + ) + }) public void testHasAttribute1() throws Throwable { Document doc; Element element; @@ -69,7 +84,15 @@ public final class ElementHasAttribute extends DOMTestCase { // state = element.hasAttribute("defaultAttr"); // assertTrue("elementhasattribute02", state); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "hasAttribute", + methodArgs = {java.lang.String.class} + ) + }) public void testHasAttribute3() throws Throwable { Document doc; Element element; @@ -85,7 +108,15 @@ public final class ElementHasAttribute extends DOMTestCase { state = element.hasAttribute("domestic"); assertTrue("elementhasattribute03_True", state); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "hasAttribute", + methodArgs = {java.lang.String.class} + ) + }) public void testHasAttribute4() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/ElementHasAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java index cf471e5..15d7cff 100644 --- a/xml/src/test/java/org/w3c/dom/ElementHasAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementHasAttributeNS.java @@ -19,14 +19,19 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; 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 @@ -42,6 +47,7 @@ import org.w3c.dom.NodeList; * @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; @@ -71,7 +77,16 @@ public final class ElementHasAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - public void testHasAttributeNS1() throws Throwable { + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "hasAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) + public void _testHasAttributeNS1() throws Throwable { Document doc; Element element; boolean state; @@ -83,7 +98,15 @@ public final class ElementHasAttributeNS extends DOMTestCase { .hasAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns"); assertTrue("elementhasattributens01", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "hasAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasAttributeNS2() throws Throwable { Document doc; Element element; @@ -97,7 +120,15 @@ public final class ElementHasAttributeNS extends DOMTestCase { state = element.hasAttributeNS("http://www.w3.org/DOM", "domestic"); assertTrue("hasDomesticAttr", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "hasAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasAttributeNS3() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/ElementRemoveAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java index 4528a72..5c25b2a 100644 --- a/xml/src/test/java/org/w3c/dom/ElementRemoveAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementRemoveAttributeNS.java @@ -1,10 +1,15 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; +import org.w3c.dom.Element; import org.w3c.dom.Attr; import org.w3c.dom.Document; -import org.w3c.dom.Element; + +import javax.xml.parsers.DocumentBuilder; /** * The method removeAttributeNS removes an attribute by local name and namespace @@ -18,6 +23,7 @@ import org.w3c.dom.Element; * @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; @@ -47,6 +53,15 @@ public final class ElementRemoveAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "removeAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveAttributeNS() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/ElementSetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java index b77504e..ea11d9d 100644 --- a/xml/src/test/java/org/w3c/dom/ElementSetAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNS.java @@ -1,16 +1,21 @@ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - +import org.w3c.dom.Element; 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; +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 @@ -23,6 +28,7 @@ import org.w3c.dom.NodeList; * @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; @@ -52,6 +58,15 @@ public final class ElementSetAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testSetAttributeNS1() throws Throwable { Document doc; Element element; @@ -69,7 +84,15 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertEquals("elementsetattributens01_attrName", "attr", attrName); assertEquals("elementsetattributens01_attrValue", "value", attrValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testSetAttributeNS2() throws Throwable { Document doc; Element element; @@ -91,7 +114,15 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertEquals("elementsetattributens02_attrValue", "Silver Street", attrValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testSetAttributeNS3() throws Throwable { Document doc; Element element; @@ -115,7 +146,15 @@ public final class ElementSetAttributeNS extends DOMTestCase { attrName); assertEquals("elementsetattributens03_attrValue", "default1", attrValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with INVALID_CHARACTER_ERR.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testSetAttributeNS4() throws Throwable { Document doc; Element element; @@ -149,7 +188,15 @@ public final class ElementSetAttributeNS extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testSetAttributeNS5() throws Throwable { Document doc; Element element; @@ -169,7 +216,15 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertTrue("elementsetattributens05", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testSetAttributeNS8() throws Throwable { Document doc; Element element; @@ -199,6 +254,15 @@ public final class ElementSetAttributeNS extends DOMTestCase { assertTrue("elementsetattributens08_Err2", success); } } + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, java.lang.String.class} + ) + }) public void testSetAttributeNSURINull() throws Throwable { String namespaceURI = null; diff --git a/xml/src/test/java/org/w3c/dom/ElementSetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java index 9b7e182..0a253da 100644 --- a/xml/src/test/java/org/w3c/dom/ElementSetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/ElementSetAttributeNodeNS.java @@ -19,17 +19,22 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.EntityReference; +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 @@ -44,6 +49,7 @@ import org.w3c.dom.NodeList; * @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; @@ -73,6 +79,15 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNodeNS1() throws Throwable { Document doc; Element element; @@ -106,7 +121,15 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { length = (int) attributes.getLength(); assertEquals("length", 1, length); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNodeNS2() throws Throwable { Document doc; Element element; @@ -132,7 +155,15 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertEquals("elementsetattributenodens02_attrName", "street", attrName); assertEquals("elementsetattributenodens02_attrValue", "Yes", attrValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNodeNS3() throws Throwable { Document doc; Element element1; @@ -159,7 +190,15 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertTrue("elementsetattributenodens03", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNodeNS4() throws Throwable { Document doc; Element element1; @@ -182,7 +221,15 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertTrue("elementsetattributenodens04", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNodeNS5() throws Throwable { Document doc; Document docAlt; @@ -205,8 +252,16 @@ public final class ElementSetAttributeNodeNS extends DOMTestCase { assertTrue("throw_WRONG_DOCUMENT_ERR", success); } } - - public void testSetAttributeNodeNS6() throws Throwable { + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NO_MODIFICATION_ALLOWED_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) + public void _testSetAttributeNodeNS6() throws Throwable { Document doc; Element element; Attr attribute; diff --git a/xml/src/test/java/org/w3c/dom/GetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java index 549743b..6a3ee11 100644 --- a/xml/src/test/java/org/w3c/dom/GetAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNS.java @@ -19,15 +19,20 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; +import org.w3c.dom.Element; import org.w3c.dom.Attr; import org.w3c.dom.Document; -import org.w3c.dom.Element; import org.w3c.dom.NodeList; +import javax.xml.parsers.DocumentBuilder; + /** * The "getAttributeNS(namespaceURI,localName)" method retrieves an attribute * value by local name and NamespaceURI. @@ -43,6 +48,7 @@ import org.w3c.dom.NodeList; * @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; @@ -87,7 +93,15 @@ public final class GetAttributeNS extends DOMTestCase { // attrValue = testAddr.getAttributeNS(namespaceURI, localName); // assertEquals("attrValue", "DISTRICT", attrValue); // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNS2() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "district"; @@ -109,7 +123,15 @@ public final class GetAttributeNS extends DOMTestCase { attrValue = testAddr.getAttributeNS(namespaceURI, localName); assertEquals("throw_Equals", "", attrValue); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNS3() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "domestic"; @@ -125,7 +147,15 @@ public final class GetAttributeNS extends DOMTestCase { attrValue = testAddr.getAttributeNS(namespaceURI, localName); assertEquals("throw_Equals", "", attrValue); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNS4() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "blank"; @@ -145,7 +175,15 @@ public final class GetAttributeNS extends DOMTestCase { attrValue = testAddr.getAttributeNS(namespaceURI, localName); assertEquals("throw_Equals", "NewValue", attrValue); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNS5() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/org/w3c/dom/GetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java index 0cecfae..7b2488a 100644 --- a/xml/src/test/java/org/w3c/dom/GetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetAttributeNodeNS.java @@ -19,14 +19,19 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; 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 @@ -42,6 +47,7 @@ import org.w3c.dom.NodeList; * @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; @@ -71,6 +77,15 @@ public final class GetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNodeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNodeNS1() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "invalidlocalname"; @@ -85,7 +100,15 @@ public final class GetAttributeNodeNS extends DOMTestCase { attribute = testAddr.getAttributeNodeNS(namespaceURI, localName); assertNull("throw_Null", attribute); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getAttributeNodeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetAttributeNodeNS2() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/org/w3c/dom/GetElementById.java b/xml/src/test/java/tests/org/w3c/dom/GetElementById.java index 127d471..9f35447 100644 --- a/xml/src/test/java/org/w3c/dom/GetElementById.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetElementById.java @@ -19,13 +19,18 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +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. @@ -41,6 +46,7 @@ import org.w3c.dom.Element; * @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; @@ -80,7 +86,15 @@ public final class GetElementById extends DOMTestCase { // tagname = element.getTagName(); // assertEquals("throw_Equals", "emp:address", tagname); // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify getElementById method for existent element.", + targets = { + @TestTarget( + methodName = "getElementById", + methodArgs = {java.lang.String.class} + ) + }) public void testGetElementById2() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/GetElementsByTagNameNS.java b/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java index a8ac85e..7c83175 100644 --- a/xml/src/test/java/org/w3c/dom/GetElementsByTagNameNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetElementsByTagNameNS.java @@ -19,17 +19,22 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - import org.w3c.dom.Document; +import org.w3c.dom.NodeList; import org.w3c.dom.Element; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilder; /** * The "getElementsByTagNameNS(namespaceURI,localName)" method for a Document @@ -45,6 +50,7 @@ import org.w3c.dom.NodeList; * @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; @@ -66,7 +72,15 @@ public final class GetElementsByTagNameNS extends DOMTestCase { builder = null; super.tearDown(); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS method with * as parameters.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS1() throws Throwable { String namespaceURI = "*"; String localName = "*"; @@ -78,7 +92,16 @@ public final class GetElementsByTagNameNS extends DOMTestCase { assertEquals("throw_Size", 36, newList.getLength()); // END android-changed } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS with '*' " + + "as the first parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS2() throws Throwable { Document doc; NodeList newList; @@ -94,7 +117,16 @@ public final class GetElementsByTagNameNS extends DOMTestCase { lname = newElement.getLocalName(); assertEquals("lname", "employee", lname); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS with '*' " + + "as the second parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS3() throws Throwable { Document doc; NodeList elementList; @@ -127,7 +159,16 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS with '*' " + + "as the first parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS4() throws Throwable { Document doc; NodeList elementList; @@ -151,7 +192,15 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies negative case of getElementsByTagNameNS method.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS5() throws Throwable { String namespaceURI = "http://www.nist.gov"; String localName = "nomatch"; @@ -161,7 +210,15 @@ public final class GetElementsByTagNameNS extends DOMTestCase { elementList = doc.getElementsByTagNameNS(namespaceURI, localName); assertEquals("throw_Size", 0, elementList.getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies negative case of getElementsByTagNameNS method.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS6() throws Throwable { Document doc; NodeList elementList; @@ -170,7 +227,15 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "address"); assertEquals("matchSize", 0, elementList.getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive case of getElementsByTagNameNS method.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS7() throws Throwable { Document doc; NodeList elementList; @@ -179,7 +244,16 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "address"); assertEquals("addresses", 3, elementList.getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS method with '*' " + + "as parameters; positive case.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS8() throws Throwable { Document doc; Element docElem; @@ -189,7 +263,16 @@ public final class GetElementsByTagNameNS extends DOMTestCase { newList = docElem.getElementsByTagNameNS("*", "*"); assertEquals("listSize", 36, newList.getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS method with '*' " + + "as the first parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS9() throws Throwable { Document doc; NodeList newList; @@ -207,7 +290,16 @@ public final class GetElementsByTagNameNS extends DOMTestCase { lname = newElement.getLocalName(); assertEquals("lname", "employee", lname); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS method with '*' as the second " + + "parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS10() throws Throwable { Document doc; Element docElem; @@ -243,7 +335,16 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies getElementsByTagNameNS method with '*' as the first " + + "parameter.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS11() throws Throwable { Document doc; Element docElem; @@ -269,7 +370,15 @@ public final class GetElementsByTagNameNS extends DOMTestCase { } assertEquals("nodeNames", expectedResult, result); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies negative case for getElementsByTagNameNS method.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS12() throws Throwable { Document doc; Element docElem; @@ -280,7 +389,15 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "nomatch"); assertEquals("size", 0, elementList.getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies negative case for getElementsByTagNameNS method.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS13() throws Throwable { Document doc; Element docElem; @@ -291,7 +408,15 @@ public final class GetElementsByTagNameNS extends DOMTestCase { "address"); assertEquals("matchSize", 0, elementList.getLength()); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive case for getElementsByTagNameNS method.", + targets = { + @TestTarget( + methodName = "getElementsByTagNameNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetElementsByTagNameNS14() throws Throwable { Document doc; Element docElem; diff --git a/xml/src/test/java/org/w3c/dom/GetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java index d442a17..a06a5e0 100644 --- a/xml/src/test/java/org/w3c/dom/GetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/GetNamedItemNS.java @@ -1,15 +1,17 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Entity; 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.Notation; + +import javax.xml.parsers.DocumentBuilder; /** * The "getNamedItemNS(namespaceURI,localName)" method for a NamedNodeMap should @@ -25,6 +27,7 @@ import org.w3c.dom.Notation; * @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; @@ -54,6 +57,15 @@ public final class GetNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getNamedItem", + methodArgs = {java.lang.String.class} + ) + }) public void testGetNamedItemNS1() throws Throwable { Document doc; NodeList elementList; @@ -70,7 +82,15 @@ public final class GetNamedItemNS extends DOMTestCase { attrName = domesticAttr.getNodeName(); assertEquals("attrName", "dmstc:domestic", attrName); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getNamedItemNS", + methodArgs = {String.class, String.class} + ) + }) public void testGetNamedItemNS2() throws Throwable { String namespaceURI = "http://www.usa.com"; String localName = "domest"; diff --git a/xml/src/test/java/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java index 5fae388..1cdd20f 100644 --- a/xml/src/test/java/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCEntitiesRemoveNamedItemNS.java @@ -16,7 +16,9 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestTargetClass; import javax.xml.parsers.DocumentBuilder; @@ -35,6 +37,7 @@ import org.w3c.dom.NamedNodeMap; * @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; diff --git a/xml/src/test/java/org/w3c/dom/HCEntitiesSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCEntitiesSetNamedItemNS.java index a9bcae8..7e2917a 100644 --- a/xml/src/test/java/org/w3c/dom/HCEntitiesSetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCEntitiesSetNamedItemNS.java @@ -1,4 +1,6 @@ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestTargetClass; import javax.xml.parsers.DocumentBuilder; @@ -18,6 +20,7 @@ import org.w3c.dom.NamedNodeMap; * @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; diff --git a/xml/src/test/java/org/w3c/dom/HCNamedNodeMapInvalidType.java b/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java index ecfb61b..675140c 100644 --- a/xml/src/test/java/org/w3c/dom/HCNamedNodeMapInvalidType.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNamedNodeMapInvalidType.java @@ -16,14 +16,19 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMException; +import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.DOMException; + +import javax.xml.parsers.DocumentBuilder; /** * Attempt to insert an element into an attribute list, should raise a @@ -37,6 +42,7 @@ import org.w3c.dom.NamedNodeMap; * @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; @@ -66,6 +72,16 @@ public final class HCNamedNodeMapInvalidType extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that setNamedItem method throws DOMException with " + + "HIERARCHY_REQUEST_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItem", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testNamedNodeMapInvalidType() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/org/w3c/dom/HCNodeDocumentFragmentNormalize.java b/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java index e7da0bc..89be8c6 100644 --- a/xml/src/test/java/org/w3c/dom/HCNodeDocumentFragmentNormalize.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNodeDocumentFragmentNormalize.java @@ -1,12 +1,17 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; +import org.w3c.dom.Node; import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Node; 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. @@ -17,6 +22,7 @@ import org.w3c.dom.Text; * @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; @@ -46,6 +52,21 @@ public final class HCNodeDocumentFragmentNormalize extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies positive functionality of getNodeValue method, " + + "and that getNextSibling method returns null.", + targets = { + @TestTarget( + methodName = "getNodeValue", + methodArgs = {} + ), + @TestTarget( + methodName = "getNextSibling", + methodArgs = {} + ) + + }) public void testNodeDocumentFragmentNormalize1() throws Throwable { Document doc; DocumentFragment docFragment; @@ -66,7 +87,15 @@ public final class HCNodeDocumentFragmentNormalize extends DOMTestCase { retval = txtNode.getNextSibling(); assertNull("singleChild", retval); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getFirstChild method returns null.", + targets = { + @TestTarget( + methodName = "getFirstChild", + methodArgs = {} + ) + }) public void testNodeDocumentFragmentNormalize2() throws Throwable { Document doc; DocumentFragment docFragment; diff --git a/xml/src/test/java/org/w3c/dom/HCNotationsRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java index 3673c73..43c1bdc 100644 --- a/xml/src/test/java/org/w3c/dom/HCNotationsRemoveNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNotationsRemoveNamedItemNS.java @@ -16,14 +16,19 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMException; +import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; -import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.DOMException; + +import javax.xml.parsers.DocumentBuilder; /** * An attempt to add remove an notation using removeNamedItemNS should result in @@ -35,6 +40,7 @@ import org.w3c.dom.NamedNodeMap; * @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; @@ -64,6 +70,15 @@ public final class HCNotationsRemoveNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that removeNamedItemNS method throws DOMException.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS() throws Throwable { Document doc; NamedNodeMap notations; diff --git a/xml/src/test/java/org/w3c/dom/HCNotationsSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java index c928b7f..6c72d9d 100644 --- a/xml/src/test/java/org/w3c/dom/HCNotationsSetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HCNotationsSetNamedItemNS.java @@ -16,15 +16,20 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMException; +import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Document; import org.w3c.dom.DocumentType; import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.DOMException; + +import javax.xml.parsers.DocumentBuilder; /** * An attempt to add an element to the named node map returned by notations @@ -36,6 +41,7 @@ import org.w3c.dom.NamedNodeMap; * @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; @@ -65,6 +71,15 @@ public final class HCNotationsSetNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that setNamedItemNS throws DOMException.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testNotationsSetNamedItemNS() throws Throwable { Document doc; NamedNodeMap notations; diff --git a/xml/src/test/java/org/w3c/dom/HasAttribute.java b/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java index abdfaec..1f51c70 100644 --- a/xml/src/test/java/org/w3c/dom/HasAttribute.java +++ b/xml/src/test/java/tests/org/w3c/dom/HasAttribute.java @@ -1,11 +1,16 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Document; 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 @@ -17,6 +22,7 @@ import org.w3c.dom.NodeList; * @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; @@ -46,6 +52,15 @@ public final class HasAttribute extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that hasAttribute method returns false.", + targets = { + @TestTarget( + methodName = "hasAttribute", + methodArgs = {java.lang.String.class} + ) + }) public void testHasAttribute1() throws Throwable { Document doc; NodeList elementList; @@ -70,7 +85,15 @@ public final class HasAttribute extends DOMTestCase { // state = testNode.hasAttribute("street"); // assertTrue("throw_True", state); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that hasAttribute method returns false.", + targets = { + @TestTarget( + methodName = "hasAttribute", + methodArgs = {java.lang.String.class} + ) + }) public void testHasAttribute3() throws Throwable { Document doc; NodeList elementList; @@ -82,7 +105,15 @@ public final class HasAttribute extends DOMTestCase { state = testNode.hasAttribute("nomatch"); assertFalse("throw_False", state); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that hasAttribute method returns true.", + targets = { + @TestTarget( + methodName = "hasAttribute", + methodArgs = {java.lang.String.class} + ) + }) public void testHasAttribute4() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/org/w3c/dom/HasAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java index efa2148..614818b 100644 --- a/xml/src/test/java/org/w3c/dom/HasAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/HasAttributeNS.java @@ -19,14 +19,19 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Document; 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 @@ -41,6 +46,7 @@ import org.w3c.dom.NodeList; * @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; @@ -70,6 +76,15 @@ public final class HasAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "hasAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasAttributeNS1() throws Throwable { String localName = "nomatch"; String namespaceURI = "http://www.usa.com"; @@ -83,7 +98,15 @@ public final class HasAttributeNS extends DOMTestCase { state = testNode.hasAttributeNS(namespaceURI, localName); assertFalse("throw_False", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "hasAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasAttributeNS2() throws Throwable { String localName = "domestic"; String namespaceURI = "http://www.nomatch.com"; @@ -97,7 +120,15 @@ public final class HasAttributeNS extends DOMTestCase { state = testNode.hasAttributeNS(namespaceURI, localName); assertFalse("throw_False", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "hasAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasAttributeNS3() throws Throwable { String localName = "blank"; String namespaceURI = "http://www.nist.gov"; @@ -128,7 +159,15 @@ public final class HasAttributeNS extends DOMTestCase { // state = testNode.hasAttributeNS(namespaceURI, localName); // assertTrue("hasAttribute", state); // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "hasAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testHasAttributeNS5() throws Throwable { String localName = "domestic"; String namespaceURI = "http://www.usa.com"; diff --git a/xml/src/test/java/org/w3c/dom/HasAttributes.java b/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java index c77879e..af0fa03 100644 --- a/xml/src/test/java/org/w3c/dom/HasAttributes.java +++ b/xml/src/test/java/tests/org/w3c/dom/HasAttributes.java @@ -19,14 +19,19 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Document; 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 @@ -38,6 +43,7 @@ import org.w3c.dom.NodeList; * @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; @@ -67,6 +73,15 @@ public final class HasAttributes extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that hasAttributes method returns false value.", + targets = { + @TestTarget( + methodName = "hasAttributes", + methodArgs = {} + ) + }) public void testHasAttributes1() throws Throwable { Document doc; NodeList addrList; @@ -78,7 +93,15 @@ public final class HasAttributes extends DOMTestCase { state = addrNode.hasAttributes(); assertFalse("throw_False", state); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that hasAttributes method returns true value.", + targets = { + @TestTarget( + methodName = "hasAttributes", + methodArgs = {} + ) + }) public void testHasAttributes2() throws Throwable { Document doc; NodeList addrList; diff --git a/xml/src/test/java/org/w3c/dom/ImportNode.java b/xml/src/test/java/tests/org/w3c/dom/ImportNode.java index 19130ad..45ce6d6 100644 --- a/xml/src/test/java/org/w3c/dom/ImportNode.java +++ b/xml/src/test/java/tests/org/w3c/dom/ImportNode.java @@ -19,29 +19,31 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - +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.DOMException; -import org.w3c.dom.Document; import org.w3c.dom.DocumentFragment; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.Entity; import org.w3c.dom.EntityReference; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Notation; import org.w3c.dom.ProcessingInstruction; -import org.w3c.dom.Text; +import org.w3c.dom.DOMException; + +import javax.xml.parsers.DocumentBuilder; /** * The "importNode(importedNode,deep)" method for a Document should import the @@ -62,6 +64,7 @@ import org.w3c.dom.Text; * @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; @@ -91,7 +94,16 @@ public final class ImportNode extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ - public void testImportNode1() throws Throwable { + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) + public void _testImportNode1() throws Throwable { Document doc; Document aNewDoc; Attr newAttr; @@ -134,7 +146,15 @@ public final class ImportNode extends DOMTestCase { childValue = child.getNodeValue(); assertEquals("childValue", "importedText", childValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode2() throws Throwable { Document doc; Document aNewDoc; @@ -157,7 +177,15 @@ public final class ImportNode extends DOMTestCase { value = aNode.getNodeValue(); assertEquals("nodeValue", "this is CDATASection data", value); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode3() throws Throwable { Document doc; Document aNewDoc; @@ -180,7 +208,15 @@ public final class ImportNode extends DOMTestCase { value = aNode.getNodeValue(); assertEquals("nodeValue", "this is a comment", value); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode4() throws Throwable { Document doc; Document aNewDoc; @@ -202,7 +238,15 @@ public final class ImportNode extends DOMTestCase { childValue = child.getNodeValue(); assertEquals("descendant1", "descendant1", childValue); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode5() throws Throwable { Document doc; Document aNewDoc; @@ -230,7 +274,15 @@ public final class ImportNode extends DOMTestCase { name = aNode.getNodeName(); assertEquals("nodeName", "emp:address", name); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode6() throws Throwable { Document doc; Document aNewDoc; @@ -280,7 +332,15 @@ public final class ImportNode extends DOMTestCase { // lname = attr.getLocalName(); // assertEquals("lname", "defaultAttr", lname); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode8() throws Throwable { Document doc; Document aNewDoc; @@ -339,7 +399,15 @@ public final class ImportNode extends DOMTestCase { // notationName = entity1.getNotationName(); // assertEquals("notationName", "notation2", notationName); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode10() throws Throwable { Document doc; Document aNewDoc; @@ -449,7 +517,15 @@ public final class ImportNode extends DOMTestCase { // system = aNode.getSystemId(); // assertNull("notationSystemId", system); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode14() throws Throwable { Document doc; Document aNewDoc; @@ -476,7 +552,15 @@ public final class ImportNode extends DOMTestCase { data = aNode.getData(); assertEquals("piData", "data1", data); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode15() throws Throwable { Document doc; Document aNewDoc; @@ -499,7 +583,16 @@ public final class ImportNode extends DOMTestCase { value = aNode.getNodeValue(); assertEquals("nodeValue", "this is text data", value); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that importNode method throws DOMException " + + "with NOT_SUPPORTED_ERR code.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode16() throws Throwable { Document doc; Document anotherDoc; @@ -519,7 +612,16 @@ public final class ImportNode extends DOMTestCase { assertTrue("throw_NOT_SUPPORTED_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that importNode method throws DOMException " + + "with NOT_SUPPORTED_ERR code.", + targets = { + @TestTarget( + methodName = "importNode", + methodArgs = {org.w3c.dom.Node.class, boolean.class} + ) + }) public void testImportNode17() throws Throwable { Document doc; Document anotherDoc; diff --git a/xml/src/test/java/org/w3c/dom/InternalSubset.java b/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java index 61a652c..d15cb37 100644 --- a/xml/src/test/java/org/w3c/dom/InternalSubset.java +++ b/xml/src/test/java/tests/org/w3c/dom/InternalSubset.java @@ -20,12 +20,17 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Document; import org.w3c.dom.DocumentType; +import org.w3c.dom.Document; + +import javax.xml.parsers.DocumentBuilder; /** * The "getInternalSubset()" method returns @@ -39,6 +44,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -66,6 +72,16 @@ public final class InternalSubset extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that getInternalSubset method returns " + + "the internal subset as a string.", + targets = { + @TestTarget( + methodName = "getInternalSubset", + methodArgs = {} + ) + }) public void testGetInternalSubset() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/org/w3c/dom/IsSupported.java b/xml/src/test/java/tests/org/w3c/dom/IsSupported.java index add6f29..a8fba52 100644 --- a/xml/src/test/java/org/w3c/dom/IsSupported.java +++ b/xml/src/test/java/tests/org/w3c/dom/IsSupported.java @@ -1,13 +1,18 @@ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - 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 @@ -25,6 +30,7 @@ import org.w3c.dom.Node; * @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; @@ -54,6 +60,15 @@ public final class IsSupported extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns false.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported1() throws Throwable { Document doc; Node rootNode; @@ -63,7 +78,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XXX", "1.0"); assertFalse("throw_False", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns false value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported2() throws Throwable { Document doc; Node rootNode; @@ -73,7 +96,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XML", "9.0"); assertFalse("throw_False", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns true value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported4() throws Throwable { Document doc; Node rootNode; @@ -83,7 +114,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("xml", "1.0"); assertTrue("throw_True", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns true value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported5() throws Throwable { Document doc; Node rootNode; @@ -93,7 +132,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("core", "2.0"); assertTrue("throw_True", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns true value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported6() throws Throwable { Document doc; Node rootNode; @@ -103,7 +150,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("xml", "2.0"); assertTrue("throw_True", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns true value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported7() throws Throwable { Document doc; Node rootNode; @@ -113,7 +168,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XML", ""); assertTrue("throw_True", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns true value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported9() throws Throwable { Document doc; Node rootNode; @@ -123,7 +186,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XML", "1.0"); assertTrue("throw_True", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns true.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported10() throws Throwable { Document doc; Node rootNode; @@ -133,7 +204,15 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("CORE", "2.0"); assertTrue("throw_True", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns true.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported11() throws Throwable { Document doc; Node rootNode; @@ -143,7 +222,16 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("XML", "2.0"); assertTrue("throw_True", state); } - + + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported12() throws Throwable { List<String> features = new ArrayList<String>(); features.add("Core"); @@ -179,7 +267,16 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported(featureElement, "2.0"); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns correct value " + + "if it has empty string as a version parameter.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported13() throws Throwable { Document doc; Node rootNode; @@ -189,7 +286,16 @@ public final class IsSupported extends DOMTestCase { state = rootNode.isSupported("Core", ""); assertTrue("Core", state); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns correct value " + + "if it has null as a version parameter.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {String.class, String.class} + ) + }) public void testIsSupported14() throws Throwable { Document doc; Node rootNode; diff --git a/xml/src/test/java/org/w3c/dom/LocalName.java b/xml/src/test/java/tests/org/w3c/dom/LocalName.java index 9f6fa14..9d001c0 100644 --- a/xml/src/test/java/org/w3c/dom/LocalName.java +++ b/xml/src/test/java/tests/org/w3c/dom/LocalName.java @@ -1,12 +1,17 @@ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +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.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 @@ -23,6 +28,7 @@ import org.w3c.dom.NodeList; * @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; @@ -52,6 +58,15 @@ public final class LocalName extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "getLocalName", + methodArgs = {} + ) + }) public void testGetLocalName1() throws Throwable { Document doc; NodeList elementList; @@ -66,7 +81,15 @@ public final class LocalName extends DOMTestCase { localName = addrAttr.getLocalName(); assertEquals("localName", "domestic", localName); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that getLocalName method returns null.", + targets = { + @TestTarget( + methodName = "getLocalName", + methodArgs = {} + ) + }) public void testGetLocalName2() throws Throwable { Document doc; Node createdNode; @@ -76,7 +99,15 @@ public final class LocalName extends DOMTestCase { localName = createdNode.getLocalName(); assertNull("localNameNull", localName); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that getLocalName method returns null.", + targets = { + @TestTarget( + methodName = "getLocalName", + methodArgs = {} + ) + }) public void testGetLocalName3() throws Throwable { Document doc; NodeList elementList; @@ -90,7 +121,15 @@ public final class LocalName extends DOMTestCase { localName = textNode.getLocalName(); assertNull("textNodeLocalName", localName); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "getLocalName", + methodArgs = {} + ) + }) public void testGetLocalName4() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/org/w3c/dom/NamedNodeMapGetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java index 2f179ba..f4338e3 100644 --- a/xml/src/test/java/org/w3c/dom/NamedNodeMapGetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapGetNamedItemNS.java @@ -19,19 +19,21 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.Entity; import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.w3c.dom.Notation; +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 @@ -49,6 +51,7 @@ import org.w3c.dom.Notation; * @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; @@ -100,7 +103,15 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { // notation = (Notation) notations.getNamedItemNS(nullNS, "notation1"); // assertNotNull("notationNull", notation); // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetNamedItemNS2() throws Throwable { Document doc; NamedNodeMap attributes; @@ -118,7 +129,15 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapgetnameditemns02", "emp:domestic", attrName); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetNamedItemNS3() throws Throwable { Document doc; NamedNodeMap attributes; @@ -140,7 +159,15 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapgetnameditemns03", "L2:att", attrName); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetNamedItemNS4() throws Throwable { Document doc; NamedNodeMap attributes; @@ -160,7 +187,15 @@ public final class NamedNodeMapGetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapgetnameditemns04", "street", attrName); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "getNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testGetNamedItemNS5() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java index 377db71..af7f061 100644 --- a/xml/src/test/java/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapRemoveNamedItemNS.java @@ -19,18 +19,22 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -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; +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 @@ -44,6 +48,7 @@ import org.w3c.dom.NodeList; * @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; @@ -73,6 +78,15 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS1() throws Throwable { Document doc; NamedNodeMap attributes; @@ -113,7 +127,15 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { // assertEquals("namednodemapremovenameditemns02_attrValue", "defaultVal", // attrValue); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS3() throws Throwable { Document doc; NamedNodeMap attributes; @@ -139,8 +161,16 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { nodeName = attribute.getNodeName(); assertEquals("namednodemapremovenameditemns02", "L2:att", nodeName); } - - public void testRemoveNamedItemNS4() throws Throwable { + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) + public void _testRemoveNamedItemNS4() throws Throwable { Document doc; NamedNodeMap attributes; Node element; @@ -207,7 +237,16 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { // } // } // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that removeNamedItemNS method throws DOMException " + + "with NOT_FOUND_ERR code.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS6() throws Throwable { Document doc; NamedNodeMap attributes; @@ -230,7 +269,16 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { assertTrue("throw_NOT_FOUND_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that removeNamedItemNS method throws DOMException " + + "with NOT_FOUND_ERR code.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS7() throws Throwable { Document doc; NamedNodeMap attributes; @@ -253,7 +301,16 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { assertTrue("throw_NOT_FOUND_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies that removeNamedItemNS method throws DOMException " + + "with NOT_FOUND_ERR code.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS8() throws Throwable { Document doc; NamedNodeMap attributes; @@ -277,7 +334,15 @@ public final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { assertTrue("throw_NOT_FOUND_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS9() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/org/w3c/dom/NamedNodeMapSetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java index 5f9a676..50c7022 100644 --- a/xml/src/test/java/org/w3c/dom/NamedNodeMapSetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamedNodeMapSetNamedItemNS.java @@ -19,21 +19,24 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +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.Document; import org.w3c.dom.DocumentType; -import org.w3c.dom.Element; -import org.w3c.dom.Entity; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Notation; + +import javax.xml.parsers.DocumentBuilder; /** * The method setNamedItemNS adds a node using its namespaceURI and localName. @@ -50,6 +53,7 @@ import org.w3c.dom.Notation; * @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; @@ -82,6 +86,15 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS1() throws Throwable { Document doc; NamedNodeMap attributes; @@ -103,7 +116,15 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapsetnameditemns01", "streets", attrName); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS2() throws Throwable { Document doc; NamedNodeMap attributes; @@ -123,7 +144,16 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { attrName = attribute.getNodeName(); assertEquals("namednodemapsetnameditemns02", "L1:att", attrName); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that setNamedItemNS throws DOMException with " + + "WRONG_DOCUMENT_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS3() throws Throwable { Document doc; @@ -159,11 +189,20 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { assertTrue("throw_WRONG_DOCUMENT_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that setNamedItemNS throws DOMException with " + + "WRONG_DOCUMENT_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS4() throws Throwable { Document doc; DOMImplementation domImpl; - Document docAlt; + Document docAlt; DocumentType docType = null; NamedNodeMap attributes; @@ -230,7 +269,16 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations", success); // } // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that setNamedItemNS throws DOMException with " + + "INUSE_ATTRIBUTE_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS6() throws Throwable { Document doc; NamedNodeMap attributes; @@ -257,7 +305,16 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { assertTrue("namednodemapsetnameditemns06", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that setNamedItemNS throws DOMException with " + + "INUSE_ATTRIBUTE_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS7() throws Throwable { Document doc; NamedNodeMap attributes; @@ -284,7 +341,16 @@ public final class NamedNodeMapSetNamedItemNS extends DOMTestCase { assertTrue("namednodemapsetnameditemns07", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that setNamedItemNS throws DOMException with " + + "INUSE_ATTRIBUTE_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS8() throws Throwable { Document doc; NamedNodeMap attributes; diff --git a/xml/src/test/java/org/w3c/dom/NamespaceURI.java b/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java index 2c00d62..788ef8b 100644 --- a/xml/src/test/java/org/w3c/dom/NamespaceURI.java +++ b/xml/src/test/java/tests/org/w3c/dom/NamespaceURI.java @@ -19,15 +19,20 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +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 org.w3c.dom.NodeList; + +import javax.xml.parsers.DocumentBuilder; /** * The "getNamespaceURI()" method for an Attribute returns the namespace URI of @@ -44,6 +49,7 @@ import org.w3c.dom.NodeList; * @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; @@ -88,7 +94,15 @@ public final class NamespaceURI extends DOMTestCase { // attrNamespaceURI = addrAttr.getNamespaceURI(); // assertEquals("namespaceURI", "http://www.nist.gov", attrNamespaceURI); // } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that getNamespaceURI method returns null.", + targets = { + @TestTarget( + methodName = "getNamespaceURI", + methodArgs = {} + ) + }) public void testGetNamespaceURI2() throws Throwable { Document doc; NodeList elementList; @@ -104,7 +118,15 @@ public final class NamespaceURI extends DOMTestCase { attrNamespaceURI = addrAttr.getNamespaceURI(); assertEquals("namespaceURI", "http://www.nist.gov", attrNamespaceURI); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that getNamespaceURI method returns null.", + targets = { + @TestTarget( + methodName = "getNamespaceURI", + methodArgs = {} + ) + }) public void testGetNamespaceURI3() throws Throwable { Document doc; NodeList elementList; @@ -117,7 +139,15 @@ public final class NamespaceURI extends DOMTestCase { employeeNamespace = testEmployee.getNamespaceURI(); assertEquals("namespaceURI", "http://www.nist.gov", employeeNamespace); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getNamespaceURI method returns null.", + targets = { + @TestTarget( + methodName = "getNamespaceURI", + methodArgs = {} + ) + }) public void testGetNamespaceURI4() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/org/w3c/dom/NodeGetLocalName.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java index 35422c6..66c5b25 100644 --- a/xml/src/test/java/org/w3c/dom/NodeGetLocalName.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetLocalName.java @@ -20,13 +20,19 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; +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. @@ -38,6 +44,7 @@ import org.w3c.dom.Element; * @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; @@ -65,6 +72,15 @@ public final class NodeGetLocalName extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify that getLocalName method returns null.", + targets = { + @TestTarget( + methodName = "getLocalName", + methodArgs = {} + ) + }) public void testGetLocalName() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/NodeGetNamespaceURI.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java index 59a4dea..e53d6cb 100644 --- a/xml/src/test/java/org/w3c/dom/NodeGetNamespaceURI.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetNamespaceURI.java @@ -20,13 +20,19 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; +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 @@ -40,6 +46,7 @@ import org.w3c.dom.Element; * @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; @@ -67,6 +74,15 @@ public final class NodeGetNamespaceURI extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getNamespaceURI", + methodArgs = {} + ) + }) public void testGetNamespaceURI() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/NodeGetOwnerDocument.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java index 4d40591..7034ea4 100644 --- a/xml/src/test/java/org/w3c/dom/NodeGetOwnerDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetOwnerDocument.java @@ -19,15 +19,21 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMImplementation; +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 @@ -42,6 +48,7 @@ import org.w3c.dom.Element; * @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; @@ -71,6 +78,15 @@ public final class NodeGetOwnerDocument extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getOwnerDocument method returns null.", + targets = { + @TestTarget( + methodName = "getOwnerDocument", + methodArgs = {} + ) + }) public void testGetOwnerDocument1() throws Throwable { Document doc; Document ownerDoc; @@ -84,7 +100,15 @@ public final class NodeGetOwnerDocument extends DOMTestCase { ownerDoc = docType.getOwnerDocument(); assertNull("nodegetownerdocument01", ownerDoc); } - + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getOwnerDocument", + methodArgs = {} + ) + }) public void testGetOwnerDocument2() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/org/w3c/dom/NodeGetPrefix.java b/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java index 60cd269..e9cfa21 100644 --- a/xml/src/test/java/org/w3c/dom/NodeGetPrefix.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeGetPrefix.java @@ -20,13 +20,19 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; +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. @@ -38,6 +44,7 @@ import org.w3c.dom.Element; * @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; @@ -66,6 +73,15 @@ public final class NodeGetPrefix extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix() throws Throwable { Document doc; Element element; diff --git a/xml/src/test/java/org/w3c/dom/NodeHasAttributes.java b/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java index 894f61c..d7b0cf6 100644 --- a/xml/src/test/java/org/w3c/dom/NodeHasAttributes.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeHasAttributes.java @@ -19,16 +19,22 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Node; import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; 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 @@ -41,6 +47,7 @@ import org.w3c.dom.NodeList; * @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; @@ -70,6 +77,15 @@ public final class NodeHasAttributes extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "hasAttributes", + methodArgs = {} + ) + }) public void testHasAttributes1() throws Throwable { Document doc; Element element; @@ -85,7 +101,15 @@ public final class NodeHasAttributes extends DOMTestCase { hasAttributes = element.hasAttributes(); assertTrue("nodehasattributes01_2", hasAttributes); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that hasAttributes method returns false value.", + targets = { + @TestTarget( + methodName = "hasAttributes", + methodArgs = {} + ) + }) public void testHasAttributes2() throws Throwable { Document doc; DocumentType docType; @@ -95,7 +119,15 @@ public final class NodeHasAttributes extends DOMTestCase { hasAttributes = docType.hasAttributes(); assertFalse("nodehasattributes02", hasAttributes); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that hasAttributes method returns true value.", + targets = { + @TestTarget( + methodName = "hasAttributes", + methodArgs = {} + ) + }) public void testHasAttributes3() throws Throwable { Document doc; Element element; @@ -108,7 +140,15 @@ public final class NodeHasAttributes extends DOMTestCase { hasAttributes = element.hasAttributes(); assertTrue("hasAttributes", hasAttributes); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that hasAttributes method returns true value.", + targets = { + @TestTarget( + methodName = "hasAttributes", + methodArgs = {} + ) + }) public void testHasAttributes4() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/org/w3c/dom/NodeIsSupported.java b/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java index c984e07..f0f9110 100644 --- a/xml/src/test/java/org/w3c/dom/NodeIsSupported.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeIsSupported.java @@ -19,20 +19,26 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - -import org.w3c.dom.Attr; +import org.w3c.dom.Node; import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; 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 @@ -49,6 +55,7 @@ import org.w3c.dom.ProcessingInstruction; * @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; @@ -78,6 +85,15 @@ public final class NodeIsSupported extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that isSupported method can return false value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testIsSupported1() throws Throwable { Document doc; Element element; @@ -113,7 +129,15 @@ public final class NodeIsSupported extends DOMTestCase { assertTrue("nodeissupported01_Core3", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify that isSupported method can return false value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testIsSupported2() throws Throwable { Document doc; Attr attribute; @@ -149,7 +173,16 @@ public final class NodeIsSupported extends DOMTestCase { assertTrue("nodeissupported02_Core3", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns false value " + + "if it's called with empty strings as parameters.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testIsSupported3() throws Throwable { Document doc; DocumentType docType; @@ -159,7 +192,15 @@ public final class NodeIsSupported extends DOMTestCase { success = docType.isSupported("", ""); assertFalse("nodeissupported03", success); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns false value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testIsSupported4() throws Throwable { Document doc; EntityReference entRef; @@ -170,7 +211,15 @@ public final class NodeIsSupported extends DOMTestCase { success = entRef.isSupported("XML CORE", ""); assertFalse("nodeissupported04", success); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that isSupported method returns false value.", + targets = { + @TestTarget( + methodName = "isSupported", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testIsSupported5() throws Throwable { Document doc; ProcessingInstruction pi; diff --git a/xml/src/test/java/org/w3c/dom/NodeNormalize.java b/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java index c7de6d0..664ad22 100644 --- a/xml/src/test/java/org/w3c/dom/NodeNormalize.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeNormalize.java @@ -19,20 +19,26 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.CDATASection; -import org.w3c.dom.Comment; -import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Node; import org.w3c.dom.Document; -import org.w3c.dom.DocumentType; 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.Text; +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 @@ -51,6 +57,7 @@ import org.w3c.dom.Text; * @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; @@ -80,6 +87,15 @@ public final class NodeNormalize extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "normalize", + methodArgs = {} + ) + }) public void testNormalize() throws Throwable { Document doc; Document newDoc; diff --git a/xml/src/test/java/org/w3c/dom/NodeSetPrefix.java b/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java index 1aa78dc..ca2844f 100644 --- a/xml/src/test/java/org/w3c/dom/NodeSetPrefix.java +++ b/xml/src/test/java/tests/org/w3c/dom/NodeSetPrefix.java @@ -19,20 +19,26 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; import java.util.ArrayList; import java.util.List; -import javax.xml.parsers.DocumentBuilder; - -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; +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 @@ -48,6 +54,7 @@ import org.w3c.dom.NodeList; * @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; @@ -77,6 +84,15 @@ public final class NodeSetPrefix extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setPrefix", + methodArgs = {java.lang.String.class} + ) + }) public void testSetPrefix1() throws Throwable { Document doc; DocumentFragment docFragment; @@ -121,7 +137,15 @@ public final class NodeSetPrefix extends DOMTestCase { // assertEquals("nodesetprefix02_attrName", "dmstc:domestic", attrName); // assertEquals("nodesetprefix02_newAttrName", "dom:address", newAttrName); // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setPrefix", + methodArgs = {java.lang.String.class} + ) + }) public void testSetPrefix3() throws Throwable { Document doc; Element element; @@ -163,7 +187,15 @@ public final class NodeSetPrefix extends DOMTestCase { // assertTrue("nodesetprefix04", success); // } // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setPrefix", + methodArgs = {java.lang.String.class} + ) + }) public void testSetPrefix5() throws Throwable { Document doc; Element element; @@ -192,7 +224,15 @@ public final class NodeSetPrefix extends DOMTestCase { } } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setPrefix", + methodArgs = {java.lang.String.class} + ) + }) public void testSetPrefix6() throws Throwable { Document doc; Element element; @@ -210,7 +250,15 @@ public final class NodeSetPrefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setPrefix", + methodArgs = {java.lang.String.class} + ) + }) public void testSetPrefix7() throws Throwable { Document doc; Attr attribute; @@ -228,7 +276,15 @@ public final class NodeSetPrefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR.", + targets = { + @TestTarget( + methodName = "setPrefix", + methodArgs = {java.lang.String.class} + ) + }) public void testSetPrefix8() throws Throwable { Document doc; Element element; @@ -249,8 +305,16 @@ public final class NodeSetPrefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - - public void testSetPrefix9() throws Throwable { + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with INVALID_CHARACTER_ERR code.", + targets = { + @TestTarget( + methodName = "setPrefix", + methodArgs = {java.lang.String.class} + ) + }) + public void _testSetPrefix9() throws Throwable { Document doc; String value = "#$%&'()@"; Element element; diff --git a/xml/src/test/java/org/w3c/dom/Normalize.java b/xml/src/test/java/tests/org/w3c/dom/Normalize.java index fcfb459..40b4b29 100644 --- a/xml/src/test/java/org/w3c/dom/Normalize.java +++ b/xml/src/test/java/tests/org/w3c/dom/Normalize.java @@ -20,15 +20,20 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.CharacterData; -import org.w3c.dom.Document; 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 @@ -45,6 +50,7 @@ import org.w3c.dom.NodeList; * @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; @@ -71,6 +77,15 @@ public final class Normalize extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "normalize", + methodArgs = {} + ) + }) public void testNormalize() throws Throwable { Document doc; Element root; diff --git a/xml/src/test/java/org/w3c/dom/OwnerDocument.java b/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java index 1c3830b..3a2537b 100644 --- a/xml/src/test/java/org/w3c/dom/OwnerDocument.java +++ b/xml/src/test/java/tests/org/w3c/dom/OwnerDocument.java @@ -20,13 +20,18 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +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. @@ -37,6 +42,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -64,6 +70,15 @@ public final class OwnerDocument extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Dosn't verify that getOwnerDocument can return not null value.", + targets = { + @TestTarget( + methodName = "getOwnerDocument", + methodArgs = {} + ) + }) public void testGetOwnerDocument() throws Throwable { Document doc; DocumentType ownerDocument; diff --git a/xml/src/test/java/org/w3c/dom/OwnerElement.java b/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java index cf18326..267d314 100644 --- a/xml/src/test/java/org/w3c/dom/OwnerElement.java +++ b/xml/src/test/java/tests/org/w3c/dom/OwnerElement.java @@ -19,16 +19,21 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; +import org.w3c.dom.Node; import org.w3c.dom.Attr; 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.NamedNodeMap; +import org.w3c.dom.Element; + +import javax.xml.parsers.DocumentBuilder; /** * The "getOwnerElement()" will return the Element node this attribute is @@ -42,6 +47,7 @@ import org.w3c.dom.NodeList; * @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; @@ -71,6 +77,15 @@ public final class OwnerElement extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies positive functionlity.", + targets = { + @TestTarget( + methodName = "getOwnerElement", + methodArgs = {} + ) + }) public void testGetOwnerElement1() throws Throwable { Document doc; NodeList addressList; @@ -88,7 +103,15 @@ public final class OwnerElement extends DOMTestCase { name = elementNode.getNodeName(); assertEquals("throw_Equals", "address", name); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getOwnerElement method returns null.", + targets = { + @TestTarget( + methodName = "getOwnerElement", + methodArgs = {} + ) + }) public void testGetOwnerElement2() throws Throwable { Document doc; Attr newAttr; diff --git a/xml/src/test/java/org/w3c/dom/Prefix.java b/xml/src/test/java/tests/org/w3c/dom/Prefix.java index 34fea2b..60bd3e4 100644 --- a/xml/src/test/java/org/w3c/dom/Prefix.java +++ b/xml/src/test/java/tests/org/w3c/dom/Prefix.java @@ -19,16 +19,21 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -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.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, @@ -44,6 +49,7 @@ import org.w3c.dom.NodeList; * @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; @@ -73,6 +79,15 @@ public final class Prefix extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method can return null.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix1() throws Throwable { Document doc; Node createdNode; @@ -82,7 +97,15 @@ public final class Prefix extends DOMTestCase { prefix = createdNode.getPrefix(); assertNull("throw_Null", prefix); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies positive functionality of getPrefix method.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix2() throws Throwable { Document doc; NodeList elementList; @@ -97,7 +120,15 @@ public final class Prefix extends DOMTestCase { prefix = textNode.getPrefix(); assertNull("textNodePrefix", prefix); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies positive functionality of getPrefix method.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix3() throws Throwable { Document doc; NodeList elementList; @@ -110,7 +141,15 @@ public final class Prefix extends DOMTestCase { prefix = testEmployee.getPrefix(); assertEquals("prefix", "emp", prefix); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method returns null.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix4() throws Throwable { Document doc; NodeList elementList; @@ -122,7 +161,16 @@ public final class Prefix extends DOMTestCase { prefix = testEmployee.getPrefix(); assertNull("throw_Null", prefix); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix5() throws Throwable { Document doc; NodeList elementList; @@ -144,8 +192,17 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - - public void testGetPrefix6() throws Throwable { + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method throws DOMException with " + + "INVALID_CHARACTER_ERR code.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) + public void _testGetPrefix6() throws Throwable { Document doc; NodeList elementList; Node employeeNode; @@ -163,7 +220,16 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_INVALID_CHARACTER_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix7() throws Throwable { Document doc; NodeList elementList; @@ -216,8 +282,17 @@ public final class Prefix extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - - public void testGetPrefix9() throws Throwable { + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) + public void _testGetPrefix9() throws Throwable { Document doc; NodeList elementList; Element addrNode; @@ -237,7 +312,16 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix10() throws Throwable { Document doc; NodeList elementList; @@ -256,7 +340,16 @@ public final class Prefix extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies that getPrefix method throws DOMException with " + + "NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "getPrefix", + methodArgs = {} + ) + }) public void testGetPrefix11() throws Throwable { Document doc; NodeList elementList; diff --git a/xml/src/test/java/org/w3c/dom/PublicId.java b/xml/src/test/java/tests/org/w3c/dom/PublicId.java index 5e1c1c3..a366e2d 100644 --- a/xml/src/test/java/org/w3c/dom/PublicId.java +++ b/xml/src/test/java/tests/org/w3c/dom/PublicId.java @@ -20,12 +20,17 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Document; import org.w3c.dom.DocumentType; +import org.w3c.dom.Document; + +import javax.xml.parsers.DocumentBuilder; /** * The "getPublicId()" method of a documenttype node contains @@ -38,6 +43,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -65,6 +71,15 @@ public final class PublicId extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getPublicId", + methodArgs = {} + ) + }) public void testGetPublicId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/org/w3c/dom/RemoveAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/RemoveAttributeNS.java index badc004..6a84d1b 100644 --- a/xml/src/test/java/org/w3c/dom/RemoveAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/RemoveAttributeNS.java @@ -19,7 +19,9 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; + +import dalvik.annotation.TestTargetClass; import javax.xml.parsers.DocumentBuilder; @@ -49,6 +51,7 @@ import org.w3c.dom.NodeList; * @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; diff --git a/xml/src/test/java/org/w3c/dom/RemoveNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java index a3e11fc..e4a6656 100644 --- a/xml/src/test/java/org/w3c/dom/RemoveNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/RemoveNamedItemNS.java @@ -19,16 +19,21 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; 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 @@ -45,6 +50,7 @@ import org.w3c.dom.NodeList; * @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; @@ -74,6 +80,15 @@ public final class RemoveNamedItemNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify DOMException exception.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS1() throws Throwable { Document doc; NodeList elementList; @@ -91,7 +106,15 @@ public final class RemoveNamedItemNS extends DOMTestCase { newAttr = (Attr) attributes.getNamedItem("dmstc:domestic"); assertNull("nodeRemoved", newAttr); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Verifies DOMException with NOT_FOUND_ERR code.", + targets = { + @TestTarget( + methodName = "removeNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testRemoveNamedItemNS2() throws Throwable { String namespaceURI = "http://www.usa.com"; String localName = "domest"; diff --git a/xml/src/test/java/org/w3c/dom/SetAttributeNS.java b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java index 038faee..5ecf072 100644 --- a/xml/src/test/java/org/w3c/dom/SetAttributeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNS.java @@ -19,16 +19,21 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; 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 @@ -47,6 +52,7 @@ import org.w3c.dom.NodeList; * @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; @@ -76,6 +82,15 @@ public final class SetAttributeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with INVALID_CHARACTER_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {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"; @@ -97,7 +112,15 @@ public final class SetAttributeNS extends DOMTestCase { assertTrue("throw_INVALID_CHARACTER_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {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:"; @@ -158,7 +181,15 @@ public final class SetAttributeNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {java.lang.String.class, java.lang.String.class, boolean.class} + ) + }) public void testSetAttributeNS4() throws Throwable { Document doc; NodeList elementList; @@ -186,7 +217,15 @@ public final class SetAttributeNS extends DOMTestCase { resultPrefix = addrAttr.getPrefix(); assertEquals("prefix", "newprefix", resultPrefix); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {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"; @@ -206,7 +245,15 @@ public final class SetAttributeNS extends DOMTestCase { namespaceURI, localName); assertEquals("throw_Equals", "<newValue>", resultAttr); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {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"; @@ -228,7 +275,15 @@ public final class SetAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {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"; @@ -250,7 +305,15 @@ public final class SetAttributeNS extends DOMTestCase { assertTrue("throw_NAMESPACE_ERR", success); } } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive functionality.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {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"; @@ -281,7 +344,15 @@ public final class SetAttributeNS extends DOMTestCase { resultPrefix = addrAttr.getPrefix(); assertEquals("prefix", "emp", resultPrefix); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with NAMESPACE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNS", + methodArgs = {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; diff --git a/xml/src/test/java/org/w3c/dom/SetAttributeNodeNS.java b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java index e3c8e19..c26bc47 100644 --- a/xml/src/test/java/org/w3c/dom/SetAttributeNodeNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/SetAttributeNodeNS.java @@ -19,16 +19,21 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Attr; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; 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 @@ -50,6 +55,7 @@ import org.w3c.dom.NodeList; * @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; @@ -79,6 +85,15 @@ public final class SetAttributeNodeNS extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNode1() throws Throwable { String namespaceURI = "http://www.newattr.com"; String qualifiedName = "emp:newAttr"; @@ -145,7 +160,15 @@ public final class SetAttributeNodeNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNode3() throws Throwable { String namespaceURI = "http://www.newattr.com"; String qualifiedName = "emp:newAttr"; @@ -163,7 +186,15 @@ public final class SetAttributeNodeNS extends DOMTestCase { .setAttributeNodeNS(newAttr); assertNull("throw_Null", newAddrAttr); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Doesn't verify DOMException.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNode4() throws Throwable { Document doc; NodeList elementList; @@ -181,7 +212,15 @@ public final class SetAttributeNodeNS extends DOMTestCase { newName = newAddrAttr.getNodeName(); assertEquals("nodeName", "emp:domestic", newName); } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", + targets = { + @TestTarget( + methodName = "setAttributeNodeNS", + methodArgs = {org.w3c.dom.Attr.class} + ) + }) public void testSetAttributeNode5() throws Throwable { String namespaceURI = "http://www.newattr.com"; String qualifiedName = "emp:newAttr"; diff --git a/xml/src/test/java/org/w3c/dom/SetNamedItemNS.java b/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java index 6c36dd9..2237eff 100644 --- a/xml/src/test/java/org/w3c/dom/SetNamedItemNS.java +++ b/xml/src/test/java/tests/org/w3c/dom/SetNamedItemNS.java @@ -20,15 +20,20 @@ See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; 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 @@ -46,6 +51,7 @@ import org.w3c.dom.NodeList; * @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; @@ -73,6 +79,15 @@ public final class SetNamedItemNS extends DOMTestCase { * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with INUSE_ATTRIBUTE_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS1() throws Throwable { Document doc; NodeList elementList; @@ -100,6 +115,15 @@ public final class SetNamedItemNS extends DOMTestCase { assertTrue("throw_INUSE_ATTRIBUTE_ERR", success); } } + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies DOMException with WRONG_DOCUMENT_ERR code.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS2() throws Throwable { String namespaceURI = "http://www.usa.com"; String qualifiedName = "dmstc:domestic"; @@ -128,6 +152,15 @@ public final class SetNamedItemNS extends DOMTestCase { assertTrue("throw_WRONG_DOCUMENT_ERR", success); } } + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive fnctionality.", + targets = { + @TestTarget( + methodName = "getNamedItemNS", + methodArgs = {java.lang.String.class, java.lang.String.class} + ) + }) public void testSetNamedItemNS3() throws Throwable { String namespaceURI = "http://www.nist.gov"; String qualifiedName = "prefix:newAttr"; @@ -193,7 +226,15 @@ public final class SetNamedItemNS extends DOMTestCase { // assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success); // } // } - + @TestInfo( + level = TestLevel.PARTIAL_OK, + purpose = "Verifies positive fnctionality.", + targets = { + @TestTarget( + methodName = "setNamedItemNS", + methodArgs = {org.w3c.dom.Node.class} + ) + }) public void testSetNamedItemNS5() throws Throwable { String namespaceURI = "http://www.usa.com"; String qualifiedName = "dmstc:domestic"; diff --git a/xml/src/test/java/org/w3c/dom/SystemId.java b/xml/src/test/java/tests/org/w3c/dom/SystemId.java index 4250581..e3bde42 100644 --- a/xml/src/test/java/org/w3c/dom/SystemId.java +++ b/xml/src/test/java/tests/org/w3c/dom/SystemId.java @@ -19,12 +19,17 @@ */ -package org.w3c.dom; +package tests.org.w3c.dom; -import javax.xml.parsers.DocumentBuilder; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; -import org.w3c.dom.Document; 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 @@ -38,6 +43,7 @@ import org.w3c.dom.DocumentType; * @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; @@ -67,6 +73,15 @@ public final class SystemId extends DOMTestCase { * @throws Throwable * Any uncaught exception causes test to fail */ + @TestInfo( + level = TestLevel.COMPLETE, + purpose = "", + targets = { + @TestTarget( + methodName = "getSystemId", + methodArgs = {} + ) + }) public void testGetSystemId() throws Throwable { Document doc; DocumentType docType; diff --git a/xml/src/test/java/tests/xml/AllTests.java b/xml/src/test/java/tests/xml/AllTests.java index f18510a..146eb57 100644 --- a/xml/src/test/java/tests/xml/AllTests.java +++ b/xml/src/test/java/tests/xml/AllTests.java @@ -27,9 +27,9 @@ public class AllTests { suite.addTestSuite(SimpleParserTest.class); suite.addTestSuite(SimpleBuilderTest.class); - suite.addTest(org.w3c.dom.AllTests.suite()); + suite.addTest(tests.org.w3c.dom.AllTests.suite()); suite.addTest(tests.api.javax.xml.parsers.AllTests.suite()); - + return suite; } diff --git a/xml/src/test/java/tests/xml/SimpleBuilderTest.java b/xml/src/test/java/tests/xml/SimpleBuilderTest.java index 412c9a7..c25698c 100644 --- a/xml/src/test/java/tests/xml/SimpleBuilderTest.java +++ b/xml/src/test/java/tests/xml/SimpleBuilderTest.java @@ -16,6 +16,11 @@ package tests.xml; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; + import junit.framework.TestCase; import org.w3c.dom.Comment; @@ -30,6 +35,7 @@ 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; @@ -57,7 +63,15 @@ public class SimpleBuilderTest extends TestCase { return result; } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Regression test.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class} + ) + }) public void testGoodFile1() throws Exception { Document document = builder.parse(getClass().getResourceAsStream( "/SimpleBuilderTest.xml")); @@ -110,7 +124,15 @@ public class SimpleBuilderTest extends TestCase { assertEquals("The quick brown fox jumps over the lazy dog.", proinst); assertEquals(" Fragile! Handle me with care! ", comment); } - + @TestInfo( + level = TestLevel.TODO, + purpose = "Doesn't verify anything.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class} + ) + }) public void testGoodFile2() throws Exception { Document document = builder.parse(getClass().getResourceAsStream( "/staffNS.xml")); diff --git a/xml/src/test/java/tests/xml/SimpleParserTest.java b/xml/src/test/java/tests/xml/SimpleParserTest.java index 5932c95..0d63262 100644 --- a/xml/src/test/java/tests/xml/SimpleParserTest.java +++ b/xml/src/test/java/tests/xml/SimpleParserTest.java @@ -16,6 +16,11 @@ package tests.xml; +import dalvik.annotation.TestInfo; +import dalvik.annotation.TestLevel; +import dalvik.annotation.TestTarget; +import dalvik.annotation.TestTargetClass; + import junit.framework.TestCase; import org.xml.sax.Attributes; @@ -34,6 +39,7 @@ 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; @@ -160,7 +166,16 @@ public class SimpleParserTest extends TestCase implements ContentHandler { public void startPrefixMapping(String prefix, String uri) { } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class, + org.xml.sax.helpers.DefaultHandler.class} + ) + }) public void testWorkingFile1() throws Exception { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(false); @@ -185,7 +200,15 @@ public class SimpleParserTest extends TestCase implements ContentHandler { assertEquals("http://www.foobar.org", namespaces1.get("stuff")); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) + }) public void testWorkingFile2() throws Exception { SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -214,7 +237,15 @@ public class SimpleParserTest extends TestCase implements ContentHandler { assertEquals(0, namespaces2.size()); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify exceptions.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) + }) public void testEntityResolver() throws Exception { final StringBuilder text = new StringBuilder(); DefaultHandler handler = new DefaultHandler() { @@ -244,7 +275,15 @@ public class SimpleParserTest extends TestCase implements ContentHandler { "resolved external entity must be in parser character stream", text.toString().contains("test")); } - + @TestInfo( + level = TestLevel.PARTIAL, + purpose = "Doesn't verify exceptions.", + targets = { + @TestTarget( + methodName = "parse", + methodArgs = {java.io.InputStream.class, org.xml.sax.helpers.DefaultHandler.class} + ) + }) public void testGetValue() throws Exception{ parser.parse(getClass().getResourceAsStream("/staffNS.xml"), new DefaultHandler() { |