From 070d7eb6dfac91df13030ca313202a064a5c6072 Mon Sep 17 00:00:00 2001 From: seanbeirne Date: Tue, 19 Dec 2023 14:18:58 +0000 Subject: Deprecate use of basic subscription model - Deprecate json files in resources Issue-ID: CPS-1973 Signed-off-by: seanbeirne Change-Id: I3bf59807f740e3e6f19af0cf0d418edb4f961328 --- ...lientCmSubscriptionNcmpInEventMapperSpec.groovy | 2 +- .../CmSubscriptionDmiOutEventConsumerSpec.groovy | 2 +- ...ntToYangModelSubscriptionEventMapperSpec.groovy | 2 +- ...ntToCmSubscriptionNcmpOutEventMapperSpec.groovy | 6 +- .../CmSubscriptionNcmpInEventConsumerSpec.groovy | 4 +- .../CmSubscriptionNcmpInEventForwarderSpec.groovy | 6 +- .../CmSubscriptionNcmpInEventMapperSpec.groovy | 2 +- .../CmSubscriptionNcmpOutEventPublisherSpec.groovy | 8 +- .../CmSubscriptionEventCloudMapperSpec.groovy | 85 ++++++++++++++++++++++ .../SubscriptionOutcomeCloudMapperSpec.groovy | 83 +++++++++++++++++++++ .../CmSubscriptionEventCloudMapperSpec.groovy | 84 --------------------- .../SubscriptionOutcomeCloudMapperSpec.groovy | 82 --------------------- .../test/resources/cmSubscriptionDmiInEvent.json | 31 -------- .../test/resources/cmSubscriptionDmiOutEvent.json | 19 ----- .../src/test/resources/cmSubscriptionEvent.json | 31 -------- .../test/resources/cmSubscriptionNcmpInEvent.json | 22 ------ .../test/resources/cmSubscriptionNcmpOutEvent.json | 28 ------- .../resources/cmSubscriptionNcmpOutEvent2.json | 20 ----- .../cmSubscriptionDmiInEvent.json | 31 ++++++++ .../cmSubscriptionDmiOutEvent.json | 19 +++++ .../cmSubscriptionEvent.json | 31 ++++++++ .../cmSubscriptionNcmpInEvent.json | 22 ++++++ .../cmSubscriptionNcmpOutEvent.json | 28 +++++++ .../cmSubscriptionNcmpOutEvent2.json | 20 +++++ 24 files changed, 335 insertions(+), 333 deletions(-) create mode 100644 cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/CmSubscriptionEventCloudMapperSpec.groovy create mode 100644 cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/SubscriptionOutcomeCloudMapperSpec.groovy delete mode 100644 cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmSubscriptionEventCloudMapperSpec.groovy delete mode 100644 cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/SubscriptionOutcomeCloudMapperSpec.groovy delete mode 100644 cps-ncmp-service/src/test/resources/cmSubscriptionDmiInEvent.json delete mode 100644 cps-ncmp-service/src/test/resources/cmSubscriptionDmiOutEvent.json delete mode 100644 cps-ncmp-service/src/test/resources/cmSubscriptionEvent.json delete mode 100644 cps-ncmp-service/src/test/resources/cmSubscriptionNcmpInEvent.json delete mode 100644 cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent.json delete mode 100644 cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent2.json create mode 100644 cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiInEvent.json create mode 100644 cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiOutEvent.json create mode 100644 cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionEvent.json create mode 100644 cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json create mode 100644 cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json create mode 100644 cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent2.json (limited to 'cps-ncmp-service') 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 1427bf9ba..468a402c0 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 5d4f5f97e..1d38d3f02 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 519d8e2e0..1c91cb5d5 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 891940a41..17b0984eb 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 d708bd658..9484e19a4 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 4a66473ec..ef3ea88bb 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 f28e614cc..6dcc997ec 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 85f8776df..725d32437 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/util/deprecated/CmSubscriptionEventCloudMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/CmSubscriptionEventCloudMapperSpec.groovy new file mode 100644 index 000000000..d61a026b7 --- /dev/null +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/CmSubscriptionEventCloudMapperSpec.groovy @@ -0,0 +1,85 @@ +/* + * ============LICENSE_START======================================================== + * Copyright (c) 2023 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +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 +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import spock.lang.Specification + +@SpringBootTest(classes = [ObjectMapper, JsonObjectMapper]) +class CmSubscriptionEventCloudMapperSpec extends Specification { + + @Autowired + JsonObjectMapper jsonObjectMapper + + @Autowired + ObjectMapper objectMapper + + def spyObjectMapper = Spy(ObjectMapper) + + def objectUnderTest = new CmSubscriptionEventCloudMapper(spyObjectMapper) + + def 'Map the subscription event to data of the cloud event'() { + given: 'a subscription event' + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionDmiInEvent.json') + def testEventData = jsonObjectMapper.convertJsonString(jsonData, + CmSubscriptionDmiInEvent.class) + def testCloudEvent = CloudEventBuilder.v1() + .withData(objectMapper.writeValueAsBytes(testEventData)) + .withId('some-id') + .withType('subscriptionCreated') + .withSource(URI.create('SCO-9989752')) + .withExtension('correlationid', 'test-cmhandle1').build() + when: 'the subscription event map to data of cloud event' + CmSubscriptionEventCloudMapper.randomId = 'some-id' + def resultCloudEvent = objectUnderTest.toCloudEvent(testEventData, 'some-event-key', 'subscriptionCreated') + then: 'the subscription event resulted having expected values' + resultCloudEvent.getData() == testCloudEvent.getData() + resultCloudEvent.getId() == testCloudEvent.getId() + resultCloudEvent.getType() == testCloudEvent.getType() + resultCloudEvent.getSource() == URI.create('SCO-9989752') + resultCloudEvent.getDataSchema() == URI.create('urn:cps:org.onap.cps.ncmp.events.cmsubscription1_0_0.ncmp_to_dmi.CmSubscriptionDmiInEvent:1.0.0') + } + + def 'Map the subscription event to cloud event with JSON processing exception'() { + given: 'a json processing exception during process' + 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('deprecatedCmSubscription/cmSubscriptionDmiInEvent.json') + def testEventData = jsonObjectMapper.convertJsonString(jsonData, + CmSubscriptionDmiInEvent.class) + when: 'the subscription event map to cloud event' + def expectedResult = objectUnderTest.toCloudEvent(testEventData, 'some-key', 'some-event-type') + then: 'no exception is thrown since it has been handled already' + noExceptionThrown() + and: 'expected result should be null' + expectedResult == null + } + +} diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/SubscriptionOutcomeCloudMapperSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/SubscriptionOutcomeCloudMapperSpec.groovy new file mode 100644 index 000000000..9d79a8b4b --- /dev/null +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/util/deprecated/SubscriptionOutcomeCloudMapperSpec.groovy @@ -0,0 +1,83 @@ +/* + * ============LICENSE_START======================================================== + * Copyright (c) 2023 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +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 +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import spock.lang.Specification + +@SpringBootTest(classes = [ObjectMapper, JsonObjectMapper]) +class SubscriptionOutcomeCloudMapperSpec extends Specification { + + @Autowired + JsonObjectMapper jsonObjectMapper + + @Autowired + ObjectMapper objectMapper + + def spyObjectMapper = Spy(ObjectMapper) + + def objectUnderTest = new SubscriptionOutcomeCloudMapper(spyObjectMapper) + + def 'Map the subscription outcome to cloud event'() { + given: 'a subscription event' + def jsonData = TestUtils.getResourceFileContent('deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json') + def testEventData = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpOutEvent.class) + def testCloudEvent = CloudEventBuilder.v1() + .withData(objectMapper.writeValueAsBytes(testEventData)) + .withId('some-id') + .withType('subscriptionCreatedStatus') + .withSource(URI.create('NCMP')) + .withExtension('correlationid', 'test-cmhandle1').build() + when: 'the subscription event map to data of cloud event' + SubscriptionOutcomeCloudMapper.randomId = 'some-id' + def resultCloudEvent = objectUnderTest.toCloudEvent(testEventData, 'some-event-key', 'subscriptionCreatedStatus') + then: 'the subscription event resulted having expected values' + resultCloudEvent.getData() == testCloudEvent.getData() + resultCloudEvent.getId() == testCloudEvent.getId() + resultCloudEvent.getType() == testCloudEvent.getType() + resultCloudEvent.getSource() == testCloudEvent.getSource() + resultCloudEvent.getDataSchema() == URI.create('urn:cps:org.onap.cps.ncmp.events.cmsubscription1_0_0.ncmp_to_client.CmSubscriptionNcmpOutEvent:1.0.0') + } + + def 'Map the subscription outcome to cloud event with JSON processing exception'() { + given: 'a json processing exception during process' + 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('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') + then: 'no exception is thrown since it has been handled already' + noExceptionThrown() + and: 'expected result should be null' + expectedResult == null + } + +} 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/utils/CmSubscriptionEventCloudMapperSpec.groovy deleted file mode 100644 index fa2828a4f..000000000 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmSubscriptionEventCloudMapperSpec.groovy +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ============LICENSE_START======================================================== - * Copyright (c) 2023 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.cps.ncmp.api.impl.utils - -import com.fasterxml.jackson.core.JsonProcessingException -import com.fasterxml.jackson.databind.ObjectMapper -import io.cloudevents.core.builder.CloudEventBuilder -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 -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.context.SpringBootTest -import spock.lang.Specification - -@SpringBootTest(classes = [ObjectMapper, JsonObjectMapper]) -class CmSubscriptionEventCloudMapperSpec extends Specification { - - @Autowired - JsonObjectMapper jsonObjectMapper - - @Autowired - ObjectMapper objectMapper - - def spyObjectMapper = Spy(ObjectMapper) - - def objectUnderTest = new CmSubscriptionEventCloudMapper(spyObjectMapper) - - def 'Map the subscription event to data of the cloud event'() { - given: 'a subscription event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionDmiInEvent.json') - def testEventData = jsonObjectMapper.convertJsonString(jsonData, - CmSubscriptionDmiInEvent.class) - def testCloudEvent = CloudEventBuilder.v1() - .withData(objectMapper.writeValueAsBytes(testEventData)) - .withId('some-id') - .withType('subscriptionCreated') - .withSource(URI.create('SCO-9989752')) - .withExtension('correlationid', 'test-cmhandle1').build() - when: 'the subscription event map to data of cloud event' - CmSubscriptionEventCloudMapper.randomId = 'some-id' - def resultCloudEvent = objectUnderTest.toCloudEvent(testEventData, 'some-event-key', 'subscriptionCreated') - then: 'the subscription event resulted having expected values' - resultCloudEvent.getData() == testCloudEvent.getData() - resultCloudEvent.getId() == testCloudEvent.getId() - resultCloudEvent.getType() == testCloudEvent.getType() - resultCloudEvent.getSource() == URI.create('SCO-9989752') - resultCloudEvent.getDataSchema() == URI.create('urn:cps:org.onap.cps.ncmp.events.cmsubscription1_0_0.ncmp_to_dmi.CmSubscriptionDmiInEvent:1.0.0') - } - - def 'Map the subscription event to cloud event with JSON processing exception'() { - given: 'a json processing exception during process' - 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 testEventData = jsonObjectMapper.convertJsonString(jsonData, - CmSubscriptionDmiInEvent.class) - when: 'the subscription event map to cloud event' - def expectedResult = objectUnderTest.toCloudEvent(testEventData, 'some-key', 'some-event-type') - then: 'no exception is thrown since it has been handled already' - noExceptionThrown() - and: 'expected result should be null' - expectedResult == null - } - -} 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/utils/SubscriptionOutcomeCloudMapperSpec.groovy deleted file mode 100644 index d5670eb40..000000000 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/SubscriptionOutcomeCloudMapperSpec.groovy +++ /dev/null @@ -1,82 +0,0 @@ -/* - * ============LICENSE_START======================================================== - * Copyright (c) 2023 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.cps.ncmp.api.impl.utils - -import com.fasterxml.jackson.core.JsonProcessingException -import com.fasterxml.jackson.databind.ObjectMapper -import io.cloudevents.core.builder.CloudEventBuilder -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 -import org.springframework.beans.factory.annotation.Autowired -import org.springframework.boot.test.context.SpringBootTest -import spock.lang.Specification - -@SpringBootTest(classes = [ObjectMapper, JsonObjectMapper]) -class SubscriptionOutcomeCloudMapperSpec extends Specification { - - @Autowired - JsonObjectMapper jsonObjectMapper - - @Autowired - ObjectMapper objectMapper - - def spyObjectMapper = Spy(ObjectMapper) - - def objectUnderTest = new SubscriptionOutcomeCloudMapper(spyObjectMapper) - - def 'Map the subscription outcome to cloud event'() { - given: 'a subscription event' - def jsonData = TestUtils.getResourceFileContent('cmSubscriptionNcmpOutEvent.json') - def testEventData = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpOutEvent.class) - def testCloudEvent = CloudEventBuilder.v1() - .withData(objectMapper.writeValueAsBytes(testEventData)) - .withId('some-id') - .withType('subscriptionCreatedStatus') - .withSource(URI.create('NCMP')) - .withExtension('correlationid', 'test-cmhandle1').build() - when: 'the subscription event map to data of cloud event' - SubscriptionOutcomeCloudMapper.randomId = 'some-id' - def resultCloudEvent = objectUnderTest.toCloudEvent(testEventData, 'some-event-key', 'subscriptionCreatedStatus') - then: 'the subscription event resulted having expected values' - resultCloudEvent.getData() == testCloudEvent.getData() - resultCloudEvent.getId() == testCloudEvent.getId() - resultCloudEvent.getType() == testCloudEvent.getType() - resultCloudEvent.getSource() == testCloudEvent.getSource() - resultCloudEvent.getDataSchema() == URI.create('urn:cps:org.onap.cps.ncmp.events.cmsubscription1_0_0.ncmp_to_client.CmSubscriptionNcmpOutEvent:1.0.0') - } - - def 'Map the subscription outcome to cloud event with JSON processing exception'() { - given: 'a json processing exception during process' - 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 testEventData = jsonObjectMapper.convertJsonString(jsonData, CmSubscriptionNcmpOutEvent.class) - when: 'the subscription outcome map to cloud event' - def expectedResult = objectUnderTest.toCloudEvent(testEventData, 'some-key', 'some-event-type') - then: 'no exception is thrown since it has been handled already' - noExceptionThrown() - and: 'expected result should be null' - expectedResult == null - } - -} diff --git a/cps-ncmp-service/src/test/resources/cmSubscriptionDmiInEvent.json b/cps-ncmp-service/src/test/resources/cmSubscriptionDmiInEvent.json deleted file mode 100644 index f31362a1c..000000000 --- a/cps-ncmp-service/src/test/resources/cmSubscriptionDmiInEvent.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "data": { - "subscription": { - "clientID": "SCO-9989752", - "name": "cm-subscription-001" - }, - "dataType": { - "dataspace": "ALL", - "dataCategory": "CM", - "dataProvider": "CM-SERVICE" - }, - "predicates": { - "targets":[ - { - "id":"CMHandle2", - "additional-properties":{ - "Books":"Novel" - } - }, - { - "id":"CMHandle1", - "additional-properties":{ - "Books":"Social Media" - } - } - ], - "datastore": "passthrough-running", - "datastore-xpath-filter": "//_3gpp-nr-nrm-gnbdufunction:GNBDUFunction/_3gpp-nr-nrm-nrcelldu:NRCellDU/ | //_3gpp-nr-nrm-gnbcuupfunction:GNBCUUPFunction// | //_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction/_3gpp-nr-nrm-nrcelldu:NRCellCU// | //_3gpp-nr-nrm-nrsectorcarrier:NRSectorCarrier//" - } - } -} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/cmSubscriptionDmiOutEvent.json b/cps-ncmp-service/src/test/resources/cmSubscriptionDmiOutEvent.json deleted file mode 100644 index ae14b5ca2..000000000 --- a/cps-ncmp-service/src/test/resources/cmSubscriptionDmiOutEvent.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "data": { - "clientId": "SCO-9989752", - "subscriptionName": "cm-subscription-001", - "dmiName": "dminame1", - "subscriptionStatus": [ - { - "id": "CMHandle1", - "status": "REJECTED", - "details": "Some error message from the DMI" - }, - { - "id": "CMHandle2", - "status": "REJECTED", - "details": "Some other error message from the DMI" - } - ] - } -} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/cmSubscriptionEvent.json b/cps-ncmp-service/src/test/resources/cmSubscriptionEvent.json deleted file mode 100644 index c38cb7921..000000000 --- a/cps-ncmp-service/src/test/resources/cmSubscriptionEvent.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "clientId": "SCO-9989752", - "subscriptionName": "cm-subscription-001", - "cmSubscriptionStatus": [ - { - "id": "CMHandle1", - "status": "REJECTED", - "details": "Some error message from the DMI" - }, - { - "id": "CMHandle2", - "status": "REJECTED", - "details": "Some other error message from the DMI" - }, - { - "id": "CMHandle3", - "status": "PENDING", - "details": "Some error causes pending" - }, - { - "id": "CMHandle4", - "status": "PENDING", - "details": "Some other error happened" - }, - { - "id": "CMHandle5", - "status": "PENDING", - "details": "Some other error happened" - } - ] -} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpInEvent.json b/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpInEvent.json deleted file mode 100644 index 803fa48bd..000000000 --- a/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpInEvent.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "data": { - "subscription": { - "clientID": "SCO-9989752", - "name": "cm-subscription-001" - }, - "dataType": { - "dataspace": "ALL", - "dataCategory": "CM", - "dataProvider": "CM-SERVICE" - }, - "predicates": { - "targets": [ - "CMHandle1", - "CMHandle2", - "CMHandle3" - ], - "datastore": "ncmp-datastore:passthrough-running", - "datastore-xpath-filter": "//_3gpp-nr-nrm-gnbdufunction:GNBDUFunction/_3gpp-nr-nrm-nrcelldu:NRCellDU/ | //_3gpp-nr-nrm-gnbcuupfunction:GNBCUUPFunction// | //_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction/_3gpp-nr-nrm-nrcelldu:NRCellCU// | //_3gpp-nr-nrm-nrsectorcarrier:NRSectorCarrier//" - } - } -} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent.json b/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent.json deleted file mode 100644 index 856f238c6..000000000 --- a/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "data": { - "statusCode": 104, - "statusMessage": "partially applied subscription", - "additionalInfo": { - "rejected": [ - { - "details": "Some other error message from the DMI", - "targets": ["CMHandle2"] - }, - { - "details": "Some error message from the DMI", - "targets": ["CMHandle1"] - } - ], - "pending": [ - { - "details": "Some other error happened", - "targets": ["CMHandle4", "CMHandle5"] - }, - { - "details": "Some error causes pending", - "targets": ["CMHandle3"] - } - ] - } - } -} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent2.json b/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent2.json deleted file mode 100644 index 35ff0241d..000000000 --- a/cps-ncmp-service/src/test/resources/cmSubscriptionNcmpOutEvent2.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "data": { - "statusCode": 104, - "statusMessage": "partially applied subscription", - "additionalInfo": { - "rejected": [ - { - "details": "Cm handle does not exist", - "targets": ["CMHandle1"] - } - ], - "pending": [ - { - "details": "Subscription forwarded to dmi plugin", - "targets": ["CMHandle3"] - } - ] - } - } -} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiInEvent.json b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiInEvent.json new file mode 100644 index 000000000..f31362a1c --- /dev/null +++ b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiInEvent.json @@ -0,0 +1,31 @@ +{ + "data": { + "subscription": { + "clientID": "SCO-9989752", + "name": "cm-subscription-001" + }, + "dataType": { + "dataspace": "ALL", + "dataCategory": "CM", + "dataProvider": "CM-SERVICE" + }, + "predicates": { + "targets":[ + { + "id":"CMHandle2", + "additional-properties":{ + "Books":"Novel" + } + }, + { + "id":"CMHandle1", + "additional-properties":{ + "Books":"Social Media" + } + } + ], + "datastore": "passthrough-running", + "datastore-xpath-filter": "//_3gpp-nr-nrm-gnbdufunction:GNBDUFunction/_3gpp-nr-nrm-nrcelldu:NRCellDU/ | //_3gpp-nr-nrm-gnbcuupfunction:GNBCUUPFunction// | //_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction/_3gpp-nr-nrm-nrcelldu:NRCellCU// | //_3gpp-nr-nrm-nrsectorcarrier:NRSectorCarrier//" + } + } +} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiOutEvent.json b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiOutEvent.json new file mode 100644 index 000000000..ae14b5ca2 --- /dev/null +++ b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionDmiOutEvent.json @@ -0,0 +1,19 @@ +{ + "data": { + "clientId": "SCO-9989752", + "subscriptionName": "cm-subscription-001", + "dmiName": "dminame1", + "subscriptionStatus": [ + { + "id": "CMHandle1", + "status": "REJECTED", + "details": "Some error message from the DMI" + }, + { + "id": "CMHandle2", + "status": "REJECTED", + "details": "Some other error message from the DMI" + } + ] + } +} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionEvent.json b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionEvent.json new file mode 100644 index 000000000..c38cb7921 --- /dev/null +++ b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionEvent.json @@ -0,0 +1,31 @@ +{ + "clientId": "SCO-9989752", + "subscriptionName": "cm-subscription-001", + "cmSubscriptionStatus": [ + { + "id": "CMHandle1", + "status": "REJECTED", + "details": "Some error message from the DMI" + }, + { + "id": "CMHandle2", + "status": "REJECTED", + "details": "Some other error message from the DMI" + }, + { + "id": "CMHandle3", + "status": "PENDING", + "details": "Some error causes pending" + }, + { + "id": "CMHandle4", + "status": "PENDING", + "details": "Some other error happened" + }, + { + "id": "CMHandle5", + "status": "PENDING", + "details": "Some other error happened" + } + ] +} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json new file mode 100644 index 000000000..803fa48bd --- /dev/null +++ b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpInEvent.json @@ -0,0 +1,22 @@ +{ + "data": { + "subscription": { + "clientID": "SCO-9989752", + "name": "cm-subscription-001" + }, + "dataType": { + "dataspace": "ALL", + "dataCategory": "CM", + "dataProvider": "CM-SERVICE" + }, + "predicates": { + "targets": [ + "CMHandle1", + "CMHandle2", + "CMHandle3" + ], + "datastore": "ncmp-datastore:passthrough-running", + "datastore-xpath-filter": "//_3gpp-nr-nrm-gnbdufunction:GNBDUFunction/_3gpp-nr-nrm-nrcelldu:NRCellDU/ | //_3gpp-nr-nrm-gnbcuupfunction:GNBCUUPFunction// | //_3gpp-nr-nrm-gnbcucpfunction:GNBCUCPFunction/_3gpp-nr-nrm-nrcelldu:NRCellCU// | //_3gpp-nr-nrm-nrsectorcarrier:NRSectorCarrier//" + } + } +} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json new file mode 100644 index 000000000..856f238c6 --- /dev/null +++ b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent.json @@ -0,0 +1,28 @@ +{ + "data": { + "statusCode": 104, + "statusMessage": "partially applied subscription", + "additionalInfo": { + "rejected": [ + { + "details": "Some other error message from the DMI", + "targets": ["CMHandle2"] + }, + { + "details": "Some error message from the DMI", + "targets": ["CMHandle1"] + } + ], + "pending": [ + { + "details": "Some other error happened", + "targets": ["CMHandle4", "CMHandle5"] + }, + { + "details": "Some error causes pending", + "targets": ["CMHandle3"] + } + ] + } + } +} \ No newline at end of file diff --git a/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent2.json b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent2.json new file mode 100644 index 000000000..35ff0241d --- /dev/null +++ b/cps-ncmp-service/src/test/resources/deprecatedCmSubscription/cmSubscriptionNcmpOutEvent2.json @@ -0,0 +1,20 @@ +{ + "data": { + "statusCode": 104, + "statusMessage": "partially applied subscription", + "additionalInfo": { + "rejected": [ + { + "details": "Cm handle does not exist", + "targets": ["CMHandle1"] + } + ], + "pending": [ + { + "details": "Subscription forwarded to dmi plugin", + "targets": ["CMHandle3"] + } + ] + } + } +} \ No newline at end of file -- cgit 1.2.3-korg