yangtools.git
9 years agoBug 2202: DerivableSchemaNode API incorrect Javadoc 06/12006/1
Martin Ciglan [Thu, 16 Oct 2014 12:27:17 +0000 (14:27 +0200)]
Bug 2202: DerivableSchemaNode API incorrect Javadoc

Change-Id: If0c9a986dbd01ed1f51a15275ce78dca4b10ea30
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
9 years agoResolved some sonar issues: Peformance 77/11977/1
Ladislav Borak [Wed, 15 Oct 2014 12:55:56 +0000 (14:55 +0200)]
Resolved some sonar issues: Peformance

- inefficient keySet iterator were changed to entrySet iterator

Change-Id: I61da29807665a804593a435879ad24b3676fc0b7
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoRework version artifact version tracking 45/11845/13
Robert Varga [Wed, 8 Oct 2014 22:26:58 +0000 (00:26 +0200)]
Rework version artifact version tracking

This patch reworks the way we track our internal artifacts by moving the
definitions from the aprent pom into a dedicated yangtools-artifacts
versions.

This artifact's dependencyManagement section is then imported into the
parent. This may look unnecessary, but it allows our downstream users to
import the same file and have the versioning work.

An interesting side-effect of that is that the properties cannot be
relied on carrying versions of artifacts and then be picked up by the
features.xml file.

This patch fixes that by introducing a script into the build cycle,
which looks at a template features.xml and resolves the versions as
currently visible in the dependency tree of the artifact.

Change-Id: I193586f777478c12520358b9909cfb61e40d14b4
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoRework feature generation 11/11911/4
Robert Varga [Sun, 12 Oct 2014 08:26:20 +0000 (10:26 +0200)]
Rework feature generation

This patch takes advantage of the features-builder, laying the
preparation work for switching artifact tracking.

Change-Id: I8c325ad4b26ca0b9839edacb919134ea43db46fe
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoIntroduce features-builder 10/11910/3
Robert Varga [Sun, 12 Oct 2014 08:32:04 +0000 (10:32 +0200)]
Introduce features-builder

The planned rework of version handling requires the features artifacts
to stop relying on maven properties for versions. This patch introduces
a base pom (e.g. suitable for being a parent), which provides the
versioning functionality based of dependency tree.

The user will typically use features-builder as their parent pom,
activate the plugins mentioned in pluginManagement and provide a
template features file, where the required version is marked by a
{{VERSION}} placeholder. The location of this template is hard-coded to
src/features, but the file name is controlled by features.file property
(features.xml) by default.

The build process' plugin wiring will take care of processing the
template and looking through the artifact's dependency tree. If a
required version is not found, the build is forced to fail.

Change-Id: If3252ffe8ca2b099ffd10c1cc37b47b3a1ac7698
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRelease: bump odlparent dependency to 1.5.0-SNAPSHOT 22/11922/2
Robert Varga [Mon, 13 Oct 2014 09:20:35 +0000 (11:20 +0200)]
Release: bump odlparent dependency to 1.5.0-SNAPSHOT

Change-Id: I78de18724d587fb1b9b1873f3a59878e79722f69
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Remove duplicate declarations"
Tony Tkacik [Mon, 13 Oct 2014 15:05:34 +0000 (15:05 +0000)]
Merge "Remove duplicate declarations"

9 years agoMerge "Fixup more javadocs"
Tony Tkacik [Mon, 13 Oct 2014 12:47:38 +0000 (12:47 +0000)]
Merge "Fixup more javadocs"

9 years agoMerge "Deactivate xtend-maven-plugin"
Tony Tkacik [Mon, 13 Oct 2014 12:47:13 +0000 (12:47 +0000)]
Merge "Deactivate xtend-maven-plugin"

9 years agoMerge "Fix link"
Tony Tkacik [Mon, 13 Oct 2014 12:46:42 +0000 (12:46 +0000)]
Merge "Fix link"

9 years agoMerge "Bug 584: GeneratedTOBuilder test coverage increase"
Robert Varga [Mon, 13 Oct 2014 09:05:34 +0000 (09:05 +0000)]
Merge "Bug 584: GeneratedTOBuilder test coverage increase"

9 years agoFix link 13/11913/2
Robert Varga [Sun, 12 Oct 2014 23:30:57 +0000 (01:30 +0200)]
Fix link

Change-Id: Id81fbcde22b0afa52630b7031daf45d7e8117316
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoFixup more javadocs 20/11920/1
Robert Varga [Mon, 13 Oct 2014 08:53:30 +0000 (10:53 +0200)]
Fixup more javadocs

Fixes invalid links and @see tags.

Change-Id: Iec791aceaf7553130d101a817103b0c61310db28
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 584: MethodParameterImpl test coverage increase 81/11881/2
Martin Ciglan [Fri, 10 Oct 2014 12:29:34 +0000 (14:29 +0200)]
Bug 584: MethodParameterImpl test coverage increase

Change-Id: I63ecbdb35266f4549ebc51c49d9a8009f8b57dcb
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
9 years agoBug 584: GeneratedTOBuilder test coverage increase 75/11875/2
Martin Ciglan [Fri, 10 Oct 2014 08:45:07 +0000 (10:45 +0200)]
Bug 584: GeneratedTOBuilder test coverage increase

