File tree Expand file tree Collapse file tree 6 files changed +48
-16
lines changed
main/java/com/redislabs/demos/redisbank
test/java/com/redislabs/demos/redisbank Expand file tree Collapse file tree 6 files changed +48
-16
lines changed Original file line number Diff line number Diff line change 1
- 16
1
+ 17
Original file line number Diff line number Diff line change @@ -19,17 +19,18 @@ Features in this demo:
19
19
20
20
## Prerequisites
21
21
22
- 1 . JDK 11 or higher (https://openjdk.java.net/install/index.html )
22
+ 1 . JDK 17 or higher (https://openjdk.java.net/install/index.html )
23
23
2 . Docker Desktop (https://www.docker.com/products/docker-desktop )
24
24
3 . Azure CLI (https://docs.microsoft.com/en-us/cli/azure/install-azure-cli )
25
25
4 . Azure Spring Cloud extension for the Azure CLI (https://docs.microsoft.com/en-us/cli/azure/spring-cloud?view=azure-cli-latest )
26
26
27
27
## Running locally
28
28
29
29
1 . Checkout the project
30
- 2 . ` docker run -p 6379:6379 redislabs/redismod:latest `
31
- 3 . ` ./mvnw clean package spring-boot:run `
32
- 4 . Navigate to http://localhost:8080 and login with user lars and password larsje
30
+ 2 . ` ./mvnw clean package `
31
+ 3 . ` docker run -p 6379:6379 redislabs/redismod:latest `
32
+ 4 . ` ./mvnw spring-boot:run `
33
+ 5 . Navigate to http://localhost:8080 and login with user lars and password larsje
33
34
34
35
## Running on Azure Spring Cloud
35
36
Original file line number Diff line number Diff line change 13
13
<name >redisbank</name >
14
14
<description >Demo project for Spring Boot</description >
15
15
<properties >
16
- <java .version>11 </java .version>
16
+ <java .version>17 </java .version>
17
17
</properties >
18
18
<dependencies >
19
19
<dependency >
63
63
<dependency >
64
64
<groupId >org.projectlombok</groupId >
65
65
<artifactId >lombok</artifactId >
66
- <version >1.18.20 </version >
66
+ <version >1.18.22 </version >
67
67
<optional >true</optional >
68
68
</dependency >
69
69
<dependency >
76
76
<artifactId >reactor-test</artifactId >
77
77
<scope >test</scope >
78
78
</dependency >
79
+ <dependency >
80
+ <groupId >org.testcontainers</groupId >
81
+ <artifactId >testcontainers</artifactId >
82
+ <scope >test</scope >
83
+ </dependency >
84
+ <dependency >
85
+ <groupId >org.testcontainers</groupId >
86
+ <artifactId >junit-jupiter</artifactId >
87
+ <scope >test</scope >
88
+ </dependency >
79
89
</dependencies >
80
90
91
+ <dependencyManagement >
92
+ <dependencies >
93
+ <dependency >
94
+ <groupId >org.testcontainers</groupId >
95
+ <artifactId >testcontainers-bom</artifactId >
96
+ <version >1.16.2</version >
97
+ <type >pom</type >
98
+ <scope >import</scope >
99
+ </dependency >
100
+ </dependencies >
101
+ </dependencyManagement >
102
+
81
103
<build >
82
104
<plugins >
83
105
<plugin >
Original file line number Diff line number Diff line change 1
1
package com .redislabs .demos .redisbank ;
2
2
3
- import java .io .File ;
4
3
import java .io .InputStream ;
5
4
import java .text .SimpleDateFormat ;
6
5
import java .util .Collections ;
Original file line number Diff line number Diff line change 14
14
import com .redislabs .lettusearch .SearchResults ;
15
15
import com .redislabs .lettusearch .StatefulRediSearchConnection ;
16
16
17
- import org .slf4j .Logger ;
18
- import org .slf4j .LoggerFactory ;
19
17
import org .springframework .data .redis .core .StringRedisTemplate ;
20
18
import org .springframework .data .redis .core .ZSetOperations .TypedTuple ;
21
19
import org .springframework .web .bind .annotation .CrossOrigin ;
29
27
@ CrossOrigin
30
28
public class TransactionOverviewController {
31
29
32
- private static final Logger LOGGER = LoggerFactory .getLogger (TransactionOverviewController .class );
33
-
34
30
private static final String ACCOUNT_INDEX = "transaction_account_idx" ;
35
31
private static final String SEARCH_INDEX = "transaction_description_idx" ;
36
32
private static final String BALANCE_TS = "balance_ts" ;
Original file line number Diff line number Diff line change 1
1
package com .redislabs .demos .redisbank ;
2
2
3
- import org .junit .jupiter .api .Test ;
4
3
import org .springframework .boot .test .context .SpringBootTest ;
4
+ import org .springframework .test .context .DynamicPropertyRegistry ;
5
+ import org .springframework .test .context .DynamicPropertySource ;
6
+ import org .testcontainers .containers .GenericContainer ;
7
+ import org .testcontainers .junit .jupiter .Container ;
8
+ import org .testcontainers .junit .jupiter .Testcontainers ;
9
+ import org .testcontainers .utility .DockerImageName ;
5
10
6
11
@ SpringBootTest
12
+ @ Testcontainers
7
13
class RedisbankApplicationTests {
8
14
9
- @ Test
10
- void contextLoads () {
11
- }
15
+ static final String REDIS_IMAGE = "redislabs/redismod:latest" ;
16
+ static final int REDIS_PORT = 6379 ;
17
+
18
+ @ Container
19
+ static GenericContainer <?> redisContainer = new GenericContainer <>(DockerImageName .parse (REDIS_IMAGE ))
20
+ .withExposedPorts (REDIS_PORT );
12
21
22
+ @ DynamicPropertySource
23
+ static void redisProperties (DynamicPropertyRegistry registry ) {
24
+ registry .add ("spring.redis.host" , redisContainer ::getContainerIpAddress );
25
+ registry .add ("spring.redis.port" , redisContainer ::getFirstMappedPort );
26
+ }
13
27
}
You can’t perform that action at this time.
0 commit comments