Source:
public void testRefreshing() throws Exception { TransactionManager transactionManager = createTestTransactionManager(); AccessControlManager accessControlManager = new AccessControlManager(transactionManager); File configFile = newTemporaryFile(); configFile.deleteOnExit(); copy(new File(getResourcePath("catalog.json")), configFile); accessControlManager.setSystemAccessControl(FileBasedSystemAccessControl.NAME, ImmutableMap.of( SECURITY_CONFIG_FILE, configFile.getAbsolutePath(), SECURITY_REFRESH_PERIOD, "1s")); transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); accessControlManager.checkCanCreateView(transactionId, alice, aliceView); accessControlManager.checkCanCreateView(transactionId, alice, aliceView); }); copy(new File(getResourcePath("security-config-file-with-unknown-rules.json")), configFile); sleep(2000); assertThatThrownBy(() -> transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); })) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Invalid JSON file"); assertThatThrownBy(() -> transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); })) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Invalid JSON file"); copy(new File(getResourcePath("catalog.json")), configFile); sleep(2000); transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); }); }

Target:
public void testRefreshing() throws Exception { TransactionManager transactionManager = createTestTransactionManager(); AccessControlManager accessControlManager = new AccessControlManager(transactionManager); File configFile = newTemporaryFile(); configFile.deleteOnExit(); copy(new File(getResourcePath("catalog.json")), configFile); accessControlManager.setSystemAccessControl(FileBasedSystemAccessControl.NAME, ImmutableMap.of( SECURITY_CONFIG_FILE, configFile.getAbsolutePath(), SECURITY_REFRESH_PERIOD, "1ms")); transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); accessControlManager.checkCanCreateView(transactionId, alice, aliceView); accessControlManager.checkCanCreateView(transactionId, alice, aliceView); }); copy(new File(getResourcePath("security-config-file-with-unknown-rules.json")), configFile); sleep(2); assertThatThrownBy(() -> transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); })) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Invalid JSON file"); assertThatThrownBy(() -> transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); })) .isInstanceOf(IllegalArgumentException.class) .hasMessageStartingWith("Invalid JSON file"); copy(new File(getResourcePath("catalog.json")), configFile); sleep(2); transaction(transactionManager, accessControlManager) .execute(transactionId -> { accessControlManager.checkCanCreateView(transactionId, alice, aliceView); }); }