diff --git a/source/java/org/alfresco/repo/cache/CacheTest.java b/source/java/org/alfresco/repo/cache/CacheTest.java index 621dd0e64e..c129c0ad50 100644 --- a/source/java/org/alfresco/repo/cache/CacheTest.java +++ b/source/java/org/alfresco/repo/cache/CacheTest.java @@ -774,6 +774,33 @@ public class CacheTest extends TestCase executeAndCheck(callback, false, COMMON_KEY, null); executeAndCheck(callback, true, COMMON_KEY, null); } + /** + * + */ + public void testConcurrentAddAgainstAdd_NoPreExisting()throws Throwable + { + RetryingTransactionCallback callback = new RetryingTransactionCallback() + { + public Object execute() throws Throwable + { + backingCache.remove(COMMON_KEY); + transactionalCache.put(COMMON_KEY, "aaa2-x"); + backingCache.put(COMMON_KEY, "aaa2"); + return null; + } + }; + transactionalCache.setMutable(true); + executeAndCheck(callback, false, COMMON_KEY, null); + executeAndCheck(callback, true, COMMON_KEY, "aaa2"); // Doesn't write through + transactionalCache.setMutable(false); + executeAndCheck(callback, false, COMMON_KEY, "aaa2-x"); // Always overwrites + executeAndCheck(callback, true, COMMON_KEY, "aaa2-x"); // Always overwrites + } /** *