Fix test failure by ordering leaf-lists 91/137191/8
authordanielhanrahan <daniel.hanrahan@est.tech>
Thu, 8 Feb 2024 15:04:05 +0000 (15:04 +0000)
committerDaniel Hanrahan <daniel.hanrahan@est.tech>
Mon, 12 Feb 2024 14:56:01 +0000 (14:56 +0000)
commite2d88379376923fbdddc78b59f74d75fd8040ec6
tree338da3402e62f1aa0497cebb7282ae469be12031
parentc72a0132b024141716b35550fd7204338b2fc673
Fix test failure by ordering leaf-lists

YANG specifies two ways that leaf-lists can be ordered:
- ordered-by user: original order in JSON is preserved
- ordered-by system (default): it is up to the system how to order

For leaf-lists to preserve same order as the JSON, the Yang module
must specify 'ordered-by user'. To ensure consistent behaviour even
when system ordering is used, the leaf-list is sorted during parsing.

- Add 'ordered-by user' to authors field in bookstore.yang
- Sort leaf-list during parsing when using 'ordered-by system'
- Add new tests to verify ordering

Issue-ID: CPS-2057
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I6ab688ec2fa4a22182e853d1a8b26642f278c40a
cps-service/src/main/java/org/onap/cps/spi/model/DataNodeBuilder.java
csit/tests/cps-data/cps-data.robot
integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy
integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsModuleServiceIntegrationSpec.groovy
integration-test/src/test/resources/data/bookstore/bookstore.yang