X-Git-Url: https://gerrit.onap.org/r/gitweb?p=cps.git;a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Fimpl%2FNetworkCmProxyDataServiceImplSpec.groovy;h=489c71c0e9f56e7ea50f92c1b3d8455629d4bba1;hp=bf5bb73a9451f1b5a73a4ea184db64c67f4c971b;hb=d69742c1f02585ae5d82f49542581698367e9cde;hpb=6fb6f7742ec1d94ea3a265f476ddbddb0156c64f 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 bf5bb73a9..489c71c0e 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2021-2022 Nordix Foundation * Modifications Copyright (C) 2021 Pantheon.tech - * Modifications Copyright (C) 2021 Bell Canada + * Modifications Copyright (C) 2021-2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,14 +112,12 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { 'testCmHandle', 'testResourceId', OPTIONS_PARAM, - 'testAcceptParam', PASSTHROUGH_OPERATIONAL, NO_REQUEST_ID, NO_TOPIC) >> new ResponseEntity<>('dmi-response', HttpStatus.OK) when: 'get resource data operational for cm-handle is called' def response = objectUnderTest.getResourceDataOperationalForCmHandle('testCmHandle', 'testResourceId', - 'testAcceptParam', OPTIONS_PARAM, NO_TOPIC) then: 'DMI returns a json response' @@ -138,7 +136,6 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { when: 'get resource data is called' objectUnderTest.getResourceDataOperationalForCmHandle('testCmHandle', 'testResourceId', - 'testAcceptParam', OPTIONS_PARAM, NO_TOPIC) then: 'exception is thrown with the expected response code and details' @@ -155,7 +152,6 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockDmiDataOperations.getResourceDataFromDmi('testCmHandle', 'testResourceId', OPTIONS_PARAM, - 'testAcceptParam', PASSTHROUGH_OPERATIONAL, NO_REQUEST_ID, NO_TOPIC) @@ -163,7 +159,6 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { when: 'get resource data is called' objectUnderTest.getResourceDataOperationalForCmHandle('testCmHandle', 'testResourceId', - 'testAcceptParam', OPTIONS_PARAM, NO_TOPIC) then: 'exception is thrown' @@ -181,14 +176,12 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockDmiDataOperations.getResourceDataFromDmi('testCmHandle', 'testResourceId', OPTIONS_PARAM, - 'testAcceptParam', PASSTHROUGH_RUNNING, NO_REQUEST_ID, NO_TOPIC) >> new ResponseEntity<>('{dmi-response}', HttpStatus.OK) when: 'get resource data is called' def response = objectUnderTest.getResourceDataPassThroughRunningForCmHandle('testCmHandle', 'testResourceId', - 'testAcceptParam', OPTIONS_PARAM, NO_TOPIC) then: 'get resource data returns expected response' @@ -203,7 +196,6 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockDmiDataOperations.getResourceDataFromDmi('testCmHandle', 'testResourceId', OPTIONS_PARAM, - 'testAcceptParam', PASSTHROUGH_RUNNING, NO_REQUEST_ID, NO_TOPIC) @@ -211,7 +203,6 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { when: 'get resource data is called' objectUnderTest.getResourceDataPassThroughRunningForCmHandle('testCmHandle', 'testResourceId', - 'testAcceptParam', OPTIONS_PARAM, NO_TOPIC) then: 'exception is thrown' @@ -230,7 +221,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { >> new ResponseEntity<>('{dmi-response}', HttpStatus.OK) when: 'get resource data is called data operational with blank topic' def responseData = objectUnderTest.getResourceDataOperationalForCmHandle('', '', - '', '', emptyTopic) + '', emptyTopic) then: 'a invalid topic exception is thrown' thrown(InvalidTopicException) where: 'the following parameters are used' @@ -245,10 +236,10 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { given: 'cps data service returns valid data node' mockCpsDataService.getDataNode(*_) >> dataNode and: 'dmi data operation returns valid response and data' - mockDmiDataOperations.getResourceDataFromDmi(_, _, _, _, _, _, 'my-topic-name') + mockDmiDataOperations.getResourceDataFromDmi(_, _, _, _, _, 'my-topic-name') >> new ResponseEntity<>('{dmi-response}', HttpStatus.OK) when: 'get resource data is called for data operational with valid topic' - def responseData = objectUnderTest.getResourceDataOperationalForCmHandle('', '', '', '', 'my-topic-name') + def responseData = objectUnderTest.getResourceDataOperationalForCmHandle('', '', '', 'my-topic-name') then: 'non empty request id is generated' assert responseData.body.requestId.length() > 0 } @@ -258,11 +249,11 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry', cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> dataNode and: 'dmi data operation returns valid response and data' - mockDmiDataOperations.getResourceDataFromDmi(_, _, _, _, _, _, 'my-topic-name') + mockDmiDataOperations.getResourceDataFromDmi(_, _, _, _, _, 'my-topic-name') >> new ResponseEntity<>('{dmi-response}', HttpStatus.OK) when: 'get resource data is called for data operational with valid topic' def responseData = objectUnderTest.getResourceDataPassThroughRunningForCmHandle('', - '', '', OPTIONS_PARAM, 'my-topic-name') + '', OPTIONS_PARAM, 'my-topic-name') then: 'non empty request id is generated' assert responseData.body.requestId.length() > 0 } @@ -272,11 +263,11 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry', cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> dataNode and: 'dmi data operation returns valid response and data' - mockDmiDataOperations.getResourceDataFromDmi(_, _, _, _, _, NO_REQUEST_ID, NO_TOPIC) + mockDmiDataOperations.getResourceDataFromDmi(_, _, _, _, NO_REQUEST_ID, NO_TOPIC) >> new ResponseEntity<>('{dmi-response}', HttpStatus.OK) when: 'get resource data is called for data operational with valid topic' def responseData = objectUnderTest.getResourceDataPassThroughRunningForCmHandle('', - '', '', '', emptyTopic) + '', '', emptyTopic) then: 'a invalid topic exception is thrown' thrown(InvalidTopicException) where: 'the following parameters are used'