/*
* ============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.
fetchDescendantsOption << FetchDescendantsOption.values()
}
+ 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 'Add list-node elements.'() {
+ given: 'a cm handle and parent node xpath'
+ def jsonData = 'some json'
+ def xpath = '/test-node'
+ when: 'addListNodeElements is invoked'
+ objectUnderTest.addListNodeElements(cmHandle, xpath, jsonData)
+ then: 'the CPS service method is invoked once with the expected parameters'
+ 1 * mockcpsDataService.saveListNodeData(expectedDataspaceName, cmHandle, xpath, jsonData)
+ }
+
def 'Update data node leaves.'() {
given: 'a cm Handle and a cps path'
def xpath = '/xpath'