[java-opensaml] branch main updated: JJDBC-8 Update with no expiration fails

Rod Widdowson rdw at steadingsoftware.com
Sat Jun 25 10:47:57 UTC 2022


This is an automated email from the git hooks/post-receive script.

rdw 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=8f0b7261c89827d153de5dc3a881e802701c7c65

The following commit(s) were added to refs/heads/main by this push:
     new 8f0b7261c JJDBC-8 Update with no expiration fails
8f0b7261c is described below

commit 8f0b7261c89827d153de5dc3a881e802701c7c65
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Jun 25 11:45:55 2022 +0100

    JJDBC-8 Update with no expiration fails
    
    https://shibboleth.atlassian.net/browse/JJDBC-8
    
    Add regression test
---
 .../storage/testing/StorageServiceTest.java        | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/opensaml-storage-api/src/test/java/org/opensaml/storage/testing/StorageServiceTest.java b/opensaml-storage-api/src/test/java/org/opensaml/storage/testing/StorageServiceTest.java
index 5b7e02c63..a07a406dc 100644
--- a/opensaml-storage-api/src/test/java/org/opensaml/storage/testing/StorageServiceTest.java
+++ b/opensaml-storage-api/src/test/java/org/opensaml/storage/testing/StorageServiceTest.java
@@ -18,6 +18,7 @@
 package org.opensaml.storage.testing;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotEquals;
 
 import java.io.IOException;
 import java.security.SecureRandom;
@@ -159,6 +160,29 @@ public abstract class StorageServiceTest {
         Assert.assertEquals(rec.getVersion(), 2);
     }
     
+    @Test
+    public void update() throws ComponentInitializationException, IOException {
+        final String context = Long.toString(random.nextLong());
+        final String value = Long.toString(random.nextLong());
+        final String newValue = Long.toString(random.nextLong());
+        final Long expiration = System.currentTimeMillis() + 10000;
+
+        shared.create(context, context, value, expiration);
+        StorageRecord<Object> rec = shared.read(context, context);
+        assertEquals(rec.getValue(), value);
+        assertEquals(rec.getExpiration(), expiration);
+
+        shared.updateExpiration(context, context, expiration+50000);
+        rec = shared.read(context, context);
+        assertEquals(rec.getValue(), value);
+        assertNotEquals(rec.getExpiration(), expiration);
+
+        shared.update(context, context, newValue, expiration+100000);
+        rec = shared.read(context, context);
+        assertEquals(rec.getValue(), newValue);
+        assertNotEquals(rec.getExpiration(), expiration);
+    }
+
     @Test
     public void objects() throws IOException, InterruptedException {
         threadInit();

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list