diff options
author | mpriyank <priyank.maheshwari@est.tech> | 2024-02-13 11:50:23 +0000 |
---|---|---|
committer | mpriyank <priyank.maheshwari@est.tech> | 2024-02-13 11:50:29 +0000 |
commit | a3e1ba15f0ed3735e4b7a540371144e7dc9bfa07 (patch) | |
tree | d8666a70c4792505cf357195a0f8c76a51f1176f /cps-ncmp-service | |
parent | c3a058c618cec3e3dbfdd4e7d08a35a682f9a4a3 (diff) |
Prefix with CmNotificationSubscription refactoring
- event schemas are now suffixed with CmNotificationSubscription
- testware updated appropriately
Issue-ID: CPS-2091
Change-Id: I9d0c4bdfaf7ea94812d35b071824d0fb083aa845
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-ncmp-service')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java (renamed from cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventConsumer.java) | 19 | ||||
-rw-r--r-- | cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy (renamed from cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventConsumerSpec.groovy) | 12 |
2 files changed, 15 insertions, 16 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventConsumer.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java index 8bc36943a3..bc798afeed 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventConsumer.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumer.java @@ -25,14 +25,14 @@ import static org.onap.cps.ncmp.api.impl.events.mapper.CloudEventMapper.toTarget import io.cloudevents.CloudEvent; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerRecord; -import org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.client_to_ncmp.CmSubscriptionNcmpInEvent; +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; @Component @Slf4j -public class CmSubscriptionNcmpInEventConsumer { +public class CmNotificationSubscriptionNcmpInEventConsumer { @Value("${notification.enabled:true}") private boolean notificationFeatureEnabled; @@ -46,19 +46,18 @@ public class CmSubscriptionNcmpInEventConsumer { * @param subscriptionEventConsumerRecord the event to be consumed */ @KafkaListener(topics = "${app.ncmp.avc.subscription-topic}", - containerFactory = "cloudEventConcurrentKafkaListenerContainerFactory") + containerFactory = "cloudEventConcurrentKafkaListenerContainerFactory") public void consumeSubscriptionEvent(final ConsumerRecord<String, CloudEvent> subscriptionEventConsumerRecord) { final CloudEvent cloudEvent = subscriptionEventConsumerRecord.value(); - final CmSubscriptionNcmpInEvent cmSubscriptionNcmpInEvent = - toTargetEvent(cloudEvent, CmSubscriptionNcmpInEvent.class); + final CmNotificationSubscriptionNcmpInEvent cmNotificationSubscriptionNcmpInEvent = + toTargetEvent(cloudEvent, CmNotificationSubscriptionNcmpInEvent.class); if (subscriptionModelLoaderEnabled) { log.info("Subscription with name {} to be mapped to hazelcast object...", - cmSubscriptionNcmpInEvent.getData().getSubscriptionId()); + cmNotificationSubscriptionNcmpInEvent.getData().getSubscriptionId()); } - if ("subscriptionCreated".equals(cloudEvent.getType()) && cmSubscriptionNcmpInEvent != null) { - log.info("Subscription for ClientID {} with name {} ...", - cloudEvent.getSource(), - cmSubscriptionNcmpInEvent.getData().getSubscriptionId()); + if ("subscriptionCreated".equals(cloudEvent.getType()) && cmNotificationSubscriptionNcmpInEvent != null) { + log.info("Subscription for ClientID {} with name {} ...", cloudEvent.getSource(), + cmNotificationSubscriptionNcmpInEvent.getData().getSubscriptionId()); } } } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventConsumerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy index 44d6eb6a00..6a3d4bef7b 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmSubscriptionNcmpInEventConsumerSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/cmsubscription/CmNotificationSubscriptionNcmpInEventConsumerSpec.groovy @@ -29,7 +29,7 @@ import io.cloudevents.CloudEvent import io.cloudevents.core.builder.CloudEventBuilder import org.apache.kafka.clients.consumer.ConsumerRecord import org.onap.cps.ncmp.api.kafka.MessagingBaseSpec -import org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.client_to_ncmp.CmSubscriptionNcmpInEvent +import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.client_to_ncmp.CmNotificationSubscriptionNcmpInEvent import org.onap.cps.ncmp.utils.TestUtils import org.onap.cps.utils.JsonObjectMapper import org.slf4j.LoggerFactory @@ -37,9 +37,9 @@ import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest @SpringBootTest(classes = [ObjectMapper, JsonObjectMapper]) -class CmSubscriptionNcmpInEventConsumerSpec extends MessagingBaseSpec { +class CmNotificationSubscriptionNcmpInEventConsumerSpec extends MessagingBaseSpec { - def objectUnderTest = new CmSubscriptionNcmpInEventConsumer() + def objectUnderTest = new CmNotificationSubscriptionNcmpInEventConsumer() def logger = Spy(ListAppender<ILoggingEvent>) @Autowired @@ -49,19 +49,19 @@ class CmSubscriptionNcmpInEventConsumerSpec extends MessagingBaseSpec { ObjectMapper objectMapper void setup() { - ((Logger) LoggerFactory.getLogger(CmSubscriptionNcmpInEventConsumer.class)).addAppender(logger) + ((Logger) LoggerFactory.getLogger(CmNotificationSubscriptionNcmpInEventConsumer.class)).addAppender(logger) logger.start() } void cleanup() { - ((Logger) LoggerFactory.getLogger(CmSubscriptionNcmpInEventConsumer.class)).detachAndStopAllAppenders() + ((Logger) LoggerFactory.getLogger(CmNotificationSubscriptionNcmpInEventConsumer.class)).detachAndStopAllAppenders() } def 'Consume valid CMSubscription create message'() { given: 'a cmsubscription event' def jsonData = TestUtils.getResourceFileContent('cmSubscription/cmSubscriptionNcmpInEvent.json') - def testEventSent = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpInEvent.class) + def testEventSent = jsonObjectMapper.convertJsonString(jsonData, CmNotificationSubscriptionNcmpInEvent.class) def testCloudEventSent = CloudEventBuilder.v1() .withData(objectMapper.writeValueAsBytes(testEventSent)) .withId('subscriptionCreated') |