diff options
author | Sourabh Sourabh <sourabh.sourabh@est.tech> | 2024-02-01 16:57:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-02-01 16:57:22 +0000 |
commit | 90b28d4b0eb228fd5906dabc50e1b543f1e3afed (patch) | |
tree | 88f1f6cf709b86af158ecdcbea893454786e8504 /cps-ncmp-service/src/test/groovy/org/onap | |
parent | 0f6f416f45d5ad0e9bba67d459858995196f7a73 (diff) | |
parent | 04280e2f93bbf30e8654c411bb1e107d275c22bb (diff) |
Merge "Extend API: Get Module Definitions"
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org/onap')
2 files changed, 25 insertions, 6 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 c1af902a08..49583cec32 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 @@ -298,10 +298,17 @@ class NetworkCmProxyDataServiceImplSpec extends Specification { assert result == ['cm-handle-id-1'] } - def 'Getting module definitions.'() { - when: 'get module definitions method is called with a valid cm handle ID' + def 'Getting module definitions by module'() { + when: 'get module definitions is performed with module name' + objectUnderTest.getModuleDefinitionsByCmHandleAndModule('some-cm-handle', 'some-module', '2021-08-04') + then: 'ncmp inventory persistence service is invoked once with correct parameters' + 1 * mockInventoryPersistence.getModuleDefinitionsByCmHandleAndModule('some-cm-handle', 'some-module', '2021-08-04') + } + + def 'Getting module definitions by cm handle id'() { + when: 'get module definitions is performed with cm handle id' objectUnderTest.getModuleDefinitionsByCmHandleId('some-cm-handle') - then: 'CPS module services is invoked once' + then: 'ncmp inventory persistence service is invoked once with correct parameter' 1 * mockInventoryPersistence.getModuleDefinitionsByCmHandleId('some-cm-handle') } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/inventory/InventoryPersistenceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/inventory/InventoryPersistenceImplSpec.groovy index cb2f3fdddd..a3b923f939 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/inventory/InventoryPersistenceImplSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/inventory/InventoryPersistenceImplSpec.groovy @@ -184,11 +184,23 @@ class InventoryPersistenceImplSpec extends Specification { 'DELETING' | CmHandleState.DELETING || ['/dmi-registry/cm-handles[@id=\'Some-Cm-Handle1\']':'{"state":{"cm-handle-state":"DELETING","last-update-time":"2022-12-31T20:30:40.000+0000"}}', '/dmi-registry/cm-handles[@id=\'Some-Cm-Handle2\']':'{"state":{"cm-handle-state":"DELETING","last-update-time":"2022-12-31T20:30:40.000+0000"}}'] } - def 'Get module definitions'() { - given: 'cps module service returns a collection of module definitions' + def 'Getting module definitions by module'() { + given: 'cps module service returns module definition for module name' + def moduleDefinitions = [new ModuleDefinition('moduleName','revision','content')] + mockCpsModuleService.getModuleDefinitionsByAnchorAndModule(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME,'some-cmHandle-Id', 'some-module', '2024-01-25') >> moduleDefinitions + when: 'get module definitions is invoked with module name' + def result = objectUnderTest.getModuleDefinitionsByCmHandleAndModule('some-cmHandle-Id', 'some-module', '2024-01-25') + then: 'returned result are the same module definitions as returned from module service' + assert result == moduleDefinitions + and: 'cm handle id and module name validated' + 1 * mockCpsValidator.validateNameCharacters('some-cmHandle-Id', 'some-module') + } + + def 'Getting module definitions with cm handle id'() { + given: 'cps module service returns module definitions for cm handle id' def moduleDefinitions = [new ModuleDefinition('moduleName','revision','content')] mockCpsModuleService.getModuleDefinitionsByAnchorName(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME,'some-cmHandle-Id') >> moduleDefinitions - when: 'get module definitions by cmHandle is invoked' + when: 'get module definitions is invoked with cm handle id' def result = objectUnderTest.getModuleDefinitionsByCmHandleId('some-cmHandle-Id') then: 'the returned result are the same module definitions as returned from the module service' assert result == moduleDefinitions |