X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Fimpl%2FNetworkCmProxyDataServiceImplSpec.groovy;h=ded4943702136439cc4ed20873dc8b8f405010c0;hb=1839f38e054a958793ec40f524d911253086c74e;hp=e6d18d915631d54c23ccc6ff23c508328258a1be;hpb=1f2e66e720678f00682e6429aab7fa62251baf29;p=cps.git 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 e6d18d915..ded494370 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 @@ -22,6 +22,7 @@ package org.onap.cps.ncmp.api.impl +import org.onap.cps.ncmp.api.impl.exception.InvalidTopicException import org.onap.cps.ncmp.api.impl.operations.YangModelCmHandleRetriever import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle import spock.lang.Shared @@ -217,7 +218,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { exceptionThrown.details.contains('NOK-json') } - def 'Get resource data for operational from DMI with empty topic sync request.'() { + def 'DMI Operational data request with #scenario'() { given: 'cps data service returns valid data node' mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry', cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> dataNode @@ -227,14 +228,14 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { when: 'get resource data is called data operational with blank topic' def responseData = objectUnderTest.getResourceDataOperationalForCmHandle('', '', '', '', emptyTopic) - then: '(synchronous) the dmi response is expected' - assert responseData == '{dmi-response}' + then: 'a invalid topic exception is thrown' + thrown(InvalidTopicException) where: 'the following parameters are used' - scenario | emptyTopic - 'No topic in url' | '' - 'Null topic in url' | null - 'Empty topic in url' | '\"\"' - 'Blank topic in url' | ' ' + scenario | emptyTopic + 'no topic value in url' | '' + 'empty topic value in url' | '\"\"' + 'blank topic value in url' | ' ' + 'invalid non-empty topic value in url' | '1_5_*_#' } def 'Get resource data for data operational from DMI with valid topic i.e. async request.'() { @@ -263,7 +264,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { assert responseData.body.requestId.length() > 0 } - def 'Get resource data for pass through running from DMI sync request where #scenario.'() { + def 'DMI pass through running data request with #scenario'() { given: 'cps data service returns valid data node' mockCpsDataService.getDataNode('NCMP-Admin', 'ncmp-dmi-registry', cmHandleXPath, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS) >> dataNode @@ -273,21 +274,21 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { when: 'get resource data is called for data operational with valid topic' def responseData = objectUnderTest.getResourceDataPassThroughRunningForCmHandle('', '', '', '', emptyTopic) - then: '(synchronous) the dmi response is expected' - assert responseData == '{dmi-response}' + then: 'a invalid topic exception is thrown' + thrown(InvalidTopicException) where: 'the following parameters are used' - scenario | emptyTopic - 'No topic in url' | '' - 'Null topic in url' | null - 'Empty topic in url' | '\"\"' - 'Blank topic in url' | ' ' + scenario | emptyTopic + 'no topic value in url' | '' + 'empty topic value in url' | '\"\"' + 'blank topic value in url' | ' ' + 'invalid non-empty topic value in url' | '1_5_*_#' } def 'Getting Yang Resources.'() { when: 'yang resources is called' - objectUnderTest.getYangResourcesModuleReferences('some cm handle') + objectUnderTest.getYangResourcesModuleReferences('some-cm-handle') then: 'CPS module services is invoked for the correct dataspace and cm handle' - 1 * mockCpsModuleService.getYangResourcesModuleReferences('NFP-Operational','some cm handle') + 1 * mockCpsModuleService.getYangResourcesModuleReferences('NFP-Operational','some-cm-handle') } def 'Get cm handle identifiers for the given module names.'() {