This project focuses on ensuring the connectivity of the database through a health check mechanism and provides functionality for managing user details, including adding users and updating their information.
The Health Check and User Management Project is a Spring Boot application designed to perform database connectivity checks and manage user details. It includes two main controllers: HealthCheckController
for verifying database connectivity and UserController
for user-related operations.
Before building and deploying the application locally, ensure you have the following prerequisites:
- Java Development Kit (JDK) 17
- Maven
The HealthCheckController
is responsible for handling health check requests to verify the status of the database connection. It provides endpoints for checking the database connection, handling unsupported HTTP methods, and managing unknown URLs.
This class includes functionalities for checking the database connection and handling different HTTP methods.
-
/healthz
: Verifies the database connection and handles specific conditions. -
/healthz
(POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE): Handles method-not-allowed for specific HTTP methods. -
/**
: Manages unknown URLs with a standard response.
The UserController
manages user-related operations, such as adding users, retrieving user details, and updating user information. It also handles unsupported HTTP methods for both general user operations and self-related operations.
POST /v1/user
: Adds a new user to the system.GET /v1/user/self
: Retrieves details of the authenticated user.PUT /v1/user/self
: Updates information for the authenticated user./v1/user
,/v1/user/self
(GET, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE): Handles method-not-allowed for user-related endpoints.
The project uses a configuration file (application.properties
) to manage database connectivity settings, Hibernate properties, and connection pool properties.
To run the project locally, follow these steps:
- Clone the repository:
git clone git@github.com:cloud-computing-csye6225-neu/webapp.git
- Configure the
application.properties
file with your database settings. - Build the project using Maven: mvn clean install -DskipTests=true
- Run the application.
- Fork the GitHub repository in your namespace.
- Clone your fork:
git clone git@github.com:cloud-computing-csye6225-neu/webapp.git
- Configure the
application.properties
file with your database settings. - Build the project using Maven:
mvn clean install -DskipTests=true
- Run the application locally.
The project includes a continuous integration workflow using GitHub Actions. The workflow is triggered on the opening of a pull request to the main branch.
The workflow focuses on integration tests for the /v1/user endpoint. The workflow performs the following steps:
- Checkout source code.
- Set up JDK 17.
- start mysql
- Build Maven:
mvn -B package --file pom.xml