diff options
author | efiacor <fiachra.corcoran@est.tech> | 2022-06-16 09:38:26 +0100 |
---|---|---|
committer | efiacor <fiachra.corcoran@est.tech> | 2022-10-10 17:40:51 +0100 |
commit | cff56489f774f937654cb6eb198d3d5ef41418a2 (patch) | |
tree | 3819828c2fed7d46536253ff2f35bcf0a3c9c031 /sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java | |
parent | 1b46a6e1d6fcf9788c9f18552f6f6b8fed60126c (diff) |
[STRIMZI] Migrate client from cambria to kafka native
Add call to sdc to get kafka and topic details
Add kafka config to IConfiguration interface
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: Ibec77d1ff1cd25ad4adce133ee81d66e54c7707f
Issue-ID: DMAAP-1745
Diffstat (limited to 'sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java')
-rw-r--r-- | sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java | 98 |
1 files changed, 67 insertions, 31 deletions
diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java index ca7abba..c2fc536 100644 --- a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java +++ b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java @@ -22,12 +22,11 @@ package org.onap.sdc.utils; import java.util.ArrayList; import java.util.List; - import org.onap.sdc.api.consumer.IConfiguration; public class TestConfiguration implements IConfiguration { - private String asdcAddress; + private String sdcAddress; private String user; private String password; private int pollingInterval = DistributionClientConstants.MIN_POLLING_INTERVAL_SEC; @@ -36,11 +35,13 @@ public class TestConfiguration implements IConfiguration { private String consumerGroup; private String environmentName; private String comsumerID; + private final String kafkaSecurityProtocolConfig; + private final String kafkaSaslMechanism; + private final String kafkaSaslJaasConfig; private String keyStorePath; private String keyStorePassword; private boolean activateServerTLSAuth; private boolean isFilterInEmptyResources; - private boolean useHttpsWithDmaap; private boolean useHttpsWithSDC; private List<String> msgBusAddress; private String httpProxyHost; @@ -48,11 +49,16 @@ public class TestConfiguration implements IConfiguration { private String httpsProxyHost; private int httpsProxyPort; private boolean useSystemProxy; + private String sdcStatusTopicName; + private String sdcNotificationTopicName; public TestConfiguration(IConfiguration other) { - this.asdcAddress = other.getAsdcAddress(); + this.sdcAddress = other.getSdcAddress(); this.comsumerID = other.getConsumerID(); this.consumerGroup = other.getConsumerGroup(); + this.kafkaSecurityProtocolConfig = other.getKafkaSecurityProtocolConfig(); + this.kafkaSaslMechanism = other.getKafkaSaslMechanism(); + this.kafkaSaslJaasConfig = other.getKafkaSaslJaasConfig(); this.environmentName = other.getEnvironmentName(); this.password = other.getPassword(); this.pollingInterval = other.getPollingInterval(); @@ -71,30 +77,37 @@ public class TestConfiguration implements IConfiguration { } public TestConfiguration() { - this.asdcAddress = "localhost:8443"; + this.sdcAddress = "localhost:8443"; this.comsumerID = "mso-123456"; this.consumerGroup = "mso-group"; this.environmentName = "PROD"; this.password = "password"; this.pollingInterval = 20; this.pollingTimeout = 20; - this.relevantArtifactTypes = new ArrayList<String>(); + this.setSdcStatusTopicName("SDC-STATUS-TOPIC"); + this.setSdcNotificationTopicName("SDC-NOTIF-TOPIC"); + this.relevantArtifactTypes = new ArrayList<>(); this.relevantArtifactTypes.add(ArtifactTypeEnum.HEAT.name()); this.user = "mso-user"; - this.keyStorePath = "etc/asdc-client.jks"; + this.keyStorePath = "etc/sdc-client.jks"; this.keyStorePassword = "Aa123456"; this.activateServerTLSAuth = false; this.isFilterInEmptyResources = false; this.useHttpsWithSDC = true; - msgBusAddress = new ArrayList<String>(); - msgBusAddress.add("www.cnn.com"); - msgBusAddress.add("www.cnn.com"); - msgBusAddress.add("www.cnn.com"); + msgBusAddress = new ArrayList<>(); + msgBusAddress.add("kafka-bootstrap1:9092"); + msgBusAddress.add("kafka-bootstrap2:9092"); + msgBusAddress.add("kafka-bootstrap3:9092"); + this.kafkaSecurityProtocolConfig = "SASL_PLAINTEXT"; + this.kafkaSaslMechanism = "PLAIN"; + this.kafkaSaslJaasConfig = "org.apache.kafka.common.security.scram.ScramLoginModule required username=admin password=admin-secret;"; + this.httpProxyHost = "proxy"; + this.httpProxyPort = 8080; } @Override - public String getAsdcAddress() { - return asdcAddress; + public String getSdcAddress() { + return sdcAddress; } @Override @@ -103,6 +116,21 @@ public class TestConfiguration implements IConfiguration { } @Override + public String getKafkaSecurityProtocolConfig() { + return kafkaSecurityProtocolConfig; + } + + @Override + public String getKafkaSaslMechanism() { + return kafkaSaslMechanism; + } + + @Override + public String getKafkaSaslJaasConfig() { + return kafkaSaslJaasConfig; + } + + @Override public String getUser() { return user; } @@ -185,8 +213,8 @@ public class TestConfiguration implements IConfiguration { this.comsumerID = comsumerID; } - public void setAsdcAddress(String asdcAddress) { - this.asdcAddress = asdcAddress; + public void setSdcAddress(String sdcAddress) { + this.sdcAddress = sdcAddress; } public void setUser(String user) { @@ -249,7 +277,7 @@ public class TestConfiguration implements IConfiguration { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((asdcAddress == null) ? 0 : asdcAddress.hashCode()); + result = prime * result + ((sdcAddress == null) ? 0 : sdcAddress.hashCode()); result = prime * result + ((comsumerID == null) ? 0 : comsumerID.hashCode()); result = prime * result + ((consumerGroup == null) ? 0 : consumerGroup.hashCode()); result = prime * result + ((environmentName == null) ? 0 : environmentName.hashCode()); @@ -280,10 +308,10 @@ public class TestConfiguration implements IConfiguration { if (getClass() != obj.getClass()) return false; TestConfiguration other = (TestConfiguration) obj; - if (asdcAddress == null) { - if (other.asdcAddress != null) + if (sdcAddress == null) { + if (other.sdcAddress != null) return false; - } else if (!asdcAddress.equals(other.asdcAddress)) + } else if (!sdcAddress.equals(other.sdcAddress)) return false; if (comsumerID == null) { if (other.comsumerID != null) @@ -325,17 +353,14 @@ public class TestConfiguration implements IConfiguration { } else if (!keyStorePath.equals(other.keyStorePath)) return false; if (keyStorePassword == null) { - if (other.keyStorePassword != null) - return false; - } else if (!keyStorePassword.equals(other.keyStorePassword)) - return false; - - return true; + return other.keyStorePassword == null; + } else + return keyStorePassword.equals(other.keyStorePassword); } @Override public String toString() { - return "TestConfiguration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password + return "TestConfiguration [sdcAddress=" + sdcAddress + ", user=" + user + ", password=" + password + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout + ", relevantArtifactTypes=" + relevantArtifactTypes + ", consumerGroup=" + consumerGroup + ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + "]"; @@ -351,11 +376,6 @@ public class TestConfiguration implements IConfiguration { } @Override - public Boolean isUseHttpsWithDmaap() { - return this.useHttpsWithDmaap; - } - - @Override public Boolean isUseHttpsWithSDC() { return this.useHttpsWithSDC; } @@ -363,4 +383,20 @@ public class TestConfiguration implements IConfiguration { public void setUseHttpsWithSDC(Boolean useHttpsWithSDC) { this.useHttpsWithSDC = useHttpsWithSDC; } + + public String getSdcStatusTopicName() { + return sdcStatusTopicName; + } + + public void setSdcStatusTopicName(String sdcStatusTopicName) { + this.sdcStatusTopicName = sdcStatusTopicName; + } + + public String getSdcNotificationTopicName() { + return sdcNotificationTopicName; + } + + public void setSdcNotificationTopicName(String sdcNotificationTopicName) { + this.sdcNotificationTopicName = sdcNotificationTopicName; + } } |