Skip to content
This repository has been archived by the owner on Jul 4, 2020. It is now read-only.

osiam/connector4java-integration-tests

Repository files navigation

connector4java-integration-tests Circle CI

The integration-tests for OSIAM.

Install

You can run the integration-tests on your machine, you only need to install java and docker, and configure docker.

The tests will fetch the snapshot dependencies from OSS JFrog or you clone the following repos and install them with ./mvnw clean install

https://github.com/osiam/connector4java
https://github.com/osiam/osiam

Configure Docker

The integration-tests use the docker-maven-plugin, which utilizes docker-java. In order to run the integration-tests, you need to ensure that your docker daemon listens on the TCP port 2375.

How exactly this works depends on your operating system, but

echo 'DOCKER_OPTS="-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock' >> /etc/default/docker

is a good starting point. For further information, please refer to the docker-java README and the official Docker documentation.

Run

To run the integration-tests against

postgres (default)

$ ./mvnw clean verify

mysql

$ ./mvnw clean verify -P mysql

Run in your IDE

To run the integration-tests in your IDE against the started containers

postgres (default)

$ ./mvnw clean pre-integration-test

mysql

$ ./mvnw clean pre-integration-test -P mysql

If you are on mac or want to run them in a VM, just checkout the OSIAM vagrant VM. It's pretty easy to setup. Just run the above mentioned command in the OSIAM vagrant VM and then the integration-tests against the VM.

Cross Project Debugging

If you want to use the integration tests to debug code in other OSIAM projects, you need to enable the debug profile. Please remember that this overrides the active-by-default setting for the postgres profile, so if you want to use it, run it like

$ ./mvnw clean pre-integration-test -P postgres,debug

This changes nothing for the mysql profile, so running

$ ./mvnw clean pre-integration-test -P mysql,debug

is equivalent.

In your IDE containing the project you want to debug, you can now attach the debugger. Just use the normal remote debugging setup for your IDE and connect to localhost:8000. Set your breakpoints as usual and run the test in the ITs project. Your IDE should pop up as soon as the service reaches the breakpoint.

Run against remote docker host

If you like to run the tests against a remote docker host, you nedd to set the following system properties:

Docker:

  • docker.host The URL of the docker daemon. Default: http://localhost:2375

OSIAM:

  • osiam.host.protocol The protocol of the OSIAM host. Default: http
  • osiam.host The host where OSIAM is running. Default: localhost
  • osiam.port The port where OSIAM is running. Default: 8180
  • osiam.database.host The host where the database for OSIAM is running. Default: localhost
  • osiam.database.port The port where the database for OSIAM is running. Defaults: Postgres: 15432, MySQL: 13306

Here is an example when docker running in a boot2docker vm:

$ ./mvnw verify -Ddocker.host=https://192.168.99.100:2376 -Dosiam.host=192.168.99.100