Change-Id: Ifb6d377a6d1911f2f12bb178efdea8809916c26a
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
9 years agoDeactivate xtend-maven-plugin 64/11864/1
Robert Varga [Fri, 10 Oct 2014 04:04:56 +0000 (06:04 +0200)]
Deactivate xtend-maven-plugin

We have only three artifacts which use xtend, so there is no reason to
mention it in the build section. Move the configuration into
pluginManagement, speeding up the build.

Change-Id: Iac5e6e93a723b5f7e8beeb7dfa0d63d316d2f6e0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoRemove duplicate declarations 44/11844/2
Robert Varga [Wed, 8 Oct 2014 22:57:11 +0000 (00:57 +0200)]
Remove duplicate declarations

Change-Id: I7686eddf2a1135e1dd943d6e5e3965dc4ec74343
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "Bug 2156: Unsupported augment target"
Tony Tkacik [Thu, 9 Oct 2014 16:12:36 +0000 (16:12 +0000)]
Merge "Bug 2156: Unsupported augment target"

9 years agoMerge "BUG-2159: fix sort() conflict"
Tony Tkacik [Thu, 9 Oct 2014 16:07:24 +0000 (16:07 +0000)]
Merge "BUG-2159: fix sort() conflict"

9 years agoMerge "BUG-2159: compilation failure with generics"
Tony Tkacik [Thu, 9 Oct 2014 16:07:03 +0000 (16:07 +0000)]
Merge "BUG-2159: compilation failure with generics"

9 years agoBUG-2159: fix sort() conflict 19/11819/1
Robert Varga [Wed, 8 Oct 2014 16:21:01 +0000 (18:21 +0200)]
BUG-2159: fix sort() conflict

Java 8 introduces a default method into java.util.List, which has a
different signature (and semantics) than the xtend extension. This patch
changes the code to not use the syntactic sugar while retaining the use
of the extension.

Change-Id: I4685937ab4da64cfe384db9aad31859ca51e97d7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-2159: compilation failure with generics 18/11818/1
Robert Varga [Wed, 8 Oct 2014 16:12:29 +0000 (18:12 +0200)]
BUG-2159: compilation failure with generics

http://mail.openjdk.java.net/pipermail/compiler-dev/2013-October/007726.html
seems to be describing why this patch is needed.

Change-Id: Ib23f51e0f319327c3c6a04ff86fb4c89b745e4ae
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-2159: bump jacoco version 17/11817/1
Robert Varga [Wed, 8 Oct 2014 16:11:34 +0000 (18:11 +0200)]
BUG-2159: bump jacoco version

0.6.2 does not work with Java 8. Until
https://git.opendaylight.org/gerrit/11816 is merged, this fixes the
problem locally.

Change-Id: I3970e0e176190fb6180f0ea266bd10433c2d5afa
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 2156: Unsupported augment target 02/11802/2
pkajsa [Tue, 7 Oct 2014 14:56:59 +0000 (16:56 +0200)]
Bug 2156: Unsupported augment target

Some yang models contain augmentations into unsupported target
(e.g. node in body of extension). This causes maven build failure
(by generation of DTO), even though parsing such models is successful.

Change-Id: I8efff696aa2d3b95c5168ba8e42d49a93d1dff74
Signed-off-by: pkajsa <pkajsa@cisco.com>
9 years agoBUG-2154 Remove duplicity check for unknown nodes 63/11763/1
Maros Marsalek [Mon, 6 Oct 2014 17:41:39 +0000 (19:41 +0200)]
BUG-2154 Remove duplicity check for unknown nodes

Change-Id: I4e40242f4cb02868e2b1fa9b3d5dd4322a3f8238
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoAdded Test suite for testing of TypeProviderImpl. 82/11582/1
Lukas Sedlak [Fri, 5 Sep 2014 08:58:14 +0000 (10:58 +0200)]
Added Test suite for testing of TypeProviderImpl.

Removed commented out blocks of code from TypeProviderImpl.
Fixed invalid typecast in getTypeDefaultConstruction(LeafSchemaNode, defaultValue) in else branch of BitsTypeDefinition processing. The parent value is of type ModuleImpl which cannot
be cast to SchemaNode as originaly was. Instead of we can extract QName direclty from parent value -> no need to typecast at all.

Fixed leafrefToDef method in TypeProviderImpl. This method will now process defaultValue from method parameter instead of parent node. Method leafrefToDef has been called only via getTypeDefaultConstruction(LeafSchemaNode, defaultValue) method where default value has been added implicitly. In case that user calls getTypeDefaultConstruction for leafref schema node
and specifies defaultValue as parameter and not in yang model the method will throw exception. Now behaviour of leafrefToDef depends only and only on parameter passed in getTypeDefaultConstruction.

Created TypeProviderTest which contains whole test suite for testing of TypeProviderImpl class.
TestIntegerTypeDefinition is mock implementation of IntegerTypeDefinition in order to testing null references returned by TypeDefinition object.

