01: /*
02: * Geotools2 - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-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: */
17: package org.geotools.data.complex.config;
18:
19: import java.net.URL;
20: import java.util.Set;
21: import java.util.logging.Level;
22:
23: import junit.framework.TestCase;
24:
25: import org.geotools.data.complex.FeatureTypeMapping;
26: import org.geotools.util.logging.Logging;
27:
28: /**
29: *
30: * @author Gabriel Roldan, Axios Engineering
31: * @version $Id: XMLConfigReaderTest.java 27848 2007-11-12 13:10:32Z desruisseaux $
32: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/community-schemas/community-schema-ds/src/test/java/org/geotools/data/complex/config/XMLConfigReaderTest.java $
33: * @since 2.4
34: */
35: public class XMLConfigReaderTest extends TestCase {
36:
37: protected void setUp() throws Exception {
38: super .setUp();
39: }
40:
41: protected void tearDown() throws Exception {
42: super .tearDown();
43: }
44:
45: /*
46: * Test method for 'org.geotools.data.complex.config.XMLConfigReader.parse(URL)'
47: */
48: public void testParseURL() throws Exception {
49: XMLConfigDigester reader = new XMLConfigDigester();
50: URL url = XMLConfigDigester.class
51: .getResource("/test-data/roadsegments.xml");
52: ComplexDataStoreDTO config = reader.parse(url);
53:
54: Set mappings = ComplexDataStoreConfigurator
55: .buildMappings(config);
56:
57: assertNotNull(mappings);
58: assertEquals(1, mappings.size());
59: FeatureTypeMapping mapping = (FeatureTypeMapping) mappings
60: .iterator().next();
61:
62: assertEquals(0, mapping.getGroupByAttNames().size());
63: assertEquals(6, mapping.getAttributeMappings().size());
64: assertNotNull(mapping.getTargetFeature());
65: assertNotNull(mapping.getSource());
66:
67: //Map/*<String, Expression>*/idMappings = mapping.getIdMappings();
68: //assertEquals(idMappings.get("RoadSegment"), ExpressionBuilder.parse("getId()"));
69: }
70:
71: }
|