Skip to content

Commit

Permalink
Move WildFly integration tests from ear module to integration-tests m…
Browse files Browse the repository at this point in the history
…odule and introduce Arquillian and JUnit 5 (resolves clusterbench#470)
  • Loading branch information
rhusar committed Jul 11, 2024
1 parent edc749d commit a6fba87
Show file tree
Hide file tree
Showing 9 changed files with 247 additions and 134 deletions.
123 changes: 1 addition & 122 deletions clusterbench-ee10-ear/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright The ClusterBench Authors
~ SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -29,15 +30,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- Define executions since 'ear' packaging skips test compilation -->
<executions>
<execution>
<id>testCompile</id>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -75,26 +67,6 @@
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>failsafe-integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -126,85 +98,9 @@
<classifier>granular</classifier>
<type>war</type>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>integration</id>
<activation>
<property>
<name>!skipTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<!-- Shared configuration to be picked up by e.g. manual 'mvn wildfly:run' -->
<configuration>
<serverConfig>standalone-ha.xml</serverConfig>
<serverArgs>
<serverArg>-Djboss.node.name=clusterbench-1</serverArg>
</serverArgs>
<version>${version.org.wildfly}</version>
</configuration>
<executions>
<execution>
<id>integration-test-wildfly-deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>execute-commands</goal>
<goal>deploy</goal>
</goals>
<configuration>
<batch>true</batch>
<scripts>
<script>jgroups.cli</script>
</scripts>
</configuration>
</execution>
<execution>
<id>integration-test-wildfly-undeploy</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-quickly</id>
<activation>
<property>
<name>quickly</name>
</property>
</activation>
<properties>
<wildfly.skip>true</wildfly.skip>
</properties>
</profile>
<profile>
<!-- OpenShift will run the following with extra properties: "mvn -e -Popenshift -DskipTests -B package" -->
<!-- See https://github.com/wildfly/wildfly-charts/blob/main/charts/wildfly/README.md -->
Expand Down Expand Up @@ -241,23 +137,6 @@
<filename>ROOT.ear</filename>
</configuration>
</execution>
<execution>
<id>integration-test-wildfly-deploy</id>
<phase>none</phase>
</execution>
<execution>
<id>integration-test-wildfly-undeploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
13 changes: 9 additions & 4 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,26 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${version.org.junit.jupiter}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${version.org.jboss.arquillian}</version>
<scope>import</scope>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<modules>
<!--
<module>wildfly</module>
-->
<module>tomcat-10.1</module>
<module>wildfly</module>
</modules>

</project>
File renamed without changes.
162 changes: 162 additions & 0 deletions integration-tests/wildfly/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright The ClusterBench Authors
~ SPDX-License-Identifier: Apache-2.0
-->

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.test</groupId>
<artifactId>clusterbench-it-parent</artifactId>
<version>10.0.0.Final-SNAPSHOT</version>
</parent>

<artifactId>clusterbench-it-wildfly</artifactId>
<packaging>jar</packaging>

<properties>
<jboss.home>${project.build.directory}/wildfly</jboss.home>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${version.org.junit.jupiter}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${version.org.jboss.arquillian}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>5.1.0.Beta2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-war</id>
<phase>generate-test-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.test</groupId>
<artifactId>clusterbench-ee10-ear</artifactId>
<version>${project.version}</version>
<type>ear</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>smoke-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemProperties>
<jboss.home>${jboss.home}</jboss.home>
</systemProperties>
<trimStackTrace>false</trimStackTrace>
<classpathDependencyExcludes>
<exclude>org.jboss.arquillian.junit:arquillian-junit-container</exclude>
<exclude>org.jboss.arquillian.junit:arquillian-junit-core</exclude>
</classpathDependencyExcludes>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.org.wildfly.maven.plugin}</version>
<configuration>
<provisioning-dir>${jboss.home}</provisioning-dir>
<jboss-home>${jboss.home}</jboss-home>
<feature-packs>
<feature-pack>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-ee-galleon-pack</artifactId>
<version>${version.org.wildfly}</version>
</feature-pack>
</feature-packs>
<galleon-options>
<jboss-fork-embedded>true</jboss-fork-embedded>
</galleon-options>
<layers>
<layer>cloud-server</layer>
<layer>jsf</layer>
<layer>ejb</layer>
<layer>web-clustering</layer>
</layers>
</configuration>
<executions>
<execution>
<id>provision-server-for-testing</id>
<goals>
<goal>provision</goal>
</goals>
<phase>process-test-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright The ClusterBench Authors
* SPDX-License-Identifier: Apache-2.0
*/

package org.jboss.test.clusterbench.it.wildfly;

import java.io.File;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.importer.ZipImporter;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;

/**
* Imports previously built enterprise archive (ear) for automatic deployment and allowing resource injection.
*
* TODO: move this to a suite scope, so it's only done once per execution.
*
* @author Radoslav Husar
*/
public abstract class AbstractWildFlyIT {

@Deployment(testable = false)
public static Archive<?> deployment() {
return ShrinkWrap
.create(ZipImporter.class, "clusterbench.ear")
.importFrom(new File("target/clusterbench-ee10-ear.ear"))
.as(EnterpriseArchive.class);
}

}
Loading

0 comments on commit a6fba87

Please sign in to comment.