ZpeUpdPolLoader implements Closeable { ZpeMatch getMatchObject(String value) { ZpeMatch match; if ("*".equals(value)) { match = new ZpeMatchAll(); } else { int anyCharMatch = value.indexOf('*'); int singleCharMatch = value.indexOf('?'); if (anyCharMatch == -1 && singleCharMatch == -1) { match = new ZpeMatchEqual(value); } else if (anyCharMatch == value.length() - 1 && singleCharMatch == -1) { match = new ZpeMatchStartsWith(value.substring(0, value.length() - 1)); } else { match = new ZpeMatchRegex(value); } } return match; } ZpeUpdPolLoader(String dirName); Map<String, List<Struct>> getWildcardRoleAllowMap(String domainName); Map<String, List<Struct>> getStandardRoleAllowMap(String domainName); Map<String, List<Struct>> getWildcardRoleDenyMap(String domainName); Map<String, List<Struct>> getStandardRoleDenyMap(String domainName); static Map<String, RoleToken> getRoleTokenCacheMap(); static Map<String, AccessToken> getAccessTokenCacheMap(); void start(); @Override void close(); static void cleanupRoleTokenCache(); static void cleanupAccessTokenCache();  }
@Test public void testGetMatchObject() { try (ZpeUpdPolLoader loader = new ZpeUpdPolLoader(null)) { ZpeMatch matchObject = loader.getMatchObject("*"); assertTrue(matchObject instanceof ZpeMatchAll); matchObject = loader.getMatchObject("**"); assertTrue(matchObject instanceof ZpeMatchRegex); matchObject = loader.getMatchObject("?*"); assertTrue(matchObject instanceof ZpeMatchRegex); matchObject = loader.getMatchObject("?"); assertTrue(matchObject instanceof ZpeMatchRegex); matchObject = loader.getMatchObject("test?again*"); assertTrue(matchObject instanceof ZpeMatchRegex); matchObject = loader.getMatchObject("*test"); assertTrue(matchObject instanceof ZpeMatchRegex); matchObject = loader.getMatchObject("test"); assertTrue(matchObject instanceof ZpeMatchEqual); matchObject = loader.getMatchObject("(test|again)"); assertTrue(matchObject instanceof ZpeMatchEqual); matchObject = loader.getMatchObject("test*"); assertTrue(matchObject instanceof ZpeMatchStartsWith); } }