Sample project for Dropwizard 1.0.0 demonstrating the courtesy client pattern.
The sample service requires Java 1.8 and Gradle 2.9 or higher
For a sample service compatible with Dropwizard 0.9.3 check out the dropwizard-0.9.3 release
The project contains three subprojects hosting the API, the application (service), and a courtesy client. Individual project structure is based on the Dropwizard recommended model. This results in the following package layout:
com.sample
|- api
|- client
|- configuration
|- service
|- domain
|- health
|- resource
|- service
There are three artifacts produced during a standard build:
- sample-service
- sample-client
- sample-api
The dependencies are set up as follows: service -> api <- client. This allows us to provide downstream services with the client as a courtesy, saving effort implementing the service's interface but without depending on it directly. Downstream services need only update their version of the client if a new version of the client has been produced because the API interface implemented by the service has changed.
Build, package and run the service:
./go
To unit test:
gradle test
To integration test:
gradle integrationTest
The integration test provided currently does only the following:
- Run the service
- Call the service HTTP API using the client
Swagger documentation is available for this service by visiting the following file path in your browser:
http://localhost:4560/swagger
See the PersonResource class for information on how to annotate the methods so they are displayed in the documentation.
RAML API documentation is also hosted inside the sample-service, available on the following path:
http://localhost:4560/api
The RAML API documentation is generated from a RAML API specification file, apispec.raml
, in the root of the project directory.