TypeProviderModel contains methods for provisiononing of YANG test models from test/resources folder.
Created Mock implementations of LeafrefTypeWithNullToStringInXpath, LeafrefTypeWithNullXpath, TestIntegerTypeDefinition and TestLeafSchemaNode designated
to increase branch coverage in tests and provide fail scenarios.

Change-Id: I5599c9b1e8f02a8553fab27c1771e32f88c38bc6
Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
9 years agoMerge "Bug 1848: Make sure that XmlStreamUtils preserve list key order."
Tony Tkacik [Thu, 25 Sep 2014 08:50:35 +0000 (08:50 +0000)]
Merge "Bug 1848: Make sure that XmlStreamUtils preserve list key order."

9 years agoMerge "Adding .DS_Store to the .gitignore"
Robert Varga [Thu, 25 Sep 2014 08:34:28 +0000 (08:34 +0000)]
Merge "Adding .DS_Store to the .gitignore"

9 years agoBug 1423 - Yangtools parser allows 2 cases with same child elements 86/9386/11
Ladislav Borak [Tue, 12 Aug 2014 09:36:09 +0000 (11:36 +0200)]
Bug 1423 - Yangtools parser allows 2 cases with same child elements

- added check in YangParserImpl if two choice cases childs are same
- rework printSchemaNodeInfo() in GeneratorImpl.xtend, where was
  problem after generating java file with uncompatible types Set<TypeDefinition<? extends Object>>
  instead of Set<TypeDefinition<?>>, problem was fixed adding another
  variable with correct type.

Change-Id: I0a612ea9143c6f29ffe3a8ceef7e703136157641
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBug 1906: Fixed bug in Binding leafref to union codec 20/11320/2
Tony Tkacik [Wed, 17 Sep 2014 12:45:33 +0000 (14:45 +0200)]
Bug 1906: Fixed bug in Binding leafref to union codec

In models, where leafref was used to reference type, incorrect
codec (EncapsulatedValueCodec) was used for all cases with
derived type instead of actual codec. EncapsulatedValueCodec
covered most cases except Union and Bits.

Added special handling for leafref, where type definition
for referenced leaf is fetched and codec is used based
on that notion.

Change-Id: Id790554e1e84bcf01179add4f5327a4e7380ebe1
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit 697925b94246e725412b88151ec097c812a65b39)
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoAdding .DS_Store to the .gitignore 88/11388/1
Colin Dixon [Fri, 19 Sep 2014 22:02:54 +0000 (17:02 -0500)]
Adding .DS_Store to the .gitignore

Change-Id: I95d2664f4853bfa5d95544a4823bbf2e5887b87a
Signed-off-by: Colin Dixon <colin@colindixon.com>
9 years agoMerge "BUG-1849 Check for duplicate required sources and exclude all redundant"
Tony Tkacik [Thu, 18 Sep 2014 12:55:00 +0000 (12:55 +0000)]
Merge "BUG-1849 Check for duplicate required sources and exclude all redundant"

9 years agoBump versions for Lithium 82/11282/1
Robert Varga [Wed, 17 Sep 2014 11:46:44 +0000 (13:46 +0200)]
Bump versions for Lithium

Bumps everything to 0.7.0, models get a .7 suffix.

Change-Id: I63d2f6b3782769043b8efa73ef64abe34e57b97a
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1849 Check for duplicate required sources and exclude all redundant 43/11243/2
Maros Marsalek [Tue, 16 Sep 2014 14:35:13 +0000 (16:35 +0200)]
BUG-1849 Check for duplicate required sources and exclude all redundant

Also check for source identifier mismatch

Change-Id: I32fc76a56fd7adb564b7b9c9fc2679c5f36069cb
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
9 years agoBug 1848: Make sure that XmlStreamUtils preserve list key order. 27/11227/1
Tony Tkacik [Tue, 16 Sep 2014 10:28:58 +0000 (12:28 +0200)]
Bug 1848: Make sure that XmlStreamUtils preserve list key order.

Change-Id: I3d7a91c9ae4ec74b1c7130c4af504af73a2f4507
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "Bug 576 Fixes of critical issues for YT components"
Tony Tkacik [Mon, 15 Sep 2014 14:52:52 +0000 (14:52 +0000)]
Merge "Bug 576 Fixes of critical issues for YT components"

9 years agoBUG-650: make ReadOnlyTrieMap concurrent 92/11192/1
Robert Varga [Mon, 15 Sep 2014 11:29:08 +0000 (13:29 +0200)]
BUG-650: make ReadOnlyTrieMap concurrent

ReadOnlyTrieMap.delegate() guarded instantiation with a synchronized
block. This is not strictly necessary as readOnly is already volatile.
We can take snapshots concurrently and then perform a simple CAS to see
if we raced with the other thread.

Change-Id: I4e957627a6d7b10bb10fb92a8e210c1d1af22b14
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: optimize MapAdaptor a tiny bit 91/11191/1
Robert Varga [Mon, 15 Sep 2014 11:19:38 +0000 (13:19 +0200)]
BUG-650: optimize MapAdaptor a tiny bit

