@Test public void testMonitoringController() throws IOException { final MonitoringConfiguration configuration = new MonitoringConfiguration(); configuration.setInitialDelay(5); configuration.setPeriod(5); try (DeploymentStateMonitorController controller = new DeploymentStateMonitorController(configuration, dataManager)) { new PublishingStateMonitor(controller, client, dataManager) { @Override protected Pod getPod(String podName) { final Pod pod; switch (podName) { case BUILD_POD_NAME: pod = buildPod; break; case DEPLOYER_POD_NAME: pod = deployerPod; break; default: pod = null; } return pod; } @Override protected Optional<Build> getBuild(String integrationId, String version) { return Optional.ofNullable(build); } @Override protected Optional<ReplicationController> getReplicationController(String integrationId, String version) { return Optional.ofNullable(replicationController); } @Override protected PodList getDeploymentPodList(String integrationId, String version) { final PodListBuilder builder = new PodListBuilder(); return deploymentPod == null ? builder.build() : builder.addToItems(deploymentPod).build(); } }; controller.open(); given().await() .atMost(Duration.ofSeconds(20)) .pollInterval(Duration.ofSeconds(5)) .untilAsserted(() -> assertEquals(expectedDetails, dataManager.fetch(IntegrationDeploymentStateDetails.class, DEPLOYMENT_ID))); } }
@PostConstruct @SuppressWarnings("FutureReturnValueIgnored") public void open() { LOGGER.info("Starting deployment state monitor."); scheduler.scheduleWithFixedDelay(this, configuration.getInitialDelay(), configuration.getPeriod(), TimeUnit.SECONDS); }
DeploymentStateMonitorController implements Runnable, Closeable, DeploymentStateMonitor { @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") public void open() { LOGGER.info("Starting deployment state monitor."); scheduler.scheduleWithFixedDelay(this, configuration.getInitialDelay(), configuration.getPeriod(), TimeUnit.SECONDS); } }
DeploymentStateMonitorController implements Runnable, Closeable, DeploymentStateMonitor { @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") public void open() { LOGGER.info("Starting deployment state monitor."); scheduler.scheduleWithFixedDelay(this, configuration.getInitialDelay(), configuration.getPeriod(), TimeUnit.SECONDS); } @Autowired  DeploymentStateMonitorController(MonitoringConfiguration configuration, DataManager dataManager); }
DeploymentStateMonitorController implements Runnable, Closeable, DeploymentStateMonitor { @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") public void open() { LOGGER.info("Starting deployment state monitor."); scheduler.scheduleWithFixedDelay(this, configuration.getInitialDelay(), configuration.getPeriod(), TimeUnit.SECONDS); } @Autowired  DeploymentStateMonitorController(MonitoringConfiguration configuration, DataManager dataManager); @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") void open(); @Override void close(); @Override void run(); @Override void register(IntegrationDeploymentState state, StateHandler stateHandler); }
DeploymentStateMonitorController implements Runnable, Closeable, DeploymentStateMonitor { @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") public void open() { LOGGER.info("Starting deployment state monitor."); scheduler.scheduleWithFixedDelay(this, configuration.getInitialDelay(), configuration.getPeriod(), TimeUnit.SECONDS); } @Autowired  DeploymentStateMonitorController(MonitoringConfiguration configuration, DataManager dataManager); @PostConstruct @SuppressWarnings("FutureReturnValueIgnored") void open(); @Override void close(); @Override void run(); @Override void register(IntegrationDeploymentState state, StateHandler stateHandler);  }