diff options
author | Ruslan Kashapov <ruslan.kashapov@pantheon.tech> | 2021-04-20 11:14:30 +0300 |
---|---|---|
committer | Rishi Chail <rishi.chail@est.tech> | 2021-04-21 13:01:53 +0000 |
commit | d07ebc86b474e0eb8e8f2f2ba24db4ef46f13b79 (patch) | |
tree | 662c6a5b25fca95dffe5565eb5285414ca20c435 /cps-ncmp-service/src/test/groovy/org | |
parent | cf37a74874074ab0de9ab4eac8143387355f1afe (diff) |
Create child data node (part 2): NCMP service + REST
Issue-ID: CPS-337
Change-Id: Icf703f6f375e5f280058d58c781eac081f3dd161
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org')
-rw-r--r-- | cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy index 49028becd7..95493bf51e 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/api/impl/NetworkCmProxyDataServiceImplSpec.groovy @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2021 Nordix Foundation + * Modifications Copyright (C) 2021 Pantheon.tech * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +25,7 @@ import org.onap.cps.api.CpsQueryService import org.onap.cps.ncmp.api.impl.NetworkCmProxyDataServiceImpl import org.onap.cps.spi.FetchDescendantsOption import spock.lang.Specification +import spock.lang.Unroll class NetworkCmProxyDataServiceImplSpec extends Specification { def objectUnderTest = new NetworkCmProxyDataServiceImpl() @@ -49,6 +51,30 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { fetchDescendantsOption << FetchDescendantsOption.values() } + @Unroll + def 'Create full data node: #scenario.'() { + given: 'a cm handle and root xpath' + def jsonData = 'some json' + when: 'createDataNode is invoked' + objectUnderTest.createDataNode(cmHandle, xpath, jsonData) + then: 'the CPS service method is invoked once with the expected parameters' + 1 * mockcpsDataService.saveData(expectedDataspaceName, cmHandle, jsonData) + where: 'following parameters were used' + scenario | xpath + 'no xpath' | '' + 'root level xpath' | '/' + } + + def 'Create child data node.'() { + given: 'a cm handle and parent node xpath' + def jsonData = 'some json' + def xpath = '/test-node' + when: 'createDataNode is invoked' + objectUnderTest.createDataNode(cmHandle, xpath, jsonData) + then: 'the CPS service method is invoked once with the expected parameters' + 1 * mockcpsDataService.saveData(expectedDataspaceName, cmHandle, xpath, jsonData) + } + def 'Update data node leaves.'() { given: 'a cm Handle and a cps path' def xpath = '/xpath' |