In this context we have already checked the map size, so there is no
need to perform the hasNext() check implied by
Iterables.getOnlyElement().

Change-Id: I12d26053a1bf397b3a026e76c3d07861fd29789c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 576 Fixes of critical issues for YT components 80/10780/4
Lukas Sedlak [Thu, 4 Sep 2014 14:38:23 +0000 (16:38 +0200)]
Bug 576 Fixes of critical issues for YT components

This is fix for https://bugs.opendaylight.org/show_bug.cgi?id=576
Added Nonnull annotations and preconditions checks for annonymous apply methods.
Fixed never reachable if statement in writeValue(final XMLStreamWriter writer, final @Nonnull Node<?> data, final SchemaNode schema) in XmlStreamUtils
since instanceof is doing already null check.
Removed empty if statement in NormalizedNodeContainerModificationStrategy in verifyStructure method.
Removed dead code from in PerRepoTestRunner runnersFromFeatures method.

Change-Id: Icec2a30149a17d8b76497d95ac0054297369e985
Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
9 years agoMerge "Bug 1512 - generated builder java file for a leaf containing a union"
Tony Tkacik [Mon, 15 Sep 2014 10:45:46 +0000 (10:45 +0000)]
Merge "Bug 1512 - generated builder java file for a leaf containing a union"

9 years agoMerge "BUG-1431: make sure (Yang)InstanceIdentifier is Serializable"
Tony Tkacik [Mon, 15 Sep 2014 10:09:50 +0000 (10:09 +0000)]
Merge "BUG-1431: make sure (Yang)InstanceIdentifier is Serializable"

9 years agoMerge "yangtools cannot release, so fixing it"
Robert Varga [Mon, 15 Sep 2014 10:04:56 +0000 (10:04 +0000)]
Merge "yangtools cannot release, so fixing it"

9 years agoMerge "Bug 1869: Fixed binding-data-codec to work with empty type"
Robert Varga [Mon, 15 Sep 2014 09:47:38 +0000 (09:47 +0000)]
Merge "Bug 1869: Fixed binding-data-codec to work with empty type"

9 years agoBug 1512 - generated builder java file for a leaf containing a union 52/9952/6
Ladislav Borak [Fri, 15 Aug 2014 07:41:59 +0000 (09:41 +0200)]
Bug 1512 - generated builder java file for a leaf containing a union

- added clarification for location of builder class for union types
  into javadoc
- remove redundant check in YangTempla.writeRpcInput() and
  YangTemplate.writeRpcOutput() methods
- added return type for GeneratorImpl.printAugmentedNode() method
  (problem to infer return type in recursivecalled method)
- added local set of typedefinitions into
  GeneratorImpl.printSchemaNodeInfo() to to remove error in geterated java
  file

Change-Id: If4ad960a998254868a0347bb836c79aac7dd19d8
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoMerge "Added Nonnull annotation for get operation"
Robert Varga [Mon, 15 Sep 2014 09:39:03 +0000 (09:39 +0000)]
Merge "Added Nonnull annotation for get operation"

9 years agoyangtools cannot release, so fixing it 97/10897/2
Giovanni Meo [Fri, 5 Sep 2014 15:50:19 +0000 (17:50 +0200)]
yangtools cannot release, so fixing it

- yangtools cannot release because the projetc.version dependency in
  dependency management keep changing with the project that includes it,
  so fixing it
- restconf dependency and other version should not be duplicated in
  multiple poms
- the version property in the common/parent/pom.xml file need to be
  the authoritative versions else the features file cannot relay on it

Change-Id: Ic99c1f3818efbdf6ff9c514d4c842164d4228fc4
Signed-off-by: Giovanni Meo <gmeo@cisco.com>
9 years agoMerge "very basic tests for yang-binding-util"
Robert Varga [Mon, 15 Sep 2014 09:36:01 +0000 (09:36 +0000)]
Merge "very basic tests for yang-binding-util"

9 years agoBUG-1431: make sure (Yang)InstanceIdentifier is Serializable 34/11134/3
Robert Varga [Sat, 13 Sep 2014 14:25:51 +0000 (16:25 +0200)]
BUG-1431: make sure (Yang)InstanceIdentifier is Serializable

This works around the fact that an Iterable cannot be serialized by
forcing instantiation of the legacy path. The read side then just does
the opposite.

For InstanceIdentifier the situation is similar, except we perform the
writeout/read-in ourselves.

Bumps the serialization format for InstanceIdentifier and
YangInstanceIdentifier to 2 and 3 respectively.

Change-Id: I668e2aeebde20b99cfe3b41594b3925697295d05
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-650: use weakCompareAndSwap()"
Tony Tkacik [Mon, 15 Sep 2014 09:22:45 +0000 (09:22 +0000)]
Merge "BUG-650: use weakCompareAndSwap()"

9 years agoBug 1869: Fixed binding-data-codec to work with empty type 85/11185/2
Tony Tkacik [Mon, 15 Sep 2014 08:39:43 +0000 (10:39 +0200)]
Bug 1869: Fixed binding-data-codec to work with empty type

Empty type is special case, which does not contain value,
but has only presence characteristic and in Binding Specification v1
it was converted to boolean (true = present, false or null not present)
but new codecs did not have that special handling for empty type
which caused some models to fail.

Fixed places affected by this bug and added test case which now
explicitly tests empty type support.

Change-Id: Idec541dc9da987cebcd46ee65d24c17b7cf9a567
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-1813: rework the interface to allow multiple implementations"
Tony Tkacik [Mon, 15 Sep 2014 09:17:32 +0000 (09:17 +0000)]
Merge "BUG-1813: rework the interface to allow multiple implementations"

9 years agoBUG-1813: rework the interface to allow multiple implementations 66/11066/8
Robert Varga [Thu, 11 Sep 2014 18:12:07 +0000 (20:12 +0200)]
BUG-1813: rework the interface to allow multiple implementations

This introduces two largely independent implementations. Unfortunately
we cannot make DurationStatsTracker abstract, simply because users are
relying on the implicit empty constructor. We create
DurationStatisticsTracker to take that role and introduce two distinct
static factory methods to create a particular instance.

Change-Id: I0e4c6688e0d21066ae857647ba642b65073e8543
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-650: Use lazy set in YangInstanceIdentifier/SchemaPath caches 28/11128/2
Robert Varga [Fri, 12 Sep 2014 22:32:04 +0000 (00:32 +0200)]
BUG-650: Use lazy set in YangInstanceIdentifier/SchemaPath caches

These cached values are just derived from immutable state, so we do not
need to force them to be visible by other threads -- they can calculate
them on their own and at some point one of the versions wins.

Change-Id: I3ecf272d151c693ef3adc519c33a065aa9dba94b
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-650: improve modification sealing performance"
Tony Tkacik [Sat, 13 Sep 2014 15:06:33 +0000 (15:06 +0000)]
Merge "BUG-650: improve modification sealing performance"

9 years agoMerge "BUG-1851: fix potential visibility problem"
Tony Tkacik [Sat, 13 Sep 2014 15:05:52 +0000 (15:05 +0000)]
Merge "BUG-1851: fix potential visibility problem"

9 years agoBUG-650: improve modification sealing performance 26/11126/2
Robert Varga [Fri, 12 Sep 2014 21:47:17 +0000 (23:47 +0200)]
BUG-650: improve modification sealing performance

The seal operation is on a fast path, so performing synchronization is
not really advised. Downgrade synchronized blocks to volatile
modifications, which have better effects on the optimizer. We introduce
a SynchronizedDataTreeModification which the users can use when they
require a serialized thread-safe access.

Change-Id: Ieffcf1f5fef4d4df32fcdc30f992672d79dcf7bf
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1813: fix DurationStatsTracker performance 61/11061/6
Robert Varga [Thu, 11 Sep 2014 14:25:58 +0000 (16:25 +0200)]
BUG-1813: fix DurationStatsTracker performance

This fixes the performance issues without affecting the behaviour in the
contended case. This lowers the overhead by moving to an LongAdder,
splitting out the duration/timestamp structure and moving the division
into the read path.

A follow-up patch will rework the code organization to allow for two
different implementations, where this one is useful for highly-contented
deployments. The other implementation will use synchronized block and be
useful for things which are not likely to be contended.

Change-Id: Ic8a1d5df9d1d64460670723bac7e644733237ef7
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1851: fix potential visibility problem 25/11125/1
Robert Varga [Fri, 12 Sep 2014 22:17:13 +0000 (00:17 +0200)]
BUG-1851: fix potential visibility problem

formattedRevision is a normal field, which may be reordered. Make it
volatile and initialize it as needed. Format operation is simple enough
so we do not require a full synchronization, worst that can happen is
that two racing threads will format it twice.

Change-Id: I52bf2f22cccd9dbb115858dd98f08bc63c3001b6
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1818: Do not relly on xml.isNameSpaceRepairing 09/11109/3
Tony Tkacik [Fri, 12 Sep 2014 14:46:16 +0000 (16:46 +0200)]
Bug 1818: Do not relly on xml.isNameSpaceRepairing

Last code path which indirectly relied on name space
repairing was write out of writeStartElement.

This was converted to look into parent namespace
and writeStartElement and writeDefaultNamespace
when namespace change.

Change-Id: I511436e9eab98e0c35eb100dfe0627cd5edd53b6
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoBug 1761: Fixed missing module name prefix for augmentations. 43/11043/6
Tony Tkacik [Thu, 11 Sep 2014 11:53:45 +0000 (13:53 +0200)]
Bug 1761: Fixed missing module name prefix for augmentations.

Migration to more state tracking introduced regression
where module name prefix was left out for containers
and lists which were augmented, which was inconsistent
with case augmentations, which were serialized properly.

Draft draft-lhotka-netmod-yang-json-02 allows previous
behaviour (without module names for augmented items),
but that may cause changing textual representation
after conflicting augmentation is introduced,
so we opted to always report module name for top level
items of augmentation, which is also allowed from spec.

Change-Id: Icbb1b2aeed1a154a06e7f90f0dacc199a7df6bcc
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1770: emit proper namespaces"
Tony Tkacik [Fri, 12 Sep 2014 14:59:13 +0000 (14:59 +0000)]
Merge "BUG-1770: emit proper namespaces"

