X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Fimpl%2Fevent%2Favc%2FSubscriptionEventConsumerSpec.groovy;h=d801e4ddf78d1e01e447c6dcc6badc9cd6c9945c;hb=08154cd815640ba673bad8905d7889e3dca9f591;hp=248eb8bbe295aeb032ab0848e2c2a16ae37b3997;hpb=dd3643411ed8bb581a3147e07606919c3b1675d3;p=cps.git diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/SubscriptionEventConsumerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/SubscriptionEventConsumerSpec.groovy index 248eb8bbe..d801e4ddf 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/SubscriptionEventConsumerSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/SubscriptionEventConsumerSpec.groovy @@ -50,6 +50,8 @@ class SubscriptionEventConsumerSpec extends MessagingBaseSpec { def testEventSent = jsonObjectMapper.convertJsonString(jsonData, SubscriptionEvent.class) and: 'notifications are enabled' objectUnderTest.notificationFeatureEnabled = true + and: 'subscription model loader is enabled' + objectUnderTest.subscriptionModelLoaderEnabled = true when: 'the valid event is consumed' objectUnderTest.consumeSubscriptionEvent(testEventSent) then: 'the event is mapped to a yangModelSubscription' @@ -60,18 +62,20 @@ class SubscriptionEventConsumerSpec extends MessagingBaseSpec { 1 * mockSubscriptionEventForwarder.forwardCreateSubscriptionEvent(testEventSent) } - def 'Consume and persist valid CM create message where notifications are disabled'() { + def 'Consume valid CM create message where notifications and model loader are disabled'() { given: 'an event with data category CM' def jsonData = TestUtils.getResourceFileContent('avcSubscriptionCreationEvent.json') def testEventSent = jsonObjectMapper.convertJsonString(jsonData, SubscriptionEvent.class) and: 'notifications are disabled' objectUnderTest.notificationFeatureEnabled = false + and: 'subscription model loader is disabled' + objectUnderTest.subscriptionModelLoaderEnabled = false when: 'the valid event is consumed' objectUnderTest.consumeSubscriptionEvent(testEventSent) - then: 'the event is mapped to a yangModelSubscription' - 1 * mockSubscriptionEventMapper.toYangModelSubscriptionEvent(testEventSent) >> yangModelSubscriptionEvent - and: 'the event is persisted' - 1 * mockSubscriptionPersistence.saveSubscriptionEvent(yangModelSubscriptionEvent) + then: 'the event is not mapped to a yangModelSubscription' + 0 * mockSubscriptionEventMapper.toYangModelSubscriptionEvent(*_) >> yangModelSubscriptionEvent + and: 'the event is not persisted' + 0 * mockSubscriptionPersistence.saveSubscriptionEvent(*_) and: 'the event is not forwarded' 0 * mockSubscriptionEventForwarder.forwardCreateSubscriptionEvent(*_) }