aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src/test/groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-rest/src/test/groovy')
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy9
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy8
2 files changed, 10 insertions, 7 deletions
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy
index 0bc0c1e55..b5f61adc5 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NcmpRestInputMapperSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2023 Nordix Foundation
+ * Copyright (C) 2022-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ class NcmpRestInputMapperSpec extends Specification {
def 'Convert a created REST CM Handle Input to an NCMP Service CM Handle with #scenario'() {
given: 'a rest cm handle input'
def inputRestCmHandle = new RestInputCmHandle(cmHandle : 'example-id', cmHandleProperties: registrationDmiProperties,
- publicCmHandleProperties: registrationPublicProperties, trustLevel: registrationTrustLevel, alternateId: 'my-alternate-id', moduleSetTag: 'my-module-set-tag')
+ publicCmHandleProperties: registrationPublicProperties, trustLevel: registrationTrustLevel, alternateId: 'my-alternate-id', moduleSetTag: 'my-module-set-tag', dataProducerIdentifier: 'my-data-producer-identifier')
def restDmiPluginRegistration = new RestDmiPluginRegistration(
createdCmHandles: [inputRestCmHandle])
when: 'to plugin dmi registration is called'
@@ -53,10 +53,11 @@ class NcmpRestInputMapperSpec extends Specification {
and: '(empty) properties are converted correctly'
result.createdCmHandles[0].dmiProperties == mappedDmiProperties
result.createdCmHandles[0].publicProperties == mappedPublicProperties
- result.createdCmHandles[0].registrationTrustLevel == mappedTrustLevel
- and: 'alternate ID and module set tag converted correctly'
+ and: 'other fields are mapped correctly'
result.createdCmHandles[0].alternateId == 'my-alternate-id'
result.createdCmHandles[0].moduleSetTag == 'my-module-set-tag'
+ result.createdCmHandles[0].registrationTrustLevel == mappedTrustLevel
+ result.createdCmHandles[0].dataProducerIdentifier == 'my-data-producer-identifier'
where: 'the following parameters are used'
scenario | registrationDmiProperties | registrationPublicProperties | registrationTrustLevel || mappedDmiProperties | mappedPublicProperties | mappedTrustLevel
'dmi and public properties' | ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | 'COMPLETE' || ['Property-Example': 'example property'] | ['Public-Property-Example': 'public example property'] | TrustLevel.COMPLETE
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
index dba2b30fd..616492d4e 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy
@@ -357,9 +357,11 @@ class NetworkCmProxyControllerSpec extends Specification {
def cmHandle2 = new NcmpServiceCmHandle()
cmHandle2.cmHandleId = 'ch-2'
cmHandle2.publicProperties = [color: 'green']
+ cmHandle2.alternateId = 'someAlternateId'
+ cmHandle2.moduleSetTag = 'someModuleSetTag'
+ cmHandle2.dataProducerIdentifier = 'someDataProducerIdentifier'
mockNetworkCmProxyDataService.executeCmHandleSearch(_) >> [cmHandle1, cmHandle2]
and: 'map for trust level per cmHandle has value for only one cm handle'
-// trustLevelPerCmHandle.get('') >> { TrustLevel.NONE }
trustLevelPerCmHandle.put('ch-1', TrustLevel.NONE)
when: 'the searches api is invoked'
def response = mvc.perform(post(searchesEndpoint)
@@ -368,7 +370,7 @@ class NetworkCmProxyControllerSpec extends Specification {
then: 'response status returns OK'
response.status == HttpStatus.OK.value()
and: 'the expected response content is returned'
- response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"NONE"},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":null}]'
+ response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"NONE","moduleSetTag":null,"alternateId":null,"dataProducerIdentifier":null},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":null,"moduleSetTag":"someModuleSetTag","alternateId":"someAlternateId","dataProducerIdentifier":"someDataProducerIdentifier"}]'
}
def 'Get complete Cm Handle details by Cm Handle id.'() {
@@ -452,7 +454,7 @@ class NetworkCmProxyControllerSpec extends Specification {
.contentType(MediaType.APPLICATION_JSON)
.content(jsonString)).andReturn().response
then: 'an empty cm handle identifier is returned'
- response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"COMPLETE"},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":"NONE"}]'
+ response.contentAsString == '[{"cmHandle":"ch-1","publicCmHandleProperties":[{"color":"yellow"}],"state":null,"trustLevel":"COMPLETE","moduleSetTag":null,"alternateId":null,"dataProducerIdentifier":null},{"cmHandle":"ch-2","publicCmHandleProperties":[{"color":"green"}],"state":null,"trustLevel":"NONE","moduleSetTag":null,"alternateId":null,"dataProducerIdentifier":null}]'
}
def 'Query for cm handles matching query parameters'() {