yangtools.git
4 years agoCleanup yang-parser-rfc7950 antlr configuration 97/84997/1
Robert Varga [Tue, 8 Oct 2019 17:08:15 +0000 (19:08 +0200)]
Cleanup yang-parser-rfc7950 antlr configuration

This fixes up a long-standing issue with how antlr is configured,
fixing javadoc plugin interaction in the process.

Change-Id: Ia077b7b2f777203baea8aad3400abd484e3e6801
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9887727e92d3674d7cd77563f74683382a58f6a3)

4 years agoRemove jacoco/surefire configration 96/84996/1
Robert Varga [Tue, 8 Oct 2019 15:33:03 +0000 (17:33 +0200)]
Remove jacoco/surefire configration

This configuration does not seem to serve any purpose, remove it.

Change-Id: I1b0c714fbb9f347011d6e4869d64886fecf11c62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2aee8b76e88757d440620f7bec11bef23f0559e1)

4 years agoClose JSON root context when the writer is closed 81/84981/1
Robert Varga [Mon, 7 Oct 2019 15:19:34 +0000 (17:19 +0200)]
Close JSON root context when the writer is closed

We should be closing the root context when we are closed, not when
a its child is closed -- otherwise it would be impossible to write
multiple children of the root context.

Since we are in the area, also centralize some QName/ContainerNode
creation.

JIRA: YANGTOOLS-1029
Change-Id: I599fb5ad1ad8e36a441dff761984d5406e401d55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f8e3d9af24d8d5d1eeca6a714d29f9822537a773)

4 years agoRepresent large number types as strings 65/84965/2
Mario Abraham [Fri, 27 Sep 2019 09:00:08 +0000 (11:00 +0200)]
Represent large number types as strings

A value of the int64, uint64 and decimal64 type is
represented as a JSON string related to rfc 7951.

Issue-ID: YANGTOOLS-1027
Change-Id: Ic6aea0a0f97e042ed40d2e0be323557750401621
Signed-off-by: Mario Abraham <mario.abraham@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit af02c59d72a4f6af9361ea2842c35e634f6454e4)

4 years agoSpecialize JSONInstanceIdentifierCodec 64/84964/1
Robert Varga [Sat, 5 Oct 2019 11:16:57 +0000 (13:16 +0200)]
Specialize JSONInstanceIdentifierCodec

We do not want to force RFC7951 to instantiate the old lhotka-02
codec if we are not using it. Make JSONInstanceIdentifierCodec
an abstract class and specialize it as
Lhotka02JSONInstanceIdentifierCodec, so we have two distinct
concrete classes.

Change-Id: Icb30d97ec9134e8dc368775e48b93ef042ed9121
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f8325877a6b29e3791b3dd945881b9cf1e648ea4)

4 years agoShortcut Collections.sort() 63/84963/1
Robert Varga [Mon, 7 Oct 2019 09:12:01 +0000 (11:12 +0200)]
Shortcut Collections.sort()

We have a concrete List implementation, hence we can use List.sort()
directly.

Change-Id: I4baa0f41ee34479b5a915d6e3670029553b48b82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6c70f2b315960611004245950729daa5fa2aa5c0)

4 years agoAdd odl-guava dependency 76/84776/1
Robert Varga [Fri, 27 Sep 2019 09:45:56 +0000 (11:45 +0200)]
Add odl-guava dependency

odl-yangtools-util is pulling in guava, is should depend on
odl-guava to get it.

Change-Id: I7514cf9fe69fa14e042c95bbcc93e4882ac1ae0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTake advantage of ValueNode in NormalizedNodes 90/84490/1
Robert Varga [Sun, 15 Sep 2019 22:10:56 +0000 (00:10 +0200)]
Take advantage of ValueNode in NormalizedNodes

We can perform a single instanceof check instead of two to check
for LeafNode and LeafSetEntryNode. Also cleanup checks to remove
superfluous type arguments.

Change-Id: Id9964088ff0751217175cf1a8c6f13009a0276e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 383c8a118c7bf009c268ced6c2db555244054e04)

4 years agoCleanup requireNonNull() use in NormalizedNodes 89/84489/1
Robert Varga [Sun, 15 Sep 2019 22:07:49 +0000 (00:07 +0200)]
Cleanup requireNonNull() use in NormalizedNodes

Take advantage of the non-null return to save a tiny bit of bytecode.

Change-Id: Ie43b7ccc15dd96cd320eb74c0b0a2d5a0dd8a4da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e36fb827370e197a732dac43e123fe780e521303)

4 years agoAdd missing @Override 86/84486/1
Robert Varga [Sun, 15 Sep 2019 22:02:02 +0000 (00:02 +0200)]
Add missing @Override

LoggingNormalizedNodeStreamWriter.domSourceValue() is missing
an annotation for some reason. Fix that.

Change-Id: I01741c2a28de11f2a86562e588db15882dbe0912
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 32de8441a7c05a0d0cc988280d24621fcfedfb16)

4 years agoBump version to 3.0.6-SNAPSHOT 57/84357/1
Robert Varga [Fri, 13 Sep 2019 04:45:17 +0000 (06:45 +0200)]
Bump version to 3.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I011ffc0ec1186161d81a440c507f2319066d0b47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 5.0.2 19/83919/7
Robert Varga [Thu, 22 Aug 2019 15:13:01 +0000 (17:13 +0200)]
Bump odlparent to 5.0.2

This bumps odlparent references to pick latest fixes.

