aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ri/src/test
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2025-02-04 18:30:20 +0000
committerToineSiebelink <toine.siebelink@est.tech>2025-02-06 16:04:02 +0000
commit4ec2a5d944b4c2bad799e6610f03912f5c955b50 (patch)
treeb5802aece8a2d459c918a33a253d094743ab9fd5 /cps-ri/src/test
parent59f1cc4c5994da34f2c48a2347499f9cfb7bd836 (diff)
Fix duplicated yang resource references V2
- Store Yang module references using SchemaSetEntity instead of SQL - Added integration test to check number of references - Update dispatcher for integration test to only return yang resources requested modules - refactor schema set create & upgrade methods for better re-uses and readability - consistent naming in related methods like(new)yangResourceContentPerName (the name can be filename, module name or schema set name) depending on the context - replaced 'var' with actual class names in affected classes Issue-ID: CPS-2605 Change-Id: I8870c70832ac533bd17ce8af409a071f659e4acf Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Diffstat (limited to 'cps-ri/src/test')
-rw-r--r--cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy6
1 files changed, 3 insertions, 3 deletions
diff --git a/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy
index 2915bc8e8c..9abfdbeb33 100644
--- a/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy
+++ b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy
@@ -78,8 +78,8 @@ class CpsModulePersistenceServiceImplSpec extends Specification {
and: 'persisting yang resource raises db constraint exception (in case of concurrent requests for example)'
mockYangResourceRepository.saveAll(_) >> { throw dbException }
when: 'attempt to store schema set '
- def newYangResourcesNameToContentMap = [(yangResourceName):yangResourceContent]
- objectUnderTest.storeSchemaSet('my-dataspace', 'my-schema-set', newYangResourcesNameToContentMap)
+ def newYangResourceContentPerName = [(yangResourceName):yangResourceContent]
+ objectUnderTest.createSchemaSet('my-dataspace', 'my-schema-set', newYangResourceContentPerName)
then: 'an #expectedThrownException is thrown'
def e = thrown(expectedThrownException)
assert e.getMessage().contains(expectedThrownExceptionMessage)
@@ -96,7 +96,7 @@ class CpsModulePersistenceServiceImplSpec extends Specification {
def schemaSetEntity = new SchemaSetEntity(id: 1)
mockSchemaSetRepository.getByDataspaceAndName(_, _) >> schemaSetEntity
when: 'schema set update is requested'
- objectUnderTest.updateSchemaSetFromModules('my-dataspace', 'my-schemaset', [:], [new ModuleReference('some module name', 'some revision name')])
+ objectUnderTest.updateSchemaSetFromNewAndExistingModules('my-dataspace', 'my-schemaset', [:], [new ModuleReference('some module name', 'some revision name')])
then: 'no exception is thrown '
noExceptionThrown()
}