KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > lazydom > BasicHTMLTests


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: BasicHTMLTests.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.lazydom;
25 import java.io.File JavaDoc;
26 import java.lang.reflect.Method JavaDoc;
27
28 import junit.framework.Test;
29
30 import org.enhydra.xml.driver.TestDomOps;
31 import org.enhydra.xml.lazydom.html.LazyHTMLDocument;
32
33 /**
34  * Basic tests of HTML Lazy DOM. XMLC coverts a lot of this too.
35  */

36 public class BasicHTMLTests extends LazyDOMTestCaseBase {
37     /** Input files */
38     private static final String JavaDoc FRAME_TREE_HTML_DIR = "../xmlc/html";
39     private static final String JavaDoc FRAME_TREE_HTML = "FrameTree.html";
40
41     /** DOM builder and parser */
42     private LazyDOMBuilder fBuilder
43         = new LazyDOMBuilder(getMsgWriter(),
44                              org.enhydra.xml.xmlc.dom.lazydom.LazyHTMLDomFactory.class);
45
46     /** Factory method to create suite of these tests */
47     public static Test suite() {
48         return createSuite(BasicHTMLTests.class, null);
49     }
50     
51     /** Constructor */
52     public BasicHTMLTests(Method JavaDoc method) {
53         super(method);
54     }
55
56     /** Create an unexpanded document from FrameTree.html */
57     private LazyHTMLDocument parseFrameTree() {
58         File JavaDoc frameTree = getOtherInputFile(FRAME_TREE_HTML_DIR,
59                                            FRAME_TREE_HTML);
60         return (LazyHTMLDocument)fBuilder.parseUnexpanded(frameTree);
61     }
62
63     /**
64      * Test 1: Simple test on FrameTree.html
65      */

66     public void test1() {
67         LazyHTMLDocument lazyDoc = parseFrameTree();
68
69         printDiffDom("Unexpanded Lazy DOM", lazyDoc,
70                      "unexpanded.dom");
71         TestDomOps.expandTree(lazyDoc);
72         printDiffDom("Expanded Lazy DOM", lazyDoc,
73                      "expanded.dom");
74     }
75 }
76
Popular Tags