Layer layer = createMapLayer(MockData.BASIC_POLYGONS, "SingleFeature");
FeatureSource<SimpleFeatureType, SimpleFeature> featureSource;
featureSource = (SimpleFeatureSource) layer.getFeatureSource();
WMSMapContent mapContent = new WMSMapContent(createGetMapRequest(MockData.BASIC_POLYGONS));
Document document;
try {
mapContent.addLayer(layer);
KMLVectorTransformer transformer = new KMLVectorTransformer(getWMS(), mapContent,
layer);
transformer.setIndentation(2);
document = WMSTestSupport.transform(featureSource.getFeatures(), transformer);
} finally {
mapContent.dispose();
}
Element element = document.getDocumentElement();
assertEquals("kml", element.getNodeName());
assertEquals(1, element.getElementsByTagName("Placemark").getLength());
assertEquals(1, element.getElementsByTagName("Style").getLength());