diff options
author | vasraz <vasyl.razinkov@est.tech> | 2023-06-19 17:51:23 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-06-20 10:05:26 +0000 |
commit | c465f8fac8cc8be671319fca2100e98fc4a4c13f (patch) | |
tree | 0c050c754ae64afe4b2ca2d2a1a2266b7f310262 /common-app-api | |
parent | 068a01213a8b2daac93b0c2aab33b9a73e7fb70b (diff) |
Disable DMaaP if Kafka active
DMaaP healthcheck cannot succeed when using Kafka, which in turn causes distribution to fail
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: Ia6e1e35b9a2e819e38e62caeb797342948f34e92
Issue-ID: SDC-4542
Diffstat (limited to 'common-app-api')
2 files changed, 55 insertions, 441 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java index 205588adab..72870ea1d9 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java @@ -19,14 +19,21 @@ */ package org.openecomp.sdc.be.config; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.openecomp.sdc.common.api.BasicConfiguration; +import org.openecomp.sdc.common.http.config.ExternalServiceConfig; + import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import org.openecomp.sdc.common.api.BasicConfiguration; -import org.openecomp.sdc.common.http.config.ExternalServiceConfig; +@Getter +@Setter public class DistributionEngineConfiguration extends BasicConfiguration { private List<String> uebServers; @@ -52,82 +59,6 @@ public class DistributionEngineConfiguration extends BasicConfiguration { private Integer opEnvRecoveryIntervalSec; private Integer allowedTimeBeforeStaleSec; - public List<String> getUebServers() { - return uebServers; - } - - public void setUebServers(List<String> uebServers) { - this.uebServers = uebServers; - } - - public String getDistributionNotifTopicName() { - return distributionNotifTopicName; - } - - public void setDistributionNotifTopicName(String distributionNotifTopicName) { - this.distributionNotifTopicName = distributionNotifTopicName; - } - - public String getDistributionStatusTopicName() { - return distributionStatusTopicName; - } - - public void setDistributionStatusTopicName(String distributionStatusTopicName) { - this.distributionStatusTopicName = distributionStatusTopicName; - } - - public String getKafkaBootStrapServers() { - return kafkaBootStrapServers; - } - - public void setKafkaBootStrapServers(String kafkaBootStrapServers) { - this.kafkaBootStrapServers = kafkaBootStrapServers; - } - - public Integer getInitRetryIntervalSec() { - return initRetryIntervalSec; - } - - public void setInitRetryIntervalSec(Integer initRetryIntervalSec) { - this.initRetryIntervalSec = initRetryIntervalSec; - } - - public ComponentArtifactTypesConfig getDistribNotifServiceArtifactTypes() { - return distribNotifServiceArtifactTypes; - } - - public void setDistribNotifServiceArtifactTypes(ComponentArtifactTypesConfig distribNotifServiceArtifactTypes) { - this.distribNotifServiceArtifactTypes = distribNotifServiceArtifactTypes; - } - - public ComponentArtifactTypesConfig getDistribNotifResourceArtifactTypes() { - return distribNotifResourceArtifactTypes; - } - - public void setDistribNotifResourceArtifactTypes(ComponentArtifactTypesConfig distribNotifResourceArtifactTypes) { - this.distribNotifResourceArtifactTypes = distribNotifResourceArtifactTypes; - } - - public String getUebPublicKey() { - return uebPublicKey; - } - - public void setUebPublicKey(String uebPublicKey) { - this.uebPublicKey = uebPublicKey; - } - - public String getUebSecretKey() { - return uebSecretKey; - } - - public void setUebSecretKey(String uebSecretKey) { - this.uebSecretKey = uebSecretKey; - } - - public List<String> getEnvironments() { - return environments; - } - public void setEnvironments(List<String> environments) { Set<String> set = new HashSet<>(); if (environments != null) { @@ -138,218 +69,64 @@ public class DistributionEngineConfiguration extends BasicConfiguration { } } - public DistributionStatusTopicConfig getDistributionStatusTopic() { - return distributionStatusTopic; - } - - public void setDistributionStatusTopic(DistributionStatusTopicConfig distributionStatusTopic) { - this.distributionStatusTopic = distributionStatusTopic; - } - - public Integer getInitMaxIntervalSec() { - return initMaxIntervalSec; - } - - public void setInitMaxIntervalSec(Integer initMaxIntervalSec) { - this.initMaxIntervalSec = initMaxIntervalSec; - } - - public CreateTopicConfig getCreateTopic() { - return createTopic; - } - - public void setCreateTopic(CreateTopicConfig createTopic) { - this.createTopic = createTopic; - } - - public boolean isStartDistributionEngine() { - return startDistributionEngine; - } - - public void setStartDistributionEngine(boolean startDistributionEngine) { - this.startDistributionEngine = startDistributionEngine; - } - - public DistributionNotificationTopicConfig getDistributionNotificationTopic() { - return distributionNotificationTopic; - } - - public void setDistributionNotificationTopic(DistributionNotificationTopicConfig distributionNotificationTopic) { - this.distributionNotificationTopic = distributionNotificationTopic; - } - - public int getDefaultArtifactInstallationTimeout() { - return defaultArtifactInstallationTimeout; - } - - public void setDefaultArtifactInstallationTimeout(int defaultArtifactInstallationTimeout) { - this.defaultArtifactInstallationTimeout = defaultArtifactInstallationTimeout; - } - - public int getCurrentArtifactInstallationTimeout() { - return currentArtifactInstallationTimeout; - } - - public void setCurrentArtifactInstallationTimeout(int currentArtifactInstallationTimeout) { - this.currentArtifactInstallationTimeout = currentArtifactInstallationTimeout; - } - - public boolean isUseHttpsWithDmaap() { - return useHttpsWithDmaap; - } - - public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap) { - this.useHttpsWithDmaap = useHttpsWithDmaap; - } - - public Integer getOpEnvRecoveryIntervalSec() { - return opEnvRecoveryIntervalSec; - } - - public void setOpEnvRecoveryIntervalSec(Integer opEnvRecoveryIntervalSec) { - this.opEnvRecoveryIntervalSec = opEnvRecoveryIntervalSec; - } - - public Integer getAllowedTimeBeforeStaleSec() { - return allowedTimeBeforeStaleSec; - } - - public void setAllowedTimeBeforeStaleSec(Integer allowedTimeBeforeStaleSec) { - this.allowedTimeBeforeStaleSec = allowedTimeBeforeStaleSec; - } - - public ExternalServiceConfig getAaiConfig() { - return aaiConfig; - } - - public void setAaiConfig(ExternalServiceConfig aaiConfig) { - this.aaiConfig = aaiConfig; - } - - public ExternalServiceConfig getMsoConfig() { - return msoConfig; - } - - public void setMsoConfig(ExternalServiceConfig msoConfig) { - this.msoConfig = msoConfig; - } - + @Getter + @AllArgsConstructor public enum ArtifcatTypeEnum { - MURANO_PKG("MURANO-PKG"), HEAT("HEAT"), DG_XML("DG_XML"); - String value; - - private ArtifcatTypeEnum(String value) { - this.value = value; - } + MURANO_PKG("MURANO-PKG"), + HEAT("HEAT"), + DG_XML("DG_XML"); + private final String value; - public String getValue() { - return value; - } } + @Getter + @Setter public static class DistribNotifServiceArtifacts { - Map<String, Object> service; - Map<String, Object> resource; + private Map<String, Object> service; + private Map<String, Object> resource; - public Map<String, Object> getService() { - return service; - } - - public void setService(Map<String, Object> service) { - this.service = service; - } - - public Map<String, Object> getResource() { - return resource; - } - - public void setResource(Map<String, Object> resource) { - this.resource = resource; - } } + @Getter + @Setter public static class NotifArtifactTypes { - List<String> info; - List<String> lifecycle; - - public List<String> getInfo() { - return info; - } - - public void setInfo(List<String> info) { - this.info = info; - } - - public List<String> getLifecycle() { - return lifecycle; - } + private List<String> info; + private List<String> lifecycle; - public void setLifecycle(List<String> lifecycle) { - this.lifecycle = lifecycle; - } } + @Getter + @Setter public static class NotifArtifactTypesResource { - List<ArtifcatTypeEnum> lifecycle; + private List<ArtifcatTypeEnum> lifecycle; } + @Getter + @Setter + @ToString public static class CreateTopicConfig { private Integer partitionCount; private Integer replicationCount; - public Integer getPartitionCount() { - return partitionCount; - } - - public void setPartitionCount(Integer partitionCount) { - this.partitionCount = partitionCount; - } - - public Integer getReplicationCount() { - return replicationCount; - } - - public void setReplicationCount(Integer replicationCount) { - this.replicationCount = replicationCount; - } - - @Override - public String toString() { - return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount + "]"; - } } + @Getter + @Setter + @ToString public static class EnvironmentConfig { private String name; private List<String> uebServers; - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List<String> getUebServers() { - return uebServers; - } - - public void setUebServers(List<String> uebServers) { - this.uebServers = uebServers; - } - - @Override - public String toString() { - return "EnvironmentConfig [name=" + name + ", uebServers=" + uebServers + "]"; - } } + @Getter + @Setter + @ToString public static class DistributionStatusTopicConfig { private Integer pollingIntervalSec; @@ -357,106 +134,26 @@ public class DistributionEngineConfiguration extends BasicConfiguration { private String consumerGroup; private String consumerId; - public Integer getPollingIntervalSec() { - return pollingIntervalSec; - } - - public void setPollingIntervalSec(Integer pollingIntervalSec) { - this.pollingIntervalSec = pollingIntervalSec; - } - - public Integer getFetchTimeSec() { - return fetchTimeSec; - } - - public void setFetchTimeSec(Integer fetchTimeSec) { - this.fetchTimeSec = fetchTimeSec; - } - - public String getConsumerGroup() { - return consumerGroup; - } - - public void setConsumerGroup(String consumerGroup) { - this.consumerGroup = consumerGroup; - } - - public String getConsumerId() { - return consumerId; - } - - public void setConsumerId(String consumerId) { - this.consumerId = consumerId; - } - - @Override - public String toString() { - return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec=" + fetchTimeSec + ", consumerGroup=" - + consumerGroup + ", consumerId=" + consumerId + "]"; - } } + @Getter + @Setter + @ToString public static class DistributionNotificationTopicConfig { private Integer maxWaitingAfterSendingSeconds; private Integer maxThreadPoolSize; private Integer minThreadPoolSize; - public Integer getMaxWaitingAfterSendingSeconds() { - return maxWaitingAfterSendingSeconds; - } - - public void setMaxWaitingAfterSendingSeconds(Integer maxWaitingAfterSendingSeconds) { - this.maxWaitingAfterSendingSeconds = maxWaitingAfterSendingSeconds; - } - - public Integer getMaxThreadPoolSize() { - return maxThreadPoolSize; - } - - public void setMaxThreadPoolSize(Integer maxThreadPoolSize) { - this.maxThreadPoolSize = maxThreadPoolSize; - } - - public Integer getMinThreadPoolSize() { - return minThreadPoolSize; - } - - public void setMinThreadPoolSize(Integer minThreadPoolSize) { - this.minThreadPoolSize = minThreadPoolSize; - } - - @Override - public String toString() { - return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds + ", maxThreadPoolSize=" - + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]"; - } } + @Getter + @Setter + @ToString public static class ComponentArtifactTypesConfig { private List<String> info; private List<String> lifecycle; - public List<String> getInfo() { - return info; - } - - public void setInfo(List<String> info) { - this.info = info; - } - - public List<String> getLifecycle() { - return lifecycle; - } - - public void setLifecycle(List<String> lifecycle) { - this.lifecycle = lifecycle; - } - - @Override - public String toString() { - return "ArtifactTypesConfig [info=" + info + ", lifecycle=" + lifecycle + "]"; - } } } diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java index cd6705dfdf..bd0564f676 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/DistributionEngineConfigurationTest.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,107 +21,24 @@ package org.openecomp.sdc.be.config; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.List; -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor; -import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters; -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.hamcrest.CoreMatchers.allOf; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +class DistributionEngineConfigurationTest { -public class DistributionEngineConfigurationTest { + @Test + void validateSetGetEnvironments() { + final String testEnvironment = "testEnvironment"; + DistributionEngineConfiguration distributionEngineConfiguration = new DistributionEngineConfiguration(); + distributionEngineConfiguration.setEnvironments(Collections.singletonList(testEnvironment)); - @Test - public void validateBean() { - assertThat(DistributionEngineConfiguration.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSettersExcluding("environments") - )); - } + List<String> response = distributionEngineConfiguration.getEnvironments(); - @Test - public void validateDistribNotifServiceArtifactsBean() { - assertThat(DistributionEngineConfiguration.DistribNotifServiceArtifacts.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters() - )); - } - - @Test - public void validateNotifArtifactTypesBean() { - assertThat(DistributionEngineConfiguration.NotifArtifactTypes.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters() - )); - } - - @Test - public void validateNotifArtifactTypesResourceBean() { - assertThat(DistributionEngineConfiguration.NotifArtifactTypesResource.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters() - )); - } - - @Test - public void validateCreateTopicConfigBean() { - assertThat(DistributionEngineConfiguration.CreateTopicConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters(), - hasValidBeanToString() - )); - } - - @Test - public void validateEnvironmentConfigBean() { - assertThat(DistributionEngineConfiguration.EnvironmentConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters(), - hasValidBeanToString() - )); - } - - @Test - public void validateDistributionStatusTopicConfigBean() { - assertThat(DistributionEngineConfiguration.DistributionStatusTopicConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters(), - hasValidBeanToString() - )); - } - - @Test - public void validateDistributionNotificationTopicConfigBean() { - assertThat(DistributionEngineConfiguration.DistributionNotificationTopicConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters(), - hasValidBeanToString() - )); - } - - @Test - public void validateComponentArtifactTypesConfigBean() { - assertThat(DistributionEngineConfiguration.ComponentArtifactTypesConfig.class, allOf( - hasValidBeanConstructor(), - hasValidGettersAndSetters() - )); - } - - @Test - public void validateSetGetEnvironments() { - final String testEnvironment = "testEnvironment"; - DistributionEngineConfiguration distributionEngineConfiguration = new DistributionEngineConfiguration(); - distributionEngineConfiguration.setEnvironments(Collections.singletonList(testEnvironment)); - - List<String> response = distributionEngineConfiguration.getEnvironments(); - - assertEquals(response.size(), 1); - assertEquals(response.get(0), testEnvironment); - } + assertEquals(1, response.size()); + assertEquals(testEnvironment, response.get(0)); + } } |