# MOA ZS ## Compile, Test and Package Compilation and Runtime Requirements: - openJDK 12 (OpenJDK 11 has an unfixed bug [1] that prevents the completion of TLS handshakes.) ### Run Unit Tests Command: ``` mvn test ``` ### Run Integration Tests Integration tests start with the prefix `IT`. Run them with the following command: ``` mvn test -P integration-tests ``` ### Run All Tests Command: ``` mvn test -P all-tests ``` Note that some integration tests (prefix `ITSSL`) rely on a TLS connection and Client Authentication. The following guide explains how to set up TLS and Client Authentication with Apache 2. #### Quick Guide: Set Up SSL (inc. Client Authentication) in Apache 2. This guide is only needed for running all tests. Some tests require SSL protection of the service endpoint with SSL Client Authentication. Here's a quick guide how to set up an Apache 2 service on localhost as a SSL terminating reverse proxy to the zusemsg endpoint that runs on . 1. Install Apache 2. 1. Ensure that mod-proxy is installed and enabled. 1. In `default-ssl.conf` add the following lines to proxy requests from `https://localhost/zusemsg` to `http://localhost:8081`: ``` ProxyRequests off ProxyPass /zusemsg/ http://localhost:8081/ ProxyPassReverse /zusemsg/ http://localhost:8081/ Order allow,deny allow from all ``` 1. Use certificate and key provided in this repository for the TLS connection and add the following directives to `default-ssl.conf`: ``` SSLCertificateFile /server.localhost.cert.pem SSLCertificateKeyFile /server.localhost.key.pem SSLCertificateChainFile /ca-chain.cert.pem ``` 1. Trust the client certificate with the following directive in `default-ssl-conf`: ``` SSLCACertificateFile /trusted-cas-bundle.pem ``` ### Package to .war The application can be packaged to a web application archive by running the following command: ``` mvn package ``` Find the war file in the `target/` folder. ## Deployment After packaging the application to a `war` file, the application can be deployed into a servlet container or as a standalone application. ### Deploy as Standalone Application 1. Create a new directory that serves as the application's working directory. ``` mkdir standalone ``` 1. Copy the `war` file into the applications working directory. ``` cp target/moa-zs.war standalone/ ``` 1. Copy the directory `test/main/resources/config/` into the applications working directory. ``` cp src/test/resources/config standalone/ -r ``` The `config` folder works out of the box for test environments. You may apply changes to files in the `config` folder to fit the needs of a productive environment. 1. Start application. ``` (cd standalone && java -jar moa-zs.war) ``` ### Deploy to Tomcat Container TODO: Describe # Footnotes [1] https://bugs.openjdk.java.net/browse/JDK-8214098