Skip to content

Introduce application containers #7162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ body:
- K3S
- K6
- Kafka
- Liberty
- LocalStack
- MariaDB
- Milvus
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/enhancement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ body:
- K3S
- K6
- Kafka
- Liberty
- LocalStack
- MariaDB
- Milvus
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ body:
- K3S
- K6
- Kafka
- Liberty
- LocalStack
- MariaDB
- Milvus
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ updates:

# Explicit entry for each module
- package-ecosystem: "gradle"
directory: "/modules/application-server-commons"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/azure"
directory: "/modules/activemq"
schedule:
interval: "monthly"
Expand Down Expand Up @@ -161,6 +167,11 @@ updates:
schedule:
interval: "weekly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/liberty"
schedule:
interval: "monthly"
open-pull-requests-limit: 10
- package-ecosystem: "gradle"
directory: "/modules/localstack"
schedule:
Expand Down
56 changes: 56 additions & 0 deletions docs/modules/liberty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Liberty Containers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to display the docs we should add a section Application Servers just like we have it for databases

- Modules:
- Databases:


Testcontainers can be used to automatically instantiate and manage [Open Liberty](https://openliberty.io/) and [WebSphere Liberty](https://www.ibm.com/products/websphere-liberty/) containers.
More precisely Testcontainers uses the official Docker images for [Open Liberty](https://hub.docker.com/_/open-liberty) or [WebSphere Liberty](https://hub.docker.com/_/websphere-liberty)

## Benefits

* Easier integration testing for application developers.
* Easier functional testing for platform development.

## Example

Create a `LibertyContainer` to use it in your tests:
<!--codeinclude-->
[Creating a LibertyContainer](../../modules/liberty/src/test/java/org/testcontainers/liberty/LibertyContainerTest.java) inside_block:constructorWithVersion
<!--/codeinclude-->

Now you can perform integration testing, in this example we are using [RestAssured](https://rest-assured.io/) to query a RESTful web service running in Liberty.

<!--codeinclude-->
[RESTful Test](../../modules/liberty/src/test/java/org/testcontainers/liberty/LibertyContainerTest.java) inside_block:testRestEndpoint
<!--/codeinclude-->

## Multi-container usage

If your Liberty server needs to connect to a data provider, message provider,
or other service that can also be run as a container you can connect them using a network:

* Run your other container on the same network as Liberty container, e.g.:
<!--codeinclude-->
[Network](../../modules/liberty/src/test/java/org/testcontainers/liberty/LibertyContainerTest.java) inside_block:constructorMockDatabase
<!--/codeinclude-->
* Use network aliases and unmapped ports to configure an environment variable that can be access from your Application server.
<!--codeinclude-->
[Configure Liberty](../../modules/liberty/src/test/java/org/testcontainers/liberty/LibertyContainerTest.java) inside_block:configureLiberty
<!--/codeinclude-->

You will need to explicitly create a network and set it on the Liberty container as well as on your other containers that Liberty communicates with.

## Adding this module to your project dependencies

Add the following dependency to your `pom.xml`/`build.gradle` file:

=== "Gradle"
```groovy
testImplementation "org.testcontainers:liberty:{{latest_version}}"
```
=== "Maven"
```xml
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>liberty</artifactId>
<version>{{latest_version}}</version>
<scope>test</scope>
</dependency>
```
9 changes: 9 additions & 0 deletions modules/application-server-commons/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description = "Testcontainers :: Application Server Common"

dependencies {
api project(':testcontainers')

compileOnly 'org.jetbrains:annotations:24.0.1'
implementation 'org.jboss.shrinkwrap:shrinkwrap-impl-base:1.2.6'
testImplementation 'org.assertj:assertj-core:3.24.2'
}
Loading
Loading