CmSubscription topics param update 48/137948/2
authormpriyank <priyank.maheshwari@est.tech>
Thu, 16 May 2024 15:35:49 +0000 (16:35 +0100)
committermpriyank <priyank.maheshwari@est.tech>
Fri, 17 May 2024 09:18:54 +0000 (10:18 +0100)
- topic application parameters updated to be in sync with the actual
  convention we are following for the flow.
- environment variables also updated to follow the same
- removed the unused parameters related to notification

Issue-ID: CPS-2210
Change-Id: If5adb3dac1ce81df5afe2e99f99513adc2011cc9
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
cps-application/src/main/resources/application.yml
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/consumer/CmNotificationSubscriptionDmiOutEventConsumer.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/consumer/CmNotificationSubscriptionNcmpInEventConsumer.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/producer/CmNotificationSubscriptionDmiInEventProducer.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/producer/CmNotificationSubscriptionNcmpOutEventProducer.java
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy
cps-ncmp-service/src/test/resources/application.yml
integration-test/src/test/resources/application.yml

index 8100680..3f4fdda 100644 (file)
@@ -101,10 +101,10 @@ app:
         async-m2m:
             topic: ${NCMP_ASYNC_M2M_TOPIC:ncmp-async-m2m}
         avc:
-            subscription-topic: ${NCMP_CM_AVC_SUBSCRIPTION:subscription}
-            subscription-forward-topic-prefix: ${NCMP_FORWARD_CM_AVC_SUBSCRIPTION:ncmp-dmi-cm-avc-subscription-}
-            subscription-response-topic: ${NCMP_RESPONSE_CM_AVC_SUBSCRIPTION:dmi-ncmp-cm-avc-subscription}
-            subscription-outcome-topic: ${NCMP_OUTCOME_CM_AVC_SUBSCRIPTION:subscription-response}
+            cm-subscription-ncmp-in: ${CM_SUBSCRIPTION_NCMP_IN_TOPIC:subscription}
+            cm-subscription-dmi-in: ${CM_SUBSCRIPTION_DMI_IN_TOPIC:ncmp-dmi-cm-avc-subscription}
+            cm-subscription-dmi-out: ${CM_SUBSCRIPTION_DMI_OUT_TOPIC:dmi-ncmp-cm-avc-subscription}
+            cm-subscription-ncmp-out: ${CM_SUBSCRIPTION_NCMP_OUT_TOPIC:subscription-response}
             cm-events-topic: ${NCMP_CM_EVENTS_TOPIC:cm-events}
     lcm:
         events:
