ZpeUpdPolLoader implements Closeable { void loadDb() { if (updMonWorker == null) { updMonWorker = new ZpeUpdMonitor(this); } if (skipPolicyDirCheck) { return; } File[] polFileNames = updMonWorker.loadFileStatus(); loadDb(polFileNames); } 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 testLoadDb() throws Exception { System.out.println("TestZpeUpdPolLoader: testLoadDb: dir=" + TEST_POL_DIR); java.nio.file.Path dirPath = java.nio.file.Paths.get(TEST_POL_DIR); try { java.nio.file.Files.createDirectory(dirPath); } catch (java.nio.file.FileAlreadyExistsException ignored) { } ZpeUpdPolLoader loader = new ZpeUpdPolLoader(TEST_POL_DIR); java.nio.file.Path badFile = java.nio.file.Paths.get(TEST_POL_DIR, TEST_POL_FILE); java.nio.file.Files.deleteIfExists(badFile); java.io.File polFile = new java.io.File(TEST_POL_DIR, TEST_POL_FILE); polFile.createNewFile(); java.io.File [] files = { polFile }; loader.loadDb(files); long lastModMilliSeconds = polFile.lastModified(); java.util.Map<String, ZpeUpdPolLoader.ZpeFileStatus> fsmap = loader.getFileStatusMap(); ZpeUpdPolLoader.ZpeFileStatus fstat = fsmap.get(polFile.getName()); assertFalse(fstat.validPolFile); java.nio.file.Path goodFile = java.nio.file.Paths.get(TEST_POL_GOOD_FILE); java.nio.file.Files.copy(goodFile, badFile, java.nio.file.StandardCopyOption.REPLACE_EXISTING); loader.loadDb(files); long lastModMilliSeconds2 = polFile.lastModified(); fsmap = loader.getFileStatusMap(); fstat = fsmap.get(polFile.getName()); assertTrue(fstat.validPolFile); loader.close(); System.out.println("TestZpeUpdPolLoader: testLoadDb: timestamp1=" + lastModMilliSeconds + " timestamp2=" + lastModMilliSeconds2); }