@@ -5,29 +5,19 @@ plugins {
5
5
6
6
description = " Spring Boot cache smoke test"
7
7
8
- def caches = [
9
- " caffeine" : [
10
- " com.github.ben-manes.caffeine:caffeine"
11
- ],
12
- " couchbase" : [
13
- project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-data-couchbase" )
14
- ],
15
- " ehcache" : [
16
- " javax.cache:cache-api" ,
17
- dependencies. create(" org.ehcache:ehcache" ) {
18
- artifact {
19
- classifier = ' jakarta'
20
- }
21
- }
22
- ],
23
- " hazelcast" : [
24
- " com.hazelcast:hazelcast" ,
25
- " com.hazelcast:hazelcast-spring"
26
- ],
27
- " redis" : [
28
- project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-data-redis" )
29
- ]
30
- ]
8
+ sourceSets {
9
+ redisTest {
10
+ compileClasspath + = sourceSets. main. output
11
+ runtimeClasspath + = sourceSets. main. output
12
+ }
13
+ }
14
+
15
+ configurations {
16
+ caffeine
17
+ couchbase
18
+ ehcache
19
+ hazelcast
20
+ }
31
21
32
22
dependencies {
33
23
implementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-actuator" ))
@@ -36,7 +26,55 @@ dependencies {
36
26
37
27
testImplementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-test" ))
38
28
39
- if (project. hasProperty(" cache" )) {
40
- caches[project. getProperty(" cache" )]. each { runtimeOnly it }
41
- }
42
- }
29
+ caffeine(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
30
+ caffeine(" com.github.ben-manes.caffeine:caffeine" )
31
+
32
+ couchbase(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
33
+ couchbase(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-data-couchbase" ))
34
+
35
+ ehcache(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
36
+ ehcache(" javax.cache:cache-api" )
37
+ ehcache(" org.ehcache:ehcache::jakarta" )
38
+
39
+ hazelcast(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
40
+ hazelcast(" com.hazelcast:hazelcast" )
41
+ hazelcast(" com.hazelcast:hazelcast-spring" )
42
+
43
+ redisTestImplementation(enforcedPlatform(project(" :spring-boot-project:spring-boot-parent" )))
44
+ redisTestImplementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-data-redis" ))
45
+ redisTestImplementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-test" ))
46
+ redisTestImplementation(project(" :spring-boot-project:spring-boot-tools:spring-boot-test-support" ))
47
+ redisTestImplementation(" org.testcontainers:testcontainers" )
48
+ redisTestImplementation(" org.testcontainers:junit-jupiter" )
49
+ }
50
+
51
+ def testCaffeine = tasks. register(" testCaffeine" , Test ) {
52
+ description = " Runs the tests against Caffeine"
53
+ classpath = sourceSets. test. runtimeClasspath + configurations. caffeine
54
+ }
55
+
56
+ def testCouchbase = tasks. register(" testCouchbase" , Test ) {
57
+ description = " Runs the tests against Couchbase"
58
+ classpath = sourceSets. test. runtimeClasspath + configurations. couchbase
59
+ }
60
+
61
+ def testEhcache = tasks. register(" testEhcache" , Test ) {
62
+ description = " Runs the tests against Ehcache"
63
+ classpath = sourceSets. test. runtimeClasspath + configurations. ehcache
64
+ systemProperties = [" spring.cache.jcache.config" : " classpath:ehcache3.xml" ]
65
+ }
66
+
67
+ def testHazelcast = tasks. register(" testHazelcast" , Test ) {
68
+ description = " Runs the tests against Hazelcast"
69
+ classpath = sourceSets. test. runtimeClasspath + configurations. hazelcast
70
+ }
71
+
72
+ def testRedis = tasks. register(" testRedis" , Test ) {
73
+ description = " Runs the tests against Redis"
74
+ classpath = sourceSets. redisTest. runtimeClasspath
75
+ testClassesDirs = sourceSets. redisTest. output. classesDirs
76
+ }
77
+
78
+ tasks. named(" check" ). configure {
79
+ dependsOn testCaffeine, testCouchbase, testEhcache, testHazelcast, testRedis
80
+ }
0 commit comments