[java-opensaml COMMIT] /trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java

noreply at shibboleth.net noreply at shibboleth.net
Tue Apr 30 14:48:07 EDT 2013


Author: scantor
Date: Tue Apr 30 14:48:07 2013
New Revision: 3326

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3326&view=rev
Log:
Add versioned update test.

Modified:
    trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java

Modified: trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java?rev=3326&r1=3325&r2=3326&view=diff
==============================================================================
--- trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java (original)
+++ trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java Tue Apr 30 14:48:07 2013
@@ -145,4 +145,24 @@
         }
     }
     
+    @Test
+    public void updates() throws IOException, VersionMismatchException {
+        String key = "key";
+        String context = Long.toString(random.nextLong());
+        
+        shared.createString(context, key, "foo");
+        
+        shared.updateStringWithVersion(1, context, key, "bar");
+        
+        try {
+            shared.updateStringWithVersion(1, context, key, "baz");
+            Assert.fail("updateStringWithVersion should have failed");
+        } catch (VersionMismatchException e) {
+            // expected
+        }
+        
+        StorageRecord rec = shared.readString(context, key);
+        Assert.assertNotNull(rec);
+        Assert.assertEquals(rec.getVersion(), 2);
+    }
 }



More information about the commits mailing list