From 50518ca2035ec6d50e7aeadcc0f44b6d0c35fbb2 Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Mon, 12 Aug 2024 10:38:39 +0100 Subject: CPS-NCMP: Slow cmHandle registration when we use moduleSetTag, alternateId and dataProducerIdentifier - Created a new repo. service for fragment table that executes a native sql query to find first ready cm handle id based on moduleset tag and then returns list of module references. - Exposed a new interface into module service that is used by module sync service to get list of midule refs by module set tag. Issue-ID: CPS-2353 Change-Id: I438dbd1ed37c1ff4e15f792e93a095aa604120bc Signed-off-by: sourabh_sourabh --- .../onap/cps/api/impl/CpsModuleServiceImplSpec.groovy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cps-service/src/test/groovy/org/onap') diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy index ad8c54bf27..62eba0c397 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy @@ -238,6 +238,23 @@ class CpsModuleServiceImplSpec extends Specification { 1 * mockCpsModulePersistenceService.identifyNewModuleReferences(moduleReferencesToCheck) } + def 'Get module references when queried by attributes'() { + given: 'a valid dataspace name and anchor name' + def dataspaceName = 'someDataspace' + def anchorName = 'someAnchor' + and: 'a set of parent attributes and child attributes used for filtering' + def parentAttributes = ['some-property-key1': 'some-property-val1'] + def childAttributes = ['some-property-key2': 'some-property-val2'] + and: 'a list of expected module references returned by the persistence service' + def expectedModuleReferences = [new ModuleReference(moduleName: 'some-name', revision: 'some-revision')] + mockCpsModulePersistenceService.getModuleReferencesByAttribute(dataspaceName, anchorName, parentAttributes, childAttributes) >> expectedModuleReferences + when: 'the method is invoked to retrieve module references by attributes' + def actualModuleReferences = objectUnderTest.getModuleReferencesByAttribute(dataspaceName, anchorName, parentAttributes, childAttributes) + then: 'the retrieved module references should match the expected module references' + assert actualModuleReferences == expectedModuleReferences + } + + def 'Getting module definitions with module name'() { given: 'module persistence service returns module definitions for module name' def moduleDefinitionsFromPersistenceService = [ new ModuleDefinition('name', 'revision', 'content' ) ] -- cgit