KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > TestApplication1_4


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
20 /*
21  * TestApplication - test the basic features.
22  *
23  * The following test assumes that we know the content of the
24  * graph as we get elements, add and change them. Therefore, the TestApplication.xml
25  * file and this java test should be kept in sync.
26  *
27  */

28
29 import java.io.*;
30 import java.util.*;
31 import org.w3c.dom.*;
32
33 import application.*;
34
35
36 public class TestApplication1_4 extends BaseTest {
37     public static void main(String JavaDoc[] argv) {
38         TestApplication1_4 o = new TestApplication1_4();
39         if (argv.length > 0)
40             o.setDocumentDir(argv[0]);
41         try {
42             o.run();
43         } catch (Exception JavaDoc e) {
44             e.printStackTrace();
45             System.exit(1);
46         }
47         System.exit(0);
48     }
49     
50     public void run() throws Exception JavaDoc {
51         Application app;
52
53         this.readDocument();
54
55         out("creating the bean graph");
56         app = Application.read(doc);
57     
58         // Check that we can read the graph an it is complete
59
out("bean graph created");
60         app.write(out);
61     }
62 }
63
Popular Tags