01: package org.geotools.data.gml;
02:
03: import org.geotools.gml3.ApplicationSchemaConfiguration;
04:
05: import com.vividsolutions.jts.geom.Coordinate;
06: import com.vividsolutions.jts.geom.Envelope;
07:
08: public class GMLFeatureCollectionTest extends GMLDataStoreTestSupport {
09:
10: public void testSize() throws Exception {
11: GMLFeatureCollection collection = new GMLFeatureCollection(
12: (GMLTypeEntry) dataStore.entry("TestFeature"));
13: assertEquals(3, collection.size());
14: }
15:
16: public void testManualBounds() throws Exception {
17: GMLFeatureCollection collection = new GMLFeatureCollection(
18: (GMLTypeEntry) dataStore.entry("TestFeature"));
19: Envelope bounds = collection.getBounds();
20: assertNotNull(bounds);
21: assertEquals(bounds, new Envelope(new Coordinate(0, 0),
22: new Coordinate(2, 2)));
23: }
24:
25: public void testOptimizedBounds() throws Exception {
26: String location = getClass().getResource("test-withBounds.xml")
27: .toString();
28: String schemaLocation = getClass().getResource("test.xsd")
29: .toString();
30:
31: GMLDataStore dataStore = dataStore = new GMLDataStore(location,
32: new ApplicationSchemaConfiguration(
33: "http://www.geotools.org/test", schemaLocation));
34:
35: GMLFeatureCollection collection = new GMLFeatureCollection(
36: (GMLTypeEntry) dataStore.entry("TestFeature"));
37:
38: Envelope bounds = collection.getBounds();
39: assertNotNull(bounds);
40: assertEquals(bounds, new Envelope(new Coordinate(0, 0),
41: new Coordinate(3, 3)));
42: }
43:
44: }
|