-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.txt
More file actions
59 lines (41 loc) · 1.91 KB
/
commands.txt
File metadata and controls
59 lines (41 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
1. MAVEN BUILD & EXECUTION
# Clean previous builds and compile the source code
mvn clean compile
# Package the application into a "Fat JAR" (includes all dependencies)
mvn clean package
# Run the application locally without Docker
# Note: Requires exec-maven-plugin configuration in pom.xml
mvn exec:java -Dexec.mainClass="logger.Main"
# Alternative: Run the compiled JAR file directly
java -jar target/Logger-app-1.0.0-SNAPSHOT-jar-with-dependencies.jar
2. TESTING & CODE QUALITY
# Run all tests (JUnit unit tests & Cucumber BDD features)
mvn test
# Clean project and run tests (Recommended for fresh testing)
mvn clean test
# Run tests while skipping JaCoCo coverage reports
mvn test "-Djacoco.skip=true"
# Automatically format the code according to Google Java Format
mvn fmt:format
# Verify if the code follows formatting rules (Fails if not formatted)
mvn fmt:check
3. DOCKER MANAGEMENT
# Build the image and start the container
docker-compose -f docker/docker-compose.yml up --build
# Start the container in the background (detached mode)
docker-compose -f docker/docker-compose.yml up -d
# Stop the container and remove networks/volumes
docker-compose -f docker/docker-compose.yml down
# Follow the live logs of the running container
docker logs -f java_logger_app
4. API TESTING (REST ENDPOINTS)
# POST: Send a new log message (PowerShell)
Invoke-RestMethod -Uri http://localhost:8080/log -Method Post -ContentType "application/json" -Body '{"message": "Test message", "level": "INFO"}'
# DELETE: Clear all logs from the database (PowerShell)
# Replace <YOUR_KEY> with the value from your .env file
$headers = @{"X-API-Key" = "<YOUR_ADMIN_KEY>"}
Invoke-RestMethod -Uri http://localhost:8080/deletelogs -Method Delete -Headers $headers
# POST: Send a new log message (Bash/Linux/macOS)
curl -X POST http://localhost:8080/log \
-H "Content-Type: application/json" \
-d '{"message": "Test message", "level": "INFO"}'