[java-idp-plugin-webauthn] branch main updated: Add another read write test to the credential repository tests
Phil Smart
philip.smart at jisc.ac.uk
Tue Oct 29 15:48:51 UTC 2024
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-idp-plugin-webauthn.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-webauthn.git;a=commit;h=3aed9496890db1eebda2ad1108e04b813006e5e2
The following commit(s) were added to refs/heads/main by this push:
new 3aed949 Add another read write test to the credential repository tests
3aed949 is described below
commit 3aed9496890db1eebda2ad1108e04b813006e5e2
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Oct 29 15:48:49 2024 +0000
Add another read write test to the credential repository tests
---
...IdPStorageServiceCredentialRespositoryTest.java | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
index f9c0678..fe30485 100644
--- a/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
+++ b/webauthn-impl/src/test/java/net/shibboleth/idp/plugin/authn/webauthn/storage/impl/IdPStorageServiceCredentialRespositoryTest.java
@@ -668,6 +668,35 @@ public class IdPStorageServiceCredentialRespositoryTest extends AbstractWebAuthn
}
+ /* Write to one user whilst reading from another user.*/
+ @Test
+ public final void testPerformanceAddRead() throws Exception {
+
+ // Add a registration which we will read from.
+ final CredentialRecord registrationToRead =
+ createRegistration("read-user", "Read User", "user-handle-read".getBytes());
+ repo.addRegistrationByUsername("read-user", registrationToRead);
+
+ // Create a registration to write too
+ final CredentialRecord registration = createRegistration("jdoe", "John Doe", "user-handle".getBytes());
+
+ final ExecutorService service = Executors.newFixedThreadPool(3);
+ final Collection<Future<Boolean>> futures = new ArrayList<>(3);
+
+ futures.add(service.submit(()->repo.addRegistrationByUsername("jdoe", registration)));
+ futures.add(service.submit(()-> {
+ final var regs = repo.getRegistrationsByUsername("read-user");
+ return regs.size() == 1;
+ }));
+
+ for (final Future<Boolean> f : futures) {
+ final Boolean success = f.get();
+ assertTrue(success);
+ }
+ assertEquals(repo.getCredentialIdsForUsername("jdoe").size(), 1);
+
+ }
+
/* Failure here would be non-deterministic if it happened.*/
@Test
public final void testThreadSafetyAddRead() throws Exception {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list