KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > tools > doclet > DTDDocletTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.tools.doclet;
20
21 import junit.textui.TestRunner;
22 import org.netbeans.modules.xml.core.DTDDataObject;
23 import org.netbeans.modules.xml.tax.cookies.TreeEditorCookie;
24 import org.netbeans.tax.TreeDTD;
25 import org.netbeans.tests.xml.XTest;
26
27
28 /**
29  * <P>
30  * <P>
31  * <FONT COLOR="#CC3333" FACE="Courier New, Monospaced" SIZE="+1">
32  * <B>
33  * <BR> XML Module API Test: XMLGenerator3Test
34  * </B>
35  * </FONT>
36  * <BR><BR><B>What it tests:</B><BR>
37  * DTDDocletTest checks 'Generate Documentation' action on DTD document. The action is
38  * accesible from popup menu an all DTD document nodes.<BR>
39  *
40  * <BR><B>How it works:</B><BR>
41  * Test opens DTD document, generates documentation in HTML for the document and writes
42  * the documentation into output.<BR>
43  *
44  * <BR><BR><B>Settings:</B><BR>
45  * None
46  *
47  * <BR><BR><B>Output (Golden file):</B><BR>
48  * DTD documentation in HTML format.<BR>
49  *
50  * <BR><B>Possible reasons of failure:</B>
51  * <UL>
52  * <LI type="circle">
53  * <I>None<BR></I>
54  * </LI>
55  * </UL>
56  * <P>
57  */

58
59 public class DTDDocletTest extends XTest {
60     
61     /** Creates new CoreSettingsTest */
62     public DTDDocletTest(String JavaDoc testName) {
63         super(testName);
64     }
65     
66     public void test() throws Exception JavaDoc {
67         DTDDataObject dao = (DTDDataObject) TestUtil.THIS.findData("books.dtd");
68         if (dao == null) {
69             fail("\"data/books.dtd\" data object is not found!");
70         }
71         TreeEditorCookie cake = (TreeEditorCookie) dao.getCookie(TreeEditorCookie.class);
72         TreeDTD dtd = (TreeDTD) cake.openDocumentRoot();
73         DTDDoclet doclet = new DTDDoclet();
74         String JavaDoc result = doclet.createDoclet(dtd);
75         result = TestUtil.replaceString(result, "<!--", "-->", "<!-- REMOVED -->");
76         ref(result);
77         compareReferenceFiles();
78     }
79     
80     /**
81      * Performs this testsuite.
82      * @param args the command line arguments
83      */

84     public static void main(String JavaDoc args[]) {
85         TestRunner.run(DTDDocletTest.class);
86     }
87 }
88
Popular Tags