diff options
Diffstat (limited to 'cps-ncmp-service/src/test')
2 files changed, 18 insertions, 30 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 e38386fdd2..b5d4713959 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 @@ -231,16 +231,14 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockDmiOperations.getResourceDataOperationalFromDmi('testDmiService', 'testCmHandle', 'testResourceId', - 'testFieldQuery', - 5, + '(a=1,b=2)', '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) + '(a=1,b=2)') then: 'dmi returns ok response' response == 'result-json' } @@ -259,8 +257,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { def response = objectUnderTest.getResourceDataOperationalForCmHandle('testCmHandle', 'testResourceId', 'testAcceptParam', - 'testFieldQuery', - 5) + '(a=1,b=2)') then: 'exception is thrown with the expected details' def exceptionThrown = thrown(NcmpException.class) exceptionThrown.details == 'testException' @@ -276,8 +273,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockDmiOperations.getResourceDataOperationalFromDmi('testDmiService', 'testCmHandle', 'testResourceId', - 'testFieldQuery', - 5, + '(a=1,b=2)', 'testAcceptParam', '{"operation":"read","cmHandleProperties":{"testName":"testValue"}}') >> new ResponseEntity<>('NOK-json', HttpStatus.NOT_FOUND) @@ -285,8 +281,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { def response = objectUnderTest.getResourceDataOperationalForCmHandle('testCmHandle', 'testResourceId', 'testAcceptParam', - 'testFieldQuery', - 5) + '(a=1,b=2)') then: 'exception is thrown' def exceptionThrown = thrown(NcmpException.class) and: 'details contains the original response' @@ -303,16 +298,14 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockDmiOperations.getResourceDataPassThroughRunningFromDmi('testDmiService', 'testCmHandle', 'testResourceId', - 'testFieldQuery', - 5, + '(a=1,b=2)', 'testAcceptParam', '{"operation":"read","cmHandleProperties":{"testName":"testValue"}}') >> new ResponseEntity<>('{result-json}', HttpStatus.OK) when: 'get resource data is called' def response = objectUnderTest.getResourceDataPassThroughRunningForCmHandle('testCmHandle', 'testResourceId', 'testAcceptParam', - 'testFieldQuery', - 5) + '(a=1,b=2)') then: 'get resource data returns expected response' response == '{result-json}' } @@ -331,8 +324,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { def response = objectUnderTest.getResourceDataPassThroughRunningForCmHandle('testCmHandle', 'testResourceId', 'testAcceptParam', - 'testFieldQuery', - 5) + '(a=1,b=2)') then: 'exception is thrown with the expected details' def exceptionThrown = thrown(NcmpException.class) exceptionThrown.details == 'testException' @@ -348,8 +340,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { mockDmiOperations.getResourceDataPassThroughRunningFromDmi('testDmiService', 'testCmHandle', 'testResourceId', - 'testFieldQuery', - 5, + '(a=1,b=2)', 'testAcceptParam', '{"operation":"read","cmHandleProperties":{"testName":"testValue"}}') >> new ResponseEntity<>('NOK-json', HttpStatus.NOT_FOUND) @@ -357,8 +348,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { def response = objectUnderTest.getResourceDataPassThroughRunningForCmHandle('testCmHandle', 'testResourceId', 'testAcceptParam', - 'testFieldQuery', - 5) + '(a=1,b=2)') then: 'exception is thrown' def exceptionThrown = thrown(NcmpException.class) and: 'details contains the original response' diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy index 6a1ce1a18b..8e0fb76a56 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy @@ -42,13 +42,12 @@ class DmiOperationsSpec extends Specification { def 'call get resource data for pass-through:operational datastore from DMI.'() { given: 'expected url' def expectedUrl = 'testDmiBasePath/dmi/v1/ch/testCmhandle/data/ds' + - '/ncmp-datastore:passthrough-operational/testResourceId?fields=testFieldsQuery&depth=10' + '/ncmp-datastore:passthrough-operational?resourceIdentifier=parent/child&options=(a=1,b=2)' when: 'get resource data is called to DMI' objectUnderTest.getResourceDataOperationalFromDmi('testDmiBasePath', 'testCmhandle', - 'testResourceId', - 'testFieldsQuery', - 10, + 'parent/child', + '(a=1,b=2)', 'testAcceptJson', 'testJsonbody') then: 'the put operation is executed with the correct URL' @@ -57,13 +56,12 @@ class DmiOperationsSpec extends Specification { def 'call get resource data for pass-through:running datastore from DMI.'() { given: 'expected url' def expectedUrl = 'testDmiBasePath/dmi/v1/ch/testCmhandle/data/ds' + - '/ncmp-datastore:passthrough-running/testResourceId?fields=testFieldsQuery&depth=10' + '/ncmp-datastore:passthrough-running?resourceIdentifier=parent/child&options=(a=1,b=2)' when: 'get resource data is called to DMI' objectUnderTest.getResourceDataPassThroughRunningFromDmi('testDmiBasePath', 'testCmhandle', - 'testResourceId', - 'testFieldsQuery', - 10, + 'parent/child', + '(a=1,b=2)', 'testAcceptJson', 'testJsonbody') then: 'the put operation is executed with the correct URL' @@ -72,11 +70,11 @@ class DmiOperationsSpec extends Specification { def 'call create resource data for pass-through:running datastore from DMI.'() { given: 'expected url' def expectedUrl = 'testDmiBasePath/dmi/v1/ch/testCmhandle/data/ds' + - '/ncmp-datastore:passthrough-running/testResourceId' + '/ncmp-datastore:passthrough-running?resourceIdentifier=parent/child' when: 'get resource data is called to DMI' objectUnderTest.createResourceDataPassThroughRunningFromDmi('testDmiBasePath', 'testCmhandle', - 'testResourceId', + 'parent/child', 'testJsonbody') then: 'the put operation is executed with the correct URL' 1 * mockDmiRestClient.postOperationWithJsonData(expectedUrl, 'testJsonbody', _ as HttpHeaders) |