Skip to content

New profile 'wildfly-docker-maven' for testing with rhuss/docker-maven-plugin #297

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

Merged
merged 2 commits into from
Apr 21, 2015

Conversation

rhuss
Copy link

@rhuss rhuss commented Mar 30, 2015

This profile demonstrates the usage of docker-maven-plugin for starting a Docker container for integration tests (without Arquillian). It has been tested with the example 'simple-servlet', for which the single unit test has be duplicated to work without Arquillian. The profile uses the maven-failsafe-plugin (triggered on *IT.java classes) and switched off maven-surefire-plugin so that the two tests don't interfere.

The image created contains the deployment artifact already which is copied to /opt/wildfly/standalone/deployments so no extra deployment step is required.

To test it simply call:

mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven clean install

(assuming your DOCKER_HOST variable is set properly). One can also build the image, start and stop it separately:

mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven package docker:build
mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven docker:start
mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven docker:stop

It use dynamically assigned ports, so multiples test can be run in parallel.

Please note that its quite simplistic and doesn't use all feature of the plugin. Some comments has been added inline to explain the various pieces, for more information please refer to the user manual

What is not shown is how to push the combined image to a registry with docker:push. For this to work, the credentials should be added to ~/.m2/settings.xml and the name of the image should be adapted accordingly to the docker hub conventions (user/repo:tag)

rhuss added 2 commits March 30, 2015 18:05
This profile demonstrates the usage of a docker-maven-plugin for starting a Docker container for integration tests (without Arquillian). It has been tested with the example 'simple-servlet'.

The image created contains the deployment artifact already which is copied to `/opt/wildfly/standalone/deployments` so no extra deployment step is required.

To test it simply call:

mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven clean install

(assuming your DOCKER_HOST variable is set properly). One can also build the image, start and stop it separately:

mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven package docker:build
mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven docker:start
mvn  -f servlet/simple-servlet/pom.xml -Pwildfly-docker-maven docker:stop

It use dynamically assigned ports, so multiples test can be run in parallel.
arun-gupta added a commit that referenced this pull request Apr 21, 2015
New profile 'wildfly-docker-maven' for testing with rhuss/docker-maven-plugin
@arun-gupta arun-gupta merged commit 63b9927 into javaee-samples:docker Apr 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants