summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumer.java3
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventResponseMapper.java3
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumerSpec.groovy6
3 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumer.java b/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumer.java
index d7622fae..bef68a67 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumer.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumer.java
@@ -65,6 +65,9 @@ public class SubscriptionEventConsumer {
if ("subscriptionCreated".equals(subscriptionType)) {
sendSubscriptionResponseMessage(eventKey, "subscriptionCreatedStatus",
formSubscriptionEventResponse(subscriptionEvent));
+ } else if ("subscriptionDeleted".equals(subscriptionType)) {
+ sendSubscriptionResponseMessage(eventKey, "subscriptionDeletedStatus",
+ formSubscriptionEventResponse(subscriptionEvent));
}
}
}
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventResponseMapper.java b/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventResponseMapper.java
index d7609932..49bdfe31 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventResponseMapper.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventResponseMapper.java
@@ -75,7 +75,8 @@ public class SubscriptionEventResponseMapper {
final String subscriptionType,
final String dmiName) {
try {
- return CloudEventBuilder.v1().withId(UUID.randomUUID().toString())
+ return CloudEventBuilder.v1()
+ .withId(UUID.randomUUID().toString())
.withSource(URI.create(dmiName))
.withType(subscriptionType)
.withDataSchema(URI.create("urn:cps:" + SubscriptionEventResponse.class.getName() + ":1.0.0"))
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumerSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumerSpec.groovy
index ba02f535..8382f67f 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumerSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/notifications/avcsubscription/SubscriptionEventConsumerSpec.groovy
@@ -88,7 +88,7 @@ class SubscriptionEventConsumerSpec extends MessagingBaseSpec {
def subscriptionEvent = objectMapper.readValue(jsonData, SubscriptionEvent.class)
objectUnderTest.cmAvcSubscriptionResponseTopic = testTopic
def cloudEvent = CloudEventBuilder.v1().withId(UUID.randomUUID().toString()).withSource(URI.create('test-ncmp-dmi'))
- .withType("subscriptionCreated")
+ .withType(subscriptionType)
.withDataSchema(URI.create("urn:cps:" + SubscriptionEvent.class.getName() + ":1.0.0"))
.withExtension("correlationid", eventKey)
.withTime(OffsetDateTime.ofInstant(timestamp.toInstant(), ZoneId.of("UTC")))
@@ -98,6 +98,10 @@ class SubscriptionEventConsumerSpec extends MessagingBaseSpec {
objectUnderTest.consumeSubscriptionEvent(testEventSent)
then: 'no exception is thrown'
noExceptionThrown()
+ where: 'given #senario'
+ scenario | subscriptionType
+ 'Subscription Create Event' | "subscriptionCreated"
+ 'Subscription Delete Event' | "subscriptionDeleted"
}
def 'Consume invalid message.'() {