diff --git a/.gitignore b/.gitignore index 599cc64..6ae81bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ *.DS_Store target/* /.project +/target/ +.classpath +.settings/ diff --git a/pom.xml b/pom.xml index 1e167e3..79ae9be 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,14 @@ + + org.opengis.cite + ets-common + 15-SNAPSHOT + + 4.0.0 ets-wcs11 - org.opengis.cite 1.18-SNAPSHOT OGC Web Coverage Service 1.1.1 - Executable Test Suite @@ -49,60 +54,20 @@ wcs11 1.1.1 - 5.5.2 UTF-8 - 5.5.2 org.opengis.cite.teamengine teamengine-spi-ctl - ${teamengine.version} - - - - - maven-project-info-reports-plugin - 2.7 - - - - license - issue-tracking - scm - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - false - - - - maven-jar-plugin - 3.0.2 - - - maven-surefire-plugin - 2.19.1 - maven-assembly-plugin - 2.6 @@ -124,20 +89,9 @@ - - maven-release-plugin - 2.5.3 - - true - @{project.version} - release - - maven-site-plugin - 3.4 - false true @@ -149,20 +103,6 @@ - - - org.apache.maven.doxia - doxia-module-markdown - 1.6 - - - - - maven-scm-publish-plugin - 1.1 - - gh-pages - @@ -170,7 +110,6 @@ io.fabric8 docker-maven-plugin - 0.28.0 @@ -178,7 +117,7 @@ ${project.basedir}/src/docker - ${project.version}-teamengine-${docker.teamengine.version} + ${project.version}-teamengine-${teamengine.version} @@ -211,40 +150,15 @@ - - maven-dependency-plugin - 3.0.0 - - - - org.opengis.cite.teamengine - teamengine-web - ${docker.teamengine.version} - war - - - org.opengis.cite.teamengine - teamengine-web - ${docker.teamengine.version} - common-libs - zip - - - org.opengis.cite.teamengine - teamengine-console - ${docker.teamengine.version} - base - zip - - - - ${basedir}/src/main/resources true + + **/*.txt + ${basedir}/src/main/scripts @@ -294,32 +208,6 @@ - - release - - - - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - - diff --git a/src/assembly/aio.xml b/src/assembly/aio.xml index c5e5c72..8626a27 100644 --- a/src/assembly/aio.xml +++ b/src/assembly/aio.xml @@ -12,9 +12,6 @@ true true runtime - - com.sun.jersey:jersey-server - diff --git a/src/docker/Dockerfile b/src/docker/Dockerfile index 13fb879..5123e30 100644 --- a/src/docker/Dockerfile +++ b/src/docker/Dockerfile @@ -1,4 +1,6 @@ -FROM tomcat:7.0-jre8 +FROM tomcat:10.1-jre17 + +RUN apt update && apt install -y unzip # add TEAM engine webapp ADD maven/dependency/teamengine-web-*.war /root/ @@ -21,5 +23,7 @@ RUN cd /root/ && unzip -q ets-wcs11-*-ctl.zip -d /root/te_base/scripts ADD maven/ets-wcs11-*-deps.zip /root/ RUN cd /root/ && unzip -q -o ets-wcs11-*-deps.zip -d /usr/local/tomcat/webapps/teamengine/WEB-INF/lib +RUN rm -R /root/te_base/scripts/note + # run tomcat CMD ["catalina.sh", "run"] \ No newline at end of file diff --git a/src/main/java/org/opengis/cite/wcs11/CtlController.java b/src/main/java/org/opengis/cite/wcs11/CtlController.java index 8d22998..ae2e286 100644 --- a/src/main/java/org/opengis/cite/wcs11/CtlController.java +++ b/src/main/java/org/opengis/cite/wcs11/CtlController.java @@ -26,106 +26,102 @@ * */ 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()); - } - } + private TestRunExecutor executor; - /** - * 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()); - } - - public String getCode() { - return etsProperties.getProperty("ets-code"); - } + private Properties etsProperties = new Properties(); - public String getVersion() { - return etsProperties.getProperty("ets-version"); - } + /** + * 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()); + } + } - public String getTitle() { - return etsProperties.getProperty("ets-title"); - } + /** + * 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()); + } - public Source doTestRun(Document testRunArgs) throws Exception { - Properties validArgs = TestRunArguments.validateArguments(testRunArgs); - // pass Properties directly instead? - 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; - } + public String getCode() { + return etsProperties.getProperty("ets-code"); + } + + public String getVersion() { + return etsProperties.getProperty("ets-version"); + } + + public String getTitle() { + return etsProperties.getProperty("ets-title"); + } + + public Source doTestRun(Document testRunArgs) throws Exception { + Properties validArgs = TestRunArguments.validateArguments(testRunArgs); + // pass Properties directly instead? + 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; + } } - \ No newline at end of file diff --git a/src/main/java/org/opengis/cite/wcs11/TestRunArguments.java b/src/main/java/org/opengis/cite/wcs11/TestRunArguments.java index e878c38..2df5110 100644 --- a/src/main/java/org/opengis/cite/wcs11/TestRunArguments.java +++ b/src/main/java/org/opengis/cite/wcs11/TestRunArguments.java @@ -20,66 +20,64 @@ */ public class TestRunArguments { - /** - * Validates the given test run arguments. An - * IllegalArgumentException is thrown if a required argument is - * missing or invalid. The recognized arguments are listed below. - * - * - * @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."); - } - // load defaults? - 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(WCS11.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", WCS11.URL)); - } - return args; - } + /** + * Validates the given test run arguments. An IllegalArgumentException is + * thrown if a required argument is missing or invalid. The recognized arguments are + * listed below. + * + * @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."); + } + // load defaults? + 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(WCS11.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", WCS11.URL)); + } + 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) { // very unlikely - Logger.getLogger(TestRunArguments.class.getName()).log(Level.WARNING, "Failed to create Document node. {0}", - e.getMessage()); - } - return doc; - } + /** + * 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) { // very unlikely + Logger.getLogger(TestRunArguments.class.getName()) + .log(Level.WARNING, "Failed to create Document node. {0}", e.getMessage()); + } + return doc; + } } diff --git a/src/main/java/org/opengis/cite/wcs11/WCS11.java b/src/main/java/org/opengis/cite/wcs11/WCS11.java index 19bc76d..68a8171 100644 --- a/src/main/java/org/opengis/cite/wcs11/WCS11.java +++ b/src/main/java/org/opengis/cite/wcs11/WCS11.java @@ -1,17 +1,17 @@ package org.opengis.cite.wcs11; /** - * Contains various constants defined in the WCS 1.1.1 specification, such as test - * run parameters. - * + * Contains various constants defined in the WCS 1.1.1 specification, such as test run + * parameters. + * * @see "OGC 07-067r2: OGC Web Coverage Service (WCS) Implementation Specification" */ public class WCS11 { - private WCS11() { - } + private WCS11() { + } - /** Supplies reference to wcs capabilities document (URI). */ - public static final String URL = "url"; + /** Supplies reference to wcs capabilities document (URI). */ + public static final String URL = "url"; } diff --git a/src/site/site.xml b/src/site/site.xml index 7faf5bd..3ce3e83 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -1,16 +1,16 @@ + xsi:schemaLocation="http://maven.apache.org/DECORATION/1.7.0 http://maven.apache.org/xsd/decoration-1.7.0.xsd"> org.apache.maven.skins maven-fluido-skin - 1.3.1 + 2.0.1 - + o true