@Test public void testListPrivilegesWildCard() { CommonPrivilege t1D1Select = create(new KeyValue("Server", "server1"), new KeyValue("db", "db1"), new KeyValue("table", "t1"), new KeyValue("action", "SELECT")); CommonPrivilege t1D2Select = create(new KeyValue("Server", "server1"), new KeyValue("db", "db2"), new KeyValue("table", "t1"), new KeyValue("action", "SELECT")); CommonPrivilege t2Select = create(new KeyValue("Server", "server1"), new KeyValue("db", "db1"), new KeyValue("table", "t2"), new KeyValue("action", "SELECT")); CommonPrivilege wildCardTable = create(new KeyValue("Server", "server1"), new KeyValue("db", "db1"), new KeyValue("table", "*"), new KeyValue("action", "SELECT")); CommonPrivilege allTable = create(new KeyValue("Server", "server1"), new KeyValue("db", "db1"), new KeyValue("table", "ALL"), new KeyValue("action", "SELECT")); CommonPrivilege allDatabase = create(new KeyValue("Server", "server1"), new KeyValue("db", "*")); CommonPrivilege colSelect = create(new KeyValue("Server", "server1"), new KeyValue("db", "db1"), new KeyValue("table", "t1"), new KeyValue("column", "c1"), new KeyValue("action", "SELECT")); SimplePrivilegeCache cache = new SimplePrivilegeCache(Sets.newHashSet(t1D1Select.toString(), t1D2Select.toString(), t2Select.toString(), wildCardTable.toString(), allTable.toString(), allDatabase.toString(), colSelect.toString())); assertEquals(7, cache.listPrivileges(null, null, null).size()); }
@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);  }