diff options
author | Lee Anjella Macabuhay <lee.anjella.macabuhay@est.tech> | 2024-08-06 15:43:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-08-06 15:43:02 +0000 |
commit | 31209db54274d33d7b68d674ae4c9404f6b7fc6d (patch) | |
tree | 260de43f0af99edf42775cdb83d4a1434318bbbd /cps-ncmp-service/src/test | |
parent | 273638207e7af2d679138e47ae8c277f3ef3d988 (diff) | |
parent | d42040c6444f41a829f6520850ca5e6b40ddaa2f (diff) |
Merge "Handle null NcmpOut event"
Diffstat (limited to 'cps-ncmp-service/src/test')
-rw-r--r-- | cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/ncmp/NcmpOutEventProducerSpec.groovy | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/ncmp/NcmpOutEventProducerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/ncmp/NcmpOutEventProducerSpec.groovy index e03682d8c9..afa2e9874e 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/ncmp/NcmpOutEventProducerSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/cmnotificationsubscription/ncmp/NcmpOutEventProducerSpec.groovy @@ -83,5 +83,24 @@ class NcmpOutEventProducerSpec extends Specification { 1 * mockDmiCacheHandler.removeAcceptedAndRejectedDmiSubscriptionEntries(subscriptionId) } + def 'No event published when NCMP out event is null'() { + given: 'a cm subscription response for the client' + def subscriptionId = 'test-subscription-id-3' + def eventType = 'subscriptionCreateResponse' + def ncmpOutEvent = null + and: 'also we have target topic for publishing to client' + objectUnderTest.ncmpOutEventTopic = 'client-test-topic' + and: 'a deadline to an event' + objectUnderTest.dmiOutEventTimeoutInMs = 1000 + when: 'the event is scheduled to be published' + objectUnderTest.publishNcmpOutEvent(subscriptionId, eventType, ncmpOutEvent, true) + then: 'we wait for 10ms and then we receive response from DMI' + Thread.sleep(10) + and: 'we receive NO response from DMI so we publish the message on demand' + objectUnderTest.publishNcmpOutEvent(subscriptionId, eventType, ncmpOutEvent, false) + and: 'no event published' + 0 * mockEventsPublisher.publishCloudEvent(*_) + } + } |