jeanouii commented on code in PR #1629:
URL: https://github.com/apache/activemq/pull/1629#discussion_r2720463476
##########
activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java:
##########
@@ -92,10 +94,10 @@ public void testLoginReload() throws Exception {
//Modify the file and test that the properties are reloaded
Thread.sleep(1000);
- FileUtils.copyFile(new File(sourcePropDir, "usersReload.properties"),
usersFile);
- FileUtils.copyFile(new File(sourcePropDir, "groupsReload.properties"),
groupsFile);
- FileUtils.touch(usersFile);
- FileUtils.touch(groupsFile);
+ Files.copy(new File(sourcePropDir, "usersReload.properties").toPath(),
usersFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ Files.copy(new File(sourcePropDir,
"groupsReload.properties").toPath(), groupsFile.toPath(),
StandardCopyOption.REPLACE_EXISTING);
+ Files.setLastModifiedTime(usersFile.toPath(),
FileTime.from(Instant.now()));
Review Comment:
Attributes are not guaranteed to be copied actually, unless you add
COPY_ATTRIBUTES option at the end. This is JVM specific so you might get the
source file's timestamp or the current time of the copy.
So strictly speaking, to mimic FileUtiles.touch(), setting last modified
date makes sense here to trigger reloading for instance.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact