Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f7e40894
Commit
f7e40894
authored
Jan 15, 2018
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Instant for Session creation and last accessed times
Closes gh-10976
parent
67e5897c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
SessionsEndpoint.java
...pringframework/boot/actuate/session/SessionsEndpoint.java
+8
-7
SessionsEndpointTests.java
...framework/boot/actuate/session/SessionsEndpointTests.java
+5
-8
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/session/SessionsEndpoint.java
View file @
f7e40894
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
org
.
springframework
.
boot
.
actuate
.
session
;
package
org
.
springframework
.
boot
.
actuate
.
session
;
import
java.time.Instant
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -101,9 +102,9 @@ public class SessionsEndpoint {
...
@@ -101,9 +102,9 @@ public class SessionsEndpoint {
private
final
Set
<
String
>
attributeNames
;
private
final
Set
<
String
>
attributeNames
;
private
final
long
creationTime
;
private
final
Instant
creationTime
;
private
final
long
lastAccessedTime
;
private
final
Instant
lastAccessedTime
;
private
final
long
maxInactiveInterval
;
private
final
long
maxInactiveInterval
;
...
@@ -112,8 +113,8 @@ public class SessionsEndpoint {
...
@@ -112,8 +113,8 @@ public class SessionsEndpoint {
public
SessionDescriptor
(
Session
session
)
{
public
SessionDescriptor
(
Session
session
)
{
this
.
id
=
session
.
getId
();
this
.
id
=
session
.
getId
();
this
.
attributeNames
=
session
.
getAttributeNames
();
this
.
attributeNames
=
session
.
getAttributeNames
();
this
.
creationTime
=
session
.
getCreationTime
()
.
toEpochMilli
()
;
this
.
creationTime
=
session
.
getCreationTime
();
this
.
lastAccessedTime
=
session
.
getLastAccessedTime
()
.
toEpochMilli
()
;
this
.
lastAccessedTime
=
session
.
getLastAccessedTime
();
this
.
maxInactiveInterval
=
session
.
getMaxInactiveInterval
().
getSeconds
();
this
.
maxInactiveInterval
=
session
.
getMaxInactiveInterval
().
getSeconds
();
this
.
expired
=
session
.
isExpired
();
this
.
expired
=
session
.
isExpired
();
}
}
...
@@ -126,11 +127,11 @@ public class SessionsEndpoint {
...
@@ -126,11 +127,11 @@ public class SessionsEndpoint {
return
this
.
attributeNames
;
return
this
.
attributeNames
;
}
}
public
long
getCreationTime
()
{
public
Instant
getCreationTime
()
{
return
this
.
creationTime
;
return
this
.
creationTime
;
}
}
public
long
getLastAccessedTime
()
{
public
Instant
getLastAccessedTime
()
{
return
this
.
lastAccessedTime
;
return
this
.
lastAccessedTime
;
}
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointTests.java
View file @
f7e40894
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -57,10 +57,9 @@ public class SessionsEndpointTests {
...
@@ -57,10 +57,9 @@ public class SessionsEndpointTests {
assertThat
(
result
.
get
(
0
).
getId
()).
isEqualTo
(
session
.
getId
());
assertThat
(
result
.
get
(
0
).
getId
()).
isEqualTo
(
session
.
getId
());
assertThat
(
result
.
get
(
0
).
getAttributeNames
())
assertThat
(
result
.
get
(
0
).
getAttributeNames
())
.
isEqualTo
(
session
.
getAttributeNames
());
.
isEqualTo
(
session
.
getAttributeNames
());
assertThat
(
result
.
get
(
0
).
getCreationTime
())
assertThat
(
result
.
get
(
0
).
getCreationTime
()).
isEqualTo
(
session
.
getCreationTime
());
.
isEqualTo
(
session
.
getCreationTime
().
toEpochMilli
());
assertThat
(
result
.
get
(
0
).
getLastAccessedTime
())
assertThat
(
result
.
get
(
0
).
getLastAccessedTime
())
.
isEqualTo
(
session
.
getLastAccessedTime
()
.
toEpochMilli
()
);
.
isEqualTo
(
session
.
getLastAccessedTime
());
assertThat
(
result
.
get
(
0
).
getMaxInactiveInterval
())
assertThat
(
result
.
get
(
0
).
getMaxInactiveInterval
())
.
isEqualTo
(
session
.
getMaxInactiveInterval
().
getSeconds
());
.
isEqualTo
(
session
.
getMaxInactiveInterval
().
getSeconds
());
assertThat
(
result
.
get
(
0
).
isExpired
()).
isEqualTo
(
session
.
isExpired
());
assertThat
(
result
.
get
(
0
).
isExpired
()).
isEqualTo
(
session
.
isExpired
());
...
@@ -72,10 +71,8 @@ public class SessionsEndpointTests {
...
@@ -72,10 +71,8 @@ public class SessionsEndpointTests {
SessionDescriptor
result
=
this
.
endpoint
.
getSession
(
session
.
getId
());
SessionDescriptor
result
=
this
.
endpoint
.
getSession
(
session
.
getId
());
assertThat
(
result
.
getId
()).
isEqualTo
(
session
.
getId
());
assertThat
(
result
.
getId
()).
isEqualTo
(
session
.
getId
());
assertThat
(
result
.
getAttributeNames
()).
isEqualTo
(
session
.
getAttributeNames
());
assertThat
(
result
.
getAttributeNames
()).
isEqualTo
(
session
.
getAttributeNames
());
assertThat
(
result
.
getCreationTime
())
assertThat
(
result
.
getCreationTime
()).
isEqualTo
(
session
.
getCreationTime
());
.
isEqualTo
(
session
.
getCreationTime
().
toEpochMilli
());
assertThat
(
result
.
getLastAccessedTime
()).
isEqualTo
(
session
.
getLastAccessedTime
());
assertThat
(
result
.
getLastAccessedTime
())
.
isEqualTo
(
session
.
getLastAccessedTime
().
toEpochMilli
());
assertThat
(
result
.
getMaxInactiveInterval
())
assertThat
(
result
.
getMaxInactiveInterval
())
.
isEqualTo
(
session
.
getMaxInactiveInterval
().
getSeconds
());
.
isEqualTo
(
session
.
getMaxInactiveInterval
().
getSeconds
());
assertThat
(
result
.
isExpired
()).
isEqualTo
(
session
.
isExpired
());
assertThat
(
result
.
isExpired
()).
isEqualTo
(
session
.
isExpired
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment