exceptionfactory commented on a change in pull request #5041:
URL: https://github.com/apache/nifi/pull/5041#discussion_r622687141
##########
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:
That's unfortunate. In that case, what about just extending
`ScheduledThreadPoolExecutor` and overriding the one `scheduleAtFixedRate` that
`PeriodicStatusReporter` uses?
--
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]