21
21
import com .hazelcast .core .HazelcastInstance ;
22
22
import org .junit .jupiter .api .AfterAll ;
23
23
import org .junit .jupiter .api .BeforeAll ;
24
- import org .junit .jupiter .api .Disabled ;
25
24
import org .junit .jupiter .api .extension .ExtendWith ;
26
25
import org .testcontainers .containers .GenericContainer ;
26
+ import org .testcontainers .images .builder .ImageFromDockerfile ;
27
27
import org .testcontainers .utility .MountableFile ;
28
28
29
29
import org .springframework .context .annotation .Bean ;
30
30
import org .springframework .context .annotation .Configuration ;
31
31
import org .springframework .session .MapSession ;
32
32
import org .springframework .session .Session ;
33
+ import org .springframework .session .SessionIdGenerator ;
33
34
import org .springframework .session .hazelcast .config .annotation .web .http .EnableHazelcastHttpSession ;
34
35
import org .springframework .test .context .ContextConfiguration ;
35
36
import org .springframework .test .context .junit .jupiter .SpringExtension ;
45
46
@ ExtendWith (SpringExtension .class )
46
47
@ ContextConfiguration
47
48
@ WebAppConfiguration
48
- @ Disabled ("Re-enable when Hazelcast image uses JDK 17" )
49
49
class ClientServerHazelcastIndexedSessionRepositoryITests extends AbstractHazelcastIndexedSessionRepositoryITests {
50
50
51
- private static GenericContainer container = new GenericContainer <>("hazelcast/hazelcast:5.0.3-slim" )
51
+ // @formatter:off
52
+ private static GenericContainer container = new GenericContainer <>(new ImageFromDockerfile ()
53
+ .withDockerfileFromBuilder ((builder ) -> builder
54
+ .from ("hazelcast/hazelcast:5.3.2-slim" )
55
+ .user ("root" )
56
+ .run ("apk del --no-cache openjdk11-jre-headless" )
57
+ .run ("apk add --no-cache openjdk17-jre-headless" )
58
+ .user ("hazelcast" )))
52
59
.withExposedPorts (5701 ).withCopyFileToContainer (MountableFile .forClasspathResource ("/hazelcast-server.xml" ),
53
60
"/opt/hazelcast/hazelcast.xml" )
54
61
.withEnv ("HAZELCAST_CONFIG" , "hazelcast.xml" );
62
+ // @formatter:on
55
63
56
64
@ BeforeAll
57
65
static void setUpClass () {
@@ -72,7 +80,8 @@ HazelcastInstance hazelcastInstance() {
72
80
ClientConfig clientConfig = new ClientConfig ();
73
81
clientConfig .getNetworkConfig ().addAddress (container .getHost () + ":" + container .getFirstMappedPort ());
74
82
clientConfig .getUserCodeDeploymentConfig ().setEnabled (true ).addClass (Session .class )
75
- .addClass (MapSession .class ).addClass (SessionUpdateEntryProcessor .class );
83
+ .addClass (MapSession .class ).addClass (SessionUpdateEntryProcessor .class )
84
+ .addClass (SessionIdGenerator .class );
76
85
return HazelcastClient .newHazelcastClient (clientConfig );
77
86
}
78
87
0 commit comments