Skip to content

Commit

Permalink
add integration test for metadata annotation in WPS4R, closes 52North…
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Nüst committed Mar 6, 2015
1 parent 303f91b commit 6c5d2f9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
11 changes: 11 additions & 0 deletions 52n-wps-webapp/src/main/webapp/R/scripts/test_metadata.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
###############################################################################
# wps.des: id = test.metadata, title = Test script, abstract = empty test
# script for checking metadata links in process descriptions;

# wps.in: id = input, title = dummy input,
# type = string, value = test, minOccurs = 0, maxOccurs = 1;

# wps.metadata: title = A test title for: a metadata link, href = http://test.url/metadata;
# wps.metadata: title = Another link, href = http://link.to/metadata;

# wps.out: id = output, type = string, title = dummy output;
24 changes: 23 additions & 1 deletion 52n-wps-webapp/src/test/java/org/n52/wps/test/Wps4rIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class Wps4rIT {

@BeforeClass
public static void beforeClass() {
wpsUrl = AllTestsIT.getWebappURL();
wpsUrl = AllTestsIT.getURL();

String host = System.getProperty("test.rserve.host", "127.0.0.1");
int port = Integer.parseInt(System.getProperty("test.rserve.port", "6311"));
Expand Down Expand Up @@ -418,4 +418,26 @@ public void csvResponseReferenceWorks() throws XmlException, IOException {
assertThat("CSV file contains test data names", csv, containsString("\"cadmium\",\"copper\",\"lead\",\"zinc\""));
}

@Test
public void metadataLinksAreInProcessDescription() throws XmlException, IOException {
URL resource = Wps4rIT.class.getResource("/R/DescribeProcessTestMetadata.xml");
XmlObject xmlPayload = XmlObject.Factory.parse(resource);

String payload = xmlPayload.toString();
String response = PostClient.sendRequest(wpsUrl, payload);

assertThat("Response is not an exception", response, not(containsString("ExceptionReport")));
assertThat("Response contains process ID", response, containsString("org.n52.wps.server.r.test.metadata"));
assertThat("Response contains first metadata link title",
response,
containsString("title=\"A test title for: a metadata link\""));
assertThat("Response contains first metadata link href",
response,
containsString("href=\"http://test.url/metadata\""));
assertThat("Response contains second metadata title", response, containsString("title=\"Another link\""));
assertThat("Response contains second metadata href",
response,
containsString("href=\"http://link.to/metadata\""));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<wps:DescribeProcess 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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_request.xsd">
<ows:Identifier>org.n52.wps.server.r.test.metadata</ows:Identifier>
</wps:DescribeProcess>

0 comments on commit 6c5d2f9

Please sign in to comment.