diff options
author | Claudio David Gasparini <claudio.gasparini@pantheon.tech> | 2020-12-14 09:49:13 +0100 |
---|---|---|
committer | Claudio David Gasparini <claudio.gasparini@pantheon.tech> | 2020-12-16 09:49:26 +0000 |
commit | 0e9a8a51e51c7f3f90e4eae4b9907558b39818f8 (patch) | |
tree | 0898b160c242963bc4593f080475913d6859d38b /cps-service/src/test/groovy | |
parent | c040bcb4ae61177b1aa691f059d19c96c6cfff7b (diff) |
Introduce YangTextSchemaSourceSet
Common interface among all layers.
YangTextSchemaSourceSet responsability is to provide all
yang model required information of an YangSchema.
Issue-ID: CPS-21
Signed-off-by: Claudio David Gasparini <claudio.gasparini@pantheon.tech>
Change-Id: I9cba490dec25defbddbb3524c6d6c1535bee63bc
Diffstat (limited to 'cps-service/src/test/groovy')
-rw-r--r-- | cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy index 801e43079a..e002b180a7 100644 --- a/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy @@ -33,7 +33,7 @@ class YangUtilsSpec extends Specification{ given: 'a yang model (file)' def file = new File(ClassLoader.getSystemClassLoader().getResource('bookstore.yang').getFile()) when: 'the file is parsed' - def result = YangUtils.parseYangModelFile(file) + def result = YangUtils.parseYangModelFiles(Collections.singletonList(file)).getSchemaContext() then: 'the result contain 1 module of the correct name and revision' result.modules.size() == 1 def optionalModule = result.findModule('stores', Revision.of('2020-09-15')) @@ -45,7 +45,7 @@ class YangUtilsSpec extends Specification{ given: 'a file with #description' File file = new File(ClassLoader.getSystemClassLoader().getResource(filename).getFile()) when: 'the file is parsed' - YangUtils.parseYangModelFile(file) + YangUtils.parseYangModelFiles(Collections.singletonList(file)) then: 'an exception is thrown' thrown(expectedException) where: 'the following parameters are used' @@ -59,7 +59,7 @@ class YangUtilsSpec extends Specification{ def jsonData = org.onap.cps.TestUtils.getResourceFileContent('bookstore.json') and: 'a model for that data' def file = new File(ClassLoader.getSystemClassLoader().getResource('bookstore.yang').getFile()) - def schemaContext = YangUtils.parseYangModelFile(file) + def schemaContext = YangUtils.parseYangModelFiles(Collections.singletonList(file)).getSchemaContext() when: 'the json data is parsed' NormalizedNode<?, ?> result = YangUtils.parseJsonData(jsonData, schemaContext) then: 'the result is a normalized node of the correct type' @@ -70,7 +70,7 @@ class YangUtilsSpec extends Specification{ def 'Parsing invalid data: #description.'() { given: 'a yang model (file)' def file = new File(ClassLoader.getSystemClassLoader().getResource('bookstore.yang').getFile()) - def schemaContext = YangUtils.parseYangModelFile(file) + def schemaContext = YangUtils.parseYangModelFiles(Collections.singletonList(file)).getSchemaContext() when: 'invalid data is parsed' YangUtils.parseJsonData(invalidJson, schemaContext) then: 'an exception is thrown' @@ -84,7 +84,7 @@ class YangUtilsSpec extends Specification{ def 'Breaking a Json Data Object into fragments.'() { given: 'a Yang module' def file = new File(ClassLoader.getSystemClassLoader().getResource('bookstore.yang').getFile()) - def schemaContext = YangUtils.parseYangModelFile(file) + def schemaContext = YangUtils.parseYangModelFiles(Collections.singletonList(file)).getSchemaContext() def module = schemaContext.findModule('stores', Revision.of('2020-09-15')).get() and: 'a normalized node for that model' def jsonData = TestUtils.getResourceFileContent('bookstore.json') |