From f709a6c787c049a67cb1adc43621e09ba374a684 Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Tue, 27 Nov 2018 05:47:57 +0100 Subject: [PATCH] Upgrade Hazelcast to 3.11 Resolves: #1267 --- gradle/dependency-management.gradle | 2 +- .../HazelcastClientRepositoryITests.java | 2 +- ...EnableHazelcastHttpSessionEventsTests.java | 19 ++++++------------- .../resources/hazelcast-server.xml | 2 +- .../hazelcast-custom-idle-time-map-name.xml | 2 +- .../web/http/hazelcast-custom-map-name.xml | 2 +- 6 files changed, 11 insertions(+), 18 deletions(-) diff --git a/gradle/dependency-management.gradle b/gradle/dependency-management.gradle index 0a16964d..75d97d75 100644 --- a/gradle/dependency-management.gradle +++ b/gradle/dependency-management.gradle @@ -9,7 +9,7 @@ dependencyManagement { } dependencies { - dependencySet(group: 'com.hazelcast', version: '3.10.6') { + dependencySet(group: 'com.hazelcast', version: '3.11') { entry 'hazelcast' entry 'hazelcast-client' } diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java index 184d614c..44a47fca 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/HazelcastClientRepositoryITests.java @@ -48,7 +48,7 @@ import org.springframework.test.context.web.WebAppConfiguration; public class HazelcastClientRepositoryITests extends AbstractHazelcastRepositoryITests { private static GenericContainer container = new GenericContainer<>( - "hazelcast/hazelcast:3.10.6") + "hazelcast/hazelcast:3.11") .withExposedPorts(5701) .withEnv("JAVA_OPTS", "-Dhazelcast.config=/opt/hazelcast/config_ext/hazelcast.xml") diff --git a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java index 76f953db..f605d7fc 100644 --- a/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java +++ b/spring-session-hazelcast/src/integration-test/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSessionEventsTests.java @@ -59,8 +59,6 @@ import static org.assertj.core.api.Assertions.assertThat; @WebAppConfiguration public class EnableHazelcastHttpSessionEventsTests { - private static final int MAX_INACTIVE_INTERVAL_IN_SECONDS = 1; - @Autowired private SessionRepository repository; @@ -116,13 +114,13 @@ public class EnableHazelcastHttpSessionEventsTests { this.registry.clear(); assertThat(sessionToSave.getMaxInactiveInterval()) - .isEqualTo(Duration.ofSeconds(MAX_INACTIVE_INTERVAL_IN_SECONDS)); + .isEqualTo(Duration.ofSeconds(2)); assertThat(this.registry.receivedEvent(sessionToSave.getId())).isTrue(); assertThat(this.registry.getEvent(sessionToSave.getId())) .isInstanceOf(SessionExpiredEvent.class); - assertThat(this.repository.findById(sessionToSave.getId())).isNull(); + assertThat(this.repository.findById(sessionToSave.getId())).isNull(); } @Test @@ -147,24 +145,18 @@ public class EnableHazelcastHttpSessionEventsTests { @Test public void saveUpdatesTimeToLiveTest() throws InterruptedException { - Object lock = new Object(); - S sessionToSave = this.repository.createSession(); this.repository.save(sessionToSave); - synchronized (lock) { - lock.wait(sessionToSave.getMaxInactiveInterval().minusMillis(500).toMillis()); - } + Thread.sleep(1200); // Get and save the session like SessionRepositoryFilter would. S sessionToUpdate = this.repository.findById(sessionToSave.getId()); sessionToUpdate.setLastAccessedTime(Instant.now()); this.repository.save(sessionToUpdate); - synchronized (lock) { - lock.wait(sessionToUpdate.getMaxInactiveInterval().minusMillis(100).toMillis()); - } + Thread.sleep(1200); assertThat(this.repository.findById(sessionToUpdate.getId())).isNotNull(); } @@ -188,7 +180,7 @@ public class EnableHazelcastHttpSessionEventsTests { } @Configuration - @EnableHazelcastHttpSession(maxInactiveIntervalInSeconds = MAX_INACTIVE_INTERVAL_IN_SECONDS) + @EnableHazelcastHttpSession(maxInactiveIntervalInSeconds = 2) static class HazelcastSessionConfig { @Bean @@ -200,6 +192,7 @@ public class EnableHazelcastHttpSessionEventsTests { public SessionEventRegistry sessionEventRegistry() { return new SessionEventRegistry(); } + } } diff --git a/spring-session-hazelcast/src/integration-test/resources/hazelcast-server.xml b/spring-session-hazelcast/src/integration-test/resources/hazelcast-server.xml index 9fcf9456..089b0227 100644 --- a/spring-session-hazelcast/src/integration-test/resources/hazelcast-server.xml +++ b/spring-session-hazelcast/src/integration-test/resources/hazelcast-server.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"> ETERNAL diff --git a/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-idle-time-map-name.xml b/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-idle-time-map-name.xml index df1fff7c..43566450 100644 --- a/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-idle-time-map-name.xml +++ b/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-idle-time-map-name.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"> spring-session-it-test-idle-time-map-name diff --git a/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-map-name.xml b/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-map-name.xml index ac14430a..7c5d1e0e 100644 --- a/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-map-name.xml +++ b/spring-session-hazelcast/src/integration-test/resources/org/springframework/session/hazelcast/config/annotation/web/http/hazelcast-custom-map-name.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd"> spring-session-it-test-map-name