diff --git a/pom.xml b/pom.xml index e0f6512..74f13e8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,13 @@ ets-sos10 org.opengis.cite 1.15-SNAPSHOT - pom org.opengis.cite ets-common - 6 + 9 - + Conformance Test Suite - OGC Sensor Observation Service Verifies conformance of implementations to OGC Sensor Observation Service. @@ -47,117 +46,136 @@ sos 1.0.0 + yyyy-MM-dd'T'HH:mm:ssZ UTF-8 - 4.0.5 + 5.3 - - + + + org.opengis.cite.teamengine + teamengine-spi-ctl + ${teamengine.version} + + + + - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-remote-resources-plugin - [1.5,) - - process - - - - - false - - - - - - - + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + false + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + + + ${hostname} + ${maven.build.timestamp} + ${buildNumber} + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + + + validate + + create + + + + + false + false + 10 + + + + maven-surefire-plugin + + true + + + + maven-assembly-plugin + + + + org.opengis.cite.sos10.CtlController + + + + ${basedir}/src/assembly/ctl.xml + ${basedir}/src/assembly/aio.xml + ${basedir}/src/assembly/deps.xml + + + + + package + + single + + + + + + org.apache.maven.plugins + maven-site-plugin + + + site-package + prepare-package + + jar + + + + + + org.apache.maven.doxia + doxia-module-markdown + 1.7 + + + + false + false + true + + + + org.apache.maven.plugins + maven-release-plugin + + true + @{project.version} + release + + + + org.apache.maven.plugins + maven-scm-publish-plugin + 1.1 + + gh-pages + + - - - - maven-jar-plugin - - - default-jar - disable - - - - - maven-assembly-plugin - - - src/assembly/ctl.xml - - - - - package - - single - - - - - - maven-site-plugin - 3.3 - - - site-package - prepare-package - - site - - - - - false - - - - maven-surefire-plugin - 2.17 - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - true - @{project.version} - release - - - - org.apache.maven.plugins - maven-scm-publish-plugin - 1.1 - - gh-pages - - - - + diff --git a/src/assembly/aio.xml b/src/assembly/aio.xml new file mode 100644 index 0000000..c5e5c72 --- /dev/null +++ b/src/assembly/aio.xml @@ -0,0 +1,20 @@ + + + + aio + + jar + + false + + + / + true + true + runtime + + com.sun.jersey:jersey-server + + + + diff --git a/src/assembly/deps.xml b/src/assembly/deps.xml new file mode 100644 index 0000000..b1ab6b2 --- /dev/null +++ b/src/assembly/deps.xml @@ -0,0 +1,25 @@ + + + deps + + zip + tar.gz + + false + + + true + + org.opengis.cite.teamengine:teamengine-spi-ctl + + / + false + runtime + true + true + + + diff --git a/src/main/java/org/opengis/cite/sos10/CtlController.java b/src/main/java/org/opengis/cite/sos10/CtlController.java new file mode 100644 index 0000000..994a3b4 --- /dev/null +++ b/src/main/java/org/opengis/cite/sos10/CtlController.java @@ -0,0 +1,133 @@ +package org.opengis.cite.sos10; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Source; + +import org.w3c.dom.Document; + +import com.occamlab.te.SetupOptions; +import com.occamlab.te.spi.ctl.CtlExecutor; +import com.occamlab.te.spi.executors.TestRunExecutor; +import com.occamlab.te.spi.jaxrs.TestSuiteController; + +/** + * Main test run controller is responsible for executing the test suite. + */ +public class CtlController implements TestSuiteController { + + private TestRunExecutor executor; + private Properties etsProperties = new Properties(); + + /** + * Constructs a controller object for this test suite. The location of the + * main CTL script is read from the "main-script" property in the + * ets.properties file (a classpath resource). + */ + public CtlController() { + SetupOptions setupOpts = new SetupOptions(); + try (InputStream is = getClass().getResourceAsStream("ets.properties")) { + this.etsProperties.load(is); + String mainScriptPath = etsProperties.getProperty("main-script"); + File ctlFile = findScriptFile(URI.create(mainScriptPath)); + setupOpts.addSource(ctlFile); + this.executor = new CtlExecutor(setupOpts); + } catch (IOException ex) { + Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Failed to initialize CtlController. {0}", + ex.getMessage()); + } + } + + /** + * A convenience method for running the test suite using a command-line + * interface. + * + * @param args + * Test run arguments (optional). The first argument must refer + * to a local XML properties file containing the expected set of + * test run arguments. If no argument is supplied, the file + * located at ${user.home}/test-run-props.xml will be used. + * @throws Exception + * If an error errors during the test run. + */ + public static void main(String[] args) throws Exception { + File propsFile; + if (args.length == 0) { + propsFile = new File(System.getProperty("user.home"), "test-run-props.xml"); + } else { + String xmlProps = args[0]; + propsFile = (xmlProps.startsWith("file:")) ? new File(URI.create(xmlProps)) : new File(xmlProps); + } + if (!propsFile.isFile()) { + throw new IllegalArgumentException("Test run arguments not found at " + propsFile); + } + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document testRunArgs = db.parse(propsFile); + TestSuiteController controller = new CtlController(); + Source results = controller.doTestRun(testRunArgs); + Logger.getLogger(CtlController.class.getName()).log(Level.INFO, "Test results: {0}", results.getSystemId()); + } + + @Override + public String getCode() { + return etsProperties.getProperty("ets-code"); + } + + @Override + public String getVersion() { + return etsProperties.getProperty("ets-version"); + } + + @Override + public String getTitle() { + return etsProperties.getProperty("ets-title"); + } + + @Override + public Source doTestRun(Document testRunArgs) throws Exception { + Properties validArgs = TestRunArguments.validateArguments(testRunArgs); + + return executor.execute(TestRunArguments.propertiesAsDocument(validArgs)); + } + + /** + * Creates a File from the given URI reference. If the URI is not absolute, + * is is resolved against the location of the TE_BASE/scripts directory; if + * a file does not exist at this location the URI is assumed to be a + * classpath reference. + * + * @param uri + * An absolute or relative URI. + * @return A File object, or null if one could not be created. + */ + final File findScriptFile(URI uri) { + File ctlFile = null; + File baseDir = SetupOptions.getBaseConfigDirectory(); + if (!uri.isAbsolute()) { + File scriptsDir = new File(baseDir, "scripts"); + ctlFile = new File(scriptsDir, uri.getPath()); + } + if (null == ctlFile || !ctlFile.isFile()) { + URL resource = getClass().getResource(uri.getPath()); + try { + ctlFile = new File(resource.toURI()); + } catch (URISyntaxException ex) { + Logger.getLogger(getClass().getName()).log(Level.INFO, "Invalid URI: {0}", ex); + } + } + Logger.getLogger(getClass().getName()).log(Level.CONFIG, "Created File object: {0}", ctlFile); + return ctlFile; + } + +} diff --git a/src/main/java/org/opengis/cite/sos10/SOS10.java b/src/main/java/org/opengis/cite/sos10/SOS10.java new file mode 100644 index 0000000..33ac158 --- /dev/null +++ b/src/main/java/org/opengis/cite/sos10/SOS10.java @@ -0,0 +1,18 @@ +package org.opengis.cite.sos10; + +/** + * Contains various constants defined in the SOS 1.0 specification, such as test + * run parameters. + * + */ +public class SOS10 { + + private SOS10() { + } + + /** Supplies reference to SOS capabilities document (URI). */ + public static final String SERVICE_URL = "service-url"; + /** Supplies to select all test. */ + public static final String WHICH_TESTS = "which-tests"; + +} diff --git a/src/main/java/org/opengis/cite/sos10/TestRunArguments.java b/src/main/java/org/opengis/cite/sos10/TestRunArguments.java new file mode 100644 index 0000000..37b5252 --- /dev/null +++ b/src/main/java/org/opengis/cite/sos10/TestRunArguments.java @@ -0,0 +1,80 @@ +package org.opengis.cite.sos10; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +/** + * Provides utility methods that assist with the handling of test run arguments. + */ +public class TestRunArguments { + + /** + * Validates the given test run arguments. + * + * @param testRunArgs + * A Document containing a set of XML properties; each entry + * (key-value pair) is a test run argument. + * @return A valid set of test run arguments. + */ + public static Properties validateArguments(Document testRunArgs) { + NodeList entries = testRunArgs.getDocumentElement().getElementsByTagName("entry"); + if (entries.getLength() == 0) { + throw new IllegalArgumentException("No test run arguments."); + } + + Properties args = new Properties(); + for (int i = 0; i < entries.getLength(); i++) { + Element entry = (Element) entries.item(i); + args.setProperty(entry.getAttribute("key"), entry.getTextContent().trim()); + } + String capabilitiesUrl = args.getProperty(SOS10.SERVICE_URL); + try { + URI uriRef = new URI(capabilitiesUrl); + if (!uriRef.isAbsolute()) { + throw new IllegalArgumentException(String.format("Not an absolute URI: %s", uriRef)); + } + } catch (URISyntaxException e1) { + throw new IllegalArgumentException(String.format("Invalid URI reference: %s", capabilitiesUrl)); + } catch (NullPointerException e2) { + throw new IllegalArgumentException(String.format("Missing required argument: %s", SOS10.SERVICE_URL)); + } + args.setProperty(SOS10.WHICH_TESTS, "all"); + return args; + } + + /** + * Creates a document that contains a simple XML representation of the given + * set of properties. + * + * @param props + * A set of properties (key-value pairs). + * @return A Document node, wherein each property is represented by an + * entry[@key] element. + */ + public static Document propertiesAsDocument(Properties props) { + Document doc = null; + try { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + props.storeToXML(outStream, "Test run arguments"); + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + doc = builder.parse(new ByteArrayInputStream(outStream.toByteArray())); + } catch (Exception e) { + Logger.getLogger(TestRunArguments.class.getName()).log(Level.WARNING, "Failed to create Document node. {0}", + e.getMessage()); + } + return doc; + } + +} diff --git a/src/main/javadoc/index.html b/src/main/javadoc/index.html new file mode 100644 index 0000000..0204851 --- /dev/null +++ b/src/main/javadoc/index.html @@ -0,0 +1,10 @@ + + + + + + + </head> + <body> + </body> +</html> diff --git a/src/main/javadoc/overview.html b/src/main/javadoc/overview.html new file mode 100644 index 0000000..cc21811 --- /dev/null +++ b/src/main/javadoc/overview.html @@ -0,0 +1,96 @@ +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + <head> + <title>Sensor Observation Service (SOS) 1.0 Conformance Test Suite + + + + +

Sensor Observation Service (SOS) 1.0 Conformance Test Suite

+

This test suite verifies that a Sensor Observation Service (SOS) 1.0. implementation conforms to the relevant specifications:

+
    +
  • OpenGIS Web Services Common Specification, Version 1.1.0 [ OGC 06-121r3]
  • +
  • Definition Identifier URNs in OGC Namespace, Version 1.1.0 [OGC 06-023r1]
  • +
  • OpenGIS Sensor Observation Service Implementation Specification, Version 1.0 [OGC 06-009r6]
  • +
+ +

The test run arguments are summarized in the following table. The Obligation + descriptor can have the following values: M (mandatory), O (optional), or C + (conditional).

+ + + + + + + + + + + + + + + + + + + +
Test run arguments
NameValue domainObligationDescription
service-urlURIMA URI that refers to an XML representation of the service capabilities document. + This document does not need to be obtained from the service under test (SUT), but it must + describe the implementation under test (IUT). Ampersand ('&') characters appearing within + a query parameter value must be percent-encoded as %26.
+ + + diff --git a/src/main/resources/META-INF/services/com.occamlab.te.spi.jaxrs.TestSuiteController b/src/main/resources/META-INF/services/com.occamlab.te.spi.jaxrs.TestSuiteController new file mode 100644 index 0000000..536dff9 --- /dev/null +++ b/src/main/resources/META-INF/services/com.occamlab.te.spi.jaxrs.TestSuiteController @@ -0,0 +1 @@ +org.opengis.cite.sos10.CtlController \ No newline at end of file diff --git a/src/main/resources/org/opengis/cite/sos10/ets.properties b/src/main/resources/org/opengis/cite/sos10/ets.properties new file mode 100644 index 0000000..f165648 --- /dev/null +++ b/src/main/resources/org/opengis/cite/sos10/ets.properties @@ -0,0 +1,4 @@ +ets-title = ${project.name} +ets-version = ${project.version} +ets-code = ${ets-code} +main-script = /${ets-code}/${spec-version}/ctl/SOS_ETS-auto.xml diff --git a/src/main/resources/org/opengis/cite/sos10/test-run-props.xml b/src/main/resources/org/opengis/cite/sos10/test-run-props.xml new file mode 100644 index 0000000..9b3a572 --- /dev/null +++ b/src/main/resources/org/opengis/cite/sos10/test-run-props.xml @@ -0,0 +1,6 @@ + + + + Test run arguments for ets-sos10 + + diff --git a/src/main/scripts/ctl/GetObservation.xml b/src/main/scripts/ctl/GetObservation.xml index 50c7c7d..2880bfc 100644 --- a/src/main/scripts/ctl/GetObservation.xml +++ b/src/main/scripts/ctl/GetObservation.xml @@ -1046,6 +1046,7 @@ + @@ -1079,6 +1080,7 @@ + @@ -1658,6 +1661,7 @@ + @@ -1871,6 +1876,7 @@ + + + + + + + + + + + + SOS 1.0 Compliance Test Suite + Verifies that an SOS 1.0 implementation complies with a given conformance class. + docs/sos/1.0.0/ + sos:Main-auto + + + + + The IUT satisfies all applicable assertions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/scripts/ctl/SOS_ETS-suite.xml b/src/main/scripts/ctl/SOS_ETS-suite.xml new file mode 100644 index 0000000..b5be78a --- /dev/null +++ b/src/main/scripts/ctl/SOS_ETS-suite.xml @@ -0,0 +1,387 @@ + + + + + SOS 1.0 Compliance Test Suite + Verifies that an SOS 1.0 implementation complies with a given conformance class. + docs/sos/1.0.0/ + sos:Main + + + The IUT satisfies all applicable assertions. + + + + + +

Compliance test suite for Sensor Observation Service (SOS) 1.0

+

Service metadata and test options

+

Please provide a URL from which a capabilities document can be retrieved.

+

Modify the URL template below to specify the location of an OGC SOS implementation under test.

+

Example reference implementations can be found at http://cite.opengeospatial.org/reference

+
+ + + + + +
Service URL: + +
+
+

Please select whether to run all tests or just selected tests.

+
+ + + + + +
+ Run all tests + + Run selected tests +
+
+

If you want to run selected tests, please select the checkboxes for the tests you want to run.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Main
+ OWS Main + + SOS General Main + + +
SOS Core: Get Capabilities
+ KVPRequestParameterHandling + + KVPRequestServiceParameterHandling + + KVPRequestRequestParameterHandling + + OperationsMetadataMandatoryOperations +
+ OperationsMetadaOptionalOperations + + ResponseContentsValidTime + + ResponseContentsValidProcedure + + ResponseContentsValidObservedProperty +
+ ResponseContentsValidResponseFormat + + ResponseContentsValidResultModel + + ResponseContentsValidResponseMode + +
SOS Core: Describe Sensor
+ RequestInvalidMIMEType + + RequestInvalidProcedure + + ResponseMatchingResponseFormat + + ResponseMatchingProcedure +
SOS Core: Get Observation
+ RequestInvalidSRSName + + RequestInvalidOffering + + RequestInvalidEventTime + + RequestInvalidProcedure +
+ RequestInvalidFeatureOfInterest + + RequestInvalidObservedProperty + + RequestInvalidResult + + RequestInvalidResponseFormat +
+ RequestInvalidResultModel + + RequestInvalidResponseMode + + ResponseMatchingSRSData + + ResponseMatchingProcedureData +
+ ResponseMatchingObservedPropertyData + + ResponseAdvertisedEventTimeData + + ResponseMatchingEventTimeData + + ResponseMatchingFeatureOfInterestData +
+ ResponseMatchingResultData + + ResponseMatchingResponseFormatData + + +
+
+

Please press the "Start" button to start testing.

+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/src/main/scripts/ctl/SOS_ETS.xml b/src/main/scripts/ctl/SOS_ETS.xml index 5e1ddf9..d6469d9 100644 --- a/src/main/scripts/ctl/SOS_ETS.xml +++ b/src/main/scripts/ctl/SOS_ETS.xml @@ -22,325 +22,6 @@ xmlns:om="http://www.opengis.net/om/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - SOS 1.0 Compliance Test Suite - Verifies that an SOS 1.0 implementation complies with a given conformance class. - docs/sos/1.0.0/ - sos:Main - - - - The IUT satisfies all applicable assertions. - - - - - -

Compliance test suite for Sensor Observation Service (SOS) 1.0

-

Service metadata and test options

-

Please provide a URL from which a capabilities document can be retrieved.

-

Modify the URL template below to specify the location of an OGC SOS implementation under test.

-

Example reference implementations can be found at http://cite.opengeospatial.org/reference

-
- - - - - -
Service URL: - -
-
-

Please select whether to run all tests or just selected tests.

-
- - - - - -
Run all testsRun selected tests
-
-

If you want to run selected tests, please select the checkboxes for the tests you want to run.

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Main
OWS MainSOS General Main
SOS Core: Get Capabilities
KVPRequestParameterHandlingKVPRequestServiceParameterHandlingKVPRequestRequestParameterHandlingOperationsMetadataMandatoryOperations
OperationsMetadaOptionalOperationsResponseContentsValidTimeResponseContentsValidProcedureResponseContentsValidObservedProperty
ResponseContentsValidResponseFormatResponseContentsValidResultModelResponseContentsValidResponseMode
SOS Core: Describe Sensor
RequestInvalidMIMETypeRequestInvalidProcedureResponseMatchingResponseFormatResponseMatchingProcedure
SOS Core: Get Observation
RequestInvalidSRSNameRequestInvalidOfferingRequestInvalidEventTimeRequestInvalidProcedure
RequestInvalidFeatureOfInterestRequestInvalidObservedPropertyRequestInvalidResultRequestInvalidResponseFormat
RequestInvalidResultModelRequestInvalidResponseModeResponseMatchingSRSDataResponseMatchingProcedureData
ResponseMatchingObservedPropertyDataResponseAdvertisedEventTimeDataResponseMatchingEventTimeDataResponseMatchingFeatureOfInterestData
ResponseMatchingResultDataResponseMatchingResponseFormatData
-
- -

Please press the "Start" button to start testing.

-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
@@ -370,6 +51,7 @@ + @@ -383,6 +65,7 @@ **************************** + @@ -395,6 +78,7 @@ + @@ -435,7 +119,7 @@ Post request is not support by service , pass this test. - + - + @@ -848,13 +533,14 @@ - + + @@ -1091,6 +778,7 @@ + @@ -1116,6 +804,7 @@ + diff --git a/src/main/scripts/ctl/functions.xml b/src/main/scripts/ctl/functions.xml index 382b07f..b2c2537 100644 --- a/src/main/scripts/ctl/functions.xml +++ b/src/main/scripts/ctl/functions.xml @@ -384,12 +384,15 @@ The capabilities document The operation for which the URL is reqested + Post URL of given operation Returns post URL of given operation - + + +

Please select URL for GetCapabilities POST:

@@ -416,6 +419,16 @@ + + + + + + + + + + @@ -498,13 +511,14 @@ available in text/xml format, if any, or the first observation offering if not. Added 2010-12-27 PwD --> The capabilities document + The offering Id The offering name The capabilities doc version The first Text/XML response format The only observation offering, or the first observation offering available in text/XML format, if any, or the first observation offering if none are available in text/XML. - + diff --git a/src/site/site.xml b/src/site/site.xml index ec50c1c..805d169 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -7,7 +7,7 @@ org.apache.maven.skins maven-fluido-skin - 1.3.1 + 1.5