Integrationtests with Wildfly and PostgreSQL for ccm-core

ccm-docs
Jens Pelzetter 2020-07-16 07:34:29 +02:00
parent babfd88124
commit 0e323368f8
4 changed files with 206 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
it-pgsql-datasources.properties
nb-configuration.xml nb-configuration.xml
node node
node_modules node_modules

View File

@ -946,7 +946,7 @@
</profile> </profile>
<profile> <profile>
<id>test-with-wildfly</id> <id>test-with-wildfly-h2mem</id>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.wildfly.arquillian</groupId> <groupId>org.wildfly.arquillian</groupId>
@ -1087,7 +1087,186 @@
</plugin> </plugin>
</plugins> </plugins>
</reporting> </reporting>
</profile>
<profile>
<id>test-with-wildfly-pgsql</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>src/test/resources-wildfly-remote-pgsql</directory>
</testResource>
<testResource>
<directory>${project.build.directory}/generated-resources</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>de.jpdigital</groupId>
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
<configuration>
<dialects>
<param>h2</param>
<param>postgresql9</param>
</dialects>
<packages>
<param>org.libreccm</param>
</packages>
<useEnvers>true</useEnvers>
</configuration>
<executions>
<execution>
<goals>
<goal>gen-ddl</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<forkMode>always</forkMode>
<forkCount>999</forkCount>
<reuseForks>true</reuseForks>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemPropertyVariables>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<executions>
<execution>
<id>read-datasource-properties</id>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/../it-pgsql-datasources.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
<executions>
<execution>
<id>start-test-env</id>
<goals>
<goal>start</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<stdout>System.out</stdout>
</configuration>
</execution>
<execution>
<id>prepare-deploy-jdbc-driver</id>
<configuration>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<name>postgresql.jar</name>
<force>true</force>
</configuration>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy-artifact</goal>
</goals>
</execution>
<execution>
<id>prepare-test-env</id>
<goals>
<goal>add-resource</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<address>subsystem=datasources,data-source=ccm-core-testdb-pgsql</address>
<force>true</force>
<resources>
<resource>
<properties>
<connection-url>${it.ccm-core.datasource.connectionUrl}</connection-url>
<jndi-name>java:/comp/env/jdbc/org/libreccm/ccm-core/pgsql</jndi-name>
<enabled>true</enabled>
<user-name>${it.ccm-core.datasource.username}</user-name>
<password>${it.ccm-core.datasource.password}</password>
<use-ccm>false</use-ccm>
<driver-name>postgresql.jar</driver-name>
</properties>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>shutdown-test-env</id>
<goals>
<goal>shutdown</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<reportSets>
<reportSet>
<id>integration-tests</id>
<reports>
<report>failsafe-report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</profile> </profile>
<profile> <profile>

View File

@ -0,0 +1,11 @@
# Example configuration file for the PostgreSQL datasources used in integration test
# profiles test-with-wildfly-pgsql
# name format: it.${moduleName}.datasource.${property}
#
# Copy these file to it-pgsql-datasources.properties and customize the settings
# to fit your environment
it.ccm-core.datasource.connectionUrl=jdbc://postgresql://localhost:5432/ccm-core-testdb
it.ccm-core.datasource.username=ccm
it.ccm-core.datasource.password=ccm

View File

@ -483,7 +483,7 @@
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>42.2.13</version> <version>42.2.14</version>
</dependency> </dependency>
<!-- <!--