Fixed ALF-10665: Immutable caches do not respond well to null (=> @@VALUE_NOT_FOUND@@)

- Immutable caches assume that values are correct and write through
 - Null value markers will get overridden


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31144 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-10-11 15:37:56 +00:00
parent 5aaf1ad850
commit f3c5571ef2
2 changed files with 30 additions and 6 deletions

View File

@@ -774,6 +774,33 @@ public class CacheTest extends TestCase
executeAndCheck(callback, false, COMMON_KEY, null);
executeAndCheck(callback, true, COMMON_KEY, null);
}
/**
* <ul>
* <li>Remove from the backing cache</li>
* <li>Add to the transactional cache</li>
* <li>Add to the backing cache</li>
* <li>Commit</li>
* </ul>
*/
public void testConcurrentAddAgainstAdd_NoPreExisting()throws Throwable
{
RetryingTransactionCallback<Object> callback = new RetryingTransactionCallback<Object>()
{
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
}
/**
* <ul>
* <li>Add to the backing cache</li>