Fix ChoiceNodeContextNode's byQName indexing 27/100227/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 23 Mar 2022 17:31:39 +0000 (18:31 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 23 Mar 2022 17:46:01 +0000 (18:46 +0100)
commitc9543ea06b176ae07a205abe29fc385a7b7548ad
treebcf1e683605d4e17437b789de31db14fc989b9e4
parenteb017d49e00a06c1b29ac1a91d4d95007fa7c1a6
Fix ChoiceNodeContextNode's byQName indexing

When we are traversing by provided QName, we are meant to encounter
each ContextNode significant to PathArgument construction. This works
for all cases except for 'choice->case->choice', where
ChoiceNodeContextNode's internal indexing does not account for itself:
it ends up storing the second ChoiceNodeContextNode under the
ChoiceSchemaNode's QName -- and therefore it fails to find it by its
consituents' QNames.

This has impact primarily on instance-identifier parsers, as evidenced
by the corresponding JSON-based unit test.

Fix this by properly overriding getQNameIdentifiers() to provide the
internal table's keySet().

JIRA: YANGTOOLS-1411
Change-Id: I11df2d4072157e06342c2899dbcf02f74eef8090
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
codec/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AbstractComplexJsonTest.java
codec/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/YT1411Test.java [new file with mode: 0644]
data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/ChoiceNodeContextNode.java