diff options
-rw-r--r-- | cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-dmi-in-event-schema-1.0.0.json (renamed from cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-dmi-in-event-schema-1.0.0.json) | 10 | ||||
-rw-r--r-- | cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-dmi-out-event-schema-1.0.0.json (renamed from cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-dmi-out-event-schema-1.0.0.json) | 12 | ||||
-rw-r--r-- | cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-ncmp-in-event-schema-1.0.0.json (renamed from cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-ncmp-in-event-schema-1.0.0.json) | 8 | ||||
-rw-r--r-- | cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-ncmp-out-event-schema-1.0.0.json (renamed from cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-ncmp-out-event-schema-1.0.0.json) | 10 | ||||
-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 |
6 files changed, 35 insertions, 36 deletions
diff --git a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-dmi-in-event-schema-1.0.0.json b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-dmi-in-event-schema-1.0.0.json index 4d4d504ec8..dcba93c014 100644 --- a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-dmi-in-event-schema-1.0.0.json +++ b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-dmi-in-event-schema-1.0.0.json @@ -1,12 +1,12 @@ { "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "urn:cps:org.onap.cps.ncmp.events:cm-subscription-dmi-in-event-schema:1.0.0", - "$ref": "#/definitions/CmSubscriptionDmiInEvent", + "$id": "urn:cps:org.onap.cps.ncmp.events:cm-notification-subscription-dmi-in-event-schema:1.0.0", + "$ref": "#/definitions/CmNotificationSubscriptionDmiInEvent", "definitions": { - "CmSubscriptionDmiInEvent": { - "description": "The payload for cm subscription merge event incoming message from NCMP.", + "CmNotificationSubscriptionDmiInEvent": { + "description": "The payload for cm notification subscription event incoming message from NCMP.", "type": "object", - "javaType": "org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.ncmp_to_dmi.CmSubscriptionDmiInEvent", + "javaType": "org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.ncmp_to_dmi.CmNotificationSubscriptionDmiInEvent", "additionalProperties": false, "properties": { "data": { diff --git a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-dmi-out-event-schema-1.0.0.json b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-dmi-out-event-schema-1.0.0.json index 5ae6225be6..538716ab55 100644 --- a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-dmi-out-event-schema-1.0.0.json +++ b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-dmi-out-event-schema-1.0.0.json @@ -1,13 +1,13 @@ { "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "urn:cps:org.onap.cps.ncmp.events:cm-subscription-dmi-out-event-schema:1.0.0", - "$ref": "#/definitions/CmSubscriptionDmiOutEvent", + "$id": "urn:cps:org.onap.cps.ncmp.events:cm-notification-subscription-dmi-out-event-schema:1.0.0", + "$ref": "#/definitions/CmNotificationSubscriptionDmiOutEvent", "definitions": { - "CmSubscriptionDmiOutEvent": { - "description": "The payload for cm subscription merge event coming out from DMI Plugin.", + "CmNotificationSubscriptionDmiOutEvent": { + "description": "The payload for cm notification subscription merge event coming out from DMI Plugin.", "type": "object", "additionalProperties": false, - "javaType": "org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.dmi_to_ncmp.CmSubscriptionDmiOutEvent", + "javaType": "org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.dmi_to_ncmp.CmNotificationSubscriptionDmiOutEvent", "properties": { "data": { "$ref": "#/definitions/Data" @@ -16,7 +16,7 @@ "required": [ "data" ], - "title": "CmSubscriptionDmiOutEvent" + "title": "CmNotificationSubscriptionDmiOutEvent" }, "Data": { "type": "object", diff --git a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-ncmp-in-event-schema-1.0.0.json b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-ncmp-in-event-schema-1.0.0.json index ffdc2e36b7..55769338b1 100644 --- a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-ncmp-in-event-schema-1.0.0.json +++ b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-ncmp-in-event-schema-1.0.0.json @@ -1,11 +1,11 @@ { - "$id": "urn:cps:org.onap.cps.ncmp.events:cm-subscription-ncmp-in-event:1.0.0", - "$ref": "#/definitions/CmSubscriptionNcmpInEvent", + "$id": "urn:cps:org.onap.cps.ncmp.events:cm-notification-subscription-ncmp-in-event:1.0.0", + "$ref": "#/definitions/CmNotificationSubscriptionNcmpInEvent", "$schema": "https://json-schema.org/draft/2019-09/schema", "definitions": { - "CmSubscriptionNcmpInEvent": { + "CmNotificationSubscriptionNcmpInEvent": { "description": "The payload for subscription merge event.", - "javaType": "org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.client_to_ncmp.CmSubscriptionNcmpInEvent", + "javaType": "org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.client_to_ncmp.CmNotificationSubscriptionNcmpInEvent", "properties": { "data": { "properties": { diff --git a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-ncmp-out-event-schema-1.0.0.json b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-ncmp-out-event-schema-1.0.0.json index e5659a7b61..d9db3ffb97 100644 --- a/cps-ncmp-events/src/main/resources/schemas/cmsubscription/cm-subscription-ncmp-out-event-schema-1.0.0.json +++ b/cps-ncmp-events/src/main/resources/schemas/cmnotificationsubscription/cm-notification-subscription-ncmp-out-event-schema-1.0.0.json @@ -1,12 +1,12 @@ { "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "urn:cps:org.onap.cps.ncmp.events:cm-subscription-ncmp-out-event-schema:1.0.0", - "$ref": "#/definitions/CmSubscriptionNcmpOutEvent", + "$id": "urn:cps:org.onap.cps.ncmp.events:cm-notification-subscription-ncmp-out-event-schema:1.0.0", + "$ref": "#/definitions/CmNotificationSubscriptionNcmpOutEvent", "definitions": { - "CmSubscriptionNcmpOutEvent": { + "CmNotificationSubscriptionNcmpOutEvent": { "type": "object", "description": "The payload applied cm subscription merge event coming out from NCMP.", - "javaType": "org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.ncmp_to_client.CmSubscriptionNcmpOutEvent", + "javaType": "org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.ncmp_to_client.CmNotificationSubscriptionNcmpOutEvent", "additionalProperties": false, "properties": { "data": { @@ -16,7 +16,7 @@ "required": [ "data" ], - "title": "CmSubscriptionNcmpOutEvent" + "title": "CmNotificationSubscriptionNcmpOutEvent" }, "Data": { "type": "object", 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') |