Search in sources :

Example 1 with DescribeProcess

use of org.geosdi.geoplatform.xml.wps.v100.DescribeProcess in project geo-platform by geosdi.

the class WPSDescribeProcessRequestV100 method createRequest.

/**
 * @return {@link DescribeProcess}
 * @throws Exception
 */
@Override
protected DescribeProcess createRequest() throws Exception {
    checkArgument(this.isSetProcessIdentifiers(), "The Parameter ProcessIdentifiers must not be null or Empty.");
    List<CodeType> processCodeTypes = this.processIdentifiers.stream().filter(value -> ((value != null) && !(value.trim().isEmpty()))).map(PROCESS_IDENTIFIER).collect(toList());
    checkArgument((processCodeTypes != null) && !(processCodeTypes.isEmpty()), "The Parameter ProcessCodeTypes must not be null or an Empty List.");
    DescribeProcess describeProcess = new DescribeProcess();
    describeProcess.setIdentifier(processCodeTypes);
    if (this.isLanguageSet())
        describeProcess.setLanguage(this.language);
    return describeProcess;
}
Also used : CodeType(org.geosdi.geoplatform.xml.ows.v110.CodeType) DescribeProcess(org.geosdi.geoplatform.xml.wps.v100.DescribeProcess)

Example 2 with DescribeProcess

use of org.geosdi.geoplatform.xml.wps.v100.DescribeProcess in project geo-platform by geosdi.

the class WPSDescribeProcessUnmarshallerTest method unmarshallWPSDescribeProcessTest.

@Theory
public void unmarshallWPSDescribeProcessTest(String fileName) throws Exception {
    String describeProcess = dirFiles.concat(fileName);
    File file = new File(describeProcess);
    Unmarshaller unmarshaller = wpsJAXBContext.acquireUnmarshaller();
    ProcessDescriptions processDescriptions = (ProcessDescriptions) unmarshaller.unmarshal(file);
    logger.info("##########################WPS_PROCESS_DESCRIPTIONS : \n{}\n for File : {}\n", processDescriptions, fileName);
}
Also used : Unmarshaller(javax.xml.bind.Unmarshaller) ProcessDescriptions(org.geosdi.geoplatform.xml.wps.v100.ProcessDescriptions) File(java.io.File) Theory(org.junit.experimental.theories.Theory)

Example 3 with DescribeProcess

use of org.geosdi.geoplatform.xml.wps.v100.DescribeProcess in project geotoolkit by Geomatys.

the class WebProcessingClient method createDescribeProcess.

/**
 * Create a describe process request
 *
 * @return DescribeProcessRequest : describe process request.
 */
public DescribeProcessRequest createDescribeProcess() {
    final WPSVersion version = ensureVersionSet();
    final DescribeProcessRequest request = new DescribeProcessRequest(serverURL.toString(), getClientSecurity(), forceGET, getTimeOutValue());
    DescribeProcess content = new DescribeProcess();
    content.setService("WPS");
    content.setVersion(version.getCode());
    request.setContent(content);
    return request;
}
Also used : DescribeProcess(org.geotoolkit.wps.xml.v200.DescribeProcess)

Example 4 with DescribeProcess

use of org.geosdi.geoplatform.xml.wps.v100.DescribeProcess in project geotoolkit by Geomatys.

the class DescribeProcessTest method testRequestAndMarshall.

