summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy23
1 files changed, 23 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
index 88277d3e9..b0c447ee1 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
@@ -457,6 +457,29 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
1 * mockCpsAdminService.queryAnchorNames('NFP-Operational', ['some-module-name'])
}
+ def 'Update resource data for pass-through running from dmi using POST #scenario cm handle properties.'() {
+ given: 'data node representing cmHandle #scenario cm handle properties'
+ def cmHandleDataNode = getCmHandleDataNodeForTest(includeCmHandleProperties)
+ and: 'cpsDataService returns valid cm-handle datanode'
+ mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry',
+ cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> cmHandleDataNode
+ when: 'update resource data is called'
+ objectUnderTest.updateResourceDataPassThroughRunningForCmHandle('testCmHandle',
+ 'testResourceId',
+ '{some-json}', 'application/json')
+ then: 'dmi called with correct data'
+ 1 * mockDmiOperations.updateResourceDataPassThroughRunningFromDmi('testDmiService',
+ 'testCmHandle',
+ 'testResourceId',
+ '{"operation":"update","dataType":"application/json","data":"{some-json}","cmHandleProperties":'
+ + expectedJsonForCmhandleProperties + '}')
+ >> new ResponseEntity<>(HttpStatus.OK)
+ where:
+ scenario | includeCmHandleProperties || expectedJsonForCmhandleProperties
+ 'with' | true || '{"testName":"testValue"}'
+ 'without' | false || '{}'
+ }
+
def getObjectUnderTestWithModelSyncDisabled() {
def objectUnderTest = Spy(new NetworkCmProxyDataServiceImpl(mockDmiOperations, mockCpsModuleService,
mockCpsDataService, mockCpsQueryService, mockCpsAdminService, spyObjectMapper))