Commit 39cc8068 authored by Andrea Aime's avatar Andrea Aime
Browse files

[GEOS-7055] A disabled WPS service will still respond to requests

parent a6862c73
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -20,7 +20,6 @@ import net.opengis.wps10.ProcessDescriptionsType;
import net.opengis.wps10.WPSCapabilitiesType;
import org.geoserver.config.GeoServer;
import org.geoserver.config.GeoServerInfo;
import org.geoserver.wps.executor.WPSExecutionManager;
import org.geotools.util.logging.Logging;
import org.springframework.beans.BeansException;
......@@ -35,17 +34,14 @@ import org.springframework.context.ApplicationContextAware;
public class DefaultWebProcessingService implements WebProcessingService, ApplicationContextAware {
private static final Logger LOGGER = Logging.getLogger(DefaultWebProcessingService.class);
protected WPSInfo wps;
protected GeoServerInfo gs;
protected GeoServer gs;
protected ApplicationContext context;
protected WPSExecutionManager executionManager;
public DefaultWebProcessingService(GeoServer gs, WPSExecutionManager executionManager) {
this.wps = gs.getService(WPSInfo.class);
this.gs = gs.getGlobal();
this.gs = gs;
this.executionManager = executionManager;
}
......@@ -53,21 +49,21 @@ public class DefaultWebProcessingService implements WebProcessingService, Applic
* @see WebMapService#getServiceInfo()
*/
public WPSInfo getServiceInfo() {
return wps;
return gs.getService(WPSInfo.class);
}
/**
* @see org.geoserver.wps.WebProcessingService#getCapabilities
*/
public WPSCapabilitiesType getCapabilities(GetCapabilitiesType request) throws WPSException {
return new GetCapabilities(this.wps, context).run(request);
return new GetCapabilities(getServiceInfo(), context).run(request);
}
/**
* @see org.geoserver.wps.WebProcessingService#describeProcess
*/
public ProcessDescriptionsType describeProcess(DescribeProcessType request) throws WPSException {
return new DescribeProcess(this.wps, context).run(request);
return new DescribeProcess(getServiceInfo(), context).run(request);
}
/**
......@@ -82,7 +78,7 @@ public class DefaultWebProcessingService implements WebProcessingService, Applic
*/
public void getSchema(HttpServletRequest request, HttpServletResponse response)
throws WPSException {
new GetSchema(this.wps).run(request, response);
new GetSchema(getServiceInfo()).run(request, response);
}
/**
......
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -65,4 +65,9 @@ public interface WebProcessingService {
* @throws WPSException
*/
File getExecutionResult(GetExecutionResultType request) throws WPSException;
/**
* WPS service configuration.
*/
WPSInfo getServiceInfo();
}
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
/* (c) 2014 - 2015 Open Source Geospatial Foundation - all rights reserved
* (c) 2001 - 2013 OpenPlans
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
......@@ -11,6 +11,7 @@ import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import org.custommonkey.xmlunit.XMLUnit;
import org.custommonkey.xmlunit.XpathEngine;
import org.geoserver.config.GeoServer;
import org.geoserver.data.test.MockData;
import org.junit.Test;
import org.w3c.dom.Document;
......@@ -24,6 +25,22 @@ public class GetCapabilitiesTest extends WPSTestSupport {
basicCapabilitiesTest(d, null);
}
@Test
public void testGetDisabledService() throws Exception {
GeoServer gs = getGeoServer();
WPSInfo info = gs.getService(WPSInfo.class);
try {
info.setEnabled(false);
gs.save(info);
Document dom = getAsDOM("wps?service=wps&request=getcapabilities");
// print(dom);
checkOws10Exception(dom);
} finally {
info.setEnabled(true);
gs.save(info);
}
}
@Test
public void testGetBasicWorkspaceQualified() throws Exception {
// this one did not report the workspace specific urls
......
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