9 years agoMerge "Bug 1817 - Add in ietf-restonf to the yangtools-models feature."
Tony Tkacik [Fri, 12 Sep 2014 13:58:03 +0000 (13:58 +0000)]
Merge "Bug 1817 - Add in ietf-restonf to the yangtools-models feature."

9 years agoBUG-1770: emit proper namespaces 46/10946/5
Robert Varga [Tue, 9 Sep 2014 13:47:11 +0000 (15:47 +0200)]
BUG-1770: emit proper namespaces

We add calls to setPrefix() and only use the calls with explicit
namespace prefix to emit elements.

Change-Id: Ib603567b3080388c6016ece5e34cac6a723ef8c0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-865: migrate tests to use BindingGeneratorImpl(boolean)"
Tony Tkacik [Fri, 12 Sep 2014 11:11:13 +0000 (11:11 +0000)]
Merge "BUG-865: migrate tests to use BindingGeneratorImpl(boolean)"

9 years agoBUG-650: use weakCompareAndSwap() 69/11069/1
Robert Varga [Thu, 11 Sep 2014 20:55:39 +0000 (22:55 +0200)]
BUG-650: use weakCompareAndSwap()

The weak version is documented to be sufficient for statistics and does
not have happens-before effects.

Change-Id: Ic71ff280e8fe166ff4d9def7800be1ad8d1318cd
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1817 - Add in ietf-restonf to the yangtools-models feature. 63/11063/2
Devin Avery [Thu, 11 Sep 2014 17:53:06 +0000 (13:53 -0400)]
Bug 1817 - Add in ietf-restonf to the yangtools-models feature.

Change-Id: Ic50f22d678eadc3024abe9b1adeeb0308742e0d3
Signed-off-by: Devin Avery <devin.avery@brocade.com>
9 years agovery basic tests for yang-binding-util 42/11042/1
Peter Bandzi [Thu, 11 Sep 2014 12:04:41 +0000 (14:04 +0200)]
very basic tests for yang-binding-util

Change-Id: I7f5b646062dcb3619cd7912d37ef8574db56c5c6
Signed-off-by: Peter Bandzi <pbandzi@cisco.com>
9 years agoBUG 1440 - additional tests for data-codec-gson 99/10999/4
Jozef Gloncak [Tue, 9 Sep 2014 14:03:09 +0000 (16:03 +0200)]
BUG 1440 - additional tests for data-codec-gson

Tests of transformation:
- json stream -> normalized node structure -
  JsonStreamToNormalizedNodeTest
- normalized node structure -> json stream -
  NormalizedNodeToJsonStreamTest
were added

Change-Id: Ieff2e565e776e5193219b07f6e0ab98165402237
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1800: restore QNameModule sharing in parser"
Tony Tkacik [Thu, 11 Sep 2014 09:23:58 +0000 (09:23 +0000)]
Merge "BUG-1800: restore QNameModule sharing in parser"

9 years agoMerge "BUG-1794: use QName.cachedReference in static references"
Tony Tkacik [Thu, 11 Sep 2014 09:10:34 +0000 (09:10 +0000)]
Merge "BUG-1794: use QName.cachedReference in static references"

9 years agoMerge "BUG-1793: make sure we cache QNameModule"
Tony Tkacik [Thu, 11 Sep 2014 09:10:20 +0000 (09:10 +0000)]
Merge "BUG-1793: make sure we cache QNameModule"

9 years agoMerge "BUG-1766: escape outbound strings"
Tony Tkacik [Thu, 11 Sep 2014 09:06:19 +0000 (09:06 +0000)]
Merge "BUG-1766: escape outbound strings"

9 years agoMerge "BUG-1774: degrade log message"
Tony Tkacik [Thu, 11 Sep 2014 09:03:46 +0000 (09:03 +0000)]
Merge "BUG-1774: degrade log message"

9 years agoMerge "BUG 1440 - incorrect inserting of augment node"
Robert Varga [Thu, 11 Sep 2014 09:02:58 +0000 (09:02 +0000)]
Merge "BUG 1440 - incorrect inserting of augment node"

9 years agoMerge "BUG-1796: implement SourceIdentifier/PotentialSchemaSource caching"
Tony Tkacik [Thu, 11 Sep 2014 09:02:01 +0000 (09:02 +0000)]
Merge "BUG-1796: implement SourceIdentifier/PotentialSchemaSource caching"

9 years agoBUG-1774: degrade log message 27/11027/1
Robert Varga [Thu, 11 Sep 2014 08:07:52 +0000 (10:07 +0200)]
BUG-1774: degrade log message

Due to the way controller starts up, this message is expected.

Change-Id: I043907b6b2a0ebc22abef143fa76139df0ae313c
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1800: restore QNameModule sharing in parser 17/11017/1
Robert Varga [Wed, 10 Sep 2014 22:04:42 +0000 (00:04 +0200)]
BUG-1800: restore QNameModule sharing in parser

The refactor to eliminate use of QName.getPrefix() has lead to us not
sharing QNameModules anymore. Restore the capability to allow us to
operate at pea efficiency.

