@Test @Ignore("This test should be run manually.") public void testListPrivilegesPerf() { int priDbCount = 1000; int priTableCount = 10; int authDbCount = 1200; int authTableCount = 1; Set<String> privileges = generatePrivilegeStrings(priDbCount, priTableCount); SimplePrivilegeCache cache = new SimplePrivilegeCache(privileges); List<Authorizable[]> authorizables = generateAuthoriables(12000, 10); System.out.println( "SimplePrivilegeCache - {privileges: db - " + priDbCount + ", table - " + priTableCount + "}, {authorizable: db - " + authDbCount + ", table - " + authTableCount + "}"); long start = System.currentTimeMillis(); for (Authorizable[] authorizableHierarchy : authorizables) { Set<String> priStrings = cache.listPrivileges(null, null, null); for (String priString : priStrings) { CommonPrivilege currPri = create(priString); currPri.getParts(); } } long end = System.currentTimeMillis(); System.out.println("SimplePrivilegeCache - total time on list string: " + (end - start) + " ms"); }
@Override public Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet) { if (cachedPrivileges == null) { cachedPrivileges = new HashSet<String>(); } return cachedPrivileges; }
SimplePrivilegeCache implements PrivilegeCache { @Override public Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet) { if (cachedPrivileges == null) { cachedPrivileges = new HashSet<String>(); } return cachedPrivileges; } }
SimplePrivilegeCache implements PrivilegeCache { @Override public Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet) { if (cachedPrivileges == null) { cachedPrivileges = new HashSet<String>(); } return cachedPrivileges; } SimplePrivilegeCache(Set<String> cachedPrivileges); }
SimplePrivilegeCache implements PrivilegeCache { @Override public Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet) { if (cachedPrivileges == null) { cachedPrivileges = new HashSet<String>(); } return cachedPrivileges; } SimplePrivilegeCache(Set<String> cachedPrivileges); @Override Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet); @Override void close(); @Override Set<String> listPrivileges(Set<String> groups, Set<String> users, ActiveRoleSet roleSet); }
SimplePrivilegeCache implements PrivilegeCache { @Override public Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet) { if (cachedPrivileges == null) { cachedPrivileges = new HashSet<String>(); } return cachedPrivileges; } SimplePrivilegeCache(Set<String> cachedPrivileges); @Override Set<String> listPrivileges(Set<String> groups, ActiveRoleSet roleSet); @Override void close(); @Override Set<String> listPrivileges(Set<String> groups, Set<String> users, ActiveRoleSet roleSet);  }