--- /dev/null
+# Change Log
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/)
+and this project adheres to [Semantic Versioning](http://semver.org/).
+
+## [2.2.0] - 11/01/2025
+
+### Added
+
+- add a `sdc-distribution-client-api` maven submodule
+
+### Changed
+
+- move `org.onap.sdc.api.*` package out of the `sdc-distribution-client` maven module into the `sdc-distribution-client-api` module
+- change the import for the `DistributionStatusEnum`: `org.onap.sdc.utils.DistributionStatusEnum` -> `org.onap.sdc.api.notification.DistributionStatusEnum`
+- change the import for the `DistributionActionResultEnum`: `org.onap.sdc.utils.DistributionActionResultEnum` -> `org.onap.sdc.api.results.DistributionActionResultEnum`
+
+## [1.4.2] - 17/12/2020
+
+### Changed
+
+- [SDC-3400](https://jira.onap.org/browse/SDC-3400) - Upgrade SDC Distribution Client code to use Java 11
+ Upgrade libraries to the newest versions
+ Upgrade Junit to 5
+ Remove old CI project
+ Create new integration tests for client inicialization
+++ /dev/null
-# Change Log
-All notable changes to this project will be documented in this file.
-
-The format is based on [Keep a Changelog](http://keepachangelog.com/)
-and this project adheres to [Semantic Versioning](http://semver.org/).
-
-## [1.4.2] - 17/12/2020
- - [SDC-3400](https://jira.onap.org/browse/SDC-3400) - Upgrade SDC Distribution Client code to use Java 11
- Upgrade libraries to the newest versions
- Upgrade Junit to 5
- Remove old CI project
- Create new integration tests for client inicialization
\ No newline at end of file
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>2.1.2-SNAPSHOT</version>
+ <version>2.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>sdc-sdc-distribution-client</name>
<modules>
<module>sdc-distribution-client</module>
<module>sdc-distribution-ci</module>
+ <module>sdc-distribution-client-api</module>
</modules>
<properties>
<awaitility-proxy.version>3.1.6</awaitility-proxy.version>
<awaitility.version>4.2.0</awaitility.version>
<jackson.version>2.15.2</jackson.version>
+ <lombok.version>1.18.24</lombok.version>
<nexus.proxy>https://nexus.onap.org</nexus.proxy>
<sitePath>/content/sites/site/org/onap/sdc/sdc-distribution-client/${project.version}</sitePath>
<parent>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>2.1.2-SNAPSHOT</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-ci</artifactId>
*/
package org.onap.test.core.config;
-import org.onap.sdc.api.consumer.IConfiguration;
-
import java.util.ArrayList;
import java.util.List;
+import org.onap.sdc.api.consumer.IConfiguration;
+
public class DistributionClientConfig implements IConfiguration {
public static final String DEFAULT_SDC_ADDRESS = "localhost:30206";
*/
package org.onap.test.core.service;
-import org.onap.sdc.api.notification.INotificationData;
-
import java.util.List;
+import org.onap.sdc.api.notification.INotificationData;
+
public interface ArtifactsValidator {
List<ValidationResult> validate(INotificationData service);
}
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.INotificationCallback;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.http.HttpSdcClient;
import org.onap.sdc.http.SdcConnectorClient;
import org.onap.sdc.impl.DistributionClientDownloadResultImpl;
import org.onap.sdc.impl.DistributionClientImpl;
-import org.onap.sdc.utils.DistributionStatusEnum;
import org.onap.test.core.config.DistributionClientConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
package org.onap.test.core.service;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
-import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
public class DistributionStatusMessage implements IDistributionStatusMessage {
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <parent>\r
+ <groupId>org.onap.sdc.sdc-distribution-client</groupId>\r
+ <artifactId>sdc-main-distribution-client</artifactId>\r
+ <version>2.2.0-SNAPSHOT</version>\r
+ </parent>\r
+\r
+ <name>sdc-distribution-client-api</name>\r
+ <artifactId>sdc-distribution-client-api</artifactId>\r
+\r
+ <properties>\r
+ <maven.compiler.source>11</maven.compiler.source>\r
+ <maven.compiler.target>11</maven.compiler.target>\r
+ </properties>\r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.projectlombok</groupId>\r
+ <artifactId>lombok</artifactId>\r
+ <version>${lombok.version}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ </dependencies>\r
+\r
+</project>\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2025 Deutsche Telekom Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.sdc.api;
+
+import java.util.List;
+
+import lombok.Value;
+
+@Value
+public class ArtifactInfo {
+ String artifactName;
+ String artifactType;
+ String artifactURL;
+ String artifactChecksum;
+ int artifactTimeout;
+ String artifactDescription;
+ String artifactVersion;
+ String artifactUUID;
+ ArtifactInfo generatedArtifact;
+ List<ArtifactInfo> relatedArtifacts;
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2025 Deutsche Telekom Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.sdc.api;
+
+public interface DistributionClient {
+ void sendStatus(StatusMessage statusMessage);
+ DownloadResult download(ArtifactInfo artifactInfo);
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2025 Deutsche Telekom Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.api;
+
+import lombok.Value;
+
+@Value
+public class DownloadResult {
+ String artifactName;
+ String artifactFilename;
+ byte[] artifactPayload;
+}
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
import org.onap.sdc.api.consumer.INotificationCallback;
import org.onap.sdc.api.consumer.IStatusCallback;
-import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.IVfModuleMetadata;
import org.onap.sdc.api.notification.StatusMessage;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.api.results.IDistributionClientResult;
/**
Client for sending/receiving notifications/status related to distributions from SDC.
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2025 Deutsche Telekom Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.sdc.api;
+
+import lombok.Value;
+
+@Value
+public class StatusMessage {
+ String artifactUrl;
+}
import java.util.List;
-import org.apache.kafka.common.KafkaException;
-import org.onap.sdc.api.notification.INotificationData;
-
public interface IConfiguration {
/**
* SDC Distribution Engine address. Value can be either hostname (with or
if(saslJaasConfFromEnv != null) {
return saslJaasConfFromEnv;
} else {
- throw new KafkaException("sasl.jaas.config not set for Kafka Consumer");
+ throw new RuntimeException("sasl.jaas.config not set for Kafka Consumer");
}
}
* configured and {@link #isUseHttpsWithSDC()} is false then SDC Distribution
* Client will register the proxy configuration with the HttpClient instance
* using HTTP and route requests through the proxy.
- *
+ *
* @return Hostname of the http proxy
*/
String getHttpProxyHost();
* {@link #isUseHttpsWithSDC()} is false then SDC Distribution Client will
* register the proxy configuration with the HttpClient instance using HTTP and
* route requests through the proxy.
- *
+ *
* @return Port of the http proxy
*/
int getHttpProxyPort();
* configured and {@link #isUseHttpsWithSDC()} is true then SDC Distribution
* Client will register the proxy configuration with the HttpClient instance
* using HTTPS and route requests through the proxy.
- *
+ *
* @return Hostname of the https proxy
*/
String getHttpsProxyHost();
* {@link #isUseHttpsWithSDC()} is true then SDC Distribution Client will
* register the proxy configuration with the HttpClient instance using HTTPS and
* route requests through the proxy.
- *
+ *
* @return Port of the https proxy
*/
int getHttpsProxyPort();
package org.onap.sdc.api.consumer;
-import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
public interface IDistributionStatusMessageBasic {
/**
public interface INotificationCallback {
void activateCallback(INotificationData data);
}
-
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.api.notification;
+
+public enum DistributionStatusEnum {
+ /**
+ * Can be sent when ONAP component successfully downloaded the specific artifact
+ */
+ DOWNLOAD_OK,
+
+ /**
+ * Can be sent when ONAP component failed to download the specific artifact (corrupted file)
+ */
+ DOWNLOAD_ERROR,
+
+ /**
+ * Can be sent only if the repeated distribution notification event is sent when the ONAP component already downloaded the artifact , but still not stored it in the local repository .
+ */
+ ALREADY_DOWNLOADED,
+
+ /**
+ * Can be sent when ONAP component successfully deployed the specific artifact in the local repository
+ */
+ DEPLOY_OK,
+
+ /**
+ * Can be sent when ONAP component failed to store the downloaded artifact in the local repository
+ */
+ DEPLOY_ERROR,
+
+ /**
+ * Sent when the repeated distribution notification event is sent for already stored in the local repository service artifact ( artifact's version and checksum match the one stored in the local repository)
+ */
+ ALREADY_DEPLOYED,
+ /**
+ * ONAP component is requested to publish this status once component successfully complete downloading and storing all the data it needs from the service.
+ */
+ COMPONENT_DONE_OK,
+ /**
+ * ONAP component is requested to publish this status when component failed to download or failed to store one or more of the mandatory information it requires from the service model.
+ * <p>
+ * It is recommended to populate the errorReason field with appropriate description of the error
+ */
+ COMPONENT_DONE_ERROR,
+ /**
+ * The DISTRIBUTION_COMPLETE_OK/ERROR status indicating the overall ONAP components status of retrieving and storing the information.
+ */
+ DISTRIBUTION_COMPLETE_OK,
+
+ DISTRIBUTION_COMPLETE_ERROR,
+
+ NOTIFIED,
+
+ NOT_NOTIFIED
+
+}
import java.util.List;
-import org.onap.sdc.impl.ArtifactInfo;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(as = ArtifactInfo.class)
public interface IArtifactInfo {
/**
import java.util.List;
-import org.onap.sdc.impl.NotificationData;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(as = NotificationData.class)
public interface INotificationData {
/**
* Global Distribution Identifier: UUID generated by SDC per each distribution activation.<br>
import java.util.List;
-import org.onap.sdc.impl.ResourceInstance;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(as = ResourceInstance.class)
public interface IResourceInstance {
/**
* Logical Resource Instance Name. <br>
package org.onap.sdc.api.notification;
-import org.onap.sdc.impl.StatusDataImpl;
-import org.onap.sdc.utils.DistributionStatusEnum;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-
-@JsonDeserialize(as = StatusDataImpl.class)
public interface IStatusData {
/**
* Global Distribution Identifier: UUID generated by SDC per each
package org.onap.sdc.api.notification;
-import org.onap.sdc.utils.DistributionStatusEnum;
-
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Value;
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * sdc-distribution-client
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.sdc.api.results;
+
+public enum DistributionActionResultEnum {
+ SUCCESS,
+ FAIL,
+ GENERAL_ERROR,
+ BAD_REQUEST,
+ DISTRIBUTION_CLIENT_NOT_INITIALIZED,
+ DISTRIBUTION_CLIENT_IS_TERMINATED,
+ DISTRIBUTION_CLIENT_ALREADY_INITIALIZED,
+ DISTRIBUTION_CLIENT_ALREADY_STARTED,
+
+ DATA_INTEGRITY_PROBLEM,
+ ARTIFACT_NOT_FOUND,
+
+ CONFIGURATION_IS_MISSING,
+ CONF_MISSING_USERNAME,
+ CONF_MISSING_PASSWORD,
+ CONF_MISSING_SDC_FQDN,
+ CONF_MISSING_ARTIFACT_TYPES,
+ CONF_CONTAINS_INVALID_ARTIFACT_TYPES,
+ CONF_MISSING_CONSUMER_ID,
+ CONF_MISSING_ENVIRONMENT_NAME,
+ CONF_INVALID_SDC_FQDN,
+ CONF_INVALID_CONSUME_PRODUCE_STATUS_TOPIC_FALG,
+ SDC_AUTHENTICATION_FAILED,
+ SDC_AUTHORIZATION_FAILED,
+ SDC_NOT_FOUND,
+ SDC_SERVER_PROBLEM,
+ SDC_CONNECTION_FAILED,
+ SDC_SERVER_TIMEOUT,
+
+ MESSAGING_CLIENT_INIT_FAILED
+}
package org.onap.sdc.api.results;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-
/**
* General Distribution Client Result
*/
<parent>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>2.1.2-SNAPSHOT</version>
+ <version>2.2.0-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-client</artifactId>
<slf4j-api.version>1.7.30</slf4j-api.version>
<kafka.version>3.3.1</kafka.version>
<gson.version>2.8.9</gson.version>
- <lombok.version>1.18.24</lombok.version>
</properties>
<dependencies>
+ <dependency>
+ <groupId>org.onap.sdc.sdc-distribution-client</groupId>
+ <artifactId>sdc-distribution-client-api</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>20220320</version>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.utils.Pair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
-import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.utils.Pair;
+import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.utils.CaseInsensitiveMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.http.entity.StringEntity;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.impl.DistributionClientDownloadResultImpl;
import org.onap.sdc.impl.DistributionClientResultImpl;
-import org.onap.sdc.utils.DistributionActionResultEnum;
import org.onap.sdc.utils.DistributionClientConstants;
import org.onap.sdc.utils.Pair;
import org.onap.sdc.utils.kafka.KafkaDataResponse;
import java.util.List;
import org.onap.sdc.api.notification.IArtifactInfo;
+
import lombok.Data;
import lombok.NoArgsConstructor;
package org.onap.sdc.impl;
import java.util.List;
+
import org.onap.sdc.api.consumer.IConfiguration;
public class Configuration implements IConfiguration {
import java.util.Objects;
import java.util.function.Function;
import java.util.regex.Matcher;
+
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.api.consumer.IStatusCallback;
-import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.utils.DistributionClientConstants;
public class ConfigurationValidator {
package org.onap.sdc.impl;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
-import org.onap.sdc.utils.DistributionActionResultEnum;
public class DistributionClientDownloadResultImpl extends DistributionClientResultImpl implements IDistributionClientDownloadResult {
private byte[] artifactPayload;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.IVfModuleMetadata;
import org.onap.sdc.api.notification.StatusMessage;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.http.HttpClientFactory;
import org.onap.sdc.http.HttpRequestFactory;
import org.onap.sdc.http.HttpSdcClient;
import org.onap.sdc.http.SdcConnectorClient;
-import org.onap.sdc.utils.DistributionActionResultEnum;
import org.onap.sdc.utils.DistributionClientConstants;
import org.onap.sdc.utils.NotificationSender;
import org.onap.sdc.utils.Pair;
package org.onap.sdc.impl;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.utils.DistributionActionResultEnum;
public class DistributionClientResultImpl implements IDistributionClientResult {
import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
-import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
class DistributionStatusMessageImpl implements IDistributionStatusMessage {
import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
-import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.List;
import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import org.onap.sdc.api.notification.StatusMessage;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.utils.ArtifactTypeEnum;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-import org.onap.sdc.utils.DistributionStatusEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.List;
+
import org.onap.sdc.api.consumer.INotificationCallback;
import org.onap.sdc.utils.kafka.SdcKafkaConsumer;
import org.slf4j.Logger;
class NotificationConsumer implements Runnable {
private static final Logger log = LoggerFactory.getLogger(NotificationConsumer.class.getName());
+ private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
private final SdcKafkaConsumer kafkaConsumer;
private final INotificationCallback clientCallback;
@Override
public void run() {
try {
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
long currentTimeMillis = System.currentTimeMillis();
- log.info("Polling for messages from topic: {}", kafkaConsumer.getTopicName());
+ log.debug("Polling for messages from topic: {}", kafkaConsumer.getTopicName());
for (String notificationMsg : kafkaConsumer.poll()) {
log.debug("received message from topic");
log.debug("received notification from broker: {}", notificationMsg);
import java.util.ArrayList;
import java.util.List;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
import lombok.Data;
-import org.onap.sdc.api.notification.IArtifactInfo;
-import org.onap.sdc.api.notification.INotificationData;
-
@Data
public class NotificationDataImpl implements INotificationData {
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+
import org.onap.sdc.api.consumer.IStatusCallback;
import org.onap.sdc.api.notification.IStatusData;
import org.onap.sdc.utils.kafka.SdcKafkaConsumer;
class StatusConsumer implements Runnable {
private static final Logger log = LoggerFactory.getLogger(StatusConsumer.class.getName());
+ private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
private final SdcKafkaConsumer kafkaConsumer;
private final IStatusCallback clientCallback;
public void run() {
try {
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- log.info("Polling for messages from topic: {}", kafkaConsumer.getTopicName());
+ log.debug("Polling for messages from topic: {}", kafkaConsumer.getTopicName());
for (String statusMsg : kafkaConsumer.poll()) {
log.debug("received message from topic");
log.debug("received notification from broker: {}", statusMsg);
package org.onap.sdc.impl;
-import lombok.Data;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
import org.onap.sdc.api.notification.IStatusData;
-import org.onap.sdc.utils.DistributionStatusEnum;
+
+import lombok.Data;
@Data
public class StatusDataImpl implements IStatusData {
package org.onap.sdc.utils;
+/**
+ * Use {@link org.onap.sdc.api.results.DistributionActionResultEnum} instead
+ */
+@Deprecated
public enum DistributionActionResultEnum {
SUCCESS,
FAIL,
package org.onap.sdc.utils;
+/**
+ * Use {@link org.onap.sdc.api.notification.DistributionStatusEnum} instead
+ */
+@Deprecated
public enum DistributionStatusEnum {
/**
* Can be sent when ONAP component successfully downloaded the specific artifact
import com.google.common.hash.Hashing;
import fj.data.Either;
+
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.impl.DistributionClientResultImpl;
import org.slf4j.Logger;
import java.util.concurrent.TimeUnit;
import org.apache.kafka.common.KafkaException;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.impl.DistributionClientResultImpl;
import org.onap.sdc.utils.kafka.SdcKafkaProducer;
import org.junit.jupiter.api.Test;
import org.mockito.Matchers;
import org.mockito.Mockito;
+import org.onap.sdc.utils.Pair;
+import org.onap.sdc.utils.kafka.KafkaDataResponse;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.utils.DistributionActionResultEnum;
-import org.onap.sdc.utils.Pair;
-import org.onap.sdc.utils.kafka.KafkaDataResponse;
import org.onap.sdc.utils.CaseInsensitiveMap;
public class SdcConnectorClientTest {
throw new IOException("Not implemented. This is expected as the implementation is for unit tests only.");
}
}
-}
\ No newline at end of file
+}
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
class DistributionClientDownloadResultTest {
import org.mockito.Mockito;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.api.notification.IVfModuleMetadata;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.http.SdcConnectorClient;
import org.onap.sdc.utils.ArtifactTypeEnum;
-import org.onap.sdc.utils.DistributionActionResultEnum;
import org.onap.sdc.utils.Pair;
import org.onap.sdc.utils.TestConfiguration;
import org.onap.sdc.utils.TestNotificationCallback;
import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
-import org.onap.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
class DistributionStatusMessageImplTest {
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.utils.ArtifactTypeEnum;
-import org.onap.sdc.utils.DistributionActionResultEnum;
import org.onap.sdc.utils.TestConfiguration;
import com.google.gson.Gson;
import org.mockito.stubbing.Answer;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.api.consumer.INotificationCallback;
+import org.onap.sdc.api.notification.DistributionStatusEnum;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.StatusMessage;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.utils.ArtifactTypeEnum;
-import org.onap.sdc.utils.DistributionActionResultEnum;
import org.onap.sdc.utils.DistributionClientConstants;
-import org.onap.sdc.utils.DistributionStatusEnum;
import org.onap.sdc.utils.TestConfiguration;
import org.onap.sdc.utils.kafka.SdcKafkaConsumer;
import java.nio.file.Files;
import java.nio.file.Paths;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IStatusData;
import lombok.SneakyThrows;
+@Disabled
public class SerializationTest {
private static final ObjectMapper mapper = new ObjectMapper();
package org.onap.sdc.impl.mock;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
-import org.onap.sdc.utils.DistributionActionResultEnum;
/**
* Mock Implementation
import nl.altindag.log.LogCaptor;
import org.apache.kafka.common.KafkaException;
import org.junit.jupiter.api.Test;
+import org.onap.sdc.api.results.DistributionActionResultEnum;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.impl.DistributionClientResultImpl;
import org.onap.sdc.utils.kafka.SdcKafkaProducer;
}
}
-
import java.util.ArrayList;
import java.util.List;
+
import org.onap.sdc.api.consumer.IConfiguration;
public class TestConfiguration implements IConfiguration {
import java.util.ArrayList;
import java.util.List;
+import org.onap.sdc.api.consumer.IConfiguration;
+
import lombok.Getter;
import lombok.Setter;
-import org.onap.sdc.api.consumer.IConfiguration;
@Getter
@Setter
* 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.
@Override
public void activateCallback(INotificationData data) {
System.out.println("notification callback was called");
-
+
}
}