index fb89aae..3e072b0 100644 (file)
@@ -51,7 +51,7 @@ public class CmNotificationSubscriptionDmiOutEventConsumer {
      *
      * @param cmNotificationSubscriptionDmiOutEventConsumerRecord the event to be consumed
      */
-    @KafkaListener(topics = "${app.ncmp.avc.subscription-response-topic}",
+    @KafkaListener(topics = "${app.ncmp.avc.cm-subscription-dmi-out}",
             containerFactory = "cloudEventConcurrentKafkaListenerContainerFactory")
     public void consumeCmNotificationSubscriptionDmiOutEvent(
             final ConsumerRecord<String, CloudEvent> cmNotificationSubscriptionDmiOutEventConsumerRecord) {
index 70135b3..2c544b7 100644 (file)
@@ -28,7 +28,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.kafka.clients.consumer.ConsumerRecord;
 import org.onap.cps.ncmp.api.impl.events.cmsubscription.service.CmNotificationSubscriptionHandlerService;
 import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.client_to_ncmp.CmNotificationSubscriptionNcmpInEvent;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.kafka.annotation.KafkaListener;
 import org.springframework.stereotype.Component;
 
@@ -39,15 +38,12 @@ public class CmNotificationSubscriptionNcmpInEventConsumer {
 
     private final CmNotificationSubscriptionHandlerService cmNotificationSubscriptionHandlerService;
 
-    @Value("${notification.enabled:true}")
-    private boolean notificationFeatureEnabled;
-
     /**
      * Consume the specified event.
      *
      * @param subscriptionEventConsumerRecord the event to be consumed
      */
-    @KafkaListener(topics = "${app.ncmp.avc.subscription-topic}",
+    @KafkaListener(topics = "${app.ncmp.avc.cm-subscription-ncmp-in}",
             containerFactory = "cloudEventConcurrentKafkaListenerContainerFactory")
     public void consumeSubscriptionEvent(final ConsumerRecord<String, CloudEvent> subscriptionEventConsumerRecord) {
         final CloudEvent cloudEvent = subscriptionEventConsumerRecord.value();
@@ -60,7 +56,7 @@ public class CmNotificationSubscriptionNcmpInEventConsumer {
         if ("subscriptionCreateRequest".equals(cloudEvent.getType())) {
             log.info("Subscription for source {} with subscription id {} ...", cloudEvent.getSource(), subscriptionId);
             cmNotificationSubscriptionHandlerService.processSubscriptionCreateRequest(
-                cmNotificationSubscriptionNcmpInEvent);
+                    cmNotificationSubscriptionNcmpInEvent);
         }
     }
 }
\ No newline at end of file
index 9fbe268..3273c55 100644 (file)
@@ -25,7 +25,6 @@ import io.cloudevents.core.builder.CloudEventBuilder;
 import java.net.URI;
 import java.util.UUID;
 import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
 import org.onap.cps.events.EventsPublisher;
 import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.ncmp_to_dmi.CmNotificationSubscriptionDmiInEvent;
 import org.onap.cps.utils.JsonObjectMapper;
@@ -34,7 +33,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.stereotype.Component;
 
 @Component
-@Slf4j
 @RequiredArgsConstructor
 @ConditionalOnProperty(name = "notification.enabled", havingValue = "true", matchIfMissing = true)
 public class CmNotificationSubscriptionDmiInEventProducer {
@@ -42,7 +40,7 @@ public class CmNotificationSubscriptionDmiInEventProducer {
     private final EventsPublisher<CloudEvent> eventsPublisher;
     private final JsonObjectMapper jsonObjectMapper;
 
-    @Value("${app.ncmp.avc.subscription-forward-topic-prefix}")
+    @Value("${app.ncmp.avc.cm-subscription-dmi-in}")
     private String cmNotificationSubscriptionDmiInEventTopic;
 
     /**
@@ -65,9 +63,10 @@ public class CmNotificationSubscriptionDmiInEventProducer {
             final String dmiPluginName, final String eventType,
             final CmNotificationSubscriptionDmiInEvent cmNotificationSubscriptionDmiInEvent) {
         return CloudEventBuilder.v1().withId(UUID.randomUUID().toString()).withType(eventType)
-                .withSource(URI.create("NCMP")).withDataSchema(URI.create("org.onap.ncmp.dmi.cm.subscription:1.0.0"))
-                .withExtension("correlationid", subscriptionId.concat("#").concat(dmiPluginName))
-                .withData(jsonObjectMapper.asJsonBytes(cmNotificationSubscriptionDmiInEvent)).build();
+                       .withSource(URI.create("NCMP"))
+                       .withDataSchema(URI.create("org.onap.ncmp.dmi.cm.subscription:1.0.0"))
+                       .withExtension("correlationid", subscriptionId.concat("#").concat(dmiPluginName))
+                       .withData(jsonObjectMapper.asJsonBytes(cmNotificationSubscriptionDmiInEvent)).build();
     }
 
 
index ac5de07..ed7ed2a 100644 (file)
@@ -48,7 +48,7 @@ import org.springframework.stereotype.Component;
 @ConditionalOnProperty(name = "notification.enabled", havingValue = "true", matchIfMissing = true)
 public class CmNotificationSubscriptionNcmpOutEventProducer {
 
-    @Value("${app.ncmp.avc.subscription-outcome-topic}")
+    @Value("${app.ncmp.avc.cm-subscription-ncmp-out}")
     private String cmNotificationSubscriptionNcmpOutEventTopic;
 
     @Value("${ncmp.timers.subscription-forwarding.dmi-response-timeout-ms}")
index 9c84c51..f07f3c1 100644 (file)
@@ -72,8 +72,6 @@ class CmNotificationSubscriptionNcmpInEventConsumerSpec extends MessagingBaseSpe
                 .withSource(URI.create('some-resource'))
                 .withExtension('correlationid', 'test-cmhandle1').build()
             def consumerRecord = new ConsumerRecord<String, CloudEvent>('topic-name', 0, 0, 'event-key', testCloudEventSent)
-        and: 'notifications are enabled'
-            objectUnderTest.notificationFeatureEnabled = true
         when: 'the valid event is consumed'
             objectUnderTest.consumeSubscriptionEvent(consumerRecord)
         then: 'an event is logged with level INFO'
index 574b499..cd68f9b 100644 (file)
@@ -1,5 +1,5 @@
 #  ============LICENSE_START=======================================================
-#  Copyright (C) 2021-2023 Nordix Foundation
+#  Copyright (C) 2021-2024 Nordix Foundation
 #  ================================================================================
 #  Licensed under the Apache License, Version 2.0 (the "License");
 #  you may not use this file except in compliance with the License.
@@ -30,9 +30,9 @@ app:
         async-m2m:
             topic: ncmp-async-m2m
         avc:
-            subscription-topic: subscription
+            cm-subscription-ncmp-in: subscription
             cm-events-topic: cm-events
-            subscription-forward-topic-prefix: ${NCMP_FORWARD_CM_AVC_SUBSCRIPTION:ncmp-dmi-cm-avc-subscription-}
+            cm-subscription-dmi-in: ${CM_SUBSCRIPTION_DMI_IN_TOPIC:ncmp-dmi-cm-avc-subscription}
 
 ncmp:
     dmi:
index 6fd3bca..adfb86d 100644 (file)
@@ -97,10 +97,10 @@ app:
     async-m2m:
       topic: ${NCMP_ASYNC_M2M_TOPIC:ncmp-async-m2m}
     avc:
-      subscription-topic: ${NCMP_CM_AVC_SUBSCRIPTION:subscription}
-      subscription-forward-topic-prefix: ${NCMP_FORWARD_CM_AVC_SUBSCRIPTION:ncmp-dmi-cm-avc-subscription-}
-      subscription-response-topic: ${NCMP_RESPONSE_CM_AVC_SUBSCRIPTION:dmi-ncmp-cm-avc-subscription}
-      subscription-outcome-topic: ${NCMP_OUTCOME_CM_AVC_SUBSCRIPTION:subscription-response}
+      cm-subscription-ncmp-in: ${CM_SUBSCRIPTION_NCMP_IN_TOPIC:subscription}
+      cm-subscription-dmi-in: ${CM_SUBSCRIPTION_DMI_IN_TOPIC:ncmp-dmi-cm-avc-subscription}
+      cm-subscription-dmi-out: ${CM_SUBSCRIPTION_DMI_OUT_TOPIC:dmi-ncmp-cm-avc-subscription}
+      cm-subscription-ncmp-out: ${CM_SUBSCRIPTION_NCMP_OUT_TOPIC:subscription-response}
       cm-events-topic: ${NCMP_CM_EVENTS_TOPIC:cm-events}
   lcm:
     events: