added APS integration test tile

This commit is contained in:
Brian Long 2025-02-06 12:20:50 -05:00
parent cf03dc8808
commit bc093cc69a
6 changed files with 370 additions and 1 deletions

9
beedk-aps-ext-it-tile/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# Eclipse
.project
.classpath
.settings
# Maven
pom.xml.versionsBackup
target

View File

@ -0,0 +1,84 @@
# BeeDK APS Extension Maven Tile for Integration Tests
This is a component within the proposed [BeeDK](/inteligr8/ootbee-beedk). It is considered to be part of the **Public API** of the BeeDK.
## Purpose
This project creates a [Maven Tile](https://github.com/repaint-io/maven-tiles) that provides the basis for integration testing any APS extension.
## Usage
To use this plugin, just reference it with the Maven Tiles plugin as shown in the following snippet. Do not forget the `extensions` element in the *plugin* configuration.
```xml
<project ...>
...
<build>
...
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>[2.0,3.0)</version>
<extensions>true</extensions>
<configuration>
<tiles>
...
<!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-aps-ext-it-tile -->
<tile>com.inteligr8.ootbee:beedk-aps-ext-it-tile:[1.1.0,2.0.0)</tile>
</tiles>
</configuration>
</plugin>
...
</plugins>
...
</build>
...
</project>
```
## Configuration
In your Maven project, set the following properties to define the behavior of this Maven Tile. Unless otherwise stated, they can only be overridden in the project POM or other Maven Tiles loaded earlier than this Maven Tile.
### Public API
The following properties are intended to be exposed by inheriting Public API Maven Tiles.
| Maven Property | Required | Default | Description |
| -------------------------- |:--------:| --------------- | ----------- |
| `aps.war.groupId` | | `org.alfresco` | |
| `aps.war.artifactId` | | `activiti-app` | |
| `aps.war.version` | **Yes** | | |
| `aps.port` | | 8080 | The port to expose on `localhost` for the developer; not for other applications or users. |
| `aps-postgres.port` | | 5432 | The port to expose on `localhost` for the developer; not for other applications or users. |
| `aps.debugger.port` | | 8000 | The port to expose on `localhost` for the developer; not for other applications or users. |
| `aps.tomcat.opts` | | | Additional `CATALINA_OPTS` to add to the Apache Tomcat startup.<br/>*May be overridden by any POM parent or Maven Tile.* |
| `aps.timeout` | | 120000 | The time to wait for the startup to complete, in milliseconds. |
| `alfresco.license.directory` | | `${user.home}/alfresco/license` | The base path to search for Alfresco licenses. |
| `aps.license.directory` | | `${alfresco.license.directory}/aps` | The base path to search for an APS license. |
| `tomcat-rad.version` | | *not important* | The version of the [Apache Tomcat Rapid Application Development Docker container](/inteligr8/tomcat-rad-docker). |
| `aps-postgres.version` | | *not important* | The version of PostgreSQL to use in the integration testing infrastructure. |
### Private API
The following properties are only intended to be defined by BeeDK components.
| Maven Property | Required | Default | Description |
| ------------------------------------ |:--------:| ------------------ | ----------- |
| `beedk.deploy.aps.warFile` | **Yes** | | The WAR file to deploy in the Apache Tomcat instance. |
| `beedk.deploy.aps.classesDirectory` | | | An additional classpath directory to sideload into the web application. |
| `beedk.deploy.aps.testClassesDirectory` | | | An additional test classpath directory to sideload into the web application. |
| `beedk.deploy.aps.extDirectory` | | | An additional directory of JARs to sideload into the web application. |
| `beedk.deploy.aps.warDirectory` | | `${project.build.warDirectory}` | A build directory for WAR files. |
| `beedk.deploy.aps.dataDirectory` | | `${project.build.directory}/alf_data` | The temporary binary storage location for ACS. |
### Other APIs
Additional less important configurations are inherited from the following Maven Tiles.
* [`beedk-run-tile`](/inteligr8/ootbee-beedk/src/stable/beedk-run-tile)
## Results
The APS app and database will be started and stopped during the `pre-integration-test` and `post-integration-test` Maven phases, respectively.

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>beedk-aps-ext-it-tile</artifactId>
<packaging>tile</packaging>
<parent>
<groupId>com.inteligr8.ootbee</groupId>
<artifactId>beedk-parent</artifactId>
<version>1.1.12</version>
<relativePath>..</relativePath>
</parent>
<name>Order of the Bee Development Kit: Integration Testing for APS Extensions</name>
<url>https://bitbucket.org/inteligr8/ootbee-beedk</url>
<licenses>
<license>
<name>GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git:https://bitbucket.org/inteligr8/ootbee-beedk.git</connection>
<developerConnection>scm:git:git@bitbucket.org:inteligr8/ootbee-beedk.git</developerConnection>
<url>https://bitbucket.org/inteligr8/ootbee-beedk</url>
</scm>
<organization>
<name>Order of the Bee</name>
<url>https://orderofthebee.net</url>
</organization>
<developers>
<developer>
<id>brian.long</id>
<name>Brian Long</name>
<email>brian@inteligr8.com</email>
<organization>Inteligr8</organization>
<organizationUrl>https://www.inteligr8.com</organizationUrl>
<url>https://twitter.com/brianmlong</url>
</developer>
</developers>
<build>
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*
-->
<project xmlns="http://tiles.bluetrainsoftware.com/maven/tiles/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tiles.bluetrainsoftware.com/maven/tiles/1.1.0 https://bitbucket.org/inteligr8/maven-tiles/raw/xsd/src/main/resources/maven-tiles.xsd">
<build>
<plugins>
<!-- This plugin downloads the parameterized WAR -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<executions>
<!-- This execution downloads the dependency JARs, including JAR modules -->
<execution>
<id>download-jars</id>
<phase>pre-integration-test</phase>
<goals><goal>copy-dependencies</goal></goals>
<configuration>
<excludeScope>provided</excludeScope>
<includeTypes>jar</includeTypes>
<outputDirectory>${beedk.deploy.aps.extDirectory}</outputDirectory>
</configuration>
</execution>
<!-- This execution downloads the parameterized WAR -->
<execution>
<id>download-webapp</id>
<phase>pre-integration-test</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${aps.war.groupId}</groupId>
<artifactId>${aps.war.artifactId}</artifactId>
<version>${aps.war.version}</version>
<type>war</type>
</artifactItem>
</artifactItems>
<outputDirectory>${beedk.deploy.aps.warDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- Using Docker to host the web application -->
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start-aps-app</id>
<phase>pre-integration-test</phase>
<goals><goal>start</goal></goals>
<configuration>
<startParallel>true</startParallel>
<images>
<image>
<name>postgres:${aps-postgres.version}</name>
<alias>aps-db</alias>
<run>
<skip>${skipTests}</skip>
<env>
<POSTGRES_PASSWORD>alfresco</POSTGRES_PASSWORD>
<POSTGRES_USER>alfresco</POSTGRES_USER>
<POSTGRES_DB>activiti</POSTGRES_DB>
</env>
<ports>
<port>${aps-postgres.port}:5432</port>
</ports>
<network>
<mode>custom</mode>
<name>${project.artifactId}</name>
</network>
</run>
</image>
<image>
<name>docker.inteligr8.com/inteligr8/tomcat-rad:${tomcat-rad.version}</name>
<alias>aps-app</alias>
<run>
<skip>${skipTests}</skip>
<env>
<JAVA_MEMORY_MAX>${aps.memory}</JAVA_MEMORY_MAX>
<ENABLE_HOTSWAP>false</ENABLE_HOTSWAP>
<ENABLE_JDWP>false</ENABLE_JDWP>
<CATALINA_OPTS>--add-opens java.base/java.net=ALL-UNNAMED \
-Djava.awt.headless=true \
-Ddatasource.driver=org.postgresql.Driver -Ddatasource.url=jdbc:postgresql://${project.artifactId}-aps-db:5432/activiti \
-Djavascript.secure-scripting.enabled=false -Djavascript.secure-scripting.enable-class-whitelisting=false \
-Dbeans.whitelisting.enabled=false \
-Del.whitelisting.enabled=false \
-Dshell.whitelisting.enabled=false \
-Dservice.task.class.whitelisting.enabled=false \
${aps.tomcat.opts}</CATALINA_OPTS>
</env>
<ports>
<port>${aps.port}:8080</port>
<port>${aps.debugger.port}:8000</port>
</ports>
<dependsOn>
<container>aps-db</container>
</dependsOn>
<network>
<mode>custom</mode>
<name>${project.artifactId}</name>
</network>
<volumes>
<bind>
<volume>${aps.license.directory}:/root/.activiti/enterprise-license:ro</volume>
<volume>${project.build.warFile}:/var/lib/tomcat/webapps/activiti-app.war:ro</volume>
<volume>${beedk.deploy.aps.classesDirectory}:/var/lib/tomcat/dev/post-rsrc:ro</volume>
<volume>${beedk.deploy.aps.testClassesDirectory}:/var/lib/tomcat/dev/post-rsrc-extra1:ro</volume>
<volume>${beedk.deploy.aps.extDirectory}:/var/lib/tomcat/dev/lib:ro</volume>
</bind>
</volumes>
<wait>
<http>
<url>http://admin%40app.activiti.com:admin@localhost:${aps.port}/activiti-app/api/management/engine</url>
<method>GET</method>
<status>200</status>
</http>
<time>${aps.timeout}</time>
</wait>
</run>
</image>
</images>
</configuration>
</execution>
<execution>
<id>stop-aps-app</id>
<phase>post-integration-test</phase>
<goals><goal>stop</goal></goals>
<configuration>
<images>
<image>
<name>postgres:${acs-postgres.version}</name>
<alias>acs-db</alias>
</image>
<image>
<name>docker.inteligr8.com/inteligr8/tomcat-rad:${tomcat-rad.version}</name>
<alias>acs-platform</alias>
</image>
</images>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- allow downstream tiles to default this before this tile does -->
<profile>
<id>tomcat-opts-unspecified</id>
<activation>
<property>
<name>!aps.tomcat.opts</name>
</property>
</activation>
<properties>
<aps.tomcat.opts></aps.tomcat.opts>
</properties>
</profile>
<profile>
<id>default-props</id>
<activation>
<property>
<name>!some-prop-that-never-exists</name>
</property>
</activation>
<properties>
<!-- configurable -->
<aps.war.groupId>com.activiti</aps.war.groupId>
<aps.war.artifactId>activiti-app</aps.war.artifactId>
<aps.war.version>${aps.version}</aps.war.version>
<project.build.warDirectory>${project.build.directory}/war</project.build.warDirectory>
<beedk.deploy.aps.classesDirectory>${project.build.outputDirectory}</beedk.deploy.aps.classesDirectory>
<beedk.deploy.aps.testClassesDirectory>${project.build.testOutputDirectory}</beedk.deploy.aps.testClassesDirectory>
<beedk.deploy.aps.extDirectory>${project.build.directory}/ext</beedk.deploy.aps.extDirectory>
<beedk.deploy.aps.warDirectory>${project.build.warDirectory}</beedk.deploy.aps.warDirectory>
<aps.timeout>60000</aps.timeout>
<aps.memory>512m</aps.memory>
<aps.debugger.enabled>true</aps.debugger.enabled>
<alfresco.license.directory>${user.home}/alfresco/license</alfresco.license.directory>
<aps.license.directory>${alfresco.license.directory}/aps</aps.license.directory>
<!-- ports -->
<aps-postgres.port>5433</aps-postgres.port>
<aps.port>8080</aps.port>
<aps.debugger.port>8000</aps.debugger.port>
<!-- versions -->
<aps-postgres.version>12</aps-postgres.version>
<aps.version>2.4.6</aps.version>
<tomcat-rad.version>9-2.2</tomcat-rad.version>
<!-- results -->
<project.build.warFile>${project.build.warDirectory}/${aps.war.artifactId}-${aps.war.version}.war</project.build.warFile>
</properties>
</profile>
</profiles>
<tiles>
<!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-run-tile -->
<tile>@project.groupId@:beedk-run-tile:@project.version@</tile>
</tiles>
</project>

View File

@ -85,4 +85,4 @@ Additional less important configurations are inherited from the following Maven
## Results
The ACS Platform, database, and MQ components will be started during the `process-classes` Maven phase.
The APS app and database will be started during the `process-classes` Maven phase.

View File

@ -101,6 +101,7 @@
<module>beedk-acs-platform-artifact-it-tile</module>
<module>beedk-acs-share-self-it-tile</module>
<module>beedk-ate-it-tile</module>
<module>beedk-aps-ext-it-tile</module>
<module>beedk-acs-module-tile</module>
<module>beedk-acs-platform-module-tile</module>