MichaelMorrisEst commented on code in PR #3501:
URL: https://github.com/apache/logging-log4j2/pull/3501#discussion_r2007304033


##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/LoggerTest.java:
##########
@@ -544,6 +544,30 @@ void testReconfiguration(final LoggerContext context) 
throws Exception {
         assertNotSame(newConfig, oldConfig, "Reconfiguration failed");
     }
 
+    @Test
+    void testReconfigurationMonitorUris(final LoggerContext context) throws 
Exception {
+        final Configuration oldConfig = context.getConfiguration();
+        final int MONITOR_INTERVAL_SECONDS = 5;
+        final File file = new 
File("target/test-classes/org/apache/logging/log4j/core/net/ssl/keyStore.p12");
+        final long orig = file.lastModified();
+        final long newTime = orig + 10000;
+        assertTrue(file.setLastModified(newTime), "setLastModified should have 
succeeded.");
+        TimeUnit.SECONDS.sleep(MONITOR_INTERVAL_SECONDS + 1);
+        for (int i = 0; i < 17; ++i) {
+            logger.debug("Reconfigure");
+        }
+        Thread.sleep(100);
+        for (int i = 0; i < 20; i++) {
+            if (context.getConfiguration() != oldConfig) {
+                break;
+            }
+            Thread.sleep(50);
+        }

Review Comment:
   Used Awatility in new test class  



##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/LoggerTest.java:
##########
@@ -544,6 +544,30 @@ void testReconfiguration(final LoggerContext context) 
throws Exception {
         assertNotSame(newConfig, oldConfig, "Reconfiguration failed");
     }
 
+    @Test
+    void testReconfigurationMonitorUris(final LoggerContext context) throws 
Exception {
+        final Configuration oldConfig = context.getConfiguration();
+        final int MONITOR_INTERVAL_SECONDS = 5;
+        final File file = new 
File("target/test-classes/org/apache/logging/log4j/core/net/ssl/keyStore.p12");
+        final long orig = file.lastModified();
+        final long newTime = orig + 10000;
+        assertTrue(file.setLastModified(newTime), "setLastModified should have 
succeeded.");
+        TimeUnit.SECONDS.sleep(MONITOR_INTERVAL_SECONDS + 1);

Review Comment:
   Done



-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to