-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change UID2-Shared for OptOut Policy Check #127
Change UID2-Shared for OptOut Policy Check #127
Conversation
71c7834
to
b1a55c1
Compare
8fed857
to
4897aef
Compare
List<ClientKey> keys = reader.getSnapshot().values().stream() | ||
.filter(k -> k.getSiteId() == siteId) // filter by site id | ||
.sorted(Comparator.comparing(ClientKey::getCreated)) // sort by key creation timestamp ascending | ||
.collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would findFirst()
be more appropriate here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced get(0)
with findFirst()
as suggested.
@@ -93,4 +95,12 @@ public CloudPath getMetadataPath() { | |||
public IAuthorizable get(String key) { | |||
return getClientKey(key); | |||
} | |||
|
|||
public ClientKey getOldestClientKey(int siteId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a method on the snapshot instead? This is not really specific to the rotating provider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our slack discussion, we'll keep getOldestClientKey() here, and refactor RotatingClientKeyProvider in UID2-1901
|
||
public class RotatingClientKeyProviderTest { | ||
@Test | ||
public void testGetOldestClientKeyBySiteId() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test for when site does not have any keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test case added as suggested.
4897aef
to
e47848f
Compare
4d8bdd3
to
d434c01
Compare
595af36
to
66f6cf6
Compare
getOldestClientKey()
to RotatingClientKeyProvider.java