Change-Id: I2eeae6371f6c97ea5fb2333d7a3daccf8c248685
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate TypeDefinitionAwareCodec 47/84347/2
Robert Varga [Fri, 23 Aug 2019 19:30:14 +0000 (21:30 +0200)]
Update TypeDefinitionAwareCodec

Note that the factory can return null, annotate as such and document
that @Nullable should be eliminated.

Change-Id: I63c4703ef9b63ce1a7fccb70b32beb23398be748
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 69552d59a2aa31f39501f15e15ded6a67484195b)

4 years agoAdd NodeIdentifierWithPredicates.containsKey() 46/84346/2
Robert Varga [Thu, 12 Sep 2019 15:16:05 +0000 (17:16 +0200)]
Add NodeIdentifierWithPredicates.containsKey()

This is a useful check, which can be performed via getValue()
and checking for null return, but implementations can perform
it a wee bit more quickly.

Change-Id: I2182870ca3cfba082c6cebafe947643d5e191f4a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 553dadbff0756bb7555545cd264916f6f2bd2101)

4 years agoMigrate Class.newInstance() user 45/84345/2
Robert Varga [Thu, 5 Sep 2019 09:35:19 +0000 (11:35 +0200)]
Migrate Class.newInstance() user

Class.newInstance() is deprecated since Java 9, migrate to explicit
constructor invocation.

Change-Id: Ifc2e67aa4a56a9ccc306eb540100ebc299eb00c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ba34613f883014ecc308f83d8786a08624f910c5)

4 years agoOptimize immutable lookups 35/84135/2
Robert Varga [Mon, 2 Sep 2019 15:25:37 +0000 (17:25 +0200)]
Optimize immutable lookups

We have a number of private Set/Map/Lists which we are using for
lookups. These typically are backed by Immutable implementations,
hence we can propagate the type knowledge to improve bytecode
generation and make JIT's life easier.

Change-Id: I7f90393b8bc76196deced50f1800c3f99424fa1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9e0e66b8a190dbd7f2903f1b4457fe4a1660254a)

4 years agoRemove references to YangInstanceIdentifier.EMPTY 62/84062/3
Robert Varga [Wed, 28 Aug 2019 20:40:14 +0000 (22:40 +0200)]
Remove references to YangInstanceIdentifier.EMPTY

The constant is going away, update javadocs to reflect that.

Change-Id: Ie0415cbd1afd375b14a6c62d097f288ed2193613
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2db0dd5c85bdf1e125362809b3b504b5090f9f98)

4 years agoDeprecate YangInstanceIdentifier.EMPTY 61/84061/3
Robert Varga [Wed, 28 Aug 2019 18:21:39 +0000 (20:21 +0200)]
Deprecate YangInstanceIdentifier.EMPTY

This runtime constant forces instantiation of a subclass, leading
to a SpotBugs warning. A static accessor works just as well --
hence YangInstanceIdentifier.empty()

Change-Id: I67b562b176f17d3c327b4589b673017f513f98f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a30bea3eefedbde31d9cf0c1ac7cdb3f8cdd190b)

4 years agoOptimize ImmutableNodes.leafNode() 16/84016/1
Robert Varga [Tue, 27 Aug 2019 14:13:19 +0000 (16:13 +0200)]
Optimize ImmutableNodes.leafNode()

This eliminates instantiation of a temporary builder and shortcuts
to creating the leaf node directly.

Change-Id: I66256b46ef0de1aa3745bb90e70d41a2bd29d419
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b6ba37de8e39888262a2bfa21d804cd233990e89)

4 years agoAdd utility PotentialSchemaSource constructor 92/83992/1
Robert Varga [Mon, 26 Aug 2019 12:32:46 +0000 (14:32 +0200)]
Add utility PotentialSchemaSource constructor

It is useful for users to use pre-defined acquisition costs, this
adds a utility so users do not have to call Costs.getValue().

Change-Id: Ib44352784076493a317dcee0aa64d108301a6305
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6a3098e0916f4850629cb11730ab008794b17d30)

4 years agoFix a theoretical IM_BAD_CHECK_FOR_ODD 07/83907/2
Robert Varga [Thu, 22 Aug 2019 13:02:53 +0000 (15:02 +0200)]
Fix a theoretical IM_BAD_CHECK_FOR_ODD

While the size of a collection cannot be negative, this keeps
SpotBugs happy about the check.

Change-Id: Ic84a9f147b9d933efc66766617f6271fcf1eddc1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRely on framework to unregister XPathParserFactory 06/83906/2
Robert Varga [Thu, 22 Aug 2019 12:57:38 +0000 (14:57 +0200)]
Rely on framework to unregister XPathParserFactory

This simplifies the code a bit while also squashing two SpotBug
violations.

Change-Id: Ie3f146568510a949e3c7d332c95c59b90f17c7b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkstyle 90/83890/1
Robert Varga [Thu, 22 Aug 2019 10:41:27 +0000 (12:41 +0200)]
Fix checkstyle

This fixes issues found by checkstyle.

Change-Id: Iecab9171c2d4d63cf564139c714a4552d069636b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpand MapAdaptor javadoc 93/83793/1
Robert Varga [Tue, 20 Aug 2019 12:17:21 +0000 (14:17 +0200)]
Expand MapAdaptor javadoc

This fixes a few warnings around javadoc completes of MapAdaptor.

