Fix SchemaTreeNamespace population via augment 37/100137/3
authorSangwook Ha <sangwook.ha@verizon.com>
Wed, 16 Mar 2022 16:39:14 +0000 (09:39 -0700)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 19 Mar 2022 13:01:14 +0000 (14:01 +0100)
commit710d9e5c81cde651ad0c1093fe93ab9e6f899e1e
tree6f7c1703c19674c8952e7da3a511e8b148087185
parent0f34ef9c1d749b903a476b84c3c54e5e98225669
Fix SchemaTreeNamespace population via augment

This change adds 4 test cases to reproduce:
  - Deviation of a case node with case statement
  - Deviation of a case node without case statement
  - Deviation of an augmented case node with case statement
  - Deviation of an augmented case node without case statement

The only test case fails is the last one (deviation of an augmented
case node without case statement). There is another way to depreduce
the root cause, which is to use 'augment' instead of deviate.

The problem is that the implicit case statement does not trigger
onStatementAdded() and hence it does not get registered in the
namespace.

Fixing this issue changes behaviour in testDuplicityInAugmentTarget2(),
i.e. the schema tree overlap previously reported through
SchemaTreeIndexingException (when we are already building effective
view) gets flagged earlier with a SourceException, pointing to both the
place where the conflict occurs and which source statement is causing
it.

JIRA: YANGTOOLS-1408
Change-Id: I7c26399b07aaa142b5ab8191dab97e738118a14a
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YT1408Test.java [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/aug-choice-case-deviate-case/deviate.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/aug-choice-case-deviate-case/orig.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/aug-choice-deviate-case/deviate.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/aug-choice-deviate-case/orig.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/choice-case-deviate-case/deviate.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/choice-case-deviate-case/orig.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/choice-deviate-case/deviate.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1408/choice-deviate-case/orig.yang [new file with mode: 0644]