Fix attribute namespace lookup 87/57587/6
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 21 May 2017 13:36:42 +0000 (15:36 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 23 May 2017 13:22:39 +0000 (13:22 +0000)
commit6b5af3bc60935ac16001b71ce01a7e1b6015cff3
treebe254440690068d5db3514a1f876f6324ec664e4
parent5079ec96bfeeb7a6ff66e71a114033c7d6c5c7a3
Fix attribute namespace lookup

During review process of Id214b78849998cf54e087685dcc78e3ded74ab69
we have broken writeAttributes() in the sense it is now sensitive
to attribute namespaces not hahving a prefix assigned in the writer.

Attributes are seldom used, but NETCONF uses them without emitting
them in the writer, hence the codec is not a drop-in replacement.

Add back the ability to map attributes, but also emit a warning if
the caller has not set up the namespace. The warning is emitted
only once for each namespace.

Also modify RandomPrefix to consult the NamespaceContext for already
existing prefix mappings.

Change-Id: Iaffcbfde06b7dffbf6e6ed02c0ba7d73fd053d6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/RandomPrefix.java
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/RandomPrefixInstanceIdentifierSerializer.java
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/SchemaAwareXMLStreamNormalizedNodeStreamWriter.java
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/SchemaAwareXMLStreamWriterUtils.java
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/SchemalessXMLStreamNormalizedNodeStreamWriter.java
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/XMLStreamNormalizedNodeStreamWriter.java
yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/RandomPrefixTest.java
yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/XmlStreamUtilsTest.java