KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > core > wizard > SchemaParserTest


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  * SchemaParserTest.java
21  * NetBeans JUnit based test
22  *
23  * Created on July 24, 2002, 11:44 PM
24  */

25
26 package org.netbeans.modules.xml.core.wizard;
27
28 import java.io.IOException JavaDoc;
29 import java.net.URL JavaDoc;
30 import java.util.Set JavaDoc;
31 import java.util.TreeSet JavaDoc;
32 import junit.framework.*;
33 import org.netbeans.api.xml.services.UserCatalog;
34 import org.netbeans.junit.*;
35 import org.openide.util.Lookup;
36 import org.openide.xml.XMLUtil;
37 import org.xml.sax.*;
38 import org.xml.sax.helpers.*;
39
40 /**
41  *
42  * @author Petr Kuzel <petr.kuzel@sun.com>
43  */

44 public class SchemaParserTest extends NbTestCase {
45     
46     public SchemaParserTest(java.lang.String JavaDoc testName) {
47         super(testName);
48     }
49     
50     public static void main(java.lang.String JavaDoc[] args) {
51         junit.textui.TestRunner.run(suite());
52     }
53     
54     public static Test suite() {
55         TestSuite suite = new NbTestSuite(SchemaParserTest.class);
56         
57         return suite;
58     }
59     
60     /** Test of parse method, of class org.netbeans.modules.xml.core.wizard.SchemaParser. */
61     public void testParse() {
62         System.out.println("testParse");
63         
64         URL JavaDoc ns = getClass().getResource("data/schemaWithNS.xsd");
65         SchemaParser parser = new SchemaParser();
66
67         SchemaParser.SchemaInfo info = parser.parse(ns.toExternalForm());
68         assertTrue("root expected",info.roots.contains("root"));
69         assertTrue("ns expected", "test:schemaWithNS".equals(info.namespace));
70         assertTrue("unexpected root", info.roots.contains("seq1") == false);
71     }
72             
73 }
74
Popular Tags