Change-Id: I6bb7b6354530b4ad47a07b4b0358c720b80b4230
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGeneralize ForwardingIdentityObject 20/83720/1
Robert Varga [Fri, 16 Aug 2019 17:01:18 +0000 (19:01 +0200)]
Generalize ForwardingIdentityObject

Wrapping objects in identity comparison is useful, and there
seems to be no readily-avaible utility. This introduces an
extension to ForwardingObject and a simple utility class to
implement its construct.

JIRA: YANGTOOLS-1016
Change-Id: If0d7a2f731b0a294570f8ba39ce5da7236e2c752
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6a039ee1b2179eb5b77ca30a366e866970806547)

4 years agoFix schema-ref traversal 75/83675/4
Anna Bencurova [Thu, 15 Aug 2019 12:17:34 +0000 (14:17 +0200)]
Fix schema-ref traversal

When traversing schema-mount definitions, we need to account for
schema-ref being a choice and hence its children are not directly
reachable.

JIRA: YANGTOOLS-1015
Change-Id: Iaa9ddbf33c172c433cb323166e5b1bcea5eea649
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove javadoc plugin version override 91/83391/3
Robert Varga [Mon, 5 Aug 2019 09:25:58 +0000 (11:25 +0200)]
Remove javadoc plugin version override

odlparent is using a newer plugin, remove the unneeded override.

Change-Id: I6afb495233e3959364c45eb3189cabe20ebdcf5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 66390f4c28b45b740bfd73f84ea17494e822ac1e)

4 years agoApply modernization 16/83416/2
Robert Varga [Tue, 6 Aug 2019 08:39:43 +0000 (10:39 +0200)]
Apply modernization

This fixes up use of old constructs pointed out by maven modernizer
plugin.

Change-Id: I3f926678763f72b195ae961ce7f220a1845fef52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove Decimal64.toInt() method 05/83405/2
Robert Varga [Mon, 5 Aug 2019 16:04:11 +0000 (18:04 +0200)]
Move Decimal64.toInt() method

This utility is only used in nested class, move it to keep SpotBugs
happy under Java 11.

Change-Id: I405718bf3db9ebcdd972ae5a71c47570c424f730
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkArgument constructor 07/83407/2
Robert Varga [Tue, 6 Aug 2019 06:23:59 +0000 (08:23 +0200)]
Fix checkArgument constructor

This adds a missing argument and removes the need for synthetic
accessors.

Change-Id: I7e293036b35b86c9ac555f2880747748b8c35443
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkstyle errors 06/83406/2
Robert Varga [Mon, 5 Aug 2019 14:14:49 +0000 (16:14 +0200)]
Fix checkstyle errors

Upgraded checkstyle plugin is finding some more errors, fix them
up.

Change-Id: Id58302b1dcd0574fa94340965c15259621a9156d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkstyle errors 94/83394/1
Robert Varga [Mon, 5 Aug 2019 14:14:49 +0000 (16:14 +0200)]
Fix checkstyle errors

Upgraded checkstyle plugin is finding some more errors, fix them
up.

Change-Id: I755c73be82230cb1a1a22fd776322b7a1d2afc4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTeach DataSchemaContextNode about anydata 03/83303/2
Robert Varga [Mon, 29 Jul 2019 15:25:54 +0000 (17:25 +0200)]
Teach DataSchemaContextNode about anydata

We failed to account for anydata nodes, which should behave the
same way as anyxml nodes.

Change-Id: Id8a2aff60921094e149f58c8b7bba1822587c96f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump version to 3.0.5-SNAPSHOT 93/83293/1
Robert Varga [Mon, 29 Jul 2019 09:10:20 +0000 (11:10 +0200)]
Bump version to 3.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: Iaf21895aadee2433c1bba42e0b3fa8097f4ae8e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Check for nested augmentations" 91/83291/1
Robert Varga [Mon, 29 Jul 2019 08:41:59 +0000 (10:41 +0200)]
Revert "Check for nested augmentations"

This reverts commit 759e69d85991edb987a760165adb83fa3f2ab67b.

JIRA: YANGTOOLS-956
Change-Id: I3c80751043a101de77292bc91e0c1c4178d16f44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCheck for nested augmentations 45/81145/6
Robert Varga [Tue, 19 Feb 2019 10:22:49 +0000 (11:22 +0100)]
Check for nested augmentations

When we are augmenting an already-conditional-augmented node from
the same module, we should inherit the previous when statement.

JIRA: YANGTOOLS-956
Change-Id: Ia3c04d60f4975bd721406b26aa4c2e7d8b05122b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd support for writing mountpoints to JSON 55/83255/1
Robert Varga [Thu, 25 Jul 2019 15:59:35 +0000 (17:59 +0200)]
Add support for writing mountpoints to JSON

This adds basic support for emitting mountpoints into JSON documents,
as otherwise we cannot translate XML-to-JSON, which hampers the usual
use case of NETCONF-to-RESTCONF transformation.

JIRA: YANGTOOLS-1013
Change-Id: I9e29050384ba344804538d4155175908c9ed6697
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd rename fixmes to NormalizedNodeStreamWriterExtensions 54/83254/1
Robert Varga [Thu, 25 Jul 2019 15:53:15 +0000 (17:53 +0200)]
Add rename fixmes to NormalizedNodeStreamWriterExtensions

The extension for Anydata is known as AnydataExtension, it makes
sense to keep naming consistent. Drop a few FIXMEs to that effect.

Change-Id: Ic2b848cd96d0d32a540bb2d10d82a80e0f0d2648
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd DatastoreIdentifier 53/83253/2
Robert Varga [Thu, 25 Jul 2019 15:40:19 +0000 (17:40 +0200)]
Add DatastoreIdentifier

