summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorClaudio David Gasparini <claudio.gasparini@pantheon.tech>2021-01-07 12:21:38 +0100
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>2021-01-11 10:01:27 +0100
commitfa56d71bb94d88f657a9d73fb91c3036220f32ab (patch)
tree163bd68ae4a77cdc4412a5354958090e7063f257 /cps-service/src/test
parent45b0d293c2d625c6d352d71a743f832c5e287c4e (diff)
Rework CpsModulePersistenceService
- remove getModuleReferences - provide service returning YangTextSchemaSourceSet Issue-ID: CPS-21 Signed-off-by: Claudio David Gasparini <claudio.gasparini@pantheon.tech> Change-Id: I61cf6450c8ed8a5154990ea19467e016dc1155b4
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, 13 insertions, 4 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 a93411bfe9..ebe4fe7bce 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
@@ -21,11 +21,9 @@
package org.onap.cps.api.impl
import org.onap.cps.TestUtils
-import org.onap.cps.spi.CpsModulePersistenceService
+import org.onap.cps.spi.CpsModulePersistenceService;
import org.onap.cps.spi.exceptions.ModelValidationException
-import org.onap.cps.utils.YangUtils
-import org.opendaylight.yangtools.yang.common.Revision
-import org.opendaylight.yangtools.yang.model.api.SchemaContext
+import org.onap.cps.spi.model.ModuleReference
import spock.lang.Specification
class CpsModuleServiceImplSpec extends Specification {
@@ -54,4 +52,15 @@ class CpsModuleServiceImplSpec extends Specification {
thrown(ModelValidationException.class)
}
+ def 'Get schema set by name and namespace.'() {
+ given: 'an already present schema set'
+ def yangResourcesNameToContentMap = TestUtils.getYangResourcesAsMap('bookstore.yang')
+ mockModuleStoreService.getYangSchemaResources('someDataspace', 'someSchemaSet') >> yangResourcesNameToContentMap
+ when: 'get schema set method is invoked'
+ def result = objectUnderTest.getSchemaSet('someDataspace', 'someSchemaSet')
+ then: 'the correct schema set is returned'
+ result.getName().contains('someSchemaSet')
+ result.getDataspaceName().contains('someDataspace')
+ result.getModuleReferences().contains(new ModuleReference('stores', 'org:onap:ccsdk:sample', '2020-09-15'))
+ }
}