Source:
<code>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(), <START> SECURITY_REFRESH_PERIOD, "1s")); <END> 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); }); }</code><technical_language>10ms ? this test takes 4s, faster</technical_language>

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); }); }