Change-Id: I9a23ca3396390eae0ffe9d954fb6fab3c7d1be55
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1719 - Formatting number in DurationStatsTracker 54/10854/4
Ladislav Borak [Fri, 5 Sep 2014 14:34:25 +0000 (16:34 +0200)]
Bug 1719 - Formatting number in DurationStatsTracker

- added format method which uses dot separator independently of default
  locale

Change-Id: Ia5447f56cab49ccdba7676516199d6bdaf84daf2
Signed-off-by: Ladislav Borak <lborak@cisco.com>
9 years agoBUG-1796: implement SourceIdentifier/PotentialSchemaSource caching 13/11013/1
Robert Varga [Wed, 10 Sep 2014 20:32:49 +0000 (22:32 +0200)]
BUG-1796: implement SourceIdentifier/PotentialSchemaSource caching

Adds a global cache for both object types and uses it in the
AbstractSchemaSourceRepository.

Change-Id: I87ff4e5379a6d0f3b39f56d8d2197571cfa9325d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-865: migrate tests to use BindingGeneratorImpl(boolean) 12/11012/1
Robert Varga [Wed, 10 Sep 2014 19:35:13 +0000 (21:35 +0200)]
BUG-865: migrate tests to use BindingGeneratorImpl(boolean)

The implicit constructor has been deprecated due to optional 'verbose'
descriptions functionality. This migrates some old users while retaining
the same functionality.

Change-Id: Ic856b273487472b5632319806650ec22e8843403
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1794: use QName.cachedReference in static references 11/11011/1
Robert Varga [Wed, 10 Sep 2014 19:31:26 +0000 (21:31 +0200)]
BUG-1794: use QName.cachedReference in static references

When we emit generated classes, we add a static final reference to a
QName created via the usual string factory method. This leads to
less-than-optimal string sharing, so we go through a cachedReference
initializer to make sure we get maximum resource sharing.

Change-Id: Id75286410be4883736164c504dd6cb8f9d26383a
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1793: make sure we cache QNameModule 10/11010/1
Robert Varga [Wed, 10 Sep 2014 18:50:37 +0000 (20:50 +0200)]
BUG-1793: make sure we cache QNameModule

This fixes QName.cachedReference() to lookup
QNameModule.cachedReference(), so we get maximum QNameModule sharing.

Change-Id: I7234a1da4429c36db2ccaeade1a0c423a94aa006
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge "BUG-1790: detect existing unmodifiableMap encapsulation"
Tony Tkacik [Wed, 10 Sep 2014 17:40:08 +0000 (17:40 +0000)]
Merge "BUG-1790: detect existing unmodifiableMap encapsulation"

9 years agoBUG-1787: cleanup AsyncNotifyingListenableFutureTask 85/10985/3
Robert Varga [Wed, 10 Sep 2014 10:42:06 +0000 (12:42 +0200)]
BUG-1787: cleanup AsyncNotifyingListenableFutureTask

First move the 'listenerExecutor != null' case into a subclass,
replacing the check with proper OOP override.

Second switch to using SettableBoolean, so we bypass the need to use
ThreadLocal.set/remove in fast path. Also introduce an explicit remove
method, which can be used to cleanup the thread-local state (which was
not previously possible).

Change-Id: I6e68cb1ca791c3ea721cb3379a1e8aa6724ab9b8
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1786: fixup DeadlockDetectingListeningExecutorService 84/10984/3
Robert Varga [Wed, 10 Sep 2014 09:55:02 +0000 (11:55 +0200)]
BUG-1786: fixup DeadlockDetectingListeningExecutorService

This patch deprecates the use of a Function where a Supplier should be
used.

Furthermore it shifts the balance of the ThreadLocal interaction by
retaining switching a Boolean to a SettableBoolean and flipping the
field contained within it rather than setting/removing the thread local
value itself. This can leave a single object attached to a thread --
which can be removed by a call to cleanStateForCurrentThread(), but
improves the performance of the fast path by utilizing the
ThreadLocal.get() fastpath when used with threadpools.

Change-Id: I2d8897138f8719187425e3aa8121bdc0f1ff39b2
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1784: use AtomicLongFieldUpdater 81/10981/2
Robert Varga [Wed, 10 Sep 2014 08:46:57 +0000 (10:46 +0200)]
BUG-1784: use AtomicLongFieldUpdater

Brings down the cost of an instance down by 16 bytes.

Change-Id: I3aa6cef9494ddb39c02219f16905c256c9b78de8
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1783: fix thread safety issues 80/10980/2
Robert Varga [Wed, 10 Sep 2014 08:16:08 +0000 (10:16 +0200)]
BUG-1783: fix thread safety issues

A CAS can fail by a racing thread, which may record a lower number, thus
causing the real peak to not be recorded. Also the filed updater has to
be final and the size should be an integer, not a long.

Change-Id: I2069f703a6bdf2bf2c10ff135d0542176a2177fd
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG 1440 - incorrect inserting of augment node 97/10997/1
Jozef Gloncak [Wed, 10 Sep 2014 14:33:25 +0000 (16:33 +0200)]
BUG 1440 - incorrect inserting of augment node

