Polish contribution
Backport Bot / build (push) Waiting to run
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run
Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run
Details
Backport Bot / build (push) Waiting to run
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run
Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run
Details
See gh-35013
This commit is contained in:
parent
c04902fefb
commit
4d2cc4ae97
|
@ -283,7 +283,7 @@ public class InMemoryWebSessionStore implements WebSessionStore {
|
||||||
private void checkMaxSessionsLimit() {
|
private void checkMaxSessionsLimit() {
|
||||||
if (sessions.size() >= maxSessions) {
|
if (sessions.size() >= maxSessions) {
|
||||||
expiredSessionChecker.removeExpiredSessions(clock.instant());
|
expiredSessionChecker.removeExpiredSessions(clock.instant());
|
||||||
if (sessions.size() >= maxSessions && !sessions.containsKey(this.getId())) {
|
if (sessions.size() >= maxSessions && !sessions.containsKey(this.id.get())) {
|
||||||
throw new IllegalStateException("Max sessions limit reached: " + sessions.size());
|
throw new IllegalStateException("Max sessions limit reached: " + sessions.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,21 +160,40 @@ class InMemoryWebSessionStoreTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void updateSession() {
|
void updateSession() {
|
||||||
WebSession oneWebSession = insertSession();
|
WebSession session = insertSession();
|
||||||
|
|
||||||
StepVerifier.create(oneWebSession.save())
|
StepVerifier.create(session.save())
|
||||||
.expectComplete()
|
.expectComplete()
|
||||||
.verify();
|
.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test // gh-35013
|
||||||
void updateSession_whenMaxSessionsReached() {
|
void updateSessionAfterMaxSessionLimitIsExceeded() {
|
||||||
WebSession onceWebSession = insertSession();
|
this.store.setMaxSessions(10);
|
||||||
IntStream.range(1, 10000).forEach(i -> insertSession());
|
|
||||||
|
|
||||||
StepVerifier.create(onceWebSession.save())
|
WebSession session = insertSession();
|
||||||
|
assertNumSessions(1);
|
||||||
|
|
||||||
|
IntStream.rangeClosed(1, 9).forEach(i -> insertSession());
|
||||||
|
assertNumSessions(10);
|
||||||
|
|
||||||
|
// Updating an existing session should succeed.
|
||||||
|
StepVerifier.create(session.save())
|
||||||
.expectComplete()
|
.expectComplete()
|
||||||
.verify();
|
.verify();
|
||||||
|
assertNumSessions(10);
|
||||||
|
|
||||||
|
// Saving an additional new session should fail.
|
||||||
|
assertThatIllegalStateException()
|
||||||
|
.isThrownBy(this::insertSession)
|
||||||
|
.withMessage("Max sessions limit reached: 10");
|
||||||
|
assertNumSessions(10);
|
||||||
|
|
||||||
|
// Updating an existing session again should still succeed.
|
||||||
|
StepVerifier.create(session.save())
|
||||||
|
.expectComplete()
|
||||||
|
.verify();
|
||||||
|
assertNumSessions(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue