From d07ebc86b474e0eb8e8f2f2ba24db4ef46f13b79 Mon Sep 17 00:00:00 2001 From: Ruslan Kashapov Date: Tue, 20 Apr 2021 11:14:30 +0300 Subject: Create child data node (part 2): NCMP service + REST Issue-ID: CPS-337 Change-Id: Icf703f6f375e5f280058d58c781eac081f3dd161 Signed-off-by: Ruslan Kashapov --- .../impl/NetworkCmProxyDataServiceImplSpec.groovy | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'cps-ncmp-service/src/test') 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 49028becd..95493bf51 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' -- cgit 1.2.3-korg