Fix sdc-distribution-client link checker pipeline failure 17/139717/11
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Thu, 12 Dec 2024 10:13:58 +0000 (11:13 +0100)
committerFiete Ostkamp <fiete.ostkamp@telekom.de>
Sun, 15 Dec 2024 09:41:39 +0000 (09:41 +0000)
- fix broken tox.ini and add missing six python dependency
- replace references to wiki.onap.org with the new wiki address
- fix timing issues in ClientInitializerTest
- improve README formatting
- bump snapshot version to 2.1.2-SNAPSHOT

Issue-ID: SDC-4704
Change-Id: I0303f44bd9a33b7bc2ee8363eb813cc2258e44f5
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
.gitignore
README.md
docs/requirements-docs.txt
docs/sections/build.rst
docs/sections/release-notes.rst
docs/tox.ini
pom.xml
sdc-distribution-ci/pom.xml
sdc-distribution-ci/src/test/java/org/onap/test/core/service/ClientInitializerTest.java
sdc-distribution-client/pom.xml
version.properties

index 39595c8..7d182fb 100644 (file)
@@ -3,6 +3,9 @@
 .project
 .settings/
 
+# VSCode
+.vscode/
+
 # Maven
 log/
 target/
index aa79ff4..03243ca 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,19 +1,17 @@
 # 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`
@@ -21,14 +19,17 @@ The result is JAR file under "target" folder
 
 
 ### 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
@@ -37,7 +38,7 @@ 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
@@ -46,15 +47,14 @@ log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
 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 ***
index 71df2ab..097282b 100644 (file)
@@ -5,3 +5,4 @@ sphinxcontrib-seqdiag # BSD
 sphinxcontrib-swaggerdoc
 sphinxcontrib-spelling
 sphinxcontrib-plantuml
+six
index 4ef3e71..283240f 100644 (file)
@@ -27,7 +27,7 @@ Environment
 
 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:
@@ -40,4 +40,3 @@ Run the following from project root:
 ``mvn clean install``
 
 The result is JAR file under the ``sdc-distribution-client/target`` folder
-
index cf7b0cf..84949b5 100644 (file)
@@ -52,7 +52,7 @@ Release Data
 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
 ------------
@@ -98,8 +98,8 @@ For more information on the ONAP London release, please see:
 #. `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
index 6e1245c..46075fa 100644 (file)
@@ -7,7 +7,7 @@ skipsdist = true
 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
@@ -16,7 +16,7 @@ commands =
 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
@@ -25,8 +25,7 @@ commands =
 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
-
diff --git a/pom.xml b/pom.xml
index d400bbe..6678630 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
 
        <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>
 
index e1e139d..3386466 100644 (file)
@@ -7,7 +7,7 @@
   <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>
index ec755e7..f9a121b 100644 (file)
  */
 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;
@@ -63,8 +47,7 @@ import org.onap.test.core.config.DistributionClientConfig;
 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;
@@ -79,13 +62,17 @@ class ClientInitializerTest {
     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;
@@ -93,7 +80,7 @@ class ClientInitializerTest {
 
     @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);
@@ -145,8 +132,9 @@ class ClientInitializerTest {
         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();
+        }
     }
 }
index eb11db7..2fd1ac7 100644 (file)
@@ -6,7 +6,7 @@
     <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>
index 25abaa5..0ffe483 100644 (file)
@@ -5,7 +5,7 @@
 
 major=2
 minor=1
-patch=1
+patch=2
 
 base_version=${major}.${minor}.${patch}