mattyb149 commented on a change in pull request #5041:
URL: https://github.com/apache/nifi/pull/5041#discussion_r622685681



##########
File path: 
minifi/minifi-bootstrap/src/test/java/org/apache/nifi/minifi/bootstrap/status/reporters/StatusLoggerTest.java
##########
@@ -194,16 +209,81 @@ public void TestErrorException() throws IOException {
         
Mockito.when(queryableStatusAggregator.statusReport(MOCK_QUERY)).thenThrow(ioException);
 
         statusLogger.initialize(getProperties(LogLevel.ERROR), 
queryableStatusAggregator);
+        statusLogger.setScheduledExecutorService(new 
RunOnceScheduledExecutorService());
         statusLogger.start();
 
         verify(logger, 
Mockito.timeout(300).atLeastOnce()).error(ENCOUNTERED_IO_EXCEPTION, 
ioException);
     }
 
-    private static Properties getProperties(LogLevel logLevel){
+    private static Properties getProperties(LogLevel logLevel) {
         Properties properties = new Properties();
-        properties.setProperty(REPORT_PERIOD_KEY, "100");
+        properties.setProperty(REPORT_PERIOD_KEY, "1");
         properties.setProperty(LOGGING_LEVEL_KEY, logLevel.name());
         properties.setProperty(QUERY_KEY, MOCK_QUERY);
         return properties;
     }
+
+    private static class RunOnceScheduledExecutorService extends 
AbstractExecutorService implements ScheduledExecutorService {

Review comment:
       Hmm, looks like you can't use the current thread to schedule Runnables 
"after the fact", getting IllegalThreadStateExceptions




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to