summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-06-14 20:56:59 +0100
committerMichael Morris <michael.morris@est.tech>2023-06-20 10:07:41 +0000
commitf845ac23cdd262b7624785283531952e38557deb (patch)
tree51dc173b216240b2b1881363f56df15b99bd7c8c /catalog-be/src/main
parentc465f8fac8cc8be671319fca2100e98fc4a4c13f (diff)
Improve test coverage
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: Ib5c265567973369a9061ce611ab018857016bff1 Issue-ID: SDC-4536
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java62
1 files changed, 25 insertions, 37 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java
index 0851f22c0a..9eb0141209 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineClusterHealth.java
@@ -32,6 +32,8 @@ import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.PreDestroy;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
@@ -65,7 +67,7 @@ public class DistributionEngineClusterHealth {
private HealthCheckInfo healthCheckInfo = HealthCheckInfoResult.UNKNOWN.getHealthCheckInfo();
private Map<String, AtomicBoolean> envNamePerStatus = null;
private ScheduledFuture<?> scheduledFuture = null;
-
+
protected void init(final String publicApiKey) {
logger.trace("Enter init method of DistributionEngineClusterHealth");
Long reconnectIntervalConfig = ConfigurationManager.getConfigurationManager().getConfiguration()
@@ -153,40 +155,28 @@ public class DistributionEngineClusterHealth {
}
}
- public enum HealthCheckInfoResult {
- OK(new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.UP, null,
- ClusterStatusDescription.OK.getDescription())), UNAVAILABLE(
- new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null,
- ClusterStatusDescription.UNAVAILABLE.getDescription())), NOT_CONFIGURED(
- new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null,
- ClusterStatusDescription.NOT_CONFIGURED.getDescription())), DISABLED(
- new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null,
- ClusterStatusDescription.DISABLED.getDescription())), UNKNOWN(
- new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.UNKNOWN, null,
- ClusterStatusDescription.UNKNOWN.getDescription()));
- private HealthCheckInfo healthCheckInfo;
-
- HealthCheckInfoResult(HealthCheckInfo healthCheckInfo) {
- this.healthCheckInfo = healthCheckInfo;
- }
-
- public HealthCheckInfo getHealthCheckInfo() {
- return healthCheckInfo;
- }
+ @AllArgsConstructor
+ @Getter
+ private enum HealthCheckInfoResult {
+ // @formatter:off
+ OK (new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.UP, null, ClusterStatusDescription.OK.getDescription())),
+ UNAVAILABLE (new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.UNAVAILABLE.getDescription())),
+ NOT_CONFIGURED (new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.NOT_CONFIGURED.getDescription())),
+ DISABLED (new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.DOWN, null, ClusterStatusDescription.DISABLED.getDescription())),
+ UNKNOWN (new HealthCheckInfo(Constants.HC_COMPONENT_DISTRIBUTION_ENGINE, HealthCheckStatus.UNKNOWN, null, ClusterStatusDescription.UNKNOWN.getDescription()));
+ // @formatter:on
+ private final HealthCheckInfo healthCheckInfo;
}
- public enum ClusterStatusDescription {
- OK("OK"), UNAVAILABLE("U-EB cluster is not available"), NOT_CONFIGURED("U-EB cluster is not configured"), DISABLED(
- "DE is disabled in configuration"), UNKNOWN("U-EB cluster is currently unknown (try again in few minutes)");
- private String desc;
-
- ClusterStatusDescription(String desc) {
- this.desc = desc;
- }
-
- public String getDescription() {
- return desc;
- }
+ @AllArgsConstructor
+ @Getter
+ private enum ClusterStatusDescription {
+ OK("OK"),
+ UNAVAILABLE("U-EB cluster is not available"),
+ NOT_CONFIGURED("U-EB cluster is not configured"),
+ DISABLED("DE is disabled in configuration"),
+ UNKNOWN("U-EB cluster is currently unknown (try again in few minutes)");
+ private final String description;
}
/**
@@ -199,11 +189,12 @@ public class DistributionEngineClusterHealth {
*/
public class HealthCheckScheduledTask implements Runnable {
+ @Getter
List<UebHealthCheckCall> healthCheckCalls = new ArrayList<>();
/**
* executor for the query itself
*/
- ExecutorService healthCheckExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
+ private final ExecutorService healthCheckExecutor = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return new Thread(r, "UEB-Health-Check-Thread");
@@ -298,8 +289,5 @@ public class DistributionEngineClusterHealth {
return result;
}
- public List<UebHealthCheckCall> getHealthCheckCalls() {
- return healthCheckCalls;
- }
}
}