This is a type-safe manifestation of RFC8342 datastore identity
for the purposes of yang-data-api. While this identifier not
immediately used in any contracts, it will be required for
RFC8525/RFC8528 interoperation where codecs are concerned.

JIRA: YANGTOOLS-1012
Change-Id: Ief45ed176d5751dc22249d3c40da2473f648bbc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPackage RFC8528 extensions in odl-yangtools-data-api 51/83251/1
Robert Varga [Thu, 25 Jul 2019 13:28:19 +0000 (15:28 +0200)]
Package RFC8528 extensions in odl-yangtools-data-api

These are pulled into the implementation package, whereas we really
want to have them in the api package.

Change-Id: Ibfaa05586da9e7b8abb2aea13db24775ba285ffc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd MountPointNormalizedNodeWriter 40/83240/1
Robert Varga [Wed, 24 Jul 2019 16:48:27 +0000 (18:48 +0200)]
Add MountPointNormalizedNodeWriter

With the advent of MountMointNode a NormalizedNode tree can contain
nested mount point data, which is not quite a regular node.

This patch introduces a utility NormalizedNodeWriter, which can
either filter or forward MountPointNodes through a NormalizedNode
stream.

JIRA: YANGTOOLS-1010
Change-Id: Ie8cf6efa0874864461aa761b8a9c6e74a250bbac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTeach InstandIdToNodes about AnydataNode 38/83238/1
Robert Varga [Wed, 24 Jul 2019 15:18:47 +0000 (17:18 +0200)]
Teach InstandIdToNodes about AnydataNode

This mirrors the capability of anyxml nodes, hence the data can
be queried.

Change-Id: Ib4b1f13ebbc1a6b8eb8b41ab6cc918d5533a59b6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd NodeIdentifierWithPredicates.getValue() 30/83230/1
Robert Varga [Wed, 24 Jul 2019 10:23:33 +0000 (12:23 +0200)]
Add NodeIdentifierWithPredicates.getValue()

Acquiring a particular value is useful for code which extracts
values out of a YangInstanceIdentifier -- as these mirror corresponding
leaves.

Change-Id: I6a1613315489cb0219225b344f266cf31cd88815
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd AbstractMountPointContextFactory 20/83220/2
Robert Varga [Tue, 23 Jul 2019 23:58:44 +0000 (01:58 +0200)]
Add AbstractMountPointContextFactory

This factory has model-specific information about RFC8528, so that
it is able to form an accurate view of mount points defined by inline
data.

Change-Id: I3350403c3fb3e1e074649536511eb7935f0ff6c9
JIRA: YANGTOOLS-1010
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions for 3.0.4-SNAPSHOT 83/83083/1
Robert Varga [Thu, 18 Jul 2019 05:37:50 +0000 (07:37 +0200)]
Bump versions for 3.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I1c5be6a304bbdbae706fb39b4cbcb6b9510cca25
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor MountPoint-related definitions 65/83065/11
Robert Varga [Tue, 16 Jul 2019 13:23:14 +0000 (15:23 +0200)]
Refactor MountPoint-related definitions

At data-api level we have an opinionated view of how
the underlying mount point looks like and unify the semantics
of a mount point.

Notably we have a MountPointContext, which provides an entrypoint
into the mount point resolution process, which can be dynamically
constructed from inlinee parser data.

This simplifies things by quite a bit, getting rid of unneeded
abstractions in the process.

JIRA: YANGTOOLS-1007
Change-Id: I6419d13b8a84a4cdf5cc7707dba039c33f8d3f39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove MountPointChild to rfc8528-data-api 63/83063/1
Robert Varga [Tue, 16 Jul 2019 13:10:10 +0000 (15:10 +0200)]
Move MountPointChild to rfc8528-data-api

This concept encapsulates a potential NormalizedNode and is needed
for mount point schema resolution. Move it to data-api.

Change-Id: I26917007488070dbb664eaaf82d11eeae62ae425
JIRA: YANGTOOLS-1007
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpecial-case schema-mount nodes 58/83058/3
Robert Varga [Tue, 16 Jul 2019 09:56:50 +0000 (11:56 +0200)]
Special-case schema-mount nodes

We need to recognize yangmnt:schema-mounts before we start emitting
the mount point data, as it may be required for nested mountpoint
resolution.

JIRA: YANGTOOLS-1007
Change-Id: Iee2b3ab7ddc4f2ae2416d01a8554fc7ec11cc6ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove YangLibraryConstants 56/83056/5
Robert Varga [Tue, 16 Jul 2019 08:36:38 +0000 (10:36 +0200)]
Move YangLibraryConstants

These constants are only needed at data-api layer, move them.

JIRA: YANGTOOLS-1007
Change-Id: I2f53b5dcf8302d833e252f1022396ddbc5d0cb94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd ImmutableMountPointNormalizedNodeStreamWriter 12/83012/15
Robert Varga [Wed, 10 Jul 2019 22:22:25 +0000 (00:22 +0200)]
Add ImmutableMountPointNormalizedNodeStreamWriter

This is an immutable writer, which is able to receive mount points
from a stream and turns them into MountPointNodes.

JIRA: YANGTOOLS-1010
Change-Id: I1c89c757b25ac58632d8183df12e77427511ee9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEliminate MountPointSchemaResolver 52/83052/5
Robert Varga [Mon, 15 Jul 2019 20:12:32 +0000 (22:12 +0200)]
Eliminate MountPointSchemaResolver

