Skip to content

VigneshGuhan/spring-microservices-testing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Overview

This application is developed to demonstrate how to write the basic unit tests and integration tests for the microservices.

This application contains 2 micro services - department service and employee service which is developed using java,spring framework. Employee service will have the employee details and the department service will have the department details of each employee. Each service has couple of GET and POST Api endpoints

Setup Instructions for the workshop:

Prerequisites

  • Java
  • Maven
  • IntelliJ IDEA (Or any IDE of your choice)
  • MongoDB and Mongo compass (optional if your IDE supports database connectivity)
  • Docker (testcontainers image)
  • Postman
  • JMeter

Installation instructions for Mac

  • Install java and maven

  • Install IntelliJ IDEA edition

  • Install Lombok as a plugin in IntelliJ. (Preferences->Plugins)

  • Enable annotation processing in IntelliJ (Preferences->Build,Execution,Deployment ->Annotation Processors and then enable annotation processing)

  • Install Docker using instructions from here

  • Install Postman and import the collection

  • Do a git clone using https://github.com/QA-Learning/spring-microservices-testing

  • Then Navigate inside the project and perform mvn clean compile

Installation of mongoDB in Mac:

Follow instructions from https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

Installation of Mongodb Compass:

  • In order to view the mongo DB and visually explore your data, you can install MongoDB Compass https://downloads.mongodb.com/compass/mongodb-compass-1.23.0-darwin-x64.dmg

Installation of Jmeter:

  • On Mac you can install jmeter by brew install jmeter
  • On windows please follow the instructions from here

To start the application:

  • Import the cloned repo in IntelliJ as Maven project

  • Allow some time for the IDE to resolve the dependencies.

  • Run /employee-service/src/main/java/com/sample/EmployeeApplication.java and src/main/java/com/sample/DepartmentApplication.java or run mvn spring-boot:run for both the services. (Employee runs in 8080 and department runs in 8081)

  • To test your database connectivity, you can use the connection string as “mongodb://localhost:27017” from your DB client

  • You should see this on the console to be sure that application is properly connected to the mongoDb. INFO 5692 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:7}] to localhost:27017

  • You should see this on the console to be sure that the employee service is running successfully. INFO 5692 --- [main] com.sample.EmployeeApplication : Started EmployeeApplication in 3.403 seconds (JVM running for 9.731

Installation instructions for Windows:

  • Install Java and follow these steps to set path

  • Install Maven. Download the binary zip archive. Follow instructions from here

  • Install IntelliJ Idea from here . You can also use any IDE of your choice

  • Install Lombok as a plugin in IntelliJ. (File->Settings->Plugins)

  • Enable annotation processing in IntelliJ (File->Setting->Build,Execution,Deployment ->Annotation Processors and then enable annotation processing)

  • Install [MongoDB](https://www.mongodb.com/try/download/community?tck=docs_server and follow instructions from https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/)

  • Download the complete installation in case you need the MongoDB Compass too. Else you can download a custom installation. You can select Run the service as Network Service user installation.

  • Install docker desktop for windows

  • In case you don't have a linux kernel installed already, install the linux kernel package from here

  • Install Postman and import the collection

  • Do a git clone using https://github.com/QA-Learning/spring-microservices-testing

  • Then Navigate inside the project and perform mvn clean compile

To start the application:

  • Import the cloned repo in IntelliJ as Maven project

  • Allow some time for the IDE to bring up the dependencies.

  • Run /employee-service/src/main/java/com/sample/EmployeeApplication.java and src/main/java/com/sample/DepartmentApplication.java or run mvn spring-boot:run for both the services. (Employee runs in 8080 and department runs in 8081)

  • To test your database connectivity, you can use the connection string as “mongodb://localhost:27017” from your DB client

  • You should see this on the console to be sure that spring is properly connected to the mongoDb. INFO 5692 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:7}] to localhost:27017

  • You should see this on the console to be sure that the employee service is running successfully. INFO 5692 --- [main] com.sample.EmployeeApplication : Started EmployeeApplication in 3.403 seconds (JVM running for 9.731

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%