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
20ff7647
Commit
20ff7647
authored
Nov 29, 2019
by
dreis2211
Committed by
Madhura Bhave
Dec 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Increase cache ttl in CachingOperationInvokerTests
See gh-19193
parent
bc53fe03
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
CachingOperationInvokerTests.java
.../endpoint/invoker/cache/CachingOperationInvokerTests.java
+8
-5
No files found.
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/invoker/cache/CachingOperationInvokerTests.java
View file @
20ff7647
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
actuate
.
endpoint
.
invoker
.
cache
;
import
java.security.Principal
;
import
java.time.Duration
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.HashMap
;
...
...
@@ -48,6 +49,8 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
*/
public
class
CachingOperationInvokerTests
{
private
static
final
long
CACHE_TTL
=
Duration
.
ofHours
(
1
).
toMillis
();
@Test
public
void
createInstanceWithTtlSetToZero
()
{
assertThatIllegalArgumentException
()
...
...
@@ -73,7 +76,7 @@ public class CachingOperationInvokerTests {
MonoOperationInvoker
.
invocations
=
0
;
MonoOperationInvoker
target
=
new
MonoOperationInvoker
();
InvocationContext
context
=
new
InvocationContext
(
mock
(
SecurityContext
.
class
),
Collections
.
emptyMap
());
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
500
L
);
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
CACHE_TT
L
);
Object
response
=
((
Mono
<?>)
invoker
.
invoke
(
context
)).
block
();
Object
cachedResponse
=
((
Mono
<?>)
invoker
.
invoke
(
context
)).
block
();
assertThat
(
MonoOperationInvoker
.
invocations
).
isEqualTo
(
1
);
...
...
@@ -85,7 +88,7 @@ public class CachingOperationInvokerTests {
FluxOperationInvoker
.
invocations
=
0
;
FluxOperationInvoker
target
=
new
FluxOperationInvoker
();
InvocationContext
context
=
new
InvocationContext
(
mock
(
SecurityContext
.
class
),
Collections
.
emptyMap
());
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
500
L
);
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
CACHE_TT
L
);
Object
response
=
((
Flux
<?>)
invoker
.
invoke
(
context
)).
blockLast
();
Object
cachedResponse
=
((
Flux
<?>)
invoker
.
invoke
(
context
)).
blockLast
();
assertThat
(
FluxOperationInvoker
.
invocations
).
isEqualTo
(
1
);
...
...
@@ -97,7 +100,7 @@ public class CachingOperationInvokerTests {
Object
expected
=
new
Object
();
InvocationContext
context
=
new
InvocationContext
(
mock
(
SecurityContext
.
class
),
parameters
);
given
(
target
.
invoke
(
context
)).
willReturn
(
expected
);
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
500
L
);
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
CACHE_TT
L
);
Object
response
=
invoker
.
invoke
(
context
);
assertThat
(
response
).
isSameAs
(
expected
);
verify
(
target
,
times
(
1
)).
invoke
(
context
);
...
...
@@ -114,7 +117,7 @@ public class CachingOperationInvokerTests {
parameters
.
put
(
"something"
,
null
);
InvocationContext
context
=
new
InvocationContext
(
mock
(
SecurityContext
.
class
),
parameters
);
given
(
target
.
invoke
(
context
)).
willReturn
(
new
Object
());
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
500
L
);
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
CACHE_TT
L
);
invoker
.
invoke
(
context
);
invoker
.
invoke
(
context
);
invoker
.
invoke
(
context
);
...
...
@@ -129,7 +132,7 @@ public class CachingOperationInvokerTests {
given
(
securityContext
.
getPrincipal
()).
willReturn
(
mock
(
Principal
.
class
));
InvocationContext
context
=
new
InvocationContext
(
securityContext
,
parameters
);
given
(
target
.
invoke
(
context
)).
willReturn
(
new
Object
());
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
500
L
);
CachingOperationInvoker
invoker
=
new
CachingOperationInvoker
(
target
,
CACHE_TT
L
);
invoker
.
invoke
(
context
);
invoker
.
invoke
(
context
);
invoker
.
invoke
(
context
);
...
...
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