MountPointSchemaResolver really deals with mount point data
instantiation. This means is really needs to live at the data-api
layer instead of model-api layer -- but it turns out we have a
mirror in MountPointNodeFactory, hence we just converge on that
interface instead.

JIRA: YANGTOOLS-1007
Change-Id: I69f1d2c11239f48d22a0d2d184604e5518e50354
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoInclude RFC85258 API documentation 51/83051/3
Robert Varga [Mon, 15 Jul 2019 20:14:23 +0000 (22:14 +0200)]
Include RFC85258 API documentation

This was missed, add the corresponding sections.

JIRA: YANGTOOLS-1007
Change-Id: Icc6a2c20f350ef29deacec90a579ba61d329e7aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd XML support for parsing schema-mount data 48/82748/41
Robert Varga [Wed, 26 Jun 2019 13:06:12 +0000 (15:06 +0200)]
Add XML support for parsing schema-mount data

When we cannot find a direct descendant of a particular schema,
we can still interpret it as a schema-mounted element, if the
corresponding schema allows for that.

JIRA: YANGTOOLS-1007
Change-Id: I1e595fafcc0aa1cd41c2cc6afc469d5152953dc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd MountPointNode and its specializations 82/82982/28
Robert Varga [Tue, 9 Jul 2019 20:29:38 +0000 (22:29 +0200)]
Add MountPointNode and its specializations

MountPointNode is a utility construct to carry a NormalizedNode
tree with mount point content attached.

JIRA: YANGTOOLS-1010
Change-Id: Ie33cd6e566584191d20f942eeb87ce6145e30717
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoIntroduce MountPointIdentifier 11/83011/10
Robert Varga [Wed, 10 Jul 2019 19:25:17 +0000 (21:25 +0200)]
Introduce MountPointIdentifier

For the purposes of streaming mount points out, we need to form
a proper identifier namespace -- MountPointIdentifier does exactly
that, improving type-safety.

This is a first step in a larger-scale refactor to clean up the
interactions between the parser and the writer.

JIRA: YANGTOOLS-1007
Change-Id: Ie3d0125c3e6c4ff795f3492b025fa00bc2b145b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRetrofit mount-point awareness into yang-data-util 77/82977/20
Robert Varga [Tue, 9 Jul 2019 10:57:04 +0000 (12:57 +0200)]
Retrofit mount-point awareness into yang-data-util

{Container,ListEntry}NodeDataWithSchema can potentially contain
out-of-band mount point data, which needs intermediate processing
once all data has been acquired.

We introduce AbstractMountPointDataWithSchema as a common superclass,
which optionally holds MountPointData.

MountPointData contains enough information to resolve the data nodes
in the context of a schema context supplied either statically or
dynamically (based on the mount data).

JIRA: YANGTOOLS-1007
Change-Id: I08ba4dcf3aaf758f12b42e625d9d17a774d07825
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd AbstractIdentifiable 83/82983/4
Robert Varga [Tue, 9 Jul 2019 22:41:35 +0000 (00:41 +0200)]
Add AbstractIdentifiable

This utility class allows us to share Identifiable implementation
subclasses. This reduces the number of implementations present.

Change-Id: I87132f0b434339a55c4911c96affabb2afb67602
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd AbstractSchemaContextProvider 81/82981/4
Robert Varga [Tue, 9 Jul 2019 21:29:53 +0000 (23:29 +0200)]
Add AbstractSchemaContextProvider

In most SchemaContextProvider cases we are dealing with a constant
SchemaContext. Codify that in AbstractSchemaContextProvider.

Change-Id: If4e8fea593ab30d10da0d206b379aba407627677
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix yang-parser-rfc7950 module name 78/82978/1
Robert Varga [Tue, 9 Jul 2019 12:00:32 +0000 (14:00 +0200)]
Fix yang-parser-rfc7950 module name

The bundle has wrong Automatic-Module-Name, fix that up.

Change-Id: Ieb6821dac0ea8ab8130fc498b7e032eb174890b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd rfc8528-data-api 76/82976/2
Robert Varga [Tue, 9 Jul 2019 09:39:25 +0000 (11:39 +0200)]
Add rfc8528-data-api

Mount points require a rather complex interaction with
NormalizedNodeStreamWriter, which is defined in a new artifact.

Change-Id: If3063151c7eca561b5382e2da6ddc339cba94e4f
JIRA: YANGTOOLS-1007
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd YangLibraryConstants 75/82975/2
Robert Varga [Tue, 9 Jul 2019 09:30:43 +0000 (11:30 +0200)]
Add YangLibraryConstants

RFC8528's data representation rules require components dealing with
mountpoints on both schema and data levels to recognize
ietf-yang-library data for the purposes of interpretation of other
contained data. This patch adds the minimum information required
to identify the data items required.

Change-Id: I9be2e1d6527d316a475dc1e47d7670e75383810b
JIRA: YANGTOOLS-1007
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAllow statements to efficiently lookup actions/notifications 43/82943/1
Robert Varga [Mon, 8 Jul 2019 08:58:40 +0000 (10:58 +0200)]
Allow statements to efficiently lookup actions/notifications

As actions and notifications are part of schema tree, we can reuse
that namespace to efficiently look them up.

Change-Id: I07d6dcc44648fb74c774a7437743db486e444a62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAllow actions/notifications to be efficiently looked up 20/82920/4
Robert Varga [Wed, 3 Jul 2019 22:34:51 +0000 (00:34 +0200)]
Allow actions/notifications to be efficiently looked up

It is quite common to look up actions/notifications through
their QName. Add a method to look them up directly to
{Action,Notification}NodeContainer.

Change-Id: Ib643f60b932e6298f95aaaf67981347104c4299f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake sure root JSON context is properly flushed 68/82868/9
Anna Bencurova [Mon, 1 Jul 2019 13:34:05 +0000 (15:34 +0200)]
Make sure root JSON context is properly flushed

If we are dealing with an exclusive context which contains
only children which can be skipped, we can end up attempting
to close the context without it first having been emitted,
leading to a GSON splat.

In order to fix this, we need make sure we do not directly
emitEnd(), but rather endNode() -- so that the context can
emit its starts if it has not done so.

JIRA: YANGTOOLS-1008
Change-Id: I02452abe24c7a42b83246a113f284990f6211d9f
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUnify ComplexJson SchemaContext references 29/82929/2
Robert Varga [Thu, 4 Jul 2019 10:34:52 +0000 (12:34 +0200)]
Unify ComplexJson SchemaContext references

This introduces AbstractComplexJsonTest, which maintains the schema
context for complexjson models and the corresponding codec factory.

Change-Id: I667fd5274a6e315679854e79389a42c93d3d72eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpecialize SchemaPath.create(boolean, QName) 19/82919/1
Robert Varga [Wed, 3 Jul 2019 22:30:16 +0000 (00:30 +0200)]
Specialize SchemaPath.create(boolean, QName)

As it turns out we use single-QName variant quite heavily, this
provides a specialized method, which does not have varargs.

Change-Id: I5a3f1bc7379fe6c387fd8d0fb3cfb9cef0139c72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit uint factory methods 10/82910/1
Robert Varga [Wed, 3 Jul 2019 12:49:45 +0000 (14:49 +0200)]
Split uint factory methods

This splits up internal methods lookup methods, so that they are
more easily inlined. Also mark cache access as potential VarHandle
users.

Change-Id: I1892290d347fba9e662394fda0ca5ce4394514d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 5.0.1 36/82636/4
Robert Varga [Fri, 21 Jun 2019 05:15:09 +0000 (07:15 +0200)]
Bump odlparent to 5.0.1

This picks up the next odlparent release.

Change-Id: I189d00c83577c602acfd25053e6b35bf20d18123
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd prerequisiteUnavailable() 09/74809/10
Robert Varga [Fri, 3 Aug 2018 18:37:30 +0000 (20:37 +0200)]
Add prerequisiteUnavailable()

This method should be invoked when we know the prerequisite is
not available. This adds the very basic notion and hooks for that.

Change-Id: Ibdb7a04737292be1f3a091057601af7db8325a38
JIRA: YANGTOOLS-859
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoHandle implicit parent statements during copy operations 38/68838/30
Robert Varga [Tue, 27 Feb 2018 20:01:27 +0000 (21:01 +0100)]
Handle implicit parent statements during copy operations

Rather than special-casing choice nodes, make sure we create a proper
implicit statement when effective nodes are being introduced.

JIRA: YANGTOOLS-724
Change-Id: I5c2f26df31ba78623cd1dd156710f3a12db8c671
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse assertThat(isA()) instead of assertTrue(instanceof) 59/82759/1
Robert Varga [Thu, 27 Jun 2019 10:30:44 +0000 (12:30 +0200)]
Use assertThat(isA()) instead of assertTrue(instanceof)

This improves errors reported when tests are failing, which is
a good thing.

Change-Id: I9ac82a7915de2faced58401f77fc0707a31b2754
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd a nullness annotation 49/82749/1
Robert Varga [Wed, 26 Jun 2019 15:57:16 +0000 (17:57 +0200)]
Add a nullness annotation

Effective mountpoint statement has to have a non-null path,
this adds the annotation to express that.

Change-Id: I85d3ee89b2334cb39351811d733d7aa02a59e8bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd explicit serialization format 54/82654/9
Robert Varga [Fri, 21 Jun 2019 23:47:42 +0000 (01:47 +0200)]
Add explicit serialization format

Having control over the entries that go in and out we get to choose
what sorts of maps are we going to use.

Change-Id: I7cb47c2452752ca046dbc0451c828ca3ba49193f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate off of deprecated NodeIdentifierWithPredicates methods 82/82682/1
Robert Varga [Mon, 24 Jun 2019 12:09:05 +0000 (14:09 +0200)]
Migrate off of deprecated NodeIdentifierWithPredicates methods

This migrates to replacement methods, eliminating warnings.

Change-Id: Iaa15e588f20b6cdc1f6fc63b45d6dacb116fa67d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate off of deprecated NodeIdentifierWithPredicates methods 77/82677/1
Robert Varga [Mon, 24 Jun 2019 08:45:45 +0000 (10:45 +0200)]
Migrate off of deprecated NodeIdentifierWithPredicates methods

This migrates to replacement methods, eliminating warnings.

Change-Id: I2862aec39ebfbcdc1f762e2868f6b84ebe2c72a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd SharedSingletonMap.getEntry() 05/82605/1
Robert Varga [Thu, 20 Jun 2019 14:19:09 +0000 (16:19 +0200)]
Add SharedSingletonMap.getEntry()

This adds access to the single entry being present in the map,
without the need to encapsulate it via entrySet().

