[DCAEGEN2] Remove DMaaP dependency in VES-Collector 84/136184/4 1.12.4
authorsushant53 <sushant.jadhav@t-systems.com>
Thu, 19 Oct 2023 07:31:28 +0000 (13:01 +0530)
committersushant53 <sushant.jadhav@t-systems.com>
Fri, 22 Dec 2023 06:43:26 +0000 (12:13 +0530)
Removed DMaaP dependency in VES-Collector by using new sdk library, which
uses Kafka API directly.

Issue-ID: DCAEGEN2-3401
Change-Id: Ia64eac12d05f71194111b82a7987283013c8a7f0
Signed-off-by: sushant53 <sushant.jadhav@t-systems.com>
Changelog.md
pom.xml
src/test/java/org/onap/dcae/common/publishing/DMaapContainer.java
src/test/java/org/onap/dcae/common/publishing/PublisherTest.java
src/test/resources/dmaap-msg-router/message-router-compose.yml
version.properties

index 3b2a1e9..22b2b49 100644 (file)
@@ -4,6 +4,9 @@ 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.12.4] - 2023/10/19
+         - [DCAEGEN2-3401] - Remove DMaaP dependency in VES-Collector
+
 ## [1.12.3] - 2023/02/14
          - [DCAEGEN2-3345] - Test updates for ConfigProcessor, DMaaPConfigurationParser & DMaaPEventPublisher
 
diff --git a/pom.xml b/pom.xml
index d84e761..f941fac 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -5,6 +5,7 @@
     ================================================================================
     Copyright (c) 2017-2019,2021-2023 AT&T Intellectual Property. All rights reserved.
     Copyright (c) 2020-2022 Nokia. All rights reserved.
+    Copyright (c) 2023 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
@@ -25,7 +26,7 @@
   </parent>
   <groupId>org.onap.dcaegen2.collectors.ves</groupId>
   <artifactId>VESCollector</artifactId>
-  <version>1.12.3-SNAPSHOT</version>
+  <version>1.12.4-SNAPSHOT</version>
   <name>dcaegen2-collectors-ves</name>
   <description>VESCollector</description>
   <properties>
@@ -71,7 +72,7 @@
     <springfox-swagger2.version>3.0.0</springfox-swagger2.version>
     <assertj-core.version>3.23.1</assertj-core.version>
     <spring-boot-starter-test.version>2.2.13.RELEASE</spring-boot-starter-test.version>
-    <sdk.version>1.9.0</sdk.version>
+    <sdk.version>1.9.4</sdk.version>
     <guava.version>31.1-jre</guava.version>
     <mock-server.version>5.13.2</mock-server.version>
     <reactor-test.version>3.4.0</reactor-test.version>
       <artifactId>cbs-client</artifactId>
       <version>${sdk.version}</version>
     </dependency>
+    <dependency>
+          <groupId>uk.org.webcompere</groupId>
+          <artifactId>system-stubs-jupiter</artifactId>
+          <version>1.1.0</version>
+          <scope>test</scope>
+      </dependency>
   </dependencies>
   <repositories>
     <repository>
index 404b0ed..8e1652a 100644 (file)
@@ -4,6 +4,7 @@
  * =========================================================
  * Copyright (C) 2019-2021 Nokia. All rights reserved.
  * Copyright (C) 2023 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2023 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.
@@ -25,6 +26,7 @@ import org.onap.dcae.FileReader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testcontainers.containers.DockerComposeContainer;
+import org.testcontainers.containers.wait.strategy.Wait;
 
 import java.io.File;
 import java.net.URI;
@@ -34,8 +36,8 @@ import java.net.URL;
 final class DMaapContainer {
     private static final String MR_COMPOSE_RESOURCE_NAME = "dmaap-msg-router/message-router-compose.yml";
     private static final String DOCKER_COMPOSE_FILE_PATH = getDockerComposeFilePath(MR_COMPOSE_RESOURCE_NAME);
-    static final int DMAAP_SERVICE_EXPOSED_PORT = 3904;
-    static final String DMAAP_SERVICE_NAME = "onap-dmaap";
+    static final int KAFKA_SERVICE_EXPOSED_PORT = 9092;
+    static final String KAFKA_SERVICE_NAME = "kafka";
     private static final Logger log = LoggerFactory.getLogger(DMaapContainer.class);
     
     private DMaapContainer() {}
@@ -51,7 +53,7 @@ final class DMaapContainer {
         }
         return new DockerComposeContainer(
                 new File(dockercomposeuri.getPath()))
-                .withExposedService(DMAAP_SERVICE_NAME, DMAAP_SERVICE_EXPOSED_PORT)
+                .withExposedService(KAFKA_SERVICE_NAME, KAFKA_SERVICE_EXPOSED_PORT, Wait.forListeningPort())
                 .withLocalCompose(true);
     }
 
