# Get all departments
curl -X GET http://localhost:8080/api/departments
# Get employees in Engineering department
curl -X GET http://localhost:8080/api/departments/dept01/employees
# Get employees in Marketing department
curl -X GET http://localhost:8080/api/departments/dept02/employees
# Create a new employee in Engineering department
curl -X POST http://localhost:8080/api/departments/dept01/employees \
-H "Content-Type: application/json" \
-d '{
"id": "emp999",
"name": "Test Employee",
"email": "test@example.com",
"position": "Test Position",
"salary": 50000
}'
# Delete the test employee
curl -X DELETE http://localhost:8080/api/departments/dept01/employees/emp999# Get all employees
curl -X GET http://localhost:8080/api/employees
# Get specific employee by ID
curl -X GET http://localhost:8080/api/employees/emp001
# Get another employee
curl -X GET http://localhost:8080/api/employees/emp005# Get department-employees mapping (JSON)
curl -X GET http://localhost:8080/api/reports/department-employees-map
# Download PDF report
curl -X GET http://localhost:8080/api/reports/employees-by-department.pdf \
-o employees-report.pdf
# Test transaction rollback
curl -X GET http://localhost:8080/api/reports/test-rollback# Access static cards page
curl -X GET http://localhost:8080/cards.html
# Or open in browser:
# http://localhost:8080/cards.html# Create employee with invalid data (should return 400)
curl -X POST http://localhost:8080/api/departments/dept01/employees \
-H "Content-Type: application/json" \
-d '{
"id": "",
"name": "",
"email": "invalid-email",
"position": "",
"salary": -1000
}'
# Try to get non-existent employee (should return 400)
curl -X GET http://localhost:8080/api/employees/nonexistent
# Try to get employees from non-existent department (should return 400)
curl -X GET http://localhost:8080/api/departments/nonexistent/employees# Access H2 Console (open in browser)
# http://localhost:8080/h2-console
# JDBC URL: jdbc:h2:mem:hrdb
# Username: sa
# Password: password
# Sample queries to run in H2 console:
# SELECT * FROM DEPARTMENTS;
# SELECT * FROM EMPLOYEES;
# SELECT d.name, COUNT(e.id) as employee_count
# FROM DEPARTMENTS d LEFT JOIN EMPLOYEES e ON d.id = e.department_id
# GROUP BY d.name;If using PowerShell, use these commands instead:
# Get all departments
Invoke-RestMethod -Uri "http://localhost:8080/api/departments" -Method GET
# Get employees in department
Invoke-RestMethod -Uri "http://localhost:8080/api/departments/dept01/employees" -Method GET
# Create new employee
$body = @{
id = "emp999"
name = "Test Employee"
email = "test@example.com"
position = "Test Position"
salary = 50000
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:8080/api/departments/dept01/employees" -Method POST -Body $body -ContentType "application/json"
# Delete employee
Invoke-RestMethod -Uri "http://localhost:8080/api/departments/dept01/employees/emp999" -Method DELETE[
{
"id": "dept01",
"name": "Engineering",
"location": "San Francisco",
"employeeCount": 4
},
{
"id": "dept02",
"name": "Marketing",
"location": "New York",
"employeeCount": 3
}
]{
"id": "emp001",
"name": "John Doe",
"email": "john.doe@company.com",
"position": "Senior Software Engineer",
"salary": 95000,
"departmentId": "dept01",
"departmentName": "Engineering"
}{
"message": "Employee not found with id: nonexistent",
"code": "RUNTIME_ERROR",
"timestamp": "2024-01-15T10:30:00",
"path": "/api/employees/nonexistent"
}- All GET endpoints return 200 with expected data
- POST endpoint creates employee and returns 201
- DELETE endpoint removes employee and returns 204
- Invalid requests return 400 with error details
- Non-existent resources return 400 with error message
- PDF download works and file has content
- Transaction rollback test returns success message
- Static cards page loads correctly
- H2 console accessible and shows populated tables