This commit is contained in:
Vedran Pavic
2017-10-27 08:22:59 +02:00
parent 6f05c84aa7
commit 5df555cd53
16 changed files with 25 additions and 39 deletions

View File

@@ -20,7 +20,6 @@ import com.maxmind.geoip2.DatabaseReader;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import sample.config.GeoConfig;
import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -16,14 +16,13 @@
package sample;
/**
* @author Rob Winch
*/
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
/**
* @author Rob Winch
*/
@EnableWebSecurity
public class SecurityConfig {
@Autowired

View File

@@ -16,14 +16,13 @@
package sample;
/**
* @author Rob Winch
*/
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
/**
* @author Rob Winch
*/
@EnableWebSecurity
public class SecurityConfig {
@Autowired

View File

@@ -1,6 +1,5 @@
rootProject.name = 'spring-session-build'
FileTree buildFiles = fileTree(rootDir) {
include '**/*.gradle'
exclude '**/gradle', 'settings.gradle', 'buildSrc', '/build.gradle', '.*'
@@ -9,15 +8,14 @@ FileTree buildFiles = fileTree(rootDir) {
String rootDirPath = rootDir.absolutePath + File.separator
buildFiles.each { File buildFile ->
boolean isDefaultName = 'build.gradle'.equals(buildFile.name)
if(isDefaultName) {
if (buildFile.name == 'build.gradle') {
String buildFilePath = buildFile.parentFile.absolutePath
String projectPath = buildFilePath.replace(rootDirPath, '').replaceAll(File.separator, ':')
include projectPath
} else {
String projectName = buildFile.name.replace('.gradle', '');
String projectPath = ':' + projectName;
}
else {
String projectName = buildFile.name.replace('.gradle', '')
String projectPath = ':' + projectName
include projectPath
def project = findProject("${projectPath}")
project.name = projectName

View File

@@ -68,7 +68,7 @@ public class MapReactiveSessionRepository implements ReactiveSessionRepository<M
* should be kept alive between client requests.
*/
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
this.defaultMaxInactiveInterval = Integer.valueOf(defaultMaxInactiveInterval);
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
}
public Mono<Void> save(MapSession session) {

View File

@@ -66,7 +66,7 @@ public class MapSessionRepository implements SessionRepository<MapSession> {
* should be kept alive between client requests.
*/
public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
this.defaultMaxInactiveInterval = Integer.valueOf(defaultMaxInactiveInterval);
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
}
public void save(MapSession session) {

View File

@@ -76,8 +76,7 @@ public class SessionEventHttpSessionListenerAdapter
Session session = event.getSession();
HttpSession httpSession = new HttpSessionAdapter<>(session,
this.context);
HttpSessionEvent httpSessionEvent = new HttpSessionEvent(httpSession);
return httpSessionEvent;
return new HttpSessionEvent(httpSession);
}
/*

View File

@@ -75,8 +75,7 @@ public class SessionEventHttpSessionListenerAdapterTests {
// none)
@Test
public void constructorEmptyWorks() {
new SessionEventHttpSessionListenerAdapter(
Collections.<HttpSessionListener>emptyList());
new SessionEventHttpSessionListenerAdapter(Collections.emptyList());
}
/**
@@ -86,7 +85,7 @@ public class SessionEventHttpSessionListenerAdapterTests {
@Test
public void onApplicationEventEmptyListenersDoesNotUseEvent() {
this.listener = new SessionEventHttpSessionListenerAdapter(
Collections.<HttpSessionListener>emptyList());
Collections.emptyList());
this.destroyed = mock(SessionDestroyedEvent.class);
this.listener.onApplicationEvent(this.destroyed);

View File

@@ -136,7 +136,7 @@ public class SessionRepositoryMessageInterceptorTests {
@Test(expected = IllegalArgumentException.class)
public void setMatchingMessageTypesEmpty() {
this.interceptor.setMatchingMessageTypes(Collections.<SimpMessageType>emptySet());
this.interceptor.setMatchingMessageTypes(Collections.emptySet());
}
@Test

View File

@@ -497,9 +497,6 @@ public class RedisOperationsSessionRepository implements
public void onMessage(Message message, byte[] pattern) {
byte[] messageChannel = message.getChannel();
byte[] messageBody = message.getBody();
if (messageChannel == null || messageBody == null) {
return;
}
String channel = new String(messageChannel);
@@ -536,8 +533,6 @@ public class RedisOperationsSessionRepository implements
else {
handleExpired(sessionId, session);
}
return;
}
}

View File

@@ -433,7 +433,7 @@ public class RedisOperationsSessionRepositoryTests {
given(this.redisOperations.boundSetOps(anyString()))
.willReturn(this.boundSetOperations);
given(this.boundSetOperations.members())
.willReturn(Collections.<Object>singleton(expiredId));
.willReturn(Collections.singleton(expiredId));
given(this.redisOperations.boundHashOps(getKey(expiredId)))
.willReturn(this.boundHashOperations);
Map map = map(RedisOperationsSessionRepository.MAX_INACTIVE_ATTR, 1,
@@ -455,7 +455,7 @@ public class RedisOperationsSessionRepositoryTests {
given(this.redisOperations.boundSetOps(anyString()))
.willReturn(this.boundSetOperations);
given(this.boundSetOperations.members())
.willReturn(Collections.<Object>singleton(sessionId));
.willReturn(Collections.singleton(sessionId));
given(this.redisOperations.boundHashOps(getKey(sessionId)))
.willReturn(this.boundHashOperations);
Map map = map(RedisOperationsSessionRepository.CREATION_TIME_ATTR, createdTime.toEpochMilli(),

View File

@@ -320,8 +320,7 @@ public class HazelcastSessionRepository implements
public String changeSessionId() {
this.changed = true;
String result = this.delegate.changeSessionId();
return result;
return this.delegate.changeSessionId();
}
public Instant getLastAccessedTime() {

View File

@@ -75,10 +75,9 @@ public class HazelcastHttpSessionConfiguration extends SpringHttpSessionConfigur
.getAnnotationAttributes(EnableHazelcastHttpSession.class.getName());
AnnotationAttributes enableAttrs = AnnotationAttributes.fromMap(enableAttrMap);
setMaxInactiveIntervalInSeconds(
(Integer) enableAttrs.getNumber("maxInactiveIntervalInSeconds"));
enableAttrs.getNumber("maxInactiveIntervalInSeconds"));
setSessionMapName(enableAttrs.getString("sessionMapName"));
setHazelcastFlushMode(
(HazelcastFlushMode) enableAttrs.getEnum("hazelcastFlushMode"));
setHazelcastFlushMode(enableAttrs.getEnum("hazelcastFlushMode"));
}
public void setMaxInactiveIntervalInSeconds(int maxInactiveIntervalInSeconds) {

View File

@@ -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 hazelcast-config-3.6.xsd">
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.8.xsd">
<group>
<name>spring-session-it-test-idle-time-map-name</name>

View File

@@ -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 hazelcast-config-3.6.xsd">
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.8.xsd">
<group>
<name>spring-session-it-test-map-name</name>

View File

@@ -527,7 +527,7 @@ public class JdbcOperationsSessionRepository implements
@Scheduled(cron = "${spring.session.cleanup.cron.expression:0 * * * * *}")
public void cleanUpExpiredSessions() {
int deletedCount = this.transactionOperations.execute(transactionStatus ->
Integer deletedCount = this.transactionOperations.execute(transactionStatus ->
JdbcOperationsSessionRepository.this.jdbcOperations.update(
JdbcOperationsSessionRepository.this.deleteSessionsByExpiryTimeQuery,
System.currentTimeMillis()));