01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-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;
09: * version 2.1 of the License.
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.gml2;
17:
18: import junit.framework.TestCase;
19: import org.picocontainer.MutablePicoContainer;
20: import org.picocontainer.defaults.DefaultPicoContainer;
21: import com.vividsolutions.jts.geom.CoordinateSequenceFactory;
22: import com.vividsolutions.jts.geom.GeometryFactory;
23: import org.geotools.feature.FeatureCollections;
24: import org.geotools.gml2.bindings.GML;
25: import org.geotools.xlink.XLINKConfiguration;
26:
27: public class GMLConfigurationTest extends TestCase {
28: GMLConfiguration configuration;
29:
30: protected void setUp() throws Exception {
31: super .setUp();
32:
33: configuration = new GMLConfiguration();
34: }
35:
36: public void testGetNamespaceURI() {
37: assertEquals(GML.NAMESPACE, configuration.getNamespaceURI());
38: }
39:
40: public void testGetSchemaLocation() {
41: assertEquals(GMLConfiguration.class.getResource("feature.xsd")
42: .toString(), configuration.getSchemaFileURL());
43: }
44:
45: public void testDependencies() {
46: assertEquals(2, configuration.getDependencies().size());
47: assertEquals(new XLINKConfiguration(), configuration
48: .getDependencies().get(1));
49: }
50:
51: public void testSchemaLocationResolver() {
52: assertEquals(GMLConfiguration.class.getResource("feature.xsd")
53: .toString(), configuration.getSchemaLocationResolver()
54: .resolveSchemaLocation(null, GML.NAMESPACE,
55: "feature.xsd"));
56: assertEquals(GMLConfiguration.class.getResource("geometry.xsd")
57: .toString(), configuration.getSchemaLocationResolver()
58: .resolveSchemaLocation(null, GML.NAMESPACE,
59: "geometry.xsd"));
60: }
61:
62: public void testContext() {
63: MutablePicoContainer container = new DefaultPicoContainer();
64: configuration.configureContext(container);
65:
66: assertNotNull(container
67: .getComponentInstanceOfType(FeatureTypeCache.class));
68: assertNotNull(container
69: .getComponentAdapter(CoordinateSequenceFactory.class));
70: assertNotNull(container
71: .getComponentAdapterOfType(GeometryFactory.class));
72: assertNotNull(container
73: .getComponentAdapterOfType(FeatureCollections.class));
74: }
75: }
|