01: package org.vfny.geoserver.wms.responses.map.kml;
02:
03: import org.geoserver.data.test.MockData;
04: import org.geoserver.wms.RemoteOWSTestSupport;
05: import org.geoserver.wms.WMSTestSupport;
06: import org.w3c.dom.Document;
07:
08: public class KMLTest extends WMSTestSupport {
09:
10: public void testVector() throws Exception {
11:
12: Document doc = getAsDOM("wms?request=getmap&service=wms&version=1.1.1"
13: + "&format="
14: + KMLMapProducerFactory.MIME_TYPE
15: + "&layers="
16: + MockData.BASIC_POLYGONS.getPrefix()
17: + ":"
18: + MockData.BASIC_POLYGONS.getLocalPart()
19: + "&styles="
20: + MockData.BASIC_POLYGONS.getLocalPart()
21: + "&height=1024&width=1024&bbox=-180,-90,180,90&srs=EPSG:4326");
22:
23: assertEquals(getFeatureSource(MockData.BASIC_POLYGONS)
24: .getFeatures().size(), doc.getElementsByTagName(
25: "Placemark").getLength());
26:
27: }
28:
29: public void testVectorWithFeatureId() throws Exception {
30:
31: Document doc = getAsDOM("wms?request=getmap&service=wms&version=1.1.1"
32: + "&format="
33: + KMLMapProducerFactory.MIME_TYPE
34: + "&layers="
35: + MockData.BASIC_POLYGONS.getPrefix()
36: + ":"
37: + MockData.BASIC_POLYGONS.getLocalPart()
38: + "&styles="
39: + MockData.BASIC_POLYGONS.getLocalPart()
40: + "&height=1024&width=1024&bbox=-180,-90,180,90&srs=EPSG:4326"
41: + "&featureid=BasicPolygons.1107531493643");
42:
43: assertEquals(1, doc.getElementsByTagName("Placemark")
44: .getLength());
45:
46: }
47:
48: public void testVectorWithRemoteLayer() throws Exception {
49: if (!RemoteOWSTestSupport.isRemoteStatesAvailable())
50: return;
51:
52: Document doc = getAsDOM("wms?request=getmap&service=wms&version=1.1.1"
53: + "&format="
54: + KMLMapProducerFactory.MIME_TYPE
55: + "&layers=topp:states"
56: + "&styles=Default"
57: + "&height=1024&width=1024&bbox=-180,-90,180,90&srs=EPSG:4326"
58: + "&remote_ows_type=wfs"
59: + "&remote_ows_url="
60: + RemoteOWSTestSupport.WFS_SERVER_URL
61: + "&featureid=states.1");
62:
63: assertEquals(1, doc.getElementsByTagName("Placemark")
64: .getLength());
65:
66: }
67: }
|