Skip to content

JAVA WEB-API [Embedded Jetty | Jersey | JUnit | Swagger | SLF4J | Jococo | Travis CL | Coverall ]

License

Notifications You must be signed in to change notification settings

prbpedro/account-manager-webapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

account-manager-webapi

Travis Coverage Status License: MIT

Technologies

Used technologies:

  • JAVA JDK 1.8
  • Embedded Jetty (Embedded server)
  • Jersey (REST framework)
  • Google Guice (Dependency injection framework)
  • Database Access Framework (JOOQ)
  • H2 Database
  • SLF4J (Log framework)
  • Swagger (To generate JSON documentation)
  • Maven (Compilation and automation tool)
  • JUnit (Test framework)
  • jacoco-maven-plugin (Test code coverege maven plugin)
  • Github repository
  • Travis CL (Continuous integration service )
  • Coverall (Continuous code coverage)

Project desciption

This is a JAVA Eclipse project built to demonstrate the use of the technologies described above by providing a REST service capable of making a transfer transaction in a banking system.

It references the account-manager-domain project, its documentation contains information about data entered for testing at server startup, possible application configurations, and rules for performing transfer transactions.

When the application starts it will create an H2 database in memory with data for testing and expose two REST services through the base URL http://localhost:5000/account-manager/.

The following two REST services are exposed by the WEB-API:

  • Perform transfer transaction - URL http://localhost:5000/account-manager/transfer/do

    Sample JAVA code to call the REST service:

     HttpResponse<String> response = Unirest.post("http://localhost:5000/account-manager/transfer/do")
     			.header("Content-Type", "application/x-www-form-urlencoded").header("cache-control", "no-cache")
     			.body("sender-account-id=ACCOUNT_1&beneficiary-account-id=ACCOUNT_2&beneficiary-bank-code=REVOLUT!!!!!&currency-code=USD&ammount=1")
     			.asString();
  • Get database data (For the purpose of returning data kept in the database for testing) - URL http://localhost:5000/account-manager/data

    Sample JAVA code to call the REST service:

     HttpResponse<String> response = Unirest.get("http://localhost:5000/account-manager/data")
     			  .header("cache-control", "no-cache")
     			  .asString();

The JSON documentation of the REST services is generated by Swagger framework and exposed through the URL http://localhost:5000/account-manager/openapi.json.

The unit testing code coverage report is available in the $PROJECT_FOLDER/target/site/jacoco/index.html file generated through the Maven plugin jacoco-maven-plugin.

To generate a JAR containing the embedded server together with the WEB-API just run Maven's goal package. The file will be generated with the following name and location $PROJECT_FOLDER/target/account-manager-webapi-1.0.0.jar.

To start the server just run the below command in the generated JAR folder:

java -jar account-manager-webapi-1.0.0.jar

The maven plugins maven-compiler-plugin, maven-surefire-plugin, jacoco-maven-plugin, and maven-shade-plugin are configured in the pom.xml file.

About

JAVA WEB-API [Embedded Jetty | Jersey | JUnit | Swagger | SLF4J | Jococo | Travis CL | Coverall ]

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages