VersionStatusUpdater extends ControllerMaintainer { @Override protected boolean maintain() { try { VersionStatus newStatus = VersionStatus.compute(controller()); controller().updateVersionStatus(newStatus); newStatus.systemVersion().ifPresent(version -> { controller().serviceRegistry().systemMonitor().reportSystemVersion(version.versionNumber(), convert(version.confidence())); }); return true; } catch (Exception e) { log.log(Level.WARNING, "Failed to compute version status: " + Exceptions.toMessageString(e) + ". Retrying in " + interval()); } return false; } VersionStatusUpdater(Controller controller, Duration interval);   }
@Test public void testVersionUpdating() { ControllerTester tester = new ControllerTester(); tester.controller().updateVersionStatus(new VersionStatus(Collections.emptyList())); assertFalse(tester.controller().versionStatus().systemVersion().isPresent()); VersionStatusUpdater updater = new VersionStatusUpdater(tester.controller(), Duration.ofDays(1) ); updater.maintain(); assertTrue(tester.controller().versionStatus().systemVersion().isPresent()); }