Skip to content
Permalink
Browse files
Adhering To Coding Conventions And Add Test Suite
  • Loading branch information
atris committed Jun 22, 2021
1 parent 822235b commit 58eaf13ef5c0c0daefb07e9fa0acfd05aaa9d329
Showing 10 changed files with 131 additions and 13 deletions.
@@ -61,7 +61,6 @@
@Import(IgniteHttpSessionConfiguration.class)
@Configuration(proxyBeanMethods = false)
public @interface EnableIgniteHttpSession {

/**
* The session timeout in seconds. By default, it is set to 1800 seconds (30 minutes).
* This should be a non-negative integer.
@@ -48,7 +48,6 @@
*/
@Configuration(proxyBeanMethods = false)
public class IgniteHttpSessionConfiguration extends SpringHttpSessionConfiguration implements ImportAware {

/** */
private Integer maxInactiveIntervalInSeconds = MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS;

@@ -103,7 +103,6 @@
CacheEntryCreatedListener<String, IgniteIndexedSessionRepository.IgniteSession>,
CacheEntryRemovedListener<String, IgniteIndexedSessionRepository.IgniteSession>,
CacheEntryExpiredListener<String, IgniteIndexedSessionRepository.IgniteSession> {

/**
* The default name of map used by Spring Session to store sessions.
*/
@@ -36,6 +36,5 @@
@Documented
@Qualifier
public @interface SpringSessionIgnite {

}

@@ -38,16 +38,19 @@
/**
* Base class for {@link IgniteIndexedSessionRepository} integration tests.
*/
abstract class AbstractIgniteIndexedSessionRepositoryITests {

abstract class AbstractIgniteIndexedSessionRepositoryITest {
/** */
private static final String SPRING_SECURITY_CONTEXT = "SPRING_SECURITY_CONTEXT";

/** */
@Autowired
private Ignite ignite;

/** */
@Autowired
private IgniteIndexedSessionRepository repository;

/** */
@Test
void createAndDestroySession() {
IgniteIndexedSessionRepository.IgniteSession sessionToSave = this.repository.createSession();
@@ -68,6 +71,7 @@ void createAndDestroySession() {
assertThat(cache.size()).isEqualTo(0);
}

/** */
@Test
void changeSessionIdWhenOnlyChangeId() {
String attrName = "changeSessionId";
@@ -95,6 +99,7 @@ void changeSessionIdWhenOnlyChangeId() {
this.repository.deleteById(changeSessionId);
}

/** */
@Test
void changeSessionIdWhenChangeTwice() {
IgniteSession toSave = this.repository.createSession();
@@ -114,6 +119,7 @@ void changeSessionIdWhenChangeTwice() {
this.repository.deleteById(changeId2);
}

/** */
@Test
void changeSessionIdWhenSetAttributeOnChangedSession() {
String attrName = "changeSessionId";
@@ -141,6 +147,7 @@ void changeSessionIdWhenSetAttributeOnChangedSession() {
this.repository.deleteById(changeSessionId);
}

/** */
@Test
void changeSessionIdWhenHasNotSaved() {
IgniteSession toSave = this.repository.createSession();
@@ -168,6 +175,7 @@ void attemptToUpdateSessionAfterDelete() {
assertThat(this.repository.findById(sessionId)).isNull();
}

/** */
@Test
void expireSession() {
IgniteSession session = this.repository.createSession();
@@ -179,6 +187,7 @@ void expireSession() {
assertThat(this.repository.findById(sessionId)).isNull();
}

/** */
@Test
void createAndUpdateSession() {
IgniteSession session = this.repository.createSession();
@@ -194,6 +203,7 @@ void createAndUpdateSession() {
assertThat(this.repository.findById(sessionId)).isNotNull();
}

/** */
@Test
void createSessionWithSecurityContextAndFindById() {
IgniteSession session = this.repository.createSession();
@@ -210,6 +220,7 @@ void createSessionWithSecurityContextAndFindById() {
assertThat(this.repository.findById(sessionId)).isNotNull();
}

/** */
@Test
void createSessionWithSecurityContextAndFindByPrincipal() {
IgniteSession session = this.repository.createSession();
@@ -35,22 +35,26 @@
@ExtendWith(SpringExtension.class)
@ContextConfiguration
@WebAppConfiguration
class EmbeddedIgniteIndexedSessionRepositoryITests extends AbstractIgniteIndexedSessionRepositoryITests {

public
class EmbeddedIgniteIndexedSessionRepositoryITest extends AbstractIgniteIndexedSessionRepositoryITest {
/** */
@BeforeAll
static void setUpClass() {
Ignition.stopAll(true);
}

/** */
@AfterAll
static void tearDownClass() {
Ignition.stopAll(true);
}

/** */
@EnableIgniteHttpSession
@Configuration
static class IgniteSessionConfig {

/** */
@Bean
Ignite ignite() {
return IgniteITestUtils.embeddedIgniteServer();

0 comments on commit 58eaf13

Please sign in to comment.