Skip to content

Commit 5d17ff6

Browse files
committed
Merge pull request #14124 from vpavic:align-session-bean
* pr/14124: Align SessionsEndpoint with Spring Session API improvements Start building against Spring Session Bean M2 snapshots
2 parents f6f9f27 + 644ab5f commit 5d17ff6

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SessionsEndpointDocumentationTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ public void sessionsForUsername() throws Exception {
8989
sessions.put(sessionOne.getId(), sessionOne);
9090
sessions.put(sessionTwo.getId(), sessionTwo);
9191
sessions.put(sessionThree.getId(), sessionThree);
92-
given(this.sessionRepository.findByIndexNameAndIndexValue(
93-
FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, "alice"))
94-
.willReturn(sessions);
92+
given(this.sessionRepository.findByPrincipalName("alice")).willReturn(sessions);
9593
this.mockMvc.perform(get("/actuator/sessions").param("username", "alice"))
9694
.andExpect(status().isOk())
9795
.andDo(document("sessions/username",

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/session/SessionsEndpoint.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ public SessionsEndpoint(
5252
@ReadOperation
5353
public SessionsReport sessionsForUsername(String username) {
5454
Map<String, ? extends Session> sessions = this.sessionRepository
55-
.findByIndexNameAndIndexValue(
56-
FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME,
57-
username);
55+
.findByPrincipalName(username);
5856
return new SessionsReport(sessions);
5957
}
6058

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ public class SessionsEndpointTests {
4848

4949
@Test
5050
public void sessionsForUsername() {
51-
given(this.repository.findByIndexNameAndIndexValue(
52-
FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, "user"))
53-
.willReturn(Collections.singletonMap(session.getId(), session));
51+
given(this.repository.findByPrincipalName("user"))
52+
.willReturn(Collections.singletonMap(session.getId(), session));
5453
List<SessionDescriptor> result = this.endpoint.sessionsForUsername("user")
5554
.getSessions();
5655
assertThat(result).hasSize(1);

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointWebIntegrationTests.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,9 +58,7 @@ public void sessionsForUsernameWithoutUsernameParam() {
5858

5959
@Test
6060
public void sessionsForUsernameNoResults() {
61-
given(repository.findByIndexNameAndIndexValue(
62-
FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, "user"))
63-
.willReturn(Collections.emptyMap());
61+
given(repository.findByPrincipalName("user")).willReturn(Collections.emptyMap());
6462
client.get()
6563
.uri((builder) -> builder.path("/actuator/sessions")
6664
.queryParam("username", "user").build())
@@ -70,9 +68,8 @@ public void sessionsForUsernameNoResults() {
7068

7169
@Test
7270
public void sessionsForUsernameFound() {
73-
given(repository.findByIndexNameAndIndexValue(
74-
FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, "user"))
75-
.willReturn(Collections.singletonMap(session.getId(), session));
71+
given(repository.findByPrincipalName("user"))
72+
.willReturn(Collections.singletonMap(session.getId(), session));
7673
client.get()
7774
.uri((builder) -> builder.path("/actuator/sessions")
7875
.queryParam("username", "user").build())

spring-boot-project/spring-boot-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
<spring-restdocs.version>2.0.2.RELEASE</spring-restdocs.version>
167167
<spring-retry.version>1.2.2.RELEASE</spring-retry.version>
168168
<spring-security.version>5.1.0.BUILD-SNAPSHOT</spring-security.version>
169-
<spring-session-bom.version>Bean-M1</spring-session-bom.version>
169+
<spring-session-bom.version>Bean-BUILD-SNAPSHOT</spring-session-bom.version>
170170
<spring-ws.version>3.0.3.RELEASE</spring-ws.version>
171171
<sqlite-jdbc.version>3.23.1</sqlite-jdbc.version>
172172
<statsd-client.version>3.1.0</statsd-client.version>

0 commit comments

Comments
 (0)