Home | History | Annotate | Download | only in core
      1 
      2 /*
      3 This Java source file was generated by test-to-java.xsl
      4 and is a derived work from the source document.
      5 The source document contained the following notice:
      6 
      7 
      8 
      9 
     10 
     11 Copyright (c) 2001 World Wide Web Consortium,
     12 
     13 (Massachusetts Institute of Technology, Institut National de
     14 
     15 Recherche en Informatique et en Automatique, Keio University).  All
     16 
     17 Rights Reserved.  This program is distributed under the W3C's Software
     18 
     19 Intellectual Property License.  This program is distributed in the
     20 
     21 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
     22 
     23 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     24 
     25 PURPOSE.
     26 
     27 
     28 
     29 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
     30 
     31 
     32 
     33 
     34 */
     35 
     36 package org.w3c.domts.level2.core;
     37 
     38 import org.w3c.dom.*;
     39 
     40 
     41 import org.w3c.domts.DOMTestCase;
     42 import org.w3c.domts.DOMTestDocumentBuilderFactory;
     43 
     44 
     45 
     46 /**
     47  *     The createDocument method with valid arguments, should create a DOM Document of
     48  *     the specified type.
     49  *
     50  *     Call the createDocument on this DOMImplementation with
     51  *     createDocument ("http://www.w3.org/DOMTest/L2",see the array below for valid QNames,null).
     52  *     Check if the returned Document object is is empty with no Document Element.
     53 * @author IBM
     54 * @author Neil Delima
     55 * @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>
     56 */
     57 public final class domimplementationcreatedocument03 extends DOMTestCase {
     58 
     59    /**
     60     * Constructor.
     61     * @param factory document factory, may not be null
     62     * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
     63     */
     64    public domimplementationcreatedocument03(final DOMTestDocumentBuilderFactory factory)  throws org.w3c.domts.DOMTestIncompatibleException {
     65 
     66       org.w3c.domts.DocumentBuilderSetting[] settings =
     67           new org.w3c.domts.DocumentBuilderSetting[] {
     68 org.w3c.domts.DocumentBuilderSetting.namespaceAware
     69         };
     70         DOMTestDocumentBuilderFactory testFactory = factory.newInstance(settings);
     71         setFactory(testFactory);
     72 
     73     //
     74     //   check if loaded documents are supported for content type
     75     //
     76     String contentType = getContentType();
     77     preload(contentType, "staffNS", false);
     78     }
     79 
     80    /**
     81     * Runs the test case.
     82     * @throws Throwable Any uncaught exception causes test to fail
     83     */
     84    public void runTest() throws Throwable {
     85       Document doc;
     86       DOMImplementation domImpl;
     87       Document newDoc;
     88       DocumentType docType = null;
     89 
     90       String namespaceURI = "http://www.w3.org/DOMTest/L2";
     91       String qualifiedName;
     92       java.util.List qualifiedNames = new java.util.ArrayList();
     93       qualifiedNames.add("_:_");
     94       qualifiedNames.add("_:h0");
     95       qualifiedNames.add("_:test");
     96       qualifiedNames.add("l_:_");
     97       qualifiedNames.add("ns:_0");
     98       qualifiedNames.add("ns:a0");
     99       qualifiedNames.add("ns0:test");
    100       qualifiedNames.add("a.b:c");
    101       qualifiedNames.add("a-b:c");
    102       qualifiedNames.add("a-b:c");
    103 
    104       doc = (Document) load("staffNS", false);
    105       domImpl = doc.getImplementation();
    106       for (int indexN1006B = 0; indexN1006B < qualifiedNames.size(); indexN1006B++) {
    107           qualifiedName = (String) qualifiedNames.get(indexN1006B);
    108     newDoc = domImpl.createDocument(namespaceURI, qualifiedName, docType);
    109       assertNotNull("domimplementationcreatedocument03", newDoc);
    110         }
    111       }
    112    /**
    113     *  Gets URI that identifies the test.
    114     *  @return uri identifier of test
    115     */
    116    public String getTargetURI() {
    117       return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/domimplementationcreatedocument03";
    118    }
    119    /**
    120     * Runs this test from the command line.
    121     * @param args command line arguments
    122     */
    123    public static void main(final String[] args) {
    124         DOMTestCase.doMain(domimplementationcreatedocument03.class, args);
    125    }
    126 }
    127 
    128