diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 000000000..8f3d37989 --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -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' + - 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' diff --git a/integration-tests/common/pom.xml b/integration-tests/common/pom.xml new file mode 100644 index 000000000..1a60ed9aa --- /dev/null +++ b/integration-tests/common/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + org.jboss.arquillian + integration-tests + 1.8.2.Final-SNAPSHOT + ../pom.xml + + + common-tests + Arquillian Core: Common integration tests + + + + + + jakarta.annotation + jakarta.annotation-api + + + jakarta.enterprise + jakarta.enterprise.cdi-api + + + jakarta.inject + jakarta.inject-api + + + jakarta.ws.rs + jakarta.ws.rs-api + + + org.jboss.arquillian.container + arquillian-container-test-api + + + org.jboss.arquillian.test + arquillian-test-api + + + + + + diff --git a/integration-tests/common/src/main/java/org/jboss/arquillian/integration/test/common/app/Greeter.java b/integration-tests/common/src/main/java/org/jboss/arquillian/integration/test/common/app/Greeter.java new file mode 100644 index 000000000..c6d69b3e2 --- /dev/null +++ b/integration-tests/common/src/main/java/org/jboss/arquillian/integration/test/common/app/Greeter.java @@ -0,0 +1,14 @@ +package org.jboss.arquillian.integration.test.common.app; + +import jakarta.enterprise.context.ApplicationScoped; + +/** + * @author James R. Perkins + */ +@ApplicationScoped +public class Greeter { + + public String greet(String name) { + return "Hello " + name + "!"; + } +} diff --git a/integration-tests/junit4-tests/pom.xml b/integration-tests/junit4-tests/pom.xml new file mode 100644 index 000000000..a438e1ffd --- /dev/null +++ b/integration-tests/junit4-tests/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + org.jboss.arquillian + integration-tests + 1.8.2.Final-SNAPSHOT + + + junit4-tests + Arquillian Core: JUnit 4 Integration Tests + + + 4.13.2 + + + + + + + junit + junit + test + ${version.org.junit} + + + org.jboss.arquillian + common-tests + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + + + + + + wildfly + + + false + + + + + org.wildfly.arquillian + wildfly-arquillian-container-managed + ${version.org.wildfly.arquillian} + test + + + + + + diff --git a/integration-tests/junit4-tests/src/test/java/org/jboss/arquillian/integration/test/junit/CdiInjectionTestCase.java b/integration-tests/junit4-tests/src/test/java/org/jboss/arquillian/integration/test/junit/CdiInjectionTestCase.java new file mode 100644 index 000000000..2afa4d4aa --- /dev/null +++ b/integration-tests/junit4-tests/src/test/java/org/jboss/arquillian/integration/test/junit/CdiInjectionTestCase.java @@ -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 James R. Perkins + */ +@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")); + } +} diff --git a/integration-tests/junit5-tests/pom.xml b/integration-tests/junit5-tests/pom.xml new file mode 100644 index 000000000..606f93ef0 --- /dev/null +++ b/integration-tests/junit5-tests/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + + org.jboss.arquillian + integration-tests + 1.8.2.Final-SNAPSHOT + + + junit5-tests + Arquillian Core: JUnit 5 Integration Tests + + + 5.10.3 + + + + + + org.junit + junit-bom + ${version.org.junit} + pom + import + + + + + + + + + org.junit.jupiter + junit-jupiter + test + + + org.jboss.arquillian + common-tests + test + + + org.jboss.arquillian.junit5 + arquillian-junit5-container + test + + + + + + + + wildfly + + + false + + + + + org.wildfly.arquillian + wildfly-arquillian-container-managed + ${version.org.wildfly.arquillian} + test + + + + + + diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/junit5/CdiInjectionTestCase.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/junit5/CdiInjectionTestCase.java new file mode 100644 index 000000000..faf6f65ad --- /dev/null +++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/junit5/CdiInjectionTestCase.java @@ -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 James R. Perkins + */ +@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")); + } +} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml new file mode 100644 index 000000000..3206f7f7d --- /dev/null +++ b/integration-tests/pom.xml @@ -0,0 +1,162 @@ + + + 4.0.0 + + org.jboss.arquillian + arquillian-parent + 1.8.2.Final-SNAPSHOT + ../pom.xml + + + integration-tests + pom + Arquillian Core: Implementation Integration Tests + Tests for implementations of Arquillian Core + + + common + junit4-tests + junit5-tests + testng-tests + + + + false + + + 10.0.0 + ${project.version} + 1.8.1.Final + + + + + + + jakarta.platform + jakarta.jakartaee-bom + ${version.jakarta.ee} + import + pom + + + org.jboss.arquillian + arquillian-bom + ${version.org.jboss.arquillian} + import + pom + + + org.jboss.arquillian.jakarta + arquillian-jakarta-bom + ${version.org.jboss.arquillian.jakarta} + import + pom + + + org.jboss.arquillian + common-tests + ${project.version} + + + + + + + + + + maven-surefire-plugin + + true + + + + + + + maven-deploy-plugin + + true + + + + + + + + + wildfly + + ${skipTests} + true + + + 5.1.0.Beta3 + 5.0.0.Final + + ${project.build.directory}${file.separator}wildfly + + + + + + + + + + maven-surefire-plugin + + ${skipTests} + + ${jboss.home} + + + + + org.wildfly.plugins + wildfly-maven-plugin + ${version.wildfly-maven-plugin} + + ${skip.provision.server} + ${jboss.home} + ${jboss.home} + + + org.wildfly + wildfly-ee-galleon-pack + + + + + + org.wildfly.channels + wildfly-ee + + + + + ee-core-profile-server + + + true + + + + + provision-wildfly + + provision + + process-test-classes + + + + + + + + + diff --git a/integration-tests/testng-tests/pom.xml b/integration-tests/testng-tests/pom.xml new file mode 100644 index 000000000..3c402d7de --- /dev/null +++ b/integration-tests/testng-tests/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + org.jboss.arquillian + integration-tests + 1.8.2.Final-SNAPSHOT + + + testng-tests + Arquillian Core: TestNG Integration Tests + + + 7.5 + + + + + + + org.testng + testng + ${version.org.testng} + test + + + org.jboss.arquillian + common-tests + test + + + org.jboss.arquillian.testng + arquillian-testng-container + test + + + + + + + + wildfly + + + false + + + + + org.wildfly.arquillian + wildfly-arquillian-container-managed + ${version.org.wildfly.arquillian} + test + + + + + + diff --git a/integration-tests/testng-tests/src/test/java/org/jboss/arquillian/integration/test/testng/CdiInjectionTestCase.java b/integration-tests/testng-tests/src/test/java/org/jboss/arquillian/integration/test/testng/CdiInjectionTestCase.java new file mode 100644 index 000000000..a92605952 --- /dev/null +++ b/integration-tests/testng-tests/src/test/java/org/jboss/arquillian/integration/test/testng/CdiInjectionTestCase.java @@ -0,0 +1,41 @@ +package org.jboss.arquillian.integration.test.testng; + +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.test.api.ArquillianResource; +import org.jboss.arquillian.testng.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.testng.Assert; +import org.testng.annotations.Test; + +/** + * @author James R. Perkins + */ +@ApplicationScoped +public class CdiInjectionTestCase extends Arquillian { + + @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, "Greeter should not be null"); + Assert.assertEquals(greeter.greet("JUnit5"), "Hello JUnit5!"); + } +} diff --git a/pom.xml b/pom.xml index 8619ba89b..39213b8a3 100644 --- a/pom.xml +++ b/pom.xml @@ -71,6 +71,7 @@ protocols bom + integration-tests