.project
.settings/
+# VSCode
+.vscode/
+
# Maven
log/
target/
# ONAP SDC Distribution client
-
---
---
-# Introduction
+## Introduction
ONAP SDC Distribution client is delivered as helper JAR that can be used by clients that work with SDC.
It listens for notifications from SDC, download artifacts from SDC, and send response back to SDC.
+## Compiling ONAP SDC Distribution client
-# Compiling ONAP SDC Distribution client
-
-As mentioned in the onap wiki https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment,
-the settings.xml (https://git.onap.org/oparent/plain/settings.xml) from the oparent project must be
+As mentioned in the [onap wiki](https://lf-onap.atlassian.net/wiki/spaces/DW/pages/16220206/Setting+Up+Your+Development+Environment),
+the [settings.xml](https://git.onap.org/oparent/plain/settings.xml) from the oparent project must be
installed in your ~/.m2 folder and referenced by your IDE.
Once maven is set up properly, ONAP SDC Distribution client can be compiled easily using maven command: `mvn clean install`
### How to use ONAP SDC Distribution client
+
Every client that wants to use the JAR, need to implement IConfiguration interface.
See the SDC ONAP read the docs for more detail in relation to the sdc-distribution-client usage.
https://docs.onap.org/projects/onap-sdc/en/kohn/sdcsdks.html#sdc-tosca-and-sdc-distribution-client
-# Logging
+## Logging
+
Loggin can be done using log4j
Example of log.properties file:
+```ini
-------------------------------
log4j.rootCategory=DEBUG, CONSOLE, LOGFILE
log4j.logger.org.onap=TRACE, CONSOLE, LOGFILE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
-
+
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.File=logs/wordnik.log
log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
log4j.appender.LOGFILE.MaxFileSize=10MB
log4j.appender.LOGFILE.MaxBackupIndex=10
+```
-
-# Getting Help
+## Getting Help
*** to be completed on release ***
SDC@lists.onap.org
SDC Javadoc and Maven site
-
-*** to be completed on rrelease ***
+*** to be completed on rrelease ***
sphinxcontrib-swaggerdoc
sphinxcontrib-spelling
sphinxcontrib-plantuml
+six
For more information regarding Env set up see `Setting Up Your Development Environment`_.
-.. _Setting Up Your Development Environment: https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment
+.. _Setting Up Your Development Environment: https://lf-onap.atlassian.net/wiki/spaces/DW/pages/16220206/Setting+Up+Your+Development+Environment
.. _Build steps:
``mvn clean install``
The result is JAR file under the ``sdc-distribution-client/target`` folder
-
New features
------------
Modify client to use kafka native to publish and subscribe to SDC topics
-https://jira.onap.org/browse/DMAAP-1745
+https://lf-onap.atlassian.net/browse/DMAAP-1745
Deliverables
------------
#. `SDC Portal`_
.. _`ONAP Home Page`: https://www.onap.org
-.. _`ONAP Wiki Page`: https://wiki.onap.org
+.. _`ONAP Wiki Page`: https://lf-onap.atlassian.net/wiki/spaces/DW/overview?homepageId=16220162
.. _`ONAP Documentation`: https://docs.onap.org
.. _`ONAP Release Downloads`: https://git.onap.org
.. _`SDC ReadTheDocs`: https://docs.onap.org/projects/onap-sdc/en/latest/
-.. _`SDC Portal`: https://wiki.onap.org/display/DW/Service+Design+and+Creation+%28SDC%29+Portal
+.. _`SDC Portal`: https://lf-onap.atlassian.net/wiki/spaces/DW/pages/16253579/Service+Design+and+Creation+SDC+Portal
basepython = python3.8
deps =
-r{toxinidir}/requirements-docs.txt
- -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
+ -chttps://releases.openstack.org/constraints/upper/yoga
-chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master
commands =
sphinx-build -W -q -b html -n -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/html
basepython = python3.8
deps =
-r{toxinidir}/requirements-docs.txt
- -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
+ -chttps://releases.openstack.org/constraints/upper/yoga
-chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master
commands =
sphinx-build -W -q -b linkcheck -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/linkcheck
basepython = python3.8
deps =
-r{toxinidir}/requirements-docs.txt
- -chttps://raw.githubusercontent.com/openstack/requirements/stable/yoga/upper-constraints.txt
+ -chttps://releases.openstack.org/constraints/upper/yoga
-chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt?h=master
commands =
sphinx-build -W -q -b spelling -d {envtmpdir}/doctrees {toxinidir} {toxinidir}/_build/spellcheck
-
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <version>2.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>sdc-sdc-distribution-client</name>
<parent>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <version>2.1.2-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-ci</artifactId>
*/
package org.onap.test.core.service;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
-import static org.mockito.Mockito.verify;
-import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.time.Duration;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
import lombok.SneakyThrows;
import org.apache.kafka.clients.CommonClientConfigs;
-import org.apache.kafka.clients.admin.AdminClient;
-import org.apache.kafka.clients.admin.AdminClientConfig;
-import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
-import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.kafka.common.config.SaslConfigs;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junitpioneer.jupiter.SetEnvironmentVariable;
-import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.sdc.impl.DistributionClientDownloadResultImpl;
import org.onap.sdc.impl.DistributionClientImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
-import org.testcontainers.containers.wait.strategy.WaitStrategy;
-import org.testcontainers.containers.wait.strategy.WaitStrategyTarget;
+import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.shaded.org.awaitility.Durations;
private static final int EXPECTED_HEAT_ARTIFACTS = 4;
private static final DistributionClientConfig clientConfig = new DistributionClientConfig();
private static final Logger testLog = LoggerFactory.getLogger(ClientInitializerTest.class);
+
@Container
CustomKafkaContainer kafka = buildBrokerInstance();
+
@Container
public GenericContainer<?> mockSdc =
new GenericContainer<>(
"nexus3.onap.org:10001/onap/onap-component-mock-sdc:master")
- .withExposedPorts(30206);
+ .withExposedPorts(30206)
+ .waitingFor(Wait.forHttp("/sdc/v1/artifactTypes"));
+
@Mock
private Logger distClientLog;
private ClientInitializer clientInitializer;
@BeforeEach
public void initializeClient() throws InterruptedException {
- clientConfig.setSdcAddress(mockSdc.getHost()+":"+mockSdc.getFirstMappedPort());
+ clientConfig.setSdcAddress(mockSdc.getHost() + ":" + mockSdc.getFirstMappedPort());
List<ArtifactsValidator> validators = new ArrayList<>();
DistributionClientImpl client = new DistributionClientImpl(distClientLog);
clientNotifyCallback = new ClientNotifyCallback(validators, client);
props.put(SaslConfigs.SASL_JAAS_CONFIG, "org.apache.kafka.common.security.plain.PlainLoginModule required username='admin' password='admin-secret';");
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
- KafkaProducer<String, String> producer = new KafkaProducer<>(props);
- String content = Files.readString(Path.of("src/test/resources/artifacts.json"));
- producer.send(new ProducerRecord<>("SDC-DIST-NOTIF-TOPIC", "testcontainers", content)).get();
+ try (KafkaProducer<String, String> producer = new KafkaProducer<>(props)) {
+ String content = Files.readString(Path.of("src/test/resources/artifacts.json"));
+ producer.send(new ProducerRecord<>("SDC-DIST-NOTIF-TOPIC", "testcontainers", content)).get();
+ }
}
}
<parent>
<groupId>org.onap.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <version>2.1.2-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-client</artifactId>
major=2
minor=1
-patch=1
+patch=2
base_version=${major}.${minor}.${patch}