summaryrefslogtreecommitdiffstats
path: root/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy')
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
index 8a3170b4..f334f780 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
+ * Copyright (C) 2021-2022 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,35 +40,35 @@ class SdncRestconfClientSpec extends Specification {
def objectUnderTest = new SdncRestconfClient(mockSdncProperties, mockRestTemplate)
def 'SDNC GET operation.'() {
- given: 'a get url'
+ given: 'a get resource url'
def getResourceUrl = '/getResourceUrl'
- and: 'sdnc properties'
+ and: 'test configuration data'
setupTestConfigurationData()
- and: 'the rest template returns a valid response entity'
+ and: 'the process returns a valid response entity'
def mockResponseEntity = Mock(ResponseEntity)
mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getResourceUrl' },
HttpMethod.GET, _ as HttpEntity, String.class) >> mockResponseEntity
- when: 'GET operation is invoked'
+ when: 'the resource is fetched'
def result = objectUnderTest.getOperation(getResourceUrl)
- then: 'the output of the method is equal to the output from the test template'
+ then: 'the output of the method is equal to the output from the rest template service'
result == mockResponseEntity
}
def 'SDNC #scenario operation called.'() {
- given: 'json data'
- def jsonData = 'some-json'
+ given: 'some request data'
+ def someRequestData = 'some request data'
and: 'a url for get module resources'
def getModuleResourceUrl = '/getModuleResourceUrl'
- and: 'configuration data'
+ and: 'test configuration data'
setupTestConfigurationData()
- and: 'the rest template returns a valid response entity'
+ and: 'the process returns a valid response entity'
def mockResponseEntity = Mock(ResponseEntity)
- when: 'get module resources is invoked'
- def result = objectUnderTest.httpOperationWithJsonData(expectedHttpMethod, getModuleResourceUrl, jsonData, new HttpHeaders())
+ when: 'the resource is fetched'
+ def result = objectUnderTest.httpOperationWithJsonData(expectedHttpMethod, getModuleResourceUrl, someRequestData, new HttpHeaders())
then: 'the rest template is called with the correct uri and json in the body'
1 * mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getModuleResourceUrl' },
- expectedHttpMethod, { it.body.contains(jsonData) }, String.class) >> mockResponseEntity
- and: 'the output of the method is the same as the output from the test template'
+ expectedHttpMethod, { it.body.contains(someRequestData) }, String.class) >> mockResponseEntity
+ and: 'the output of the method is the same as the output from the rest template service'
result == mockResponseEntity
where: 'the following values are used'
scenario || expectedHttpMethod
@@ -78,18 +78,18 @@ class SdncRestconfClientSpec extends Specification {
'DELETE' || DELETE
}
- def 'SDNC GET operation with header.'() {
+ def 'SDNC GET operation with headers.'() {
given: 'a get url'
def getResourceUrl = '/getResourceUrl'
- and: 'sdnc properties'
+ and: 'test configuration data'
setupTestConfigurationData()
- and: 'the rest template returns a valid response entity'
+ and: 'the process returns a valid response entity'
def mockResponseEntity = Mock(ResponseEntity)
mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getResourceUrl' },
HttpMethod.GET, _ as HttpEntity, String.class) >> mockResponseEntity
- when: 'GET operation is invoked'
+ when: 'the resource is fetched with headers'
def result = objectUnderTest.getOperation(getResourceUrl, new HttpHeaders())
- then: 'the output of the method is equal to the output from the test template'
+ then: 'the output of the method is equal to the output from the rest template service'
result == mockResponseEntity
}