Skip to content

Commit 2426f7a

Browse files
committed
Switch to russian authors, update docker scripts, fill README
1 parent d4aa51d commit 2426f7a

File tree

5 files changed

+76
-87
lines changed

5 files changed

+76
-87
lines changed

README.MD

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ Supports CRUD set of operations and R with pagination
1414
- JDK 21
1515

1616
## How to build:
17-
mvn clean install
17+
```shell
18+
mvn clean install
19+
```
1820

19-
#### Build Docker image with application inside:
20-
docker build ./ -t spring-boot-redis-app
21+
### Build Docker image with application inside:
22+
```shell
23+
docker build --no-cache ./ -t spring-boot-redis-app
24+
```
2125

2226
## Start application using starting script:
23-
Use [run-in-docker.bat](./run-in-docker.bat) script
27+
Use [run-in-docker.bat](run-in-docker.bat) script
2428

2529
## Start application by running executable jar (Redis should be started before that manually):
2630
java -jar target/spring-boot-redis-0.0.1-SNAPSHOT.jar \
@@ -50,16 +54,38 @@ http://localhost:9080/swagger-ui/index.html
5054

5155
## Useful CURL commands:
5256
- New article addition:
53-
`curl -i -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "title": "Some tittle", "text": "Some text", "summary": "bla-bla", "author": "Pushkin" }' -X POST http://localhost:9080/api/v1/articles`
57+
```shell
58+
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "title": "Some tittle", "text": "Some text", "summary": "bla-bla", "author": "Pushkin" }' -X POST http://localhost:9080/api/v1/articles
59+
```
5460

5561
- Get existing article:
56-
`curl -i http://localhost:9080/api/v1/articles/1`
62+
```shell
63+
curl -i http://localhost:9080/api/v1/articles/1
64+
```
5765

5866
- Update existing article:
59-
`curl -i -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "title": "Another tittle" }' -X PATCH http://localhost:9080/api/v1/articles/2`
67+
```shell
68+
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "title": "Another tittle" }' -X PATCH http://localhost:9080/api/v1/articles/2
69+
```
70+
71+
- Get all articles:
72+
```shell
73+
curl -i http://localhost:9080/api/v1/articles
74+
```
6075

6176
- Get list of articles with pagination support:
62-
`curl -i 'http://localhost:9080/api/v1/articles?size=2&page=4&sort=author.firstName,DESC'`
77+
```shell
78+
curl -i 'http://localhost:9080/api/v1/articles?size=2&page=4&sort=author.firstName,DESC'
79+
```
6380

6481
- Deletion of article:
65-
`curl -i -X DELETE http://localhost:9080/api/v1/articles/1`
82+
```shell
83+
curl -i -X DELETE http://localhost:9080/api/v1/articles/1
84+
```
85+
86+
## Run functional tests:
87+
88+
cd func-test
89+
./gradlew clean build
90+
91+
Check functional test report [here](func-test/build/spock-reports/index.html)

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3"
2-
31
services:
42
redis:
53
image: redis:7.2-alpine
@@ -13,7 +11,7 @@ services:
1311
- "6379:6379"
1412

1513
spring-boot-redis-app:
16-
build: ./
14+
image: spring-boot-redis-app
1715
restart: always
1816
network_mode: bridge
1917
container_name: spring-boot-redis-app

src/main/java/by/andd3dfx/templateapp/SpringBootRedisApp.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,38 @@ public static void main(String[] args) {
2020
}
2121

2222
@Override
23-
public void afterPropertiesSet() throws Exception {
23+
public void afterPropertiesSet() {
2424
populateDb();
2525
}
2626

2727
private void populateDb() {
2828
var article = Article.builder()
2929
.id("1")
30-
.author("Isaac Sirin")
30+
.author("Исаак Сирин")
3131
.title("Слова Подвижнические")
3232
.summary("Изложение аскетического опыта")
3333
.build();
3434
var article2 = Article.builder()
3535
.id("2")
36-
.author("Epiktet")
36+
.author("Эпиктет")
3737
.title("В чем наше благо")
3838
.summary("Творения философа-стоика 1го века")
3939
.build();
4040
var article3 = Article.builder()
4141
.id("3")
42-
.author("John Sonmez")
42+
.author("Джон Сонмез")
4343
.title("Путь программиста")
4444
.summary("Книга о разных аспектах жизни программиста")
4545
.build();
4646
var article4 = Article.builder()
4747
.id("4")
48-
.author("Ignaty Brianchaninov")
48+
.author("Игнатий Брянчанинов")
4949
.title("Отечник")
5050
.summary("Собрание изречений святых Отцов")
5151
.build();
5252
var article5 = Article.builder()
5353
.id("5")
54-
.author("Egor Gaidar")
54+
.author("Егор Гайдар")
5555
.title("Гибель империи")
5656
.summary("Рассказ о распаде СССР")
5757
.build();

src/main/java/by/andd3dfx/templateapp/persistence/dao/ArticleRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.springframework.stereotype.Repository;
77

88
/**
9-
* Check these docs: https://docs.spring.io/spring-data/redis/docs/3.1.6/reference/html/#query-by-example
9+
* Check these <a href="https://docs.spring.io/spring-data/redis/docs/3.1.6/reference/html/#query-by-example">docs</a>
1010
*/
1111
@Repository
1212
public interface ArticleRepository extends CrudRepository<Article, String>, QueryByExampleExecutor<Article> {

0 commit comments

Comments
 (0)