Skip to content

Commit

Permalink
Closes Taskana#612: add wildfly test that wildflyApp is deployed
Browse files Browse the repository at this point in the history
  • Loading branch information
arolfes committed Nov 21, 2023
1 parent 30076fd commit e2a619c
Show file tree
Hide file tree
Showing 15 changed files with 1,318 additions and 6 deletions.
8 changes: 8 additions & 0 deletions docker-databases/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3'
services:
taskana-postgres_14:
build: postgres_14
ports:
- 50102:5432
environment:
- POSTGRES_PASSWORD=postgres
3 changes: 3 additions & 0 deletions docker-databases/postgres_14/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM postgres:14.7
RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
ENV LANG de_DE.utf8
43 changes: 43 additions & 0 deletions docker-databases/prepare_db.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@ECHO OFF
SETLOCAL

:MENU
ECHO.
ECHO -----------------------------------------------------
ECHO PRESS a number to select your task - anything to EXIT.
ECHO -----------------------------------------------------
ECHO.
ECHO 1 - Start POSTGRES 14
ECHO 2 - Stop POSTGRES 14
ECHO.
ECHO 3 - Stop all
ECHO.
SET /P MENU=Select task then press ENTER:
ECHO.
IF [%MENU%]==[1] GOTO START_POSTGRES_14
IF [%MENU%]==[2] GOTO STOP_POSTGRES_14
IF [%MENU%]==[3] GOTO STOP_ALL
EXIT /B

:START_POSTGRES_14
ECHO ---
ECHO docker-compose -f %~dp0/docker-compose.yml up -d taskana-postgres_14
docker-compose -f %~dp0/docker-compose.yml up -d taskana-postgres_14

ECHO ---
GOTO MENU

:STOP_POSTGRES_14
ECHO ---
ECHO docker stop taskana-postgres_14
ECHO docker-compose -f %~dp0/docker-compose.yml rm -f -s -v taskana-postgres_14
docker-compose -f %~dp0/docker-compose.yml rm -f -s -v taskana-postgres_14
ECHO ---
GOTO MENU

:STOP_ALL
ECHO ---
ECHO docker-compose -f %~dp0/docker-compose.yml down -v
docker-compose -f %~dp0/docker-compose.yml down -v
ECHO ---
GOTO MENU
68 changes: 68 additions & 0 deletions docker-databases/prepare_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
set -e #fail fast
trap "exit 1" TERM
export TOP_PID=$$

#H Usage:
#H %FILE% -h | %FILE% --help
#H
#H prints this help and exits
#H
#H %FILE% <database>
#H
#H downloads and starts docker image for TASKANA unit tests.
#H
#H %FILE% stop [database]
#H
#H stops the database.
#H If no database was provided all databases are stopped.
#H
#H database:
#H - POSTGRES | POSTGRES_14
# Arguments:
# $1: exit code
function helpAndExit() {
cat "$0" | grep "^#H" | cut -c4- | sed -e "s/%FILE%/$(basename "$0")/g"
exit "$1"
}

# This function maps the database parameter (for this file) to the docker-compose service name.
# Arguments:
# $1: the database which should be mapped
function mapDBToDockerComposeServiceName() {
[[ -z "$1" || "$1" == "H2" ]] && return
case "$1" in
POSTGRES|POSTGRES_14)
echo "taskana-postgres_14"
;;
*)
echo "unknown database '$1'" >&2 && kill -s TERM $TOP_PID
esac
}

function main() {
[[ $# -eq 0 || "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0
scriptDir=$(dirname "$0")

case "$1" in
H2)
;;
POSTGRES|POSTGRES_14)
docker-compose -f $scriptDir/docker-compose.yml up -d "$(mapDBToDockerComposeServiceName "$1")"
;;
stop)
# this variable is necessary, so that the script can terminate properly
# when the provided database name does not match. PLEASE DO NOT INLINE!
local composeServiceName="$(mapDBToDockerComposeServiceName "$2")"
docker-compose -f $scriptDir/docker-compose.yml rm -f -s -v $composeServiceName
;;
*)
echo "unknown database '$1'" >&2
exit 1
;;
esac

docker ps
}

main "$@"
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
<version.maven.checkstyle>3.3.1</version.maven.checkstyle>
<version.maven.spring-boot>2.7.9</version.maven.spring-boot>
<version.maven.sonar>3.10.0.2594</version.maven.sonar>
<version.wildfly.maven.plugin>4.0.0.Final</version.wildfly.maven.plugin>
<version.jboss-as-maven-plugin>7.9.Final</version.jboss-as-maven-plugin>
<version.maven.resources>3.3.1</version.maven.resources>
<version.maven.dependency>3.6.1</version.maven.dependency>

<version.mybatis>3.5.13</version.mybatis>
<version.spring.mybatis>3.0.2</version.spring.mybatis>
Expand All @@ -76,9 +80,11 @@
<version.javax.ws.rs.api>2.1.1</version.javax.ws.rs.api>
<version.org.webjars.bootstrap>5.3.1</version.org.webjars.bootstrap>
<version.org.jboss.spec>3.0.3.Final</version.org.jboss.spec>
<version.wildfly>11.0.0.Final</version.wildfly>
<version.wildfly.maven.plugin>4.0.0.Final</version.wildfly.maven.plugin>
<version.jboss-as-maven-plugin>7.9.Final</version.jboss-as-maven-plugin>

<version.wildfly>27.0.1.Final</version.wildfly>
<version.arquillian>1.7.1.Final</version.arquillian>
<version.arquillian.managed.wildfly>5.0.1.Final</version.arquillian.managed.wildfly>


<version.archunit>1.0.1</version.archunit>
<version.hamcrest.json>0.2</version.hamcrest.json>
Expand Down
170 changes: 170 additions & 0 deletions taskana-adapter-camunda-wildfly-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-ee</artifactId>
<version>${version.wildfly}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${version.arquillian}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -39,6 +53,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -89,6 +107,15 @@
<version>${version.jakarta.servlet}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>${version.arquillian.managed.wildfly}</version>
<scope>provided</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand All @@ -100,6 +127,51 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-api-maven</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
Expand Down Expand Up @@ -177,7 +249,105 @@
<artifactId>maven-war-plugin</artifactId>
<version>${version.maven-war-plugin}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${version.maven.dependency}</version>
<executions>
<execution>
<id>unpack-wildfly</id>
<phase>process-test-classes</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${version.wildfly}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-postgres-db-driver</id>
<phase>process-test-classes</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<outputDirectory>
${project.build.directory}/wildfly-${version.wildfly}/modules/system/layers/base/org/postgresql/postgresql/main
</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.maven.resources}</version>
<executions>
<execution>
<id>copy-postgres-module-xml</id>
<phase>process-test-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/wildfly-${version.wildfly}/modules/system/layers/base/org/postgresql/postgresql/main
</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>module.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-wildfly-config-xml</id>
<phase>process-test-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/wildfly-${version.wildfly}/standalone/configuration
</outputDirectory>
<resources>
<resource>
<directory>src/test/resources</directory>
<includes>
<include>int-test-standalone.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ taskana-system-connector-outbox-rest-api-user-password=pwd4OutboxRestUser
####################################################################################
# taskana-connector properties
######################################################################################
taskana.datasource.jndi-name=java:/TaskanaDS
taskana.datasource.jndi-name=java:jboss/datasources/TaskanaDS
####### cache static resources properties
spring.web.resources.cache.cachecontrol.cache-private=true
taskana.schemaName=TASKANA
Expand Down
Loading

0 comments on commit e2a619c

Please sign in to comment.