Polish
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user