Fix Per Comments
diff --git a/modules/spring-sessions/pom.xml b/modules/spring-sessions/pom.xml
index 4fca7b6..9e33eac 100644
--- a/modules/spring-sessions/pom.xml
+++ b/modules/spring-sessions/pom.xml
@@ -23,13 +23,13 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
- <version>5.3.8</version>
+ <version>${spring.version.for.sessions}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
- <version>5.3.8</version>
+ <version>${spring.version.for.sessions}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-core -->
@@ -50,7 +50,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
- <version>5.3.8</version>
+ <version>${spring.version.for.sessions}</version>
</dependency>
<dependency>
@@ -62,7 +62,7 @@
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
- <version>2.11.0-SNAPSHOT</version>
+ <version>2.10.0</version>
<scope>compile</scope>
</dependency>
@@ -86,7 +86,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
- <version>5.3.8</version>
+ <version>${spring.version.for.sessions}</version>
<scope>test</scope>
</dependency>
@@ -109,7 +109,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
- <version>5.3.8</version>
+ <version>${spring.version.for.sessions}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.ignite/ignite-indexing -->
@@ -131,4 +131,4 @@
</dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/EnableIgniteHttpSession.java b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/EnableIgniteHttpSession.java
index 7e6b841..8ac5b17 100644
--- a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/EnableIgniteHttpSession.java
+++ b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/EnableIgniteHttpSession.java
@@ -96,4 +96,4 @@
*/
SaveMode saveMode() default SaveMode.ON_SET_ATTRIBUTE;
-}
\ No newline at end of file
+}
diff --git a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfiguration.java b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfiguration.java
index 971e049..3adc2a4 100644
--- a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfiguration.java
+++ b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfiguration.java
@@ -49,93 +49,148 @@
@Configuration(proxyBeanMethods = false)
public class IgniteHttpSessionConfiguration extends SpringHttpSessionConfiguration implements ImportAware {
+ /**
+ *
+ */
private Integer maxInactiveIntervalInSeconds = MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS;
+ /**
+ *
+ */
private String sessionMapName = IgniteIndexedSessionRepository.DEFAULT_SESSION_MAP_NAME;
+ /**
+ *
+ */
private FlushMode flushMode = FlushMode.ON_SAVE;
+ /**
+ *
+ */
private SaveMode saveMode = SaveMode.ON_SET_ATTRIBUTE;
+ /**
+ *
+ */
private Ignite ignite;
+ /**
+ *
+ */
private ApplicationEventPublisher applicationEventPublisher;
+ /**
+ *
+ */
private IndexResolver<Session> indexResolver;
+ /**
+ *
+ */
private List<SessionRepositoryCustomizer<IgniteIndexedSessionRepository>> sessionRepositoryCustomizers;
+ /**
+ *
+ */
@Bean
public SessionRepository<?> sessionRepository() {
return createIgniteIndexedSessionRepository();
}
+ /**
+ *
+ */
public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds) {
this.maxInactiveIntervalInSeconds = maxInactiveIntervalInSeconds;
}
+ /**
+ *
+ */
public void setSessionMapName(String sessionMapName) {
this.sessionMapName = sessionMapName;
}
+ /**
+ *
+ */
public void setFlushMode(FlushMode flushMode) {
this.flushMode = flushMode;
}
+ /**
+ *
+ */
public void setSaveMode(SaveMode saveMode) {
this.saveMode = saveMode;
}
+ /**
+ *
+ */
@Autowired
public void setIgnite(@SpringSessionIgnite ObjectProvider<Ignite> springSessionIgnite,
ObjectProvider<Ignite> ignite) {
Ignite igniteToUse = springSessionIgnite.getIfAvailable();
- if (igniteToUse == null) {
+ if (igniteToUse == null)
igniteToUse = ignite.getObject();
- }
+
this.ignite = igniteToUse;
}
+ /**
+ *
+ */
@Autowired
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
}
+ /**
+ *
+ */
@Autowired(required = false)
public void setIndexResolver(IndexResolver<Session> indexResolver) {
this.indexResolver = indexResolver;
}
+ /**
+ *
+ */
@Autowired(required = false)
public void setSessionRepositoryCustomizer(
ObjectProvider<SessionRepositoryCustomizer<IgniteIndexedSessionRepository>> sessionRepositoryCustomizers) {
this.sessionRepositoryCustomizers = sessionRepositoryCustomizers.orderedStream().collect(Collectors.toList());
}
- @Override
- @SuppressWarnings("deprecation")
- public void setImportMetadata(AnnotationMetadata importMetadata) {
+ /**
+ *
+ */
+ @Override @SuppressWarnings("deprecation") public void setImportMetadata(AnnotationMetadata importMetadata) {
Map<String, Object> attributeMap = importMetadata
.getAnnotationAttributes(EnableIgniteHttpSession.class.getName());
AnnotationAttributes attributes = AnnotationAttributes.fromMap(attributeMap);
this.maxInactiveIntervalInSeconds = attributes.getNumber("maxInactiveIntervalInSeconds");
String sessionMapNameValue = attributes.getString("sessionMapName");
- if (StringUtils.hasText(sessionMapNameValue)) {
+ if (StringUtils.hasText(sessionMapNameValue))
this.sessionMapName = sessionMapNameValue;
- }
+
this.flushMode = attributes.getEnum("flushMode");
this.saveMode = attributes.getEnum("saveMode");
}
+ /**
+ *
+ */
private IgniteIndexedSessionRepository createIgniteIndexedSessionRepository() {
IgniteIndexedSessionRepository sessionRepository = new IgniteIndexedSessionRepository(this.ignite);
sessionRepository.setApplicationEventPublisher(this.applicationEventPublisher);
- if (this.indexResolver != null) {
+ if (this.indexResolver != null)
sessionRepository.setIndexResolver(this.indexResolver);
- }
- if (StringUtils.hasText(this.sessionMapName)) {
+
+ if (StringUtils.hasText(this.sessionMapName))
sessionRepository.setSessionMapName(this.sessionMapName);
- }
+
sessionRepository.setDefaultMaxInactiveInterval(this.maxInactiveIntervalInSeconds);
sessionRepository.setFlushMode(this.flushMode);
sessionRepository.setSaveMode(this.saveMode);
@@ -143,5 +198,5 @@
.forEach((sessionRepositoryCustomizer) -> sessionRepositoryCustomizer.customize(sessionRepository));
return sessionRepository;
}
-
}
+
diff --git a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteIndexedSessionRepository.java b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteIndexedSessionRepository.java
index d8adad4..5318883 100644
--- a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteIndexedSessionRepository.java
+++ b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/IgniteIndexedSessionRepository.java
@@ -110,16 +110,23 @@
public static final String DEFAULT_SESSION_MAP_NAME = "spring:session:sessions";
/**
- * The principal name custom attribute name.
+ *
*/
- public static final String PRINCIPAL_NAME_ATTRIBUTE = "principalName";
-
private static final String SPRING_SECURITY_CONTEXT = "SPRING_SECURITY_CONTEXT";
+ /**
+ *
+ */
private static final Log logger = LogFactory.getLog(IgniteIndexedSessionRepository.class);
+ /**
+ *
+ */
private final Ignite ignite;
+ /**
+ *
+ */
private ApplicationEventPublisher eventPublisher = (event) -> {
};
@@ -129,16 +136,34 @@
*/
private Integer defaultMaxInactiveInterval;
+ /**
+ *
+ */
private IndexResolver<Session> indexResolver = new DelegatingIndexResolver<>(new PrincipalNameIndexResolver<>());
+ /**
+ *
+ */
private String sessionMapName = DEFAULT_SESSION_MAP_NAME;
+ /**
+ *
+ */
private FlushMode flushMode = FlushMode.ON_SAVE;
+ /**
+ *
+ */
private SaveMode saveMode = SaveMode.ON_SET_ATTRIBUTE;
+ /**
+ *
+ */
private IgniteCache<String, IgniteSession> sessions;
+ /**
+ *
+ */
private CacheEntryListenerConfiguration<String, IgniteSession> listenerConfiguration;
/**
@@ -150,42 +175,43 @@
this.ignite = ignite;
}
+ /**
+ *
+ */
@PostConstruct
public void init() {
final CacheConfiguration<String, IgniteSession> configuration = new CacheConfiguration<String, IgniteSession>(
this.sessionMapName).setIndexedTypes(String.class, IgniteSession.class);
- if (this.defaultMaxInactiveInterval != null) {
+ if (this.defaultMaxInactiveInterval != null)
configuration.setExpiryPolicyFactory(TouchedExpiryPolicy
.factoryOf(new javax.cache.expiry.Duration(TimeUnit.SECONDS, this.defaultMaxInactiveInterval)));
- }
this.sessions = this.ignite.getOrCreateCache(configuration);
this.listenerConfiguration = new CacheEntryListenerConfiguration<String, IgniteSession>() {
- @Override
- public Factory<CacheEntryListener<? super String, ? super IgniteSession>> getCacheEntryListenerFactory() {
+ @Override public Factory<CacheEntryListener<? super String, ? super IgniteSession>> getCacheEntryListenerFactory() {
return (Factory<CacheEntryListener<? super String, ? super IgniteSession>>) () -> IgniteIndexedSessionRepository.this;
}
- @Override
- public boolean isOldValueRequired() {
+ @Override public boolean isOldValueRequired() {
return true;
}
- @Override
- public Factory<CacheEntryEventFilter<? super String, ? super IgniteSession>> getCacheEntryEventFilterFactory() {
+ @Override public Factory<CacheEntryEventFilter<? super String, ? super IgniteSession>> getCacheEntryEventFilterFactory() {
return null;
}
- @Override
- public boolean isSynchronous() {
+ @Override public boolean isSynchronous() {
return false;
}
};
this.sessions.registerCacheEntryListener(this.listenerConfiguration);
}
+ /**
+ *
+ */
@PreDestroy
public void close() {
this.sessions.deregisterCacheEntryListener(this.listenerConfiguration);
@@ -249,22 +275,26 @@
this.saveMode = saveMode;
}
- @Override
- public IgniteSession createSession() {
+ /**
+ *
+ */
+ @Override public IgniteSession createSession() {
MapSession cached = new MapSession();
- if (this.defaultMaxInactiveInterval != null) {
+ if (this.defaultMaxInactiveInterval != null)
cached.setMaxInactiveInterval(Duration.ofSeconds(this.defaultMaxInactiveInterval));
- }
+
IgniteSession session = new IgniteSession(cached, true);
session.flushImmediateIfNecessary();
return session;
}
- @Override
- public void save(IgniteSession session) {
- if (session.isNew) {
+ /**
+ *
+ */
+ @Override public void save(IgniteSession session) {
+ if (session.isNew)
ttlSessions(session.getMaxInactiveInterval()).put(session.getId(), session);
- }
+
else if (session.sessionIdChanged) {
this.sessions.remove(session.originalId);
session.originalId = session.getId();
@@ -281,12 +311,14 @@
session.clearChangeFlags();
}
- @Override
- public IgniteSession findById(String id) {
+ /**
+ *
+ */
+ @Override public IgniteSession findById(String id) {
IgniteSession saved = this.sessions.get(id);
- if (saved == null) {
+ if (saved == null)
return null;
- }
+
if (saved.isExpired()) {
deleteById(saved.getId());
return null;
@@ -295,22 +327,25 @@
return saved;
}
- @Override
- public void deleteById(String id) {
+ /**
+ *
+ */
+ @Override public void deleteById(String id) {
this.sessions.remove(id);
}
- @Override
- public Map<String, IgniteSession> findByIndexNameAndIndexValue(String indexName, String indexValue) {
- if (!PRINCIPAL_NAME_INDEX_NAME.equals(indexName)) {
+ /**
+ *
+ */
+ @Override public Map<String, IgniteSession> findByIndexNameAndIndexValue(String indexName, String indexValue) {
+ if (!PRINCIPAL_NAME_INDEX_NAME.equals(indexName))
return Collections.emptyMap();
- }
+
final FieldsQueryCursor<List<?>> cursor = this.sessions
.query(new SqlFieldsQuery("SELECT * FROM IgniteSession WHERE principal='" + indexValue + "'"));
- if (cursor == null) {
+ if (cursor == null)
return Collections.emptyMap();
- }
final List<List<?>> sessions = cursor.getAll();
@@ -325,40 +360,47 @@
return sessionMap;
}
- @Override
- public void onCreated(Iterable<CacheEntryEvent<? extends String, ? extends IgniteSession>> events)
+ /**
+ *
+ */
+ @Override public void onCreated(Iterable<CacheEntryEvent<? extends String, ? extends IgniteSession>> events)
throws CacheEntryListenerException {
events.forEach((event) -> {
IgniteSession session = event.getValue();
if (session.getId().equals(session.getDelegate().getOriginalId())) {
- if (logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled())
logger.debug("Session created with id: " + session.getId());
- }
+
this.eventPublisher.publishEvent(new SessionCreatedEvent(this, session));
}
});
}
+ /**
+ *
+ */
@Override
public void onExpired(Iterable<CacheEntryEvent<? extends String, ? extends IgniteSession>> events)
throws CacheEntryListenerException {
events.forEach((event) -> {
- if (logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled())
logger.debug("Session expired with id: " + event.getOldValue().getId());
- }
+
this.eventPublisher.publishEvent(new SessionExpiredEvent(this, event.getOldValue()));
});
}
- @Override
- public void onRemoved(Iterable<CacheEntryEvent<? extends String, ? extends IgniteSession>> events)
+ /**
+ *
+ */
+ @Override public void onRemoved(Iterable<CacheEntryEvent<? extends String, ? extends IgniteSession>> events)
throws CacheEntryListenerException {
events.forEach((event) -> {
IgniteSession session = event.getOldValue();
if (session != null) {
- if (logger.isDebugEnabled()) {
+ if (logger.isDebugEnabled())
logger.debug("Session deleted with id: " + session.getId());
- }
+
this.eventPublisher.publishEvent(new SessionDeletedEvent(this, session));
}
});
@@ -388,27 +430,51 @@
*/
final class IgniteSession implements Session {
+ /**
+ *
+ */
@QuerySqlField
private final MapSession delegate;
+ /**
+ *
+ */
@GridDirectTransient
private boolean isNew;
+ /**
+ *
+ */
@GridDirectTransient
private boolean sessionIdChanged;
+ /**
+ *
+ */
@GridDirectTransient
private boolean lastAccessedTimeChanged;
+ /**
+ *
+ */
@GridDirectTransient
private boolean maxInactiveIntervalChanged;
+ /**
+ *
+ */
@GridDirectTransient
private String originalId;
+ /**
+ *
+ */
@GridDirectTransient
private Map<String, Object> delta = new HashMap<>();
+ /**
+ *
+ */
@QuerySqlField(index = true)
private String principal;
@@ -416,75 +482,97 @@
this.delegate = cached;
this.isNew = isNew;
this.originalId = cached.getId();
- if (this.isNew || (IgniteIndexedSessionRepository.this.saveMode == SaveMode.ALWAYS)) {
+ if (this.isNew || (IgniteIndexedSessionRepository.this.saveMode == SaveMode.ALWAYS))
getAttributeNames()
.forEach((attributeName) -> this.delta.put(attributeName, cached.getAttribute(attributeName)));
- }
+
}
- @Override
- public void setLastAccessedTime(Instant lastAccessedTime) {
+ /**
+ *
+ */
+ @Override public void setLastAccessedTime(Instant lastAccessedTime) {
this.delegate.setLastAccessedTime(lastAccessedTime);
this.lastAccessedTimeChanged = true;
flushImmediateIfNecessary();
}
- @Override
- public boolean isExpired() {
+ /**
+ *
+ */
+ @Override public boolean isExpired() {
return this.delegate.isExpired();
}
- @Override
- public Instant getCreationTime() {
+ /**
+ *
+ */
+ @Override public Instant getCreationTime() {
return this.delegate.getCreationTime();
}
- @Override
- public String getId() {
+ /**
+ *
+ */
+ @Override public String getId() {
return this.delegate.getId();
}
- @Override
- public String changeSessionId() {
+ /**
+ *
+ */
+ @Override public String changeSessionId() {
String newSessionId = this.delegate.changeSessionId();
this.sessionIdChanged = true;
return newSessionId;
}
- @Override
- public Instant getLastAccessedTime() {
+ /**
+ *
+ */
+ @Override public Instant getLastAccessedTime() {
return this.delegate.getLastAccessedTime();
}
- @Override
- public void setMaxInactiveInterval(Duration interval) {
+ /**
+ *
+ */
+ @Override public void setMaxInactiveInterval(Duration interval) {
this.delegate.setMaxInactiveInterval(interval);
this.maxInactiveIntervalChanged = true;
flushImmediateIfNecessary();
}
- @Override
- public Duration getMaxInactiveInterval() {
+ /**
+ *
+ */
+ @Override public Duration getMaxInactiveInterval() {
return this.delegate.getMaxInactiveInterval();
}
- @Override
- public <T> T getAttribute(String attributeName) {
+ /**
+ *
+ */
+ @Override public <T> T getAttribute(String attributeName) {
T attributeValue = this.delegate.getAttribute(attributeName);
if (attributeValue != null
- && IgniteIndexedSessionRepository.this.saveMode.equals(SaveMode.ON_GET_ATTRIBUTE)) {
+ && IgniteIndexedSessionRepository.this.saveMode.equals(SaveMode.ON_GET_ATTRIBUTE))
this.delta.put(attributeName, attributeValue);
- }
+
return attributeValue;
}
- @Override
- public Set<String> getAttributeNames() {
+ /**
+ *
+ */
+ @Override public Set<String> getAttributeNames() {
return this.delegate.getAttributeNames();
}
- @Override
- public void setAttribute(String attributeName, Object attributeValue) {
+ /**
+ *
+ */
+ @Override public void setAttribute(String attributeName, Object attributeValue) {
this.delegate.setAttribute(attributeName, attributeValue);
this.delta.put(attributeName, attributeValue);
if (SPRING_SECURITY_CONTEXT.equals(attributeName)) {
@@ -496,19 +584,30 @@
flushImmediateIfNecessary();
}
- @Override
- public void removeAttribute(String attributeName) {
+ /**
+ *
+ */
+ @Override public void removeAttribute(String attributeName) {
setAttribute(attributeName, null);
}
+ /**
+ *
+ */
MapSession getDelegate() {
return this.delegate;
}
+ /**
+ *
+ */
boolean hasChanges() {
return (this.lastAccessedTimeChanged || this.maxInactiveIntervalChanged || !this.delta.isEmpty());
}
+ /**
+ *
+ */
void clearChangeFlags() {
this.isNew = false;
this.lastAccessedTimeChanged = false;
@@ -517,29 +616,34 @@
this.delta.clear();
}
+ /**
+ *
+ */
private void flushImmediateIfNecessary() {
- if (IgniteIndexedSessionRepository.this.flushMode == FlushMode.IMMEDIATE) {
+ if (IgniteIndexedSessionRepository.this.flushMode == FlushMode.IMMEDIATE)
IgniteIndexedSessionRepository.this.save(this);
- }
}
- @Override
- public boolean equals(Object o) {
- if (this == o) {
+ /**
+ *
+ */
+ @Override public boolean equals(Object o) {
+ if (this == o)
return true;
- }
- if (o == null || getClass() != o.getClass()) {
+
+ if (o == null || getClass() != o.getClass())
return false;
- }
+
IgniteSession session = (IgniteSession) o;
return this.delegate.equals(session.delegate);
}
- @Override
- public int hashCode() {
+ /**
+ *
+ */
+ @Override public int hashCode() {
return Objects.hash(this.delegate);
}
-
}
-
}
+
diff --git a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/SessionEventRegistry.java b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/SessionEventRegistry.java
index c5c6479..de1a3ce 100644
--- a/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/SessionEventRegistry.java
+++ b/modules/spring-sessions/src/main/java/org/apache/ignite/spring/sessions/SessionEventRegistry.java
@@ -31,12 +31,20 @@
*/
class SessionEventRegistry implements ApplicationListener<AbstractSessionEvent> {
+ /**
+ *
+ */
private Map<String, AbstractSessionEvent> events = new HashMap<>();
+ /**
+ *
+ */
private ConcurrentMap<String, Object> locks = new ConcurrentHashMap<>();
- @Override
- public void onApplicationEvent(AbstractSessionEvent event) {
+ /**
+ *
+ */
+ @Override public void onApplicationEvent(AbstractSessionEvent event) {
String sessionId = event.getSessionId();
this.events.put(sessionId, event);
Object lock = getLock(sessionId);
@@ -45,30 +53,45 @@
}
}
+ /**
+ *
+ */
void clear() {
this.events.clear();
this.locks.clear();
}
+ /**
+ *
+ */
boolean receivedEvent(String sessionId) throws InterruptedException {
return waitForEvent(sessionId) != null;
}
+ /**
+ *
+ */
<E extends AbstractSessionEvent> E getEvent(String sessionId) throws InterruptedException {
return (E) waitForEvent(sessionId);
}
+ /**
+ *
+ */
private <E extends AbstractSessionEvent> E waitForEvent(String sessionId) throws InterruptedException {
Object lock = getLock(sessionId);
synchronized (lock) {
- if (!this.events.containsKey(sessionId)) {
+ if (!this.events.containsKey(sessionId))
lock.wait(10000);
- }
+
}
return (E) this.events.get(sessionId);
}
+ /**
+ *
+ */
private Object getLock(String sessionId) {
return this.locks.computeIfAbsent(sessionId, (k) -> new Object());
}
-}
\ No newline at end of file
+}
diff --git a/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/ClientServerIgniteIndexedSessionRepositoryITests.java b/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/ClientServerIgniteIndexedSessionRepositoryITests.java
deleted file mode 100644
index 204721d..0000000
--- a/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/ClientServerIgniteIndexedSessionRepositoryITests.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.apache.ignite.spring.sessions;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.Collections;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.testcontainers.containers.GenericContainer;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-import org.springframework.test.context.web.WebAppConfiguration;
-
-/**
- * Integration tests for {@link IgniteIndexedSessionRepository} using client-server
- * topology.
- */
-@ExtendWith(SpringExtension.class)
-@ContextConfiguration
-@WebAppConfiguration
-class ClientServerIgniteIndexedSessionRepositoryITests extends AbstractIgniteIndexedSessionRepositoryITests {
-
- private static GenericContainer container = new GenericContainer<>("apacheignite/ignite:2.9.0")
- .withExposedPorts(47100, 47500);
-
- @BeforeAll
- static void setUpClass() {
- Ignition.stopAll(true);
- container.start();
- }
-
- @AfterAll
- static void tearDownClass() {
- Ignition.stopAll(true);
- container.stop();
- }
-
- @Configuration
- @EnableIgniteHttpSession
- static class IgniteSessionConfig {
-
- @Bean
- Ignite ignite() {
- IgniteConfiguration cfg = new IgniteConfiguration();
- final String address = container.getContainerIpAddress() + ":" + container.getMappedPort(47500);
- final TcpDiscoverySpi spi = new TcpDiscoverySpi()
- .setIpFinder(new TcpDiscoveryVmIpFinder().setAddresses(Collections.singleton(address)));
- cfg.setDiscoverySpi(spi);
- return Ignition.start(cfg);
- }
-
- }
-
-}
diff --git a/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfigurationTests.java b/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfigurationTests.java
index c096b78..09ea373 100644
--- a/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfigurationTests.java
+++ b/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteHttpSessionConfigurationTests.java
@@ -55,9 +55,8 @@
@AfterEach
void closeContext() {
- if (this.context != null) {
+ if (this.context != null)
this.context.close();
- }
}
@Test
@@ -436,7 +435,5 @@
return (sessionRepository) -> sessionRepository
.setDefaultMaxInactiveInterval(MAX_INACTIVE_INTERVAL_IN_SECONDS);
}
-
}
-
}
diff --git a/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteITestUtils.java b/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteITestUtils.java
index 172cf56..c0a9503 100644
--- a/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteITestUtils.java
+++ b/modules/spring-sessions/src/test/java/org/apache/ignite/spring/sessions/IgniteITestUtils.java
@@ -35,5 +35,4 @@
static Ignite embeddedIgniteServer() {
return Ignition.start();
}
-
}
diff --git a/parent/pom.xml b/parent/pom.xml
index a94c273..1adc04d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -129,6 +129,7 @@
<spark.version>2.3.0</spark.version>
<spring.data.version>1.13.23.RELEASE</spring.data.version> <!-- don't forget to update spring version -->
<spring.version>4.3.26.RELEASE</spring.version><!-- don't forget to update spring-data version -->
+ <spring.version.for.sessions>5.3.8</spring.version.for.sessions><!-- don't forget to update spring-data version -->
<spring.data-2.0.version>2.0.13.RELEASE</spring.data-2.0.version> <!-- don't forget to update spring-5.0 version -->
<spring-5.0.version>5.0.16.RELEASE</spring-5.0.version><!-- don't forget to update spring-data-2.0 version -->
<spring.data-2.2.version>2.2.3.RELEASE</spring.data-2.2.version> <!-- don't forget to update spring-5.2 version -->