Change-Id: Ifbb101285bb4825237fceb37db025334b1307c0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeduplicate concurrent SchemaContext loads 90/82490/3
Robert Varga [Tue, 11 Jun 2019 16:53:18 +0000 (18:53 +0200)]
Deduplicate concurrent SchemaContext loads

In case we are running concurrent SchemaContext computation, if
the result is not cached we will have multiple results. These
need to be reconciled with the cache, so that those results will
be squashed into a single instance.

JIRA: YANGTOOLS-1004
Change-Id: I82df2b32a534d0acc803548579fb8ad138853c68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 3.0.3-SNAPSHOT (again) 02/82502/1
Robert Varga [Wed, 12 Jun 2019 09:42:32 +0000 (11:42 +0200)]
Bump versions to 3.0.3-SNAPSHOT (again)

This starts the next development iteration.

Change-Id: I35551bbd2ea36e65e36ca88eaec9be966a643d85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix version mis-bump 01/82501/1
Robert Varga [Wed, 12 Jun 2019 09:41:35 +0000 (11:41 +0200)]
Fix version mis-bump

These instances were not properly bumped, fix that.

Change-Id: Ia057bd0823b16198cf184f20b22f571a8cb5aeb3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Bump versions to 3.0.3-SNAPSHOT" 00/82500/1
Robert Varga [Wed, 12 Jun 2019 09:41:13 +0000 (11:41 +0200)]
Revert "Bump versions to 3.0.3-SNAPSHOT"

This reverts commit 7ec04bfab1274091de745f29f2c4ee00e550ebe4.

Change-Id: I4fc92a77262194e3416db51c552990b895e6836c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 3.0.3-SNAPSHOT 94/82494/1
Robert Varga [Wed, 12 Jun 2019 00:43:14 +0000 (02:43 +0200)]
Bump versions to 3.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I6a454b23fd831606a64beec8e1d6b1370e7c3913
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRecognize AnyDataSchemaNode 83/82483/2
Robert Varga [Tue, 11 Jun 2019 09:18:45 +0000 (11:18 +0200)]
Recognize AnyDataSchemaNode

CompositeNodeDataWithSchema needs to recognize anydata nodes and
not fall back to a generic.

Change-Id: Id545fde1f4911754ceb1a8a63c8519125206afba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEmit end of anyxml data 50/82450/3
Robert Varga [Fri, 7 Jun 2019 14:33:56 +0000 (16:33 +0200)]
Emit end of anyxml data

Since we are emitting the start of anyxml node, and we have fixed
the thinko in 36326770d563bfe2a5332738b02e66d6132574a9, we also
need to emit its end.

JIRA: YANGTOOLS-1002
Change-Id: I5e8497cd33ad4be270d5e9b5366e39c04e017486
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix DOMSourceAnydata normalization 54/82354/9
PeterSuna [Fri, 31 May 2019 12:53:49 +0000 (14:53 +0200)]
Fix DOMSourceAnydata normalization

Internal DOMSource contains nested a top-level element, which acts
as a container for internal nodes. We need to skip this element
when we are attempting to parse the content, otherwise we will end
up with incorrect schema/data nesting.

Change-Id: Iaa2c799a2437dadf9ee2735092e1346d1f275d55
Signed-off-by: PeterSuna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEnd anydata element 48/82448/5
Robert Varga [Fri, 7 Jun 2019 13:41:54 +0000 (15:41 +0200)]
End anydata element

Since startAnydata() is opening an element we must make sure
we close it again. This flushes out a thinko around tracking
endElement depth, which must be decremented before check.

JIRA: YANGTOOLS-1002
Change-Id: I8f0b31eb9f165d384c1e680e5fc19763e9f67fbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFlush element when streaming NormalizedAnydata 47/82447/2
Robert Varga [Fri, 7 Jun 2019 13:39:08 +0000 (15:39 +0200)]
Flush element when streaming NormalizedAnydata

We must make sure parent StreamWriterFacade emits any started
open elements to the writer, otherwise can end up with weird
XML, which suddenly emits a self-closing element.

Issue a flushElement() before writing the data.

JIRA: YANGTOOLS-1002
Change-Id: Ib3933ddad22e490782a144306b8df10a033d74ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove dead code from StreamWriterFacade 46/82446/1
Robert Varga [Fri, 7 Jun 2019 13:29:08 +0000 (15:29 +0200)]
Remove dead code from StreamWriterFacade

This code was leftover from the opaque anydata implementation
and does not serve any purpose, hence kill it.

Change-Id: I58c1ebcfc4677cfdeec85770fcaa1024f18859e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd sibling serialization test 41/82441/2
Robert Varga [Fri, 7 Jun 2019 09:37:47 +0000 (11:37 +0200)]
Add sibling serialization test

This adds the model update and a simple test for sibling
serialization boundaries.

Change-Id: I0f67626f56d86bbbfd02486c376b66efabd3b81c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake ReusableImmutableNormalizedNodeStreamWriter reuse leaf builders 22/82422/2
Robert Varga [Thu, 6 Jun 2019 13:42:50 +0000 (15:42 +0200)]
Make ReusableImmutableNormalizedNodeStreamWriter reuse leaf builders

LeafSetEntryNode and LeafNode cannot have children, hence we can
easily reuse their instances.

Change-Id: Ic347a3e89648d6a67ca81dc65c6c320647b078b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose ReusableStreamReceiver 16/82416/4
Robert Varga [Thu, 6 Jun 2019 10:23:49 +0000 (12:23 +0200)]
Expose ReusableStreamReceiver

