01: package org.geoserver.wfs;
02:
03: import org.geoserver.test.GeoServerTestSupport;
04: import org.w3c.dom.Document;
05: import org.w3c.dom.Element;
06: import org.w3c.dom.NodeList;
07:
08: public class SrsNameTest extends GeoServerTestSupport {
09:
10: public void testWfs10() throws Exception {
11: String q = "wfs?request=getfeature&service=wfs&version=1.0.0"
12: + "&typename=cgf:Points";
13: Document d = getAsDOM(q);
14:
15: assertEquals("wfs:FeatureCollection", d.getDocumentElement()
16: .getNodeName());
17:
18: NodeList boxes = d.getElementsByTagName("gml:Box");
19: assertFalse(boxes.getLength() == 0);
20: for (int i = 0; i < boxes.getLength(); i++) {
21: Element box = (Element) boxes.item(i);
22: assertEquals(
23: "http://www.opengis.net/gml/srs/epsg.xml#4326", box
24: .getAttribute("srsName"));
25: }
26:
27: NodeList points = d.getElementsByTagName("gml:Point");
28: assertFalse(points.getLength() == 0);
29: for (int i = 0; i < points.getLength(); i++) {
30: Element point = (Element) points.item(i);
31: assertEquals(
32: "http://www.opengis.net/gml/srs/epsg.xml#4326",
33: point.getAttribute("srsName"));
34: }
35:
36: }
37:
38: public void testWfs11() throws Exception {
39: String q = "wfs?request=getfeature&service=wfs&version=1.1.0"
40: + "&typename=cgf:Points";
41: Document d = getAsDOM(q);
42:
43: assertEquals("wfs:FeatureCollection", d.getDocumentElement()
44: .getNodeName());
45:
46: NodeList boxes = d.getElementsByTagName("gml:Envelope");
47: assertFalse(boxes.getLength() == 0);
48: for (int i = 0; i < boxes.getLength(); i++) {
49: Element box = (Element) boxes.item(i);
50: assertEquals("urn:x-ogc:def:crs:EPSG:6.11.2:32615", box
51: .getAttribute("srsName"));
52: }
53:
54: NodeList points = d.getElementsByTagName("gml:Point");
55: assertFalse(points.getLength() == 0);
56: for (int i = 0; i < points.getLength(); i++) {
57: Element point = (Element) points.item(i);
58: assertEquals("urn:x-ogc:def:crs:EPSG:6.11.2:32615", point
59: .getAttribute("srsName"));
60: }
61: }
62: }
|