summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorefiacor <fiachra.corcoran@est.tech>2022-10-21 14:33:48 +0100
committerefiacor <fiachra.corcoran@est.tech>2022-10-25 11:26:09 +0100
commitece674df14c8ecf818438c3bc6626a104cf9c305 (patch)
treea393e119af96c15799c4959f58899930d08e0d64
parentcff56489f774f937654cb6eb198d3d5ef41418a2 (diff)
[SDC-DIST] Remove msgBusAddress config
Update javadocs for specific interfaces Add javadoc build for maven storage Signed-off-by: efiacor <fiachra.corcoran@est.tech> Change-Id: I603c6162079e19b431e10c9489aef45c15ce181c Issue-ID: DMAAP-1745
-rw-r--r--pom.xml13
-rw-r--r--sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java8
-rw-r--r--sdc-distribution-client/pom.xml2
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/api/IDistributionClient.java46
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java54
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java74
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java4
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaProducer.java13
-rw-r--r--sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java5
9 files changed, 118 insertions, 101 deletions
diff --git a/pom.xml b/pom.xml
index bb52ff0..694d402 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,6 +136,7 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
@@ -196,7 +197,17 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
- <configuration/>
+ <configuration>
+ <failOnError>false</failOnError>
+ </configuration>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
diff --git a/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java b/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java
index 5a902c8..3f002a3 100644
--- a/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java
+++ b/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java
@@ -95,14 +95,6 @@ public class DistributionClientConfig implements IConfiguration {
return sdcAddress;
}
- public List<String> getMsgBusAddress() {
- return msgBusAddress;
- }
-
- public void setMsgBusAddress(List<String> msgBusAddress) {
- this.msgBusAddress = msgBusAddress;
- }
-
@Override
public String getUser() {
return user;
diff --git a/sdc-distribution-client/pom.xml b/sdc-distribution-client/pom.xml
index 3d1ebbd..a96f39f 100644
--- a/sdc-distribution-client/pom.xml
+++ b/sdc-distribution-client/pom.xml
@@ -19,7 +19,7 @@
<mockito-all.version>3.6.28</mockito-all.version>
<commons-io.version>2.8.0</commons-io.version>
<slf4j-api.version>1.7.30</slf4j-api.version>
- <jackson.version>2.5.2</jackson.version>
+ <jackson.version>2.8.6</jackson.version>
<kafka.version>3.3.1</kafka.version>
<gson.version>2.8.9</gson.version>
<lombok.version>1.18.24</lombok.version>
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/api/IDistributionClient.java b/sdc-distribution-client/src/main/java/org/onap/sdc/api/IDistributionClient.java
index ac48419..1115c91 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/api/IDistributionClient.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/api/IDistributionClient.java
@@ -76,16 +76,18 @@ public interface IDistributionClient {
/**
* Downloads an artifact from SDC Catalog <br>
*
- * @param artifactInfo
+ * @param artifactInfo - the info about the Artifact to be downloaded
* @return IDistributionClientDownloadResult
*/
IDistributionClientDownloadResult download(IArtifactInfo artifactInfo);
/**
* Initialize the distribution client <br>
- * - get MessageBus server list from configuration <br>
+ * - validate the config <br>
+ * - set up the SDC connector <br>
* - validate artifact types against sdc server <br>
* - set the notification callback <br>
+ * - get and set up the Kafka endpoint and topics <br>
* - set up notification sender <br>
* <p>
* Note: all configuration fields are mandatory. <br>
@@ -93,17 +95,19 @@ public interface IDistributionClient {
* ONAP-Component MUST store password as SHA-2 (256) hashed with
* dynamically generated salt value <br>
*
- * @param conf
- * @param callback
+ * @param conf - contains configuration
+ * @param callback - the NotificationCallback logic
* @return IDistributionClientResult
*/
IDistributionClientResult init(IConfiguration conf, INotificationCallback callback);
/**
* Initialize the distribution client <br>
- * - get MessageBus server list from configuration <br>
+ * - validate the config <br>
+ * - set up the SDC connector <br>
* - validate artifact types against sdc server <br>
* - set the notification callback <br>
+ * - get and set up the Kafka endpoint and topics <br>
* - set up notification sender <br>
* <p>
* Note: all configuration fields are mandatory. <br>
@@ -111,9 +115,9 @@ public interface IDistributionClient {
* ONAP-Component MUST store password as SHA-2 (256) hashed with
* dynamically generated salt value <br>
*
- * @param conf
- * @param notificationCallback
- * @param statusCallback
+ * @param conf - contains configuration
+ * @param notificationCallback - the NotificationCallback logic
+ * @param statusCallback - the StatusCallback logic
* @return IDistributionClientResult
*/
IDistributionClientResult init(IConfiguration conf, INotificationCallback notificationCallback,
@@ -123,7 +127,7 @@ public interface IDistributionClient {
* Build and publish Distribution Download Status event to Distribution
* Status Topic
*
- * @param statusMessage
+ * @param statusMessage - the status message to be published
* @return IDistributionClientResult
*/
IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage statusMessage);
@@ -132,8 +136,8 @@ public interface IDistributionClient {
* Build and publish Distribution Download Status event to Distribution
* Status Topic With Error Reason.
*
- * @param statusMessage
- * @param errorReason
+ * @param statusMessage - the status message to be published
+ * @param errorReason - the error details
* @return IDistributionClientResult
*/
IDistributionClientResult sendDownloadStatus(IDistributionStatusMessage statusMessage, String errorReason);
@@ -142,7 +146,7 @@ public interface IDistributionClient {
* Build and publish Distribution Deployment Status event to Distribution
* Status Topic
*
- * @param statusMessage
+ * @param statusMessage - the status message to be published
* @return IDistributionClientResult
*/
IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage statusMessage);
@@ -151,8 +155,8 @@ public interface IDistributionClient {
* Build and publish Distribution Deployment Status event to Distribution
* Status Topic With Error Reason.
*
- * @param statusMessage
- * @param errorReason
+ * @param statusMessage - the status message to be published
+ * @param errorReason - the error details
* @return IDistributionClientResult
*/
IDistributionClientResult sendDeploymentStatus(IDistributionStatusMessage statusMessage, String errorReason);
@@ -161,7 +165,7 @@ public interface IDistributionClient {
* Build and publish Distribution Component Status event to Distribution
* Status Topic
*
- * @param statusMessage
+ * @param statusMessage - the status message to be published
* @return IDistributionClientResult
*/
IDistributionClientResult sendComponentDoneStatus(IComponentDoneStatusMessage statusMessage);
@@ -170,8 +174,8 @@ public interface IDistributionClient {
* Build and publish Distribution Component Status event to Distribution
* Status Topic With Error Reason.
*
- * @param statusMessage
- * @param errorReason
+ * @param statusMessage - the status message to be published
+ * @param errorReason - the error details
* @return IDistributionClientResult
*/
IDistributionClientResult sendComponentDoneStatus(IComponentDoneStatusMessage statusMessage, String errorReason);
@@ -181,7 +185,7 @@ public interface IDistributionClient {
* Build and publish Distribution Final Status event to Distribution
* Status Topic
*
- * @param statusMessage
+ * @param statusMessage - the status message to be published
* @return IDistributionClientResult
*/
IDistributionClientResult sendFinalDistrStatus(IFinalDistrStatusMessage statusMessage);
@@ -191,8 +195,8 @@ public interface IDistributionClient {
* Build and publish Distribution Final Status event to Distribution
* Status Topic With Error Reason.
*
- * @param statusMessage
- * @param errorReason
+ * @param statusMessage - the status message to be published
+ * @param errorReason - the error details
* @return IDistributionClientResult
*/
IDistributionClientResult sendFinalDistrStatus(IFinalDistrStatusMessage statusMessage, String errorReason);
@@ -204,7 +208,7 @@ public interface IDistributionClient {
* @deprecated Method is deprecated due to VF Module changes. Only backward
* compatibility is supported.<br>
*
- * @param artifactPayload
+ * @param artifactPayload - the payload of artifact data
* @return IVfModuleMetadata list
*/
@Deprecated
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java b/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java
index 84eb42b..184dca4 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java
@@ -34,27 +34,28 @@ public interface IConfiguration {
String getSdcAddress();
/**
- * SDC Distribution Addresses from ONAP Component Values need to be set from
- * impl
- */
- List<String> getMsgBusAddress();
-
- /**
- * Kafka security.protocol
+ * Kafka security protocol to be used by the client to Auth towards the kafka cluster
+ *
+ * @return Kafka security.protocol. Default is SASL_PLAINTEXT
*/
default String getKafkaSecurityProtocolConfig() {
return System.getenv().getOrDefault("SECURITY_PROTOCOL", "SASL_PLAINTEXT");
}
/**
- * Kafka sasl.mechanism
+ * Kafka SASL mechanism to be used by the client to Auth towards the kafka cluster
+ *
+ * @return Kafka sasl.mechanism. Default is SCRAM-SHA-512
*/
default String getKafkaSaslMechanism() {
return System.getenv().getOrDefault("SASL_MECHANISM", "SCRAM-SHA-512");
}
/**
- * Kafka sasl.jaas.config
+ * Kafka JAAS config to be used by the client to Auth towards the kafka cluster.
+ * If overridden, must align with sasl.jaas.config convention set out by the sasl.mechanism being used
+ * otherwise, mandatory setting of the environment variable SASL_JAAS_CONFIG is required to provide default behaviour
+ * @return Kafka sasl.jaas.config
*/
default String getKafkaSaslJaasConfig() {
String saslJaasConfFromEnv = System.getenv("SASL_JAAS_CONFIG");
@@ -77,7 +78,7 @@ public interface IConfiguration {
* default (HTTPS) behavior will be applied. If set to false, distribution
* client will use HTTP when connecting to SDC.
*
- * @return
+ * @return default is true
*/
default Boolean isUseHttpsWithSDC() {
return true;
@@ -116,8 +117,7 @@ public interface IConfiguration {
List<String> getRelevantArtifactTypes();
/**
- * Returns the consumer group defined for this component, if no consumer
- * group is defined return null.
+ * Returns the kafka consumer group defined for this component.
*
* @return SdcKafkaConsumer group.
*/
@@ -127,14 +127,14 @@ public interface IConfiguration {
* Returns the environment name (testing, production etc...). Can Be
* reconfigured in runtime.
*
- * @return
+ * @return Environment name
*/
String getEnvironmentName();
/**
- * Unique ID of component instance (e.x INSTAR name).
+ * Returns the kafka consumer id defined for this component.
*
- * @return
+ * @return SdcKafkaConsumer id.
*/
String getConsumerID();
@@ -143,12 +143,14 @@ public interface IConfiguration {
* the SDC's public key (e.g /etc/keystore/sdc-client.jks) file will be
* deployed with sdc-distribution jar.
*
- * @return
+ * @return Client's Key store path
*/
String getKeyStorePath();
/**
- * @return Returns client's Key Store password
+ * Return the password for the Client's Key Store
+ *
+ * @return Client's Key Store password
*/
String getKeyStorePassword();
@@ -156,7 +158,7 @@ public interface IConfiguration {
* Sets whether SDC server TLS authentication is activated. If set to false, Key
* Store path and password are not needed to be set.
*
- * @return
+ * @return true by default
*/
boolean activateServerTLSAuth();
@@ -169,12 +171,12 @@ public interface IConfiguration {
* Setting the method to false will activate the legacy behavior, in which empty
* resources are not part of the notification.<br>
*
- * @return
+ * @return true or false
*/
boolean isFilterInEmptyResources();
/**
- * By default, (false value) Distribution Client will trigger the regular
+ * By default: false. Distribution Client will trigger the regular
* registration towards SDC (register component as consumer to the
* SDC-DISTR-NOTIF-TOPIC-[ENV] topic and register component as producer to the
* SDC-DISTR-STATUS-TOPIC-[ENV]).<br>
@@ -182,7 +184,7 @@ public interface IConfiguration {
* this component request to be consumer and producer of the
* SDC-DISTR-STATUS-TOPIC-[ENV] topic.<br>
*
- * @return
+ * @return false by default
*/
default boolean isConsumeProduceStatusTopic() {
return false;
@@ -193,7 +195,7 @@ public interface IConfiguration {
* available proxies from JVM arguments. If set to false, distribution client
* will use proxy parameters configured through properties file.
*
- * @return
+ * @return false by default
*/
default Boolean isUseSystemProxy() {
return false;
@@ -205,7 +207,7 @@ public interface IConfiguration {
* Client will register the proxy configuration with the HttpClient instance
* using HTTP and route requests through the proxy.
*
- * @return
+ * @return Hostname of the http proxy
*/
String getHttpProxyHost();
@@ -216,7 +218,7 @@ public interface IConfiguration {
* register the proxy configuration with the HttpClient instance using HTTP and
* route requests through the proxy.
*
- * @return
+ * @return Port of the http proxy
*/
int getHttpProxyPort();
@@ -226,7 +228,7 @@ public interface IConfiguration {
* Client will register the proxy configuration with the HttpClient instance
* using HTTPS and route requests through the proxy.
*
- * @return
+ * @return Hostname of the https proxy
*/
String getHttpsProxyHost();
@@ -237,7 +239,7 @@ public interface IConfiguration {
* register the proxy configuration with the HttpClient instance using HTTPS and
* route requests through the proxy.
*
- * @return
+ * @return Port of the https proxy
*/
int getHttpsProxyPort();
}
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java b/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java
index db4433b..24f3225 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java
@@ -23,7 +23,6 @@ package org.onap.sdc.impl;
import java.util.List;
import org.onap.sdc.api.consumer.IConfiguration;
-import org.onap.sdc.utils.DistributionClientConstants;
public class Configuration implements IConfiguration {
@@ -36,8 +35,8 @@ public class Configuration implements IConfiguration {
private String sdcAddress;
private String user;
private String password;
- private int pollingInterval = DistributionClientConstants.MIN_POLLING_INTERVAL_SEC;
- private int pollingTimeout = DistributionClientConstants.POLLING_TIMEOUT_SEC;
+ private int pollingInterval;
+ private int pollingTimeout;
private List<String> relevantArtifactTypes;
private String consumerGroup;
private String environmentName;
@@ -85,31 +84,6 @@ public class Configuration implements IConfiguration {
return sdcAddress;
}
- public String getStatusTopicName() {
- return sdcStatusTopicName;
- }
-
- public void setStatusTopicName(String sdcStatusTopicName) {
- this.sdcStatusTopicName = sdcStatusTopicName;
- }
-
- public String getNotificationTopicName() {
- return sdcNotificationTopicName;
- }
-
- public void setNotificationTopicName(String sdcNotificationTopicName) {
- this.sdcNotificationTopicName = sdcNotificationTopicName;
- }
-
- @Override
- public List<String> getMsgBusAddress() {
- return msgBusAddressList;
- }
-
- public void setMsgBusAddress(List<String> newMsgBusAddress) {
- msgBusAddressList = newMsgBusAddress;
- }
-
@Override
public String getKafkaSecurityProtocolConfig() {
return kafkaSecurityProtocolConfig;
@@ -205,6 +179,40 @@ public class Configuration implements IConfiguration {
return useSystemProxy;
}
+ @Override
+ public boolean activateServerTLSAuth() {
+ return this.activateServerTLSAuth;
+ }
+
+ @Override
+ public boolean isFilterInEmptyResources() {
+ return this.filterInEmptyResources;
+ }
+
+ public String getStatusTopicName() {
+ return sdcStatusTopicName;
+ }
+
+ public void setStatusTopicName(String sdcStatusTopicName) {
+ this.sdcStatusTopicName = sdcStatusTopicName;
+ }
+
+ public String getNotificationTopicName() {
+ return sdcNotificationTopicName;
+ }
+
+ public void setNotificationTopicName(String sdcNotificationTopicName) {
+ this.sdcNotificationTopicName = sdcNotificationTopicName;
+ }
+
+ public List<String> getMsgBusAddress() {
+ return msgBusAddressList;
+ }
+
+ public void setMsgBusAddress(List<String> newMsgBusAddress) {
+ msgBusAddressList = newMsgBusAddress;
+ }
+
public void setComsumerID(String comsumerID) {
this.comsumerID = comsumerID;
}
@@ -273,16 +281,6 @@ public class Configuration implements IConfiguration {
this.useSystemProxy = useSystemProxy;
}
- @Override
- public boolean activateServerTLSAuth() {
- return this.activateServerTLSAuth;
- }
-
- @Override
- public boolean isFilterInEmptyResources() {
- return this.filterInEmptyResources;
- }
-
public void setUseHttpsWithSDC(boolean useHttpsWithSDC) {
this.useHttpsWithSDC = useHttpsWithSDC;
}
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java
index 71f793d..91b41a9 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaConsumer.java
@@ -94,6 +94,10 @@ public class SdcKafkaConsumer {
return msgs;
}
+ /**
+ *
+ * @return The topic being polled by the consumer
+ */
public String getTopicName() {
return topicName;
}
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaProducer.java b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaProducer.java
index 9826f8b..19338fc 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaProducer.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/utils/kafka/SdcKafkaProducer.java
@@ -45,6 +45,10 @@ public class SdcKafkaProducer {
private final List<String> msgBusAddresses;
private final String topicName;
+ /**
+ *
+ * @param configuration The config provided to the client
+ */
public SdcKafkaProducer(Configuration configuration) {
Properties props = new Properties();
props.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, configuration.getMsgBusAddress());
@@ -76,8 +80,9 @@ public class SdcKafkaProducer {
}
return data;
}
+
/**
- *
+ * Flush accumulated records in producer
*/
public void flush() {
try {
@@ -88,10 +93,16 @@ public class SdcKafkaProducer {
}
}
+ /**
+ * @return The list kafka endpoints
+ */
public List<String> getMsgBusAddresses() {
return msgBusAddresses;
}
+ /**
+ * @return The topic name being published to
+ */
public String getTopicName() {
return topicName;
}
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 c2fc536..86f29be 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
@@ -111,11 +111,6 @@ public class TestConfiguration implements IConfiguration {
}
@Override
- public List<String> getMsgBusAddress() {
- return msgBusAddress;
- }
-
- @Override
public String getKafkaSecurityProtocolConfig() {
return kafkaSecurityProtocolConfig;
}