KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > TestDupInternalNames


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  * TestDupInternalNames - test what happens when different complexTypes
22  * have the same named element declaration
23  * inside of them. Duplicate type names should
24  * get renamed.
25  *
26  * The following test assumes that we know the content of the
27  * graph as we get elements, add and change them. Therefore, the TestDupInternalNames.xml
28  * file and this java test should be kept in sync.
29  *
30  */

31
32 import java.io.*;
33 import java.util.*;
34 import org.w3c.dom.*;
35 import java.math.*;
36
37 import root.*;
38
39
40 public class TestDupInternalNames extends BaseTest {
41     public static void main(String JavaDoc[] argv) {
42         TestDupInternalNames o = new TestDupInternalNames();
43         if (argv.length > 0)
44             o.setDocumentDir(argv[0]);
45         try {
46             o.run();
47         } catch (Exception JavaDoc e) {
48             e.printStackTrace();
49             System.exit(1);
50         }
51         System.exit(0);
52     }
53     
54     public void run() throws Exception JavaDoc {
55         Root dupInternalNames;
56
57         this.readDocument();
58
59         out("creating the bean graph");
60         dupInternalNames = Root.read(doc);
61     
62         // Check that we can read the graph an it is complete
63
out("bean graph created");
64         dupInternalNames.write(out);
65
66         AnalogInput in = dupInternalNames.getIn();
67         in.setPointNumber(new BigInteger("5"));
68         AnalogOutput o = dupInternalNames.getOut();
69         o.setPointNumber(new BigInteger("89"));
70         dupInternalNames.write(out);
71     }
72 }
73
Popular Tags