Before running this project, make sure you have installed:
- Java 21 or higher
- Maven 3.9+ (or use the included Maven Wrapper
mvnw) - Docker Desktop (for PostgreSQL and RabbitMQ)
- Git
- An IDE such as IntelliJ IDEA (recommended)
git clone https://github.com/CSCI44092GroupProject/order-service.git
cd order-serviceCopy the template and fill in your local values:
cp .env.example .envContents of .env:
# Local PostgreSQL (Docker)
DB_HOST=localhost
DB_PORT=5432
DB_NAME=order_db
DB_USERNAME=order_user
DB_PASSWORD=change_me
# RabbitMQ (Docker)
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=rabbitmq_user
RABBITMQ_PASSWORD=rabbitmq_passwordStart PostgreSQL and RabbitMQ:
docker compose up -dVerify both containers are running:
docker psYou should see order-postgres and order-rabbitmq in the output.
- Open the project in IntelliJ IDEA
- Right-click
OrderServiceApplication.java - Click Run 'OrderServiceApplication'
./mvnw spring-boot:runThe application will start on http://localhost:8080.
Once the application is running, access the interactive API documentation:
- Swagger UI: http://localhost:8080/swagger-ui.html
- OpenAPI JSON: http://localhost:8080/v3/api-docs
POST /api/orders
{
"customerId": "CUST-1001",
"items": [
{
"productId": 3,
"quantity": 2
}
]
}{
"orderId": "8a4f6e1d-...",
"customerId": "CUST-1001",
"items": [
{
"productId": 3,
"productName": "Wireless Mouse",
"quantity": 2,
"unitPrice": 120.00,
"lineTotal": 240.00
}
],
"totalPrice": 240.00,
"orderDate": "2026-06-29T14:30:00",
"status": "CREATED"
}| Method | Endpoint | Description |
|---|---|---|
| POST | /api/orders |
Create a new order |
| GET | /api/products |
List all products (proxied from Product Service) |
| GET | /api/products/{id} |
Get a product by ID (proxied from Product Service) |
./mvnw testOr in IntelliJ:
- Right-click
src/test/javaβ Run 'All Tests'
Tests are written for:
- β
Controllers β
OrderController,ProductController - β
Service Layer β
OrderServiceImpl,OrderEventPublisher - β
Mappers β
OrderMapper - β
REST Client β
ProductCatalogRestClient - β
Exception Handler β
GlobalExceptionHandler
./mvnw test jacoco:reportReport is generated at target/site/jacoco/index.html.
We use GitHub Actions to automate build and testing on every Pull Request.
- Checkout source code
- Set up JDK 21
- Cache Maven dependencies
- Run unit tests (
mvn test) - Build the project (
mvn clean package) - Run SonarCloud static code analysis
- Upload test reports as artifacts
Configuration file: .github/workflows/ci.yml
Static code analysis is performed via SonarCloud on every push and pull request. View the project dashboard on SonarCloud for:
- Code coverage
- Bugs and vulnerabilities
- Code smells
- Duplications
docker exec -it order-postgres psql -U order_user -d order_db -c "SELECT * FROM orders;"- URL: http://localhost:15672
- Username:
guest - Password:
guest
You can view exchanges, queues, bindings, and inspect messages here.
docker compose downTo also delete the database volume:
docker compose down -vThis microservice is part of a larger system. See the other services:
- Product Service: https://github.com/CSCI44092GroupProject/product-service β manages products, hosted at https://productservice001-cma3gfg4akc3dtgj.centralus-01.azurewebsites.net/swagger-ui/index.html
- Notification Service: https://github.com/CSCI44092GroupProject/notification-service β consumes RabbitMQ events
- Create a feature branch from
main:
git checkout -b feature/your-feature-name- Make your changes and commit with a meaningful message:
git commit -m "feat: describe your change"- Push the branch and open a Pull Request:
git push origin feature/your-feature-name- Wait for the CI pipeline to pass, get code review, then merge.
feat:β new featurefix:β bug fixtest:β adding or updating testsdocs:β documentation changesrefactor:β code refactoring without behavior changeci:β CI/CD configuration changes
| Name | Student ID | Role |
|---|---|---|
| Amindu Bhashana | CS/2020/007 | Order Service Developer |
| Lakith Randula | CS/2020/017 | Order Service Developer |
This project was developed for academic purposes as part of the CSCI 44092 β Software Engineering course.