@@ -5,32 +5,21 @@ 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
- " org.ehcache:ehcache"
18
- ],
19
- " ehcache2" : [
20
- " net.sf.ehcache:ehcache"
21
- ],
22
- " hazelcast" : [
23
- " com.hazelcast:hazelcast" ,
24
- " com.hazelcast:hazelcast-spring"
25
- ],
26
- " infinispan" : [
27
- " org.infinispan:infinispan-jcache" ,
28
- " org.infinispan:infinispan-spring5-embedded"
29
- ],
30
- " redis" : [
31
- project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-data-redis" )
32
- ]
33
- ]
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
+ ehcache2
20
+ hazelcast
21
+ infinispan
22
+ }
34
23
35
24
dependencies {
36
25
implementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-actuator" ))
@@ -39,7 +28,73 @@ dependencies {
39
28
40
29
testImplementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-test" ))
41
30
42
- if (project. hasProperty(" cache" )) {
43
- caches[project. getProperty(" cache" )]. each { runtimeOnly it }
44
- }
45
- }
31
+ caffeine(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
32
+ caffeine(" com.github.ben-manes.caffeine:caffeine" )
33
+
34
+ couchbase(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
35
+ couchbase(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-data-couchbase" ))
36
+
37
+ ehcache(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
38
+ ehcache(" javax.cache:cache-api" )
39
+ ehcache(" org.ehcache:ehcache" )
40
+ ehcache2(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
41
+ ehcache2(" net.sf.ehcache:ehcache" )
42
+
43
+ hazelcast(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
44
+ hazelcast(" com.hazelcast:hazelcast" )
45
+ hazelcast(" com.hazelcast:hazelcast-spring" )
46
+
47
+ infinispan(enforcedPlatform(project(" :spring-boot-project:spring-boot-dependencies" )))
48
+ infinispan(" javax.cache:cache-api" )
49
+ infinispan(" org.infinispan:infinispan-jcache" )
50
+ infinispan(" org.infinispan:infinispan-spring5-embedded" )
51
+
52
+ redisTestImplementation(enforcedPlatform(project(" :spring-boot-project:spring-boot-parent" )))
53
+ redisTestImplementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-data-redis" ))
54
+ redisTestImplementation(project(" :spring-boot-project:spring-boot-starters:spring-boot-starter-test" ))
55
+ redisTestImplementation(project(" :spring-boot-project:spring-boot-tools:spring-boot-test-support" ))
56
+ redisTestImplementation(" org.testcontainers:testcontainers" )
57
+ redisTestImplementation(" org.testcontainers:junit-jupiter" )
58
+ }
59
+
60
+ def testCaffeine = tasks. register(" testCaffeine" , Test ) {
61
+ description = " Runs the tests against Caffeine"
62
+ classpath = sourceSets. test. runtimeClasspath + configurations. caffeine
63
+ }
64
+
65
+ def testCouchbase = tasks. register(" testCouchbase" , Test ) {
66
+ description = " Runs the tests against Couchbase"
67
+ classpath = sourceSets. test. runtimeClasspath + configurations. couchbase
68
+ }
69
+
70
+ def testEhcache = tasks. register(" testEhcache" , Test ) {
71
+ description = " Runs the tests against Ehcache"
72
+ classpath = sourceSets. test. runtimeClasspath + configurations. ehcache
73
+ systemProperties = [" spring.cache.jcache.config" : " classpath:ehcache3.xml" ]
74
+ }
75
+
76
+ def testEhcache2 = tasks. register(" testEhcache2" , Test ) {
77
+ description = " Runs the tests against Ehcache2"
78
+ classpath = sourceSets. test. runtimeClasspath + configurations. ehcache2
79
+ }
80
+
81
+ def testHazelcast = tasks. register(" testHazelcast" , Test ) {
82
+ description = " Runs the tests against Hazelcast"
83
+ classpath = sourceSets. test. runtimeClasspath + configurations. hazelcast
84
+ }
85
+
86
+ def testInfinispan = tasks. register(" testInfinispan" , Test ) {
87
+ description = " Runs the tests against Infinispan"
88
+ classpath = sourceSets. test. runtimeClasspath + configurations. infinispan
89
+ systemProperties = [" spring.cache.jcache.config" : " classpath:infinispan.xml" ]
90
+ }
91
+
92
+ def testRedis = tasks. register(" testRedis" , Test ) {
93
+ description = " Runs the tests against Redis"
94
+ classpath = sourceSets. redisTest. runtimeClasspath
95
+ testClassesDirs = sourceSets. redisTest. output. classesDirs
96
+ }
97
+
98
+ tasks. named(" check" ). configure {
99
+ dependsOn testCaffeine, testCouchbase, testEhcache, testEhcache2, testHazelcast, testInfinispan, testRedis
100
+ }
0 commit comments