index be76894..134788b 100644 (file)
@@ -4,6 +4,7 @@
  * ================================================================================
  * Copyright (C) 2021 Nokia. All rights reserved.
  * Copyright (C) 2023 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2023 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.
@@ -24,6 +25,7 @@ import com.google.gson.JsonElement;
 import io.vavr.collection.List;
 import io.vavr.control.Option;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.Assume;
 import org.junit.Before;
 
@@ -34,19 +36,25 @@ import org.testcontainers.junit.jupiter.Container;
 import org.testcontainers.junit.jupiter.Testcontainers;
 import reactor.core.publisher.Flux;
 import reactor.test.StepVerifier;
+import uk.org.webcompere.systemstubs.environment.EnvironmentVariables;
+import uk.org.webcompere.systemstubs.jupiter.SystemStub;
+import uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension;
 
 import java.time.Duration;
 
 import static org.onap.dcae.common.publishing.DMaapContainer.createContainerInstance;
 import static org.onap.dcae.common.publishing.DmaapRequestConfiguration.getAsJsonElements;
 
-
+@ExtendWith(SystemStubsExtension.class)
 @Testcontainers(disabledWithoutDocker = true)
 public class PublisherTest  {
-
+    
+    @SystemStub
+    EnvironmentVariables environmentVariables = new EnvironmentVariables();
+    
     @Container
     private final DockerComposeContainer CONTAINER = createContainerInstance();
-    
+        
     @Before
     public void linuxOnly() {
         Assume.assumeFalse
@@ -56,6 +64,8 @@ public class PublisherTest  {
     @Test
     public void publishEvent_shouldSuccessfullyPublishSingleMessage() {
         //given
+        environmentVariables
+        .set("BOOTSTRAP_SERVERS", "localhost:9092");
         final Publisher publisher = new Publisher();
         final String simpleEvent = "{\"message\":\"message1\"}";
         final List<String> twoJsonMessages = List.of(simpleEvent);
index e110a96..22dbea6 100644 (file)
@@ -32,13 +32,14 @@ services:
       KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS: 40000
       KAFKA_ZOOKEEPER_SESSION_TIMEOUT_MS: 40000
       KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL_PLAINTEXT:PLAINTEXT,EXTERNAL_PLAINTEXT:PLAINTEXT
-      KAFKA_ADVERTISED_LISTENERS: INTERNAL_PLAINTEXT://kafka:9092
+      KAFKA_ADVERTISED_LISTENERS: INTERNAL_PLAINTEXT://localhost:9092
       KAFKA_LISTENERS: INTERNAL_PLAINTEXT://0.0.0.0:9092
       KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL_PLAINTEXT
       KAFKA_CONFLUENT_SUPPORT_METRICS_ENABLE: 'false'
       KAFKA_OPTS: -Djava.security.auth.login.config=/etc/kafka/secrets/jaas/zk_client_jaas.conf
       KAFKA_ZOOKEEPER_SET_ACL: 'true'
       KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
+      KAFKA_CREATE_TOPICS: "topic:1:3"
     volumes:
       - ./zk_client_jaas.conf:/etc/kafka/secrets/jaas/zk_client_jaas.conf
     networks:
@@ -48,25 +49,6 @@ services:
     depends_on:
       - zookeeper
 
-  onap-dmaap:
-    image: nexus3.onap.org:10001/onap/dmaap/dmaap-mr:1.1.20
-    ports:
-      - "3904:3904"
-      - "3905:3905"
-    environment:
-      enableCadi: 'false'
-    volumes:
-      - ./MsgRtrApi.properties:/appl/dmaapMR1/bundleconfig/etc/appprops/MsgRtrApi.properties
-      - ./logback.xml:/appl/dmaapMR1/bundleconfig/etc/logback.xml
-      - ./cadi.properties:/appl/dmaapMR1/etc/cadi.properties
-    networks:
-      net:
-        aliases:
-          - onap-dmaap
-    depends_on:
-      - zookeeper
-      - kafka
-
   mockserver:
     image: mockserver/mockserver:mockserver-5.11.2
     command: -serverPort 1090 -proxyRemotePort 3904 -proxyRemoteHost onap-dmaap
@@ -74,8 +56,6 @@ services:
       - "1080:1090"
     networks:
       - net
-    depends_on:
-      - onap-dmaap
 
 networks:
   net:
index 7bf1a5c..00a4711 100644 (file)
@@ -1,6 +1,6 @@
 major=1
 minor=12
-patch=3
+patch=4
 base_version=${major}.${minor}.${patch}
 release_version=${base_version}
 snapshot_version=${base_version}-SNAPSHOT