Skip to content

Commit d1d805b

Browse files
Gaurav Gandhigandhi-21
authored andcommitted
update instructions in update readme with specific changes test
1 parent 371e3ab commit d1d805b

File tree

7 files changed

+78
-83
lines changed

7 files changed

+78
-83
lines changed

ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/docTests/UpdateReadmeWithSpecificChangesFlowTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class UpdateReadmeWithSpecificChangesFlowTest {
120120
val readmePath = Paths.get("tstData", "qdoc", "updateFlow", "README.md")
121121
val readme = File(readmePath.toUri())
122122
assertTrue(readme.exists())
123-
assertTrue(readme.readText().contains("## Programming Languages"))
123+
assertTrue(readme.readText().contains("### Installation"))
124124
}
125125
}
126126

ui-tests-starter/tst-243+/software/aws/toolkits/jetbrains/uitests/docTests/scripts/UpdateReadmeWithSpecificChangesScripts.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ val updateReadmeSpecificChangesScript = """
101101
await findAndClickButton(page, 'Yes', true, 10000);
102102
103103
console.log('Typing specific change instructions in the chat window');
104-
await page.type('.mynah-chat-prompt-input', 'Add new section titled Programming Languages which describes the programming languages and version of programming language used in this project.');
104+
await page.type('.mynah-chat-prompt-input', 'Add a section with Installation instructions for this repository. Title this new section \"### Installation\"');
105105
await page.keyboard.press('Enter');
106106
107107
console.log('Waiting for updated README to be generated');
Lines changed: 72 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,112 @@
1-
# Spring Boot REST API for Simple Data Management
1+
# Spring Boot REST API Service with Health Monitoring and Data Management
22

3-
This Spring Boot application provides a RESTful API for managing data items with in-memory storage. It offers a lightweight and efficient way to store and retrieve data items through HTTP endpoints, making it ideal for prototyping and development environments.
3+
This Spring Boot application provides a RESTful API service with health monitoring capabilities and simple data management functionality. It offers a robust foundation for building microservices with built-in health checks and a flexible data storage interface.
44

5-
The application is built using Spring Boot 3.2.0 and Java 17, featuring a clean architecture with separate controller and model layers. It includes built-in monitoring capabilities through Spring Actuator and comprehensive logging configuration. The REST API supports basic CRUD operations with JSON payloads, making it easy to integrate with various client applications.
5+
The service implements health monitoring endpoints for infrastructure integration and a data management API for storing and retrieving items. Built with Spring Boot 3.2.0 and Java 17, it includes production-ready features through Spring Actuator and comprehensive testing support. The application uses an in-memory data store for demonstration purposes and can be easily extended for production use cases.
66

77
## Repository Structure
88
```
9-
.
10-
├── build.gradle # Gradle build configuration with Spring Boot dependencies
9+
ui-tests-starter/tstData/qdoc/updateFlow/
10+
├── build.gradle # Gradle build configuration with Spring Boot 3.2.0 dependencies
1111
├── config/
12-
│ └── application-local.yml # Local environment configuration (port, app name, logging)
13-
└── src/
14-
── com/example/
15-
├── App.java # Main application entry point with Spring Boot configuration
16-
├── controller/
17-
│ └── SampleController.java # REST endpoints for data management
18-
└── model/
19-
└── DataItem.java # Data model class for storing items
12+
│ └── application-local.yml # Local environment configuration with server and logging settings
13+
└── src/com/zetcode/tancode/
14+
── App.java # Main Spring Boot application entry point
15+
├── controller/
16+
├── HealthController.java # Health and status monitoring endpoints
17+
│ └── SampleController.java # Data management REST endpoints
18+
└── model/
19+
└── DataItem.java # Data model for item storage
2020
```
2121

2222
## Usage Instructions
23-
2423
### Prerequisites
25-
- Java Development Kit (JDK) 17 or higher
26-
- Gradle 8.x (or use the included Gradle wrapper)
27-
28-
### Installation
29-
1. Clone the repository:
30-
```bash
31-
git clone <repository-url>
32-
cd <repository-name>
33-
```
24+
- Java Development Kit (JDK) 17 or later
25+
- Gradle 7.x or later
26+
- Port 8080 available on the host machine
3427

35-
2. Build the application:
36-
```bash
37-
./gradlew build
38-
```
3928

4029
### Quick Start
4130
1. Start the application:
4231
```bash
4332
./gradlew bootRun
4433
```
4534

46-
2. The application will be available at `http://localhost:8080`
35+
2. Verify the service is running:
36+
```bash
37+
curl http://localhost:8080/api/health
38+
```
4739

4840
### More Detailed Examples
49-
50-
#### Creating or Updating a Data Item
41+
1. Check service status:
5142
```bash
52-
curl -X PUT http://localhost:8080/api/data/1 \
53-
-H "Content-Type: application/json" \
54-
-d '{"content": "Sample content"}'
43+
curl http://localhost:8080/api/status
5544
```
56-
57-
Response:
45+
Expected response:
5846
```json
5947
{
60-
"id": "1",
61-
"content": "Sample content"
48+
"timestamp": "2024-01-01T12:00:00",
49+
"service": "sample-rest-app",
50+
"status": "running"
6251
}
6352
```
6453

65-
#### Retrieving a Data Item
54+
2. Store a data item:
6655
```bash
67-
curl http://localhost:8080/api/data/1
56+
curl -X PUT http://localhost:8080/api/data/1 \
57+
-H "Content-Type: application/json" \
58+
-d '{"content": "Sample content"}'
6859
```
6960

70-
Response:
71-
```json
72-
{
73-
"id": "1",
74-
"content": "Sample content"
75-
}
61+
3. Retrieve a data item:
62+
```bash
63+
curl http://localhost:8080/api/data/1
7664
```
7765

7866
### Troubleshooting
79-
80-
#### Common Issues
81-
82-
1. Application Fails to Start
83-
- Problem: Port 8080 is already in use
84-
- Error message: `Web server failed to start. Port 8080 was already in use.`
85-
- Solution: Modify the port in `config/application-local.yml`:
86-
```yaml
87-
server:
88-
port: 8081
89-
```
90-
91-
2. Debugging
92-
- Enable debug logging by modifying `config/application-local.yml`:
93-
```yaml
94-
logging:
95-
level:
96-
com.example: DEBUG
67+
1. Service Not Starting
68+
- Problem: Application fails to start
69+
- Diagnosis:
70+
* Check if port 8080 is already in use
71+
* Verify Java version with `java -version`
72+
- Solution:
73+
* Change port in `config/application-local.yml`
74+
* Update Java installation if needed
75+
76+
2. Debug Mode
77+
- Enable debug logging:
78+
* Set `logging.level.com.example=DEBUG` in application-local.yml
79+
- Log location: Standard output when running locally
80+
- Monitor application logs:
81+
```bash
82+
tail -f logs/application.log
9783
```
98-
- Debug logs will be available in the console output
99-
- Monitor actuator endpoints at `http://localhost:8080/actuator` for application health
10084

10185
## Data Flow
102-
103-
The application implements a simple data flow where REST requests are processed through controllers and stored in an in-memory map structure.
86+
The application processes REST requests through controllers, managing data items in an in-memory store while providing health monitoring capabilities.
10487

10588
```ascii
106-
Client Request → REST Controller → In-Memory Storage
107-
↑ |
108-
└────────────────────────────────────┘
109-
Response with stored data
89+
Client Request
90+
91+
92+
[Spring Boot Server :8080]
93+
94+
├─── /api/health, /api/status
95+
│ │
96+
│ HealthController
97+
98+
└─── /api/data/{id}
99+
100+
SampleController
101+
102+
In-Memory Store
110103
```
111104

112-
Component interactions:
113-
1. Client sends HTTP requests to REST endpoints
114-
2. SampleController handles request validation and routing
115-
3. Data is stored in an in-memory HashMap within the controller
116-
4. Responses are returned as JSON using Spring's ResponseEntity
117-
5. Error handling is managed through HTTP status codes (200 OK, 404 Not Found)
105+
Component Interactions:
106+
1. REST endpoints receive HTTP requests on port 8080
107+
2. HealthController provides system status and health information
108+
3. SampleController manages data items through GET and PUT operations
109+
4. DataItem objects are stored in an in-memory HashMap
110+
5. All responses are returned as JSON with appropriate HTTP status codes
111+
6. Health checks return UP status when service is operational
112+
7. Data operations are synchronized through Spring's request handling

ui-tests-starter/tstData/qdoc/updateFlow/src/com/tancode/App.java renamed to ui-tests-starter/tstData/qdoc/updateFlow/src/com/zetcode/tancode/App.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.tancode;
1+
package com.zetcode.tancode;
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;

ui-tests-starter/tstData/qdoc/updateFlow/src/com/tancode/controller/HealthController.java renamed to ui-tests-starter/tstData/qdoc/updateFlow/src/com/zetcode/tancode/controller/HealthController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
package com.tancode.controller;
4+
package com.zetcode.tancode.controller;
55

66
import org.springframework.http.ResponseEntity;
77
import org.springframework.web.bind.annotation.GetMapping;

ui-tests-starter/tstData/qdoc/updateFlow/src/com/tancode/controller/SampleController.java renamed to ui-tests-starter/tstData/qdoc/updateFlow/src/com/zetcode/tancode/controller/SampleController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.tancode.controller;
1+
package com.zetcode.tancode.controller;
22

33
import com.example.model.DataItem;
44
import org.springframework.http.ResponseEntity;

ui-tests-starter/tstData/qdoc/updateFlow/src/com/tancode/model/DataItem.java renamed to ui-tests-starter/tstData/qdoc/updateFlow/src/com/zetcode/tancode/model/DataItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.tancode.model;
1+
package com.zetcode.tancode.model;
22

33
public class DataItem {
44
private String id;

0 commit comments

Comments
 (0)