ReusableImmutableNormalizedNodeStreamWriter has two properties
which are not inherently tied to it being bound to immutable nodes:
- it can have its state reset
- it exposes a NormalizedNode result of a streaming session

Expose these traits as ReusableStreamReceiver, so that users
can use the API rather than the implementation.

Change-Id: I841211c89520c4a5c67d436c8a49d719e8f7f1b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDeprecate NodeIdentifierWithPredicates.getKeyValues() 47/82347/4
Robert Varga [Thu, 30 May 2019 23:42:54 +0000 (01:42 +0200)]
Deprecate NodeIdentifierWithPredicates.getKeyValues()

Map vieew is not necessary, as it leaks hashCode()/equals(),
preventing us from optimizing the layout of the structure.

This patch introduces alternative method for accessing predicates
without relying on Map, while retaining the possibility of getting
a Map view.

Change-Id: Ieb2c8794056fe481d4905862e30fe0601c2ab152
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoRemove AbstractPathArgument.hashCodeGuard 45/82345/2
Robert Varga [Thu, 30 May 2019 21:42:18 +0000 (23:42 +0200)]
Remove AbstractPathArgument.hashCodeGuard

This patch removes the explicit boolean guard around hashCode,
which guarantees disambiguation between 0 and uncomputed.

The single byte expended here has an actual cost of 7 bytes,
as it is forcing all subclasses to have a padding of 7 with
default settings in most environments.

This changes instance sizes as follows (32bit/64bit):

NodeIdentifier                24(3)/32(7) -> 24(4)/24(0)
NodeIdentifierWithPredicates  32(7)/40(7) -> 24(0)/32(0)
NodeWithValue                 32(7)/40(7) -> 24(0)/32(0)

Most notable here is the reduction of
NodeIdentifierWithPredicates, which cannot reasonably be
shared, as it depends on user data.

Change-Id: Ia444cf708f5209cb22f2661e48f2f2ffaf150281
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoBump versions to 3.0.2-SNAPSHOT 58/82258/6
Robert Varga [Mon, 27 May 2019 19:12:02 +0000 (21:12 +0200)]
Bump versions to 3.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: I74d4e84d0c9a2c9f2cf8c0cd131175280b71e2bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCleanup testing AugmentationIdentifier instantiations 41/82341/2
Robert Varga [Thu, 30 May 2019 17:06:07 +0000 (19:06 +0200)]
Cleanup testing AugmentationIdentifier instantiations

Using ImmutableList.of() is slightly faster, use that.

Change-Id: Ia45d18dc840e8985a1037e7235c01da5f873d870
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd AugmentationIdentifier.create() methods 40/82340/2
Robert Varga [Thu, 30 May 2019 17:03:24 +0000 (19:03 +0200)]
Add AugmentationIdentifier.create() methods

This adds two flavors of AugmentationIdentifier.create(), which
use a global weak cache for normalizing AugmentationIdentifiers.

The cache is carefully populated, i.e. it makes a point of using
immutable keys only.

JIRA: YANGTOOLS-998
Change-Id: I1e7d65b995e50773ec2260c9fb01bc1c6bbaafbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDeprecate NodeIdentifierWithPredicates constructors 39/82339/2
Robert Varga [Thu, 30 May 2019 16:44:15 +0000 (18:44 +0200)]
Deprecate NodeIdentifierWithPredicates constructors

Provide static factory methods for instantiating
NodeIdentifierWithPredicates, so that we can deprecate public
constructors, allowing us to evolve the class itself.

JIRA: CONTROLLER-1000
Change-Id: I05916b45c2c94caab717ae96b699ca2b264cc2da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoCreate unit test for anydata. 82/82282/10
PeterSuna [Tue, 28 May 2019 15:50:53 +0000 (17:50 +0200)]
Create unit test for anydata.

-Add test for Serialization (Fail)
-Add test for Deserialization (Pass)

Change-Id: Ic7de2373f1a4effbedce35aded6b6223dac3c9ab
Signed-off-by: PeterSuna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd ImmutableMetadataNormalizedAnydata.ofOptional() 33/82333/1
Robert Varga [Thu, 30 May 2019 10:09:06 +0000 (12:09 +0200)]
Add ImmutableMetadataNormalizedAnydata.ofOptional()

The only user of ImmutableMetadataNormalizedAnydata is using it
only optionally, based on metadata presence. This indicates a static
factory method is usable more than the plain constructor.

Change-Id: I0379fd89acfcf6d12264da9cbb041da772449988
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoAdd missing @NonNull annotations 32/82332/1
Robert Varga [Thu, 30 May 2019 10:08:19 +0000 (12:08 +0200)]
Add missing @NonNull annotations

Static factories are missing these annotations, making downstreams'
life harder.

Change-Id: I8a8ccaf19e32b01efa5037a09dcee4cab078f72d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 years agoDocument and fix DOMSourceAnydata streaming 21/82321/2
Robert Varga [Wed, 29 May 2019 23:50:00 +0000 (01:50 +0200)]
Document and fix DOMSourceAnydata streaming

W3C DOM requires each document to have a single root element, and
we are using the anydata element as the container. This is required
because anydata (and anyxml) can hold a list, in which case we would
be faced with a document which has multiple root elements.

Document this fact and adjust streaming interfaces/handling to take
this into account.

JIRA: YANGTOOLS-993
Change-Id: Ifcc7777d60359c942b8f033307ab63295525ca1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>