summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy
diff options
context:
space:
mode:
authoremaclee <lee.anjella.macabuhay@est.tech>2022-11-22 16:04:14 +0000
committeremaclee <lee.anjella.macabuhay@est.tech>2022-12-06 09:36:52 +0000
commit25969bf454bc0c965408cdc1a1ff2df223a8cb49 (patch)
treeb3e3c3a02d1ad87f9f981ede69da6dac9d3c82d2 /cps-service/src/test/groovy
parent17cbd7b1b51f8d961ad6a908d12c767497afceb9 (diff)
Upgrade Open daylight yang tool to version 8.0.6
- changed classes according to upgrade of yang tool - changed methods in YangUtils class to accomodate change for jSonParserStream method - updated unit tests for the upgrade Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech> Change-Id: Ib62fe424150ed0695eed168e1ae21f4d9a61cdf4
Diffstat (limited to 'cps-service/src/test/groovy')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/utils/JsonParserStreamSpec.groovy6
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/utils/YangUtilsSpec.groovy8
2 files changed, 7 insertions, 7 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/JsonParserStreamSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/JsonParserStreamSpec.groovy
index 68f9251eb9..40f0e0a2ae 100644
--- a/cps-service/src/test/groovy/org/onap/cps/utils/JsonParserStreamSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/utils/JsonParserStreamSpec.groovy
@@ -10,7 +10,7 @@ import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier
import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream
import org.opendaylight.yangtools.yang.data.impl.schema.Builders
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder
+import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import spock.lang.Specification
import org.onap.cps.TestUtils
@@ -38,10 +38,10 @@ class JsonParserStreamSpec extends Specification{
then: 'result is the correct size'
result.size() == 2
then: 'data container child is a type of normalized node'
- def dataContainerChild = result.getValue()[index]
+ def dataContainerChild = result.body().getAt(index)
dataContainerChild instanceof NormalizedNode == true
then: 'qualified name created is as expected'
- dataContainerChild.nodeType == QName.create('org:onap:ccsdk:multiDataTree', '2020-09-15', nodeName)
+ dataContainerChild.identifier.nodeType == QName.create('org:onap:ccsdk:multiDataTree', '2020-09-15', nodeName)
where:
index | nodeName
0 | 'first-container'
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 3f190910b1..65aa3af7d8 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
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
+ * Copyright (C) 2020-2022 Nordix Foundation
* Modifications Copyright (C) 2021 Pantheon.tech
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,9 +36,9 @@ class YangUtilsSpec extends Specification {
def yangResourceNameToContent = TestUtils.getYangResourcesAsMap('bookstore.yang')
def schemaContext = YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent).getSchemaContext()
when: 'the json data is parsed'
- NormalizedNode<?, ?> result = YangUtils.parseJsonData(jsonData, schemaContext)
+ NormalizedNode result = YangUtils.parseJsonData(jsonData, schemaContext)
then: 'the result is a normalized node of the correct type'
- result.nodeType == QName.create('org:onap:ccsdk:sample', '2020-09-15', 'bookstore')
+ result.getIdentifier().nodeType == QName.create('org:onap:ccsdk:sample', '2020-09-15', 'bookstore')
}
def 'Parsing invalid data: #description.'() {
@@ -63,7 +63,7 @@ class YangUtilsSpec extends Specification {
when: 'json string is parsed'
def result = YangUtils.parseJsonData(jsonData, schemaContext, parentNodeXpath)
then: 'result represents a node of expected type'
- result.nodeType == QName.create('org:onap:cps:test:test-tree', '2020-02-02', nodeName)
+ result.getIdentifier().nodeType == QName.create('org:onap:cps:test:test-tree', '2020-02-02', nodeName)
where:
scenario | jsonData | parentNodeXpath || nodeName
'list element as container' | '{ "branch": { "name": "B", "nest": { "name": "N", "birds": ["bird"] } } }' | '/test-tree' || 'branch'