@Test public void canRunSelfHealingSuccess () { doReturn(true).when(adminManager).canRunSelfHealing(); assertTrue(experiment.canRunSelfHealing()); }
boolean canRunSelfHealing () { if (!adminManager.canRunSelfHealing()) { sendNotification(NotificationLevel.WARN, "Self healing disabled due admin state"); log.debug("Self healing disallowed by Admin State {}", v("AdminState", adminManager.getAdminState())); return false; } else if (Optional.ofNullable(lastSelfHealingTime) .map(i -> i.plus(getMinimumTimeBetweenSelfHealing())) .map(i -> i.isAfter(Instant.now())) .orElse(false)) { log.debug("Self healing last occurred too recently. Skipping re-execution."); return false; } return true; }
Experiment { boolean canRunSelfHealing () { if (!adminManager.canRunSelfHealing()) { sendNotification(NotificationLevel.WARN, "Self healing disabled due admin state"); log.debug("Self healing disallowed by Admin State {}", v("AdminState", adminManager.getAdminState())); return false; } else if (Optional.ofNullable(lastSelfHealingTime) .map(i -> i.plus(getMinimumTimeBetweenSelfHealing())) .map(i -> i.isAfter(Instant.now())) .orElse(false)) { log.debug("Self healing last occurred too recently. Skipping re-execution."); return false; } return true; } }
Experiment { boolean canRunSelfHealing () { if (!adminManager.canRunSelfHealing()) { sendNotification(NotificationLevel.WARN, "Self healing disabled due admin state"); log.debug("Self healing disallowed by Admin State {}", v("AdminState", adminManager.getAdminState())); return false; } else if (Optional.ofNullable(lastSelfHealingTime) .map(i -> i.plus(getMinimumTimeBetweenSelfHealing())) .map(i -> i.isAfter(Instant.now())) .orElse(false)) { log.debug("Self healing last occurred too recently. Skipping re-execution."); return false; } return true; } Experiment(Container container); }
Experiment { boolean canRunSelfHealing () { if (!adminManager.canRunSelfHealing()) { sendNotification(NotificationLevel.WARN, "Self healing disabled due admin state"); log.debug("Self healing disallowed by Admin State {}", v("AdminState", adminManager.getAdminState())); return false; } else if (Optional.ofNullable(lastSelfHealingTime) .map(i -> i.plus(getMinimumTimeBetweenSelfHealing())) .map(i -> i.isAfter(Instant.now())) .orElse(false)) { log.debug("Self healing last occurred too recently. Skipping re-execution."); return false; } return true; } Experiment(Container container); String getExperimentMethodName(); Container getContainer(); void setPreferredExperiment(String preferredExperiment); Instant getLastSelfHealingTime(); @JsonIgnore Platform getExperimentLayer(); String getExperimentLayerName(); @JsonIgnore ExperimentMethod getExperimentMethod(); Runnable getSelfHealingMethod(); void setSelfHealingMethod(Runnable selfHealingMethod); @JsonIgnore Runnable getFinalizeMethod(); void setFinalizeMethod(Runnable finalizeMethod); @JsonIgnore Callable<ContainerHealth> getCheckContainerHealth(); void setCheckContainerHealth(Callable<ContainerHealth> checkContainerHealth); void setFinalizationDuration(Duration finalizationDuration); String getId(); ExperimentType getExperimentType(); AtomicInteger getSelfHealingCounter(); ExperimentState getExperimentState(); Instant getStartTime(); void setMinimumDuration(Duration minimumDuration); void setMaximumDuration(Duration maximumDuration); Boolean getWasSelfHealingRequired(); @Override String toString(); }
Experiment { boolean canRunSelfHealing () { if (!adminManager.canRunSelfHealing()) { sendNotification(NotificationLevel.WARN, "Self healing disabled due admin state"); log.debug("Self healing disallowed by Admin State {}", v("AdminState", adminManager.getAdminState())); return false; } else if (Optional.ofNullable(lastSelfHealingTime) .map(i -> i.plus(getMinimumTimeBetweenSelfHealing())) .map(i -> i.isAfter(Instant.now())) .orElse(false)) { log.debug("Self healing last occurred too recently. Skipping re-execution."); return false; } return true; } Experiment(Container container); String getExperimentMethodName(); Container getContainer(); void setPreferredExperiment(String preferredExperiment); Instant getLastSelfHealingTime(); @JsonIgnore Platform getExperimentLayer(); String getExperimentLayerName(); @JsonIgnore ExperimentMethod getExperimentMethod(); Runnable getSelfHealingMethod(); void setSelfHealingMethod(Runnable selfHealingMethod); @JsonIgnore Runnable getFinalizeMethod(); void setFinalizeMethod(Runnable finalizeMethod); @JsonIgnore Callable<ContainerHealth> getCheckContainerHealth(); void setCheckContainerHealth(Callable<ContainerHealth> checkContainerHealth); void setFinalizationDuration(Duration finalizationDuration); String getId(); ExperimentType getExperimentType(); AtomicInteger getSelfHealingCounter(); ExperimentState getExperimentState(); Instant getStartTime(); void setMinimumDuration(Duration minimumDuration); void setMaximumDuration(Duration maximumDuration); Boolean getWasSelfHealingRequired(); @Override String toString();  }