-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[580] Create some integration tests. Create profiles for WildFly to r…
…un the tests. Signed-off-by: James R. Perkins <[email protected]>
- Loading branch information
Showing
11 changed files
with
602 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow will build a Java project with Maven | ||
# For more information see: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
|
||
name: Arquillian Integration Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
schedule: | ||
- cron: '0 0 * * *' # Every day at 00:00 UTC | ||
|
||
# Only run the latest job | ||
concurrency: | ||
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
wildfly-integation: | ||
name: 'WildFly Integration Tests' | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 90 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest ] | ||
java: ['11', '17', '21'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
- name: Build with Maven Java ${{ matrix.java }} - ${{ matrix.os }} | ||
run: | | ||
mvn clean install -U -B -fae '-Pwildfly' '-T1' '-Pintegration-tests' | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: surefire-reports-${{ matrix.os }}-${{ matrix.java }} | ||
path: '**/surefire-reports/*' | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: server-logs-${{ matrix.os }}-${{ matrix.java }} | ||
path: '**/server.log' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jboss.arquillian</groupId> | ||
<artifactId>integration-tests</artifactId> | ||
<version>1.8.2.Final-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>common-tests</artifactId> | ||
<name>Arquillian Core: Common integration tests</name> | ||
<description/> | ||
|
||
<properties/> | ||
<dependencies> | ||
<dependency> | ||
<groupId>jakarta.annotation</groupId> | ||
<artifactId>jakarta.annotation-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.enterprise</groupId> | ||
<artifactId>jakarta.enterprise.cdi-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.inject</groupId> | ||
<artifactId>jakarta.inject-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.ws.rs</groupId> | ||
<artifactId>jakarta.ws.rs-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.container</groupId> | ||
<artifactId>arquillian-container-test-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.test</groupId> | ||
<artifactId>arquillian-test-api</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build/> | ||
|
||
</project> |
14 changes: 14 additions & 0 deletions
14
...-tests/common/src/main/java/org/jboss/arquillian/integration/test/common/app/Greeter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.jboss.arquillian.integration.test.common.app; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@ApplicationScoped | ||
public class Greeter { | ||
|
||
public String greet(String name) { | ||
return "Hello " + name + "!"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jboss.arquillian</groupId> | ||
<artifactId>integration-tests</artifactId> | ||
<version>1.8.2.Final-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>junit4-tests</artifactId> | ||
<name>Arquillian Core: JUnit 4 Integration Tests</name> | ||
|
||
<properties> | ||
<version.org.junit>4.13.2</version.org.junit> | ||
</properties> | ||
|
||
<dependencies> | ||
|
||
<!-- Test Dependencies --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
<version>${version.org.junit}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian</groupId> | ||
<artifactId>common-tests</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.junit</groupId> | ||
<artifactId>arquillian-junit-container</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build/> | ||
|
||
<profiles> | ||
<profile> | ||
<id>wildfly</id> | ||
|
||
<properties> | ||
<skip.provision.server>false</skip.provision.server> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.wildfly.arquillian</groupId> | ||
<artifactId>wildfly-arquillian-container-managed</artifactId> | ||
<version>${version.org.wildfly.arquillian}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
43 changes: 43 additions & 0 deletions
43
...tests/src/test/java/org/jboss/arquillian/integration/test/junit/CdiInjectionTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.jboss.arquillian.integration.test.junit; | ||
|
||
import java.net.URI; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.integration.test.common.app.Greeter; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@RunWith(Arquillian.class) | ||
@ApplicationScoped | ||
public class CdiInjectionTestCase { | ||
|
||
@Deployment | ||
public static WebArchive createDeployment() { | ||
return ShrinkWrap.create(WebArchive.class) | ||
.addClass(Greeter.class) | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
} | ||
|
||
@ArquillianResource | ||
private URI uri; | ||
|
||
@Inject | ||
Greeter greeter; | ||
|
||
@Test | ||
public void validateGreeting() { | ||
Assert.assertNotNull("Greeter should not be null", greeter); | ||
Assert.assertEquals("Hello JUnit5!", greeter.greet("JUnit5")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jboss.arquillian</groupId> | ||
<artifactId>integration-tests</artifactId> | ||
<version>1.8.2.Final-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>junit5-tests</artifactId> | ||
<name>Arquillian Core: JUnit 5 Integration Tests</name> | ||
|
||
<properties> | ||
<version.org.junit>5.10.3</version.org.junit> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit</groupId> | ||
<artifactId>junit-bom</artifactId> | ||
<version>${version.org.junit}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
|
||
<!-- Test Dependencies --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian</groupId> | ||
<artifactId>common-tests</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.arquillian.junit5</groupId> | ||
<artifactId>arquillian-junit5-container</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build/> | ||
|
||
<profiles> | ||
<profile> | ||
<id>wildfly</id> | ||
|
||
<properties> | ||
<skip.provision.server>false</skip.provision.server> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.wildfly.arquillian</groupId> | ||
<artifactId>wildfly-arquillian-container-managed</artifactId> | ||
<version>${version.org.wildfly.arquillian}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
43 changes: 43 additions & 0 deletions
43
...ests/src/test/java/org/jboss/arquillian/integration/test/junit5/CdiInjectionTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.jboss.arquillian.integration.test.junit5; | ||
|
||
import java.net.URI; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.integration.test.common.app.Greeter; | ||
import org.jboss.arquillian.junit5.ArquillianExtension; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@ExtendWith(ArquillianExtension.class) | ||
@ApplicationScoped | ||
public class CdiInjectionTestCase { | ||
|
||
@Deployment | ||
public static WebArchive createDeployment() { | ||
return ShrinkWrap.create(WebArchive.class) | ||
.addClass(Greeter.class) | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
} | ||
|
||
@ArquillianResource | ||
private URI uri; | ||
|
||
@Inject | ||
Greeter greeter; | ||
|
||
@Test | ||
public void validateGreeting() { | ||
Assertions.assertNotNull(greeter, "Greeter should not be null"); | ||
Assertions.assertEquals("Hello JUnit5!", greeter.greet("JUnit5")); | ||
} | ||
} |
Oops, something went wrong.