Commit 3d447efd authored by DBlasby's avatar DBlasby Committed by Andrea Aime
Browse files

Test for [GEOS-7281] move input-less processes to RUNNING state during execution

parent 038c5154
/* (c) 2015 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.wps.other;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
import org.geoserver.wps.gs.GeoServerProcess;
/**
* No argument process, used for the sake of testing
*/
@DescribeProcess(title="NoArgWPS", description="NoArgWPS - test case for no argument process")
public class NoArgWPS implements GeoServerProcess {
@DescribeResult(name="result", description="output result")
public String execute( ) {
return "Completed!" ;
}
}
/* (c) 2015 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.wps.other;
import static org.junit.Assert.assertEquals;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.geoserver.data.test.SystemTestData;
import org.geoserver.wps.WPSTestSupport;
import org.junit.Test;
public class NoArgWPSTest extends WPSTestSupport {
@Override
protected void setUpSpring(List<String> springContextLocations) {
super.setUpSpring(springContextLocations);
springContextLocations.add("classpath*:/applicationContext-noargs.xml");
}
@Override
protected void registerNamespaces(Map<String, String> namespaces) {
namespaces.put("feature", SystemTestData.BUILDINGS.getNamespaceURI());
}
/**
* This test runs a no-argument WPS Process and checks the result.
*
* @throws Exception
*/
@Test
public void NoArgumentProcessTest() throws Exception {
String xml = "<wps:Execute service='WPS' version='1.0.0' xmlns:wps='http://www.opengis.net/wps/1.0.0' "
+ "xmlns:ows='http://www.opengis.net/ows/1.1'>"
+ "<ows:Identifier>gs:NoArgWPS</ows:Identifier>" + "<wps:DataInputs>"
+ "</wps:DataInputs>" + "<wps:ResponseForm>"
+ "<wps:RawDataOutput mimeType=\"text/xml\">"
+ "<ows:Identifier>result</ows:Identifier>" + "</wps:RawDataOutput>"
+ "</wps:ResponseForm>" + "</wps:Execute>";
// Document d = postAsDOM(root(), xml); // allows you to debug exception
InputStream is = post(root(), xml);
String s = IOUtils.toString(is);
assertEquals(s, "Completed!");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2015 - Open Source Geospatial Foundation. All rights reserved.
This code is licensed under the GPL 2.0 license, available at the root
application directory.
-->
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="NoArgWPS" class="org.geoserver.wps.other.NoArgWPS" />
</beans>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment