- def 'Create data node: #scenario.'() {
- when: 'post request is performed'
- def response = mvc.perform(
- post("$ncmpBasePathV1/cm-handles/$cmHandle/nodes")
- .contentType(MediaType.APPLICATION_JSON)
- .content(jsonString)
- .param('xpath', reqXpath)
- ).andReturn().response
- then: 'the service method is invoked once with expected parameters'
- 1 * mockNetworkCmProxyDataService.createDataNode(cmHandle, usedXpath, jsonString)
- and: 'response status indicates success'
- response.status == HttpStatus.CREATED.value()
- where: 'following parameters were used'
- scenario | reqXpath || usedXpath
- 'no xpath parameter' | '' || '/'
- 'root xpath' | '/' || '/'
- 'parent node xpath' | '/xpath' || '/xpath'
- }
-
- def 'Add list-node elements.'() {
- given: ' parent node xpath'
- def parentNodeXpath = 'parent node xpath'
- when: 'post request is performed'
- def response = mvc.perform(
- post("$ncmpBasePathV1/cm-handles/$cmHandle/list-node")
- .contentType(MediaType.APPLICATION_JSON)
- .content(jsonString)
- .param('xpath', parentNodeXpath)
- ).andReturn().response
- then: 'the service method is invoked once with expected parameters'
- 1 * mockNetworkCmProxyDataService.addListNodeElements(cmHandle, parentNodeXpath, jsonString)
- and: 'response status indicates success'
- response.status == HttpStatus.CREATED.value()
- }
-
- def 'Update data node leaves.'() {
- given: 'the query endpoint'
- def endpoint = "$ncmpBasePathV1/cm-handles/$cmHandle/nodes"
- when: 'patch request is performed'
- def response = mvc.perform(
- patch(endpoint)
- .contentType(MediaType.APPLICATION_JSON)
- .content(jsonString)
- .param('xpath', xpath)
- ).andReturn().response
- then: 'the service method is invoked once with expected parameters'
- 1 * mockNetworkCmProxyDataService.updateNodeLeaves(cmHandle, xpath, jsonString)
- and: 'response status indicates success'
- response.status == HttpStatus.OK.value()
- }
-
- def 'Replace data node tree.'() {
- given: 'the query endpoint'
- def endpoint = "$ncmpBasePathV1/cm-handles/$cmHandle/nodes"
- when: 'put request is performed'