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
4b59d5f5
Commit
4b59d5f5
authored
Jan 11, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rationalize AuditEventRepository contract
Closes gh-11331
parent
644925e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
36 deletions
+8
-36
AuditEventRepository.java
...ingframework/boot/actuate/audit/AuditEventRepository.java
+1
-19
InMemoryAuditEventRepository.java
...work/boot/actuate/audit/InMemoryAuditEventRepository.java
+1
-11
InMemoryAuditEventRepositoryTests.java
...boot/actuate/audit/InMemoryAuditEventRepositoryTests.java
+6
-6
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/AuditEventRepository.java
View file @
4b59d5f5
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -33,24 +33,6 @@ public interface AuditEventRepository {
*/
void
add
(
AuditEvent
event
);
/**
* Find audit events since the time provided.
* @param after timestamp of earliest result required (or {@code null} if
* unrestricted)
* @return audit events
* @since 1.4.0
*/
List
<
AuditEvent
>
find
(
Date
after
);
/**
* Find audit events relating to the specified principal since the time provided.
* @param principal the principal name to search for (or {@code null} if unrestricted)
* @param after timestamp of earliest result required (or {@code null} if
* unrestricted)
* @return audit events relating to the principal
*/
List
<
AuditEvent
>
find
(
String
principal
,
Date
after
);
/**
* Find audit events of specified type relating to the specified principal since the
* time provided.
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepository.java
View file @
4b59d5f5
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -69,16 +69,6 @@ public class InMemoryAuditEventRepository implements AuditEventRepository {
}
}
@Override
public
List
<
AuditEvent
>
find
(
Date
after
)
{
return
find
(
null
,
after
,
null
);
}
@Override
public
List
<
AuditEvent
>
find
(
String
principal
,
Date
after
)
{
return
find
(
principal
,
after
,
null
);
}
@Override
public
List
<
AuditEvent
>
find
(
String
principal
,
Date
after
,
String
type
)
{
LinkedList
<
AuditEvent
>
events
=
new
LinkedList
<>();
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/InMemoryAuditEventRepositoryTests.java
View file @
4b59d5f5
/*
* 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");
* you may not use this file except in compliance with the License.
...
...
@@ -45,7 +45,7 @@ public class InMemoryAuditEventRepositoryTests {
InMemoryAuditEventRepository
repository
=
new
InMemoryAuditEventRepository
();
repository
.
add
(
new
AuditEvent
(
"dave"
,
"a"
));
repository
.
add
(
new
AuditEvent
(
"dave"
,
"b"
));
List
<
AuditEvent
>
events
=
repository
.
find
(
"dave"
,
null
);
List
<
AuditEvent
>
events
=
repository
.
find
(
"dave"
,
null
,
null
);
assertThat
(
events
.
size
()).
isEqualTo
(
2
);
assertThat
(
events
.
get
(
0
).
getType
()).
isEqualTo
(
"a"
);
assertThat
(
events
.
get
(
1
).
getType
()).
isEqualTo
(
"b"
);
...
...
@@ -57,7 +57,7 @@ public class InMemoryAuditEventRepositoryTests {
repository
.
add
(
new
AuditEvent
(
"dave"
,
"a"
));
repository
.
add
(
new
AuditEvent
(
"dave"
,
"b"
));
repository
.
add
(
new
AuditEvent
(
"dave"
,
"c"
));
List
<
AuditEvent
>
events
=
repository
.
find
(
"dave"
,
null
);
List
<
AuditEvent
>
events
=
repository
.
find
(
"dave"
,
null
,
null
);
assertThat
(
events
.
size
()).
isEqualTo
(
2
);
assertThat
(
events
.
get
(
0
).
getType
()).
isEqualTo
(
"b"
);
assertThat
(
events
.
get
(
1
).
getType
()).
isEqualTo
(
"c"
);
...
...
@@ -78,7 +78,7 @@ public class InMemoryAuditEventRepositoryTests {
repository
.
add
(
new
AuditEvent
(
"phil"
,
"b"
));
repository
.
add
(
new
AuditEvent
(
"dave"
,
"c"
));
repository
.
add
(
new
AuditEvent
(
"phil"
,
"d"
));
List
<
AuditEvent
>
events
=
repository
.
find
(
"dave"
,
null
);
List
<
AuditEvent
>
events
=
repository
.
find
(
"dave"
,
null
,
null
);
assertThat
(
events
.
size
()).
isEqualTo
(
2
);
assertThat
(
events
.
get
(
0
).
getType
()).
isEqualTo
(
"a"
);
assertThat
(
events
.
get
(
1
).
getType
()).
isEqualTo
(
"c"
);
...
...
@@ -113,11 +113,11 @@ public class InMemoryAuditEventRepositoryTests {
calendar
.
add
(
Calendar
.
DAY_OF_YEAR
,
1
);
repository
.
add
(
new
AuditEvent
(
calendar
.
getTime
(),
"phil"
,
"d"
,
data
));
calendar
.
add
(
Calendar
.
DAY_OF_YEAR
,
1
);
List
<
AuditEvent
>
events
=
repository
.
find
(
after
);
List
<
AuditEvent
>
events
=
repository
.
find
(
null
,
after
,
null
);
assertThat
(
events
.
size
()).
isEqualTo
(
2
);
assertThat
(
events
.
get
(
0
).
getType
()).
isEqualTo
(
"c"
);
assertThat
(
events
.
get
(
1
).
getType
()).
isEqualTo
(
"d"
);
events
=
repository
.
find
(
"dave"
,
after
);
events
=
repository
.
find
(
"dave"
,
after
,
null
);
assertThat
(
events
.
size
()).
isEqualTo
(
1
);
assertThat
(
events
.
get
(
0
).
getType
()).
isEqualTo
(
"c"
);
}
...
...
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