Harmonize naming of session repositories

Resolves: #1455
This commit is contained in:
Vedran Pavic
2019-09-18 20:50:38 +02:00
parent 96715e04f2
commit 8cc8fbb7fd
64 changed files with 3029 additions and 2888 deletions

View File

@@ -30,17 +30,17 @@ import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.session.MapSession;
import org.springframework.session.hazelcast.HazelcastSessionRepository.HazelcastSession;
import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository.HazelcastSession;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Abstract base class for Hazelcast integration tests.
* Base class for {@link HazelcastIndexedSessionRepository} integration tests.
*
* @author Tommy Ludwig
* @author Vedran Pavic
*/
abstract class AbstractHazelcastRepositoryITests {
abstract class AbstractHazelcastIndexedSessionRepositoryITests {
private static final String SPRING_SECURITY_CONTEXT = "SPRING_SECURITY_CONTEXT";
@@ -48,7 +48,7 @@ abstract class AbstractHazelcastRepositoryITests {
private HazelcastInstance hazelcastInstance;
@Autowired
private HazelcastSessionRepository repository;
private HazelcastIndexedSessionRepository repository;
@Test
void createAndDestroySession() {
@@ -56,7 +56,7 @@ abstract class AbstractHazelcastRepositoryITests {
String sessionId = sessionToSave.getId();
IMap<String, MapSession> hazelcastMap = this.hazelcastInstance
.getMap(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME);
.getMap(HazelcastIndexedSessionRepository.DEFAULT_SESSION_MAP_NAME);
assertThat(hazelcastMap.size()).isEqualTo(0);

View File

@@ -35,17 +35,16 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
/**
* Integration tests that check the underlying data source - in this case Hazelcast
* Client.
* Integration tests for {@link HazelcastIndexedSessionRepository} using client-server
* topology.
*
* @author Vedran Pavic
* @author Artem Bilan
* @since 1.1
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration
@WebAppConfiguration
class HazelcastClientRepositoryITests extends AbstractHazelcastRepositoryITests {
class ClientServerHazelcastIndexedSessionRepositoryITests extends AbstractHazelcastIndexedSessionRepositoryITests {
private static GenericContainer container = new GenericContainer<>("hazelcast/hazelcast:3.12.2")
.withExposedPorts(5701).withEnv("JAVA_OPTS", "-Dhazelcast.config=/opt/hazelcast/config_ext/hazelcast.xml")

View File

@@ -27,8 +27,8 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.WebAppConfiguration;
/**
* Integration tests that check the underlying data source - in this case Hazelcast
* Server.
* Integration tests for {@link HazelcastIndexedSessionRepository} using embedded
* topology.
*
* @author Tommy Ludwig
* @author Vedran Pavic
@@ -36,7 +36,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
@ExtendWith(SpringExtension.class)
@ContextConfiguration
@WebAppConfiguration
class HazelcastServerRepositoryITests extends AbstractHazelcastRepositoryITests {
class EmbeddedHazelcastIndexedSessionRepositoryITests extends AbstractHazelcastIndexedSessionRepositoryITests {
@EnableHazelcastHttpSession
@Configuration

View File

@@ -42,7 +42,7 @@ public final class HazelcastITestUtils {
*/
public static HazelcastInstance embeddedHazelcastServer(int port) {
MapAttributeConfig attributeConfig = new MapAttributeConfig()
.setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
.setName(HazelcastIndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
.setExtractor(PrincipalNameExtractor.class.getName());
Config config = new Config();
@@ -53,8 +53,9 @@ public final class HazelcastITestUtils {
networkConfig.getJoin().getMulticastConfig().setEnabled(false);
config.getMapConfig(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME).addMapAttributeConfig(attributeConfig)
.addMapIndexConfig(new MapIndexConfig(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));
config.getMapConfig(HazelcastIndexedSessionRepository.DEFAULT_SESSION_MAP_NAME)
.addMapAttributeConfig(attributeConfig).addMapIndexConfig(
new MapIndexConfig(HazelcastIndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));
return Hazelcast.newHazelcastInstance(config);
}