Skip to content
Mark Prins edited this page Jun 12, 2019 · 8 revisions

Here is some documentation for developers

Extra information for print

https://gist.github.com/mtoonen/5b97b82255b8e6ae39ac

Extra layers for print

https://gist.github.com/mtoonen/7463484c8a70578a2e40

unit testing

Unit tests run as part of the normal build cycle, if you want to run them separately use the following command: mvn test. A large amount of database unit testing was introduced in PR 446. These tests use a HSQLDB database. Unit tests have a naming convention of <Classname>Test.java, deviating from this convention may lead to unexpected test runs.

integration testing

PR 505 introduced the possibility to run integration tests of the viewer component. By default these tests only run on Travis-CI using the travis-ci profile. It is possible to run these tests locally by using the following command: mvn verify -Ptravis-ci from the viewer directory. You may want to change the database params in viewer/src/test/resources/postgres.properties to match your environment.

While creating/developing more tests it can be useful to have tomcat running, you can do this using the command mvn package tomcat7:run -Ptravis-ci. This will enable you to run tests from your ide, an example test is available in viewer/src/test/java/nl/b3p/viewer/ViewerIntegrationTest.java

Integration tests have a naming convention of <ClassOrProcessOrComponentname>IntegrationTest.java, deviating from this convention may lead to unexpected test runs.

Getting started with MS SQL for development

docker

The easiest way to get a local ms sql database is using docker:

docker pull microsoft/mssql-server-linux:2017-latest
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Password12!' -p 1433:1433 --name sql2017 -h sql2017 -d microsoft/mssql-server-linux:2017-latest

This will create a docker instance of mssql-server-linux named sql2017 with superuser sa and password Password12! listening at localhost:1433. If you add the --rm flag the container will be deleted after stopping, nice to have for clean starts:

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=Password12!' -p 1433:1433 --name sql2017 --rm -h sql2017 -d microsoft/mssql-server-linux:2017-latest

You can use docker stop sql2017 to stop the container, docker rm sql2017 to delete the container and and docker start sql2017 to start the container.

More information at: https://docs.microsoft.com/nl-nl/sql/linux/sql-server-linux-configure-docker?view=sql-server-linux-2017 and https://docs.docker.com/engine/reference/run/

docker shell / commandline

To get a shell in the container use docker exec -it sql2017 "bash" which will then allow you to do /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Password12!' -d "flamingo4"

install sqlcmd / commandline

You can use apt to install sqlcmd locally (on eg ubuntu xenial / 16.04):

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update 
sudo apt-get install mssql-tools unixodbc-dev

See: https://docs.microsoft.com/nl-nl/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-linux-2017#tools

create a database

sqlcmd -S localhost,1433 -U SA -P 'Password12!' -Q "CREATE DATABASE flamingo4" -d "master"

Clone this wiki locally