Skip to content

Commit

Permalink
Upgrade Hazelcast to 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
vpavic committed Nov 27, 2018
1 parent c354927 commit f709a6c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle/dependency-management.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
@WebAppConfiguration
public class EnableHazelcastHttpSessionEventsTests<S extends Session> {

private static final int MAX_INACTIVE_INTERVAL_IN_SECONDS = 1;

@Autowired
private SessionRepository<S> repository;

Expand Down Expand Up @@ -116,13 +114,13 @@ public void expiredSessionTest() throws InterruptedException {
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.<SessionExpiredEvent>getEvent(sessionToSave.getId()))
.isInstanceOf(SessionExpiredEvent.class);

assertThat(this.repository.<Session>findById(sessionToSave.getId())).isNull();
assertThat(this.repository.findById(sessionToSave.getId())).isNull();
}

@Test
Expand All @@ -147,24 +145,18 @@ public void deletedSessionTest() throws InterruptedException {

@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();
}
Expand All @@ -188,7 +180,7 @@ public void changeSessionIdNoEventTest() throws InterruptedException {
}

@Configuration
@EnableHazelcastHttpSession(maxInactiveIntervalInSeconds = MAX_INACTIVE_INTERVAL_IN_SECONDS)
@EnableHazelcastHttpSession(maxInactiveIntervalInSeconds = 2)
static class HazelcastSessionConfig {

@Bean
Expand All @@ -200,6 +192,7 @@ public HazelcastInstance embeddedHazelcast() {
public SessionEventRegistry sessionEventRegistry() {
return new SessionEventRegistry();
}

}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.10.xsd">
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd">

<user-code-deployment enabled="true">
<class-cache-mode>ETERNAL</class-cache-mode>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.10.xsd">
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd">

<group>
<name>spring-session-it-test-idle-time-map-name</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.10.xsd">
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.11.xsd">

<group>
<name>spring-session-it-test-map-name</name>
Expand Down

0 comments on commit f709a6c

Please sign in to comment.