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.bindings;
17:
18: import org.w3c.dom.Document;
19: import com.vividsolutions.jts.geom.Geometry;
20: import com.vividsolutions.jts.geom.Point;
21: import org.opengis.referencing.crs.CoordinateReferenceSystem;
22: import org.geotools.referencing.CRS;
23: import org.geotools.xml.Binding;
24:
25: public class GMLAbstractGeometryTypeBindingTest extends GMLTestSupport {
26: public void testType() {
27: assertEquals(Geometry.class, binding(GML.AbstractGeometryType)
28: .getType());
29: }
30:
31: public void testExecutionMode() {
32: assertEquals(Binding.OVERRIDE,
33: binding(GML.AbstractGeometryType).getExecutionMode());
34: }
35:
36: public void testParse() throws Exception {
37: GML2MockData.point(document, document);
38: document.getDocumentElement().setAttribute("srsName",
39: "EPSG:4326");
40:
41: Point p = (Point) parse();
42: assertTrue(p.getUserData() instanceof CoordinateReferenceSystem);
43: }
44:
45: public void testEncode() throws Exception {
46: Point p = GML2MockData.point();
47: p.setUserData(CRS.decode("EPSG:4326", true));
48:
49: Document doc = encode(p, GML.Point);
50: assertEquals("http://www.opengis.net/gml/srs/epsg.xml#4326",
51: doc.getDocumentElement().getAttribute("srsName"));
52: }
53: }
|