Fix min/max validation inside written value 03/71803/16
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 4 May 2018 16:25:35 +0000 (18:25 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 22 May 2018 07:01:29 +0000 (09:01 +0200)
commit1184a7fe89ab1e032948809e1f2dfb54acccfb03
tree6747d6f86730f11deff9b0ebc1a598794964d882
parent1e3269fb859578dc6a6531f4a180d83158b92d63
Fix min/max validation inside written value

When the user is writing a complete tree min/max elements
validation needs to occur inside validateStructure(), as that
runs when the data is being introduced. If we fail to validate
it then, the parent will be committed with the assumption that
the written value actually conforms to the schema.

Fix MinMaxElementsValidation to check the number of elements
inside verifyStructure(), so we flat out reject invalid writes.

JIRA: YANGTOOLS-776
Change-Id: Ie804463612403c578f0f9230884ae53641ba76c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/MinMaxElementsValidation.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug4454Test.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ListConstraintsValidation.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/YT776Test.java [new file with mode: 0644]
yang/yang-data-impl/src/test/resources/yt776/yt776.yang [new file with mode: 0644]