Augment node was incorrectly inserted to normalized node structure in
cases when node was child of choice (case) or child of case.

This fix cause that for such cases augment will never found and therefore
children will be added to collection of children and not children which
were added via augmentation.

Change-Id: I9bb0e08def798ee387539bf57b60b4eea1cf65c2
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
9 years agoBUG-1790: detect existing unmodifiableMap encapsulation 95/10995/1
Robert Varga [Wed, 10 Sep 2014 14:22:03 +0000 (16:22 +0200)]
BUG-1790: detect existing unmodifiableMap encapsulation

Commit 9bcc82d107075da35c8cd01422481eaea395ba29 introduced a way to
reuse children map by builders. Unfortunately there is a codepath which
could see us receiving the returned collection in our constructor, and
the subsequent operation would wrap it again. If you stack these
operations, at some point the nesting becomes unmanageable.

The fix is to detect a previously-encapsulated collection and reusing
it. Analysis also shows that the children field is not needed, so remove
it as well.

Change-Id: I42d604d290326afca4564565760cbcf4586c2908
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1766: escape outbound strings 47/10947/2
Robert Varga [Tue, 9 Sep 2014 14:31:43 +0000 (16:31 +0200)]
BUG-1766: escape outbound strings

For non-numeric strings we need to make sure there are no stray
backslashes or double quotes are not left unescaped.

Change-Id: Ib2935ad7c4f483d4c592b3f8634d02c7383ba3aa
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoMerge changes I3672c44d,I9ca6b66d
Tony Tkacik [Tue, 9 Sep 2014 14:49:01 +0000 (14:49 +0000)]
Merge changes I3672c44d,I9ca6b66d

* changes:
  BUG-1768: expose JSONCodecFactory for sharing
  BUG-1745, BUG-1746: remove needless quotes

9 years agoMerge "BUG-1704: rework state tracking"
Tony Tkacik [Tue, 9 Sep 2014 13:55:10 +0000 (13:55 +0000)]
Merge "BUG-1704: rework state tracking"

9 years agoMerge "Bug 1698: Updated handling of choice node inside choice node"
Robert Varga [Tue, 9 Sep 2014 13:02:51 +0000 (13:02 +0000)]
Merge "Bug 1698: Updated handling of choice node inside choice node"

9 years agoBUG-1768: expose JSONCodecFactory for sharing 41/10941/1
Robert Varga [Tue, 9 Sep 2014 12:58:47 +0000 (14:58 +0200)]
BUG-1768: expose JSONCodecFactory for sharing

Codecs can be cached for a particular schema context instance, and used
by multiple writers in parallel.

Change-Id: I3672c44d899d8d7e59d63bfbfa037298bac4900d
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1704: rework state tracking 66/10866/5
Robert Varga [Fri, 5 Sep 2014 13:06:03 +0000 (15:06 +0200)]
BUG-1704: rework state tracking

In order to understand when a list (or container) is necessary, the
state tracking machinery needs to be reworked. This patch does exactly
that, adding a single-linked stack tracking nodes and their respective
output.

Change-Id: Iaf6ec6b25c05e0505a1dec6faad5fde2ecb791a0
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBUG-1745, BUG-1746: remove needless quotes 36/10936/2
Robert Varga [Tue, 9 Sep 2014 09:27:34 +0000 (11:27 +0200)]
BUG-1745, BUG-1746: remove needless quotes

The class-based detection did not work because the encodec values are
always strings. Rework the codec factory to make that obvious. Add a
codec-type dispatch which will detect the need for quotes.

Change-Id: I9ca6b66d95522d2022db3f271f9fc40d213a8329
Signed-off-by: Robert Varga <rovarga@cisco.com>
9 years agoBug 1698: Updated handling of choice node inside choice node 40/10940/1
Tony Tkacik [Tue, 9 Sep 2014 12:18:16 +0000 (14:18 +0200)]
Bug 1698: Updated handling of choice node inside choice node

As it turned out, Composite Node to Binding codec
had problem with handling situations, where case
was augmented to choice and that case contained
another choice directly on first level.

Updated code to detect this situation and do proper lookup
to find choice in case in choice.

Change-Id: I2c39542520b842857884468dc0dcd28502ff41b3
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
9 years agoMerge "BUG-1718 Fix hasAttributes method in XmlStreamUtils"
Robert Varga [Mon, 8 Sep 2014 15:45:13 +0000 (15:45 +0000)]
Merge "BUG-1718 Fix hasAttributes method in XmlStreamUtils"

9 years agoMerge "Bug 650: Removed unnecessary and performance affecting String.format()"
Robert Varga [Mon, 8 Sep 2014 15:35:20 +0000 (15:35 +0000)]
Merge "Bug 650: Removed unnecessary and performance affecting String.format()"

9 years agoMerge "Bug 1743: Fixed resolving of Identityrefs in xml."
Robert Varga [Mon, 8 Sep 2014 15:27:53 +0000 (15:27 +0000)]
Merge "Bug 1743: Fixed resolving of Identityrefs in xml."