Author: bdaw
Date: 2010-08-10 07:25:05 -0400 (Tue, 10 Aug 2010)
New Revision: 351
Modified:
idm/trunk/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java
Log:
- PLIDM-22 - Role cache not properly invalidated
Modified:
idm/trunk/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
===================================================================
---
idm/trunk/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2010-08-10
11:03:57 UTC (rev 350)
+++
idm/trunk/picketlink-idm-cache/src/main/java/org/picketlink/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2010-08-10
11:25:05 UTC (rev 351)
@@ -801,6 +801,11 @@
cache.getRoot().removeChild(getFqn(ns, NODE_RELATIONSHIP_SEARCHES));
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_SEARCHES));
cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_TYPE_SEARCHES));
+
+ // Probably should have separate invalidate methods, but for now need to be part of
search invalidation
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLES));
+ cache.getRoot().removeChild(getFqn(ns, NODE_ROLE_TYPES));
+
if (log.isLoggable(Level.FINER))
{
log.finer(this.toString() + "Invalidating all searches. Namespace:" +
ns);
Modified:
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java
===================================================================
---
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java 2010-08-10
11:03:57 UTC (rev 350)
+++
idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java 2010-08-10
11:25:05 UTC (rev 351)
@@ -273,9 +273,24 @@
assertEquals(0, session.getRoleManager().findUserRoleTypes(user1).size());
assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getKey(),
null).size());
-
+ // Create roleType and role, remove roleType and check if role was properly
removed
+ session.getPersistenceManager().createUser("u1");
+ Group g1 = session.getPersistenceManager().createGroup("g1",
ORGANIZATION);
+
+ //session.getRoleManager().createRoleType("rt1");
+
+ session.getRoleManager().createRole("rt1", "u1", g1.getKey());
+
+ assertNotNull(session.getRoleManager().getRole("rt1","u1",
g1.getKey()));
+
+ session.getRoleManager().removeRoleType("rt1");
+
+ assertNull(session.getRoleManager().getRole("rt1","u1",
g1.getKey()));
+
+
+
ctx.commit();
}