summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service/src/test/groovy')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy13
1 files changed, 12 insertions, 1 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 b8bfd4593e..d719b3d24e 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
@@ -52,7 +52,7 @@ class CpsModuleServiceImplSpec extends Specification {
@Autowired
CpsModuleServiceImpl objectUnderTest
- def 'Create schema set'() {
+ def 'Create schema set.'() {
given: 'Valid yang resource as name-to-content map'
def yangResourcesNameToContentMap = TestUtils.getYangResourcesAsMap('bookstore.yang')
when: 'Create schema set method is invoked'
@@ -61,6 +61,17 @@ class CpsModuleServiceImplSpec extends Specification {
1 * mockModuleStoreService.storeSchemaSet('someDataspace', 'someSchemaSet', yangResourcesNameToContentMap)
}
+ def 'Create schema set from new modules and existing modules.'() {
+ given: 'a list of existing modules module reference'
+ def moduleReferenceForExistingModule = new ModuleReference("test", "test.org", "2021-10-12")
+ def listOfExistingModulesModuleReference = [moduleReferenceForExistingModule]
+ when: 'create schema set from modules method is invoked'
+ objectUnderTest.createSchemaSetFromModules("someDataspaceName", "someSchemaSetName", [newModule: "newContent"], listOfExistingModulesModuleReference)
+ then: 'processing is delegated to persistence service'
+ 1 * mockModuleStoreService.storeSchemaSetFromModules("someDataspaceName", "someSchemaSetName", [newModule: "newContent"], listOfExistingModulesModuleReference)
+
+ }
+
def 'Create schema set from invalid resources'() {
given: 'Invalid yang resource as name-to-content map'
def yangResourcesNameToContentMap = TestUtils.getYangResourcesAsMap('invalid.yang')