This project was developed for education purposes. Feel free to use :)
Click here for detailed Medium post.
- Open the project directory with your favorite editor. Wait for synchronization.
- Intelij IDEA -> Preferences -> Build,Execution,Deployment -> Compiler -> Build project automatically
- Intelij IDEA -> Preferences -> Advanced Settings -> Allow auto-make to start even if developed application is currently running
- Intelij IDEA -> Run/Debug Configurations -> Modify options -> Add before launch task -> 1. Build Project -> 2. Build
- Check src/main/java/resources/application.properties for these lines;
- spring.devtools.restart.enabled=true
- spring.devtools.restart.additional-paths=src/main/java
- Install MySQL via Docker!
docker run --detach --env MYSQL_ROOT_PASSWORD=testpass --env MYSQL_USER=testuser --env MYSQL_PASSWORD=testpass --env MYSQL_DATABASE=library --name mysql --publish 3306:3306 mysql:8-oracle
- Then click Build & Run!
NOTE: Every mock data's password is 'testpass'.
Click here for REST API docs and design.
This is the structure of the files in the app tier:
│
├── src
│ ├── main
│ │ ├── java
│ │ │ ├── com.engineer.library
│ │ │ │ ├── configuration # Contains the Spring configuration files.
│ │ │ │ ├── constant # Contains the constant values.
│ │ │ │ ├── controller # Contains the Spring MVC controllers that handle HTTP requests.
│ │ │ │ ├── exception # Contains the custom exception files.
│ │ │ │ ├── model # Houses the data models or entities for your application.
│ │ │ │ ├── repository # Handles data access and interactions with the database.
│ │ │ │ ├── service # Contains the business logic, DTO and other things related to any service.
│ │ │ │ ├── LibraryApplication.java # SpringBootApplication configuration file.
│ │ │ ├── resources
│ │ │ │ ├── static # Project-wide static files.
│ │ │ │ ├── templates # Project-wide templates.
│ │ │ │ ├── application.properties # Project-specific configurations.
│ ├── test
│ │ ├── java
│ │ │ ├── com.engineer.library # Contains test-related files and classes.
├── mvnw
├── mvnw.cmd
├── .gitignore
├── pom.xml
├── README.md
- Go to Apache JMeter page then download the binary .zip file.
- Extract the zip file then inside the folder you'll see the bin folder.
- Open the bin folder in Terminal and run this command to open GUI.
sh jmeter.sh
- Then in the JMeter GUI open Options -> Themes and choose System.
- Start the application.
- Right-click TestPlan in the left on the GUI -> Go to Threads (Users) -> setUp Thread Group.
- Then give it a name and enter the number of users you want to test the endpoint.
- Right-click the Thread Group -> Add -> Sampler -> HTTP Request
- Give it a name and enter the host name (which is localhost for local) and port name.
- Choose method and enter path.
- Right-click the HTTP Request -> Add -> Config Element -> HTTP Header Manager (You can additionally add HTTP Authorization Manager to test authentication needed paths or methods.)
- Click Add and enter Name : Api-Version and Value : v1.0
- Right-click Thread Group -> Add -> Listener -> View Result Tree
- Click Save on top of the GUI.
- Click HTTP Request you want to test. Click Run icon on top of the GUI.
- Click your Result Tree and you will see the results on the left. Click and see the load times and latencies (These are the most important ones.)
As you can see testing results are perfect because of the REST API Caching mechanism.
Also download the sample file for JMX.
- Download the Jenkins via Docker.
docker pull jenkins/jenkins
- Run the image. Don't forget to check the ports. It may be same with application port.
docker run -p 8080:8080 -p 50000:50000 --restart=on-failure jenkins/jenkins
- Write the admin password and install the plugins.
- Create the first admin user.
- Apply your Jenkins URL.
- Go to Manage Extensions and search for AWS Elastic Beanstalk Publisher
- Then go to AWS Elastic Beanstalk and create the application.
- Crate Access Key from IAM console in AWS.
- Go to Manage Jenkins -> System -> Add new credentials to AWS Elastic Beanstalk Plugin.
- Create a job in Jenkins -> Source Code Management -> Git. Fill the informations.
- Go to Build Steps -> Invoke top-level Maven targets.
-
clean compile test package
-
- Add Post-Build Action -> Deploy into AWS Elastic Beanstalk -> Fill the inputs.
- Add Additional behaviors for S3 Bucket informations. Save it.
- Then click Build Now. You can schedule it to check Git changes from Build Triggers in Configuration page at Jenkins.
- User Mockito REST API tests.
- Book unit tests.
- GuestBook unit and Mockito tests.
- Spring Boot DevTools
- Spring Web
- Spring Security
- Validation
- Spring Data JPA
- Spring Boot Actuator
- MySQL Connector J
- JMeter
- Jenkins
- Docker
- Junit
- Mockito
Cloning this repo makes you better developer. Be careful!
- My website: – Contact with me!
- My Youtube channel – Sharing my experience in whole my career.