1
0
mirror of synced 2026-08-05 09:47:05 +00:00

SEC-2114: Polishing Spring Based Cache

This commit is contained in:
Rob Winch
2013-01-04 11:12:08 -06:00
parent 01ea39ce35
commit 6b81f97081
6 changed files with 41 additions and 121 deletions
@@ -1,7 +1,6 @@
package org.springframework.security.acls.jdbc;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.cache.Cache;
@@ -17,15 +16,14 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.util.FieldUtils;
import java.io.*;
import java.util.Map;
import static org.junit.Assert.*;
/**
* Tests {@link org.springframework.security.acls.domain.EhCacheBasedAclCache}
* Tests {@link org.springframework.security.acls.domain.SpringCacheBasedAclCache}
*
* @author Andrei Stefan
* @author Marten Deinum
*/
public class SpringCacheBasedAclCacheTests {
private static final String TARGET_CLASS = "org.springframework.security.acls.TargetObject";
@@ -55,6 +53,7 @@ public class SpringCacheBasedAclCacheTests {
new SpringCacheBasedAclCache(null, null, null);
}
@SuppressWarnings("rawtypes")
@Test
public void cacheOperationsAclWithoutParent() throws Exception {
Cache cache = getCache();
@@ -98,7 +97,7 @@ public class SpringCacheBasedAclCacheTests {
assertEquals(realCache.size(), 0);
}
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
@Test
public void cacheOperationsAclWithParent() throws Exception {
Cache cache = getCache();
@@ -140,33 +139,4 @@ public class SpringCacheBasedAclCacheTests {
assertNotNull(FieldUtils.getFieldValue(parentAclFromCache, "aclAuthorizationStrategy"));
assertEquals(parentAcl, myCache.getFromCache(identityParent));
}
//~ Inner Classes ==================================================================================================
private class MockCache implements Cache {
@Override
public String getName() {
return "mockcache";
}
@Override
public Object getNativeCache() {
return null;
}
@Override
public ValueWrapper get(Object key) {
return null;
}
@Override
public void put(Object key, Object value) {}
@Override
public void evict(Object key) {}
@Override
public void clear() {}
}
}