package org.geoserver.wps.gs;
import org.geoserver.data.test.MockData;
import org.geoserver.wps.WPSTestSupport;
import com.mockrunner.mock.web.MockHttpServletResponse;
public class CountProcessTest extends WPSTestSupport {
public void testCount() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<wps:Execute version=\"1.0.0\" service=\"WPS\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://www.opengis.net/wps/1.0.0\" xmlns:wfs=\"http://www.opengis.net/wfs\" xmlns:wps=\"http://www.opengis.net/wps/1.0.0\" xmlns:ows=\"http://www.opengis.net/ows/1.1\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns:ogc=\"http://www.opengis.net/ogc\" xmlns:wcs=\"http://www.opengis.net/wcs/1.1.1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xsi:schemaLocation=\"http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd\">\n"
+ " <ows:Identifier>gs:Count</ows:Identifier>\n"
+ " <wps:DataInputs>\n"
+ " <wps:Input>\n"
+ " <ows:Identifier>features</ows:Identifier>\n"
+ " <wps:Reference mimeType=\"text/xml; subtype=wfs-collection/1.0\" xlink:href=\"http://geoserver/wfs\" method=\"POST\">\n"
+ " <wps:Body>\n"
+ " <wfs:GetFeature service=\"WFS\" version=\"1.0.0\" outputFormat=\"GML2\">\n"
+ " <wfs:Query typeName=\"" + getLayerId(MockData.PRIMITIVEGEOFEATURE)
+ "\"/>\n" + " </wfs:GetFeature>\n" + " </wps:Body>\n"
+ " </wps:Reference>\n" + " </wps:Input>\n" + " </wps:DataInputs>\n"
+ " <wps:ResponseForm>\n" + " <wps:RawDataOutput>\n"
+ " <ows:Identifier>result</ows:Identifier>\n" + " </wps:RawDataOutput>\n"
+ " </wps:ResponseForm>\n" + "</wps:Execute>";
MockHttpServletResponse resp = postAsServletResponse(root(), xml);
assertEquals("text/plain", resp.getContentType());
assertEquals("5", resp.getOutputStreamContent());
resp = postAsServletResponse(root() + "content-disposition=attachment",xml);
assertEquals("attachment; filename=result.txt",resp.getHeader("Content-Disposition"));
}
}