@Test
public void testRequestAndMarshall() throws Exception {
    final WebProcessingClient client = new WebProcessingClient(new URL("http://test.com"), null, WPSVersion.v100);
    final DescribeProcessRequest request = client.createDescribeProcess();
    final DescribeProcess content = request.getContent();
    content.setIdentifier(Arrays.asList("identifier1", "identifier2", "identifier3"));
    final StringWriter stringWriter = new StringWriter();
    final Marshaller marshaller = WPSMarshallerPool.getInstance().acquireMarshaller();
    marshaller.marshal(content, stringWriter);
    String result = stringWriter.toString();
    final String expectedMarshalledRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<wps:DescribeProcess version=\"1.0.0\" service=\"WPS\"" + " xmlns:wps=\"http://www.opengis.net/wps/1.0.0\"" + " xmlns:ows=\"http://www.opengis.net/ows/1.1\">\n" + "    <ows:Identifier>identifier1</ows:Identifier>\n" + "    <ows:Identifier>identifier2</ows:Identifier>\n" + "    <ows:Identifier>identifier3</ows:Identifier>\n" + "</wps:DescribeProcess>\n";
    assertXmlEquals(expectedMarshalledRequest, result, "xmlns:*");
    WPSMarshallerPool.getInstance().recycle(marshaller);
}
Also used : Marshaller(javax.xml.bind.Marshaller) StringWriter(java.io.StringWriter) DescribeProcess(org.geotoolkit.wps.xml.v200.DescribeProcess) WebProcessingClient(org.geotoolkit.wps.client.WebProcessingClient) DescribeProcessRequest(org.geotoolkit.wps.client.DescribeProcessRequest) URL(java.net.URL) Test(org.junit.Test)

Example 5 with DescribeProcess

use of org.geosdi.geoplatform.xml.wps.v100.DescribeProcess in project geotoolkit by Geomatys.

the class DescribeProcessTest method testDescribeProcess110.

/**
 * Ensures the {@link DescribeProcess#getURL()} method returns a well-built url,
 * with the parameters given.
 */
@Test
public void testDescribeProcess110() throws MalformedURLException {
    final WebProcessingClient client = new WebProcessingClient(new URL("http://test.com"), null, WPSVersion.v100);
    final DescribeProcessRequest request = client.createDescribeProcess();
    final DescribeProcess content = request.getContent();
    content.setIdentifier(Arrays.asList("identifier1", "identifier2", "identifier3"));
    final URL url;
    try {
        url = request.getURL();
    } catch (MalformedURLException ex) {
        fail(ex.getLocalizedMessage());
        return;
    }
    final String strUrl = url.toString();
    // final String expectedURL = "http://test.com?VERSION=1.0.0&SERVICE=WPS&REQUEST=DescribeProcess&IDENTIFIER=identifier1,identifier2,identifier3";
    assertTrue(strUrl.contains("VERSION=1.0.0"));
    assertTrue(strUrl.contains("SERVICE=WPS"));
    assertTrue(strUrl.contains("REQUEST=DescribeProcess"));
    assertTrue(strUrl.contains("IDENTIFIER=identifier1%2Cidentifier2%2Cidentifier3"));
}
Also used : MalformedURLException(java.net.MalformedURLException) DescribeProcess(org.geotoolkit.wps.xml.v200.DescribeProcess) WebProcessingClient(org.geotoolkit.wps.client.WebProcessingClient) DescribeProcessRequest(org.geotoolkit.wps.client.DescribeProcessRequest) URL(java.net.URL) Test(org.junit.Test)

Aggregations

DescribeProcess (org.geotoolkit.wps.xml.v200.DescribeProcess)4 URL (java.net.URL)2 Marshaller (javax.xml.bind.Marshaller)2 DescribeProcessRequest (org.geotoolkit.wps.client.DescribeProcessRequest)2 WebProcessingClient (org.geotoolkit.wps.client.WebProcessingClient)2 Test (org.junit.Test)2 File (java.io.File)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 StringWriter (java.io.StringWriter)1 MalformedURLException (java.net.MalformedURLException)1 URLConnection (java.net.URLConnection)1 JAXBException (javax.xml.bind.JAXBException)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 CodeType (org.geosdi.geoplatform.xml.ows.v110.CodeType)1 DescribeProcess (org.geosdi.geoplatform.xml.wps.v100.DescribeProcess)1 ProcessDescriptions (org.geosdi.geoplatform.xml.wps.v100.ProcessDescriptions)1 Theory (org.junit.experimental.theories.Theory)1