Dockerized Database Integration Tests for Active Objects during Atlassian Plugin Development
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Proof of Concept: Dockerized Database Integration Tests

for Atlassian Server App

A simple Proof of Concept on how to run Database Integration Tests with real dockerized PostgreSQL or MySQL Databases during Atlassian JIRA Server App development. This PoC is based on UnitTests for Active Objects.



  • Docker is installed and on PATH
  • Java 8 JDK is installed and on PATH
  • Atlassian Plugin SDK is installed and on PATH


Running the Tests

We can run the same test against different database engines.


Run tests against embedded HSQLDB


Run tests against dockerized PostgreSQL

(1) Start dockerized PostgreSQL database

docker run --name postgres95 \
           -d --rm -p 5441:5432 \
           -e POSTGRES_PASSWORD=jira \
           -e POSTGRES_USER=jira \
           -e POSTGRES_DB=jira \
           postgres:9.5 \
           postgres -c 'log_statement=all'

(2) Run tests against it

atlas-unit-test -Dao.test.database=postgres \
                -Ddb.url=jdbc:postgresql://localhost:5441/jira  \
                -Ddb.schema=public \
                -Ddb.username=jira \

We can see the tables and indexes:

(3) See logged queries

docker logs postgres95

(4) Shutdown dockerized PostgreSQL database.

docker kill postgres95


Run tests against dockerized MySQL

(1) Start dockerized MySQL database

docker run --name mysql56 \
           -d --rm \
           -p 3316:3306 \
           -e MYSQL_RANDOM_ROOT_PASSWORD=true \
           -e MYSQL_USER=jira  \
           -e MYSQL_PASSWORD=jira  \
           -e MYSQL_DATABASE=jira  \

(2) Run tests against it

atlas-unit-test -Dao.test.database=mysql \
                -Ddb.url=jdbc:mysql://localhost:3316/jira?autoReconnect=true  \
                -Ddb.username=jira \
  • Note that MySQL uses no so called "schema". So we skip the definition.

(3) Shutdown dockerized MySQL database.

docker kill mysql56


Classes and Tests



  • Why not atlas-integration-test?
    • Because even though it is named 'integration-test' it starts a full JIRA instance and runs tests against it. We only want to instantiate Active Objects with a real database and not the whole JIRA context. That is why we use the atlas-unit-test command.
  • Why not use @ManyToOne Annotations?
    • You can do that if you want a Left Join
    • The PoC wants to show how to perform an Inner Join



MIT © Comsysto Reply GmbH