summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test
diff options
context:
space:
mode:
authorniamhcore <niamh.core@est.tech>2021-09-01 17:12:28 +0100
committeraditya puthuparambil <aditya.puthuparambil@bell.ca>2021-09-06 14:06:16 +0000
commitd0422226b45f752086c9920bdead753c644d9289 (patch)
tree219118e284927589ad69dc4ded6d520e76e77530 /cps-ncmp-service/src/test
parentc27465347d10b573e7a211c0b11b7c8a6fd792c0 (diff)
P1 - Get module name and revision persistence layer
Rename ModuleReference to ExtendedModuleReference Create new ModuleReference class (moduleName and revision) Update existing sync model flow to use new module reference class Create native query to get module name and revision Issue-ID: CPS-485 Signed-off-by: niamhcore <niamh.core@est.tech> Change-Id: I0d0da7742ceef3a68e83a5dd4852091e6adf138b
Diffstat (limited to 'cps-ncmp-service/src/test')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy12
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy6
2 files changed, 9 insertions, 9 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 b42db57233..ff3e0cd157 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
@@ -357,23 +357,23 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def 'Sync model for a (new) cm handle with #scenario'() {
given: 'DMI PLug-in returns a list of module references'
getModulesForCmHandle()
- def knownModule1 = new ModuleReference('module1', NO_NAMESPACE, '1')
- def knownOtherModule = new ModuleReference('some other module', NO_NAMESPACE, 'some revision')
+ def knownModule1 = new ModuleReference('module1', '1')
+ def knownOtherModule = new ModuleReference('some other module', 'some revision')
and: 'CPS-Core returns list of known modules'
- mockCpsModuleService.getAllYangResourcesModuleReferences() >> [knownModule1, knownOtherModule]
+ mockCpsModuleService.getAllYangResourceModuleReferences(_) >> [knownModule1, knownOtherModule]
and: 'DMI-Plugin returns resource(s) for "new" module(s)'
def moduleResources = new ResponseEntity<String>(sdncReponseBody, HttpStatus.OK)
mockDmiOperations.getResourceFromDmi(_, cmHandleForModelSync.getId(), 'moduleResources') >> moduleResources
when: 'module Sync is triggered'
objectUnderTest.createAnchorAndSyncModel(cmHandleForModelSync)
then: 'the CPS module service is called once with the correct parameters'
- 1 * mockCpsModuleService.createSchemaSetFromModules(expectedDataspaceNameForModleSync, cmHandleForModelSync.getId(), expectedYangResourceToContentMap , [knownModule1])
+ 1 * mockCpsModuleService.createSchemaSetFromModules(expectedDataspaceNameForModleSync, cmHandleForModelSync.getId(), expectedYangResourceToContentMap, [knownModule1])
and: 'admin service create anchor method has been called with correct parameters'
1 * mockCpsAdminService.createAnchor(expectedDataspaceNameForModleSync, cmHandleForModelSync.getId(), cmHandleForModelSync.getId())
where: 'the following responses are recieved from SDNC'
- scenario | sdncReponseBody || expectedYangResourceToContentMap
+ scenario | sdncReponseBody || expectedYangResourceToContentMap
'one unknown module' | '[{"moduleName" : "someModule", "revision" : "1","yangSource": "someResource"}]' || [someModule: 'someResource']
- 'no unknown module' | '[]' || [:]
+ 'no unknown module' | '[]' || [:]
}
def getModulesForCmHandle() {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy
index d6cb4635d8..9f161a9e53 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/models/moduleReferenceSpec.groovy
@@ -1,14 +1,14 @@
package org.onap.cps.ncmp.api.models
-import org.onap.cps.spi.model.ModuleReference
+import org.onap.cps.spi.model.ExtendedModuleReference
import spock.lang.Specification
class moduleReferenceSpec extends Specification {
def 'lombok data annotation correctly implements toString() and hashCode() methods'() {
given: 'two moduleReference objects'
- def moduleReference1 = new ModuleReference('module1', "some namespace", '1')
- def moduleReference2 = new ModuleReference('module1', "some namespace", '1')
+ def moduleReference1 = new ExtendedModuleReference('module1', "some namespace", '1')
+ def moduleReference2 = new ExtendedModuleReference('module1', "some namespace", '1')
when: 'lombok generated methods are called'
then: 'the methods exist and behaviour is accurate'
assert moduleReference1.toString() == moduleReference2.toString()