Skip to end of metadata
Go to start of metadata

Running a service in Eclipse

To run a service in Eclipse, it's good to know what the default port number for each service:

ServicePort
adminservice8080
analysisservice8081
appservice8082
batchservice8083

In Eclipse, this can be configured as part of the run settings:

Note the other option too: -ea, which enables assertions. Highly recommended!

Integration tests

The integration tests are written in Groovy and checked in under /src/intTest.

To run all integration tests:

gradlew --rerun-tasks :adminservice:intTest :analysisservice:intTest :appservice:intTest

To run a single test (e.g. the User test):

gradlew :appservice:cleanIntTest :appservice:intTest --tests UserTest

To run a single test continuously (e.g. the User test):

gradlew --continuous :appservice:intTest --tests UserTest

To clear the DB and start all services, wait for a key stroke and then start all the integration tests, you can use batch script servers_start.

To run the tests in Eclipse, you need to have Groovy installed. After that you can use the following test run configuration:

Debugging tips

Load the production database and debug with it

  • Copy a database backup from the jump server (/home/dbdump/yona) or dump the database:
    docker exec mariadb sh -c "exec mysqldump --databases yona -u$yona_db_user_name -p$yona_db_password"  | gzip -c > dump.sql.gz
  • Copy the dump to your local system (e.g. through WinSCP)
  • Load the data into the local database
    mysql --user=%YONA_DB_USER_NAME% --password=%YONA_DB_PASSWORD% < scripts\recreateYonaDB.sql
    gzip -cd < C:\Users\Bert\Downloads\dump.sql.gz | mysql --user=%YONA_DB_USER_NAME% --password=%YONA_DB_PASSWORD%
  • Start the services, retaining the current database content
    servers_start -keepDB

Debug as usual.

Generate a standard data set and gather statistics for various requests

Run this gradle command:

gradlew :appservice:cleanIntTest :appservice:intTest -Pyona_enableHibernateStatsAllowed=true -DintTest.single=HibernateStatsTest

This generates a file with query statistics: appservice/build/reports/tests/intTest/HibernateStatsTest.md. We retain a copy of the statistics in Git. To update that, copy the generated file:

cp appservice/build/reports/tests/intTest/HibernateStatsTest.md appservice/src/intTest/HibernateStatsTest.md

If you want to log details about the database interaction, enable the following property:

logging.level.org.hibernate.SQL=DEBUG

 

 

 

  • No labels