aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2024-08-12 10:38:39 +0100
committersourabh_sourabh <sourabh.sourabh@est.tech>2024-08-13 18:06:26 +0100
commit50518ca2035ec6d50e7aeadcc0f44b6d0c35fbb2 (patch)
treeb6bcfe6b189cc1a7ab62f9a393c6ac7a5a9f0981 /cps-service/src/test
parentd3c1e7246ab4f41cf3dad97e559ca2736b0014cf (diff)
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 <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-service/src/test')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy17
1 files changed, 17 insertions, 0 deletions
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' ) ]