Skip to content

Commit

Permalink
Merge pull request #25 from KyleAure/124-junit5-runner
Browse files Browse the repository at this point in the history
Add Junit5
  • Loading branch information
cherylking committed Oct 25, 2022
2 parents f4f455d + 4a4060f commit 450efde
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ The Liberty dependency bundles for Arquillian make it easy for you to manage ver

## Dependencies

In this repository, you'll find 4 artifacts that you can use in your Maven and Gradle projects with Jakarta EE 9. They are:
In this repository, you'll find 6 artifacts that you can use in your Maven and Gradle projects with Jakarta EE 9. They are:

- `io.openliberty.arquillian:arquillian-liberty-managed-jakarta-junit` for using the Arquillian Liberty Managed container with JUnit
- `io.openliberty.arquillian:arquillian-liberty-managed-jakarta-junit5` for using the Arquillian Liberty Managed container with JUnit5
- `io.openliberty.arquillian:arquillian-liberty-managed-jakarta-testng` for using the Arquillian Liberty Managed container with TestNG
- `io.openliberty.arquillian:arquillian-liberty-remote-jakarta-junit` for using the Arquillian Liberty Remote container with JUnit
- `io.openliberty.arquillian:arquillian-liberty-remote-jakarta-junit5` for using the Arquillian Liberty Remote container with JUnit5
- `io.openliberty.arquillian:arquillian-liberty-remote-jakarta-testng` for using the Arquillian Liberty Remote container with TestNG

For Java EE 8 or below, the following 4 artifacts are available:
Expand Down
42 changes: 42 additions & 0 deletions arquillian-liberty-managed-junit5/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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>io.openliberty.arquillian</groupId>
<artifactId>arquillian-liberty-jakarta-dependencies</artifactId>
<version>2.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>arquillian-liberty-managed-jakarta-junit5</artifactId>
<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>${liberty.arquillian.groupId}</groupId>
<artifactId>${liberty.managed.artifactId}</artifactId>
<version>${liberty.arquillian.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit5.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
42 changes: 42 additions & 0 deletions arquillian-liberty-remote-junit5/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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>io.openliberty.arquillian</groupId>
<artifactId>arquillian-liberty-jakarta-dependencies</artifactId>
<version>2.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>arquillian-liberty-remote-jakarta-junit5</artifactId>
<packaging>pom</packaging>

<dependencies>
<dependency>
<groupId>${liberty.arquillian.groupId}</groupId>
<artifactId>${liberty.remote.artifactId}</artifactId>
<version>${liberty.arquillian.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit5.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
2 changes: 1 addition & 1 deletion gradle-tests/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dependencyBundleVersion=2.1.1-SNAPSHOT
dependencyBundleVersion=2.1.2-SNAPSHOT
12 changes: 8 additions & 4 deletions it/managed-tests/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ invoker.goals.1 = dependency:tree -Pmanaged-testng -Pol
invoker.goals.2 = clean install -Pmanaged-testng -Pol
invoker.goals.3 = dependency:tree -Pmanaged-junit -Pol
invoker.goals.4 = clean install -Pmanaged-junit -Pol
invoker.goals.5 = dependency:tree -Pmanaged-junit5 -Pol
invoker.goals.6 = clean install -Pmanaged-junit5 -Pol

invoker.goals.5 = dependency:tree -Pmanaged-testng -Pwlp
invoker.goals.6 = clean install -Pmanaged-testng -Pwlp
invoker.goals.7 = dependency:tree -Pmanaged-junit -Pwlp
invoker.goals.8 = clean install -Pmanaged-junit -Pwlp
invoker.goals.7 = dependency:tree -Pmanaged-testng -Pwlp
invoker.goals.8 = clean install -Pmanaged-testng -Pwlp
invoker.goals.9 = dependency:tree -Pmanaged-junit -Pwlp
invoker.goals.10 = clean install -Pmanaged-junit -Pwlp
invoker.goals.11 = dependency:tree -Pmanaged-junit5 -Pwlp
invoker.goals.12 = clean install -Pmanaged-junit5 -Pwlp
9 changes: 8 additions & 1 deletion it/managed-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,17 @@
<profile>
<id>managed-junit</id>
<properties>
<test.to.include>**/JUnit*</test.to.include>
<test.to.include>**/JUnit4*</test.to.include>
<arquillian.dependency.artifact>arquillian-liberty-managed-jakarta-junit</arquillian.dependency.artifact>
</properties>
</profile>
<profile>
<id>managed-junit5</id>
<properties>
<test.to.include>**/JUnit5*</test.to.include>
<arquillian.dependency.artifact>arquillian-liberty-managed-jakarta-junit5</arquillian.dependency.artifact>
</properties>
</profile>

<!-- WLP and OL profiles -->
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @author <a href="http://community.jboss.org/people/dan.j.allen">Dan Allen</a>
*/
@RunWith(Arquillian.class)
public class JUnitGreeterIT {
public class JUnit4GreeterIT {

@Deployment
public static WebArchive createDeployment() {
Expand Down
54 changes: 54 additions & 0 deletions it/managed-tests/src/test-profile-resources/JUnit5GreeterIT.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2022, IBM Corporation, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package application.rest;

import org.arquillian.example.Greeter;
import org.arquillian.example.PhraseBuilder;

import java.io.File;

import jakarta.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.ShrinkWrap;
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;


@ExtendWith(ArquillianExtension.class)
public class JUnit5GreeterIT {

@Deployment
public static WebArchive createDeployment() {
WebArchive archive = ShrinkWrap.create(WebArchive.class).addClasses(Greeter.class, PhraseBuilder.class);
System.out.println(archive.toString());
return archive;
}

@Inject
Greeter greeter;

@Test
public void should_create_greeting() {
String greeting = greeter.createGreeting("Earthling");
Assertions.assertEquals("Hello, Earthling!", greeting);
greeter.greet(System.out, "Earthling");
}
}
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@
<liberty.remote.artifactId>arquillian-liberty-remote-jakarta</liberty.remote.artifactId>

<junit.version>4.13.2</junit.version>
<junit5.version>5.9.0</junit5.version>
<testng.version>6.13.1</testng.version>
</properties>

<modules>
<module>arquillian-liberty-managed-junit</module>
<module>arquillian-liberty-managed-junit5</module>
<module>arquillian-liberty-managed-testng</module>
<module>arquillian-liberty-remote-junit</module>
<module>arquillian-liberty-remote-junit5</module>
<module>arquillian-liberty-remote-testng</module>
</modules>

Expand Down

0 comments on commit 450efde

Please sign in to comment.