Skip to content
This repository was archived by the owner on Apr 16, 2024. It is now read-only.

alex-d-bondarev/learn-dropwizard

Repository files navigation

LearnDW

You can copy and reuse code MIT License

Running LearnDW

How to start the LearnDW application from terminal

  1. Run mvn clean install to build application
  2. Start application via one of:
    1. java -jar target/com-learn-dropwizard-1.0-SNAPSHOT.jar server config.yml
    2. make start_service
  3. To check that application is running navigate to url http://localhost:8080

How to start the LearnDW application from IDE

  1. Add new configuration as "Application"
  2. Set Main class = LearnDWApplication
  3. Set Program Arguments = server config.yml
  4. Save configuration
  5. Run or debug from IDE
  6. Reference: https://blog.indrek.io/articles/running-a-dropwizard-application-in-intellij-eclipse-and-netbeans/

How to run via Dockerfile

  1. Download Docker from https://www.docker.com/get-docker
  2. Install Docker
  3. Run mvn clean install to build application
  4. Build image: docker image build -t learn-drop-wizard .
  5. Run image docker container run -p 8080:8080 -p 8081:8081 -d learn-drop-wizard
  6. To check that application is running navigate to url http://localhost:8080
  7. To stop running image docker stop $(docker ps -a -q)

How to run via docker-compose

  1. Download Docker from https://www.docker.com/get-docker
  2. Install Docker
  3. Run docker-compose up to run LearnDW in Docker
  4. Click ^C to stop LearnDW in Docker

Check test coverage

Slides

  1. Build the project mvn clean install
  2. Start the service make start_service
  3. Send request to several endpoints, like:
    1. Hello, Stranger!
    2. Hello, Handsome!
  4. In separate terminal run make jacoco_all
  5. Check jacoco reports:
    1. Unit tests coverage
    2. Manual tests coverage
    3. Combined coverage

LearnDW features

Health Check

To see your applications' health enter url http://localhost:8081/healthcheck

Endpoints

Hello World
Default request
Parameterized request

Example: http://localhost:8080/hello-world?name=Jim

Sum numbers

Example: http://localhost:8080/sum/2/and/5

Wait milliseconds
Default request
Parameterized request

Example: http://localhost:8080/wait?timeout=500

Other URLs

All other non implemented endpoints will throw custom 404 error:

  • code = 404
  • message = Custom page not found error

About

Learn Dropwizard basic functionality

Topics

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Contributors