def 'Query data node by cps path for the given cm handle with #scenario.'() {
given: 'service method returns a list containing a data node'
def 'Query data node by cps path for the given cm handle with #scenario.'() {
given: 'service method returns a list containing a data node'
when: 'post request is performed'
def response = mvc.perform(
post("$ncmpBasePathV1/cm-handles/$cmHandle/nodes")
.contentType(MediaType.APPLICATION_JSON)
when: 'post request is performed'
def response = mvc.perform(
post("$ncmpBasePathV1/cm-handles/$cmHandle/nodes")
.contentType(MediaType.APPLICATION_JSON)
.param('xpath', reqXpath)
).andReturn().response
then: 'the service method is invoked once with expected parameters'
.param('xpath', reqXpath)
).andReturn().response
then: 'the service method is invoked once with expected parameters'
and: 'response status indicates success'
response.status == HttpStatus.CREATED.value()
where: 'following parameters were used'
and: 'response status indicates success'
response.status == HttpStatus.CREATED.value()
where: 'following parameters were used'
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)
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)
.param('xpath', parentNodeXpath)
).andReturn().response
then: 'the service method is invoked once with expected parameters'
.param('xpath', parentNodeXpath)
).andReturn().response
then: 'the service method is invoked once with expected parameters'
and: 'response status indicates success'
response.status == HttpStatus.CREATED.value()
}
def 'Update data node leaves.'() {
and: 'response status indicates success'
response.status == HttpStatus.CREATED.value()
}
def 'Update data node leaves.'() {
def endpoint = "$ncmpBasePathV1/cm-handles/$cmHandle/nodes"
when: 'patch request is performed'
def response = mvc.perform(
patch(endpoint)
.contentType(MediaType.APPLICATION_JSON)
def endpoint = "$ncmpBasePathV1/cm-handles/$cmHandle/nodes"
when: 'patch request is performed'
def response = mvc.perform(
patch(endpoint)
.contentType(MediaType.APPLICATION_JSON)
and: 'response status indicates success'
response.status == HttpStatus.OK.value()
}
def 'Replace data node tree.'() {
and: 'response status indicates success'
response.status == HttpStatus.OK.value()
}
def 'Replace data node tree.'() {
def endpoint = "$ncmpBasePathV1/cm-handles/$cmHandle/nodes"
when: 'put request is performed'
def response = mvc.perform(
put(endpoint)
.contentType(MediaType.APPLICATION_JSON)
def endpoint = "$ncmpBasePathV1/cm-handles/$cmHandle/nodes"
when: 'put request is performed'
def response = mvc.perform(
put(endpoint)
.contentType(MediaType.APPLICATION_JSON)
).andReturn().response
then: 'ncmp service method to update resource is called'
1 * mockNetworkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle('testCmHandle',
).andReturn().response
then: 'ncmp service method to update resource is called'
1 * mockNetworkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle('testCmHandle',
- 'parent/child', UPDATE,'some-request-body', 'application/json;charset=UTF-8')
+ 'parent/child', UPDATE, jsonString, 'application/json;charset=UTF-8')
given: 'resource data url'
def url = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"?resourceIdentifier=parent/child"
given: 'resource data url'
def url = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"?resourceIdentifier=parent/child"
'parent/child', CREATE, requestBody, 'application/json;charset=UTF-8')
and: 'resource is created'
response.status == HttpStatus.CREATED.value()
'parent/child', CREATE, requestBody, 'application/json;charset=UTF-8')
and: 'resource is created'
response.status == HttpStatus.CREATED.value()
def response =mvc.perform(get(getUrl)).andReturn().response
then: 'ncmp service method to get yang resource module references is called'
mockNetworkCmProxyDataService.getYangResourcesModuleReferences('some-cmhandle')
def response =mvc.perform(get(getUrl)).andReturn().response
then: 'ncmp service method to get yang resource module references is called'
mockNetworkCmProxyDataService.getYangResourcesModuleReferences('some-cmhandle')
def 'Retrieve cm handles.'() {
given: 'an endpoint and json data'
def searchesEndpoint = "$ncmpBasePathV1/ch/searches"
def 'Retrieve cm handles.'() {
given: 'an endpoint and json data'
def searchesEndpoint = "$ncmpBasePathV1/ch/searches"
and: 'the service method is invoked with module names and returns two cm handle ids'
mockNetworkCmProxyDataService.executeCmHandleHasAllModulesSearch(['module1', 'module2']) >> ['some-cmhandle-id1', 'some-cmhandle-id2']
when: 'the searches api is invoked'
def response = mvc.perform(post(searchesEndpoint)
.contentType(MediaType.APPLICATION_JSON)
and: 'the service method is invoked with module names and returns two cm handle ids'
mockNetworkCmProxyDataService.executeCmHandleHasAllModulesSearch(['module1', 'module2']) >> ['some-cmhandle-id1', 'some-cmhandle-id2']
when: 'the searches api is invoked'
def response = mvc.perform(post(searchesEndpoint)
.contentType(MediaType.APPLICATION_JSON)
then: 'response status returns OK'
response.status == HttpStatus.OK.value()
and: 'the expected response content is returned'
then: 'response status returns OK'
response.status == HttpStatus.OK.value()
and: 'the expected response content is returned'
def 'Call execute cm handle searches with unrecognized condition name.'() {
given: 'an endpoint and json data'
def searchesEndpoint = "$ncmpBasePathV1/ch/searches"
def 'Call execute cm handle searches with unrecognized condition name.'() {
given: 'an endpoint and json data'
def searchesEndpoint = "$ncmpBasePathV1/ch/searches"
when: 'the searches api is invoked'
def response = mvc.perform(post(searchesEndpoint)
.contentType(MediaType.APPLICATION_JSON)
when: 'the searches api is invoked'
def response = mvc.perform(post(searchesEndpoint)
.contentType(MediaType.APPLICATION_JSON)
).andReturn().response
then: 'ncmp service method to update resource is called'
1 * mockNetworkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle('testCmHandle',
).andReturn().response
then: 'ncmp service method to update resource is called'
1 * mockNetworkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle('testCmHandle',
- 'parent/child', PATCH, '{some-key=some-value}', 'application/json;charset=UTF-8')
+ 'parent/child', PATCH, jsonString, 'application/json;charset=UTF-8')
"?resourceIdentifier=parent/child"
when: 'delete data resource request is performed'
def response = mvc.perform(
"?resourceIdentifier=parent/child"
when: 'delete data resource request is performed'
def response = mvc.perform(
- delete(url).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)
- .content('{"some-key" : "some-value"}')).andReturn().response
- then: 'the ncmp service method to delete resource is called'
+ delete(url).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andReturn().response
+ then: 'the ncmp service method to delete resource is called (with null as body)'
- 'parent/child', DELETE, '{"some-key" : "some-value"}', 'application/json;charset=UTF-8')
+ 'parent/child', DELETE, null, 'application/json;charset=UTF-8')