From 4146a50741567ed4c354bea219383dc01bb83dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Pro=C3=9F?= Date: Wed, 22 Jan 2025 16:45:47 +0100 Subject: [PATCH 1/5] Adjust pom.xml --- pom.xml | 223 ++++++++++++++++++++------------------------------------ 1 file changed, 78 insertions(+), 145 deletions(-) diff --git a/pom.xml b/pom.xml index d2af6d7..436e05e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,14 @@ + + + org.opengis.cite + ets-common + 15-SNAPSHOT + + 4.0.0 ets-csw20 - org.opengis.cite 1.19-SNAPSHOT jar @@ -54,58 +60,13 @@ csw 2.0.2 UTF-8 - 4.10 - - - - - 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-jar-plugin - 2.5 - - - default-jar - disable - - - org.apache.maven.plugins maven-site-plugin - 3.7.1 site-package @@ -115,15 +76,7 @@ - - - org.apache.maven.doxia - doxia-module-markdown - 1.8 - - - false false true @@ -131,7 +84,6 @@ org.apache.maven.plugins maven-assembly-plugin - 3.1.0 assemble_data @@ -143,7 +95,7 @@ ${ets-code}-${spec-version} ${project.build.directory}/site/data - src/assembly/data.xml + ${basedir}/src/assembly/data.xml @@ -155,45 +107,23 @@ - src/assembly/ctl.xml + ${basedir}/src/assembly/ctl.xml - assemble_site package single - src/assembly/site.xml + ${basedir}/src/assembly/site.xml - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - - **/Verify*.java - **/*Tests.java - **/*Test.java - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.2 - - 1.7 - 1.7 - - org.apache.maven.plugins maven-remote-resources-plugin @@ -213,42 +143,54 @@ - - maven-release-plugin - 2.5.3 - - true - @{project.version} - release - - - - maven-scm-publish-plugin - 1.1 - - gh-pages - - - - maven-javadoc-plugin - 2.10.4 - - true - package - - http://testng.org/javadocs/ - - - - - attach-javadocs - - jar - - - - + + + + io.fabric8 + docker-maven-plugin + + + + ogccite/${project.artifactId} + + ${project.basedir}/src/docker + + ${project.version}-teamengine-${teamengine.version} + + + + + + ${project.build.directory} + . + + dependency/*teamengine-*.war + dependency/*teamengine-*.zip + *ets-*.zip + + + + + + + + + 8081:8080 + + + + http://localhost:8081/teamengine + + + + + + + + + + @@ -261,22 +203,6 @@ - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.7 - - - - - - - - - - org.opengis.cite.teamengine @@ -287,33 +213,40 @@ junit junit - 4.13.1 test - release + docker - maven-gpg-plugin - 1.6 + io.fabric8 + docker-maven-plugin + + + build + + build + + + + push + + push + + + + + + maven-dependency-plugin - sign-artifacts - verify - sign + copy - - - - From 87d9e90584cfcccd7a1506722a145b9fcc91c95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Pro=C3=9F?= Date: Wed, 22 Jan 2025 16:46:11 +0100 Subject: [PATCH 2/5] Adjust site-descriptor --- src/site/site.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/site/site.xml b/src/site/site.xml index 5775175..4eeae6a 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.7 + 2.0.1 - + o true From 8f2f57beedeb388cb70c356233bc88abd60b78e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Pro=C3=9F?= Date: Wed, 22 Jan 2025 16:46:24 +0100 Subject: [PATCH 3/5] Adjust java code --- .../opengis/cite/csw20/VerifyTestSuite.java | 226 +++++++++--------- 1 file changed, 114 insertions(+), 112 deletions(-) diff --git a/src/test/java/org/opengis/cite/csw20/VerifyTestSuite.java b/src/test/java/org/opengis/cite/csw20/VerifyTestSuite.java index e2dc492..b598420 100644 --- a/src/test/java/org/opengis/cite/csw20/VerifyTestSuite.java +++ b/src/test/java/org/opengis/cite/csw20/VerifyTestSuite.java @@ -30,123 +30,125 @@ import com.occamlab.te.SetupOptions; import com.occamlab.te.TEClassLoader; import com.occamlab.te.TECore; +import com.occamlab.te.html.EarlToHtmlTransformation; import com.occamlab.te.index.Index; import com.occamlab.te.util.DocumentationHelper; /** - * Verifies the results of executing a CTL test suite. The test suite parameters - * are read from a properties file located at ${user.home}/sut.properties; if - * this file does not exist then load the default sut.properties file from the - * classpath (src/test/resources). + * Verifies the results of executing a CTL test suite. The test suite parameters are read + * from a properties file located at ${user.home}/sut.properties; if this file does not + * exist then load the default sut.properties file from the classpath + * (src/test/resources). */ public class VerifyTestSuite { - static final int VERDICT_PASS = 1; - static final int VERDICT_SKIP = 3; - static final int VERDICT_INHERITED_FAIL = 5; - static final int VERDICT_FAIL = 6; - private static Properties testProps; - private static Properties sutProps; - private static String previousTEBase; - private static DocumentBuilder docBuilder; - private static final String CSW202_NS = "http://www.opengis.net/cat/csw/2.0.2"; - private RuntimeOptions runOpts; - private SetupOptions setupOpts; - private File sessionDir; - - @BeforeClass - public static void initFixture() throws IOException, - ParserConfigurationException { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - docBuilder = dbf.newDocumentBuilder(); - testProps = new Properties(); - try (InputStream propsInput = VerifyTestSuite.class - .getResourceAsStream("/integration-test.properties")) { - testProps.load(propsInput); - } - File targetDir = new File(testProps.getProperty("targetDir")); - File teBaseDir = new File(targetDir, "te-base"); - teBaseDir.mkdir(); - for (String dir : new String[] { "users", "work" }) { - new File(teBaseDir, dir).mkdir(); - } - previousTEBase = System.getProperty("TE_BASE"); - System.setProperty("TE_BASE", teBaseDir.getAbsolutePath()); - } - - @BeforeClass - public static void initTestSuiteParams() throws IOException { - sutProps = new Properties(); - String homeDir = System.getProperty("user.home"); - File sutPropsFile = new File(homeDir, "sut.properties"); - if (sutPropsFile.exists()) { - sutProps.load(new FileInputStream(sutPropsFile)); - } else { - try (InputStream propsInput = VerifyTestSuite.class - .getResourceAsStream("/sut.properties")) { - sutProps.load(propsInput); - } - } - } - - @AfterClass - public static void restoreEnvironment() { - if (null != previousTEBase) { - System.setProperty("TE_BASE", previousTEBase); - } - } - - @Before - public void initTestSession() { - this.setupOpts = new SetupOptions(); - this.setupOpts.setValidate(false); - this.runOpts = new RuntimeOptions(); - this.runOpts.setMode(com.occamlab.te.Test.TEST_MODE); - this.runOpts.setWorkDir(setupOpts.getWorkDir()); - UUID sessionId = UUID.randomUUID(); - this.runOpts.setSessionId(sessionId.toString()); - File logDir = this.runOpts.getLogDir(); - this.sessionDir = new File(logDir, sessionId.toString()); - } - - @After - public void generateReport() throws Exception { - URL reportStylesheet = getClass().getResource( - "/com/occamlab/te/test_report_html.xsl"); - DocumentationHelper reporter = new DocumentationHelper(reportStylesheet); - reporter.prettyPrintsReport(this.sessionDir); - } - - @Test - public void executeStartingTest() throws Exception { - File scriptsDir = new File(testProps.getProperty("scriptsDir")); - File ctlFile = new File(scriptsDir, "ctl" - + System.getProperty("file.separator") + "main.xml"); - this.setupOpts.addSource(ctlFile); - // run starting test directly to bypass input form - QName startingTest = new QName(CSW202_NS, "Main", "csw"); - this.runOpts.setTestName(startingTest.toString()); - for (Object key : sutProps.keySet()) { - String paramName = (String) key; - StringBuilder kvp = new StringBuilder(paramName); - kvp.append("=").append(sutProps.getProperty(paramName)); - this.runOpts.addParam(kvp.toString()); - } - File indexFile = new File(this.sessionDir, "index.xml"); - Index mainIndex = Generator.generateXsl(this.setupOpts); - mainIndex.persist(indexFile); - File resourcesDir = new File(scriptsDir.getParentFile(), "resources"); - TEClassLoader teLoader = new TEClassLoader(resourcesDir); - Engine engine = new Engine(mainIndex, this.setupOpts.getSourcesName(), - teLoader); - TECore core = new TECore(engine, mainIndex, this.runOpts); - core.execute(); - Document testLog = docBuilder - .parse(new File(this.sessionDir, "log.xml")); - XPath xpath = XPathFactory.newInstance().newXPath(); - String result = xpath.evaluate("/log/endtest/@result", testLog); - assertEquals("Unexpected result.", VERDICT_PASS, - Integer.parseInt(result)); - } + static final int VERDICT_PASS = 1; + static final int VERDICT_SKIP = 3; + static final int VERDICT_INHERITED_FAIL = 5; + static final int VERDICT_FAIL = 6; + + private static Properties testProps; + + private static Properties sutProps; + + private static String previousTEBase; + + private static DocumentBuilder docBuilder; + + private static final String CSW202_NS = "http://www.opengis.net/cat/csw/2.0.2"; + + private RuntimeOptions runOpts; + + private SetupOptions setupOpts; + + private File sessionDir; + + @BeforeClass + public static void initFixture() throws IOException, ParserConfigurationException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + docBuilder = dbf.newDocumentBuilder(); + testProps = new Properties(); + try (InputStream propsInput = VerifyTestSuite.class.getResourceAsStream("/integration-test.properties")) { + testProps.load(propsInput); + } + File targetDir = new File(testProps.getProperty("targetDir")); + File teBaseDir = new File(targetDir, "te-base"); + teBaseDir.mkdir(); + for (String dir : new String[] { "users", "work" }) { + new File(teBaseDir, dir).mkdir(); + } + previousTEBase = System.getProperty("TE_BASE"); + System.setProperty("TE_BASE", teBaseDir.getAbsolutePath()); + } + + @BeforeClass + public static void initTestSuiteParams() throws IOException { + sutProps = new Properties(); + String homeDir = System.getProperty("user.home"); + File sutPropsFile = new File(homeDir, "sut.properties"); + if (sutPropsFile.exists()) { + sutProps.load(new FileInputStream(sutPropsFile)); + } + else { + try (InputStream propsInput = VerifyTestSuite.class.getResourceAsStream("/sut.properties")) { + sutProps.load(propsInput); + } + } + } + + @AfterClass + public static void restoreEnvironment() { + if (null != previousTEBase) { + System.setProperty("TE_BASE", previousTEBase); + } + } + + @Before + public void initTestSession() { + this.setupOpts = new SetupOptions(); + this.setupOpts.setValidate(false); + this.runOpts = new RuntimeOptions(); + this.runOpts.setMode(com.occamlab.te.Test.TEST_MODE); + this.runOpts.setWorkDir(setupOpts.getWorkDir()); + UUID sessionId = UUID.randomUUID(); + this.runOpts.setSessionId(sessionId.toString()); + File logDir = this.runOpts.getLogDir(); + this.sessionDir = new File(logDir, sessionId.toString()); + } + + @After + public void generateReport() throws Exception { + EarlToHtmlTransformation earlToHtmlTransformation = new EarlToHtmlTransformation(); + earlToHtmlTransformation.earlHtmlReport(this.sessionDir.getAbsolutePath()); + } + + @Test + public void executeStartingTest() throws Exception { + File scriptsDir = new File(testProps.getProperty("scriptsDir")); + File ctlFile = new File(scriptsDir, "ctl" + System.getProperty("file.separator") + "main.xml"); + this.setupOpts.addSource(ctlFile); + // run starting test directly to bypass input form + QName startingTest = new QName(CSW202_NS, "Main", "csw"); + this.runOpts.setTestName(startingTest.toString()); + for (Object key : sutProps.keySet()) { + String paramName = (String) key; + StringBuilder kvp = new StringBuilder(paramName); + kvp.append("=").append(sutProps.getProperty(paramName)); + this.runOpts.addParam(kvp.toString()); + } + File indexFile = new File(this.sessionDir, "index.xml"); + Index mainIndex = Generator.generateXsl(this.setupOpts); + mainIndex.persist(indexFile); + File resourcesDir = new File(scriptsDir.getParentFile(), "resources"); + TEClassLoader teLoader = new TEClassLoader(resourcesDir); + Engine engine = new Engine(mainIndex, this.setupOpts.getSourcesName(), teLoader); + TECore core = new TECore(engine, mainIndex, this.runOpts); + core.execute(); + Document testLog = docBuilder.parse(new File(this.sessionDir, "log.xml")); + XPath xpath = XPathFactory.newInstance().newXPath(); + String result = xpath.evaluate("/log/endtest/@result", testLog); + assertEquals("Unexpected result.", VERDICT_PASS, Integer.parseInt(result)); + } + } From 902db76259def518f7bbff4cdf1388587b0c6a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Pro=C3=9F?= Date: Wed, 22 Jan 2025 16:46:33 +0100 Subject: [PATCH 4/5] Add Dockerfile --- src/docker/Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/docker/Dockerfile diff --git a/src/docker/Dockerfile b/src/docker/Dockerfile new file mode 100644 index 0000000..231be69 --- /dev/null +++ b/src/docker/Dockerfile @@ -0,0 +1,27 @@ +FROM tomcat:10.1-jre17 + +RUN apt update && apt install -y unzip + +# add TEAM engine webapp +ADD maven/dependency/teamengine-web-*.war /root/ +RUN cd /root/ && unzip -q teamengine-web-*.war -d /usr/local/tomcat/webapps/teamengine + +# add common libs +ADD maven/dependency/teamengine-web-*-common-libs.zip /root/ +RUN cd /root/ && unzip -q teamengine-web-*-common-libs.zip -d /usr/local/tomcat/lib + +# add TEAM engine console +ADD maven/dependency/teamengine-console-*-base.zip /root/ +RUN cd /root/ && unzip -q teamengine-console-*-base.zip -d /root/te_base + +# set TE_BASE +ENV JAVA_OPTS="-Xms1024m -Xmx2048m -DTE_BASE=/root/te_base" + +# add ETS for WCS 1.0.0 +ADD maven/ets-csw20-*-ctl.zip /root/ +RUN cd /root/ && unzip -q ets-csw20-*-ctl.zip -d /root/te_base/scripts + +RUN rm -R /root/te_base/scripts/note + +# run tomcat +CMD ["catalina.sh", "run"] \ No newline at end of file From 7dff0dc68eb0f27f8aaccc135d92b76ed63f65b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Pro=C3=9F?= Date: Wed, 29 Jan 2025 08:50:52 +0100 Subject: [PATCH 5/5] Merge assembly executions --- pom.xml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 436e05e..a2c00e9 100644 --- a/pom.xml +++ b/pom.xml @@ -100,18 +100,7 @@ - assemble_ctl - package - - single - - - - ${basedir}/src/assembly/ctl.xml - - - - + default package single @@ -119,6 +108,7 @@ ${basedir}/src/assembly/site.xml + ${basedir}/src/assembly/ctl.xml