diff options
author | seanbeirne <sean.beirne@est.tech> | 2023-12-19 14:18:58 +0000 |
---|---|---|
committer | Sean Beirne <sean.beirne@est.tech> | 2023-12-21 10:24:15 +0000 |
commit | 070d7eb6dfac91df13030ca313202a064a5c6072 (patch) | |
tree | 145b9292722e7d7d1405bda03c563e436b5bb0a6 /cps-ncmp-service/src/test/groovy/org | |
parent | 9437af648dbffc8b186bca8c602c8e574874f6b2 (diff) |
Deprecate use of basic subscription model
- Deprecate json files in resources
Issue-ID: CPS-1973
Signed-off-by: seanbeirne <sean.beirne@est.tech>
Change-Id: I3bf59807f740e3e6f19af0cf0d418edb4f961328
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org')
10 files changed, 24 insertions, 22 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/ClientCmSubscriptionNcmpInEventMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/ClientCmSubscriptionNcmpInEventMapperSpec.groovy index 1427bf9ba1..468a402c00 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/ClientCmSubscriptionNcmpInEventMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/ClientCmSubscriptionNcmpInEventMapperSpec.groovy @@ -39,7 +39,7 @@ class ClientCmSubscriptionNcmpInEventMapperSpec extends Specification { def 'Map clients subscription event to ncmps subscription event'() { given: 'a Subscription Event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json') def testEventToMap = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpInEvent.class) when: 'the client event is mapped to a ncmp subscription event' def result = objectUnderTest.toCmSubscriptionDmiInEvent(testEventToMap) diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventConsumerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventConsumerSpec.groovy index 5d4f5f97ee..1d38d3f023 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventConsumerSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventConsumerSpec.groovy @@ -115,7 +115,7 @@ class CmSubscriptionDmiOutEventConsumerSpec extends MessagingBaseSpec { } def getDmiOutEvent() { - def cmSubscriptionDmiOutEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionDmiOutEvent.json') + def cmSubscriptionDmiOutEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionDmiOutEvent.json') return jsonObjectMapper.convertJsonString(cmSubscriptionDmiOutEventJsonData, CmSubscriptionDmiOutEvent.class) } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventToYangModelSubscriptionEventMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventToYangModelSubscriptionEventMapperSpec.groovy index 519d8e2e0b..1c91cb5d57 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventToYangModelSubscriptionEventMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionDmiOutEventToYangModelSubscriptionEventMapperSpec.groovy @@ -41,7 +41,7 @@ class CmSubscriptionDmiOutEventToYangModelSubscriptionEventMapperSpec extends Sp def 'Map dmi out event to yang model subscription event'() { given: 'a dmi out event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionDmiOutEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionDmiOutEvent.json') def testEventToMap = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionDmiOutEvent.class) when: 'the event is mapped to a yang model subscription' def result = objectUnderTest.toYangModelSubscriptionEvent(testEventToMap) diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionEventToCmSubscriptionNcmpOutEventMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionEventToCmSubscriptionNcmpOutEventMapperSpec.groovy index 891940a41b..17b0984eb9 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionEventToCmSubscriptionNcmpOutEventMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionEventToCmSubscriptionNcmpOutEventMapperSpec.groovy @@ -42,7 +42,7 @@ class CmSubscriptionEventToCmSubscriptionNcmpOutEventMapperSpec extends Specific def 'Map cm subscription event to ncmp out event'() { given: 'a cm subscription event' - def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionEvent.json') + def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionEvent.json') def cmSubscriptionEvent = jsonObjectMapper.convertJsonString(cmSubscriptionEventJsonData, CmSubscriptionEvent.class) when: 'cm subscription event is mapped to ncmp out event' def result = objectUnderTest.toCmSubscriptionNcmpOutEvent(cmSubscriptionEvent) @@ -62,7 +62,7 @@ class CmSubscriptionEventToCmSubscriptionNcmpOutEventMapperSpec extends Specific def 'Map cm subscription event to ncmp out event with the given scenarios causes an exception'() { given: 'a cm subscription event' - def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionEvent.json') + def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionEvent.json') def cmSubscriptionEvent = jsonObjectMapper.convertJsonString(cmSubscriptionEventJsonData, CmSubscriptionEvent.class) and: 'set cm subscription status with given scenarios' cmSubscriptionEvent.setCmSubscriptionStatus(subscriptionStatusList) @@ -79,7 +79,7 @@ class CmSubscriptionEventToCmSubscriptionNcmpOutEventMapperSpec extends Specific def 'Map cm subscription event to ncmp out event without any exception'() { given: 'a cm subscription Event' - def subscriptionResponseJsonData = TestUtils.getResourceFileContent('cmSubscriptionEvent.json') + def subscriptionResponseJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionEvent.json') def subscriptionResponseEvent = jsonObjectMapper.convertJsonString(subscriptionResponseJsonData, CmSubscriptionEvent.class) when: 'cm subscription event is mapped to ncmp out event' objectUnderTest.toCmSubscriptionNcmpOutEvent(subscriptionResponseEvent) diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventConsumerSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventConsumerSpec.groovy index d708bd6584..9484e19a49 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventConsumerSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventConsumerSpec.groovy @@ -52,7 +52,7 @@ class CmSubscriptionNcmpInEventConsumerSpec extends MessagingBaseSpec { def 'Consume, persist and forward valid CM create message'() { given: 'an event with data category CM' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json') def testEventSent = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpInEvent.class) testEventSent.getData().getDataType().setDataCategory(dataCategory) def testCloudEventSent = CloudEventBuilder.v1() @@ -86,7 +86,7 @@ class CmSubscriptionNcmpInEventConsumerSpec extends MessagingBaseSpec { def 'Consume event with wrong datastore causes an exception'() { given: 'an event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json') def testEventSent = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpInEvent.class) and: 'datastore is set to a passthrough-running datastore' testEventSent.getData().getPredicates().setDatastore('operational') diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy index 4a66473ec9..ef3ea88bbd 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventForwarderSpec.groovy @@ -73,7 +73,7 @@ class CmSubscriptionNcmpInEventForwarderSpec extends MessagingBaseSpec { def 'Forward valid CM create subscription and simulate timeout'() { given: 'a ncmp in event' - def ncmpInEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json') + def ncmpInEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json') def ncmpInEventJson = jsonObjectMapper.convertJsonString(ncmpInEventJsonData, CmSubscriptionNcmpInEvent.class) and: 'the InventoryPersistence returns private properties for the supplied CM Handles' 1 * mockInventoryPersistence.getYangModelCmHandles(["CMHandle1", "CMHandle2", "CMHandle3"]) >> [ @@ -116,7 +116,7 @@ class CmSubscriptionNcmpInEventForwarderSpec extends MessagingBaseSpec { def 'Forward CM create subscription where target CM Handles are #scenario'() { given: 'a ncmp in event' - def ncmpInEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json') + def ncmpInEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json') def ncmpInEventJson = jsonObjectMapper.convertJsonString(ncmpInEventJsonData, CmSubscriptionNcmpInEvent.class) and: 'the target CMHandles are set to #scenario' ncmpInEventJson.getData().getPredicates().setTargets(invalidTargets) @@ -133,7 +133,7 @@ class CmSubscriptionNcmpInEventForwarderSpec extends MessagingBaseSpec { def 'Forward valid CM create subscription where targets are not associated to any existing CMHandles'() { given: 'a ncmp in event' - def ncmpInEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json') + def ncmpInEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json') def ncmpInEventJson = jsonObjectMapper.convertJsonString(ncmpInEventJsonData, CmSubscriptionNcmpInEvent.class) and: 'the InventoryPersistence returns no private properties for the supplied CM Handles' 1 * mockInventoryPersistence.getYangModelCmHandles(["CMHandle1", "CMHandle2", "CMHandle3"]) >> [] diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventMapperSpec.groovy index f28e614cc6..6dcc997ec2 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpInEventMapperSpec.groovy @@ -41,7 +41,7 @@ class CmSubscriptionNcmpInEventMapperSpec extends Specification { def 'Map subscription event to yang model subscription event where #scenario'() { given: 'a Subscription Event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpInEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json') def testEventToMap = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpInEvent.class) when: 'the event is mapped to a yang model subscription' def result = objectUnderTest.toYangModelSubscriptionEvent(testEventToMap) diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpOutEventPublisherSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpOutEventPublisherSpec.groovy index 85f8776dfd..725d32437e 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpOutEventPublisherSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/events/deprecated/cmsubscription/CmSubscriptionNcmpOutEventPublisherSpec.groovy @@ -64,10 +64,10 @@ class CmSubscriptionNcmpOutEventPublisherSpec extends DataNodeBaseSpec { def 'Send response to the client apps successfully'() { given: 'a cm subscription event' - def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionEvent.json') + def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionEvent.json') def cmSubscriptionEvent = jsonObjectMapper.convertJsonString(cmSubscriptionEventJsonData, CmSubscriptionEvent.class) and: 'a ncmp out event' - def ncmpOutEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpOutEvent2.json') + def ncmpOutEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpOutEvent2.json') def ncmpOutEvent = jsonObjectMapper.convertJsonString(ncmpOutEventJsonData, CmSubscriptionNcmpOutEvent.class) and: 'a random id for the cloud event' SubscriptionOutcomeCloudMapper.randomId = 'some-id' @@ -89,10 +89,10 @@ class CmSubscriptionNcmpOutEventPublisherSpec extends DataNodeBaseSpec { def 'Create ncmp out message as expected'() { given: 'a cm subscription event' - def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionEvent.json') + def cmSubscriptionEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionEvent.json') def cmSubscriptionEvent = jsonObjectMapper.convertJsonString(cmSubscriptionEventJsonData, CmSubscriptionEvent.class) and: 'a ncmp out event' - def ncmpOutEventJsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpOutEvent.json') + def ncmpOutEventJsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json') def ncmpOutEvent = jsonObjectMapper.convertJsonString(ncmpOutEventJsonData, CmSubscriptionNcmpOutEvent.class) and: 'a status code and status message a per #scenarios' ncmpOutEvent.getData().setStatusCode(statusCode) diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmSubscriptionEventCloudMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/CmSubscriptionEventCloudMapperSpec.groovy index fa2828a4f1..d61a026b73 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmSubscriptionEventCloudMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/CmSubscriptionEventCloudMapperSpec.groovy @@ -18,11 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.api.impl.utils +package org.onap.cps.ncmp.api.impl.util.deprecated import com.fasterxml.jackson.core.JsonProcessingException import com.fasterxml.jackson.databind.ObjectMapper import io.cloudevents.core.builder.CloudEventBuilder +import org.onap.cps.ncmp.api.impl.utils.CmSubscriptionEventCloudMapper import org.onap.cps.ncmp.events.cmsubscription1_0_0.ncmp_to_dmi.CmSubscriptionDmiInEvent import org.onap.cps.ncmp.utils.TestUtils import org.onap.cps.utils.JsonObjectMapper @@ -45,7 +46,7 @@ class CmSubscriptionEventCloudMapperSpec extends Specification { def 'Map the subscription event to data of the cloud event'() { given: 'a subscription event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionDmiInEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionDmiInEvent.json') def testEventData = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionDmiInEvent.class) def testCloudEvent = CloudEventBuilder.v1() @@ -70,7 +71,7 @@ class CmSubscriptionEventCloudMapperSpec extends Specification { def jsonProcessingException = new JsonProcessingException('The Cloud Event could not be constructed') spyObjectMapper.writeValueAsBytes(_) >> { throw jsonProcessingException } and: 'a subscription event of ncmp version' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionDmiInEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionDmiInEvent.json') def testEventData = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionDmiInEvent.class) when: 'the subscription event map to cloud event' diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/SubscriptionOutcomeCloudMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/SubscriptionOutcomeCloudMapperSpec.groovy index d5670eb40d..9d79a8b4bb 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/SubscriptionOutcomeCloudMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/SubscriptionOutcomeCloudMapperSpec.groovy @@ -18,11 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.ncmp.api.impl.utils +package org.onap.cps.ncmp.api.impl.util.deprecated import com.fasterxml.jackson.core.JsonProcessingException import com.fasterxml.jackson.databind.ObjectMapper import io.cloudevents.core.builder.CloudEventBuilder +import org.onap.cps.ncmp.api.impl.utils.SubscriptionOutcomeCloudMapper import org.onap.cps.ncmp.events.cmsubscription1_0_0.ncmp_to_client.CmSubscriptionNcmpOutEvent import org.onap.cps.ncmp.utils.TestUtils import org.onap.cps.utils.JsonObjectMapper @@ -45,7 +46,7 @@ class SubscriptionOutcomeCloudMapperSpec extends Specification { def 'Map the subscription outcome to cloud event'() { given: 'a subscription event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpOutEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json') def testEventData = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpOutEvent.class) def testCloudEvent = CloudEventBuilder.v1() .withData(objectMapper.writeValueAsBytes(testEventData)) @@ -69,7 +70,7 @@ class SubscriptionOutcomeCloudMapperSpec extends Specification { def jsonProcessingException = new JsonProcessingException('The Cloud Event could not be constructed') spyObjectMapper.writeValueAsBytes(_) >> { throw jsonProcessingException } and: 'a cloud event having a subscription outcome in the data part' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpOutEvent.json') + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json') def testEventData = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpOutEvent.class) when: 'the subscription outcome map to cloud event' def expectedResult = objectUnderTest.toCloudEvent(testEventData, 'some-key', 'some-event-type') |