[java-opensaml] branch main updated: OSJ-413 - StorageService implementations compare version improperly
Scott Cantor
cantor.2 at osu.edu
Wed Sep 4 12:41:04 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=9ee3353e8b88fbfdbb4b0e54a3b12b91ed05dc96
The following commit(s) were added to refs/heads/main by this push:
new 9ee3353e8 OSJ-413 - StorageService implementations compare version improperly
9ee3353e8 is described below
commit 9ee3353e8b88fbfdbb4b0e54a3b12b91ed05dc96
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Sep 4 08:40:57 2024 -0400
OSJ-413 - StorageService implementations compare version improperly
https://shibboleth.atlassian.net/browse/OSJ-413
Add a unit test.
---
.../storage/testing/StorageServiceTest.java | 24 +++++++++-------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/opensaml-testing/src/main/java/org/opensaml/storage/testing/StorageServiceTest.java b/opensaml-testing/src/main/java/org/opensaml/storage/testing/StorageServiceTest.java
index e76cf04f4..79433a4b6 100644
--- a/opensaml-testing/src/main/java/org/opensaml/storage/testing/StorageServiceTest.java
+++ b/opensaml-testing/src/main/java/org/opensaml/storage/testing/StorageServiceTest.java
@@ -165,13 +165,13 @@ public abstract class StorageServiceTest {
}
/**
- * Test of versioned update.
+ * Test of versions > 127.
*
- * @throws IOException on error
- * @throws VersionMismatchException on record version mismatch
+ * @throws IOException
+ * @throws VersionMismatchException
*/
@Test
- public void updates() throws IOException, VersionMismatchException {
+ public void versions() throws IOException, VersionMismatchException {
threadInit();
final String key = "key";
@@ -179,20 +179,16 @@ public abstract class StorageServiceTest {
shared.create(context, key, "foo", null);
- assertEquals(shared.updateWithVersion(1, context, key, "bar", null), 2);
-
- try {
- shared.updateWithVersion(1, context, key, "baz", null);
- Assert.fail("updateStringWithVersion should have failed");
- } catch (final VersionMismatchException e) {
- // expected
+ for (long i = 1; i < 130; i++) {
+ shared.updateWithVersion(i, context, key, "foo" + i, null);
}
final StorageRecord<?> rec = shared.read(context, key);
- assert rec!=null;
- Assert.assertEquals(rec.getVersion(), 2);
+ assert rec != null;
+ Assert.assertEquals(rec.getVersion(), 130);
+ Assert.assertEquals(rec.getValue(), "foo129");
}
-
+
/**
* Test updates.
*
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list