ATS-252 : Use docker-maven-plugin for the integration tests

This commit is contained in:
Cezar.Leahu 2019-06-05 20:31:54 +03:00 committed by CezarLeahu
parent 8419cc4b6d
commit 69a836fc89
12 changed files with 181 additions and 26 deletions

2
.gitignore vendored
View File

@ -35,3 +35,5 @@ hs_err_pid*
alf_data alf_data
/src/main/resources/alfresco-global.properties /src/main/resources/alfresco-global.properties
/src/main/resources/alfresco/extension/custom-log4j.properties /src/main/resources/alfresco/extension/custom-log4j.properties
libreoffice-dist-*-linux.gz

View File

@ -11,7 +11,7 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/../"
mvn -B -U \ mvn -B -U \
clean install \ clean install \
-DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true \ -DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true \
"-P${PROFILE}" "-P${PROFILE},docker-it-setup"
docker ps -a -q | xargs -r -l docker stop ; docker ps -a -q | xargs -r -l docker rm docker ps -a -q | xargs -r -l docker stop ; docker ps -a -q | xargs -r -l docker rm

View File

@ -56,7 +56,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>${dependency.spring-boot.version}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -69,6 +68,14 @@
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId> <artifactId>license-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -91,6 +98,19 @@
<profiles> <profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile> <profile>
<id>local</id> <id>local</id>
<build> <build>

View File

@ -42,7 +42,7 @@ import org.springframework.test.context.junit4.SpringRunner;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class AlfrescoPdfRendererQueueTransformServiceTest extends AbstractQueueTransformServiceIT public class AlfrescoPdfRendererQueueTransformServiceIT extends AbstractQueueTransformServiceIT
{ {
@Override @Override
protected TransformRequest buildRequest() protected TransformRequest buildRequest()

View File

@ -56,7 +56,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>${dependency.spring-boot.version}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -69,6 +68,14 @@
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId> <artifactId>license-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -91,6 +98,19 @@
<profiles> <profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile> <profile>
<id>local</id> <id>local</id>
<build> <build>

View File

@ -42,7 +42,7 @@ import org.springframework.test.context.junit4.SpringRunner;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ImageMagickQueueTransformServiceTest extends AbstractQueueTransformServiceIT public class ImageMagickQueueTransformServiceIT extends AbstractQueueTransformServiceIT
{ {
@Override @Override
protected TransformRequest buildRequest() protected TransformRequest buildRequest()

View File

@ -64,7 +64,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>${dependency.spring-boot.version}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -77,6 +76,14 @@
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId> <artifactId>license-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
@ -99,6 +106,19 @@
<profiles> <profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile> <profile>
<id>local</id> <id>local</id>
<build> <build>

View File

@ -41,7 +41,7 @@ import org.springframework.test.context.junit4.SpringRunner;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class LibreOfficeQueueTransformServiceTest extends AbstractQueueTransformServiceIT public class LibreOfficeQueueTransformServiceIT extends AbstractQueueTransformServiceIT
{ {
@Override @Override
protected TransformRequest buildRequest() protected TransformRequest buildRequest()

View File

@ -128,7 +128,6 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>${dependency.spring-boot.version}</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -137,6 +136,14 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId> <artifactId>license-maven-plugin</artifactId>
@ -163,6 +170,19 @@
<profiles> <profiles>
<profile>
<id>docker-it-setup</id>
<!-- raises an ActiveMq container for the Integration Tests -->
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile> <profile>
<id>local</id> <id>local</id>
<build> <build>

View File

@ -42,7 +42,7 @@ import org.springframework.test.context.junit4.SpringRunner;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TikaQueueTransformServiceTest extends AbstractQueueTransformServiceIT public class TikaQueueTransformServiceIT extends AbstractQueueTransformServiceIT
{ {
@Override @Override
protected TransformRequest buildRequest() protected TransformRequest buildRequest()

View File

@ -79,22 +79,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>maven-activemq-plugin</artifactId>
<version>5.7.0</version>
<executions>
<execution>
<configuration>
<fork>true</fork>
</configuration>
<goals>
<goal>run</goal>
</goals>
<phase>process-test-classes</phase>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

91
pom.xml
View File

@ -18,7 +18,6 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
<image.tag>latest</image.tag> <image.tag>latest</image.tag>
<dependency.pdfbox.version>2.0.12</dependency.pdfbox.version> <dependency.pdfbox.version>2.0.12</dependency.pdfbox.version>
<dependency.spring-boot.version>2.1.1.RELEASE</dependency.spring-boot.version>
<dependency.alfresco-core.version>7.3</dependency.alfresco-core.version> <dependency.alfresco-core.version>7.3</dependency.alfresco-core.version>
<dependency.alfresco-data-model.version>8.8</dependency.alfresco-data-model.version> <dependency.alfresco-data-model.version>8.8</dependency.alfresco-data-model.version>
<dependency.alfresco-jodconverter-core.version>3.0.1.1</dependency.alfresco-jodconverter-core.version> <dependency.alfresco-jodconverter-core.version>3.0.1.1</dependency.alfresco-jodconverter-core.version>
@ -204,11 +203,101 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
</configuration>
<executions>
<execution>
<id>default-test</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>io.fabric8</groupId> <groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId> <artifactId>fabric8-maven-plugin</artifactId>
<version>4.1.0</version> <version>4.1.0</version>
</plugin> </plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.26.1</version>
<extensions>true</extensions>
<configuration>
<apiVersion>1.29</apiVersion>
<imagePullPolicy>Always</imagePullPolicy>
<autoCreateCustomNetworks>true</autoCreateCustomNetworks>
<!--<dockerHost>tcp://127.0.0.1:2376</dockerHost>-->
<images>
<image>
<alias>activemq</alias>
<name>alfresco/alfresco-activemq:5.15.6</name>
<run>
<hostname>activemq</hostname>
<network>
<name>transform</name>
<alias>activemq</alias>
</network>
<ports>
<port>8161:8161</port>
<port>5672:5672</port>
<port>61616:61616</port>
</ports>
<wait>
<log>Apache ActiveMQ 5.15.6 .* started</log>
<time>20000</time>
<kill>500</kill>
<shutdown>100</shutdown>
<exec>
<preStop>kill 1</preStop>
<preStop>kill -9 1</preStop>
</exec>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>before-integration-tests</id>
<phase>pre-integration-test</phase>
<goals>
<!--<goal>stop</goal>-->
<goal>start</goal>
</goals>
</execution>
<execution>
<id>after-integration-tests</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>