A demonstration of an simple bank application made with Jakarta Enterprise Edition 8 platform (Java EE) for the backend part and with Angular 7 for the frontend part.
- Requirements
- UML Diagram generation
- Java EE 7+ Stack related to code
- Installation
- Start OpenBank
- Test RESTful/SOAP contracts
- Start the client
- Administrate Wildly application server
- Run just the integration tests
- Run unit and system tests with coverage
- Force check code coverage by number of lines for all Java classes
- Generate encrypted property password
- Run the OpenBank with plain text passwords or with encrypted passwords locally
- Deliver new OpenBank Jakarta EE image
- Generate encrypted TRAVIS CI environment variables
To be able to compile and run the OpenBank application the following dependicies are required:
To run application without Docker:
- Maven version 3.6.0 or newer
- JDK 11 or newer
- NodeJS version 10.15.3 or newer
- Angular CLI version 7.3.6 or newer
- Wildfly version 16.0.0 or newer
To run application with Docker:
- Docker Engine version 18.09.2 or later is recommended
By default, uml diagrams are generated by the build setup and stored at the root diagrams directory.
Generate the graphvis dot files to pdf by the command:
find . -type f -name "*.dot" -exec sh -c 'dot -Tpdf "${0}" -o "${0%.*}.pdf"' {} \;
Dependent Injected EntityManager
Annotations that can be applied to both field and method.
Enterprise JavaBeans are required by default.
To be able to dynamically add Interceptor annotation to all Java CDI beans not included in the excluded list.
DynamicEjbInjectionPointInterceptor
Before installing the application in a Docker environment, you will need to source the openbank_setup.sh file so the encrypted property values are decrypted and properly set when building the image. (Windows users needs Cyqwin to be able to execute the bash script.)
source openbank_setup.sh
mvn clean install
docker-compose build --no-cache
Sometimes it is nessesary to clean up images and containers to be able to run OpenBank because of little memory space left and even hard disk space left, only execute this commands below if the regular Docker command give errors.
docker rm -vf $(docker ps -a -q) # Clean up containers
docker rmi -f $(docker images -a -q) # Clean up all images
docker-compose up
Load the generated openbankAPI.yaml file with the http://editor.swagger.io/ editor to easily test the RESTful contracts after successful installation. Be sure to use basic authorization with --user user:pass flag to use the RESTful operations successfully.
Example:
curl --user john:doe -X GET "http://localhost:8080/restful-webservice/api/client/info/191212121212" \
-H "accept: application/json"
For the Spring war package the following OpenApi v2 json file gets generated at OpenBankAPIv1.json
SOAP contracts (Service) is tested through http://localhost:8080/soap-webservice endpoint with SoapUI utility
Goto http://localhost:8080/client/openbank and basic authorization is simplest to test through the Chrome browser.
mvn clean install
docker build -t openbank .
mvn clean install -Pintegrationtests
mvn clean install -Pgenerate-coverage
Code coverage by lines must be at least 50 %
mvn clean install -Pcoverage-check
The demonstration how to generate encrypted password with help of master password, master password shall never be stored in the repository along with any unencrypted passwords to maintain good security.
java -cp ~/.m2/repository/org/jasypt/jasypt/1.9.3/jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI \
input="obpassword" password=my_secret_password algorithm=PBEWithMD5AndDES
# Execute the OpenBank with plain text passwords
mvn clean install -T 1C -DskipTests && source openbank_setup_local.sh && docker-compose -f docker-compose_local.yaml up --build --force-recreate
# Execute the OpenBank with encrypted password, MASTER_KEY environment variable must be set
mvn clean install -T 1C -DskipTests && source openbank_setup_prod.sh && docker-compose -f docker-compose_prod.yaml up --build --force-recreate
# Make sure you are logged in to the DockerHub before releasing a new latest image tag
docker build -f Dockerfile -t openbank-jee .
docker tag openbank-jee:latest jsquadab/openbank-jee:latest
docker push jsquadab/openbank-jee:latest
travis encrypt VARIABLE_A=VALUE_1 MASTER_SECRET=VALUE_2 --add