// does the server contain the specific process I want
boolean found = false;
Iterator iterator = processes.iterator();
while (iterator.hasNext())
{
ProcessBriefType process = (ProcessBriefType) iterator.next();
if (process.getIdentifier().getValue().equalsIgnoreCase(processIden))
{
found = true;
break;
}
}
// exit test if my process doesn't exist on server
if (!found)
{
return;
}
// do a full describeprocess on my process
DescribeProcessRequest descRequest = wps.createDescribeProcessRequest();
descRequest.setIdentifier(processIden);
ExecuteProcessRequest execRequest = wps.createExecuteProcessRequest();
execRequest.setIdentifier(processIden);
execRequest.addInput("buffer", Arrays.asList(wps.createLiteralInputValue("350")));
execRequest.addInput("geom1", Arrays.asList(wps.createBoundingBoxInputValue(
"EPSG:4326", 2, Arrays.asList(-180.0, -90.0), Arrays.asList(-180.0, -90.0))));
ResponseDocumentType respDoc = wps.createResponseDocumentType(false, true, true, "result");
OutputDefinitionType rawOutput = wps.createOutputDefinitionType("test");
ResponseFormType responseForm = wps.createResponseForm(respDoc, rawOutput);
responseForm.setResponseDocument(respDoc);
execRequest.setResponseForm(responseForm);
execRequest.performPostOutput(System.out);
DescribeProcessResponse descResponse = wps.issueRequest(descRequest);
// based on the describeprocess, setup the execute
ProcessDescriptionsType processDesc = descResponse.getProcessDesc();
ProcessDescriptionType pdt = (ProcessDescriptionType) processDesc.getProcessDescription().get(0);
WPSFactory wpsfactory = new WPSFactory(pdt, this.url);
Process process = wpsfactory.create();
// setup the inputs
Map<String, Object> map = new TreeMap<String, Object>();
map.put("buffer", 350);
map.put("geom1", geom1);
// execute/send-request for the process
Map<String, Object> results = process.execute(map, null);
// check that the result is expected
assertNotNull(results);
Geometry expected = geom1.buffer(350);