01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.xml;
17:
18: import java.io.File;
19: import java.net.URI;
20: import java.net.URISyntaxException;
21: import java.util.logging.Level;
22:
23: import junit.framework.TestCase;
24:
25: import org.geotools.TestData;
26: import org.geotools.xml.schema.Schema;
27:
28: /**
29: * <p>
30: * DOCUMENT ME!
31: * </p>
32: * @
33: *
34: * @author dzwiers www.refractions.net
35: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/xml/src/test/java/org/geotools/xml/SchemaParser2Test.java $
36: */
37: public class SchemaParser2Test extends TestCase {
38: // public void testMail(){
39: // runit("","test/mails.xsd");
40: // }
41: public void testWFS() throws URISyntaxException {
42: runit(new URI("http://www.opengis.net/wfs"),
43: "xml/wfs/WFS-basic.xsd");
44: }
45:
46: public void testGMLFeature() throws URISyntaxException {
47: runit(new URI("http://www.opengis.net/gml"),
48: "xml/gml/feature.xsd");
49: }
50:
51: public void testGMLGeometry() throws URISyntaxException {
52: runit(new URI("http://www.opengis.net/gml"),
53: "xml/gml/geometry.xsd");
54: }
55:
56: public void testGMLXLinks() throws URISyntaxException {
57: runit(new URI("http://www.w3.org/1999/xlink"),
58: "xml/gml/xlinks.xsd");
59: }
60:
61: private void runit(URI targetNS, String path) {
62: Schema s = null;
63:
64: try {
65: File f = TestData.copy(this , path);
66: s = SchemaFactory.getInstance(targetNS, f.toURI(),
67: Level.INFO);
68: } catch (Exception e) {
69: e.printStackTrace();
70: fail(e.toString());
71: }
72:
73: assertNotNull("Schema missing", s);
74: System.out.println(s);
75:
76: Schema s2 = null;
77: s2 = SchemaFactory.getInstance(targetNS);
78: assertTrue("Should be the same", s == s2);
79: }
80: }
|