summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylanB95EST <dylan.byrne@est.tech>2021-09-07 10:27:57 +0100
committerDylanB95EST <dylan.byrne@est.tech>2021-09-08 16:04:14 +0100
commit2d67cfd62ad847dfbb1c286dd4e6c3f028a99685 (patch)
treee5eb02ecb0634fb2b8bdaff53d3ae794ce40e89b
parent912eaa7fa9cdfa437da6ed8fa4997dbfa63035be (diff)
Address minor comments on tests for CPS-577
Address comments left by Renu on NetworkCmProxyDataServiceImplSpec.groovy Issue-ID: CPS-597 Change-Id: Ieaa1756730640d7ef2d67eb8640c97f56e112e33 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy29
1 files changed, 14 insertions, 15 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
index e945442250..795eeefa31 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
@@ -183,25 +183,24 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def 'Get resource data for pass-through operational from dmi.'() {
given: 'data node representing cmHandle and its properties'
def cmHandleDataNode = getCmHandleDataNodeForTest()
+ and: 'data node is got from data service'
+ mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry',
+ cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> cmHandleDataNode
+ and: 'resource data is got from DMI'
+ mockDmiOperations.getResourceDataOperationalFromDmi('testDmiService',
+ 'testCmHandle',
+ 'testResourceId',
+ 'testFieldQuery',
+ 5,
+ 'testAcceptParam',
+ '{"operation":"read","cmHandleProperties":{"testName":"testValue"}}') >> new ResponseEntity<>('result-json', HttpStatus.OK)
when: 'get resource data is called'
def response = objectUnderTest.getResourceDataOperationalForCmHandle('testCmHandle',
'testResourceId',
'testAcceptParam',
'testFieldQuery',
5)
- then: 'cps data service is being called once to get data node'
- 1 * mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry',
- cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> cmHandleDataNode
- and: 'dmi operation is being called to get resource data'
- 1 * mockDmiOperations.getResourceDataOperationalFromDmi('testDmiService',
- 'testCmHandle',
- 'testResourceId',
- 'testFieldQuery',
- 5,
- 'testAcceptParam',
- '{"operation":"read","cmHandleProperties":{"testName":"testValue"}}') >>
- new ResponseEntity<>('result-json', HttpStatus.OK)
- and: 'dmi returns ok response'
+ then: 'dmi returns ok response'
response == 'result-json'
}
@@ -322,7 +321,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def 'Write resource data for pass-through running from dmi using POST.'() {
given: 'data node representing cmHandle and its properties'
def cmHandleDataNode = getCmHandleDataNodeForTest()
- and: 'cpsDataService returns valid dataNode'
+ and: 'cpsDataService returns valid cm-handle datanode'
mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry',
cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> cmHandleDataNode
when: 'get resource data is called'
@@ -344,7 +343,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry',
cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> cmHandleDataNode
and: 'dmi throws exception'
- 1 * mockDmiOperations.createResourceDataPassThroughRunningFromDmi(_ as String, _ as String, _ as String, _ as String)
+ mockDmiOperations.createResourceDataPassThroughRunningFromDmi(_ as String, _ as String, _ as String, _ as String)
>> { new ResponseEntity<>(HttpStatus.NOT_FOUND) }
when: 'get resource data is called'
objectUnderTest.createResourceDataPassThroughRunningForCmHandle('testCmHandle',