Bug 5085: Clean-up test and retest JUnit tests 26/38426/2
authorIgor Foltin <ifoltin@cisco.com>
Thu, 5 May 2016 13:49:26 +0000 (15:49 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 9 May 2016 10:27:02 +0000 (10:27 +0000)
Migrated unit tests which used old yang parser to new yang parser.

Change-Id: Ib3dae51fc083734e9b27692f12b6f5528975f4bb
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
228 files changed:
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4501Test.java [moved from yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/Bug4501Test.java with 90% similarity]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4969Test.java [moved from yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/Bug4969Test.java with 80% similarity]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/JsonStreamToNormalizedNodeTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/NormalizedNodeToJsonStreamTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/StreamToNormalizedNodeTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestUtils.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestingNormalizedNodeStructuresCreator.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/YangModeledAnyXmlSupportTest.java [moved from yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/YangModeledAnyXmlSupportTest.java with 90% similarity]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/JsonStreamToNormalizedNodeTest.java [deleted file]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/NormalizedNodeToJsonStreamTest.java [deleted file]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/RetestUtils.java [deleted file]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/StreamToNormalizedNodeTest.java [deleted file]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/TestUtils.java [deleted file]
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/TestingNormalizedNodeStructuresCreator.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/TestUtils.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/RetestUtils.java with 97% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/Bug2964Test.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/InstanceIdentifierForXmlCodecTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/XmlDocumentUtilsTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/XmlStreamUtilsTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/Bug2964Test.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/RandomPrefixTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/XmlDocumentUtilsTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/XmlStreamUtilsTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BinaryCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/BinaryCodecStringTest.java with 83% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BitsCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/BitsCodecStringTest.java with 64% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BooleanCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/BooleanCodecStringTest.java with 65% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/DecimalCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/DecimalCodecStringTest.java with 57% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/EmptyCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/EmptyCodecStringTest.java with 58% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/EnumCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/EnumCodecStringTest.java with 69% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int16CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int16CodecStringTest.java with 82% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int32CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int32CodecStringTest.java with 69% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int64CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int64CodecStringTest.java with 83% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int8CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int8CodecStringTest.java with 68% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/StringCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/StringCodecStringTest.java with 71% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/StringPatternCheckingCodecTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/StringPatternCheckingCodecTest.java with 90% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/TypeDefinitionAwareCodecTestHelper.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/TypeDefinitionAwareCodecTestHelper.java with 95% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint16CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint16CodecStringTest.java with 79% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint32CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint32CodecStringTest.java with 79% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint64CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint64CodecStringTest.java with 63% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint8CodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint8CodecStringTest.java with 80% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/UnionCodecStringTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/UnionCodecStringTest.java with 80% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/DataTreeCandidateValidatorTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/retest/DataTreeCandidateValidatorTest.java with 99% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/DataTreeCandidateValidatorTest2.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/retest/DataTreeCandidateValidatorTest2.java with 98% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/DataTreeCandidateValidatorTest3.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/retest/DataTreeCandidateValidatorTest3.java with 98% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/LeafRefContextTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/retest/LeafRefContextTest.java with 94% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/LeafRefContextTreeBuilderTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/retest/LeafRefContextTreeBuilderTest.java with 97% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest2.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest3.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/LeafRefContextTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/LeafRefContextTreeBuilderTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/BuilderTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/test/BuilderTest.java with 98% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/InstanceIdToNodesTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/NormalizedDataBuilderTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/NormalizedNodeUtilsTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/test/NormalizedNodeUtilsTest.java with 92% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/retest/InstanceIdToNodesTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/retest/NormalizedDataBuilderTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/parser/DomToNormalizedNodeParserFactoryTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/Bug5396.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/DomSerializerTestUtils.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/NormalizedNodeXmlTranslationTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/YangModeledAnyXMLDeserializationTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/retest/YangModeledAnyXMLDeserializationTest.java with 97% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/YangModeledAnyXMLSerializationTest.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/retest/YangModeledAnyXMLSerializationTest.java with 97% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/retest/NormalizedNodeXmlTranslationTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug2690FixTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug2690Test.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_Bug2690Fix.java with 95% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug3674Test.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug4295Test.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/CaseExclusionTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ConcurrentTreeModificationTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ConfigStatementValidationTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/DataTreeTransactionTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ErrorReportingTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ListConstraintsValidation.java [moved from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ListConstraintsValidation.java with 98% similarity]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ListConstraintsValidationTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/MandatoryLeafTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ModificationMetadataTreeTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/OrderedListTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/RetestModel.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_Bug3674Test.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ConcurrentTreeModificationTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ConfigStatementValidationTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ErrorReportingTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ModificationMetadataTreeTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_StoreTreeNodesTest.java [deleted file]
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/StoreTreeNodesTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/TestModel.java
yang/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/JaxenTest.java
yang/yang-data-jaxen/src/test/java/org/opendaylight/yangtools/yang/data/jaxen/TestUtils.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/AbstractBuilderTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/BuilderUtilsTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/CopyUtilsTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeBuilderTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleBuilderTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineUtilsTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionBuilderTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeDefinitionBuilderImplTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentToExtensionTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentationSchemaBuilderImplTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug1412Test.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug1413Test.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug2291Test.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug3799Test.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug394Test.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug4079Test.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/GroupingTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ListKeysTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/OrderingTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ParsingExtensionValueTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/SameQNamesInChoiceTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/SchemaContextTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TestUtils.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TwoRevisionsTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TypesResolutionTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/UsesAugmentTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationListTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationModuleTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationSubModuleTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserIdentityTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserNegativeTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserSimpleTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserWithContextTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/util/SchemaContextUtilTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentArgumentParsingTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentProcessTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentProcessTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentSimplestTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentSimplestTest.java with 93% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/AugmentTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentToExtensionTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/AugmentToExtensionTest.java with 89% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug1412Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug1412Test.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug1413Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug1413Test.java with 91% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug2219Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug2219Test.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug2291Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug2291Test.java with 88% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug3799Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug3799Test.java with 85% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug3859Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug3859Test.java with 85% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug3874ExtensionTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug3874ExtensionTest.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug394Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug394Test.java with 93% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4079Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug4079Test.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4231Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug4231Test.java with 81% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4410Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4410Test.java with 92% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4456Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4456Test.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4459Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4459Test.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4610Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4610Test.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4623Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug4623Test.java with 65% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4933Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4933Test.java with 93% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5059.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5059.java with 88% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5101.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5101.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5335.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5335.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5396.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5396.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5437.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5437.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5481.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5481.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5550.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5550.java with 93% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5693Test.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug5693Test.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/CaseStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/CaseStmtTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ChoiceStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ChoiceStmtTest.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ControllerStmtParserTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ControllerStmtParserTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/DeclaredStatementsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/DeclaredStatementsTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveBuildTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveBuildTest.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveIdentityTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveIdentityTest.java with 92% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveModuleTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveModuleTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveModulesAndSubmodulesTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveModulesAndSubmodulesTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveStatementTypeTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveStatementTypeTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveUsesRefineAndConstraintsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveUsesRefineAndConstraintsTest.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ExtensionStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ExtensionStmtTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/GroupingAndUsesStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/GroupingAndUsesStmtTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/GroupingTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/GroupingTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IdentityStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IdentityStmtTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ImportResolutionBasicTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ImportResolutionBasicTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ImportRevisionsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ImportRevisionsTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IncludeResolutionTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IncludeResolutionTest.java with 92% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IncludeRevisionsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IncludeRevisionsTest.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IncludedStmtsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IncludedStmtsTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/KeyTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/KeyTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ListKeysTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/ListKeysTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ListTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ListTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MappedEffectiveBuildTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/MappedEffectiveBuildTest.java with 81% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ModuleIdentifierTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ModuleIdentifierTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MoreRevisionsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/MoreRevisionsTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MustAndWhenStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/MustAndWhenStmtTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/NotificationStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/NotificationStmtTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/OrderingTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/OrderingTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ParsingExtensionValueTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/ParsingExtensionValueTest.java with 88% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/RpcStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/RpcStmtTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/SchemaContextTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/SchemaContextTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/SchemaContextUtilTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/SchemaContextUtilTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/StmtTestUtils.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/SubstatementValidatorTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/SubstatementValidatorTest.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TestUtils.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/TestUtils.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TwoRevisionsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/TwoRevisionsTest.java with 86% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TypedefConstraintsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/TypedefConstraintsTest.java with 88% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TypedefSubStmtsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/TypedefSubStmtsTest.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TypesResolutionTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/TypesResolutionTest.java with 83% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/UsesAugmentTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/UsesAugmentTest.java with 99% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangFileStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/YangFileStmtTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationListTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangModelValidationListTest.java with 97% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationModuleTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangModelValidationModuleTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationSubModuleTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangModelValidationSubModuleTest.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangModelValidationTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserIdentityTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserIdentityTest.java with 93% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserNegativeTest.java with 88% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserSimpleTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserSimpleTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserTest.java with 88% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserWithContextTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserWithContextTest.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangTypes2StmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/YangTypes2StmtTest.java with 98% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangTypesStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/YangTypesStmtTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/AugmentationSchemaBuilderImplTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug2219Test.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/ModuleIdentifierTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/SameQNamesInChoiceTest.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/package-info.java [deleted file]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileAugmentStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileAugmentStmtTest.java with 92% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileChoiceStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileChoiceStmtTest.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileExtensionStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileExtensionStmtTest.java with 96% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileFeatureStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileFeatureStmtTest.java with 90% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileGroupingStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileGroupingStmtTest.java with 93% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileHeaderStmtsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileHeaderStmtsTest.java with 87% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileIdentityStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileIdentityStmtTest.java with 91% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileImportStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileImportStmtTest.java with 91% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileIncludeStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileIncludeStmtTest.java with 89% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileLeafListStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileLeafListStmtTest.java with 91% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileListStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileListStmtTest.java with 94% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileMetaStmtsTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileMetaStmtsTest.java with 93% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileRpcStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileRpcStmtTest.java with 92% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileStmtTest.java with 95% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileTypeDefStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileTypeDefStmtTest.java with 90% similarity]
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileUsesStmtTest.java [moved from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileUsesStmtTest.java with 92% similarity]

similarity index 90%
rename from yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/Bug4501Test.java
rename to yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4501Test.java
index 0e9ff9b95bf2fd4f2bcbe0da49779b80626d6444..b95f5cc7363b80afcbac372fc80546002c7a9d4e 100644 (file)
@@ -1,17 +1,17 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
+package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadModules;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadTextFile;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadModules;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadTextFile;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
@@ -28,7 +28,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
similarity index 80%
rename from yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/Bug4969Test.java
rename to yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/Bug4969Test.java
index babd4fb51f2cf5830c70f1fa8997d0c1ad6088f6..2a3a1d5a221e5852af66014bb8ba16a95ade4bb5 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
+package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -16,7 +16,6 @@ import java.io.File;
 import java.io.IOException;
 import java.io.StringReader;
 import java.net.URISyntaxException;
-import java.util.Arrays;
 import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -26,11 +25,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
@@ -39,16 +36,7 @@ public class Bug4969Test {
     @Test
     public void newParserLeafRefTest() throws SourceException, ReactorException, URISyntaxException, IOException {
         File sourceDir = new File(Bug4969Test.class.getResource("/bug-4969/yang").toURI());
-        SchemaContext context = RetestUtils.parseYangSources(sourceDir.listFiles());
-        assertNotNull(context);
-
-        verifyNormalizedNodeResult(context);
-    }
-
-    @Test
-    public void oldParserLeafRefTest() throws SourceException, ReactorException, URISyntaxException, IOException {
-        File sourceDir = new File(Bug4969Test.class.getResource("/bug-4969/yang").toURI());
-        SchemaContext context = YangParserImpl.getInstance().parseFiles(Arrays.asList(sourceDir.listFiles()));
+        SchemaContext context = TestUtils.parseYangSources(sourceDir.listFiles());
         assertNotNull(context);
 
         verifyNormalizedNodeResult(context);
@@ -107,16 +95,7 @@ public class Bug4969Test {
     @Test
     public void newParserLeafRefTest2() throws SourceException, ReactorException, URISyntaxException, IOException {
         File sourceDir = new File(Bug4969Test.class.getResource("/leafref/yang").toURI());
-        SchemaContext context = RetestUtils.parseYangSources(sourceDir.listFiles());
-        assertNotNull(context);
-
-        parseJsonToNormalizedNodes(context);
-    }
-
-    @Test
-    public void oldParserLeafRefTest2() throws SourceException, ReactorException, URISyntaxException, IOException {
-        File sourceDir = new File(Bug4969Test.class.getResource("/leafref/yang").toURI());
-        SchemaContext context = YangParserImpl.getInstance().parseFiles(Arrays.asList(sourceDir.listFiles()));
+        SchemaContext context = TestUtils.parseYangSources(sourceDir.listFiles());
         assertNotNull(context);
 
         parseJsonToNormalizedNodes(context);
index 5582d508c49d8a845e159734656065ff9897b467..c7e574d812b105d2b92983d5a04284207c259d82 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -34,6 +34,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeS
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 /**
  *
@@ -46,7 +47,7 @@ public class JsonStreamToNormalizedNodeTest {
     private static SchemaContext schemaContext;
 
     @BeforeClass
-    public static void initialization() throws IOException, URISyntaxException {
+    public static void initialization() throws IOException, URISyntaxException, ReactorException {
         schemaContext = loadModules("/complexjson/yang");
     }
 
index 62f1d6e6c51b1e7c345a73d5ae8a4f0212fe781c..51ed99fe08cdc994c908aa2e741a307d0457490c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -40,6 +40,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 /**
  * Each test tests whether json output obtained after transformation contains is corect. The transformation takes
@@ -50,15 +51,15 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 public class NormalizedNodeToJsonStreamTest {
 
     private static final QName CONT_1 = QName.create("ns:complex:json", "2014-08-11", "cont1");
-    private static final QName EMPTY_LEAF = QName.create(CONT_1,"empty");
+    private static final QName EMPTY_LEAF = QName.create(CONT_1, "empty");
     private static SchemaContext schemaContext;
 
     public interface JsonValidator {
         void validate(final String jsonOutput);
-   }
+    }
 
     @BeforeClass
-    public static void initialization() throws IOException, URISyntaxException {
+    public static void initialization() throws IOException, URISyntaxException, ReactorException {
         schemaContext = loadModules("/complexjson/yang");
     }
 
@@ -106,7 +107,8 @@ public class NormalizedNodeToJsonStreamTest {
     @Test
     public void leafListNodeInContainerMultiline() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator.leafListNodeInContainerMultiline();
+        final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator
+                .leafListNodeInContainerMultiline();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafListNodeInContainer);
         new JsonValidator() {
 
@@ -123,7 +125,8 @@ public class NormalizedNodeToJsonStreamTest {
                     lflst11Values.add(((JsonPrimitive) jsonElement).getAsString());
                 }
 
-                assertEquals(Sets.newHashSet("lflst11 value2\r\nanother line 2", "lflst11 value1\nanother line 1"), lflst11Values);
+                assertEquals(Sets.newHashSet("lflst11 value2\r\nanother line 2", "lflst11 value1\nanother line 1"),
+                        lflst11Values);
             }
         }.validate(jsonOutput);
 
@@ -154,7 +157,8 @@ public class NormalizedNodeToJsonStreamTest {
     @Test
     public void leafListNodeInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator.leafListNodeInContainer();
+        final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator
+                .leafListNodeInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafListNodeInContainer);
         new JsonValidator() {
 
@@ -218,7 +222,8 @@ public class NormalizedNodeToJsonStreamTest {
     @Test
     public void choiceNodeInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> choiceNodeInContainer = TestingNormalizedNodeStructuresCreator.choiceNodeInContainer();
+        final NormalizedNode<?, ?> choiceNodeInContainer = TestingNormalizedNodeStructuresCreator
+                .choiceNodeInContainer();
         final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, choiceNodeInContainer);
         new JsonValidator() {
 
@@ -244,13 +249,14 @@ public class NormalizedNodeToJsonStreamTest {
      * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
      *
      */
-//    @Ignore
+    // @Ignore
     @Test
     public void caseNodeAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
         final NormalizedNode<?, ?> caseNodeAugmentationInChoiceInContainer = TestingNormalizedNodeStructuresCreator
                 .caseNodeAugmentationInChoiceInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, caseNodeAugmentationInChoiceInContainer);
+        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
+                caseNodeAugmentationInChoiceInContainer);
         new JsonValidator() {
 
             @Override
@@ -286,7 +292,7 @@ public class NormalizedNodeToJsonStreamTest {
      * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
      *
      */
-//    @Ignore
+    // @Ignore
     @Test
     public void caseNodeExternalAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
@@ -331,14 +337,13 @@ public class NormalizedNodeToJsonStreamTest {
      * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
      *
      */
-//    @Ignore
+    // @Ignore
     @Test
     public void choiceNodeAugmentationInContainer() throws IOException, URISyntaxException {
         final Writer writer = new StringWriter();
         final NormalizedNode<?, ?> choiceNodeAugmentationInContainer = TestingNormalizedNodeStructuresCreator
                 .choiceNodeAugmentationInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
-                choiceNodeAugmentationInContainer);
+        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, choiceNodeAugmentationInContainer);
         new JsonValidator() {
 
             @Override
@@ -346,9 +351,9 @@ public class NormalizedNodeToJsonStreamTest {
                 final JsonObject cont1 = resolveCont1(jsonOutput);
                 assertNotNull(cont1);
 
-                final JsonPrimitive lf17 = childPrimitive(cont1, "complexjson:lf17","lf17");
+                final JsonPrimitive lf17 = childPrimitive(cont1, "complexjson:lf17", "lf17");
                 assertNotNull(lf17);
-                assertEquals("lf17 value",lf17.getAsString());
+                assertEquals("lf17 value", lf17.getAsString());
             }
         }.validate(jsonOutput);
     }
@@ -358,8 +363,7 @@ public class NormalizedNodeToJsonStreamTest {
         final Writer writer = new StringWriter();
         final NormalizedNode<?, ?> unkeyedNodeInContainer = TestingNormalizedNodeStructuresCreator
                 .unkeyedNodeInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
-                unkeyedNodeInContainer);
+        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, unkeyedNodeInContainer);
         new JsonValidator() {
 
             @Override
@@ -367,7 +371,7 @@ public class NormalizedNodeToJsonStreamTest {
                 final JsonObject cont1 = resolveCont1(jsonOutput);
                 assertNotNull(cont1);
 
-                final JsonArray lst12 = childArray(cont1, "complexjson:lst12","lst12");
+                final JsonArray lst12 = childArray(cont1, "complexjson:lst12", "lst12");
                 assertNotNull(lst12);
 
                 final Iterator<JsonElement> iterator = lst12.iterator();
@@ -376,11 +380,11 @@ public class NormalizedNodeToJsonStreamTest {
                 assertFalse(iterator.hasNext());
 
                 assertTrue(lst12Entry1Raw instanceof JsonObject);
-                final JsonObject lst12Entry1 = (JsonObject)lst12Entry1Raw;
+                final JsonObject lst12Entry1 = (JsonObject) lst12Entry1Raw;
                 final JsonPrimitive lf121 = childPrimitive(lst12Entry1, "complexjson:lf121", "lf121");
                 assertNotNull(lf121);
 
-                assertEquals("lf121 value",lf121.getAsString());
+                assertEquals("lf121 value", lf121.getAsString());
 
             }
         }.validate(jsonOutput);
@@ -392,15 +396,13 @@ public class NormalizedNodeToJsonStreamTest {
         final StringWriter writer = new StringWriter();
         final ContainerNode emptyStructure = Builders.containerBuilder()
                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CONT_1))
-                .addChild(ImmutableNodes.leafNode(EMPTY_LEAF, null))
-                .build();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
-                emptyStructure);
+                .addChild(ImmutableNodes.leafNode(EMPTY_LEAF, null)).build();
+        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, emptyStructure);
         final JsonObject cont1 = resolveCont1(jsonOutput);
         final JsonElement emptyObj = cont1.get("empty");
         assertNotNull(emptyObj);
         assertTrue(emptyObj instanceof JsonArray);
-        assertEquals(1,emptyObj.getAsJsonArray().size());
+        assertEquals(1, emptyObj.getAsJsonArray().size());
         assertTrue(emptyObj.getAsJsonArray().get(0) instanceof JsonNull);
     }
 
index 3f21878681b143622acf9468e45eda78cfdb7e6b..28db132ffe37df5cbd974574404676c7eb5ed135 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -9,6 +9,9 @@ package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadModules;
 import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadTextFile;
+
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+
 import com.google.gson.stream.JsonReader;
 import java.io.File;
 import java.io.IOException;
@@ -27,7 +30,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWrit
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,7 +40,7 @@ public class StreamToNormalizedNodeTest {
     private static String streamAsString;
 
     @BeforeClass
-    public static void initialization() throws IOException, URISyntaxException {
+    public static void initialization() throws IOException, URISyntaxException, ReactorException {
         schemaContext = loadModules("/complexjson/yang");
         streamAsString = loadTextFile(new File(StreamToNormalizedNodeTest.class.getResource(
                 "/complexjson/complex-json.json").toURI()));
@@ -100,10 +103,12 @@ public class StreamToNormalizedNodeTest {
         // String holder
         final StringWriter writer = new StringWriter();
 
+        // StreamWriter which outputs JSON strings
         // StreamWriter which outputs JSON strings
         final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.
                 createExclusiveWriter(JSONCodecFactory.create(schemaContext), SchemaPath.ROOT, null,
                     JsonWriterFactory.createJsonWriter(writer, 2));
+
         // NormalizedNode -> StreamWriter
         final NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
 
index c5b6d80c2e775f635e6ab39f9245c5c8cbb339ed..0e13ecbbfe8e18e1f7be52a6de1419958b4e34ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import static org.junit.Assert.assertTrue;
-
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
@@ -16,24 +15,31 @@ import com.google.gson.JsonParser;
 import com.google.gson.JsonPrimitive;
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 
 public class TestUtils {
 
     private TestUtils() {
     }
 
-    static SchemaContext loadModules(final String resourceDirectory) throws IOException, URISyntaxException {
-        YangContextParser parser = new YangParserImpl();
+    static SchemaContext loadModules(final String resourceDirectory) throws IOException, URISyntaxException,
+            ReactorException {
         URI path = StreamToNormalizedNodeTest.class.getResource(resourceDirectory).toURI();
         final File testDir = new File(path);
         final String[] fileList = testDir.list();
@@ -46,7 +52,41 @@ public class TestUtils {
                 testFiles.add(new File(testDir, fileName));
             }
         }
-        return parser.parseFiles(testFiles);
+        return parseYangSources(testFiles);
+    }
+
+    public static SchemaContext parseYangSources(StatementStreamSource... sources)
+            throws SourceException, ReactorException {
+
+        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
+                .newBuild();
+        reactor.addSources(sources);
+
+        return reactor.buildEffective();
+    }
+
+    public static SchemaContext parseYangSources(File... files) throws SourceException, ReactorException, FileNotFoundException {
+
+        StatementStreamSource[] sources = new StatementStreamSource[files.length];
+
+        for(int i = 0; i<files.length; i++) {
+            sources[i] = new YangStatementSourceImpl(new FileInputStream(files[i]));
+        }
+
+        return parseYangSources(sources);
+    }
+
+    public static SchemaContext parseYangSources(Collection<File> files) throws SourceException, ReactorException, FileNotFoundException {
+        return parseYangSources(files.toArray(new File[files.size()]));
+    }
+
+
+    public static SchemaContext parseYangStreams(List<InputStream> streams)
+            throws SourceException, ReactorException {
+
+        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
+                .newBuild();
+        return reactor.buildEffective(streams);
     }
 
     static String loadTextFile(final File file) throws IOException {
@@ -66,7 +106,7 @@ public class TestUtils {
         return loadTextFile(new File(TestUtils.class.getResource(relativePath).toURI()));
     }
 
-    static JsonObject childObject(final JsonObject jsonObject,final String ... names) {
+    static JsonObject childObject(final JsonObject jsonObject, final String... names) {
         for (String name : names) {
             JsonObject childJsonObject = jsonObject.getAsJsonObject(name);
             if (childJsonObject != null) {
@@ -76,7 +116,7 @@ public class TestUtils {
         return null;
     }
 
-    static JsonPrimitive childPrimitive(final JsonObject jsonObject,final String ... names) {
+    static JsonPrimitive childPrimitive(final JsonObject jsonObject, final String... names) {
         for (String name : names) {
             JsonPrimitive childJsonPrimitive = jsonObject.getAsJsonPrimitive(name);
             if (childJsonPrimitive != null) {
@@ -86,7 +126,7 @@ public class TestUtils {
         return null;
     }
 
-    static JsonArray childArray(final JsonObject jsonObject,final String ... names) {
+    static JsonArray childArray(final JsonObject jsonObject, final String... names) {
         for (String name : names) {
             JsonArray childJsonArray = jsonObject.getAsJsonArray(name);
             if (childJsonArray != null) {
@@ -105,5 +145,4 @@ public class TestUtils {
         return cont1;
     }
 
-
 }
index 0001a05aada6fd56f6216d4467d75e146694d151..db4814c9820364919af8ba334fe5d31d5cb14708 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -1,15 +1,15 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
+package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import static org.junit.Assert.assertEquals;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadModules;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadTextFile;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadModules;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadTextFile;
 import com.google.common.base.Preconditions;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonParser;
@@ -35,10 +35,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/JsonStreamToNormalizedNodeTest.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/JsonStreamToNormalizedNodeTest.java
deleted file mode 100644 (file)
index 682e650..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadModules;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadTextFile;
-import static org.opendaylight.yangtools.yang.data.impl.schema.Builders.augmentationBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.Builders.choiceBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.Builders.containerBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.leafNode;
-import com.google.common.collect.Sets;
-import com.google.gson.stream.JsonReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.net.URISyntaxException;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-/**
- *
- * Each test tests whether json input is correctly transformed to normalized node structure
- */
-public class JsonStreamToNormalizedNodeTest {
-
-    private static final QName CONT_1 = QName.create("ns:complex:json", "2014-08-11", "cont1");
-    private static final QName EMPTY_LEAF = QName.create(CONT_1,"empty");
-    private static SchemaContext schemaContext;
-
-    @BeforeClass
-    public static void initialization() throws IOException, URISyntaxException, ReactorException {
-        schemaContext = loadModules("/complexjson/yang");
-    }
-
-    /**
-     * case when anyxml contains simple value will be implemented when anyxml normalized node reprezentation will be
-     * specified
-     */
-    @Ignore
-    @Test
-    public void anyXmlNodeWithSimpleValueInContainer() throws IOException, URISyntaxException {
-
-    }
-
-    /**
-     * case when anyxml contains complex xml will be implemented when anyxml normalized node reprezentation will be
-     * specified
-     */
-    @Ignore
-    @Test
-    public void anyXmlNodeWithCompositeValueInContainer() throws IOException, URISyntaxException {
-
-    }
-
-    @Test
-    public void leafNodeInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/leaf-node-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson, TestingNormalizedNodeStructuresCreator.leafNodeInContainer());
-    }
-
-    @Test
-    public void leafNodeViaAugmentationInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/leaf-node-via-augmentation-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson,
-                TestingNormalizedNodeStructuresCreator.leafNodeViaAugmentationInContainer());
-    }
-
-    @Test
-    public void leafListNodeInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/leaflist-node-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson,
-                TestingNormalizedNodeStructuresCreator.leafListNodeInContainer());
-    }
-
-    @Test
-    public void keyedListNodeInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/keyed-list-node-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson,
-                TestingNormalizedNodeStructuresCreator.keyedListNodeInContainer());
-    }
-
-    @Test
-    public void choiceNodeInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/choice-node-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson, TestingNormalizedNodeStructuresCreator.choiceNodeInContainer());
-    }
-
-    /**
-     * Test of translating internal augmentations to normalized nodes structure
-     *
-     * 2 nodes are added via internal augmentation A, 1 node via internal augmentation B and one node is originally
-     * member of case.
-     *
-     */
-    @Test
-    public void caseNodeAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/case-node-augmentation-in-choice-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson,
-                TestingNormalizedNodeStructuresCreator.caseNodeAugmentationInChoiceInContainer());
-    }
-
-    /**
-     * also test using of namesakes (equal local names with different
-     *
-     * @throws IOException
-     * @throws URISyntaxException
-     */
-    @Test
-    public void caseNodeExternalAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/case-node-external-augmentation-in-choice-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson,
-                TestingNormalizedNodeStructuresCreator.caseNodeExternalAugmentationInChoiceInContainer());
-    }
-
-    /**
-     * augmentation of choice - adding new case
-     */
-    @Test
-    public void choiceNodeAugmentationInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/choice-node-augmentation-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson,
-                TestingNormalizedNodeStructuresCreator.choiceNodeAugmentationInContainer());
-    }
-
-    @Test
-    public void unkeyedNodeInContainer() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/unkeyed-node-in-container.json");
-        verifyTransformationToNormalizedNode(inputJson, TestingNormalizedNodeStructuresCreator.unkeyedNodeInContainer());
-    }
-
-    /**
-     * Top level JSON element contains no information about module name.
-     *
-     * It should be possible to find out potential module name from available schema context.
-     *
-     */
-    @Test
-    public void missingModuleInfoInTopLevelElement() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/missing-module-in-top-level.json");
-        verifyTransformationToNormalizedNode(inputJson, TestingNormalizedNodeStructuresCreator.topLevelContainer());
-    }
-
-    /**
-     *
-     * Exception expected.
-     *
-     * It tests case when several elements with the same name and various namespaces exists and are in JSON specified
-     * without module name prefix.
-     */
-    @Test
-    public void leafNamesakes() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/namesakes.json");
-        try {
-            //second parameter isn't necessary because error will be raised before it is used.
-            verifyTransformationToNormalizedNode(inputJson, null);
-            fail("Expected exception not raised");
-        } catch (final IllegalStateException e) {
-            final String errorMessage = e.getMessage();
-            assertTrue(errorMessage.contains("Choose suitable module name for element lf11-namesake:"));
-            assertTrue(errorMessage.contains("complexjson-augmentation"));
-            assertTrue(errorMessage.contains("complexjson-augmentation-namesake"));
-        }
-    }
-
-    @Test
-    public void emptyTypeTest() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/type-empty.json");
-        final ContainerNode awaitedStructure = containerBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CONT_1))
-                .addChild(leafNode(EMPTY_LEAF, null))
-                .build();
-
-        verifyTransformationToNormalizedNode(inputJson, awaitedStructure);
-    }
-
-    /**
-     *
-     * Exception expected.
-     *
-     * Json input contains element which doesn't exist in YANG schema
-     */
-    @Test
-    public void parsingNotExistingElement() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/not-existing-element.json");
-        try {
-            //second parameter isn't necessary because error will be raised before it is used.
-            verifyTransformationToNormalizedNode(inputJson, null);
-        } catch (final IllegalStateException e) {
-            assertTrue(e.getMessage().contains("Schema node with name dummy-element wasn't found"));
-        }
-    }
-
-
-    @Test
-    public void listItemWithoutArray() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/keyed-list-restconf-behaviour.json");
-
-        final NormalizedNodeResult result = new NormalizedNodeResult();
-        final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-        final SchemaNode parentNode = schemaContext.getDataChildByName("cont1");
-        final JsonParserStream jsonParser = JsonParserStream.create(streamWriter, schemaContext, parentNode);
-        jsonParser.parse(new JsonReader(new StringReader(inputJson)));
-        final NormalizedNode<?, ?> transformedInput = result.getResult();
-        assertNotNull(transformedInput);
-    }
-
-    @Test
-    public void listItemWithArray() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/keyed-list-yang-json-behaviour.json");
-
-        final NormalizedNodeResult result = new NormalizedNodeResult();
-        final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-        final SchemaNode parentNode = schemaContext.getDataChildByName("cont1");
-        final JsonParserStream jsonParser = JsonParserStream.create(streamWriter, schemaContext, parentNode);
-        jsonParser.parse(new JsonReader(new StringReader(inputJson)));
-        final NormalizedNode<?, ?> transformedInput = result.getResult();
-        assertNotNull(transformedInput);
-    }
-
-   @Test
-    public void multipleChoiceAugmentation() throws IOException, URISyntaxException {
-        final String inputJson = loadTextFile("/complexjson/multiple-choice-augmentation-in-container.json");
-
-        final NormalizedNodeResult result = new NormalizedNodeResult();
-        final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-        final SchemaNode parentNode = schemaContext.getDataChildByName("cont1");
-
-        QName augmentChoice1QName = QName.create(parentNode.getQName(), "augment-choice1");
-        QName augmentChoice2QName = QName.create(augmentChoice1QName, "augment-choice2");
-        final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
-        final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
-
-        final YangInstanceIdentifier.AugmentationIdentifier aug1Id =
-                new YangInstanceIdentifier.AugmentationIdentifier(Sets.newHashSet(augmentChoice1QName));
-        final YangInstanceIdentifier.AugmentationIdentifier aug2Id =
-                new YangInstanceIdentifier.AugmentationIdentifier(Sets.newHashSet(augmentChoice2QName));
-        final YangInstanceIdentifier.NodeIdentifier augmentChoice1Id =
-                new YangInstanceIdentifier.NodeIdentifier(augmentChoice1QName);
-        final YangInstanceIdentifier.NodeIdentifier augmentChoice2Id =
-                new YangInstanceIdentifier.NodeIdentifier(augmentChoice2QName);
-        final YangInstanceIdentifier.NodeIdentifier containerId =
-                new YangInstanceIdentifier.NodeIdentifier(containerQName);
-
-        final NormalizedNode<?, ?> cont1Normalized =
-                containerBuilder().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(parentNode.getQName()))
-                        .withChild(augmentationBuilder().withNodeIdentifier(aug1Id)
-                                .withChild(choiceBuilder().withNodeIdentifier(augmentChoice1Id)
-                                        .withChild(augmentationBuilder().withNodeIdentifier(aug2Id)
-                                                .withChild(choiceBuilder().withNodeIdentifier(augmentChoice2Id)
-                                                        .withChild(containerBuilder().withNodeIdentifier(containerId)
-                                                                .withChild(leafNode(leafQName, "leaf-value"))
-                                                                .build())
-                                                        .build())
-                                                .build())
-                                        .build())
-                                .build()).build();
-
-        final JsonParserStream jsonParser = JsonParserStream.create(streamWriter, schemaContext);
-        jsonParser.parse(new JsonReader(new StringReader(inputJson)));
-        final NormalizedNode<?, ?> transformedInput = result.getResult();
-        assertNotNull(transformedInput);
-        assertEquals(cont1Normalized, transformedInput);
-    }
-
-    private static void verifyTransformationToNormalizedNode(final String inputJson,
-            final NormalizedNode<?, ?> awaitedStructure) {
-        final NormalizedNodeResult result = new NormalizedNodeResult();
-        final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-        final JsonParserStream jsonParser = JsonParserStream.create(streamWriter, schemaContext);
-        jsonParser.parse(new JsonReader(new StringReader(inputJson)));
-        final NormalizedNode<?, ?> transformedInput = result.getResult();
-        assertEquals("Transformation of json input to normalized node wasn't successful.", awaitedStructure,
-                transformedInput);
-    }
-
-}
diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/NormalizedNodeToJsonStreamTest.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/NormalizedNodeToJsonStreamTest.java
deleted file mode 100644 (file)
index 58480a7..0000000
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.childArray;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.childPrimitive;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadModules;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.resolveCont1;
-import com.google.common.collect.Sets;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonNull;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URISyntaxException;
-import java.util.HashSet;
-import java.util.Iterator;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-/**
- * Each test tests whether json output obtained after transformation contains is corect. The transformation takes
- * normalized node data structure and transform it to json output. To make it easier validate json output it is loaded
- * via gson as structure of json elements which are walked and compared with awaited values.
- *
- */
-public class NormalizedNodeToJsonStreamTest {
-
-    private static final QName CONT_1 = QName.create("ns:complex:json", "2014-08-11", "cont1");
-    private static final QName EMPTY_LEAF = QName.create(CONT_1, "empty");
-    private static SchemaContext schemaContext;
-
-    public interface JsonValidator {
-        void validate(final String jsonOutput);
-    }
-
-    @BeforeClass
-    public static void initialization() throws IOException, URISyntaxException, ReactorException {
-        schemaContext = loadModules("/complexjson/yang");
-    }
-
-    /**
-     * case when anyxml contains simple value will be implemented when anyxml normalized node reprezentation will be
-     * specified
-     */
-    @Ignore
-    @Test
-    public void anyXmlNodeWithSimpleValueInContainer() throws IOException, URISyntaxException {
-
-    }
-
-    /**
-     * case when anyxml contains complex xml will be implemented when anyxml normalized node reprezentation will be
-     * specified
-     */
-    @Ignore
-    @Test
-    public void anyXmlNodeWithCompositeValueInContainer() throws IOException, URISyntaxException {
-
-    }
-
-    @Test
-    public void leafNodeInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> leafNodeInContainer = TestingNormalizedNodeStructuresCreator.leafNodeInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafNodeInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-
-                final JsonPrimitive lf11 = childPrimitive(cont1, "complexjson:lf11", "lf11");
-                assertNotNull(lf11);
-                final int asInt = lf11.getAsInt();
-                assertEquals(453, asInt);
-            }
-        }.validate(jsonOutput);
-
-    }
-
-    @Test
-    public void leafListNodeInContainerMultiline() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator
-                .leafListNodeInContainerMultiline();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafListNodeInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-                final JsonArray lflst11 = childArray(cont1, "complexjson:lflst11", "lflst11");
-                assertNotNull(lflst11);
-
-                final HashSet<Object> lflst11Values = Sets.newHashSet();
-                for (final JsonElement jsonElement : lflst11) {
-                    assertTrue(jsonElement instanceof JsonPrimitive);
-                    lflst11Values.add(((JsonPrimitive) jsonElement).getAsString());
-                }
-
-                assertEquals(Sets.newHashSet("lflst11 value2\r\nanother line 2", "lflst11 value1\nanother line 1"),
-                        lflst11Values);
-            }
-        }.validate(jsonOutput);
-
-    }
-
-    @Test
-    public void leafNodeViaAugmentationInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> leafNodeViaAugmentationInContainer = TestingNormalizedNodeStructuresCreator
-                .leafNodeViaAugmentationInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafNodeViaAugmentationInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-
-                final JsonPrimitive lf12_1 = childPrimitive(cont1, "complexjson:lf12_1", "lf12_1");
-                assertNotNull(lf12_1);
-                final String asString = lf12_1.getAsString();
-                assertEquals("lf12 value", asString);
-            }
-        }.validate(jsonOutput);
-
-    }
-
-    @Test
-    public void leafListNodeInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator
-                .leafListNodeInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafListNodeInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-                final JsonArray lflst11 = childArray(cont1, "complexjson:lflst11", "lflst11");
-                assertNotNull(lflst11);
-
-                final HashSet<Object> lflst11Values = Sets.newHashSet();
-                for (final JsonElement jsonElement : lflst11) {
-                    assertTrue(jsonElement instanceof JsonPrimitive);
-                    lflst11Values.add(((JsonPrimitive) jsonElement).getAsString());
-                }
-
-                assertEquals(Sets.newHashSet("lflst11 value2", "lflst11 value1"), lflst11Values);
-            }
-        }.validate(jsonOutput);
-    }
-
-    @Test
-    public void keyedListNodeInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> keyedListNodeInContainer = TestingNormalizedNodeStructuresCreator
-                .keyedListNodeInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, keyedListNodeInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-                final JsonArray lst11 = childArray(cont1, "complexjson:lst11", "lst11");
-                assertNotNull(lst11);
-
-                final Iterator<JsonElement> iterator = lst11.iterator();
-                assertTrue(iterator.hasNext());
-                final JsonElement lst11Entry1Raw = iterator.next();
-                assertFalse(iterator.hasNext());
-                assertTrue(lst11Entry1Raw instanceof JsonObject);
-                final JsonObject lst11Entry1 = (JsonObject) lst11Entry1Raw;
-
-                final JsonPrimitive key111 = childPrimitive(lst11Entry1, "complexjson:key111", "key111");
-                assertNotNull(key111);
-                final JsonPrimitive lf112 = childPrimitive(lst11Entry1, "complexjson:lf112", "lf112");
-                assertNotNull(lf112);
-                final JsonPrimitive lf113 = childPrimitive(lst11Entry1, "complexjson:lf113", "lf113");
-                assertNotNull(lf113);
-                final JsonPrimitive lf111 = childPrimitive(lst11Entry1, "complexjson:lf111", "lf111");
-                assertNotNull(lf111);
-
-                assertEquals("key111 value", key111.getAsString());
-                assertEquals("/complexjson:cont1/complexjson:lflst11[.='foo']", lf112.getAsString());
-                assertEquals("lf113 value", lf113.getAsString());
-                assertEquals("lf111 value", lf111.getAsString());
-            }
-        }.validate(jsonOutput);
-    }
-
-    @Test
-    public void choiceNodeInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> choiceNodeInContainer = TestingNormalizedNodeStructuresCreator
-                .choiceNodeInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, choiceNodeInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-                final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
-                assertNotNull(lf13);
-
-                assertEquals("lf13 value", lf13.getAsString());
-            }
-        }.validate(jsonOutput);
-    }
-
-    /**
-     * tested case when case c11A in choice choc11 is augmented (two leaves (augment A) and one leaf (augment B) are
-     * added)
-     *
-     * after running this test following exception is raised
-     *
-     * java.lang.IllegalArgumentException: Augmentation allowed only in DataNodeContainer
-     * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
-     *
-     */
-    // @Ignore
-    @Test
-    public void caseNodeAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> caseNodeAugmentationInChoiceInContainer = TestingNormalizedNodeStructuresCreator
-                .caseNodeAugmentationInChoiceInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
-                caseNodeAugmentationInChoiceInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-
-                final JsonPrimitive lf15_21 = childPrimitive(cont1, "complexjson:lf15_21", "lf15_21");
-                assertNotNull(lf15_21);
-                final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
-                assertNotNull(lf13);
-                final JsonPrimitive lf15_11 = childPrimitive(cont1, "complexjson:lf15_11", "lf15_11");
-                assertNotNull(lf15_11);
-                final JsonPrimitive lf15_12 = childPrimitive(cont1, "complexjson:lf15_12", "lf15_12");
-                assertNotNull(lf15_12);
-
-                assertEquals("lf15_21 value", lf15_21.getAsString());
-                assertEquals("lf13 value", lf13.getAsString());
-                assertTrue("one two".equals(lf15_11.getAsString()) || "two one".equals(lf15_11.getAsString()));
-                assertEquals("complexjson:lf11", lf15_12.getAsString());
-
-            }
-        }.validate(jsonOutput);
-    }
-
-    /**
-     * tested case when case c11A in choice choc11 is augmented (two leaves (augment A) internally and one two leaves
-     * with the same names externally (augment B) are added)
-     *
-     * after running this test following exception is raised
-     *
-     * java.lang.IllegalArgumentException: Augmentation allowed only in DataNodeContainer
-     * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
-     *
-     */
-    // @Ignore
-    @Test
-    public void caseNodeExternalAugmentationInChoiceInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> caseNodeExternalAugmentationInChoiceInContainer = TestingNormalizedNodeStructuresCreator
-                .caseNodeExternalAugmentationInChoiceInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer,
-                caseNodeExternalAugmentationInChoiceInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-
-                final JsonPrimitive lf15_11Augment = childPrimitive(cont1, "complexjson-augmentation:lf15_11");
-                assertNotNull(lf15_11Augment);
-                final JsonPrimitive lf15_12Augment = childPrimitive(cont1, "complexjson-augmentation:lf15_12");
-                assertNotNull(lf15_12Augment);
-                final JsonPrimitive lf13 = childPrimitive(cont1, "complexjson:lf13", "lf13");
-                assertNotNull(lf13);
-                final JsonPrimitive lf15_11 = childPrimitive(cont1, "complexjson:lf15_11", "lf15_11");
-                assertNotNull(lf15_11);
-                final JsonPrimitive lf15_12 = childPrimitive(cont1, "complexjson:lf15_12", "lf15_12");
-                assertNotNull(lf15_12);
-
-                assertEquals("lf15_11 value from augmentation", lf15_11Augment.getAsString());
-                assertEquals("lf15_12 value from augmentation", lf15_12Augment.getAsString());
-                assertEquals("lf13 value", lf13.getAsString());
-                assertTrue("one two".equals(lf15_11.getAsString()) || "two one".equals(lf15_11.getAsString()));
-                assertEquals("complexjson:lf11", lf15_12.getAsString());
-
-            }
-        }.validate(jsonOutput);
-    }
-
-    /**
-     * augmentation of choice - adding new case
-     *
-     * after running this test following exception is raised
-     *
-     * java.lang.IllegalArgumentException: Augmentation allowed only in DataNodeContainer
-     * [ChoiceNodeImpl[qname=(ns:complex:json?revision=2014-08-11)choc11]]
-     *
-     */
-    // @Ignore
-    @Test
-    public void choiceNodeAugmentationInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> choiceNodeAugmentationInContainer = TestingNormalizedNodeStructuresCreator
-                .choiceNodeAugmentationInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, choiceNodeAugmentationInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-
-                final JsonPrimitive lf17 = childPrimitive(cont1, "complexjson:lf17", "lf17");
-                assertNotNull(lf17);
-                assertEquals("lf17 value", lf17.getAsString());
-            }
-        }.validate(jsonOutput);
-    }
-
-    @Test
-    public void unkeyedNodeInContainer() throws IOException, URISyntaxException {
-        final Writer writer = new StringWriter();
-        final NormalizedNode<?, ?> unkeyedNodeInContainer = TestingNormalizedNodeStructuresCreator
-                .unkeyedNodeInContainer();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, unkeyedNodeInContainer);
-        new JsonValidator() {
-
-            @Override
-            public void validate(final String jsonOutput) {
-                final JsonObject cont1 = resolveCont1(jsonOutput);
-                assertNotNull(cont1);
-
-                final JsonArray lst12 = childArray(cont1, "complexjson:lst12", "lst12");
-                assertNotNull(lst12);
-
-                final Iterator<JsonElement> iterator = lst12.iterator();
-                assertTrue(iterator.hasNext());
-                final JsonElement lst12Entry1Raw = iterator.next();
-                assertFalse(iterator.hasNext());
-
-                assertTrue(lst12Entry1Raw instanceof JsonObject);
-                final JsonObject lst12Entry1 = (JsonObject) lst12Entry1Raw;
-                final JsonPrimitive lf121 = childPrimitive(lst12Entry1, "complexjson:lf121", "lf121");
-                assertNotNull(lf121);
-
-                assertEquals("lf121 value", lf121.getAsString());
-
-            }
-        }.validate(jsonOutput);
-
-    }
-
-    @Test
-    public void emptyTypeTest() throws IOException, URISyntaxException {
-        final StringWriter writer = new StringWriter();
-        final ContainerNode emptyStructure = Builders.containerBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CONT_1))
-                .addChild(ImmutableNodes.leafNode(EMPTY_LEAF, null)).build();
-        final String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, emptyStructure);
-        final JsonObject cont1 = resolveCont1(jsonOutput);
-        final JsonElement emptyObj = cont1.get("empty");
-        assertNotNull(emptyObj);
-        assertTrue(emptyObj instanceof JsonArray);
-        assertEquals(1, emptyObj.getAsJsonArray().size());
-        assertTrue(emptyObj.getAsJsonArray().get(0) instanceof JsonNull);
-    }
-
-    private static String normalizedNodeToJsonStreamTransformation(final Writer writer,
-            final NormalizedNode<?, ?> inputStructure) throws IOException {
-
-        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.
-                createExclusiveWriter(JSONCodecFactory.create(schemaContext), SchemaPath.ROOT, null,
-                    JsonWriterFactory.createJsonWriter(writer, 2));
-        final NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
-        nodeWriter.write(inputStructure);
-
-        nodeWriter.close();
-        return writer.toString();
-    }
-
-}
diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/RetestUtils.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/RetestUtils.java
deleted file mode 100644 (file)
index 92e20a2..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.List;
-
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
-import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
-
-public class RetestUtils {
-
-    private RetestUtils() {
-        throw new UnsupportedOperationException("Utility class");
-    }
-
-    public static SchemaContext parseYangSources(StatementStreamSource... sources)
-            throws SourceException, ReactorException {
-
-        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
-                .newBuild();
-        reactor.addSources(sources);
-
-        return reactor.buildEffective();
-    }
-
-    public static SchemaContext parseYangSources(File... files) throws SourceException, ReactorException, FileNotFoundException {
-
-        StatementStreamSource[] sources = new StatementStreamSource[files.length];
-
-        for(int i = 0; i<files.length; i++) {
-            sources[i] = new YangStatementSourceImpl(new FileInputStream(files[i]));
-        }
-
-        return parseYangSources(sources);
-    }
-
-    public static SchemaContext parseYangSources(Collection<File> files) throws SourceException, ReactorException, FileNotFoundException {
-        return parseYangSources(files.toArray(new File[files.size()]));
-    }
-
-
-    public static SchemaContext parseYangStreams(List<InputStream> streams)
-            throws SourceException, ReactorException {
-
-        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
-                .newBuild();
-        return reactor.buildEffective(streams);
-    }
-}
diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/StreamToNormalizedNodeTest.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/StreamToNormalizedNodeTest.java
deleted file mode 100644 (file)
index d19c7aa..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
-
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadModules;
-import static org.opendaylight.yangtools.yang.data.codec.gson.retest.TestUtils.loadTextFile;
-
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-import com.google.gson.stream.JsonReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URISyntaxException;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.LoggingNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class StreamToNormalizedNodeTest {
-    private static final Logger LOG = LoggerFactory.getLogger(StreamToNormalizedNodeTest.class);
-    private static SchemaContext schemaContext;
-    private static String streamAsString;
-
-    @BeforeClass
-    public static void initialization() throws IOException, URISyntaxException, ReactorException {
-        schemaContext = loadModules("/complexjson/yang");
-        streamAsString = loadTextFile(new File(StreamToNormalizedNodeTest.class.getResource(
-                "/complexjson/complex-json.json").toURI()));
-    }
-
-    /**
-     * Demonstrates how to log events produced by a {@link JsonReader}.
-     *
-     * @throws IOException
-     */
-    @Test
-    public void ownStreamWriterImplementationDemonstration() throws IOException {
-        // GSON's JsonReader reading from the loaded string (our event source)
-        final JsonReader reader = new JsonReader(new StringReader(streamAsString));
-
-        // StreamWriter which outputs SLF4J events
-        final LoggingNormalizedNodeStreamWriter logWriter = new LoggingNormalizedNodeStreamWriter();
-
-        // JSON -> StreamWriter parser
-        try (final JsonParserStream jsonHandler = JsonParserStream.create(logWriter, schemaContext)) {
-            // Process multiple readers, flush()/close() as needed
-            jsonHandler.parse(reader);
-        }
-    }
-
-    /**
-     * Demonstrates how to create an immutable NormalizedNode tree from a {@link JsonReader} and
-     * then writes the data back into string representation.
-     *
-     * @throws IOException
-     */
-    @Ignore
-    @Test
-    public void immutableNormalizedNodeStreamWriterDemonstration() throws IOException {
-        /*
-         * This is the parsing part
-         */
-        // This is where we will output the nodes
-        NormalizedNodeResult result = new NormalizedNodeResult();
-
-        // StreamWriter which attaches NormalizedNode under parent
-        final NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-
-        // JSON -> StreamWriter parser
-        try (JsonParserStream handler = JsonParserStream.create(streamWriter, schemaContext)) {
-            handler.parse(new JsonReader(new StringReader(streamAsString)));
-        }
-
-        // Finally build the node
-        final NormalizedNode<?, ?> parsedData = result.getResult();
-        LOG.debug("Parsed NormalizedNodes: {}", parsedData);
-
-        /*
-         * This is the serialization part.
-         */
-        // We want to write the first child out
-        final DataContainerChild<? extends PathArgument, ?> firstChild = (DataContainerChild<? extends PathArgument, ?>) parsedData;
-        LOG.debug("Serializing first child: {}", firstChild);
-
-        // String holder
-        final StringWriter writer = new StringWriter();
-
-        // StreamWriter which outputs JSON strings
-        // StreamWriter which outputs JSON strings
-        final NormalizedNodeStreamWriter jsonStream = JSONNormalizedNodeStreamWriter.
-                createExclusiveWriter(JSONCodecFactory.create(schemaContext), SchemaPath.ROOT, null,
-                    JsonWriterFactory.createJsonWriter(writer, 2));
-
-        // NormalizedNode -> StreamWriter
-        final NormalizedNodeWriter nodeWriter = NormalizedNodeWriter.forStreamWriter(jsonStream);
-
-        // Write multiple NormalizedNodes fluently, flush()/close() as needed
-        nodeWriter.write(firstChild).close();
-
-        // Just to put it somewhere
-        LOG.debug("Serialized JSON: {}", writer.toString());
-    }
-
-}
diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/TestUtils.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/TestUtils.java
deleted file mode 100644 (file)
index ed539d7..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
-
-import static org.junit.Assert.assertTrue;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import com.google.gson.JsonPrimitive;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-public class TestUtils {
-
-    private TestUtils() {
-    }
-
-    static SchemaContext loadModules(final String resourceDirectory) throws IOException, URISyntaxException,
-            ReactorException {
-        URI path = StreamToNormalizedNodeTest.class.getResource(resourceDirectory).toURI();
-        final File testDir = new File(path);
-        final String[] fileList = testDir.list();
-        final List<File> testFiles = new ArrayList<>();
-        if (fileList == null) {
-            throw new FileNotFoundException(resourceDirectory);
-        }
-        for (String fileName : fileList) {
-            if (!new File(testDir, fileName).isDirectory()) {
-                testFiles.add(new File(testDir, fileName));
-            }
-        }
-        return RetestUtils.parseYangSources(testFiles);
-    }
-
-    static String loadTextFile(final File file) throws IOException {
-        FileReader fileReader = new FileReader(file);
-        BufferedReader bufReader = new BufferedReader(fileReader);
-
-        String line = null;
-        StringBuilder result = new StringBuilder();
-        while ((line = bufReader.readLine()) != null) {
-            result.append(line);
-        }
-        bufReader.close();
-        return result.toString();
-    }
-
-    static String loadTextFile(final String relativePath) throws IOException, URISyntaxException {
-        return loadTextFile(new File(TestUtils.class.getResource(relativePath).toURI()));
-    }
-
-    static JsonObject childObject(final JsonObject jsonObject, final String... names) {
-        for (String name : names) {
-            JsonObject childJsonObject = jsonObject.getAsJsonObject(name);
-            if (childJsonObject != null) {
-                return childJsonObject;
-            }
-        }
-        return null;
-    }
-
-    static JsonPrimitive childPrimitive(final JsonObject jsonObject, final String... names) {
-        for (String name : names) {
-            JsonPrimitive childJsonPrimitive = jsonObject.getAsJsonPrimitive(name);
-            if (childJsonPrimitive != null) {
-                return childJsonPrimitive;
-            }
-        }
-        return null;
-    }
-
-    static JsonArray childArray(final JsonObject jsonObject, final String... names) {
-        for (String name : names) {
-            JsonArray childJsonArray = jsonObject.getAsJsonArray(name);
-            if (childJsonArray != null) {
-                return childJsonArray;
-            }
-        }
-        return null;
-    }
-
-    static JsonObject resolveCont1(String jsonOutput) {
-        JsonParser parser = new JsonParser();
-        JsonElement rootElement = parser.parse(jsonOutput);
-        assertTrue(rootElement.isJsonObject());
-        JsonObject rootObject = rootElement.getAsJsonObject();
-        JsonObject cont1 = childObject(rootObject, "complexjson:cont1", "cont1");
-        return cont1;
-    }
-
-}
diff --git a/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/TestingNormalizedNodeStructuresCreator.java b/yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/retest/TestingNormalizedNodeStructuresCreator.java
deleted file mode 100644 (file)
index 52f7bd7..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.codec.gson.retest;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import java.util.HashMap;
-import java.util.Map;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
-import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
-
-public class TestingNormalizedNodeStructuresCreator {
-
-    @SafeVarargs
-    static NormalizedNode<?, ?> cont1Node(
-            final DataContainerChild<? extends PathArgument, ?>... children) {
-        DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> cont1 = Builders.containerBuilder();
-        cont1.withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "cont1")));
-
-        cont1.withValue(Lists.newArrayList(children));
-        return cont1.build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> lst12Node() {
-        CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> lst12Builder = Builders.unkeyedListBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lst12")));
-        lst12Builder.withChild(lst12Entry1Node());
-        return lst12Builder.build();
-    }
-
-    private static UnkeyedListEntryNode lst12Entry1Node() {
-        DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> lst12Entry1Builder = Builders
-                .unkeyedListEntryBuilder();
-        lst12Entry1Builder
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lst12")));
-        lst12Entry1Builder.withChild(Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf121")))
-                .withValue("lf121 value").build());
-        return lst12Entry1Builder.build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> choc12Node() {
-        DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choc12Builder = Builders.choiceBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "choc12")));
-
-        choc12Builder.withChild(lf17Node());
-        return choc12Builder.build();
-    }
-
-    protected static LeafNode<Object> lf17Node() {
-        return Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf17")))
-                .withValue("lf17 value").build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> externalAugmentC11AWithLf15_11AndLf15_12Node() {
-        DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> augmentationBuilder = Builders
-                .augmentationBuilder();
-        augmentationBuilder.withNodeIdentifier(new AugmentationIdentifier(Sets.newHashSet(
-                QName.create("ns:complex:json:augmentation", "2014-08-14", "lf15_11"),
-                QName.create("ns:complex:json:augmentation", "2014-08-14", "lf15_12"))));
-        augmentationBuilder.withChild(lf15_11NodeExternal());
-        augmentationBuilder.withChild(lf15_12NodeExternal());
-        return augmentationBuilder.build();
-    }
-
-    private static LeafNode<Object> lf15_12NodeExternal() {
-        return Builders
-                .leafBuilder()
-                .withNodeIdentifier(
-                        new NodeIdentifier(QName.create("ns:complex:json:augmentation", "2014-08-14", "lf15_12")))
-                .withValue("lf15_12 value from augmentation").build();
-    }
-
-    private static LeafNode<Object> lf15_11NodeExternal() {
-        return Builders
-                .leafBuilder()
-                .withNodeIdentifier(
-                        new NodeIdentifier(QName.create("ns:complex:json:augmentation", "2014-08-14", "lf15_11")))
-                .withValue("lf15_11 value from augmentation").build();
-    }
-
-    @SafeVarargs
-    private static DataContainerChild<? extends PathArgument, ?> choc11Node(
-            final DataContainerChild<? extends PathArgument, ?>... children) {
-        DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choc11Builder = Builders.choiceBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "choc11")));
-        choc11Builder.withValue(Lists.newArrayList(children));
-        // choc11Builder.addChild(lf13Node());
-        // choc11Builder.addChild(augmentChoc11_c11A_lf1511AndLf1512Children());
-        // choc11Builder.addChild(augmentChoc11_c11_lf1521Children());
-        return choc11Builder.build();
-    }
-
-    private static LeafNode<Object> lf13Node() {
-        return Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf13")))
-                .withValue("lf13 value").build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> augmentC11AWithLf15_21Node() {
-        DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> choc11_c11AugmentBuilder = Builders
-                .augmentationBuilder();
-        choc11_c11AugmentBuilder.withNodeIdentifier(new AugmentationIdentifier(Sets.newHashSet(QName.create(
-                "ns:complex:json", "2014-08-11", "lf15_21"))));
-
-        choc11_c11AugmentBuilder.withChild(lf15_21Node());
-        return choc11_c11AugmentBuilder.build();
-    }
-
-    private static LeafNode<Object> lf15_21Node() {
-        return Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf15_21")))
-                .withValue("lf15_21 value").build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> augmentC11AWithLf15_11AndLf15_12Node() {
-        DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> choc11_c11AugmentBuilder = Builders
-                .augmentationBuilder();
-        choc11_c11AugmentBuilder.withNodeIdentifier(new AugmentationIdentifier(Sets.newHashSet(
-                QName.create("ns:complex:json", "2014-08-11", "lf15_11"),
-                QName.create("ns:complex:json", "2014-08-11", "lf15_12"))));
-        choc11_c11AugmentBuilder.withChild(lf15_11Node());
-        choc11_c11AugmentBuilder.withChild(lf15_12Node());
-        return choc11_c11AugmentBuilder.build();
-    }
-
-    private static LeafNode<Object> lf15_12Node() {
-        return Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf15_12")))
-                .withValue(QName.create("ns:complex:json", "2014-08-11", "lf11")).build();
-    }
-
-    private static LeafNode<Object> lf15_11Node() {
-        return Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf15_11")))
-                .withValue(Sets.newHashSet("one", "two")).build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> lf12_1Node() {
-        DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> augmentBuilder = Builders
-                .augmentationBuilder().withNodeIdentifier(
-                        new AugmentationIdentifier(Sets.newHashSet(
-                                QName.create("ns:complex:json", "2014-08-11", "lf12_1"),
-                                QName.create("ns:complex:json", "2014-08-11", "lf12_2"))));
-        augmentBuilder.withChild(Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf12_1")))
-                .withValue("lf12 value").build());
-        return augmentBuilder.build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> childLst11() {
-        CollectionNodeBuilder<MapEntryNode, MapNode> lst11 = Builders.mapBuilder().withNodeIdentifier(
-                new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lst11")));
-
-        DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> lst11Entry1Builder = Builders
-                .mapEntryBuilder();
-
-        Map<QName, Object> key = new HashMap<>();
-        key.put(QName.create("ns:complex:json", "2014-08-11", "key111"), "key111 value");
-        key.put(QName.create("ns:complex:json", "2014-08-11", "lf111"), "lf111 value");
-
-        lst11Entry1Builder.withNodeIdentifier(new NodeIdentifierWithPredicates(QName.create("ns:complex:json",
-                "2014-08-11", "lst11"), key));
-        lst11Entry1Builder.withChild(Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "key111")))
-                .withValue("key111 value").build());
-        lst11Entry1Builder.withChild(Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf112")))
-                .withValue(lf112Value()).build());
-        lst11Entry1Builder.withChild(Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf113")))
-                .withValue("lf113 value").build());
-        lst11Entry1Builder.withChild(Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf111")))
-                .withValue("lf111 value").build());
-        lst11.withChild(lst11Entry1Builder.build());
-        return lst11.build();
-    }
-
-    private static Object lf112Value() {
-        return YangInstanceIdentifier.create(
-                new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "cont1")),
-                new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lflst11")),
-                new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"),"foo")
-        );
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> childLflst11() {
-        ListNodeBuilder<Object, LeafSetEntryNode<Object>> lflst11 = Builders.leafSetBuilder().withNodeIdentifier(
-                new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lflst11")));
-        lflst11.withChild(Builders
-                .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value1"))
-                .withValue("lflst11 value1").build());
-        lflst11.withChild(Builders
-                .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value2"))
-                .withValue("lflst11 value2").build());
-        return lflst11.build();
-    }
-
-    private static DataContainerChild<? extends PathArgument, ?> childLflst11Multiline() {
-        ListNodeBuilder<Object, LeafSetEntryNode<Object>> lflst11 = Builders.leafSetBuilder().withNodeIdentifier(
-                new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lflst11")));
-        lflst11.withChild(Builders
-                .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value1\nanother line 1"))
-                .withValue("lflst11 value1\nanother line 1").build());
-        lflst11.withChild(Builders
-                .leafSetEntryBuilder()
-                .withNodeIdentifier(
-                        new NodeWithValue<>(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value2\r\nanother line 2"))
-                .withValue("lflst11 value2\r\nanother line 2").build());
-        return lflst11.build();
-    }
-
-    public static NormalizedNode<?, ?> leafNodeInContainer() {
-        LeafNode<Object> lf11 = Builders.leafBuilder()
-                .withNodeIdentifier(new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lf11")))
-                .withValue(453).build();
-        return cont1Node(lf11);
-    }
-
-    public static NormalizedNode<?, ?> leafListNodeInContainer() {
-        return cont1Node(childLflst11());
-    }
-    public static NormalizedNode<?, ?> leafListNodeInContainerMultiline() {
-        return cont1Node(childLflst11Multiline());
-    }
-
-    public static NormalizedNode<?, ?> keyedListNodeInContainer() {
-        return cont1Node(childLst11());
-    }
-
-    public static NormalizedNode<?, ?> leafNodeViaAugmentationInContainer() {
-        return cont1Node(lf12_1Node());
-    }
-
-    public static NormalizedNode<?, ?> choiceNodeInContainer() {
-        return cont1Node(choc11Node(lf13Node()));
-    }
-
-    /**
-     * choc11 contains lf13, lf15_11 and lf15_12 are added via external augmentation
-     *
-     * @return
-     */
-    public static NormalizedNode<?, ?> caseNodeAugmentationInChoiceInContainer() {
-        return cont1Node(choc11Node(augmentC11AWithLf15_11AndLf15_12Node(), lf13Node(), augmentC11AWithLf15_21Node()));
-    }
-
-    public static NormalizedNode<?, ?> caseNodeExternalAugmentationInChoiceInContainer() {
-        return cont1Node(choc11Node(lf13Node(), augmentC11AWithLf15_11AndLf15_12Node(), externalAugmentC11AWithLf15_11AndLf15_12Node()));
-    }
-
-    public static NormalizedNode<?, ?> choiceNodeAugmentationInContainer() {
-        return cont1Node(choc12Node());
-    }
-
-    public static NormalizedNode<?, ?> unkeyedNodeInContainer() {
-        return cont1Node(lst12Node());
-    }
-
-    public static NormalizedNode<?, ?> topLevelContainer() {
-        return cont1Node();
-    }
-}
similarity index 97%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/RetestUtils.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/TestUtils.java
index 9e68b4e9971cf1f39a8f623525fe05fd1b727527..a09f17d4a259593c6f30adad5e717ab3ab446e81 100644 (file)
@@ -22,9 +22,9 @@ import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementR
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 
-public class RetestUtils {
+public class TestUtils {
 
-    private RetestUtils() {
+    private TestUtils() {
         throw new UnsupportedOperationException("Utility class");
     }
 
index 3cf1b9b6a16c5755d08b123f88b29086c5a855fd..3ab0ecc0387a76385f22c98f2793ed22be143b12 100644 (file)
@@ -1,39 +1,43 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.yangtools.yang.data.impl.codec.xml;
 
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 import com.google.common.base.Charsets;
-import com.google.common.collect.Lists;
-import com.google.common.io.ByteSource;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
 public class Bug2964Test {
 
-    public static final String XML_CONTENT = "<cont2 xmlns=\"urn:opendaylight:yangtools:leafref:test\">\n" +
-            "<point-to-identityrefleaf>test-identity</point-to-identityrefleaf>\n" +
-            "</cont2>";
+    public static final String XML_CONTENT = "<cont2 xmlns=\"urn:opendaylight:yangtools:leafref:test\">\n"
+            + "<point-to-identityrefleaf>test-identity</point-to-identityrefleaf>\n" + "</cont2>";
 
     private static final DocumentBuilderFactory BUILDERFACTORY;
 
@@ -55,13 +59,8 @@ public class Bug2964Test {
 
     @Before
     public void setUp() throws Exception {
-        final ByteSource byteSource = new ByteSource() {
-            @Override
-            public InputStream openStream() throws IOException {
-                return Bug2964Test.this.getClass().getResourceAsStream("/leafref-test.yang");
-            }
-        };
-        schema = new YangParserImpl().parseSources(Lists.newArrayList(byteSource));
+        File leafRefTestYang = new File(getClass().getResource("/leafref-test.yang").toURI());
+        schema = TestUtils.parseYangSources(leafRefTestYang);
     }
 
     public static Document readXmlToDocument(final String xmlContent) throws SAXException, IOException {
@@ -75,8 +74,7 @@ public class Bug2964Test {
         final Document document = readXmlToDocument(XML_CONTENT);
         final Element identityLeafRefElement = (Element) document.getDocumentElement().getFirstChild().getNextSibling();
 
-        final Module leafrefModule = schema.findModuleByNamespaceAndRevision(
-                namespaceUri, null);
+        final Module leafrefModule = schema.findModuleByNamespaceAndRevision(namespaceUri, null);
         final ContainerSchemaNode cont2 = (ContainerSchemaNode) leafrefModule.getDataChildByName(CONT_2);
         final DataSchemaNode identityLeafRefSchema = cont2.getDataChildByName(IDENTITY_LEAFREF);
         final Object parsedValue = DomUtils.parseXmlValue(identityLeafRefElement, DomUtils.defaultValueCodecProvider(),
index d6e412d4f3c9c3ad9baca27feff095c76b78f65d..935947f9f6187de022b5ee3d75dff06f986ba222 100644 (file)
@@ -19,7 +19,7 @@ import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.w3c.dom.Document;
@@ -40,7 +40,7 @@ public class InstanceIdentifierForXmlCodecTest {
     @Before
     public void setup() throws Exception {
         final File rpcTestYang = new File(getClass().getResource("iid-test.yang").toURI());
-        this.schemaContext = RetestUtils.parseYangSources(rpcTestYang);
+        this.schemaContext = TestUtils.parseYangSources(rpcTestYang);
 
         final YangInstanceIdentifier.NodeIdentifier container = new YangInstanceIdentifier.NodeIdentifier(
                 QName.create(InstanceIdentifierForXmlCodecTest.NS, InstanceIdentifierForXmlCodecTest.REVISION, "cont"));
index 99a32465a19f7a8eb64f58f2526d6bb3f96bd50a..dc86f82ea7b9f63cb54a78d5d4849f702edcfe8e 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.ModifyAction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
@@ -80,7 +80,7 @@ public class XmlDocumentUtilsTest {
         final File rpcTestYang1 = new File(getClass().getResource("xml-doc-test.yang").toURI());
         final File rpcTestYang2 = new File(getClass().getResource("xml-doc-test2.yang").toURI());
 
-        this.schema = RetestUtils.parseYangSources(rpcTestYang1, rpcTestYang2);
+        this.schema = TestUtils.parseYangSources(rpcTestYang1, rpcTestYang2);
     }
 
     public static Document readXmlToDocument(final String xmlContent) throws SAXException, IOException {
index 50dab8e3a296e5a88fca19e277b71dd845a088d6..a27595b32ee279f11c5d37b6958b0578c45cbe60 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -17,10 +17,10 @@ import com.google.common.base.Optional;
 import com.google.common.collect.Maps;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.AbstractMap;
-import java.util.Collections;
 import java.util.Date;
 import java.util.Map;
 import java.util.regex.Matcher;
@@ -34,6 +34,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
@@ -44,7 +45,7 @@ import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefi
 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.w3c.dom.Document;
 
 public class XmlStreamUtilsTest {
@@ -55,21 +56,19 @@ public class XmlStreamUtilsTest {
     private static Module leafRefModule;
 
     @BeforeClass
-    public static void initialize() throws URISyntaxException {
-        final YangParserImpl yangParser = new YangParserImpl();
-        final File file = new File(XmlStreamUtils.class.getResource("/leafref-test.yang").toURI());
-        schemaContext = yangParser.parseFiles(Collections.singletonList(file));
+    public static void initialize() throws URISyntaxException, FileNotFoundException, ReactorException {
+        final File file = new File(org.opendaylight.yangtools.yang.data.impl.codec.xml.retest.XmlStreamUtils.class.getResource("/leafref-test.yang").toURI());
+        schemaContext = TestUtils.parseYangSources(file);
         assertNotNull(schemaContext);
-        assertEquals(1,schemaContext.getModules().size());
+        assertEquals(1, schemaContext.getModules().size());
         leafRefModule = schemaContext.getModules().iterator().next();
         assertNotNull(leafRefModule);
     }
 
-
     @Test
     public void testWriteAttribute() throws Exception {
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        final XMLStreamWriter writer =  XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
+        final XMLStreamWriter writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
         writer.writeStartElement("element");
 
         QName name = getAttrQName("namespace", "2012-12-12", "attr", Optional.of("prefix"));
@@ -92,7 +91,8 @@ public class XmlStreamUtilsTest {
         assertEquals(2, mappedPrefixes.size());
         final String randomPrefixValue = mappedPrefixes.get("namespace2");
 
-        final String expectedXmlAsString = "<element xmlns:a=\"namespace\" a:attr=\"value\" xmlns:" + randomPrefixValue + "=\"namespace2\" " + randomPrefixValue + ":attr=\"value\"></element>";
+        final String expectedXmlAsString = "<element xmlns:a=\"namespace\" a:attr=\"value\" xmlns:" + randomPrefixValue
+                + "=\"namespace2\" " + randomPrefixValue + ":attr=\"value\"></element>";
 
         XMLUnit.setIgnoreAttributeOrder(true);
         final Document control = XMLUnit.buildControlDocument(expectedXmlAsString);
@@ -106,7 +106,7 @@ public class XmlStreamUtilsTest {
     @Test
     public void testWriteIdentityRef() throws Exception {
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        final XMLStreamWriter writer =  XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
+        final XMLStreamWriter writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
 
         writer.writeStartElement("element");
         final QNameModule parent = QNameModule.create(URI.create("parent:uri"), new Date());
@@ -149,7 +149,8 @@ public class XmlStreamUtilsTest {
     /**
      * Tests relative path with double point inside path (e. g. "../../lf:interface/../lf:cont2/lf:stringleaf")
      */
-    @Ignore //ignored because this isn't implemented
+    @Ignore
+    // ignored because this isn't implemented
     @Test
     public void testLeafRefWithDoublePointInPath() {
         getTargetNodeForLeafRef("lf-with-double-point-inside", StringTypeDefinition.class);
@@ -169,7 +170,8 @@ public class XmlStreamUtilsTest {
         assertNotNull(schemaNode);
         final LeafrefTypeDefinition leafrefTypedef = findLeafrefType(schemaNode);
         assertNotNull(leafrefTypedef);
-        final TypeDefinition<?> targetBaseType = SchemaContextUtil.getBaseTypeForLeafRef(leafrefTypedef, schemaContext, schemaNode);
+        final TypeDefinition<?> targetBaseType = SchemaContextUtil.getBaseTypeForLeafRef(leafrefTypedef, schemaContext,
+                schemaNode);
         assertTrue("Wrong class found.", clas.isInstance(targetBaseType));
         return targetBaseType;
     }
@@ -182,7 +184,8 @@ public class XmlStreamUtilsTest {
         return mappedPrefixes;
     }
 
-    private static QName getAttrQName(final String namespace, final String revision, final String localName, final Optional<String> prefix) {
+    private static QName getAttrQName(final String namespace, final String revision, final String localName,
+            final Optional<String> prefix) {
         if (prefix.isPresent()) {
             final QName moduleQName = QName.create(namespace, revision, "module");
             final QNameModule module = QNameModule.create(moduleQName.getNamespace(), moduleQName.getRevision());
@@ -195,14 +198,15 @@ public class XmlStreamUtilsTest {
     private LeafSchemaNode findSchemaNodeWithLeafrefType(final DataNodeContainer module, final String nodeName) {
         for (final DataSchemaNode childNode : module.getChildNodes()) {
             if (childNode instanceof DataNodeContainer) {
-                LeafSchemaNode leafrefFromRecursion = findSchemaNodeWithLeafrefType((DataNodeContainer)childNode, nodeName);
+                LeafSchemaNode leafrefFromRecursion = findSchemaNodeWithLeafrefType((DataNodeContainer) childNode,
+                        nodeName);
                 if (leafrefFromRecursion != null) {
                     return leafrefFromRecursion;
                 }
             } else if (childNode.getQName().getLocalName().equals(nodeName) && childNode instanceof LeafSchemaNode) {
-                final TypeDefinition<?> leafSchemaNodeType = ((LeafSchemaNode)childNode).getType();
+                final TypeDefinition<?> leafSchemaNodeType = ((LeafSchemaNode) childNode).getType();
                 if (leafSchemaNodeType instanceof LeafrefTypeDefinition) {
-                    return (LeafSchemaNode)childNode;
+                    return (LeafSchemaNode) childNode;
                 }
             }
         }
@@ -212,7 +216,7 @@ public class XmlStreamUtilsTest {
     private static LeafrefTypeDefinition findLeafrefType(final LeafSchemaNode schemaNode) {
         final TypeDefinition<?> type = schemaNode.getType();
         if (type instanceof LeafrefTypeDefinition) {
-            return (LeafrefTypeDefinition)type;
+            return (LeafrefTypeDefinition) type;
         }
         return null;
     }
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/Bug2964Test.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/Bug2964Test.java
deleted file mode 100644 (file)
index 329ac4e..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.impl.codec.xml.retest;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import com.google.common.base.Charsets;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-public class Bug2964Test {
-
-    public static final String XML_CONTENT = "<cont2 xmlns=\"urn:opendaylight:yangtools:leafref:test\">\n"
-            + "<point-to-identityrefleaf>test-identity</point-to-identityrefleaf>\n" + "</cont2>";
-
-    private static final DocumentBuilderFactory BUILDERFACTORY;
-
-    private static final String NAMESPACE = "urn:opendaylight:yangtools:leafref:test";
-    private static final String TEST_IDENTITY = "test-identity";
-    private static final String CONT_2 = "cont2";
-    private static final String IDENTITY_LEAFREF = "point-to-identityrefleaf";
-
-    static {
-        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(true);
-        factory.setCoalescing(true);
-        factory.setIgnoringElementContentWhitespace(true);
-        factory.setIgnoringComments(true);
-        BUILDERFACTORY = factory;
-    }
-
-    private SchemaContext schema;
-
-    @Before
-    public void setUp() throws Exception {
-        File leafRefTestYang = new File(getClass().getResource("/leafref-test.yang").toURI());
-        schema = RetestUtils.parseYangSources(leafRefTestYang);
-    }
-
-    public static Document readXmlToDocument(final String xmlContent) throws SAXException, IOException {
-        return readXmlToDocument(new ByteArrayInputStream(xmlContent.getBytes(Charsets.UTF_8)));
-    }
-
-    @Test
-    public void testLeafrefIdentityRefDeserialization() throws Exception {
-        final URI namespaceUri = new URI(NAMESPACE);
-
-        final Document document = readXmlToDocument(XML_CONTENT);
-        final Element identityLeafRefElement = (Element) document.getDocumentElement().getFirstChild().getNextSibling();
-
-        final Module leafrefModule = schema.findModuleByNamespaceAndRevision(namespaceUri, null);
-        final ContainerSchemaNode cont2 = (ContainerSchemaNode) leafrefModule.getDataChildByName(CONT_2);
-        final DataSchemaNode identityLeafRefSchema = cont2.getDataChildByName(IDENTITY_LEAFREF);
-        final Object parsedValue = DomUtils.parseXmlValue(identityLeafRefElement, DomUtils.defaultValueCodecProvider(),
-                identityLeafRefSchema, ((LeafSchemaNode) identityLeafRefSchema).getType(), schema);
-
-        assertThat(parsedValue, instanceOf(QName.class));
-        final QName parsedQName = (QName) parsedValue;
-        assertEquals(namespaceUri, parsedQName.getNamespace());
-        assertEquals(TEST_IDENTITY, parsedQName.getLocalName());
-    }
-
-    public static Document readXmlToDocument(final InputStream xmlContent) throws SAXException, IOException {
-        final DocumentBuilder dBuilder;
-        try {
-            dBuilder = BUILDERFACTORY.newDocumentBuilder();
-        } catch (final ParserConfigurationException e) {
-            throw new IllegalStateException("Failed to parse XML document", e);
-        }
-        final Document doc = dBuilder.parse(xmlContent);
-
-        doc.getDocumentElement().normalize();
-        return doc;
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/RandomPrefixTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/RandomPrefixTest.java
deleted file mode 100644 (file)
index 257a954..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.codec.xml.retest;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import java.net.URI;
-import java.util.Date;
-import java.util.List;
-import org.hamcrest.CoreMatchers;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-
-public class RandomPrefixTest {
-    static final int MAX_COUNTER = 4000;
-
-    @Test
-    public void testEncodeDecode() throws Exception {
-
-        final List<String> allGenerated = Lists.newArrayList();
-        for (int i = 0; i < MAX_COUNTER; i++) {
-            final String encoded = RandomPrefix.encode(i);
-            assertEquals(RandomPrefix.decode(encoded), i);
-            allGenerated.add(encoded);
-        }
-
-        assertEquals(allGenerated.size(), MAX_COUNTER);
-        assertEquals("dPT", allGenerated.get(MAX_COUNTER - 1));
-        assertEquals("a", allGenerated.get(0));
-        assertEquals(allGenerated.size(), Sets.newHashSet(allGenerated).size());
-    }
-
-    @Test
-    public void testQNameWithPrefix() throws Exception {
-        final RandomPrefix a = new RandomPrefix();
-
-        final List<String> allGenerated = Lists.newArrayList();
-        for (int i = 0; i < MAX_COUNTER; i++) {
-            final String prefix = RandomPrefix.encode(i);
-            final URI uri = new URI("localhost:" + prefix);
-            final QName qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
-            allGenerated.add(a.encodePrefix(qName.getNamespace()));
-        }
-
-        assertEquals(MAX_COUNTER, allGenerated.size());
-        // We are generating MAX_COUNTER_VALUE + 27 prefixes total, so we should encounter a reset in prefix a start
-        // from 0 at some point
-        // At the end, there should be only 27 values in RandomPrefix cache
-        assertEquals(MAX_COUNTER, Iterables.size(a.getPrefixes()));
-        assertThat(allGenerated, CoreMatchers.not(CoreMatchers.hasItem("xml")));
-        assertThat(allGenerated, CoreMatchers.not(CoreMatchers.hasItem("xmla")));
-        assertThat(allGenerated, CoreMatchers.not(CoreMatchers.hasItem("xmlz")));
-
-        assertEquals(1, Iterables.frequency(allGenerated, "a"));
-    }
-
-    @Test
-    public void test2QNames1Namespace() throws Exception {
-        final RandomPrefix a = new RandomPrefix();
-
-        final URI uri = URI.create("localhost");
-        final QName qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
-        final QName qName2 = QName.create(QNameModule.create(uri, new Date()), "local-name");
-
-        assertEquals(a.encodePrefix(qName.getNamespace()), a.encodePrefix(qName2.getNamespace()));
-    }
-
-    @Test
-    public void testQNameNoPrefix() throws Exception {
-        final RandomPrefix a = new RandomPrefix();
-
-        final URI uri = URI.create("localhost");
-        QName qName = QName.create(uri, new Date(), "local-name");
-        assertEquals("a", a.encodePrefix(qName.getNamespace()));
-        qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
-        assertEquals("a", a.encodePrefix(qName.getNamespace()));
-        qName = QName.create(QNameModule.create(URI.create("second"), new Date()), "local-name");
-        assertEquals("b", a.encodePrefix(qName.getNamespace()));
-
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/XmlDocumentUtilsTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/XmlDocumentUtilsTest.java
deleted file mode 100644 (file)
index 319b4bc..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.impl.codec.xml.retest;
-
-import com.google.common.base.Charsets;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.junit.Before;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-public class XmlDocumentUtilsTest {
-
-    private static final DocumentBuilderFactory BUILDERFACTORY;
-
-    static {
-        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(true);
-        factory.setCoalescing(true);
-        factory.setIgnoringElementContentWhitespace(true);
-        factory.setIgnoringComments(true);
-        BUILDERFACTORY = factory;
-    }
-
-    public static final String XML_CONTENT = "<input xmlns=\"urn:opendaylight:controller:rpc:test\">\n"
-            + "<a>value</a>\n" + "<ref xmlns:ltha=\"urn:opendaylight:controller:rpc:test\">"
-            + "/ltha:cont/ltha:l[  ltha:id='id/foo/bar'  ]" + "</ref>\n" + "</input>";
-
-    public static final String RPC_REPLY = "<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" message-id=\"m-1\">\n"
-            + " <ok/>\n" + "</rpc-reply>";
-
-    private SchemaContext schema;
-    private RpcDefinition testRpc;
-
-    @Before
-    public void setUp() throws Exception {
-        File rpcTestYang = new File(getClass().getResource("/rpc-test.yang").toURI());
-        schema = RetestUtils.parseYangSources(rpcTestYang);
-        final Module rpcTestModule = schema.getModules().iterator().next();
-        testRpc = rpcTestModule.getRpcs().iterator().next();
-    }
-
-    public static Document readXmlToDocument(final String xmlContent) throws SAXException, IOException {
-        return readXmlToDocument(new ByteArrayInputStream(xmlContent.getBytes(Charsets.UTF_8)));
-    }
-
-    public static Document readXmlToDocument(final InputStream xmlContent) throws SAXException, IOException {
-        final DocumentBuilder dBuilder;
-        try {
-            dBuilder = BUILDERFACTORY.newDocumentBuilder();
-        } catch (final ParserConfigurationException e) {
-            throw new IllegalStateException("Failed to parse XML document", e);
-        }
-        final Document doc = dBuilder.parse(xmlContent);
-
-        doc.getDocumentElement().normalize();
-        return doc;
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/XmlStreamUtilsTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/xml/retest/XmlStreamUtilsTest.java
deleted file mode 100644 (file)
index 457ea43..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.impl.codec.xml.retest;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import com.google.common.base.Optional;
-import com.google.common.collect.Maps;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.AbstractMap;
-import java.util.Date;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.w3c.dom.Document;
-
-public class XmlStreamUtilsTest {
-
-    public static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newFactory();
-
-    private static SchemaContext schemaContext;
-    private static Module leafRefModule;
-
-    @BeforeClass
-    public static void initialize() throws URISyntaxException, FileNotFoundException, ReactorException {
-        final File file = new File(XmlStreamUtils.class.getResource("/leafref-test.yang").toURI());
-        schemaContext = RetestUtils.parseYangSources(file);
-        assertNotNull(schemaContext);
-        assertEquals(1, schemaContext.getModules().size());
-        leafRefModule = schemaContext.getModules().iterator().next();
-        assertNotNull(leafRefModule);
-    }
-
-    @Test
-    public void testWriteAttribute() throws Exception {
-        final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        final XMLStreamWriter writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
-        writer.writeStartElement("element");
-
-        QName name = getAttrQName("namespace", "2012-12-12", "attr", Optional.of("prefix"));
-        final Map.Entry<QName, String> attributeEntry = new AbstractMap.SimpleEntry<>(name, "value");
-
-        name = getAttrQName("namespace2", "2012-12-12", "attr", Optional.absent());
-        final Map.Entry<QName, String> attributeEntryNoPrefix = new AbstractMap.SimpleEntry<>(name, "value");
-
-        final RandomPrefix randomPrefix = new RandomPrefix();
-        XmlStreamUtils.writeAttribute(writer, attributeEntry, randomPrefix);
-        XmlStreamUtils.writeAttribute(writer, attributeEntryNoPrefix, randomPrefix);
-
-        writer.writeEndElement();
-        writer.close();
-        out.close();
-
-        final String xmlAsString = new String(out.toByteArray());
-
-        final Map<String, String> mappedPrefixes = mapPrefixed(randomPrefix.getPrefixes());
-        assertEquals(2, mappedPrefixes.size());
-        final String randomPrefixValue = mappedPrefixes.get("namespace2");
-
-        final String expectedXmlAsString = "<element xmlns:a=\"namespace\" a:attr=\"value\" xmlns:" + randomPrefixValue
-                + "=\"namespace2\" " + randomPrefixValue + ":attr=\"value\"></element>";
-
-        XMLUnit.setIgnoreAttributeOrder(true);
-        final Document control = XMLUnit.buildControlDocument(expectedXmlAsString);
-        final Document test = XMLUnit.buildTestDocument(xmlAsString);
-        final Diff diff = XMLUnit.compareXML(control, test);
-
-        final boolean identical = diff.identical();
-        assertTrue("Xml differs: " + diff.toString(), identical);
-    }
-
-    @Test
-    public void testWriteIdentityRef() throws Exception {
-        final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        final XMLStreamWriter writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(out);
-
-        writer.writeStartElement("element");
-        final QNameModule parent = QNameModule.create(URI.create("parent:uri"), new Date());
-        XmlStreamUtils.write(writer, null, QName.create(parent, "identity"), Optional.of(parent));
-        writer.writeEndElement();
-
-        writer.writeStartElement("elementDifferent");
-        XmlStreamUtils.write(writer, null, QName.create("different:namespace", "identity"), Optional.of(parent));
-        writer.writeEndElement();
-
-        writer.close();
-        out.close();
-
-        final String xmlAsString = new String(out.toByteArray()).replaceAll("\\s*", "");
-        assertThat(xmlAsString, containsString("element>identity"));
-
-        final Pattern prefixedIdentityPattern = Pattern.compile(".*\"different:namespace\">(.*):identity.*");
-        final Matcher matcher = prefixedIdentityPattern.matcher(xmlAsString);
-        assertTrue("Xml: " + xmlAsString + " should match: " + prefixedIdentityPattern, matcher.matches());
-    }
-
-    /**
-     * One leafref reference to other leafref via relative references
-     */
-    @Test
-    public void testLeafRefRelativeChaining() {
-        getTargetNodeForLeafRef("leafname3", StringTypeDefinition.class);
-    }
-
-    @Test
-    public void testLeafRefRelative() {
-        getTargetNodeForLeafRef("pointToStringLeaf", StringTypeDefinition.class);
-    }
-
-    @Test
-    public void testLeafRefAbsoluteWithSameTarget() {
-        getTargetNodeForLeafRef("absname", InstanceIdentifierTypeDefinition.class);
-    }
-
-    /**
-     * Tests relative path with double point inside path (e. g. "../../lf:interface/../lf:cont2/lf:stringleaf")
-     */
-    @Ignore
-    // ignored because this isn't implemented
-    @Test
-    public void testLeafRefWithDoublePointInPath() {
-        getTargetNodeForLeafRef("lf-with-double-point-inside", StringTypeDefinition.class);
-    }
-
-    @Test
-    public void testLeafRefRelativeAndAbsoluteWithSameTarget() {
-        final TypeDefinition<?> targetNodeForAbsname = getTargetNodeForLeafRef("absname",
-            InstanceIdentifierTypeDefinition.class);
-        final TypeDefinition<?> targetNodeForRelname = getTargetNodeForLeafRef("relname",
-            InstanceIdentifierTypeDefinition.class);
-        assertEquals(targetNodeForAbsname, targetNodeForRelname);
-    }
-
-    private TypeDefinition<?> getTargetNodeForLeafRef(final String nodeName, final Class<?> clas) {
-        final LeafSchemaNode schemaNode = findSchemaNodeWithLeafrefType(leafRefModule, nodeName);
-        assertNotNull(schemaNode);
-        final LeafrefTypeDefinition leafrefTypedef = findLeafrefType(schemaNode);
-        assertNotNull(leafrefTypedef);
-        final TypeDefinition<?> targetBaseType = SchemaContextUtil.getBaseTypeForLeafRef(leafrefTypedef, schemaContext,
-                schemaNode);
-        assertTrue("Wrong class found.", clas.isInstance(targetBaseType));
-        return targetBaseType;
-    }
-
-    private static Map<String, String> mapPrefixed(final Iterable<Map.Entry<URI, String>> prefixes) {
-        final Map<String, String> mappedPrefixes = Maps.newHashMap();
-        for (final Map.Entry<URI, String> prefix : prefixes) {
-            mappedPrefixes.put(prefix.getKey().toString(), prefix.getValue());
-        }
-        return mappedPrefixes;
-    }
-
-    private static QName getAttrQName(final String namespace, final String revision, final String localName,
-            final Optional<String> prefix) {
-        if (prefix.isPresent()) {
-            final QName moduleQName = QName.create(namespace, revision, "module");
-            final QNameModule module = QNameModule.create(moduleQName.getNamespace(), moduleQName.getRevision());
-            return QName.create(module, localName);
-        } else {
-            return QName.create(namespace, revision, localName);
-        }
-    }
-
-    private LeafSchemaNode findSchemaNodeWithLeafrefType(final DataNodeContainer module, final String nodeName) {
-        for (final DataSchemaNode childNode : module.getChildNodes()) {
-            if (childNode instanceof DataNodeContainer) {
-                LeafSchemaNode leafrefFromRecursion = findSchemaNodeWithLeafrefType((DataNodeContainer) childNode,
-                        nodeName);
-                if (leafrefFromRecursion != null) {
-                    return leafrefFromRecursion;
-                }
-            } else if (childNode.getQName().getLocalName().equals(nodeName) && childNode instanceof LeafSchemaNode) {
-                final TypeDefinition<?> leafSchemaNodeType = ((LeafSchemaNode) childNode).getType();
-                if (leafSchemaNodeType instanceof LeafrefTypeDefinition) {
-                    return (LeafSchemaNode) childNode;
-                }
-            }
-        }
-        return null;
-    }
-
-    private static LeafrefTypeDefinition findLeafrefType(final LeafSchemaNode schemaNode) {
-        final TypeDefinition<?> type = schemaNode.getType();
-        if (type instanceof LeafrefTypeDefinition) {
-            return (LeafrefTypeDefinition) type;
-        }
-        return null;
-    }
-}
similarity index 83%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/BinaryCodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BinaryCodecStringTest.java
index 74b65ba1fb3934ffe50c84114a5ed95f30cb3140..c5e4e9a4d429ac55a86f0c037fca777bc9743332 100644 (file)
@@ -1,17 +1,17 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
 
 import org.junit.Test;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 import org.opendaylight.yangtools.yang.data.api.codec.BinaryCodec;
 import org.opendaylight.yangtools.yang.model.util.BinaryType;
 
similarity index 64%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/BitsCodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BitsCodecStringTest.java
index fe1b029aeb294d267c3f0c1141db9c18ecdd8a3b..d39226729aeae765f25b694f8672e95f475875fd 100644 (file)
@@ -1,21 +1,17 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
 import java.util.Collections;
 import org.junit.Test;
 
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.toBitsTypeDefinition;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-
 import org.opendaylight.yangtools.yang.data.api.codec.BitsCodec;
 import com.google.common.collect.ImmutableSet;
 
@@ -31,7 +27,7 @@ public class BitsCodecStringTest {
     @Test
     public void testSerialize() {
 
-        BitsCodec<String> codec = getCodec( toBitsTypeDefinition( "foo" ), BitsCodec.class );
+        BitsCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( TypeDefinitionAwareCodecTestHelper.toBitsTypeDefinition( "foo" ), BitsCodec.class );
 
         ImmutableSet<String> toSerialize = ImmutableSet.of("foo", "bar");
 
@@ -49,13 +45,13 @@ public class BitsCodecStringTest {
     @Test
     public void testDeserialize() {
 
-        BitsCodec<String> codec = getCodec( toBitsTypeDefinition( "bit1", "bit2" ), BitsCodec.class );
+        BitsCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( TypeDefinitionAwareCodecTestHelper.toBitsTypeDefinition( "bit1", "bit2" ), BitsCodec.class );
 
         assertEquals("deserialize", ImmutableSet.of("bit1", "bit2"), codec.deserialize("  bit1 bit2     "));
 
         assertEquals("deserialize", Collections.emptySet(), codec.deserialize(""));
         assertEquals("deserialize", Collections.emptySet(), codec.deserialize(null));
 
-        deserializeWithExpectedIllegalArgEx(codec, "bit1 bit3");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "bit1 bit3");
     }
 }
@@ -1,20 +1,17 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
 
 import org.junit.Test;
 
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-
 import org.opendaylight.yangtools.yang.data.api.codec.BooleanCodec;
 import org.opendaylight.yangtools.yang.model.util.BooleanType;
 
@@ -28,7 +25,7 @@ public class BooleanCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        BooleanCodec<String> codec = getCodec( BooleanType.getInstance(), BooleanCodec.class);
+        BooleanCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( BooleanType.getInstance(), BooleanCodec.class);
 
         assertEquals( "serialize", "", codec.serialize( null ) );
         assertEquals( "serialize", "true", codec.serialize( true ) );
@@ -38,14 +35,14 @@ public class BooleanCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testDeserialize() {
-        BooleanCodec<String> codec = getCodec( BooleanType.getInstance(), BooleanCodec.class);
+        BooleanCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( BooleanType.getInstance(), BooleanCodec.class);
 
         assertEquals( "deserialize", Boolean.TRUE, codec.deserialize( "true" ) );
         assertEquals( "deserialize", Boolean.TRUE, codec.deserialize( "TRUE" ) );
         assertEquals( "deserialize", Boolean.FALSE, codec.deserialize( "FALSE" ) );
         assertEquals( "deserialize", Boolean.FALSE, codec.deserialize( "false" ) );
         assertEquals( "deserialize", null, codec.deserialize( null ) );
-        deserializeWithExpectedIllegalArgEx(codec, "foo");
-        deserializeWithExpectedIllegalArgEx(codec, "");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "foo");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "");
     }
 }
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
 import static org.mockito.Mockito.mock;
@@ -15,9 +15,6 @@ import java.math.BigDecimal;
 
 import org.junit.Test;
 
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-
 import org.opendaylight.yangtools.yang.data.api.codec.DecimalCodec;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.util.Decimal64;
@@ -32,7 +29,7 @@ public class DecimalCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        DecimalCodec<String> codec = getCodec( Decimal64.create( mock( SchemaPath.class ), 2 ), DecimalCodec.class );
+        DecimalCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( Decimal64.create( mock( SchemaPath.class ), 2 ), DecimalCodec.class );
 
         assertEquals( "serialize", "123.456", codec.serialize( new BigDecimal( "123.456" ) ) );
         assertEquals( "serialize", "", codec.serialize( null ) );
@@ -41,12 +38,12 @@ public class DecimalCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testDeserialize() {
-        DecimalCodec<String> codec = getCodec( Decimal64.create( mock( SchemaPath.class ), 2 ), DecimalCodec.class );
+        DecimalCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( Decimal64.create( mock( SchemaPath.class ), 2 ), DecimalCodec.class );
 
         assertEquals( "deserialize", new BigDecimal( "123.456" ), codec.deserialize( "123.456" ) );
 
-        deserializeWithExpectedIllegalArgEx( codec, "12o.3" );
-        deserializeWithExpectedIllegalArgEx( codec, "" );
-        deserializeWithExpectedIllegalArgEx( codec, null );
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx( codec, "12o.3" );
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx( codec, "" );
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx( codec, null );
     }
 }
similarity index 58%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/EmptyCodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/EmptyCodecStringTest.java
index 98d9bc0fcba5c3dc5607fddb5f939d839b1ba689..58162668065de4322520a4d15b891f58f93fb104 100644 (file)
@@ -1,18 +1,16 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
 
 import org.junit.Test;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
 import org.opendaylight.yangtools.yang.data.api.codec.EmptyCodec;
 import org.opendaylight.yangtools.yang.model.util.EmptyType;
 
@@ -26,7 +24,7 @@ public class EmptyCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        EmptyCodec<String> codec = getCodec( EmptyType.getInstance(), EmptyCodec.class);
+        EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( EmptyType.getInstance(), EmptyCodec.class);
 
         assertEquals( "serialize", "", codec.serialize( null ) );
     }
@@ -34,12 +32,12 @@ public class EmptyCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testDeserialize() {
-        EmptyCodec<String> codec = getCodec( EmptyType.getInstance(), EmptyCodec.class);
+        EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( EmptyType.getInstance(), EmptyCodec.class);
 
         assertEquals( "deserialize", null, codec.deserialize( "" ) );
         assertEquals( "deserialize", null, codec.deserialize( null ) );
 
-        deserializeWithExpectedIllegalArgEx( codec, "foo" );
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx( codec, "foo" );
     }
 
 }
similarity index 69%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/EnumCodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/EnumCodecStringTest.java
index 146d762cc16977e86ef72530c2f0b56eb3a1e802..6be2ddc88cb95bfdb88a623ca0275e22061d2553 100644 (file)
@@ -1,20 +1,20 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.EnumCodec;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.toEnumTypeDefinition;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.toEnumTypeDefinition;
 
 /**
  * Unit tests for EnumCodecString.
similarity index 82%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int16CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int16CodecStringTest.java
index 9d468596d7633f5818b1d21b05fc65828f51492b..d1e94ab0fa93b7532d59bcc08d9258855d6824df 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Int16Codec;
similarity index 69%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int32CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int32CodecStringTest.java
index a3b2975e88f5c1880160f7f78ac5993afe2c04af..ab7255d0a76665330490b12925ee4b095f7d81d2 100644 (file)
@@ -1,16 +1,14 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Int32Codec;
@@ -26,7 +24,7 @@ public class Int32CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Int32Codec<String> codec = getCodec(Int32.getInstance(), Int32Codec.class);
+        Int32Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int32.getInstance(), Int32Codec.class);
 
         assertEquals("serialize", "10", codec.serialize(Integer.valueOf( 10 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -42,7 +40,7 @@ public class Int32CodecStringTest {
         final String integer = "1174404318";
         final String negInteger = "-1174404318";
 
-        Int32Codec<String> codec = getCodec(Int32.getInstance(), Int32Codec.class);
+        Int32Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int32.getInstance(), Int32Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), Integer.valueOf("+045FFFCDE", 16));
         assertEquals("deserialize", codec.deserialize(negHexa), Integer.valueOf("-045FFFCDE", 16));
@@ -51,8 +49,8 @@ public class Int32CodecStringTest {
         assertEquals("deserialize", codec.deserialize(integer), Integer.valueOf(integer, 10));
         assertEquals("deserialize", codec.deserialize(negInteger), Integer.valueOf(negInteger, 10));
 
-        deserializeWithExpectedIllegalArgEx(codec, "1o");
-        deserializeWithExpectedIllegalArgEx(codec, "");
-        deserializeWithExpectedIllegalArgEx(codec, null);
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "1o");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, null);
     }
 }
similarity index 83%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int64CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int64CodecStringTest.java
index aa93f95a16a48cca13cf05e58c69f4bff8527f60..bf784afe04759eea89e1eee287b3e4162eec645b 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Int64Codec;
similarity index 68%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Int8CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int8CodecStringTest.java
index b699b502fd164ceef5bb4212cfee2f932d8b3530..4ee8492f194d24b4440c94fc5665ca8798775f00 100644 (file)
@@ -1,16 +1,14 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Int8Codec;
@@ -26,7 +24,7 @@ public class Int8CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Int8Codec<String> codec = getCodec(Int8.getInstance(), Int8Codec.class);
+        Int8Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int8.getInstance(), Int8Codec.class);
 
         assertEquals("serialize", "10", codec.serialize(Byte.valueOf( (byte) 10 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -42,7 +40,7 @@ public class Int8CodecStringTest {
         final String integer = "64";
         final String negInteger = "-64";
 
-        Int8Codec<String> codec = getCodec(Int8.getInstance(), Int8Codec.class);
+        Int8Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int8.getInstance(), Int8Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), Byte.valueOf("040", 16));
         assertEquals("deserialize", codec.deserialize(negHexa), Byte.valueOf("-040", 16));
@@ -51,8 +49,8 @@ public class Int8CodecStringTest {
         assertEquals("deserialize", codec.deserialize(integer), Byte.valueOf(integer, 10));
         assertEquals("deserialize", codec.deserialize(negInteger), Byte.valueOf(negInteger, 10));
 
-        deserializeWithExpectedIllegalArgEx(codec, "1o");
-        deserializeWithExpectedIllegalArgEx(codec, "");
-        deserializeWithExpectedIllegalArgEx(codec, null);
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "1o");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, null);
     }
 }
similarity index 71%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/StringCodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/StringCodecStringTest.java
index 42e461660e0aee576bcd517ea7500390943e1678..7810e6c0e4a5fec597d65580192734abcb54c212 100644 (file)
@@ -1,17 +1,16 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
 
 import org.junit.Test;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 import org.opendaylight.yangtools.yang.data.api.codec.StringCodec;
 import org.opendaylight.yangtools.yang.model.util.StringType;
 
@@ -25,7 +24,7 @@ public class StringCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        StringCodec<String> codec = getCodec( StringType.getInstance(), StringCodec.class);
+        StringCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( StringType.getInstance(), StringCodec.class);
 
         assertEquals( "serialize", "foo", codec.serialize( "foo" ) );
         assertEquals( "serialize", "", codec.serialize( "" ) );
@@ -35,7 +34,7 @@ public class StringCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testDeserialize() {
-        StringCodec<String> codec = getCodec( StringType.getInstance(), StringCodec.class);
+        StringCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( StringType.getInstance(), StringCodec.class);
 
         assertEquals( "deserialize", "bar", codec.deserialize( "bar" ) );
         assertEquals( "deserialize", "", codec.deserialize( "" ) );
@@ -6,13 +6,13 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -21,7 +21,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
@@ -40,7 +40,7 @@ public class StringPatternCheckingCodecTest {
 
     @Test
     public void testStringPatternCheckingCodec() throws ReactorException, ParseException, URISyntaxException {
-        SchemaContext schemaContext = RetestUtils.parseYangSources(TEST_MODULE);
+        SchemaContext schemaContext = TestUtils.parseYangSources(TEST_MODULE);
         assertNotNull(schemaContext);
 
         QNameModule testModuleQName = QNameModule.create(new URI("string-pattern-checking-codec-test"),
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
similarity index 79%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint16CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint16CodecStringTest.java
index ffd275b95bd7e459bdb22471c457c3b29dc4fb93..4985519d8c385f23fbe8a76becc6b3a3f0ac0b8e 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Uint16Codec;
similarity index 79%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint32CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint32CodecStringTest.java
index bf427b6657581ade7693f58490a0e841c7f4fdd8..12ad8a62da45c38577bd0d53c37b9d072f379ba5 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Uint32Codec;
similarity index 63%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint64CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint64CodecStringTest.java
index d5f83c1bcd5e86e41da53bfcf6887b61c8579a41..c59bfa314ac653f3f86e3fa0ba6b9595fc54f579 100644 (file)
@@ -1,16 +1,14 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import java.math.BigInteger;
 
@@ -28,7 +26,7 @@ public class Uint64CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Uint64Codec<String> codec = getCodec(Uint64.getInstance(), Uint64Codec.class);
+        Uint64Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Uint64.getInstance(), Uint64Codec.class);
 
         assertEquals("serialize", "123456789", codec.serialize(BigInteger.valueOf( 123456789 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -41,14 +39,14 @@ public class Uint64CodecStringTest {
         final String octal = "03536670743556272";
         final String integer = "129664115727546";
 
-        Uint64Codec<String> codec = getCodec(Uint64.getInstance(), Uint64Codec.class);
+        Uint64Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Uint64.getInstance(), Uint64Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), new BigInteger("75EDC78edCBA", 16));
         assertEquals("deserialize", codec.deserialize(octal), new BigInteger(octal, 8));
         assertEquals("deserialize", codec.deserialize(integer), new BigInteger(integer, 10));
 
-        deserializeWithExpectedIllegalArgEx(codec, "12345o");
-        deserializeWithExpectedIllegalArgEx(codec, "");
-        deserializeWithExpectedIllegalArgEx(codec, null);
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "12345o");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "");
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, null);
     }
 }
similarity index 80%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/Uint8CodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint8CodecStringTest.java
index 43d7b5045779e4dce064ba8272144dd55095c325..9bde6e5624353a3cd7c85e4c5b36312607051730 100644 (file)
@@ -1,16 +1,16 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.*;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Uint8Codec;
similarity index 80%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/test/codecs/UnionCodecStringTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/UnionCodecStringTest.java
index 1e01e76415796ac374f372da31226e109d206128..48fd57bd1e831dae51380f9a3c30597113f5f8e5 100644 (file)
@@ -1,18 +1,18 @@
 /*
- * Copyright (c) 2014 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.test.codecs;
+package org.opendaylight.yangtools.yang.data.impl.codecs;
 
 import static org.junit.Assert.assertEquals;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.toEnumTypeDefinition;
-import static org.opendaylight.yangtools.yang.data.impl.test.codecs.TypeDefinitionAwareCodecTestHelper.toUnionTypeDefinition;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.toEnumTypeDefinition;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.toUnionTypeDefinition;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.UnionCodec;
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test.retest;
+package org.opendaylight.yangtools.yang.data.impl.leafref.context;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -36,7 +36,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefDataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefValidatation;
@@ -122,7 +122,7 @@ public class DataTreeCandidateValidatorTest {
                 .toURI());
         final File resourceDir = resourceFile.getParentFile();
 
-        context = RetestUtils.parseYangSources(Arrays.asList(resourceDir
+        context = TestUtils.parseYangSources(Arrays.asList(resourceDir
                 .listFiles()));
 
         final Set<Module> modules = context.getModules();
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test.retest;
+package org.opendaylight.yangtools.yang.data.impl.leafref.context;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -30,7 +30,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefDataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefValidatation;
@@ -159,7 +159,7 @@ public class DataTreeCandidateValidatorTest2 {
                 "/leafref-validation/leafref-validation2.yang").toURI());
         final File resourceDir = resourceFile.getParentFile();
 
-        context = RetestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
+        context = TestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
 
         final Set<Module> modules = context.getModules();
         for (final Module module : modules) {
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test.retest;
+package org.opendaylight.yangtools.yang.data.impl.leafref.context;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -30,7 +30,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefDataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefValidatation;
@@ -206,7 +206,7 @@ public class DataTreeCandidateValidatorTest3 {
                 "/leafref-validation/leafref-validation3.yang").toURI());
         final File resourceDir = resourceFile.getParentFile();
 
-        context = RetestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
+        context = TestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
 
         final Set<Module> modules = context.getModules();
         for (final Module module : modules) {
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test.retest;
+package org.opendaylight.yangtools.yang.data.impl.leafref.context;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -20,7 +20,7 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContextUtils;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@@ -44,7 +44,7 @@ public class LeafRefContextTest {
 
         final File resourceDir = resourceFile.getParentFile();
 
-        context = RetestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
+        context = TestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
 
         final Set<Module> modules = context.getModules();
         for (final Module module : modules) {
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test.retest;
+package org.opendaylight.yangtools.yang.data.impl.leafref.context;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -23,7 +23,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
 import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContextUtils;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@@ -47,7 +47,7 @@ public class LeafRefContextTreeBuilderTest {
                 "/leafref-context-test/correct-modules/leafref-test.yang").toURI());
         final File resourceDir = resourceFile.getParentFile();
 
-        context = RetestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
+        context = TestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
 
         final Set<Module> modules = context.getModules();
         for (final Module module : modules) {
@@ -244,7 +244,7 @@ public class LeafRefContextTreeBuilderTest {
                 "/leafref-context-test/incorrect-modules/leafref-test.yang").toURI());
         final File resourceDir = resourceFile.getParentFile();
 
-        final SchemaContext context = RetestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
+        final SchemaContext context = TestUtils.parseYangSources(Arrays.asList(resourceDir.listFiles()));
 
         LeafRefContext.create(context);
 
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest.java
deleted file mode 100644 (file)
index e508096..0000000
+++ /dev/null
@@ -1,815 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import org.apache.log4j.BasicConfigurator;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefDataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefValidatation;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefYangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeAttrBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataTreeCandidateValidatorTest {
-
-    private static SchemaContext context;
-    private static Module valModule;
-    private static QNameModule valModuleQname;
-    private static LeafRefContext rootLeafRefContext;
-    public static TipProducingDataTree inMemoryDataTree;
-
-    private static QName odl;
-    private static QName project;
-    private static QName name;
-    private static QName desc;
-    private static QName lead;
-    private static QName owner;
-    private static QName odlContributor;
-    private static QName contributor;
-    private static QName odlProjectName;
-    private static QName odlProjectDesc;
-    private static QName login;
-    private static QName contributorName;
-    private static QName l1;
-    private static QName l2;
-    private static QName con1;
-    private static QName ch1;
-    private static QName ch2;
-    private static QName leafrefInChoice;
-    private static QName listInChoice;
-
-    private static QName leafrefInChoiceToChoice;
-    private static QName con3;
-    private static QName list3InChoice;
-    private static QName l3;
-    private static QName choiceInCon3;
-
-    private static QName listInChoiceKey;
-    private static QName k;
-
-    private static QName leafrefLeafList;
-
-    private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidateValidatorTest.class);
-    private static final String NEW_LINE = System.getProperty("line.separator");
-
-    static {
-        BasicConfigurator.configure();
-    }
-
-    @BeforeClass
-    public static void init() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, LeafRefYangSyntaxErrorException {
-        initSchemaContext();
-
-        initLeafRefContext();
-
-        initQnames();
-
-        initDataTree();
-
-    }
-
-    private static void initSchemaContext() throws URISyntaxException,
-            IOException, YangSyntaxErrorException {
-        final File resourceFile = new File(DataTreeCandidateValidatorTest.class
-                .getResource("/leafref-validation/leafref-validation.yang")
-                .toURI());
-        final File resourceDir = resourceFile.getParentFile();
-
-        final YangParserImpl parser = YangParserImpl.getInstance();
-        context = parser.parseFile(resourceFile, resourceDir);
-
-        final Set<Module> modules = context.getModules();
-        for (final Module module : modules) {
-            if (module.getName().equals("leafref-validation")) {
-                valModule = module;
-            }
-        }
-
-        valModuleQname = valModule.getQNameModule();
-    }
-
-    private static void initLeafRefContext() throws IOException,
-            LeafRefYangSyntaxErrorException {
-        rootLeafRefContext = LeafRefContext.create(context);
-    }
-
-    private static void initQnames() {
-        odl = QName.create(valModuleQname, "odl-project");
-        project = QName.create(valModuleQname, "project");
-        name = QName.create(valModuleQname, "name");
-        desc = QName.create(valModuleQname, "desc");
-        lead = QName.create(valModuleQname, "project-lead");
-        owner = QName.create(valModuleQname, "project-owner");
-
-        odlContributor = QName.create(valModuleQname, "odl-contributor");
-        contributor = QName.create(valModuleQname, "contributor");
-        odlProjectName = QName.create(valModuleQname, "odl-project-name");
-        login = QName.create(valModuleQname, "login");
-        contributorName = QName.create(valModuleQname, "contributor-name");
-
-        con1 = QName.create(valModuleQname, "con1");
-        l1 = QName.create(valModuleQname, "l1");
-        l2 = QName.create(valModuleQname, "l2");
-        odlProjectDesc = QName.create(valModuleQname, "odl-project-desc");
-
-        ch1 = QName.create(valModuleQname, "ch1");
-        ch2 = QName.create(valModuleQname, "ch2");
-        leafrefInChoice = QName.create(valModuleQname, "leafref-in-choice");
-        listInChoice = QName.create(valModuleQname, "list-in-choice");
-
-        leafrefInChoiceToChoice = QName.create(valModuleQname,
-                "leafref-in-choice-to-choice");
-        con3 = QName.create(valModuleQname, "con3");
-        list3InChoice = QName.create(valModuleQname, "list3-in-choice");
-        l3 = QName.create(valModuleQname, "l3");
-        choiceInCon3 = QName.create(valModuleQname, "choice-in-con3");
-
-        listInChoiceKey = QName.create(valModuleQname, "list-in-choice-key");
-        k = QName.create(valModuleQname, "k");
-
-        leafrefLeafList = QName.create(valModuleQname, "leafref-leaf-list");
-
-    }
-
-    private static void initDataTree() {
-        inMemoryDataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        inMemoryDataTree.setSchemaContext(context);
-
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-
-        final ContainerSchemaNode odlProjContSchemaNode = (ContainerSchemaNode) valModule
-                .getDataChildByName(odl);
-
-        final ContainerNode odlProjectContainer = createOdlContainer(odlProjContSchemaNode);
-
-        final YangInstanceIdentifier path = YangInstanceIdentifier.of(odl);
-        initialDataTreeModification.write(path, odlProjectContainer);
-        initialDataTreeModification.ready();
-
-        final DataTreeCandidate writeContributorsCandidate = inMemoryDataTree
-                .prepare(initialDataTreeModification);
-        inMemoryDataTree.commit(writeContributorsCandidate);
-
-    }
-
-    @Test
-    public void dataTreeCanditateValidationTest() {
-        write();
-
-        write2();
-
-        delete();
-
-        writeContributors();
-
-        writeMapEntry();
-
-        writeIntoMapEntry();
-    }
-
-    private static void writeContributors() {
-
-        final ContainerSchemaNode contributorContSchemaNode = (ContainerSchemaNode) valModule
-                .getDataChildByName(odlContributor);
-
-        final ContainerNode contributorContainer = createBasicContributorContainer(contributorContSchemaNode);
-
-        final YangInstanceIdentifier contributorPath = YangInstanceIdentifier
-                .of(odlContributor);
-        final DataTreeModification writeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        writeModification.write(contributorPath, contributorContainer);
-        writeModification.ready();
-
-        final DataTreeCandidate writeContributorsCandidate = inMemoryDataTree
-                .prepare(writeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before write of contributors: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(writeContributorsCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            assertEquals(3, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        inMemoryDataTree.commit(writeContributorsCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After write of contributors: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        assertTrue(exception);
-
-    }
-
-    private static void writeIntoMapEntry() {
-
-        final Map<QName, Object> keys = new HashMap<>();
-        keys.put(name, "New Project");
-        final NodeIdentifierWithPredicates mapEntryPath = new NodeIdentifierWithPredicates(
-                project, keys);
-
-        final YangInstanceIdentifier leaderPath = YangInstanceIdentifier.of(odl)
-                .node(project).node(mapEntryPath).node(lead);
-
-        final LeafNode<String> leader = ImmutableNodes.leafNode(lead,
-                "Updated leader");
-
-        final DataTreeModification writeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        writeModification.write(leaderPath, leader);
-        writeModification.ready();
-
-        final DataTreeCandidate writeContributorsCandidate = inMemoryDataTree
-                .prepare(writeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before write into map entry (update of leader name): ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(writeContributorsCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            assertEquals(1, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        inMemoryDataTree.commit(writeContributorsCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After write into map entry (update of leader name): ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        assertTrue(exception);
-
-    }
-
-    private static void writeMapEntry() {
-
-        final Map<QName, Object> keys = new HashMap<>();
-        keys.put(name, "New Project");
-        final NodeIdentifierWithPredicates mapEntryPath = new NodeIdentifierWithPredicates(
-                project, keys);
-
-        final YangInstanceIdentifier newOdlProjectMapEntryPath = YangInstanceIdentifier
-                .of(odl).node(project).node(mapEntryPath);
-
-        final ContainerSchemaNode odlProjContSchemaNode = (ContainerSchemaNode) valModule
-                .getDataChildByName(odl);
-        final ListSchemaNode projListSchemaNode = (ListSchemaNode) odlProjContSchemaNode
-                .getDataChildByName(project);
-        final MapEntryNode newProjectMapEntry = createProjectListEntry("New Project",
-                "New Project description ...", "Leader of New Project",
-                "Owner of New Project", projListSchemaNode);
-
-        final DataTreeModification writeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        writeModification.write(newOdlProjectMapEntryPath, newProjectMapEntry);
-        writeModification.ready();
-
-        final DataTreeCandidate writeContributorsCandidate = inMemoryDataTree
-                .prepare(writeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before map entry write: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(writeContributorsCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            assertEquals(2, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        inMemoryDataTree.commit(writeContributorsCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After map entry write: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        assertTrue(exception);
-
-    }
-
-    private static void write() {
-
-        final ContainerSchemaNode contributorContSchemaNode = (ContainerSchemaNode) valModule
-                .getDataChildByName(odlContributor);
-
-        final ContainerNode contributorContainer = createContributorContainer(contributorContSchemaNode);
-
-        final YangInstanceIdentifier contributorPath = YangInstanceIdentifier
-                .of(odlContributor);
-        final DataTreeModification writeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        writeModification.write(contributorPath, contributorContainer);
-
-        writeModification.write(YangInstanceIdentifier.of(l1),
-                ImmutableNodes.leafNode(l1, "Leafref l1 under the root"));
-        writeModification
-                .write(YangInstanceIdentifier.of(l2), ImmutableNodes.leafNode(
-                        l2, "Leafref target l2 under the root"));
-
-        writeModification.ready();
-        final DataTreeCandidate writeContributorsCandidate = inMemoryDataTree
-                .prepare(writeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before write: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(writeContributorsCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            assertEquals(12, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        inMemoryDataTree.commit(writeContributorsCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After write: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        assertTrue(exception);
-    }
-
-    private static void write2() {
-
-        final ContainerSchemaNode odlCon = (ContainerSchemaNode) valModule
-                .getDataChildByName(odl);
-        final ContainerSchemaNode con1Con = (ContainerSchemaNode) odlCon
-                .getDataChildByName(con1);
-        final LeafNode<String> l1Leaf = ImmutableNodes.leafNode(l1, "l1 value");
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> containerBuilder = Builders
-                .containerBuilder(con1Con);
-        containerBuilder.addChild(l1Leaf);
-        final ContainerNode con1Node = containerBuilder.build();
-
-        final YangInstanceIdentifier con1Path = YangInstanceIdentifier.of(odl).node(
-                con1);
-        final DataTreeModification writeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        writeModification.write(con1Path, con1Node);
-
-        final ChoiceNode choiceNode = createChoiceNode();
-        final YangInstanceIdentifier choicePath = YangInstanceIdentifier.of(odl)
-                .node(ch1);
-        writeModification.write(choicePath, choiceNode);
-
-        final ContainerNode con3Node = createCon3Node();
-        final YangInstanceIdentifier con3Path = YangInstanceIdentifier.of(odl).node(
-                con3);
-        writeModification.write(con3Path, con3Node);
-
-        final LeafSetNode<?> leafListNode = createLeafRefLeafListNode();
-        final YangInstanceIdentifier leafListPath = YangInstanceIdentifier.of(odl)
-                .node(leafrefLeafList);
-        writeModification.write(leafListPath, leafListNode);
-        writeModification.ready();
-
-        final DataTreeCandidate writeContributorsCandidate = inMemoryDataTree
-                .prepare(writeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before write2: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(writeContributorsCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            assertEquals(6, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        assertTrue(exception);
-
-        inMemoryDataTree.commit(writeContributorsCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After write2: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-    }
-
-    private static LeafSetNode<?> createLeafRefLeafListNode() {
-
-        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafSetBuilder = Builders
-                .leafSetBuilder();
-        leafSetBuilder.withNodeIdentifier(new NodeIdentifier(leafrefLeafList));
-
-        leafSetBuilder.addChild(createLeafSetEntry(leafrefLeafList, "k1"));
-        leafSetBuilder.addChild(createLeafSetEntry(leafrefLeafList, "k2"));
-        leafSetBuilder.addChild(createLeafSetEntry(leafrefLeafList, "k3"));
-
-        return leafSetBuilder.build();
-    }
-
-    private static ContainerNode createCon3Node() {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder = Builders
-                .mapBuilder();
-        mapBuilder.withNodeIdentifier(new NodeIdentifier(list3InChoice));
-
-        mapBuilder.addChild(createList3Entry("k1", "val1", "valA", "valX"));
-        mapBuilder.addChild(createList3Entry("k2", "val2", "valB", "valY"));
-
-        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choiceBuilder = Builders
-                .choiceBuilder();
-        choiceBuilder.withNodeIdentifier(new NodeIdentifier(choiceInCon3));
-
-        choiceBuilder.addChild(mapBuilder.build());
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> containerBuilder = Builders
-                .containerBuilder();
-        containerBuilder.withNodeIdentifier(new NodeIdentifier(con3));
-
-        containerBuilder.addChild(choiceBuilder.build());
-
-        return containerBuilder.build();
-    }
-
-    private static MapEntryNode createList3Entry(final String kVal, final String l3Val1,
-            final String l3Val2, final String l3Val3) {
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder = Builders
-                .mapEntryBuilder();
-        mapEntryBuilder.withNodeIdentifier(new NodeIdentifierWithPredicates(
-                list3InChoice, k, kVal));
-
-        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafSetBuilder = Builders
-                .leafSetBuilder();
-        leafSetBuilder.withNodeIdentifier(new NodeIdentifier(l3));
-
-        leafSetBuilder.addChild(createLeafSetEntry(l3, l3Val1));
-        leafSetBuilder.addChild(createLeafSetEntry(l3, l3Val2));
-        leafSetBuilder.addChild(createLeafSetEntry(l3, l3Val3));
-
-        mapEntryBuilder.addChild(ImmutableNodes.leafNode(k, kVal));
-        mapEntryBuilder.addChild(leafSetBuilder.build());
-
-        return mapEntryBuilder.build();
-    }
-
-    private static LeafSetEntryNode<Object> createLeafSetEntry(final QName qname, final String val) {
-        final NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> leafSetEntryBuilder = Builders
-                .leafSetEntryBuilder();
-        leafSetEntryBuilder.withNodeIdentifier(new NodeWithValue<>(qname, val));
-        leafSetEntryBuilder.withValue(val);
-        return leafSetEntryBuilder.build();
-    }
-
-    private static ChoiceNode createChoiceNode() {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> listInChoiceBuilder = Builders
-                .mapBuilder();
-        listInChoiceBuilder
-                .withNodeIdentifier(new NodeIdentifier(listInChoice));
-
-        listInChoiceBuilder.addChild(createListInChoiceEntry("key1",
-                "leafref-in-choice value", "val1"));
-        listInChoiceBuilder.addChild(createListInChoiceEntry("key2",
-                "l1 value", "val2"));
-        listInChoiceBuilder.addChild(createListInChoiceEntry("key3",
-                "l1 value", "val3"));
-
-        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice2Builder = Builders
-                .choiceBuilder();
-        choice2Builder.withNodeIdentifier(new NodeIdentifier(ch2));
-
-        choice2Builder.addChild(listInChoiceBuilder.build());
-
-        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choiceBuilder = Builders
-                .choiceBuilder();
-        choiceBuilder.withNodeIdentifier(new NodeIdentifier(ch1));
-        choiceBuilder.addChild(choice2Builder.build());
-
-        return choiceBuilder.build();
-    }
-
-    private static MapEntryNode createListInChoiceEntry(final String keyVal,
-            final String leafrefInChoiceVal, final String leafrefInChoiceToChoiceVal) {
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> mapEntryBuilder = Builders
-                .mapEntryBuilder();
-
-        mapEntryBuilder.withNodeIdentifier(new NodeIdentifierWithPredicates(
-                listInChoice, listInChoiceKey, keyVal));
-
-        mapEntryBuilder.addChild(ImmutableNodes.leafNode(listInChoiceKey,
-                keyVal));
-        mapEntryBuilder.addChild(ImmutableNodes.leafNode(leafrefInChoice,
-                leafrefInChoiceVal));
-        mapEntryBuilder.addChild(ImmutableNodes.leafNode(
-                leafrefInChoiceToChoice, leafrefInChoiceToChoiceVal));
-
-        return mapEntryBuilder.build();
-    }
-
-    private static void delete() {
-
-        final YangInstanceIdentifier contributorPath = YangInstanceIdentifier
-                .of(odlContributor);
-        final DataTreeModification delete = inMemoryDataTree.takeSnapshot()
-                .newModification();
-        delete.delete(contributorPath);
-        delete.ready();
-
-        final DataTreeCandidate deleteContributorsCanditate = inMemoryDataTree
-                .prepare(delete);
-
-        LOG.debug("*************************");
-        LOG.debug("Before delete: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(deleteContributorsCanditate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            assertEquals(6, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        assertTrue(exception);
-
-        inMemoryDataTree.commit(deleteContributorsCanditate);
-
-        LOG.debug("*************************");
-        LOG.debug("After delete: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-    }
-
-    private static ContainerNode createContributorContainer(
-            final ContainerSchemaNode contributorContSchemaNode) {
-
-        final ListSchemaNode contributorListSchemaNode = (ListSchemaNode) contributorContSchemaNode
-                .getDataChildByName(contributor);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> contributorContainerBldr = Builders
-                .containerBuilder(contributorContSchemaNode);
-
-        final MapNode contributorMap = createContributorList(contributorListSchemaNode);
-        contributorContainerBldr.addChild(contributorMap);
-
-        final ContainerNode contributorContainer = contributorContainerBldr.build();
-
-        return contributorContainer;
-
-    }
-
-    private static MapNode createContributorList(
-            final ListSchemaNode contributorListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> contributorMapBldr = Builders
-                .mapBuilder(contributorListSchemaNode);
-
-        final MapEntryNode contributorMapEntry1 = createContributorListEntry(
-                "Leader of Yangtools", "Yangtools Leader name", "Yangtools",
-                "Yangtools description ...", contributorListSchemaNode);
-        final MapEntryNode contributorMapEntry2 = createContributorListEntry(
-                "Leader of MD-SAL", "MD-SAL Leader name", "MD-SAL",
-                "MD-SAL description ...", contributorListSchemaNode);
-        final MapEntryNode contributorMapEntry3 = createContributorListEntry(
-                "Leader of Controller", "Controller Leader name", "Controller",
-                "Controller description ...", contributorListSchemaNode);
-
-        final MapEntryNode contributorMapEntry4 = createContributorListEntry("jdoe",
-                "John Doe", "MD-SAL", "Yangtools description ...",
-                contributorListSchemaNode);
-
-        final MapEntryNode contributorMapEntry5 = createContributorListEntry("foo",
-                "foo name", "Controller", "MD-SAL description ...",
-                contributorListSchemaNode);
-
-        final MapEntryNode contributorMapEntry6 = createContributorListEntry("bar",
-                "bar name", "Yangtools", "Controller description ...",
-                contributorListSchemaNode);
-
-        final MapEntryNode contributorMapEntry7 = createContributorListEntry("baz",
-                "baz name", "Unknown Project",
-                "Unknown Project description ...", contributorListSchemaNode);
-
-        final MapEntryNode contributorMapEntry8 = createContributorListEntry("pk",
-                "pk name", "Unknown Project 2", "Controller description ...",
-                contributorListSchemaNode);
-
-        contributorMapBldr.addChild(contributorMapEntry1);
-        contributorMapBldr.addChild(contributorMapEntry2);
-        contributorMapBldr.addChild(contributorMapEntry3);
-        contributorMapBldr.addChild(contributorMapEntry4);
-        contributorMapBldr.addChild(contributorMapEntry5);
-        contributorMapBldr.addChild(contributorMapEntry6);
-        contributorMapBldr.addChild(contributorMapEntry7);
-        contributorMapBldr.addChild(contributorMapEntry8);
-
-        final MapNode contributorMap = contributorMapBldr.build();
-
-        return contributorMap;
-
-    }
-
-    private static MapEntryNode createContributorListEntry(final String loginVal,
-            final String contributorNameVal, final String odlProjectNameVal,
-            final String odlProjectDescVal, final ListSchemaNode contributorListSchemaNode) {
-
-        final LeafNode<String> loginLeaf = ImmutableNodes.leafNode(login, loginVal);
-        final LeafNode<String> contributorNameLeaf = ImmutableNodes.leafNode(
-                contributorName, contributorNameVal);
-        final LeafNode<String> odlProjectNameLeafRef = ImmutableNodes.leafNode(
-                odlProjectName, odlProjectNameVal);
-        final LeafNode<String> odlProjectDescLeafRef = ImmutableNodes.leafNode(
-                odlProjectDesc, odlProjectDescVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> contributorMapEntryBldr = Builders
-                .mapEntryBuilder(contributorListSchemaNode);
-
-        contributorMapEntryBldr.addChild(loginLeaf);
-        contributorMapEntryBldr.addChild(contributorNameLeaf);
-        contributorMapEntryBldr.addChild(odlProjectNameLeafRef);
-        contributorMapEntryBldr.addChild(odlProjectDescLeafRef);
-
-        final MapEntryNode contributorMapEntry = contributorMapEntryBldr.build();
-
-        return contributorMapEntry;
-    }
-
-    private static ContainerNode createOdlContainer(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode projListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(project);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> odlProjectContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode projectMap = createProjectList(projListSchemaNode);
-        odlProjectContainerBldr.addChild(projectMap);
-
-        final ContainerNode odlProjectContainer = odlProjectContainerBldr.build();
-
-        return odlProjectContainer;
-    }
-
-    private static MapNode createProjectList(final ListSchemaNode projListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> projectMapBldr = Builders
-                .mapBuilder(projListSchemaNode);
-
-        final MapEntryNode projMapEntry1 = createProjectListEntry("Yangtools",
-                "Yangtools description ...", "Leader of Yangtools",
-                "Owner of Yangtools", projListSchemaNode);
-        final MapEntryNode projMapEntry2 = createProjectListEntry("MD-SAL",
-                "MD-SAL description ...", "Leader of MD-SAL",
-                "Owner of MD-SAL", projListSchemaNode);
-        final MapEntryNode projMapEntry3 = createProjectListEntry("Controller",
-                "Controller description ...", "Leader of Controller",
-                "Owner of Controller", projListSchemaNode);
-
-        projectMapBldr.addChild(projMapEntry1);
-        projectMapBldr.addChild(projMapEntry2);
-        projectMapBldr.addChild(projMapEntry3);
-
-        final MapNode projectMap = projectMapBldr.build();
-
-        return projectMap;
-    }
-
-    private static MapEntryNode createProjectListEntry(final String nameVal,
-            final String descVal, final String leadVal, final String ownerVal,
-            final ListSchemaNode projListSchemaNode) {
-
-        final LeafNode<String> nameLeaf = ImmutableNodes.leafNode(name, nameVal);
-        final LeafNode<String> descLeaf = ImmutableNodes.leafNode(desc, descVal);
-        final LeafNode<String> leadLeafRef = ImmutableNodes.leafNode(lead, leadVal);
-        final LeafNode<String> ownerLeafRef = ImmutableNodes
-                .leafNode(owner, ownerVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> projMapEntryBldr = Builders
-                .mapEntryBuilder(projListSchemaNode);
-
-        projMapEntryBldr.addChild(nameLeaf);
-        projMapEntryBldr.addChild(descLeaf);
-        projMapEntryBldr.addChild(leadLeafRef);
-        projMapEntryBldr.addChild(ownerLeafRef);
-        final MapEntryNode projMapEntry = projMapEntryBldr.build();
-
-        return projMapEntry;
-    }
-
-    private static ContainerNode createBasicContributorContainer(
-            final ContainerSchemaNode contributorContSchemaNode) {
-
-        final ListSchemaNode contributorListSchemaNode = (ListSchemaNode) contributorContSchemaNode
-                .getDataChildByName(contributor);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> contributorContainerBldr = Builders
-                .containerBuilder(contributorContSchemaNode);
-
-        final MapNode contributorMap = createBasicContributorList(contributorListSchemaNode);
-        contributorContainerBldr.addChild(contributorMap);
-
-        final ContainerNode contributorContainer = contributorContainerBldr.build();
-
-        return contributorContainer;
-
-    }
-
-    private static MapNode createBasicContributorList(
-            final ListSchemaNode contributorListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> contributorMapBldr = Builders
-                .mapBuilder(contributorListSchemaNode);
-
-        final MapEntryNode contributorMapEntry1 = createContributorListEntry(
-                "Leader of Yangtools", "Yangtools Leader name", "Yangtools",
-                "Yangtools description ...", contributorListSchemaNode);
-        final MapEntryNode contributorMapEntry2 = createContributorListEntry(
-                "Leader of MD-SAL", "MD-SAL Leader name", "MD-SAL",
-                "MD-SAL description ...", contributorListSchemaNode);
-        final MapEntryNode contributorMapEntry3 = createContributorListEntry(
-                "Leader of Controller", "Controller Leader name", "Controller",
-                "Controller description ...", contributorListSchemaNode);
-
-        contributorMapBldr.addChild(contributorMapEntry1);
-        contributorMapBldr.addChild(contributorMapEntry2);
-        contributorMapBldr.addChild(contributorMapEntry3);
-
-        final MapNode contributorMap = contributorMapBldr.build();
-
-        return contributorMap;
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest2.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest2.java
deleted file mode 100644 (file)
index eb5e7bc..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Set;
-import org.apache.log4j.BasicConfigurator;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefDataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefValidatation;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefYangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataTreeCandidateValidatorTest2 {
-
-    private static SchemaContext context;
-    private static Module mainModule;
-    private static QNameModule rootModuleQname;
-    private static LeafRefContext rootLeafRefContext;
-    public static TipProducingDataTree inMemoryDataTree;
-
-    private static QName chips;
-    private static QName chip;
-    private static QName devType;
-    private static QName chipDesc;
-
-    private static QName devices;
-    private static QName device;
-    private static QName typeChoice;
-    private static QName typeText;
-    private static QName devDesc;
-    private static QName sn;
-    private static QName defaultIp;
-
-    private static QName deviceTypeStr;
-    private static QName deviceType;
-    private static QName type;
-    private static QName desc;
-
-    private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidateValidatorTest2.class);
-    private static final String NEW_LINE = System.getProperty("line.separator");
-
-    static {
-        BasicConfigurator.configure();
-    }
-
-    @BeforeClass
-    public static void init() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, LeafRefYangSyntaxErrorException {
-
-        initSchemaContext();
-        initLeafRefContext();
-        initQnames();
-        initDataTree();
-    }
-
-    @Test
-    public void dataTreeCanditateValidationTest2() {
-
-        writeDevices();
-    }
-
-    private static void writeDevices() {
-
-        final ContainerSchemaNode devicesContSchemaNode = (ContainerSchemaNode) mainModule
-                .getDataChildByName(devices);
-
-        final ContainerNode devicesContainer = createDevicesContainer(devicesContSchemaNode);
-
-        final YangInstanceIdentifier devicesPath = YangInstanceIdentifier.of(devices);
-        final DataTreeModification writeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        writeModification.write(devicesPath, devicesContainer);
-
-        writeModification.ready();
-        final DataTreeCandidate writeDevicesCandidate = inMemoryDataTree
-                .prepare(writeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before writeDevices: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(writeDevicesCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-
-            assertEquals(4, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        assertTrue(exception);
-
-        inMemoryDataTree.commit(writeDevicesCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After write: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-    }
-
-    private static void initQnames() {
-
-        chips = QName.create(rootModuleQname, "chips");
-        chip = QName.create(rootModuleQname, "chip");
-        devType = QName.create(rootModuleQname, "dev_type");
-        chipDesc = QName.create(rootModuleQname, "chip_desc");
-
-        devices = QName.create(rootModuleQname, "devices");
-        device = QName.create(rootModuleQname, "device");
-        typeText = QName.create(rootModuleQname, "type_text");
-        devDesc = QName.create(rootModuleQname, "dev_desc");
-        sn = QName.create(rootModuleQname, "sn");
-        defaultIp = QName.create(rootModuleQname, "default_ip");
-
-        deviceTypeStr = QName.create(rootModuleQname, "device_types");
-        deviceType = QName.create(rootModuleQname, "device_type");
-        type = QName.create(rootModuleQname, "type");
-        desc = QName.create(rootModuleQname, "desc");
-    }
-
-    private static void initSchemaContext() throws URISyntaxException,
-            IOException, YangSyntaxErrorException {
-
-        final File resourceFile = new File(DataTreeCandidateValidatorTest.class
-                .getResource("/leafref-validation/leafref-validation2.yang")
-                .toURI());
-        final File resourceDir = resourceFile.getParentFile();
-
-        final YangParserImpl parser = YangParserImpl.getInstance();
-        context = parser.parseFile(resourceFile, resourceDir);
-
-        final Set<Module> modules = context.getModules();
-        for (final Module module : modules) {
-            if (module.getName().equals("leafref-validation2")) {
-                mainModule = module;
-            }
-        }
-
-        rootModuleQname = mainModule.getQNameModule();
-    }
-
-    private static void initDataTree() {
-
-        inMemoryDataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        inMemoryDataTree.setSchemaContext(context);
-
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-
-        final ContainerSchemaNode chipsListContSchemaNode = (ContainerSchemaNode) mainModule
-                .getDataChildByName(chips);
-        final ContainerNode chipsContainer = createChipsContainer(chipsListContSchemaNode);
-        final YangInstanceIdentifier path1 = YangInstanceIdentifier.of(chips);
-        initialDataTreeModification.write(path1, chipsContainer);
-
-        final ContainerSchemaNode devTypesListContSchemaNode = (ContainerSchemaNode) mainModule
-                .getDataChildByName(deviceTypeStr);
-        final ContainerNode deviceTypesContainer = createDevTypeStrContainer(devTypesListContSchemaNode);
-        final YangInstanceIdentifier path2 = YangInstanceIdentifier.of(deviceTypeStr);
-        initialDataTreeModification.write(path2, deviceTypesContainer);
-
-        initialDataTreeModification.ready();
-        final DataTreeCandidate writeChipsCandidate = inMemoryDataTree
-                .prepare(initialDataTreeModification);
-
-        inMemoryDataTree.commit(writeChipsCandidate);
-
-        System.out.println(inMemoryDataTree.toString());
-    }
-
-    private static void initLeafRefContext() throws IOException,
-            LeafRefYangSyntaxErrorException {
-        rootLeafRefContext = LeafRefContext.create(context);
-    }
-
-    private static ContainerNode createDevTypeStrContainer(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode devTypeListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(deviceType);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> devTypeContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode devTypeMap = createDevTypeList(devTypeListSchemaNode);
-        devTypeContainerBldr.addChild(devTypeMap);
-
-        return devTypeContainerBldr.build();
-    }
-
-    private static MapNode createDevTypeList(
-            final ListSchemaNode devTypeListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> devTypeMapBldr = Builders
-                .mapBuilder(devTypeListSchemaNode);
-
-        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type_1",
-                "typedesc1", devTypeListSchemaNode));
-        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type_2",
-                "typedesc2", devTypeListSchemaNode));
-        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type_3",
-                "typedesc3", devTypeListSchemaNode));
-
-        return devTypeMapBldr.build();
-    }
-
-    private static MapEntryNode createDevTypeListEntry(final String typeVal,
-            final String descVal, final ListSchemaNode devTypeListSchemaNode) {
-
-        final LeafNode<String> typeLeaf = ImmutableNodes.leafNode(type, typeVal);
-        final LeafNode<String> descLeaf = ImmutableNodes.leafNode(desc, descVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> devTypeMapEntryBldr = Builders
-                .mapEntryBuilder(devTypeListSchemaNode);
-
-        devTypeMapEntryBldr.addChild(typeLeaf);
-        devTypeMapEntryBldr.addChild(descLeaf);
-
-        return devTypeMapEntryBldr.build();
-    }
-
-    private static ContainerNode createChipsContainer(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode chipsListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(chip);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> chipsContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode chipsMap = createChipsList(chipsListSchemaNode);
-        chipsContainerBldr.addChild(chipsMap);
-
-        return chipsContainerBldr.build();
-    }
-
-    private static MapNode createChipsList(final ListSchemaNode chipsListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> chipsMapBldr = Builders
-                .mapBuilder(chipsListSchemaNode);
-
-        chipsMapBldr.addChild(createChipsListEntry("dev_type_1", "desc1",
-                chipsListSchemaNode));
-        chipsMapBldr.addChild(createChipsListEntry("dev_type_2", "desc2",
-                chipsListSchemaNode));
-
-        return chipsMapBldr.build();
-    }
-
-    private static MapEntryNode createChipsListEntry(final String devTypeVal,
-            final String chipDescVal, final ListSchemaNode chipsListSchemaNode) {
-
-        final LeafNode<String> devTypeLeaf = ImmutableNodes.leafNode(devType,
-                devTypeVal);
-        final LeafNode<String> chipDescLeaf = ImmutableNodes.leafNode(chipDesc,
-                chipDescVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> chipsMapEntryBldr = Builders
-                .mapEntryBuilder(chipsListSchemaNode);
-
-        chipsMapEntryBldr.addChild(devTypeLeaf);
-        chipsMapEntryBldr.addChild(chipDescLeaf);
-
-        return chipsMapEntryBldr.build();
-    }
-
-    private static ContainerNode createDevicesContainer(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode devicesListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(device);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> devicesContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode devicesMap = createDeviceList(devicesListSchemaNode);
-        devicesContainerBldr.addChild(devicesMap);
-
-        return devicesContainerBldr.build();
-    }
-
-    private static MapNode createDeviceList(final ListSchemaNode deviceListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> devicesMapBldr = Builders
-                .mapBuilder(deviceListSchemaNode);
-
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type_1",
-                "typedesc1", 123456, "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type_2",
-                "typedesc2", 123457, "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type_2",
-                "typedesc3", 123457, "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type_1",
-                "typedesc2", 123458, "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("unknown", "unknown",
-                123457, "192.168.0.1", deviceListSchemaNode));
-
-        return devicesMapBldr.build();
-    }
-
-    private static MapEntryNode createDeviceListEntry(final String typeTextVal,
-            final String descVal, final int snVal, final String defaultIpVal,
-            final ListSchemaNode devicesListSchemaNode) {
-
-        final LeafNode<String> typeTextLeaf = ImmutableNodes.leafNode(typeText,
-                typeTextVal);
-        final LeafNode<String> descLeaf = ImmutableNodes.leafNode(devDesc, descVal);
-        final LeafNode<Integer> snValLeaf = ImmutableNodes.leafNode(sn, snVal);
-        final LeafNode<String> defaultIpLeaf = ImmutableNodes.leafNode(defaultIp,
-                defaultIpVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> devicesMapEntryBldr = Builders
-                .mapEntryBuilder(devicesListSchemaNode);
-
-        devicesMapEntryBldr.addChild(typeTextLeaf);
-        devicesMapEntryBldr.addChild(descLeaf);
-        devicesMapEntryBldr.addChild(snValLeaf);
-        devicesMapEntryBldr.addChild(defaultIpLeaf);
-
-        return devicesMapEntryBldr.build();
-    }
-}
\ No newline at end of file
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest3.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/DataTreeCandidateValidatorTest3.java
deleted file mode 100644 (file)
index fb57f9b..0000000
+++ /dev/null
@@ -1,462 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Set;
-import org.apache.log4j.BasicConfigurator;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefDataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefValidatation;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefYangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataTreeCandidateValidatorTest3 {
-
-    private static SchemaContext context;
-    private static Module mainModule;
-    private static QNameModule rootModuleQname;
-    private static LeafRefContext rootLeafRefContext;
-    public static TipProducingDataTree inMemoryDataTree;
-
-    private static QName chips;
-    private static QName chip;
-    private static QName devType;
-    private static QName chipDesc;
-
-    private static QName devices;
-    private static QName device;
-    private static QName typeText1;
-    private static QName typeText2;
-    private static QName typeText3;
-    private static QName devDesc;
-    private static QName sn;
-    private static QName defaultIp;
-
-    private static QName deviceTypeStr;
-    private static QName deviceType;
-    private static QName type1;
-    private static QName type2;
-    private static QName type3;
-    private static QName desc;
-
-    private static final Logger LOG = LoggerFactory.getLogger(DataTreeCandidateValidatorTest3.class);
-    private static final String NEW_LINE = System.getProperty("line.separator");
-
-    static {
-        BasicConfigurator.configure();
-    }
-
-    @BeforeClass
-    public static void init() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, LeafRefYangSyntaxErrorException {
-
-        initSchemaContext();
-        initLeafRefContext();
-        initQnames();
-        initDataTree();
-    }
-
-    @Test
-    public void dataTreeCanditateValidationTest2() {
-
-        writeDevices();
-
-        mergeDevices();
-    }
-
-    private static void writeDevices() {
-
-        final ContainerSchemaNode devicesContSchemaNode = (ContainerSchemaNode) mainModule
-                .getDataChildByName(devices);
-
-        final ContainerNode devicesContainer = createDevicesContainer(devicesContSchemaNode);
-
-        final YangInstanceIdentifier devicesPath = YangInstanceIdentifier.of(devices);
-        final DataTreeModification writeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        writeModification.write(devicesPath, devicesContainer);
-
-        writeModification.ready();
-        final DataTreeCandidate writeDevicesCandidate = inMemoryDataTree
-                .prepare(writeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before writeDevices: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(writeDevicesCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            assertEquals(6, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        assertTrue(exception);
-
-        inMemoryDataTree.commit(writeDevicesCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After writeDevices: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-    }
-
-    private static void mergeDevices() {
-
-        final ContainerSchemaNode devicesContSchemaNode = (ContainerSchemaNode) mainModule
-                .getDataChildByName(devices);
-
-        final ContainerNode devicesContainer = createDevices2Container(devicesContSchemaNode);
-
-        final YangInstanceIdentifier devicesPath = YangInstanceIdentifier.of(devices);
-        final DataTreeModification mergeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-        mergeModification.write(devicesPath, devicesContainer);
-        mergeModification.merge(devicesPath, devicesContainer);
-
-        mergeModification.ready();
-        final DataTreeCandidate mergeDevicesCandidate = inMemoryDataTree
-                .prepare(mergeModification);
-
-        LOG.debug("*************************");
-        LOG.debug("Before mergeDevices: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        boolean exception = false;
-        try {
-            LeafRefValidatation.validate(mergeDevicesCandidate, rootLeafRefContext);
-        } catch (final LeafRefDataValidationFailedException e) {
-            LOG.debug("All validation errors:" + NEW_LINE + e.getMessage());
-            // :TODO verify errors count gz
-            assertEquals(6, e.getValidationsErrorsCount());
-            exception = true;
-        }
-
-        inMemoryDataTree.commit(mergeDevicesCandidate);
-
-        LOG.debug("*************************");
-        LOG.debug("After mergeDevices: ");
-        LOG.debug("*************************");
-        LOG.debug(inMemoryDataTree.toString());
-
-        assertTrue(exception);
-    }
-
-    private static void initQnames() {
-
-        chips = QName.create(rootModuleQname, "chips");
-        chip = QName.create(rootModuleQname, "chip");
-        devType = QName.create(rootModuleQname, "dev_type");
-        chipDesc = QName.create(rootModuleQname, "chip_desc");
-
-        devices = QName.create(rootModuleQname, "devices");
-        device = QName.create(rootModuleQname, "device");
-        typeText1 = QName.create(rootModuleQname, "type_text1");
-        typeText2 = QName.create(rootModuleQname, "type_text2");
-        typeText3 = QName.create(rootModuleQname, "type_text3");
-        devDesc = QName.create(rootModuleQname, "dev_desc");
-        sn = QName.create(rootModuleQname, "sn");
-        defaultIp = QName.create(rootModuleQname, "default_ip");
-
-        deviceTypeStr = QName.create(rootModuleQname, "device_types");
-        deviceType = QName.create(rootModuleQname, "device_type");
-        type1 = QName.create(rootModuleQname, "type1");
-        type2 = QName.create(rootModuleQname, "type2");
-        type3 = QName.create(rootModuleQname, "type3");
-        desc = QName.create(rootModuleQname, "desc");
-    }
-
-    private static void initSchemaContext() throws URISyntaxException,
-            IOException, YangSyntaxErrorException {
-
-        final File resourceFile = new File(DataTreeCandidateValidatorTest.class
-                .getResource("/leafref-validation/leafref-validation3.yang")
-                .toURI());
-        final File resourceDir = resourceFile.getParentFile();
-
-        final YangParserImpl parser = YangParserImpl.getInstance();
-        context = parser.parseFile(resourceFile, resourceDir);
-
-        final Set<Module> modules = context.getModules();
-        for (final Module module : modules) {
-            if (module.getName().equals("leafref-validation3")) {
-                mainModule = module;
-            }
-        }
-
-        rootModuleQname = mainModule.getQNameModule();
-    }
-
-    private static void initDataTree() {
-
-        inMemoryDataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        inMemoryDataTree.setSchemaContext(context);
-
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree
-                .takeSnapshot().newModification();
-
-        final ContainerSchemaNode chipsListContSchemaNode = (ContainerSchemaNode) mainModule
-                .getDataChildByName(chips);
-        final ContainerNode chipsContainer = createChipsContainer(chipsListContSchemaNode);
-        final YangInstanceIdentifier path1 = YangInstanceIdentifier.of(chips);
-        initialDataTreeModification.write(path1, chipsContainer);
-
-        final ContainerSchemaNode devTypesListContSchemaNode = (ContainerSchemaNode) mainModule
-                .getDataChildByName(deviceTypeStr);
-        final ContainerNode deviceTypesContainer = createDevTypeStrContainer(devTypesListContSchemaNode);
-        final YangInstanceIdentifier path2 = YangInstanceIdentifier.of(deviceTypeStr);
-        initialDataTreeModification.write(path2, deviceTypesContainer);
-
-        initialDataTreeModification.ready();
-        final DataTreeCandidate writeChipsCandidate = inMemoryDataTree
-                .prepare(initialDataTreeModification);
-
-        inMemoryDataTree.commit(writeChipsCandidate);
-
-        System.out.println(inMemoryDataTree.toString());
-    }
-
-    private static void initLeafRefContext() throws IOException,
-            LeafRefYangSyntaxErrorException {
-        rootLeafRefContext = LeafRefContext.create(context);
-    }
-
-    private static ContainerNode createDevTypeStrContainer(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode devTypeListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(deviceType);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> devTypeContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode devTypeMap = createDevTypeList(devTypeListSchemaNode);
-        devTypeContainerBldr.addChild(devTypeMap);
-
-        return devTypeContainerBldr.build();
-    }
-
-    private static MapNode createDevTypeList(
-            final ListSchemaNode devTypeListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> devTypeMapBldr = Builders
-                .mapBuilder(devTypeListSchemaNode);
-
-        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type1_1",
-                "dev_type2_1", "dev_type3_1", "typedesc1",
-                devTypeListSchemaNode));
-        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type1_2",
-                "dev_type2_2", "dev_type3_2", "typedesc2",
-                devTypeListSchemaNode));
-        devTypeMapBldr.addChild(createDevTypeListEntry("dev_type1_3",
-                "dev_type2_3", "dev_type3_3", "typedesc3",
-                devTypeListSchemaNode));
-
-        return devTypeMapBldr.build();
-    }
-
-    private static MapEntryNode createDevTypeListEntry(final String type1Val,
-            final String type2Val, final String type3Val, final String descVal,
-            final ListSchemaNode devTypeListSchemaNode) {
-
-        final LeafNode<String> type1Leaf = ImmutableNodes.leafNode(type1, type1Val);
-        final LeafNode<String> type2Leaf = ImmutableNodes.leafNode(type2, type2Val);
-        final LeafNode<String> type3Leaf = ImmutableNodes.leafNode(type3, type3Val);
-        final LeafNode<String> descLeaf = ImmutableNodes.leafNode(desc, descVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> devTypeMapEntryBldr = Builders
-                .mapEntryBuilder(devTypeListSchemaNode);
-
-        devTypeMapEntryBldr.addChild(type1Leaf);
-        devTypeMapEntryBldr.addChild(type2Leaf);
-        devTypeMapEntryBldr.addChild(type3Leaf);
-        devTypeMapEntryBldr.addChild(descLeaf);
-
-        return devTypeMapEntryBldr.build();
-    }
-
-    private static ContainerNode createChipsContainer(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode chipsListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(chip);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> chipsContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode chipsMap = createChipsList(chipsListSchemaNode);
-        chipsContainerBldr.addChild(chipsMap);
-
-        return chipsContainerBldr.build();
-    }
-
-    private static MapNode createChipsList(final ListSchemaNode chipsListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> chipsMapBldr = Builders
-                .mapBuilder(chipsListSchemaNode);
-
-        chipsMapBldr.addChild(createChipsListEntry("dev_type_1", "desc1",
-                chipsListSchemaNode));
-        chipsMapBldr.addChild(createChipsListEntry("dev_type_2", "desc2",
-                chipsListSchemaNode));
-
-        return chipsMapBldr.build();
-    }
-
-    private static MapEntryNode createChipsListEntry(final String devTypeVal,
-            final String chipDescVal, final ListSchemaNode chipsListSchemaNode) {
-
-        final LeafNode<String> devTypeLeaf = ImmutableNodes.leafNode(devType,
-                devTypeVal);
-        final LeafNode<String> chipDescLeaf = ImmutableNodes.leafNode(chipDesc,
-                chipDescVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> chipsMapEntryBldr = Builders
-                .mapEntryBuilder(chipsListSchemaNode);
-
-        chipsMapEntryBldr.addChild(devTypeLeaf);
-        chipsMapEntryBldr.addChild(chipDescLeaf);
-
-        return chipsMapEntryBldr.build();
-    }
-
-    private static ContainerNode createDevicesContainer(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode devicesListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(device);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> devicesContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode devicesMap = createDeviceList(devicesListSchemaNode);
-        devicesContainerBldr.addChild(devicesMap);
-
-        return devicesContainerBldr.build();
-    }
-
-    private static MapNode createDeviceList(final ListSchemaNode deviceListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> devicesMapBldr = Builders
-                .mapBuilder(deviceListSchemaNode);
-
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_1",
-                "dev_type2_1", "dev_type3_1", "typedesc1", 123456,
-                "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_2",
-                "dev_type2_2", "dev_type3_2", "typedesc1", 123457,
-                "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_1",
-                "dev_type2_2", "dev_type3_3", "typedesc2", 123458,
-                "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("unk11", "unk22",
-                "unk33", "unk_desc2", 123457, "192.168.0.1",
-                deviceListSchemaNode));
-
-        return devicesMapBldr.build();
-    }
-
-    private static ContainerNode createDevices2Container(
-            final ContainerSchemaNode container) {
-
-        final ListSchemaNode devicesListSchemaNode = (ListSchemaNode) container
-                .getDataChildByName(device);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> devicesContainerBldr = Builders
-                .containerBuilder(container);
-
-        final MapNode devicesMap = createDevice2List(devicesListSchemaNode);
-        devicesContainerBldr.addChild(devicesMap);
-
-        return devicesContainerBldr.build();
-    }
-
-    private static MapNode createDevice2List(final ListSchemaNode deviceListSchemaNode) {
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> devicesMapBldr = Builders
-                .mapBuilder(deviceListSchemaNode);
-
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_3",
-                "dev_type2_3", "dev_type3_3", "typedesc3", 123459,
-                "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_3",
-                "dev_type2_3", "dev_type3_3", "typedesc2", 123460,
-                "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("dev_type1_3",
-                "dev_type2_2", "dev_type3_1", "typedesc1", 123461,
-                "192.168.0.1", deviceListSchemaNode));
-        devicesMapBldr.addChild(createDeviceListEntry("unk1", "unk2", "unk3",
-                "unk_desc", 123462, "192.168.0.1", deviceListSchemaNode));
-
-        return devicesMapBldr.build();
-    }
-
-    private static MapEntryNode createDeviceListEntry(final String type1TextVal,
-            final String type2TextVal, final String type3TextVal, final String descVal,
-            final int snVal, final String defaultIpVal, final ListSchemaNode devicesListSchemaNode) {
-
-        final LeafNode<String> typeText1Leaf = ImmutableNodes.leafNode(typeText1,
-                type1TextVal);
-        final LeafNode<String> typeText2Leaf = ImmutableNodes.leafNode(typeText2,
-                type2TextVal);
-        final LeafNode<String> typeText3Leaf = ImmutableNodes.leafNode(typeText3,
-                type3TextVal);
-        final LeafNode<String> descLeaf = ImmutableNodes.leafNode(devDesc, descVal);
-        final LeafNode<Integer> snValLeaf = ImmutableNodes.leafNode(sn, snVal);
-        final LeafNode<String> defaultIpLeaf = ImmutableNodes.leafNode(defaultIp,
-                defaultIpVal);
-
-        final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> devicesMapEntryBldr = Builders
-                .mapEntryBuilder(devicesListSchemaNode);
-
-        devicesMapEntryBldr.addChild(typeText1Leaf);
-        devicesMapEntryBldr.addChild(typeText2Leaf);
-        devicesMapEntryBldr.addChild(typeText3Leaf);
-        devicesMapEntryBldr.addChild(descLeaf);
-        devicesMapEntryBldr.addChild(snValLeaf);
-        devicesMapEntryBldr.addChild(defaultIpLeaf);
-
-        return devicesMapEntryBldr.build();
-    }
-}
\ No newline at end of file
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/LeafRefContextTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/LeafRefContextTest.java
deleted file mode 100644 (file)
index eb3143d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Map;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContextUtils;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefYangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-
-public class LeafRefContextTest {
-
-    private static SchemaContext context;
-    private static Module rootMod;
-    private static QNameModule root;
-    private static LeafRefContext rootLeafRefContext;
-
-    @BeforeClass
-    public static void init() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, LeafRefYangSyntaxErrorException {
-
-        final File resourceFile = new File(
-                LeafRefContextTreeBuilderTest.class
-                        .getResource(
-                                "/leafref-context-test/correct-modules/leafref-test2.yang")
-                        .toURI());
-
-        final File resourceDir = resourceFile.getParentFile();
-
-        final YangParserImpl parser = YangParserImpl.getInstance();
-        context = parser.parseFile(resourceFile, resourceDir);
-
-        final Set<Module> modules = context.getModules();
-        for (final Module module : modules) {
-            if (module.getName().equals("leafref-test2")) {
-                rootMod = module;
-            }
-        }
-
-        root = rootMod.getQNameModule();
-        rootLeafRefContext = LeafRefContext.create(context);
-    }
-
-    @Test
-    public void test() {
-
-        final QName q1 = QName.create(root, "ref1");
-        final QName q2 = QName.create(root, "leaf1");
-        final QName q3 = QName.create(root, "cont1");
-        final QName q4 = QName.create(root, "cont2");
-        final QName q5 = QName.create(root, "list1");
-        final QName q6 = QName.create(root, "name");
-
-        final DataSchemaNode leafRefNode = rootMod.getDataChildByName(q1);
-        final DataSchemaNode targetNode = rootMod.getDataChildByName(q2);
-        final DataSchemaNode cont1Node = rootMod.getDataChildByName(q3);
-        final DataSchemaNode cont2Node = rootMod.getDataChildByName(q4);
-        final DataSchemaNode name1Node = ((DataNodeContainer) ((DataNodeContainer) rootMod
-                .getDataChildByName(q3)).getDataChildByName(q5))
-                .getDataChildByName(q6);
-
-        assertTrue(LeafRefContextUtils.isLeafRef(leafRefNode,
-                rootLeafRefContext));
-        assertFalse(LeafRefContextUtils.isLeafRef(targetNode,
-                rootLeafRefContext));
-
-        assertTrue(LeafRefContextUtils.hasLeafRefChild(cont1Node,
-                rootLeafRefContext));
-        assertFalse(LeafRefContextUtils.hasLeafRefChild(leafRefNode,
-                rootLeafRefContext));
-
-        assertTrue(LeafRefContextUtils.isReferencedByLeafRef(targetNode,
-                rootLeafRefContext));
-        assertFalse(LeafRefContextUtils.isReferencedByLeafRef(leafRefNode,
-                rootLeafRefContext));
-
-        assertTrue(LeafRefContextUtils.hasChildReferencedByLeafRef(cont2Node,
-                rootLeafRefContext));
-        assertFalse(LeafRefContextUtils.hasChildReferencedByLeafRef(
-                leafRefNode, rootLeafRefContext));
-
-        Map<QName, LeafRefContext> leafRefs = LeafRefContextUtils
-                .getAllLeafRefsReferencingThisNode(name1Node,
-                        rootLeafRefContext);
-        assertEquals(4, leafRefs.size());
-        leafRefs = LeafRefContextUtils.getAllLeafRefsReferencingThisNode(
-                leafRefNode, rootLeafRefContext);
-        assertTrue(leafRefs.isEmpty());
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/LeafRefContextTreeBuilderTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/leafref/context/test/LeafRefContextTreeBuilderTest.java
deleted file mode 100644 (file)
index 110f246..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.leafref.context.test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContext;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefContextUtils;
-import org.opendaylight.yangtools.yang.data.impl.leafref.LeafRefYangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-
-public class LeafRefContextTreeBuilderTest {
-
-    private static SchemaContext context;
-    private static Module impMod;
-    private static Module tstMod;
-    private static QNameModule imp;
-    private static QNameModule tst;
-    private static LeafRefContext rootLeafRefContext;
-
-    @BeforeClass
-    public static void init() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, LeafRefYangSyntaxErrorException {
-        final File resourceFile = new File(
-                LeafRefContextTreeBuilderTest.class
-                        .getResource(
-                                "/leafref-context-test/correct-modules/leafref-test.yang")
-                        .toURI());
-        final File resourceDir = resourceFile.getParentFile();
-
-        final YangParserImpl parser = YangParserImpl.getInstance();
-        context = parser.parseFile(resourceFile, resourceDir);
-
-        final Set<Module> modules = context.getModules();
-        for (final Module module : modules) {
-            if (module.getName().equals("import-mod")) {
-                impMod = module;
-            }
-            if (module.getName().equals("leafref-test")) {
-                tstMod = module;
-            }
-        }
-
-        imp = impMod.getQNameModule();
-        tst = tstMod.getQNameModule();
-
-        rootLeafRefContext = LeafRefContext.create(context);
-    }
-
-    @Test
-    public void buildLeafRefContextTreeTest1() {
-
-        final QName q1 = QName.create(tst, "odl-project");
-        final QName q2 = QName.create(tst, "project");
-        final QName q3 = QName.create(tst, "project-lead");
-
-        final LeafRefContext leafRefCtx = rootLeafRefContext
-                .getReferencingChildByName(q1).getReferencingChildByName(q2)
-                .getReferencingChildByName(q3);
-
-        assertTrue(leafRefCtx.isReferencing());
-        assertNotNull(leafRefCtx.getLeafRefTargetPath());
-        assertFalse(leafRefCtx.getLeafRefTargetPath().isAbsolute());
-        assertNotNull(leafRefCtx.getAbsoluteLeafRefTargetPath());
-        assertTrue(leafRefCtx.getAbsoluteLeafRefTargetPath().isAbsolute());
-
-        System.out.println();
-        System.out.println("******* Test 1 ************");
-        System.out.println("Original definition string:");
-        System.out.println(leafRefCtx.getLeafRefTargetPathString());
-        System.out.println("Parsed leafref path:");
-        System.out.println(leafRefCtx.getLeafRefTargetPath().toString());
-        System.out.println("Absolute leafref path:");
-        System.out
-                .println(leafRefCtx.getAbsoluteLeafRefTargetPath().toString());
-    }
-
-    @Test
-    public void buildLeafRefContextTreeTest2() {
-
-        final QName q1 = QName.create(tst, "odl-project");
-        final QName q2 = QName.create(tst, "project");
-        final QName q4 = QName.create(tst, "project-lead2");
-
-        final LeafRefContext leafRefCtx2 = rootLeafRefContext
-                .getReferencingChildByName(q1).getReferencingChildByName(q2)
-                .getReferencingChildByName(q4);
-
-        assertTrue(leafRefCtx2.isReferencing());
-        assertNotNull(leafRefCtx2.getLeafRefTargetPath());
-        assertTrue(leafRefCtx2.getLeafRefTargetPath().isAbsolute());
-        assertNotNull(leafRefCtx2.getAbsoluteLeafRefTargetPath());
-        assertTrue(leafRefCtx2.getAbsoluteLeafRefTargetPath().isAbsolute());
-
-        System.out.println();
-        System.out.println("******* Test 2 ************");
-        System.out.println("Original definition string2:");
-        System.out.println(leafRefCtx2.getLeafRefTargetPathString());
-        System.out.println("Parsed leafref path2:");
-        System.out.println(leafRefCtx2.getLeafRefTargetPath().toString());
-        System.out.println("Absolute leafref path2:");
-        System.out.println(leafRefCtx2.getAbsoluteLeafRefTargetPath()
-                .toString());
-        System.out.println();
-
-    }
-
-    @Test
-    public void buildLeafRefContextTreeXPathTest() {
-        final QName q1 = QName.create(tst, "odl-project");
-        final QName q2 = QName.create(tst, "project");
-        final QName q5 = QName.create(tst, "ch1");
-        final QName q6 = QName.create(tst, "c1");
-        final QName q7 = QName.create(tst, "ch2");
-        final QName q8 = QName.create(tst, "l1");
-        final LeafRefContext leafRefCtx3 = rootLeafRefContext
-                .getReferencingChildByName(q1).getReferencingChildByName(q2)
-                .getReferencingChildByName(q5).getReferencingChildByName(q6)
-                .getReferencingChildByName(q7).getReferencingChildByName(q6)
-                .getReferencingChildByName(q8);
-
-        assertTrue(leafRefCtx3.isReferencing());
-        assertNotNull(leafRefCtx3.getLeafRefTargetPath());
-        assertFalse(leafRefCtx3.getLeafRefTargetPath().isAbsolute());
-        assertNotNull(leafRefCtx3.getAbsoluteLeafRefTargetPath());
-        assertTrue(leafRefCtx3.getAbsoluteLeafRefTargetPath().isAbsolute());
-
-        System.out.println();
-        System.out.println("******* Test 3 ************");
-        System.out.println("Original definition string2:");
-        System.out.println(leafRefCtx3.getLeafRefTargetPathString());
-        System.out.println("Parsed leafref path2:");
-        System.out.println(leafRefCtx3.getLeafRefTargetPath().toString());
-        System.out.println("Absolute leafref path2:");
-        System.out.println(leafRefCtx3.getAbsoluteLeafRefTargetPath()
-                .toString());
-        System.out.println();
-    }
-
-    @Test
-    public void buildLeafRefContextTreeTest4() {
-        final QName q9 = QName.create(tst, "odl-project");
-        final QName q10 = QName.create(tst, "project");
-        final QName q11 = QName.create(tst, "name");
-
-        final LeafRefContext leafRefCtx4 = rootLeafRefContext
-                .getReferencedChildByName(q9).getReferencedChildByName(q10)
-                .getReferencedChildByName(q11);
-
-        assertNotNull(leafRefCtx4);
-        assertTrue(leafRefCtx4.isReferenced());
-        assertEquals(6, leafRefCtx4.getAllReferencedByLeafRefCtxs().size());
-
-    }
-
-    @Test
-    public void leafRefContextUtilsTest() {
-        final QName q1 = QName.create(tst, "odl-contributor");
-        final QName q2 = QName.create(tst, "contributor");
-        final QName q3 = QName.create(tst, "odl-project-name");
-
-        final LeafRefContext odlContrProjNameCtx = rootLeafRefContext
-                .getReferencingChildByName(q1).getReferencingChildByName(q2)
-                .getReferencingChildByName(q3);
-
-        final DataSchemaNode odlContrProjNameNode = ((DataNodeContainer) ((DataNodeContainer) tstMod
-                .getDataChildByName(q1)).getDataChildByName(q2))
-                .getDataChildByName(q3);
-
-        final LeafRefContext foundOdlContrProjNameCtx = LeafRefContextUtils
-                .getLeafRefReferencingContext(odlContrProjNameNode,
-                        rootLeafRefContext);
-
-        assertNotNull(foundOdlContrProjNameCtx);
-        assertTrue(foundOdlContrProjNameCtx.isReferencing());
-        assertNotNull(foundOdlContrProjNameCtx.getLeafRefTargetPath());
-        assertEquals(odlContrProjNameCtx, foundOdlContrProjNameCtx);
-    }
-
-    @Test
-    public void leafRefContextUtilsTest2() {
-        final QName q1 = QName.create(tst, "odl-project");
-        final QName q2 = QName.create(tst, "project");
-        final QName q3 = QName.create(tst, "name");
-
-        final LeafRefContext leafRefCtx = rootLeafRefContext
-                .getReferencedChildByName(q1).getReferencedChildByName(q2)
-                .getReferencedChildByName(q3);
-
-        final DataSchemaNode odlProjNameNode = ((DataNodeContainer) ((DataNodeContainer) tstMod
-                .getDataChildByName(q1)).getDataChildByName(q2))
-                .getDataChildByName(q3);
-
-        LeafRefContext foundOdlProjNameCtx = LeafRefContextUtils
-                .getLeafRefReferencingContext(odlProjNameNode,
-                        rootLeafRefContext);
-
-        assertNull(foundOdlProjNameCtx);
-
-        foundOdlProjNameCtx = LeafRefContextUtils
-                .getLeafRefReferencedByContext(odlProjNameNode,
-                        rootLeafRefContext);
-
-        assertNotNull(foundOdlProjNameCtx);
-        assertTrue(foundOdlProjNameCtx.isReferenced());
-        assertFalse(foundOdlProjNameCtx.getAllReferencedByLeafRefCtxs()
-                .isEmpty());
-        assertEquals(6, foundOdlProjNameCtx.getAllReferencedByLeafRefCtxs()
-                .size());
-        assertEquals(leafRefCtx, foundOdlProjNameCtx);
-    }
-
-    @Test
-    public void leafRefContextUtilsTest3() {
-        final QName q16 = QName.create(tst, "con1");
-        final DataSchemaNode con1 = tstMod.getDataChildByName(q16);
-        final List<LeafRefContext> allLeafRefChilds = LeafRefContextUtils
-                .findAllLeafRefChilds(con1, rootLeafRefContext);
-
-        assertNotNull(allLeafRefChilds);
-        assertFalse(allLeafRefChilds.isEmpty());
-        assertEquals(4, allLeafRefChilds.size());
-
-        final QName q17 = QName.create(tst, "odl-contributor");
-        final DataSchemaNode odlContributorNode = tstMod.getDataChildByName(q17);
-        List<LeafRefContext> allChildsReferencedByLeafRef = LeafRefContextUtils
-                .findAllChildsReferencedByLeafRef(odlContributorNode,
-                        rootLeafRefContext);
-
-        assertNotNull(allChildsReferencedByLeafRef);
-        assertFalse(allChildsReferencedByLeafRef.isEmpty());
-        assertEquals(1, allChildsReferencedByLeafRef.size());
-
-        allChildsReferencedByLeafRef = LeafRefContextUtils
-                .findAllChildsReferencedByLeafRef(con1, rootLeafRefContext);
-
-        assertNotNull(allChildsReferencedByLeafRef);
-        assertTrue(allChildsReferencedByLeafRef.isEmpty());
-
-    }
-
-    @Test(expected = RuntimeException.class)
-    public void incorrectLeafRefPathTest() throws URISyntaxException,
-            IOException, YangSyntaxErrorException,
-            LeafRefYangSyntaxErrorException {
-        final File resourceFile = new File(getClass().getResource(
-                "/leafref-context-test/incorrect-modules/leafref-test.yang")
-                .toURI());
-        final File resourceDir = resourceFile.getParentFile();
-
-        final YangParserImpl parser = YangParserImpl.getInstance();
-        final SchemaContext context = parser.parseFile(resourceFile, resourceDir);
-
-        LeafRefContext.create(context);
-
-    }
-
-}
similarity index 98%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/test/BuilderTest.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/BuilderTest.java
index 76e7189d058a371c41f3f033da400a40ad9e250c..10bf9a2380dbb3faa3ae26cc9b39ce0f692ed5f4 100644 (file)
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.data.impl.schema.test;
+package org.opendaylight.yangtools.yang.data.impl.schema;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -34,9 +34,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.OrderedLeafSetNode;
 import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableAugmentationNodeBuilder;
@@ -95,7 +93,7 @@ public class BuilderTest {
     public void setup() throws FileNotFoundException, ReactorException, URISyntaxException {
         final File leafRefTestYang = new File(getClass().getResource("/builder-test/immutable-ordered-map-node.yang")
                 .toURI());
-        final SchemaContext schema = RetestUtils.parseYangSources(leafRefTestYang);
+        final SchemaContext schema = TestUtils.parseYangSources(leafRefTestYang);
         final Module module = schema.getModules().iterator().next();
         final DataSchemaNode root = module.getDataChildByName(ROOT_CONTAINER);
         list = (ListSchemaNode)((ContainerEffectiveStatementImpl) root).getDataChildByName(LIST_MAIN);
index 5b1fdf3cd758c7ed55297967f7570c1c2a407222..d25c7d0f1dece9f219b0c4323a684b8ef13245f7 100644 (file)
@@ -1,20 +1,18 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 package org.opendaylight.yangtools.yang.data.impl.schema;
 
 import static org.junit.Assert.assertEquals;
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.io.ByteSource;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.URISyntaxException;
 import java.util.Collections;
-import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -27,144 +25,180 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class InstanceIdToNodesTest {
 
     private static final String NS = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:normalization:test";
     private static final String REVISION = "2014-03-13";
     private static final QName ID = QName.create(NS, REVISION, "id");
-    private SchemaContext ctx;
+    private static SchemaContext ctx;
 
     private final NodeIdentifier rootContainer = new NodeIdentifier(QName.create(NS, REVISION, "test"));
     private final NodeIdentifier outerContainer = new NodeIdentifier(QName.create(NS, REVISION, "outer-container"));
     private final NodeIdentifier augmentedLeaf = new NodeIdentifier(QName.create(NS, REVISION, "augmented-leaf"));
-    private final AugmentationIdentifier augmentation = new AugmentationIdentifier(Collections.singleton(augmentedLeaf.getNodeType()));
+    private final AugmentationIdentifier augmentation = new AugmentationIdentifier(
+            Collections.singleton(augmentedLeaf.getNodeType()));
 
-    private final NodeIdentifier outerList = new NodeIdentifier(QName.create(NS, REVISION, "outer-list"));
-    private final NodeIdentifierWithPredicates outerListWithKey = new NodeIdentifierWithPredicates(QName.create(NS, REVISION, "outer-list"), ID, 1);
+    private final NodeIdentifier outerList = new NodeIdentifier(
+            QName.create(NS, REVISION, "outer-list"));
+    private final NodeIdentifierWithPredicates outerListWithKey = new NodeIdentifierWithPredicates(
+            QName.create(NS, REVISION, "outer-list"), ID, 1);
     private final NodeIdentifier choice = new NodeIdentifier(QName.create(NS, REVISION, "outer-choice"));
     private final NodeIdentifier leafFromCase = new NodeIdentifier(QName.create(NS, REVISION, "one"));
 
     private final NodeIdentifier leafList = new NodeIdentifier(QName.create(NS, REVISION, "ordered-leaf-list"));
-    private final NodeWithValue<?> leafListWithValue = new NodeWithValue<>(leafList.getNodeType(), "abcd");
-
-    static SchemaContext createTestContext() throws IOException, YangSyntaxErrorException {
-        final YangParserImpl parser = new YangParserImpl();
-        return parser.parseSources(Collections2.transform(Collections.singletonList("/filter-test.yang"), new Function<String, ByteSource>() {
-            @Override
-            public ByteSource apply(final String input) {
-                return new ByteSource() {
-                    @Override
-                    public InputStream openStream() throws IOException {
-                        return InstanceIdToNodesTest.class.getResourceAsStream(input);
-                    }
-                };
-            }
-        }));
+    private final NodeWithValue<?> leafListWithValue = new NodeWithValue<>(
+            leafList.getNodeType(), "abcd");
+
+    static SchemaContext createTestContext() throws URISyntaxException, FileNotFoundException, ReactorException {
+        final File resourceFile = new File(InstanceIdToNodesTest.class.getResource("/filter-test.yang").toURI());
+        return TestUtils.parseYangSources(resourceFile);
     }
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeClass
+    public static void setUp() throws Exception {
         ctx = createTestContext();
 
     }
 
     @Test
     public void testInAugment() throws Exception {
-        final ContainerNode expectedFilter = Builders.containerBuilder().withNodeIdentifier(rootContainer).withChild(
-                Builders.containerBuilder().withNodeIdentifier(outerContainer).withChild(
-                        Builders.augmentationBuilder().withNodeIdentifier(augmentation).withChild(
-                                Builders.leafBuilder().withNodeIdentifier(augmentedLeaf).build()
-                        ).build()
-                ).build()
-        ).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx, YangInstanceIdentifier.create(rootContainer, outerContainer, augmentation, augmentedLeaf));
+        final ContainerNode expectedFilter = Builders
+                .containerBuilder()
+                .withNodeIdentifier(rootContainer)
+                .withChild(
+                        Builders.containerBuilder()
+                                .withNodeIdentifier(outerContainer)
+                                .withChild(
+                                        Builders.augmentationBuilder()
+                                                .withNodeIdentifier(augmentation)
+                                                .withChild(
+                                                        Builders.leafBuilder().withNodeIdentifier(augmentedLeaf)
+                                                                .build()).build()).build()).build();
+
+        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
+                YangInstanceIdentifier.create(rootContainer, outerContainer, augmentation, augmentedLeaf));
         assertEquals(expectedFilter, filter);
     }
 
     @Test
     public void testInAugmentLeafOverride() throws Exception {
-        final LeafNode<Object> lastLeaf = Builders.leafBuilder().withNodeIdentifier(augmentedLeaf).withValue("randomValue").build();
-
-        final ContainerNode expectedFilter = Builders.containerBuilder().withNodeIdentifier(rootContainer).withChild(
-                Builders.containerBuilder().withNodeIdentifier(outerContainer).withChild(
-                        Builders.augmentationBuilder().withNodeIdentifier(augmentation).withChild(
-                                lastLeaf
-                        ).build()
-                ).build()
-        ).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx, YangInstanceIdentifier.create(rootContainer, outerContainer, augmentation, augmentedLeaf), lastLeaf);
+        final LeafNode<Object> lastLeaf = Builders.leafBuilder().withNodeIdentifier(augmentedLeaf)
+                .withValue("randomValue").build();
+
+        final ContainerNode expectedFilter = Builders
+                .containerBuilder()
+                .withNodeIdentifier(rootContainer)
+                .withChild(
+                        Builders.containerBuilder()
+                                .withNodeIdentifier(outerContainer)
+                                .withChild(
+                                        Builders.augmentationBuilder().withNodeIdentifier(augmentation)
+                                                .withChild(lastLeaf).build()).build()).build();
+
+        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
+                YangInstanceIdentifier.create(rootContainer, outerContainer, augmentation, augmentedLeaf), lastLeaf);
         assertEquals(expectedFilter, filter);
     }
 
     @Test
     public void testListChoice() throws Exception {
-        final ContainerNode expectedFilter = Builders.containerBuilder().withNodeIdentifier(rootContainer).withChild(
-                Builders.mapBuilder().withNodeIdentifier(outerList).withChild(
-                        Builders.mapEntryBuilder().withNodeIdentifier(outerListWithKey).withChild(
-                                Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(ID)).withValue(1).build()
-                        ).withChild(
-                                Builders.choiceBuilder().withNodeIdentifier(choice).withChild(
-                                        Builders.leafBuilder().withNodeIdentifier(leafFromCase).build()
-                                ).build()
-                        ).build()
-                ).build()
-        ).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx, YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey, choice, leafFromCase));
+        final ContainerNode expectedFilter = Builders
+                .containerBuilder()
+                .withNodeIdentifier(rootContainer)
+                .withChild(
+                        Builders.mapBuilder()
+                                .withNodeIdentifier(outerList)
+                                .withChild(
+                                        Builders.mapEntryBuilder()
+                                                .withNodeIdentifier(outerListWithKey)
+                                                .withChild(
+                                                        Builders.leafBuilder()
+                                                                .withNodeIdentifier(
+                                                                        new NodeIdentifier(ID))
+                                                                .withValue(1).build())
+                                                .withChild(
+                                                        Builders.choiceBuilder()
+                                                                .withNodeIdentifier(choice)
+                                                                .withChild(
+                                                                        Builders.leafBuilder()
+                                                                                .withNodeIdentifier(leafFromCase)
+                                                                                .build()).build()).build()).build())
+                .build();
+
+        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
+                YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey, choice, leafFromCase));
         assertEquals(expectedFilter, filter);
     }
 
     @Test
     public void testTopContainerLastChildOverride() throws Exception {
-        final ContainerNode expectedStructure = Builders.containerBuilder().withNodeIdentifier(rootContainer).withChild(
-                Builders.mapBuilder().withNodeIdentifier(outerList).withChild(
-                        Builders.mapEntryBuilder().withNodeIdentifier(outerListWithKey).withChild(
-                                Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(ID)).withValue(1).build()
-                        ).withChild(
-                                Builders.choiceBuilder().withNodeIdentifier(choice).withChild(
-                                        Builders.leafBuilder().withNodeIdentifier(leafFromCase).build()
-                                ).build()
-                        ).build()
-                ).build()
-        ).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx, YangInstanceIdentifier.create(rootContainer), expectedStructure);
+        final ContainerNode expectedStructure = Builders
+                .containerBuilder()
+                .withNodeIdentifier(rootContainer)
+                .withChild(
+                        Builders.mapBuilder()
+                                .withNodeIdentifier(outerList)
+                                .withChild(
+                                        Builders.mapEntryBuilder()
+                                                .withNodeIdentifier(outerListWithKey)
+                                                .withChild(
+                                                        Builders.leafBuilder()
+                                                                .withNodeIdentifier(
+                                                                        new NodeIdentifier(ID))
+                                                                .withValue(1).build())
+                                                .withChild(
+                                                        Builders.choiceBuilder()
+                                                                .withNodeIdentifier(choice)
+                                                                .withChild(
+                                                                        Builders.leafBuilder()
+                                                                                .withNodeIdentifier(leafFromCase)
+                                                                                .build()).build()).build()).build())
+                .build();
+
+        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
+                YangInstanceIdentifier.create(rootContainer), expectedStructure);
         assertEquals(expectedStructure, filter);
     }
 
     @Test
     public void testListLastChildOverride() throws Exception {
-        final MapEntryNode outerListEntry = Builders.mapEntryBuilder().withNodeIdentifier(outerListWithKey).withChild(
-                Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(ID)).withValue(1).build()
-        ).build();
-        final MapNode lastChild = Builders.mapBuilder().withNodeIdentifier(this.outerList).withChild(
-                outerListEntry
-        ).build();
-        final ContainerNode expectedStructure = Builders.containerBuilder().withNodeIdentifier(rootContainer).withChild(
-                lastChild
-        ).build();
-
-        NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx, YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey), outerListEntry);
+        final MapEntryNode outerListEntry = Builders
+                .mapEntryBuilder()
+                .withNodeIdentifier(outerListWithKey)
+                .withChild(
+                        Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(ID))
+                                .withValue(1).build()).build();
+        final MapNode lastChild = Builders.mapBuilder().withNodeIdentifier(this.outerList).withChild(outerListEntry)
+                .build();
+        final ContainerNode expectedStructure = Builders.containerBuilder().withNodeIdentifier(rootContainer)
+                .withChild(lastChild).build();
+
+        NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
+                YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey), outerListEntry);
         assertEquals(expectedStructure, filter);
-        filter = ImmutableNodes.fromInstanceId(ctx, YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey));
+        filter = ImmutableNodes.fromInstanceId(ctx,
+                YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey));
         assertEquals(expectedStructure, filter);
     }
 
     @Test
     public void testLeafList() throws Exception {
-        final ContainerNode expectedFilter = Builders.containerBuilder().withNodeIdentifier(rootContainer).withChild(
-                Builders.orderedLeafSetBuilder().withNodeIdentifier(leafList).withChild(
-                        Builders.leafSetEntryBuilder().withNodeIdentifier(leafListWithValue).withValue(leafListWithValue.getValue()).build()
-                ).build()
-        ).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx, YangInstanceIdentifier.create(rootContainer, leafList, leafListWithValue));
+        final ContainerNode expectedFilter = Builders
+                .containerBuilder()
+                .withNodeIdentifier(rootContainer)
+                .withChild(
+                        Builders.orderedLeafSetBuilder()
+                                .withNodeIdentifier(leafList)
+                                .withChild(
+                                        Builders.leafSetEntryBuilder().withNodeIdentifier(leafListWithValue)
+                                                .withValue(leafListWithValue.getValue()).build()).build()).build();
+
+        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
+                YangInstanceIdentifier.create(rootContainer, leafList, leafListWithValue));
         assertEquals(expectedFilter, filter);
     }
 }
\ No newline at end of file
index 8fd5e28a85abe1a431c689c90be106ff6d70d865..c4ba341711f15887d92b8084c93c56d1cfba5e68 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -7,15 +7,13 @@
  */
 package org.opendaylight.yangtools.yang.data.impl.schema;
 
-import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Resources;
-import java.io.IOException;
+import java.io.File;
+import java.io.FileNotFoundException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Collections;
 import java.util.List;
 import org.junit.Before;
@@ -32,6 +30,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableChoiceNodeSchemaAwareBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeSchemaAwareBuilder;
@@ -45,40 +44,23 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class NormalizedDataBuilderTest {
 
     private ContainerSchemaNode containerNode;
     private SchemaContext schema;
 
-    SchemaContext parseTestSchema(final String... yangPath) throws IOException, YangSyntaxErrorException {
-        YangParserImpl yangParserImpl = new YangParserImpl();
-        return yangParserImpl.parseSources(getTestYangs(yangPath));
-    }
-
-    List<ByteSource> getTestYangs(final String... yangPaths) {
-
-        return Lists.newArrayList(Collections2.transform(Lists.newArrayList(yangPaths),
-                new Function<String, ByteSource>() {
-            @Override
-            public ByteSource apply(final String input) {
-                ByteSource resourceAsStream = Resources.asByteSource(getClass().getResource(input));
-                Preconditions.checkNotNull(resourceAsStream, "File %s was null", resourceAsStream);
-                return resourceAsStream;
-            }
-        }));
-    }
-
     @Before
-    public void setUp() throws Exception {
-        schema = parseTestSchema("test.yang");
+    public void setUp() throws URISyntaxException, FileNotFoundException, ReactorException {
+        final File resourceFile = new File(getClass().getResource(
+                "test.yang").toURI());
+        schema = TestUtils.parseYangSources(resourceFile);
         containerNode = (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
     }
 
     @Test
-    public void testSchemaUnaware() throws Exception {
+    public void testSchemaUnaware() {
         // Container
         DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builder = Builders
                 .containerBuilder().withNodeIdentifier(getNodeIdentifier("container"));
@@ -95,8 +77,8 @@ public class NormalizedDataBuilderTest {
                 .withChildValue(1)
                 .withChild(
                         Builders.<Integer> leafSetEntryBuilder()
-                        .withNodeIdentifier(getNodeWithValueIdentifier("leaf", 3)).withValue(3).build())
-                        .build();
+                                .withNodeIdentifier(getNodeWithValueIdentifier("leaf", 3)).withValue(3).build())
+                .build();
         builder.withChild(leafList);
 
         // list
@@ -104,12 +86,12 @@ public class NormalizedDataBuilderTest {
                 .mapEntryBuilder()
                 .withChild(
                         Builders.<Integer> leafBuilder().withNodeIdentifier(getNodeIdentifier("uint32InList"))
-                        .withValue(1).build())
-                        .withChild(Builders.containerBuilder().withNodeIdentifier(getNodeIdentifier("containerInList")).build())
-                        .withNodeIdentifier(
-                                new NodeIdentifierWithPredicates(getNodeIdentifier("list").getNodeType(),
-                                        Collections.singletonMap(getNodeIdentifier("uint32InList").getNodeType(), (Object) 1)))
-                                        .build();
+                                .withValue(1).build())
+                .withChild(Builders.containerBuilder().withNodeIdentifier(getNodeIdentifier("containerInList")).build())
+                .withNodeIdentifier(
+                        new NodeIdentifierWithPredicates(
+                                getNodeIdentifier("list").getNodeType(), Collections.singletonMap(
+                                getNodeIdentifier("uint32InList").getNodeType(), (Object) 1))).build();
 
         MapNode list = Builders.mapBuilder().withChild(listChild1).withNodeIdentifier(getNodeIdentifier("list"))
                 .build();
@@ -119,8 +101,8 @@ public class NormalizedDataBuilderTest {
                 .augmentationBuilder()
                 .withNodeIdentifier(
                         new AugmentationIdentifier(Sets.newHashSet(getQName("augmentUint32"))))
-                        .withChild(
-                                Builders.<Integer> leafBuilder().withNodeIdentifier(getNodeIdentifier("augmentUint32"))
+                .withChild(
+                        Builders.<Integer>leafBuilder().withNodeIdentifier(getNodeIdentifier("augmentUint32"))
                                 .withValue(11).build()).build();
 
         builder.withChild(augmentation);
@@ -132,7 +114,7 @@ public class NormalizedDataBuilderTest {
     }
 
     @Test
-    public void testSchemaAware() throws Exception {
+    public void testSchemaAware() {
         DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builder = Builders
                 .containerBuilder(containerNode);
 
@@ -162,7 +144,7 @@ public class NormalizedDataBuilderTest {
                 augmentUint32SchemaNode.getQName());
 
         AugmentationNode augmentation = Builders.augmentationBuilder(augmentationSchema)
-                .withChild(Builders.<Integer>leafBuilder(augmentUint32SchemaNode).withValue(11).build()).build();
+                .withChild(Builders.<Integer> leafBuilder(augmentUint32SchemaNode).withValue(11).build()).build();
 
         builder.withChild(augmentation);
 
@@ -173,8 +155,7 @@ public class NormalizedDataBuilderTest {
         LeafSchemaNode augumentString2SchemaNode = (LeafSchemaNode) getSchemaNode(schema, "test", "augmentString2");
 
         ChoiceSchemaNode choice1SchemaNode = (ChoiceSchemaNode) getSchemaNode(schema, "test", "choice");
-        ChoiceNode choice = ImmutableChoiceNodeSchemaAwareBuilder
-                .create(choice1SchemaNode)
+        ChoiceNode choice = ImmutableChoiceNodeSchemaAwareBuilder.create(choice1SchemaNode)
                 .withChild(Builders.<String> leafBuilder(augumentString1SchemaNode).withValue("case1").build())
                 // This should fail, since child node belongs to different case
                 // .withChild(Builders.<String>leafBuilder(augumentString2SchemaNode).withValue("case2")
@@ -188,7 +169,8 @@ public class NormalizedDataBuilderTest {
         // .build());
     }
 
-    private static AugmentationSchema getAugmentationSchemaForChild(final ContainerSchemaNode containerNode, final QName qName) {
+    private static AugmentationSchema getAugmentationSchemaForChild(final ContainerSchemaNode containerNode,
+            final QName qName) {
         for (AugmentationSchema augmentationSchema : containerNode.getAvailableAugmentations()) {
             if (augmentationSchema.getDataChildByName(qName) != null) {
                 return augmentationSchema;
@@ -210,7 +192,8 @@ public class NormalizedDataBuilderTest {
         return new NodeIdentifier(getQName(localName));
     }
 
-    public static DataSchemaNode getSchemaNode(final SchemaContext context, final String moduleName, final String childNodeName) {
+    public static DataSchemaNode getSchemaNode(final SchemaContext context, final String moduleName,
+            final String childNodeName) {
         for (Module module : context.getModules()) {
             if (module.getName().equals(moduleName)) {
                 DataSchemaNode found = findChildNode(module.getChildNodes(), childNodeName);
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.data.impl.schema.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.data.impl.schema;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/retest/InstanceIdToNodesTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/retest/InstanceIdToNodesTest.java
deleted file mode 100644 (file)
index 5aabff3..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.retest;
-
-import static org.junit.Assert.assertEquals;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-public class InstanceIdToNodesTest {
-
-    private static final String NS = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:normalization:test";
-    private static final String REVISION = "2014-03-13";
-    private static final QName ID = QName.create(NS, REVISION, "id");
-    private static SchemaContext ctx;
-
-    private final NodeIdentifier rootContainer = new NodeIdentifier(QName.create(NS, REVISION, "test"));
-    private final NodeIdentifier outerContainer = new NodeIdentifier(QName.create(NS, REVISION, "outer-container"));
-    private final NodeIdentifier augmentedLeaf = new NodeIdentifier(QName.create(NS, REVISION, "augmented-leaf"));
-    private final AugmentationIdentifier augmentation = new AugmentationIdentifier(
-            Collections.singleton(augmentedLeaf.getNodeType()));
-
-    private final NodeIdentifier outerList = new NodeIdentifier(
-            QName.create(NS, REVISION, "outer-list"));
-    private final NodeIdentifierWithPredicates outerListWithKey = new NodeIdentifierWithPredicates(
-            QName.create(NS, REVISION, "outer-list"), ID, 1);
-    private final NodeIdentifier choice = new NodeIdentifier(QName.create(NS, REVISION, "outer-choice"));
-    private final NodeIdentifier leafFromCase = new NodeIdentifier(QName.create(NS, REVISION, "one"));
-
-    private final NodeIdentifier leafList = new NodeIdentifier(QName.create(NS, REVISION, "ordered-leaf-list"));
-    private final NodeWithValue<?> leafListWithValue = new NodeWithValue<>(
-            leafList.getNodeType(), "abcd");
-
-    static SchemaContext createTestContext() throws URISyntaxException, FileNotFoundException, ReactorException {
-        final File resourceFile = new File(InstanceIdToNodesTest.class.getResource("/filter-test.yang").toURI());
-        return RetestUtils.parseYangSources(resourceFile);
-    }
-
-    @BeforeClass
-    public static void setUp() throws Exception {
-        ctx = createTestContext();
-
-    }
-
-    @Test
-    public void testInAugment() throws Exception {
-        final ContainerNode expectedFilter = Builders
-                .containerBuilder()
-                .withNodeIdentifier(rootContainer)
-                .withChild(
-                        Builders.containerBuilder()
-                                .withNodeIdentifier(outerContainer)
-                                .withChild(
-                                        Builders.augmentationBuilder()
-                                                .withNodeIdentifier(augmentation)
-                                                .withChild(
-                                                        Builders.leafBuilder().withNodeIdentifier(augmentedLeaf)
-                                                                .build()).build()).build()).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
-                YangInstanceIdentifier.create(rootContainer, outerContainer, augmentation, augmentedLeaf));
-        assertEquals(expectedFilter, filter);
-    }
-
-    @Test
-    public void testInAugmentLeafOverride() throws Exception {
-        final LeafNode<Object> lastLeaf = Builders.leafBuilder().withNodeIdentifier(augmentedLeaf)
-                .withValue("randomValue").build();
-
-        final ContainerNode expectedFilter = Builders
-                .containerBuilder()
-                .withNodeIdentifier(rootContainer)
-                .withChild(
-                        Builders.containerBuilder()
-                                .withNodeIdentifier(outerContainer)
-                                .withChild(
-                                        Builders.augmentationBuilder().withNodeIdentifier(augmentation)
-                                                .withChild(lastLeaf).build()).build()).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
-                YangInstanceIdentifier.create(rootContainer, outerContainer, augmentation, augmentedLeaf), lastLeaf);
-        assertEquals(expectedFilter, filter);
-    }
-
-    @Test
-    public void testListChoice() throws Exception {
-        final ContainerNode expectedFilter = Builders
-                .containerBuilder()
-                .withNodeIdentifier(rootContainer)
-                .withChild(
-                        Builders.mapBuilder()
-                                .withNodeIdentifier(outerList)
-                                .withChild(
-                                        Builders.mapEntryBuilder()
-                                                .withNodeIdentifier(outerListWithKey)
-                                                .withChild(
-                                                        Builders.leafBuilder()
-                                                                .withNodeIdentifier(
-                                                                        new NodeIdentifier(ID))
-                                                                .withValue(1).build())
-                                                .withChild(
-                                                        Builders.choiceBuilder()
-                                                                .withNodeIdentifier(choice)
-                                                                .withChild(
-                                                                        Builders.leafBuilder()
-                                                                                .withNodeIdentifier(leafFromCase)
-                                                                                .build()).build()).build()).build())
-                .build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
-                YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey, choice, leafFromCase));
-        assertEquals(expectedFilter, filter);
-    }
-
-    @Test
-    public void testTopContainerLastChildOverride() throws Exception {
-        final ContainerNode expectedStructure = Builders
-                .containerBuilder()
-                .withNodeIdentifier(rootContainer)
-                .withChild(
-                        Builders.mapBuilder()
-                                .withNodeIdentifier(outerList)
-                                .withChild(
-                                        Builders.mapEntryBuilder()
-                                                .withNodeIdentifier(outerListWithKey)
-                                                .withChild(
-                                                        Builders.leafBuilder()
-                                                                .withNodeIdentifier(
-                                                                        new NodeIdentifier(ID))
-                                                                .withValue(1).build())
-                                                .withChild(
-                                                        Builders.choiceBuilder()
-                                                                .withNodeIdentifier(choice)
-                                                                .withChild(
-                                                                        Builders.leafBuilder()
-                                                                                .withNodeIdentifier(leafFromCase)
-                                                                                .build()).build()).build()).build())
-                .build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
-                YangInstanceIdentifier.create(rootContainer), expectedStructure);
-        assertEquals(expectedStructure, filter);
-    }
-
-    @Test
-    public void testListLastChildOverride() throws Exception {
-        final MapEntryNode outerListEntry = Builders
-                .mapEntryBuilder()
-                .withNodeIdentifier(outerListWithKey)
-                .withChild(
-                        Builders.leafBuilder().withNodeIdentifier(new NodeIdentifier(ID))
-                                .withValue(1).build()).build();
-        final MapNode lastChild = Builders.mapBuilder().withNodeIdentifier(this.outerList).withChild(outerListEntry)
-                .build();
-        final ContainerNode expectedStructure = Builders.containerBuilder().withNodeIdentifier(rootContainer)
-                .withChild(lastChild).build();
-
-        NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
-                YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey), outerListEntry);
-        assertEquals(expectedStructure, filter);
-        filter = ImmutableNodes.fromInstanceId(ctx,
-                YangInstanceIdentifier.create(rootContainer, outerList, outerListWithKey));
-        assertEquals(expectedStructure, filter);
-    }
-
-    @Test
-    public void testLeafList() throws Exception {
-        final ContainerNode expectedFilter = Builders
-                .containerBuilder()
-                .withNodeIdentifier(rootContainer)
-                .withChild(
-                        Builders.orderedLeafSetBuilder()
-                                .withNodeIdentifier(leafList)
-                                .withChild(
-                                        Builders.leafSetEntryBuilder().withNodeIdentifier(leafListWithValue)
-                                                .withValue(leafListWithValue.getValue()).build()).build()).build();
-
-        final NormalizedNode<?, ?> filter = ImmutableNodes.fromInstanceId(ctx,
-                YangInstanceIdentifier.create(rootContainer, leafList, leafListWithValue));
-        assertEquals(expectedFilter, filter);
-    }
-}
\ No newline at end of file
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/retest/NormalizedDataBuilderTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/retest/NormalizedDataBuilderTest.java
deleted file mode 100644 (file)
index 20c413d..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.retest;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
-import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableChoiceNodeSchemaAwareBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeSchemaAwareBuilder;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-public class NormalizedDataBuilderTest {
-
-    private ContainerSchemaNode containerNode;
-    private SchemaContext schema;
-
-    @Before
-    public void setUp() throws URISyntaxException, FileNotFoundException, ReactorException {
-        final File resourceFile = new File(getClass().getResource(
-                "../test.yang").toURI());
-        schema = RetestUtils.parseYangSources(resourceFile);
-        containerNode = (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
-    }
-
-    @Test
-    public void testSchemaUnaware() {
-        // Container
-        DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builder = Builders
-                .containerBuilder().withNodeIdentifier(getNodeIdentifier("container"));
-
-        // leaf
-        LeafNode<String> leafChild = Builders.<String> leafBuilder().withNodeIdentifier(getNodeIdentifier("leaf"))
-                .withValue("String").build();
-        builder.withChild(leafChild);
-
-        // leafList
-        LeafSetNode<Integer> leafList = Builders
-                .<Integer> leafSetBuilder()
-                .withNodeIdentifier(getNodeIdentifier("leaf"))
-                .withChildValue(1)
-                .withChild(
-                        Builders.<Integer> leafSetEntryBuilder()
-                                .withNodeIdentifier(getNodeWithValueIdentifier("leaf", 3)).withValue(3).build())
-                .build();
-        builder.withChild(leafList);
-
-        // list
-        MapEntryNode listChild1 = Builders
-                .mapEntryBuilder()
-                .withChild(
-                        Builders.<Integer> leafBuilder().withNodeIdentifier(getNodeIdentifier("uint32InList"))
-                                .withValue(1).build())
-                .withChild(Builders.containerBuilder().withNodeIdentifier(getNodeIdentifier("containerInList")).build())
-                .withNodeIdentifier(
-                        new NodeIdentifierWithPredicates(
-                                getNodeIdentifier("list").getNodeType(), Collections.singletonMap(
-                                getNodeIdentifier("uint32InList").getNodeType(), (Object) 1))).build();
-
-        MapNode list = Builders.mapBuilder().withChild(listChild1).withNodeIdentifier(getNodeIdentifier("list"))
-                .build();
-        builder.withChild(list);
-
-        AugmentationNode augmentation = Builders
-                .augmentationBuilder()
-                .withNodeIdentifier(
-                        new AugmentationIdentifier(Sets.newHashSet(getQName("augmentUint32"))))
-                .withChild(
-                        Builders.<Integer>leafBuilder().withNodeIdentifier(getNodeIdentifier("augmentUint32"))
-                                .withValue(11).build()).build();
-
-        builder.withChild(augmentation);
-
-        // This works without schema (adding child from augment as a direct
-        // child)
-        builder.withChild(Builders.<Integer> leafBuilder().withNodeIdentifier(getNodeIdentifier("augmentUint32"))
-                .withValue(11).build());
-    }
-
-    @Test
-    public void testSchemaAware() {
-        DataContainerNodeBuilder<NodeIdentifier, ContainerNode> builder = Builders
-                .containerBuilder(containerNode);
-
-        LeafSchemaNode schemaNode = (LeafSchemaNode) getSchemaNode(schema, "test", "uint32");
-        LeafNode<String> leafChild = Builders.<String> leafBuilder(schemaNode).withValue("String").build();
-        builder.withChild(leafChild);
-
-        LeafListSchemaNode leafListSchemaNode = (LeafListSchemaNode) getSchemaNode(schema, "test", "leafList");
-        LeafSetNode<Integer> leafList = Builders.<Integer> leafSetBuilder(leafListSchemaNode).withChildValue(1)
-                .withChild(Builders.<Integer> leafSetEntryBuilder(leafListSchemaNode).withValue(3).build()).build();
-        builder.withChild(leafList);
-
-        ListSchemaNode listSchema = (ListSchemaNode) getSchemaNode(schema, "test", "list");
-        LeafSchemaNode uint32InListSchemaNode = (LeafSchemaNode) getSchemaNode(schema, "test", "uint32InList");
-        ContainerSchemaNode containerInListSchemaNode = (ContainerSchemaNode) getSchemaNode(schema, "test",
-                "containerInList");
-
-        MapEntryNode listChild1 = Builders.mapEntryBuilder(listSchema)
-                .withChild(Builders.<Integer> leafBuilder(uint32InListSchemaNode).withValue(1).build())
-                .withChild(Builders.containerBuilder(containerInListSchemaNode).build()).build();
-
-        MapNode list = ImmutableMapNodeSchemaAwareBuilder.create(listSchema).withChild(listChild1).build();
-        builder.withChild(list);
-
-        LeafSchemaNode augmentUint32SchemaNode = (LeafSchemaNode) getSchemaNode(schema, "test", "augmentUint32");
-        AugmentationSchema augmentationSchema = getAugmentationSchemaForChild(containerNode,
-                augmentUint32SchemaNode.getQName());
-
-        AugmentationNode augmentation = Builders.augmentationBuilder(augmentationSchema)
-                .withChild(Builders.<Integer> leafBuilder(augmentUint32SchemaNode).withValue(11).build()).build();
-
-        builder.withChild(augmentation);
-
-        // This should fail with schema, since the leaf comes from augmentation
-        // builder.withChild(ImmutableLeafNodeSchemaAwareBuilder.<Integer>get(augmentUint32SchemaNode).withValue(11).build());
-
-        LeafSchemaNode augumentString1SchemaNode = (LeafSchemaNode) getSchemaNode(schema, "test", "augmentString1");
-        LeafSchemaNode augumentString2SchemaNode = (LeafSchemaNode) getSchemaNode(schema, "test", "augmentString2");
-
-        ChoiceSchemaNode choice1SchemaNode = (ChoiceSchemaNode) getSchemaNode(schema, "test", "choice");
-        ChoiceNode choice = ImmutableChoiceNodeSchemaAwareBuilder.create(choice1SchemaNode)
-                .withChild(Builders.<String> leafBuilder(augumentString1SchemaNode).withValue("case1").build())
-                // This should fail, since child node belongs to different case
-                // .withChild(Builders.<String>leafBuilder(augumentString2SchemaNode).withValue("case2")
-                // .build())
-                .build();
-
-        builder.withChild(choice);
-
-        // This should fail, child from case
-        // builder.withChild(Builders.<String>leafBuilder(augumentString1SchemaNode).withValue("case1")
-        // .build());
-    }
-
-    private static AugmentationSchema getAugmentationSchemaForChild(final ContainerSchemaNode containerNode,
-            final QName qName) {
-        for (AugmentationSchema augmentationSchema : containerNode.getAvailableAugmentations()) {
-            if (augmentationSchema.getDataChildByName(qName) != null) {
-                return augmentationSchema;
-            }
-        }
-        throw new IllegalStateException("Unable to find child augmentation in " + containerNode);
-    }
-
-    private static <T> NodeWithValue<T> getNodeWithValueIdentifier(final String localName, final T value) {
-        return new NodeWithValue<>(getQName(localName), value);
-    }
-
-    private static QName getQName(final String localName) {
-        String namespace = "namespace";
-        return new QName(URI.create(namespace), localName);
-    }
-
-    private static NodeIdentifier getNodeIdentifier(final String localName) {
-        return new NodeIdentifier(getQName(localName));
-    }
-
-    public static DataSchemaNode getSchemaNode(final SchemaContext context, final String moduleName,
-            final String childNodeName) {
-        for (Module module : context.getModules()) {
-            if (module.getName().equals(moduleName)) {
-                DataSchemaNode found = findChildNode(module.getChildNodes(), childNodeName);
-                Preconditions.checkState(found != null, "Unable to find %s", childNodeName);
-                return found;
-            }
-        }
-        throw new IllegalStateException("Unable to find child node " + childNodeName);
-    }
-
-    private static DataSchemaNode findChildNode(final Iterable<DataSchemaNode> children, final String name) {
-        List<DataNodeContainer> containers = Lists.newArrayList();
-
-        for (DataSchemaNode dataSchemaNode : children) {
-            if (dataSchemaNode.getQName().getLocalName().equals(name)) {
-                return dataSchemaNode;
-            }
-            if (dataSchemaNode instanceof DataNodeContainer) {
-                containers.add((DataNodeContainer) dataSchemaNode);
-            } else if (dataSchemaNode instanceof ChoiceSchemaNode) {
-                containers.addAll(((ChoiceSchemaNode) dataSchemaNode).getCases());
-            }
-        }
-
-        for (DataNodeContainer container : containers) {
-            DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
-            if (retVal != null) {
-                return retVal;
-            }
-        }
-
-        return null;
-    }
-}
index fac21edc0db1d55d7cfcfb4348010ce524b8daf6..ef63edcc858919841b9bf26fd769d8ff783f4d49 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.OrderedMapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.ToNormalizedNodeParser;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
@@ -31,7 +31,7 @@ public class DomToNormalizedNodeParserFactoryTest {
     public void testFactoryInstantiation() throws ReactorException {
         YangStatementSourceImpl foo = new YangStatementSourceImpl("/foo.yang", false);
 
-        SchemaContext schemaContext = RetestUtils.parseYangSources(foo);
+        SchemaContext schemaContext = TestUtils.parseYangSources(foo);
 
         DomToNormalizedNodeParserFactory factory = DomToNormalizedNodeParserFactory.getInstance(
                 DomUtils.defaultValueCodecProvider(), schemaContext,
index b7ba1f3b753099a6a186f2bd04811ae55ad7a4c9..103adb2aa58c422fd88f76475ec8208c22f1aec3 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.DomToNormalizedNodeParserFactory;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -64,7 +64,7 @@ public class Bug5396 {
         fooModuleQName = QNameModule.create(new URI("foo"), SimpleDateFormatUtil.getRevisionFormat()
                 .parse("2016-03-22"));
         root = QName.create(fooModuleQName, "root");
-        schemaContext = RetestUtils
+        schemaContext = TestUtils
                 .parseYangSources(new File(getClass().getResource("/bug5396/yang/foo.yang").toURI()));
     }
 
index 1b16fcaaa802e0750c71630f73776faf6c61e798..6ef48d97f4a59c7f3b1010498eb8a78ef6a3eab1 100644 (file)
@@ -24,7 +24,7 @@ import javax.xml.transform.stream.StreamResult;
 import org.mockito.Mockito;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
@@ -56,7 +56,7 @@ public class DomSerializerTestUtils {
 
     public static SchemaContext getSchemaContext() throws ReactorException, IOException, YangSyntaxErrorException {
         final StatementStreamSource source = new YangStatementSourceImpl("/dom-serializer-test/serializer-test.yang", false);
-        final SchemaContext schemaContext = RetestUtils.parseYangSources(source);
+        final SchemaContext schemaContext = TestUtils.parseYangSources(source);
 
         assertNotNull("Schema context must not be null.", schemaContext);
         return schemaContext;
index fa953eff4bcead8248cce7da88b9b6bf55865c42..e1f02a76a9602d491678e89b49dc3508767cc724 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -17,8 +17,6 @@ import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Resources;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringWriter;
@@ -52,10 +50,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@@ -64,6 +59,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
@@ -77,8 +73,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.Dom
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
@@ -92,14 +87,13 @@ public class NormalizedNodeXmlTranslationTest {
 
     @Parameterized.Parameters()
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][]{
-                {"augment_choice_hell.yang", "augment_choice_hell_ok.xml", augmentChoiceHell()},
-                {"augment_choice_hell.yang", "augment_choice_hell_ok2.xml", null},
-                {"augment_choice_hell.yang", "augment_choice_hell_ok3.xml", augmentChoiceHell2()},
-                {"test.yang", "simple.xml", null},
-                {"test.yang", "simple2.xml", null},
+        return Arrays.asList(new Object[][] {
+                { "augment_choice_hell.yang", "augment_choice_hell_ok.xml", augmentChoiceHell() },
+                { "augment_choice_hell.yang", "augment_choice_hell_ok2.xml", null },
+                { "augment_choice_hell.yang", "augment_choice_hell_ok3.xml", augmentChoiceHell2() },
+                { "test.yang", "simple.xml", null }, { "test.yang", "simple2.xml", null },
                 // TODO check attributes
-                {"test.yang", "simple_xml_with_attributes.xml", withAttributes()}
+                { "test.yang", "simple_xml_with_attributes.xml", withAttributes() }
         });
     }
 
@@ -114,18 +108,22 @@ public class NormalizedNodeXmlTranslationTest {
     }
 
     private static ContainerNode augmentChoiceHell2() {
-        final NodeIdentifier container = getNodeIdentifier("container");
+        final YangInstanceIdentifier.NodeIdentifier container = getNodeIdentifier("container");
         QName augmentChoice1QName = QName.create(container.getNodeType(), "augment-choice1");
         QName augmentChoice2QName = QName.create(augmentChoice1QName, "augment-choice2");
         final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
         final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
 
-        final AugmentationIdentifier aug1Id = new AugmentationIdentifier(Sets.newHashSet(augmentChoice1QName));
-        final AugmentationIdentifier aug2Id = new AugmentationIdentifier(Sets.newHashSet(augmentChoice2QName));
-        final NodeIdentifier augmentChoice1Id = new NodeIdentifier(augmentChoice1QName);
-        final NodeIdentifier augmentChoice2Id = new NodeIdentifier(augmentChoice2QName);
-        final NodeIdentifier containerId = new NodeIdentifier(containerQName);
-
+        final YangInstanceIdentifier.AugmentationIdentifier aug1Id = new YangInstanceIdentifier.AugmentationIdentifier(
+                Sets.newHashSet(augmentChoice1QName));
+        final YangInstanceIdentifier.AugmentationIdentifier aug2Id = new YangInstanceIdentifier.AugmentationIdentifier(
+                Sets.newHashSet(augmentChoice2QName));
+        final YangInstanceIdentifier.NodeIdentifier augmentChoice1Id = new YangInstanceIdentifier.NodeIdentifier(
+                augmentChoice1QName);
+        final YangInstanceIdentifier.NodeIdentifier augmentChoice2Id = new YangInstanceIdentifier.NodeIdentifier(
+                augmentChoice2QName);
+        final YangInstanceIdentifier.NodeIdentifier containerId = new YangInstanceIdentifier.NodeIdentifier(
+                containerQName);
 
         return containerBuilder().withNodeIdentifier(container)
                 .withChild(augmentationBuilder().withNodeIdentifier(aug1Id)
@@ -142,7 +140,7 @@ public class NormalizedNodeXmlTranslationTest {
     }
 
     private static ContainerNode withAttributes() {
-        final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> b = containerBuilder();
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b = containerBuilder();
         b.withNodeIdentifier(getNodeIdentifier("container"));
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder = Builders.mapBuilder().withNodeIdentifier(
@@ -151,28 +149,29 @@ public class NormalizedNodeXmlTranslationTest {
         final Map<QName, Object> predicates = Maps.newHashMap();
         predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
 
-        final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> list1Builder = Builders
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder = Builders
                 .mapEntryBuilder().withNodeIdentifier(
-                        new NodeIdentifierWithPredicates(getNodeIdentifier("list").getNodeType(),
-                                predicates));
-        final NormalizedNodeBuilder<NodeIdentifier,Object,LeafNode<Object>> uint32InListBuilder
-        = Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("uint32InList"));
+                        new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+                                getNodeIdentifier("list").getNodeType(), predicates));
+        final NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder = Builders
+                .leafBuilder().withNodeIdentifier(getNodeIdentifier("uint32InList"));
 
         list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
 
         listBuilder.withChild(list1Builder.build());
         b.withChild(listBuilder.build());
 
-        final NormalizedNodeBuilder<NodeIdentifier, Object, LeafNode<Object>> booleanBuilder
-        = Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
+        final NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder = Builders
+                .leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
         booleanBuilder.withValue(false);
         b.withChild(booleanBuilder.build());
 
-        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder
-        = Builders.leafSetBuilder().withNodeIdentifier(getNodeIdentifier("leafList"));
+        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder = Builders.leafSetBuilder()
+                .withNodeIdentifier(getNodeIdentifier("leafList"));
 
-        final NormalizedNodeBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder
-        = Builders.leafSetEntryBuilder().withNodeIdentifier(new NodeWithValue<>(getNodeIdentifier("leafList").getNodeType(), "a"));
+        final NormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder = Builders
+                .leafSetEntryBuilder().withNodeIdentifier(
+                        new YangInstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList").getNodeType(), "a"));
 
         leafList1Builder.withValue("a");
 
@@ -184,66 +183,79 @@ public class NormalizedNodeXmlTranslationTest {
 
     private static ContainerNode augmentChoiceHell() {
 
-        final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> b = containerBuilder();
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b = containerBuilder();
         b.withNodeIdentifier(getNodeIdentifier("container"));
 
-        b.withChild(
-                choiceBuilder().withNodeIdentifier(getNodeIdentifier("ch2"))
-                .withChild(Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2").build())
+        b.withChild(choiceBuilder()
+                .withNodeIdentifier(getNodeIdentifier("ch2"))
+                .withChild(
+                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2").build())
+                .withChild(
+                        choiceBuilder()
+                                .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
+                                .withChild(
+                                        Builders.leafBuilder()
+                                                .withNodeIdentifier(getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
+                                                .withValue("2").build()).build()).build());
+
+        b.withChild(choiceBuilder()
+                .withNodeIdentifier(getNodeIdentifier("ch3"))
                 .withChild(
-                        choiceBuilder().withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
-                        .withChild(Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c2DeepChoiceCase1Leaf2")).withValue("2").build())
-                        .build()
-                        )
-                        .build()
-                );
-
-        b.withChild(
-                choiceBuilder().withNodeIdentifier(getNodeIdentifier("ch3")).withChild(
                         Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3").build())
-                        .build());
-
-        b.withChild(
-                augmentationBuilder().withNodeIdentifier(getAugmentIdentifier("augLeaf")).withChild(
-                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("augLeaf")).withValue("augment").build())
-                        .build());
-
-        b.withChild(
-                augmentationBuilder().withNodeIdentifier(getAugmentIdentifier("ch")).withChild(
-                        choiceBuilder().withNodeIdentifier(getNodeIdentifier("ch"))
-                        .withChild(
-                                Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c1Leaf")).withValue("1").build())
+                .build());
+
+        b.withChild(augmentationBuilder()
+                .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
+                .withChild(
+                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("augLeaf")).withValue("augment")
+                                .build()).build());
+
+        b.withChild(augmentationBuilder()
+                .withNodeIdentifier(getAugmentIdentifier("ch"))
+                .withChild(
+                        choiceBuilder()
+                                .withNodeIdentifier(getNodeIdentifier("ch"))
+                                .withChild(
+                                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c1Leaf"))
+                                                .withValue("1").build())
                                 .withChild(
-                                        augmentationBuilder().withNodeIdentifier(getAugmentIdentifier("c1Leaf_AnotherAugment", "deepChoice"))
-                                        .withChild(
-                                                Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c1Leaf_AnotherAugment")).withValue("1").build())
+                                        augmentationBuilder()
+                                                .withNodeIdentifier(
+                                                        getAugmentIdentifier("c1Leaf_AnotherAugment", "deepChoice"))
                                                 .withChild(
-                                                        choiceBuilder().withNodeIdentifier(getNodeIdentifier("deepChoice"))
-                                                        .withChild(
-                                                                Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("deepLeafc1")).withValue("1").build()
-                                                                ).build()
-                                                        ).build()
-                                        ).build()
-                        ).build());
+                                                        Builders.leafBuilder()
+                                                                .withNodeIdentifier(
+                                                                        getNodeIdentifier("c1Leaf_AnotherAugment"))
+                                                                .withValue("1").build())
+                                                .withChild(
+                                                        choiceBuilder()
+                                                                .withNodeIdentifier(getNodeIdentifier("deepChoice"))
+                                                                .withChild(
+                                                                        Builders.leafBuilder()
+                                                                                .withNodeIdentifier(
+                                                                                        getNodeIdentifier("deepLeafc1"))
+                                                                                .withValue("1").build()).build())
+                                                .build()).build()).build());
 
         return b.build();
     }
 
-    private static NodeIdentifier getNodeIdentifier(final String localName) {
-        return new NodeIdentifier(QName.create(URI.create(NAMESPACE), revision, localName));
+    private static YangInstanceIdentifier.NodeIdentifier getNodeIdentifier(final String localName) {
+        return new YangInstanceIdentifier.NodeIdentifier(QName.create(URI.create(NAMESPACE), revision, localName));
     }
 
-    public static AugmentationIdentifier getAugmentIdentifier(final String... childNames) {
+    public static YangInstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(final String... childNames) {
         final Set<QName> qn = Sets.newHashSet();
 
         for (final String childName : childNames) {
             qn.add(getNodeIdentifier(childName).getNodeType());
         }
 
-        return new AugmentationIdentifier(qn);
+        return new YangInstanceIdentifier.AugmentationIdentifier(qn);
     }
 
-    public NormalizedNodeXmlTranslationTest(final String yangPath, final String xmlPath, final ContainerNode expectedNode) throws IOException, YangSyntaxErrorException {
+    public NormalizedNodeXmlTranslationTest(final String yangPath, final String xmlPath,
+            final ContainerNode expectedNode) throws ReactorException {
         schema = parseTestSchema(yangPath);
         this.xmlPath = xmlPath;
         this.containerNode = (ContainerSchemaNode) NormalizedDataBuilderTest.getSchemaNode(schema, "test", "container");
@@ -254,33 +266,30 @@ public class NormalizedNodeXmlTranslationTest {
     private final ContainerSchemaNode containerNode;
     private final String xmlPath;
 
-
-    SchemaContext parseTestSchema(final String... yangPath) throws IOException, YangSyntaxErrorException {
-        final YangParserImpl yangParserImpl = new YangParserImpl();
-        return yangParserImpl.parseSources(getTestYangs(yangPath));
+    SchemaContext parseTestSchema(final String... yangPath) throws ReactorException {
+        return TestUtils.parseYangStreams(getTestYangs(yangPath));
     }
 
-    List<ByteSource> getTestYangs(final String... yangPaths) {
+    List<InputStream> getTestYangs(final String... yangPaths) {
 
         return Lists.newArrayList(Collections2.transform(Lists.newArrayList(yangPaths),
-                new Function<String, ByteSource>() {
-            @Override
-            public ByteSource apply(final String input) {
-                final ByteSource source = Resources.asByteSource(
-                    NormalizedDataBuilderTest.class.getResource(input));
-                Preconditions.checkNotNull(source, "File %s was null", source);
-                return source;
-            }
-        }));
+                new Function<String, InputStream>() {
+                    @Override
+                    public InputStream apply(final String input) {
+                        final InputStream resourceAsStream = NormalizedDataBuilderTest.class.getResourceAsStream(input);
+                        Preconditions.checkNotNull(resourceAsStream, "File %s was null", resourceAsStream);
+                        return resourceAsStream;
+                    }
+                }));
     }
 
     @Test
     public void testTranslation() throws Exception {
         final Document doc = loadDocument(xmlPath);
 
-        final ContainerNode built =
-                DomToNormalizedNodeParserFactory.getInstance(DomUtils.defaultValueCodecProvider(), schema).getContainerNodeParser().parse(
-                        Collections.singletonList(doc.getDocumentElement()), containerNode);
+        final ContainerNode built = DomToNormalizedNodeParserFactory
+                .getInstance(DomUtils.defaultValueCodecProvider(), schema).getContainerNodeParser()
+                .parse(Collections.singletonList(doc.getDocumentElement()), containerNode);
 
         if (expectedNode != null) {
             org.junit.Assert.assertEquals(expectedNode, built);
@@ -289,7 +298,8 @@ public class NormalizedNodeXmlTranslationTest {
         System.err.println(built);
         logger.info("{}", built);
 
-        final Element elementNS = XmlDocumentUtils.getDocument().createElementNS(containerNode.getQName().getNamespace().toString(), containerNode.getQName().getLocalName());
+        final Element elementNS = XmlDocumentUtils.getDocument().createElementNS(
+                containerNode.getQName().getNamespace().toString(), containerNode.getQName().getLocalName());
         writeNormalizedNode(built, new DOMResult(elementNS), SchemaPath.create(true), schema);
 
         XMLUnit.setIgnoreWhitespace(true);
@@ -297,27 +307,27 @@ public class NormalizedNodeXmlTranslationTest {
         XMLUnit.setIgnoreAttributeOrder(true);
         XMLUnit.setNormalize(true);
 
-
         System.err.println(toString(doc.getDocumentElement()));
         System.err.println(toString(elementNS));
 
-        final Diff diff = new Diff(XMLUnit.buildControlDocument(toString(doc.getDocumentElement())), XMLUnit.buildTestDocument(toString(elementNS)));
+        final Diff diff = new Diff(XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+                XMLUnit.buildTestDocument(toString(elementNS)));
 
-        // FIXME the comparison cannot be performed, since the qualifiers supplied by XMlUnit do not work correctly in this case
+        // FIXME the comparison cannot be performed, since the qualifiers supplied by XMlUnit do not work correctly in
+        // this case
         // We need to implement custom qualifier so that the element ordering does not mess the DIFF
-//        dd.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(100, true));
-//        assertTrue(dd.toString(), dd.similar());
+        // dd.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(100, true));
+        // assertTrue(dd.toString(), dd.similar());
     }
 
-
     static final XMLOutputFactory XML_FACTORY;
     static {
         XML_FACTORY = XMLOutputFactory.newFactory();
         XML_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, false);
     }
 
-    private static void writeNormalizedNode(final NormalizedNode<?, ?> normalized, final DOMResult result, final SchemaPath schemaPath, final SchemaContext context)
-            throws IOException, XMLStreamException {
+    private static void writeNormalizedNode(final NormalizedNode<?, ?> normalized, final DOMResult result,
+            final SchemaPath schemaPath, final SchemaContext context) throws IOException, XMLStreamException {
         NormalizedNodeWriter normalizedNodeWriter = null;
         NormalizedNodeStreamWriter normalizedNodeStreamWriter = null;
         XMLStreamWriter writer = null;
@@ -330,13 +340,13 @@ public class NormalizedNodeXmlTranslationTest {
 
             normalizedNodeWriter.flush();
         } finally {
-            if(normalizedNodeWriter != null) {
+            if (normalizedNodeWriter != null) {
                 normalizedNodeWriter.close();
             }
-            if(normalizedNodeStreamWriter != null) {
+            if (normalizedNodeStreamWriter != null) {
                 normalizedNodeStreamWriter.close();
             }
-            if(writer != null) {
+            if (writer != null) {
                 writer.close();
             }
         }
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer.retest;
+package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -35,7 +35,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
 import org.opendaylight.yangtools.yang.data.api.schema.YangModeledAnyXmlNode;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.DomToNormalizedNodeParserFactory;
 import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
@@ -91,7 +91,7 @@ public class YangModeledAnyXMLDeserializationTest {
         myLeaf3 = QName.create(fooModuleQName, "my-leaf-3");
         myLeaf2 = QName.create(fooModuleQName, "my-leaf-2");
         myAnyXMLDataFoo = QName.create(fooModuleQName, "my-anyxml-data");
-        schemaContext = RetestUtils.parseYangSources(new File(getClass().getResource("/anyxml-support/yang/foo.yang")
+        schemaContext = TestUtils.parseYangSources(new File(getClass().getResource("/anyxml-support/yang/foo.yang")
                 .toURI()), new File(getClass().getResource("/anyxml-support/yang/bar.yang").toURI()), new File(getClass().getResource("/anyxml-support/yang/yang-ext.yang").toURI()));
     }
 
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer.retest;
+package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
@@ -43,7 +43,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.YangModeledAnyXmlNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
@@ -86,7 +86,7 @@ public class YangModeledAnyXMLSerializationTest extends XMLTestCase {
         myContainer2QName = QName.create(bazModuleQName, "my-container-2");
         myAnyXMLDataBaz = QName.create(bazModuleQName, "my-anyxml-data");
 
-        schemaContext = RetestUtils.parseYangSources(
+        schemaContext = TestUtils.parseYangSources(
                 new File(getClass().getResource("/anyxml-support/serialization/baz.yang").toURI()), new File(getClass()
                         .getResource("/anyxml-support/serialization/yang-ext.yang").toURI()));
     }
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/retest/NormalizedNodeXmlTranslationTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/retest/NormalizedNodeXmlTranslationTest.java
deleted file mode 100644 (file)
index 8674f92..0000000
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serializer.retest;
-
-import static org.opendaylight.yangtools.yang.data.impl.schema.Builders.augmentationBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.Builders.choiceBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.Builders.containerBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.leafNode;
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.data.impl.codec.xml.XMLStreamNormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedDataBuilderTest;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.DomUtils;
-import org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.parser.DomToNormalizedNodeParserFactory;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-@RunWith(Parameterized.class)
-public class NormalizedNodeXmlTranslationTest {
-    private static final Logger logger = LoggerFactory.getLogger(NormalizedNodeXmlTranslationTest.class);
-    private final SchemaContext schema;
-
-    @Parameterized.Parameters()
-    public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] {
-                { "augment_choice_hell.yang", "augment_choice_hell_ok.xml", augmentChoiceHell() },
-                { "augment_choice_hell.yang", "augment_choice_hell_ok2.xml", null },
-                { "augment_choice_hell.yang", "augment_choice_hell_ok3.xml", augmentChoiceHell2() },
-                { "test.yang", "simple.xml", null }, { "test.yang", "simple2.xml", null },
-                // TODO check attributes
-                { "test.yang", "simple_xml_with_attributes.xml", withAttributes() }
-        });
-    }
-
-    public static final String NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:test";
-    private static Date revision;
-    static {
-        try {
-            revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-13");
-        } catch (final ParseException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    private static ContainerNode augmentChoiceHell2() {
-        final YangInstanceIdentifier.NodeIdentifier container = getNodeIdentifier("container");
-        QName augmentChoice1QName = QName.create(container.getNodeType(), "augment-choice1");
-        QName augmentChoice2QName = QName.create(augmentChoice1QName, "augment-choice2");
-        final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
-        final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
-
-        final YangInstanceIdentifier.AugmentationIdentifier aug1Id = new YangInstanceIdentifier.AugmentationIdentifier(
-                Sets.newHashSet(augmentChoice1QName));
-        final YangInstanceIdentifier.AugmentationIdentifier aug2Id = new YangInstanceIdentifier.AugmentationIdentifier(
-                Sets.newHashSet(augmentChoice2QName));
-        final YangInstanceIdentifier.NodeIdentifier augmentChoice1Id = new YangInstanceIdentifier.NodeIdentifier(
-                augmentChoice1QName);
-        final YangInstanceIdentifier.NodeIdentifier augmentChoice2Id = new YangInstanceIdentifier.NodeIdentifier(
-                augmentChoice2QName);
-        final YangInstanceIdentifier.NodeIdentifier containerId = new YangInstanceIdentifier.NodeIdentifier(
-                containerQName);
-
-        return containerBuilder().withNodeIdentifier(container)
-                .withChild(augmentationBuilder().withNodeIdentifier(aug1Id)
-                        .withChild(choiceBuilder().withNodeIdentifier(augmentChoice1Id)
-                                .withChild(augmentationBuilder().withNodeIdentifier(aug2Id)
-                                        .withChild(choiceBuilder().withNodeIdentifier(augmentChoice2Id)
-                                                .withChild(containerBuilder().withNodeIdentifier(containerId)
-                                                        .withChild(leafNode(leafQName, "leaf-value"))
-                                                        .build())
-                                                .build())
-                                        .build())
-                                .build())
-                        .build()).build();
-    }
-
-    private static ContainerNode withAttributes() {
-        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b = containerBuilder();
-        b.withNodeIdentifier(getNodeIdentifier("container"));
-
-        final CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder = Builders.mapBuilder().withNodeIdentifier(
-                getNodeIdentifier("list"));
-
-        final Map<QName, Object> predicates = Maps.newHashMap();
-        predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
-
-        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder = Builders
-                .mapEntryBuilder().withNodeIdentifier(
-                        new YangInstanceIdentifier.NodeIdentifierWithPredicates(
-                                getNodeIdentifier("list").getNodeType(), predicates));
-        final NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder = Builders
-                .leafBuilder().withNodeIdentifier(getNodeIdentifier("uint32InList"));
-
-        list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
-
-        listBuilder.withChild(list1Builder.build());
-        b.withChild(listBuilder.build());
-
-        final NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder = Builders
-                .leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
-        booleanBuilder.withValue(false);
-        b.withChild(booleanBuilder.build());
-
-        final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder = Builders.leafSetBuilder()
-                .withNodeIdentifier(getNodeIdentifier("leafList"));
-
-        final NormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder = Builders
-                .leafSetEntryBuilder().withNodeIdentifier(
-                        new YangInstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList").getNodeType(), "a"));
-
-        leafList1Builder.withValue("a");
-
-        leafListBuilder.withChild(leafList1Builder.build());
-        b.withChild(leafListBuilder.build());
-
-        return b.build();
-    }
-
-    private static ContainerNode augmentChoiceHell() {
-
-        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b = containerBuilder();
-        b.withNodeIdentifier(getNodeIdentifier("container"));
-
-        b.withChild(choiceBuilder()
-                .withNodeIdentifier(getNodeIdentifier("ch2"))
-                .withChild(
-                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2").build())
-                .withChild(
-                        choiceBuilder()
-                                .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
-                                .withChild(
-                                        Builders.leafBuilder()
-                                                .withNodeIdentifier(getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
-                                                .withValue("2").build()).build()).build());
-
-        b.withChild(choiceBuilder()
-                .withNodeIdentifier(getNodeIdentifier("ch3"))
-                .withChild(
-                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3").build())
-                .build());
-
-        b.withChild(augmentationBuilder()
-                .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
-                .withChild(
-                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("augLeaf")).withValue("augment")
-                                .build()).build());
-
-        b.withChild(augmentationBuilder()
-                .withNodeIdentifier(getAugmentIdentifier("ch"))
-                .withChild(
-                        choiceBuilder()
-                                .withNodeIdentifier(getNodeIdentifier("ch"))
-                                .withChild(
-                                        Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("c1Leaf"))
-                                                .withValue("1").build())
-                                .withChild(
-                                        augmentationBuilder()
-                                                .withNodeIdentifier(
-                                                        getAugmentIdentifier("c1Leaf_AnotherAugment", "deepChoice"))
-                                                .withChild(
-                                                        Builders.leafBuilder()
-                                                                .withNodeIdentifier(
-                                                                        getNodeIdentifier("c1Leaf_AnotherAugment"))
-                                                                .withValue("1").build())
-                                                .withChild(
-                                                        choiceBuilder()
-                                                                .withNodeIdentifier(getNodeIdentifier("deepChoice"))
-                                                                .withChild(
-                                                                        Builders.leafBuilder()
-                                                                                .withNodeIdentifier(
-                                                                                        getNodeIdentifier("deepLeafc1"))
-                                                                                .withValue("1").build()).build())
-                                                .build()).build()).build());
-
-        return b.build();
-    }
-
-    private static YangInstanceIdentifier.NodeIdentifier getNodeIdentifier(final String localName) {
-        return new YangInstanceIdentifier.NodeIdentifier(QName.create(URI.create(NAMESPACE), revision, localName));
-    }
-
-    public static YangInstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(final String... childNames) {
-        final Set<QName> qn = Sets.newHashSet();
-
-        for (final String childName : childNames) {
-            qn.add(getNodeIdentifier(childName).getNodeType());
-        }
-
-        return new YangInstanceIdentifier.AugmentationIdentifier(qn);
-    }
-
-    public NormalizedNodeXmlTranslationTest(final String yangPath, final String xmlPath,
-            final ContainerNode expectedNode) throws ReactorException {
-        schema = parseTestSchema(yangPath);
-        this.xmlPath = xmlPath;
-        this.containerNode = (ContainerSchemaNode) NormalizedDataBuilderTest.getSchemaNode(schema, "test", "container");
-        this.expectedNode = expectedNode;
-    }
-
-    private final ContainerNode expectedNode;
-    private final ContainerSchemaNode containerNode;
-    private final String xmlPath;
-
-    SchemaContext parseTestSchema(final String... yangPath) throws ReactorException {
-        return RetestUtils.parseYangStreams(getTestYangs(yangPath));
-    }
-
-    List<InputStream> getTestYangs(final String... yangPaths) {
-
-        return Lists.newArrayList(Collections2.transform(Lists.newArrayList(yangPaths),
-                new Function<String, InputStream>() {
-                    @Override
-                    public InputStream apply(final String input) {
-                        final InputStream resourceAsStream = NormalizedDataBuilderTest.class.getResourceAsStream(input);
-                        Preconditions.checkNotNull(resourceAsStream, "File %s was null", resourceAsStream);
-                        return resourceAsStream;
-                    }
-                }));
-    }
-
-    @Test
-    public void testTranslation() throws Exception {
-        final Document doc = loadDocument(xmlPath);
-
-        final ContainerNode built = DomToNormalizedNodeParserFactory
-                .getInstance(DomUtils.defaultValueCodecProvider(), schema).getContainerNodeParser()
-                .parse(Collections.singletonList(doc.getDocumentElement()), containerNode);
-
-        if (expectedNode != null) {
-            org.junit.Assert.assertEquals(expectedNode, built);
-        }
-
-        System.err.println(built);
-        logger.info("{}", built);
-
-        final Element elementNS = XmlDocumentUtils.getDocument().createElementNS(
-                containerNode.getQName().getNamespace().toString(), containerNode.getQName().getLocalName());
-        writeNormalizedNode(built, new DOMResult(elementNS), SchemaPath.create(true), schema);
-
-        XMLUnit.setIgnoreWhitespace(true);
-        XMLUnit.setIgnoreComments(true);
-        XMLUnit.setIgnoreAttributeOrder(true);
-        XMLUnit.setNormalize(true);
-
-        System.err.println(toString(doc.getDocumentElement()));
-        System.err.println(toString(elementNS));
-
-        final Diff diff = new Diff(XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
-                XMLUnit.buildTestDocument(toString(elementNS)));
-
-        // FIXME the comparison cannot be performed, since the qualifiers supplied by XMlUnit do not work correctly in
-        // this case
-        // We need to implement custom qualifier so that the element ordering does not mess the DIFF
-        // dd.overrideElementQualifier(new MultiLevelElementNameAndTextQualifier(100, true));
-        // assertTrue(dd.toString(), dd.similar());
-    }
-
-    static final XMLOutputFactory XML_FACTORY;
-    static {
-        XML_FACTORY = XMLOutputFactory.newFactory();
-        XML_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, false);
-    }
-
-    private static void writeNormalizedNode(final NormalizedNode<?, ?> normalized, final DOMResult result,
-            final SchemaPath schemaPath, final SchemaContext context) throws IOException, XMLStreamException {
-        NormalizedNodeWriter normalizedNodeWriter = null;
-        NormalizedNodeStreamWriter normalizedNodeStreamWriter = null;
-        XMLStreamWriter writer = null;
-        try {
-            writer = XML_FACTORY.createXMLStreamWriter(result);
-            normalizedNodeStreamWriter = XMLStreamNormalizedNodeStreamWriter.create(writer, context, schemaPath);
-            normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter(normalizedNodeStreamWriter);
-
-            normalizedNodeWriter.write(normalized);
-
-            normalizedNodeWriter.flush();
-        } finally {
-            if (normalizedNodeWriter != null) {
-                normalizedNodeWriter.close();
-            }
-            if (normalizedNodeStreamWriter != null) {
-                normalizedNodeStreamWriter.close();
-            }
-            if (writer != null) {
-                writer.close();
-            }
-        }
-    }
-
-    private static Document loadDocument(final String xmlPath) throws IOException, SAXException {
-        final InputStream resourceAsStream = NormalizedDataBuilderTest.class.getResourceAsStream(xmlPath);
-
-        final Document currentConfigElement = readXmlToDocument(resourceAsStream);
-        Preconditions.checkNotNull(currentConfigElement);
-        return currentConfigElement;
-    }
-
-    private static final DocumentBuilderFactory BUILDERFACTORY;
-
-    static {
-        final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(true);
-        factory.setCoalescing(true);
-        factory.setIgnoringElementContentWhitespace(true);
-        factory.setIgnoringComments(true);
-        BUILDERFACTORY = factory;
-    }
-
-    private static Document readXmlToDocument(final InputStream xmlContent) throws IOException, SAXException {
-        final DocumentBuilder dBuilder;
-        try {
-            dBuilder = BUILDERFACTORY.newDocumentBuilder();
-        } catch (final ParserConfigurationException e) {
-            throw new RuntimeException("Failed to parse XML document", e);
-        }
-        final Document doc = dBuilder.parse(xmlContent);
-
-        doc.getDocumentElement().normalize();
-        return doc;
-    }
-
-    public static String toString(final Element xml) {
-        try {
-            final Transformer transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
-            final StreamResult result = new StreamResult(new StringWriter());
-            final DOMSource source = new DOMSource(xml);
-            transformer.transform(source, result);
-
-            return result.getWriter().toString();
-        } catch (IllegalArgumentException | TransformerFactoryConfigurationError | TransformerException e) {
-            throw new RuntimeException("Unable to serialize xml element " + xml, e);
-        }
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug2690FixTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug2690FixTest.java
deleted file mode 100644 (file)
index c39e319..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import com.google.common.base.Optional;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Resources;
-import java.io.IOException;
-import java.util.Collections;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-
-public class Bug2690FixTest {
-    private static final String ODL_DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
-    private SchemaContext schemaContext;
-
-    private InMemoryDataTree inMemoryDataTree;
-
-    @Before
-    public void prepare() throws IOException, YangSyntaxErrorException {
-        schemaContext = createTestContext();
-        assertNotNull("Schema context must not be null.", schemaContext);
-        inMemoryDataTree =  (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-    }
-
-    private static ByteSource getInputStream() {
-        return Resources.asByteSource(TestModel.class.getResource(ODL_DATASTORE_TEST_YANG));
-    }
-
-    public static SchemaContext createTestContext() throws IOException, YangSyntaxErrorException {
-        final YangParserImpl parser = new YangParserImpl();
-        return parser.parseSources(Collections.singletonList(getInputStream()));
-    }
-
-    @Test
-    public void testWriteMerge1() throws DataValidationFailedException {
-        final MapEntryNode fooEntryNode = ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1);
-        final MapEntryNode barEntryNode = ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 2);
-        final MapNode mapNode1 = ImmutableNodes.mapNodeBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.OUTER_LIST_QNAME))
-                .withChild(fooEntryNode).build();
-        final MapNode mapNode2 = ImmutableNodes.mapNodeBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.OUTER_LIST_QNAME))
-                .withChild(barEntryNode).build();
-
-        final ContainerNode cont1 = Builders.containerBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(mapNode1).build();
-
-        final ContainerNode cont2 = Builders.containerBuilder()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(mapNode2).build();
-
-        final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        modificationTree.write(TestModel.TEST_PATH, cont1);
-        modificationTree.merge(TestModel.TEST_PATH, cont2);
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare);
-
-        final InMemoryDataTreeSnapshot snapshotAfterTx = inMemoryDataTree.takeSnapshot();
-        final InMemoryDataTreeModification modificationAfterTx = snapshotAfterTx.newModification();
-        final Optional<NormalizedNode<?, ?>> readNode = modificationAfterTx.readNode(TestModel.OUTER_LIST_PATH);
-        assertTrue(readNode.isPresent());
-        assertEquals(2, ((NormalizedNodeContainer<?,?,?>)readNode.get()).getValue().size());
-
-    }
-
-
-}
similarity index 95%
rename from yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_Bug2690Fix.java
rename to yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Bug2690Test.java
index 933017534cb636a8e2dd9a54d25c3735ba67bb86..f0dc617e286b1d5c745ca915711c8a822dde62c4 100644 (file)
@@ -25,13 +25,13 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
-public class Retest_Bug2690Fix {
+public class Bug2690Test {
     private static final String ODL_DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
     private SchemaContext schemaContext;
     private InMemoryDataTree inMemoryDataTree;
@@ -53,7 +53,7 @@ public class Retest_Bug2690Fix {
     }
 
     public static SchemaContext createTestContext() throws ReactorException {
-        return RetestUtils.parseYangStreams(Collections.singletonList(getDatastoreTestInputStream()));
+        return TestUtils.parseYangStreams(Collections.singletonList(getDatastoreTestInputStream()));
     }
 
     @Test
index c5f59e68e6c44a9b5964780a90202c0b081a76ca..479f7658f34b660c8003283be7bfc681a3bfc3d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -17,6 +17,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification
 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 /**
  * BUG-3674: issuing a delete on a non-existent entry must be preserved in
@@ -27,7 +28,7 @@ public class Bug3674Test {
     private DataTree tree;
 
     @Before
-    public void setUp() {
+    public void setUp() throws ReactorException {
         tree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
         tree.setSchemaContext(TestModel.createTestContext());
 
index 9ac489c01b4e27fbbffef02aed5ce98c392189d6..8d36915d111ec70a1f6747a9a9c66f001fec693e 100644 (file)
@@ -26,7 +26,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
@@ -51,7 +51,7 @@ public class Bug4295Test {
     public void init() throws Exception {
         final File resourceFile = new File(Bug4295Test.class.getResource("/bug-4295/foo.yang")
                 .toURI());
-        context = RetestUtils.parseYangSources(resourceFile);
+        context = TestUtils.parseYangSources(resourceFile);
         foo = QNameModule.create(new URI("foo"), SimpleDateFormatUtil.getRevisionFormat().parse("1970-01-01"));
         root = QName.create(foo, "root");
         subRoot = QName.create(foo, "sub-root");
index cec5bbbc43350f2dcb44e5e5e91de645b23b1e5b..781f0d129ccecb8aec52bf5b3563c318af64ceda 100644 (file)
@@ -31,7 +31,7 @@ public class CaseExclusionTest {
 
     @Before
     public void prepare() throws ReactorException {
-        schemaContext = RetestModel.createTestContext("/case-exclusion-test.yang");
+        schemaContext = TestModel.createTestContext("/case-exclusion-test.yang");
         assertNotNull("Schema context must not be null.", schemaContext);
     }
 
index 8e7ef3f868a77dbc30d2c732adc91d549818a175..28ee0686ab19860d7bdb90e637aeb70699d65ee9 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
 import static org.junit.Assert.assertFalse;
@@ -21,6 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,7 +61,7 @@ public class ConcurrentTreeModificationTest {
     private InMemoryDataTree inMemoryDataTree;
 
     @Before
-    public void prepare() {
+    public void prepare() throws ReactorException {
         schemaContext = TestModel.createTestContext();
         assertNotNull("Schema context must not be null.", schemaContext);
         inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
index f35ad36e1a136a76da145cac9dd0a6210945e075..5322b9887bf2a2395113fce670a8ac081945b5b1 100644 (file)
@@ -5,6 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
+
 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
 import static org.junit.Assert.assertNotNull;
@@ -27,6 +28,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,20 +39,20 @@ public class ConfigStatementValidationTest {
     private static final Short ONE_ID = 1;
     private static final Short TWO_ID = 2;
 
-    private static final YangInstanceIdentifier OUTER_LIST_1_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
+    private static final YangInstanceIdentifier OUTER_LIST_1_PATH = YangInstanceIdentifier
+            .builder(TestModel.OUTER_LIST_PATH).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
             .build();
 
-    private static final YangInstanceIdentifier OUTER_LIST_2_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
+    private static final YangInstanceIdentifier OUTER_LIST_2_PATH = YangInstanceIdentifier
+            .builder(TestModel.OUTER_LIST_PATH).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
             .build();
 
-    private static final MapEntryNode INNER_FOO_ENTRY_NODE =
-            ImmutableNodes.mapEntry(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, "foo");
+    private static final MapEntryNode INNER_FOO_ENTRY_NODE = ImmutableNodes.mapEntry(TestModel.INNER_LIST_QNAME,
+            TestModel.NAME_QNAME, "foo");
 
-    private static final MapEntryNode INNER_BAR_ENTRY_NODE =
-            ImmutableNodes.mapEntryBuilder(QName.create(TestModel.TEST_QNAME, "inner-list2"), TestModel.NAME_QNAME, "foo")
-                    .withChild(ImmutableNodes.leafNode(TestModel.VALUE_QNAME, "value")).build();
+    private static final MapEntryNode INNER_BAR_ENTRY_NODE = ImmutableNodes
+            .mapEntryBuilder(QName.create(TestModel.TEST_QNAME, "inner-list2"), TestModel.NAME_QNAME, "foo")
+            .withChild(ImmutableNodes.leafNode(TestModel.VALUE_QNAME, "value")).build();
 
     private static final MapEntryNode FOO_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
             .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME).withChild(INNER_FOO_ENTRY_NODE) //
@@ -65,37 +67,32 @@ public class ConfigStatementValidationTest {
     private SchemaContext schemaContext;
 
     private static ContainerNode createFooTestContainerNode() {
-        return ImmutableContainerNodeBuilder
-                .create()
+        return ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(
-                        mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
-                                .withChild(FOO_NODE).build()).build();
+                .withChild(mapNodeBuilder(TestModel.OUTER_LIST_QNAME).withChild(FOO_NODE).build()).build();
     }
 
     private static ContainerNode createBarTestContainerNode() {
-        return ImmutableContainerNodeBuilder
-                .create()
+        return ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(
-                        mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
-                                .withChild(BAR_NODE).build()).build();
+                .withChild(mapNodeBuilder(TestModel.OUTER_LIST_QNAME).withChild(BAR_NODE).build()).build();
     }
 
     @Before
-    public void prepare() {
+    public void prepare() throws ReactorException {
         schemaContext = TestModel.createTestContext();
         assertNotNull("Schema context must not be null.", schemaContext);
     }
 
-    @Test(expected=SchemaValidationFailedException.class)
+    @Test(expected = SchemaValidationFailedException.class)
     public void testOnPathFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree =
-                (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
+                TreeType.CONFIGURATION);
         inMemoryDataTree.setSchemaContext(schemaContext);
         final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        final YangInstanceIdentifier ii = OUTER_LIST_1_PATH.node(new YangInstanceIdentifier.NodeIdentifier(TestModel.INNER_LIST_QNAME))
-                .node(INNER_FOO_ENTRY_NODE.getIdentifier());
+        final YangInstanceIdentifier ii = OUTER_LIST_1_PATH.node(
+                new YangInstanceIdentifier.NodeIdentifier(TestModel.INNER_LIST_QNAME)).node(
+                INNER_FOO_ENTRY_NODE.getIdentifier());
         modificationTree.write(ii, INNER_FOO_ENTRY_NODE);
 
         inMemoryDataTree.validate(modificationTree);
@@ -103,10 +100,10 @@ public class ConfigStatementValidationTest {
         inMemoryDataTree.commit(prepare);
     }
 
-    @Test(expected=SchemaValidationFailedException.class)
+    @Test(expected = SchemaValidationFailedException.class)
     public void testOnDataFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree =
-                (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
+                TreeType.CONFIGURATION);
         inMemoryDataTree.setSchemaContext(schemaContext);
         final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
         modificationTree.write(TestModel.TEST_PATH, createFooTestContainerNode());
@@ -116,10 +113,10 @@ public class ConfigStatementValidationTest {
         inMemoryDataTree.commit(prepare);
     }
 
-    @Test(expected=SchemaValidationFailedException.class)
+    @Test(expected = SchemaValidationFailedException.class)
     public void testOnDataLeafFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree =
-                (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
+                TreeType.CONFIGURATION);
         inMemoryDataTree.setSchemaContext(schemaContext);
         final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
         modificationTree.write(TestModel.TEST_PATH, createBarTestContainerNode());
@@ -129,13 +126,13 @@ public class ConfigStatementValidationTest {
         inMemoryDataTree.commit(prepare);
     }
 
-    @Test(expected=SchemaValidationFailedException.class)
+    @Test(expected = SchemaValidationFailedException.class)
     public void testOnPathCaseLeafFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree =
-                (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
+                TreeType.CONFIGURATION);
         inMemoryDataTree.setSchemaContext(schemaContext);
-        final YangInstanceIdentifier.NodeIdentifier choice1Id = new YangInstanceIdentifier.NodeIdentifier(
-                QName.create(TestModel.TEST_QNAME, "choice1"));
+        final YangInstanceIdentifier.NodeIdentifier choice1Id = new YangInstanceIdentifier.NodeIdentifier(QName.create(
+                TestModel.TEST_QNAME, "choice1"));
         final YangInstanceIdentifier.NodeIdentifier case2ContId = new YangInstanceIdentifier.NodeIdentifier(
                 QName.create(TestModel.TEST_QNAME, "case2-cont"));
         final YangInstanceIdentifier ii = TestModel.TEST_PATH.node(choice1Id).node(case2ContId);
@@ -144,19 +141,19 @@ public class ConfigStatementValidationTest {
 
         final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
         modificationTree.write(ii, case2Cont);
-
+        modificationTree.ready();
         inMemoryDataTree.validate(modificationTree);
         final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
         inMemoryDataTree.commit(prepare);
     }
 
-    @Test(expected=VerifyException.class)
+    @Test(expected = VerifyException.class)
     public void testOnDataCaseLeafFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree =
-                (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
+                TreeType.CONFIGURATION);
         inMemoryDataTree.setSchemaContext(schemaContext);
-        final YangInstanceIdentifier.NodeIdentifier choice1Id = new YangInstanceIdentifier.NodeIdentifier(
-                QName.create(TestModel.TEST_QNAME, "choice1"));
+        final YangInstanceIdentifier.NodeIdentifier choice1Id = new YangInstanceIdentifier.NodeIdentifier(QName.create(
+                TestModel.TEST_QNAME, "choice1"));
         final YangInstanceIdentifier ii = TestModel.TEST_PATH.node(choice1Id);
         final ChoiceNode choice1 = Builders.choiceBuilder().withNodeIdentifier(choice1Id)
                 .withChild(leafNode(QName.create(TestModel.TEST_QNAME, "case1-leaf1"), "leaf-value")).build();
index 60691a897824f1550188dd267fc15db33a7729c2..ceabb7a9bff1aba1ad8422f9b1b870f2a7682a7b 100644 (file)
@@ -13,12 +13,13 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class DataTreeTransactionTest {
     private DataTree tree;
 
     @Before
-    public void setUp() {
+    public void setUp() throws ReactorException {
         tree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
         tree.setSchemaContext(TestModel.createTestContext());
     }
index bc14e4b3206a391a95854ad4f9cd619858ace3ee..c495f035d9e4e55b50ad553c044957b8c115c2cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -16,13 +16,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailed
 import org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class ErrorReportingTest {
 
     private InMemoryDataTree tree;
 
     @Before
-    public void setup() {
+    public void setup() throws ReactorException {
         tree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
         tree.setSchemaContext(TestModel.createTestContext());
     }
@@ -71,5 +72,4 @@ public class ErrorReportingTest {
         }
 
     }
-
 }
@@ -32,7 +32,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
@@ -43,8 +43,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class Retest_ListConstraintsValidation {
-    private static final Logger LOG = LoggerFactory.getLogger(Retest_ListConstraintsValidation.class);
+public class ListConstraintsValidation {
+    private static final Logger LOG = LoggerFactory.getLogger(ListConstraintsValidation.class);
 
     private static final String CONSTRAINTS_VALIDATION_TEST_YANG = "/list-constraints-validation-test-model.yang";
     private SchemaContext schemaContext;
@@ -99,7 +99,7 @@ public class Retest_ListConstraintsValidation {
     }
 
     public static SchemaContext createTestContext() throws ReactorException {
-        return RetestUtils.parseYangStreams(Collections.singletonList(getDatastoreTestInputStream()));
+        return TestUtils.parseYangStreams(Collections.singletonList(getDatastoreTestInputStream()));
     }
 
     @Test
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ListConstraintsValidationTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/ListConstraintsValidationTest.java
deleted file mode 100644 (file)
index 675de0e..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import com.google.common.base.Optional;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Resources;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
-import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListEntryNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableUnkeyedListNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ListConstraintsValidationTest {
-    private static final Logger LOG = LoggerFactory.getLogger(ListConstraintsValidationTest.class);
-
-    private static final String CONSTRAINTS_VALIDATION_TEST_YANG = "/list-constraints-validation-test-model.yang";
-    private SchemaContext schemaContext;
-
-    private InMemoryDataTree inMemoryDataTree;
-
-    private static final QName MASTER_CONTAINER_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:list-constraints-validation-test-model", "2015-02-02",
-            "master-container");
-    private static final QName MIN_MAX_LIST_QNAME = QName.create(MASTER_CONTAINER_QNAME, "min-max-list");
-    private static final QName MIN_MAX_KEY_LEAF_QNAME = QName.create(MASTER_CONTAINER_QNAME, "min-max-key-leaf");
-    private static final QName UNBOUNDED_LIST_QNAME = QName.create(MASTER_CONTAINER_QNAME, "unbounded-list");
-    private static final QName UNBOUNDED_KEY_LEAF_QNAME = QName.create(MASTER_CONTAINER_QNAME, "unbounded-key-leaf");
-    private static final QName MIN_MAX_LEAF_LIST_QNAME = QName.create(MASTER_CONTAINER_QNAME, "min-max-leaf-list");
-    private static final QName UNBOUNDED_LEAF_LIST_QNAME = QName.create(MASTER_CONTAINER_QNAME, "unbounded-leaf-list");
-    private static final QName UNKEYED_LIST_QNAME = QName.create(MASTER_CONTAINER_QNAME, "unkeyed-list");
-    private static final QName UNKEYED_LEAF_QNAME = QName.create(MASTER_CONTAINER_QNAME, "unkeyed-leaf");
-
-    private static final YangInstanceIdentifier MASTER_CONTAINER_PATH = YangInstanceIdentifier.of(MASTER_CONTAINER_QNAME);
-    private static final YangInstanceIdentifier MIN_MAX_LIST_PATH = YangInstanceIdentifier.builder(MASTER_CONTAINER_PATH)
-            .node(MIN_MAX_LIST_QNAME).build();
-    private static final YangInstanceIdentifier UNBOUNDED_LIST_PATH = YangInstanceIdentifier.builder(MASTER_CONTAINER_PATH)
-            .node(UNBOUNDED_LIST_QNAME).build();
-    private static final YangInstanceIdentifier MIN_MAX_LEAF_LIST_PATH = YangInstanceIdentifier.builder(MASTER_CONTAINER_PATH)
-            .node(MIN_MAX_LEAF_LIST_QNAME).build();
-    private static final YangInstanceIdentifier UNBOUNDED_LEAF_LIST_PATH = YangInstanceIdentifier.builder(MASTER_CONTAINER_PATH)
-            .node(UNBOUNDED_LEAF_LIST_QNAME).build();
-    private static final YangInstanceIdentifier UNKEYED_LIST_PATH = YangInstanceIdentifier.builder(MASTER_CONTAINER_PATH)
-            .node(UNKEYED_LIST_QNAME).build();
-
-    @Before
-    public void prepare() throws IOException, YangSyntaxErrorException {
-        schemaContext = createTestContext();
-        assertNotNull("Schema context must not be null.", schemaContext);
-        inMemoryDataTree =  (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-        final DataTreeModification modificationTree = initialDataTreeSnapshot.newModification();
-
-        modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.containerNode(MASTER_CONTAINER_QNAME));
-        modificationTree.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(modificationTree));
-
-    }
-
-    private static ByteSource getInputStream() {
-        return Resources.asByteSource(TestModel.class.getResource(CONSTRAINTS_VALIDATION_TEST_YANG));
-    }
-
-    public static SchemaContext createTestContext() throws IOException, YangSyntaxErrorException {
-        final YangParserImpl parser = new YangParserImpl();
-        return parser.parseSources(Collections.singletonList(getInputStream()));
-    }
-
-    @Test
-    public void minMaxListTestPass() throws DataValidationFailedException {
-
-        final MapEntryNode fooEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "foo");
-        final MapEntryNode barEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "bar");
-        final MapNode mapNode1 = ImmutableNodes.mapNodeBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
-                .withChild(fooEntryNode).build();
-        final MapNode mapNode2 = ImmutableNodes.mapNodeBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
-                .withChild(barEntryNode).build();
-
-        final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        modificationTree.write(MIN_MAX_LIST_PATH, mapNode1);
-        modificationTree.merge(MIN_MAX_LIST_PATH, mapNode2);
-        // TODO: check why write and then merge on list commits only "bar" child
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
-        final Optional<NormalizedNode<?, ?>> minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
-        assertTrue(minMaxListRead.isPresent());
-        assertTrue(((NormalizedNodeContainer<?, ?, ?>) minMaxListRead.get()).getValue().size() == 2);
-    }
-
-    @Test(expected=DataValidationFailedException.class)
-    public void minMaxListFail() throws DataValidationFailedException {
-        InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-
-        final MapEntryNode fooEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "foo");
-        final MapEntryNode barEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "bar");
-        final MapEntryNode gooEntryNode = ImmutableNodes.mapEntry(MIN_MAX_LIST_QNAME, MIN_MAX_KEY_LEAF_QNAME, "goo");
-        final MapNode mapNode = ImmutableNodes.mapNodeBuilder()
-                .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LIST_QNAME))
-                .withChild(fooEntryNode).build();
-
-        final YangInstanceIdentifier fooPath = MIN_MAX_LIST_PATH.node(fooEntryNode.getIdentifier());
-        final YangInstanceIdentifier barPath = MIN_MAX_LIST_PATH.node(barEntryNode.getIdentifier());
-        final YangInstanceIdentifier gooPath = MIN_MAX_LIST_PATH.node(gooEntryNode.getIdentifier());
-
-        modificationTree.write(MIN_MAX_LIST_PATH, mapNode);
-        modificationTree.merge(barPath, barEntryNode);
-        modificationTree.write(gooPath, gooEntryNode);
-        modificationTree.delete(gooPath);
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-        DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare1);
-
-        InMemoryDataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
-        Optional<NormalizedNode<?, ?>> minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
-        assertTrue(minMaxListRead.isPresent());
-        assertTrue(((NormalizedNodeContainer<?, ?, ?>) minMaxListRead.get()).getValue().size() == 2);
-
-        modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        modificationTree.write(gooPath, gooEntryNode);
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-        prepare1 = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare1);
-
-        snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
-        minMaxListRead = snapshotAfterCommit.readNode(MIN_MAX_LIST_PATH);
-        assertTrue(minMaxListRead.isPresent());
-        assertTrue(((NormalizedNodeContainer<?, ?, ?>) minMaxListRead.get()).getValue().size() == 3);
-
-        modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-
-        modificationTree.delete(gooPath);
-        modificationTree.delete(fooPath);
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-    }
-
-    @Test
-    public void minMaxLeafListPass() throws DataValidationFailedException {
-        final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-
-        final NodeWithValue<?> barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
-        final NodeWithValue<?> gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
-
-        final LeafSetEntryNode<Object> barLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
-                .withNodeIdentifier(barPath)
-                .withValue("bar").build();
-        final LeafSetEntryNode<Object> gooLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
-                .withNodeIdentifier(gooPath)
-                .withValue("goo").build();
-
-        final LeafSetNode<Object> fooLeafSetNode = ImmutableLeafSetNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME))
-                .withChildValue("foo").build();
-
-        modificationTree.write(MIN_MAX_LEAF_LIST_PATH, fooLeafSetNode);
-        modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), barLeafSetEntry);
-        modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), gooLeafSetEntry);
-        modificationTree.delete(MIN_MAX_LEAF_LIST_PATH.node(gooPath));
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare1);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
-        final Optional<NormalizedNode<?, ?>> masterContainer = snapshotAfterCommit.readNode(MASTER_CONTAINER_PATH);
-        assertTrue(masterContainer.isPresent());
-        final Optional<NormalizedNodeContainer<?, ?, ?>> leafList = ((NormalizedNodeContainer) masterContainer.get()).getChild(
-                new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME));
-        assertTrue(leafList.isPresent());
-        assertTrue(leafList.get().getValue().size() == 2);
-    }
-
-    @Test(expected=DataValidationFailedException.class)
-    public void minMaxLeafListFail() throws DataValidationFailedException {
-        final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-
-        final NodeWithValue<?> fooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "foo");
-        final NodeWithValue<?> barPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "bar");
-        final NodeWithValue<?> gooPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "goo");
-        final NodeWithValue<?> fuuPath = new NodeWithValue<>(MIN_MAX_LIST_QNAME, "fuu");
-
-        final LeafSetEntryNode<Object> barLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
-                .withNodeIdentifier(barPath)
-                .withValue("bar").build();
-        final LeafSetEntryNode<Object> gooLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
-                .withNodeIdentifier(gooPath)
-                .withValue("goo").build();
-        final LeafSetEntryNode<Object> fuuLeafSetEntry = ImmutableLeafSetEntryNodeBuilder.create()
-                .withNodeIdentifier(fuuPath)
-                .withValue("fuu").build();
-
-        final LeafSetNode<Object> fooLeafSetNode = ImmutableLeafSetNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifier(MIN_MAX_LEAF_LIST_QNAME))
-                .withChildValue("foo").build();
-
-        modificationTree.write(MIN_MAX_LEAF_LIST_PATH, fooLeafSetNode);
-        modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(barPath), barLeafSetEntry);
-        modificationTree.merge(MIN_MAX_LEAF_LIST_PATH.node(gooPath), gooLeafSetEntry);
-        modificationTree.write(MIN_MAX_LEAF_LIST_PATH.node(fuuPath), fuuLeafSetEntry);
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-    }
-
-    @Test
-    public void unkeyedListTestPass() throws DataValidationFailedException {
-        final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-
-        final UnkeyedListEntryNode foo = ImmutableUnkeyedListEntryNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
-                .withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "foo")).build();
-        final List<UnkeyedListEntryNode> unkeyedEntries = new ArrayList<>();
-        unkeyedEntries.add(foo);
-        final UnkeyedListNode unkeyedListNode = ImmutableUnkeyedListNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME))
-                .withValue(unkeyedEntries).build();
-
-        modificationTree.write(MASTER_CONTAINER_PATH, ImmutableNodes.containerNode(MASTER_CONTAINER_QNAME));
-        modificationTree.merge(UNKEYED_LIST_PATH, unkeyedListNode);
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare1);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommit = inMemoryDataTree.takeSnapshot();
-        final Optional<NormalizedNode<?, ?>> unkeyedListRead = snapshotAfterCommit.readNode(UNKEYED_LIST_PATH);
-        assertTrue(unkeyedListRead.isPresent());
-        assertTrue(((UnkeyedListNode) unkeyedListRead.get()).getSize() == 1);
-    }
-
-    @Test(expected=DataValidationFailedException.class)
-    public void unkeyedListTestFail() throws DataValidationFailedException {
-        final DataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-
-        final UnkeyedListEntryNode foo = ImmutableUnkeyedListEntryNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
-                .withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "foo")).build();
-        final UnkeyedListEntryNode bar = ImmutableUnkeyedListEntryNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifier(UNKEYED_LEAF_QNAME))
-                .withChild(ImmutableNodes.leafNode(UNKEYED_LEAF_QNAME, "bar")).build();
-        final List<UnkeyedListEntryNode> unkeyedEntries = new ArrayList<>();
-        unkeyedEntries.add(foo);
-        unkeyedEntries.add(bar);
-        final UnkeyedListNode unkeyedListNode = ImmutableUnkeyedListNodeBuilder.create()
-                .withNodeIdentifier(new NodeIdentifier(UNKEYED_LIST_QNAME))
-                .withValue(unkeyedEntries).build();
-
-        modificationTree.write(UNKEYED_LIST_PATH, unkeyedListNode);
-        modificationTree.ready();
-
-        inMemoryDataTree.validate(modificationTree);
-    }
-}
index 98cd9aef4a5108ebee633a38fd0c3b982244ea52..6346167d7198812d2320954ee5854d0ec3b43800 100644 (file)
@@ -30,7 +30,7 @@ public class MandatoryLeafTest {
 
     @Before
     public void prepare() throws ReactorException {
-        schemaContext = RetestModel.createTestContext("/mandatory-leaf-test.yang");
+        schemaContext = TestModel.createTestContext("/mandatory-leaf-test.yang");
         assertNotNull("Schema context must not be null.", schemaContext);
     }
 
index 5b500bb4cb4d9ba3fb2907eebd95f17d96fcebf1..0c8052610fc618a0b879a51b51efd7ddd9a90690 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -32,6 +32,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 /**
  *
@@ -95,7 +96,7 @@ public class ModificationMetadataTreeTest {
     private RootModificationApplyOperation rootOper;
 
     @Before
-    public void prepare() {
+    public void prepare() throws ReactorException {
         schemaContext = TestModel.createTestContext();
         assertNotNull("Schema context must not be null.", schemaContext);
         rootOper = RootModificationApplyOperation.from(SchemaAwareApplyOperation.from(schemaContext, TreeType.OPERATIONAL));
index b7f130bcf6eb4f1a283ec5c8b040696a247db393..b12c054788e2faea48555daba013b51eddc75e8e 100644 (file)
@@ -34,7 +34,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.slf4j.Logger;
@@ -60,7 +60,7 @@ public class OrderedListTest {
     public void setup() throws Exception {
         final File resourceFile = new File(Bug4295Test.class.getResource("/ordered-list-modification-test.yang")
                 .toURI());
-        context = RetestUtils.parseYangSources(resourceFile);
+        context = TestUtils.parseYangSources(resourceFile);
         testModule = QNameModule.create(new URI("ordered-list-modification-test"),
                 SimpleDateFormatUtil.getRevisionFormat().parse("1970-01-01"));
         parentContainer = QName.create(testModule, "parent-container");
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/RetestModel.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/RetestModel.java
deleted file mode 100644 (file)
index 8035f5c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.impl.RetestUtils;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-public class RetestModel {
-
-    public static final QName TEST_QNAME = QName.create(
-            "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13", "test");
-    public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
-    public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
-    public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice");
-    public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
-    public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
-    public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
-    private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
-
-    public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
-    public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH)
-            .node(OUTER_LIST_QNAME).build();
-    public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
-    public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
-
-    public static InputStream getDatastoreTestInputStream() {
-        return RetestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
-    }
-
-    public static SchemaContext createTestContext() throws ReactorException {
-        return RetestUtils.parseYangStreams(Arrays.asList(getDatastoreTestInputStream()));
-    }
-
-    public static SchemaContext createTestContext(String resourcePath) throws ReactorException {
-        InputStream yangStream = RetestModel.class.getResourceAsStream(resourcePath);
-        return RetestUtils.parseYangStreams(Collections.singletonList(yangStream));
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_Bug3674Test.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_Bug3674Test.java
deleted file mode 100644 (file)
index 8f1d4a5..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-/**
- * BUG-3674: issuing a delete on a non-existent entry must be preserved in
- *           DataTreeModification, but should appear as UNMODIFIED in the
- *           resulting DataTreeCandidate.
- */
-public class Retest_Bug3674Test {
-    private DataTree tree;
-
-    @Before
-    public void setUp() throws ReactorException {
-        tree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        tree.setSchemaContext(RetestModel.createTestContext());
-
-        // Create the top-level container
-        final DataTreeModification mod = tree.takeSnapshot().newModification();
-        mod.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        mod.ready();
-        tree.commit(tree.prepare(mod));
-    }
-
-    @Test
-    public void testDeleteOfNonExistingNode() {
-        final DataTreeModification mod = tree.takeSnapshot().newModification();
-        mod.delete(TestModel.OUTER_LIST_PATH);
-        mod.ready();
-
-        final DataTreeCandidate candidate = tree.prepare(mod);
-        final DataTreeCandidateNode root = candidate.getRootNode();
-        assertEquals(ModificationType.UNMODIFIED, root.getModificationType());
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ConcurrentTreeModificationTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ConcurrentTreeModificationTest.java
deleted file mode 100644 (file)
index 5ef6bde..0000000
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
-import com.google.common.base.Optional;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Retest_ConcurrentTreeModificationTest {
-    private static final Logger LOG = LoggerFactory.getLogger(Retest_ConcurrentTreeModificationTest.class);
-
-    private static final Short ONE_ID = 1;
-    private static final Short TWO_ID = 2;
-
-    private static final YangInstanceIdentifier OUTER_LIST_1_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
-            .build();
-
-    private static final YangInstanceIdentifier OUTER_LIST_2_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .build();
-
-    private static final MapEntryNode FOO_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
-            .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME) //
-                    .build()) //
-            .build();
-
-    private static final MapEntryNode BAR_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME) //
-                    .build()) //
-            .build();
-
-    private SchemaContext schemaContext;
-    private InMemoryDataTree inMemoryDataTree;
-
-    @Before
-    public void prepare() throws ReactorException {
-        schemaContext = RetestModel.createTestContext();
-        assertNotNull("Schema context must not be null.", schemaContext);
-        inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-    }
-
-    private static ContainerNode createFooTestContainerNode() {
-        return ImmutableContainerNodeBuilder
-                .create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(
-                        mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
-                                .withChild(FOO_NODE).build()).build();
-    }
-
-    private static ContainerNode createBarTestContainerNode() {
-        return ImmutableContainerNodeBuilder
-                .create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(
-                        mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
-                                .withChild(BAR_NODE).build()).build();
-    }
-
-    private static <T> T assertPresentAndType(final Optional<?> potential, final Class<T> type) {
-        assertNotNull(potential);
-        assertTrue(potential.isPresent());
-        assertTrue(type.isInstance(potential.get()));
-        return type.cast(potential.get());
-    }
-
-    @Test
-    public void writeWrite1stLevelEmptyTreeTest() throws DataValidationFailedException {
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        modificationTree2.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-
-        modificationTree1.ready();
-        modificationTree2.ready();
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            fail("Exception should have been thrown.");
-        } catch (final ConflictingModificationAppliedException ex) {
-            LOG.debug("ConflictingModificationAppliedException - '{}' was thrown as expected.");
-        }
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final Optional<NormalizedNode<?, ?>> testNodeAfterCommits = modificationTree1.readNode(TestModel.TEST_PATH);
-        assertPresentAndType(testNodeAfterCommits, ContainerNode.class);
-    }
-
-    @Test
-    public void writeMerge1stLevelEmptyTreeTest() throws DataValidationFailedException {
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        modificationTree2.merge(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final Optional<NormalizedNode<?, ?>> testNodeAfterCommits = modificationTree1.readNode(TestModel.TEST_PATH);
-        assertPresentAndType(testNodeAfterCommits, ContainerNode.class);
-    }
-
-    @Test
-    public void writeWriteFooBar1stLevelEmptyTreeTest() throws DataValidationFailedException {
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.write(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            fail("Exception should have been thrown.");
-            final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-            inMemoryDataTree.commit(prepare2);
-        } catch (final ConflictingModificationAppliedException ex) {
-            LOG.debug("ConflictingModificationAppliedException - '{}' was thrown as expected.");
-        }
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertFalse(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH).isPresent());
-    }
-
-    @Test
-    public void writeMergeFooBar1stLevelEmptyTreeTest() throws DataValidationFailedException {
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.merge(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void mergeWriteFooBar1stLevelEmptyTreeTest() throws DataValidationFailedException {
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.merge(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.write(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            fail("Exception should have been thrown.");
-            final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-            inMemoryDataTree.commit(prepare2);
-        } catch (final ConflictingModificationAppliedException ex) {
-            LOG.debug("ConflictingModificationAppliedException - '{}' was thrown as expected.");
-        }
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertFalse(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH).isPresent());
-    }
-
-    @Test
-    public void mergeMergeFooBar1stLevelEmptyTreeTest() throws DataValidationFailedException {
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.merge(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.merge(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void writeWriteFooBar1stLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.write(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            fail("Exception should have been thrown.");
-            final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-            inMemoryDataTree.commit(prepare2);
-        } catch (final ConflictingModificationAppliedException ex) {
-            LOG.debug("ConflictingModificationAppliedException - '{}' was thrown as expected.");
-        }
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertFalse(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH).isPresent());
-    }
-
-    @Test
-    public void writeMergeFooBar1stLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.merge(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void mergeWriteFooBar1stLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.merge(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.write(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            fail("Exception should have been thrown.");
-            final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-            inMemoryDataTree.commit(prepare2);
-        } catch (final ConflictingModificationAppliedException ex) {
-            LOG.debug("ConflictingModificationAppliedException - '{}' was thrown as expected.");
-        }
-
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertFalse(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH).isPresent());
-    }
-
-    @Test
-    public void mergeMergeFooBar1stLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.merge(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree2.merge(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void deleteWriteFooBar1stLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.delete(TestModel.TEST_PATH);
-        modificationTree2.write(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            fail("Exception should have been thrown.");
-            final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-            inMemoryDataTree.commit(prepare2);
-        } catch (final ConflictingModificationAppliedException ex) {
-            LOG.debug("ConflictingModificationAppliedException - '{}' was thrown as expected.");
-        }
-
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertFalse(snapshotAfterCommits.readNode(TestModel.TEST_PATH).isPresent());
-    }
-
-    @Test
-    public void deleteMergeFooBar1stLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.delete(TestModel.TEST_PATH);
-        modificationTree2.merge(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void writeWriteFooBar2ndLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.write(TestModel.OUTER_LIST_PATH, mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(OUTER_LIST_1_PATH, FOO_NODE);
-        modificationTree2.write(OUTER_LIST_2_PATH, BAR_NODE);
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void writeMergeFooBar2ndLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.write(TestModel.OUTER_LIST_PATH, mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.write(OUTER_LIST_1_PATH, FOO_NODE);
-        modificationTree2.merge(OUTER_LIST_2_PATH, BAR_NODE);
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void mergeWriteFooBar2ndLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.write(TestModel.OUTER_LIST_PATH, mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.merge(OUTER_LIST_1_PATH, FOO_NODE);
-        modificationTree2.write(OUTER_LIST_2_PATH, BAR_NODE);
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void mergeMergeFooBar2ndLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.write(TestModel.OUTER_LIST_PATH, mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.merge(OUTER_LIST_1_PATH, FOO_NODE);
-        modificationTree2.merge(OUTER_LIST_2_PATH, BAR_NODE);
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        inMemoryDataTree.validate(modificationTree2);
-        final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-        inMemoryDataTree.commit(prepare2);
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_1_PATH), MapEntryNode.class);
-        assertPresentAndType(snapshotAfterCommits.readNode(OUTER_LIST_2_PATH), MapEntryNode.class);
-    }
-
-    @Test
-    public void deleteWriteFooBar2ndLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.write(TestModel.OUTER_LIST_PATH, mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.delete(TestModel.TEST_PATH);
-        modificationTree2.merge(OUTER_LIST_2_PATH, BAR_NODE);
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-            inMemoryDataTree.commit(prepare2);
-            fail("Exception should have been thrown");
-        } catch (final Exception e) {
-            LOG.debug("Exception was thrown because path no longer exist in tree");
-        }
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertFalse(snapshotAfterCommits.readNode(TestModel.TEST_PATH).isPresent());
-    }
-
-    @Test
-    public void deleteMergeFooBar2ndLevelEmptyContainerTest() throws DataValidationFailedException {
-        final DataTreeModification initialDataTreeModification = inMemoryDataTree.takeSnapshot().newModification();
-        initialDataTreeModification.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initialDataTreeModification.write(TestModel.OUTER_LIST_PATH, mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        initialDataTreeModification.ready();
-        inMemoryDataTree.commit(inMemoryDataTree.prepare(initialDataTreeModification));
-        final InMemoryDataTreeSnapshot initialDataTreeSnapshot = inMemoryDataTree.takeSnapshot();
-
-        final DataTreeModification modificationTree1 = initialDataTreeSnapshot.newModification();
-        final DataTreeModification modificationTree2 = initialDataTreeSnapshot.newModification();
-
-        modificationTree1.delete(TestModel.TEST_PATH);
-        modificationTree2.merge(OUTER_LIST_2_PATH, BAR_NODE);
-        modificationTree1.ready();
-        modificationTree2.ready();
-
-        inMemoryDataTree.validate(modificationTree1);
-        final DataTreeCandidate prepare1 = inMemoryDataTree.prepare(modificationTree1);
-        inMemoryDataTree.commit(prepare1);
-
-        try {
-            inMemoryDataTree.validate(modificationTree2);
-            final DataTreeCandidate prepare2 = inMemoryDataTree.prepare(modificationTree2);
-            inMemoryDataTree.commit(prepare2);
-            fail("Exception should have been thrown");
-        } catch (final Exception e) {
-            LOG.debug("Exception was thrown because path no longer exist in tree");
-        }
-
-        final InMemoryDataTreeSnapshot snapshotAfterCommits = inMemoryDataTree.takeSnapshot();
-        assertFalse(snapshotAfterCommits.readNode(TestModel.TEST_PATH).isPresent());
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ConfigStatementValidationTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ConfigStatementValidationTest.java
deleted file mode 100644 (file)
index 383857c..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertNotNull;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.leafNode;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
-
-import com.google.common.base.VerifyException;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-// TODO: expand these tests to catch some more obscure cases
-public class Retest_ConfigStatementValidationTest {
-    private static final Logger LOG = LoggerFactory.getLogger(Retest_ConfigStatementValidationTest.class);
-
-    private static final Short ONE_ID = 1;
-    private static final Short TWO_ID = 2;
-
-    private static final YangInstanceIdentifier OUTER_LIST_1_PATH = YangInstanceIdentifier
-            .builder(TestModel.OUTER_LIST_PATH).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
-            .build();
-
-    private static final YangInstanceIdentifier OUTER_LIST_2_PATH = YangInstanceIdentifier
-            .builder(TestModel.OUTER_LIST_PATH).nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .build();
-
-    private static final MapEntryNode INNER_FOO_ENTRY_NODE = ImmutableNodes.mapEntry(TestModel.INNER_LIST_QNAME,
-            TestModel.NAME_QNAME, "foo");
-
-    private static final MapEntryNode INNER_BAR_ENTRY_NODE = ImmutableNodes
-            .mapEntryBuilder(QName.create(TestModel.TEST_QNAME, "inner-list2"), TestModel.NAME_QNAME, "foo")
-            .withChild(ImmutableNodes.leafNode(TestModel.VALUE_QNAME, "value")).build();
-
-    private static final MapEntryNode FOO_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
-            .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME).withChild(INNER_FOO_ENTRY_NODE) //
-                    .build()) //
-            .build();
-
-    private static final MapEntryNode BAR_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME).withChild(INNER_BAR_ENTRY_NODE) //
-                    .build()) //
-            .build();
-
-    private SchemaContext schemaContext;
-
-    private static ContainerNode createFooTestContainerNode() {
-        return ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(mapNodeBuilder(TestModel.OUTER_LIST_QNAME).withChild(FOO_NODE).build()).build();
-    }
-
-    private static ContainerNode createBarTestContainerNode() {
-        return ImmutableContainerNodeBuilder.create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(mapNodeBuilder(TestModel.OUTER_LIST_QNAME).withChild(BAR_NODE).build()).build();
-    }
-
-    @Before
-    public void prepare() throws ReactorException {
-        schemaContext = RetestModel.createTestContext();
-        assertNotNull("Schema context must not be null.", schemaContext);
-    }
-
-    @Test(expected = SchemaValidationFailedException.class)
-    public void testOnPathFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
-                TreeType.CONFIGURATION);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-        final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        final YangInstanceIdentifier ii = OUTER_LIST_1_PATH.node(
-                new YangInstanceIdentifier.NodeIdentifier(TestModel.INNER_LIST_QNAME)).node(
-                INNER_FOO_ENTRY_NODE.getIdentifier());
-        modificationTree.write(ii, INNER_FOO_ENTRY_NODE);
-
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare);
-    }
-
-    @Test(expected = SchemaValidationFailedException.class)
-    public void testOnDataFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
-                TreeType.CONFIGURATION);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-        final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        modificationTree.write(TestModel.TEST_PATH, createFooTestContainerNode());
-        modificationTree.ready();
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare);
-    }
-
-    @Test(expected = SchemaValidationFailedException.class)
-    public void testOnDataLeafFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
-                TreeType.CONFIGURATION);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-        final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        modificationTree.write(TestModel.TEST_PATH, createBarTestContainerNode());
-        modificationTree.ready();
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare);
-    }
-
-    @Test(expected = SchemaValidationFailedException.class)
-    public void testOnPathCaseLeafFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
-                TreeType.CONFIGURATION);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-        final YangInstanceIdentifier.NodeIdentifier choice1Id = new YangInstanceIdentifier.NodeIdentifier(QName.create(
-                TestModel.TEST_QNAME, "choice1"));
-        final YangInstanceIdentifier.NodeIdentifier case2ContId = new YangInstanceIdentifier.NodeIdentifier(
-                QName.create(TestModel.TEST_QNAME, "case2-cont"));
-        final YangInstanceIdentifier ii = TestModel.TEST_PATH.node(choice1Id).node(case2ContId);
-        final ContainerNode case2Cont = Builders.containerBuilder().withNodeIdentifier(case2ContId)
-                .withChild(leafNode(QName.create(TestModel.TEST_QNAME, "case2-leaf1"), "leaf-value")).build();
-
-        final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        modificationTree.write(ii, case2Cont);
-        modificationTree.ready();
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare);
-    }
-
-    @Test(expected = VerifyException.class)
-    public void testOnDataCaseLeafFail() throws DataValidationFailedException {
-        final InMemoryDataTree inMemoryDataTree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(
-                TreeType.CONFIGURATION);
-        inMemoryDataTree.setSchemaContext(schemaContext);
-        final YangInstanceIdentifier.NodeIdentifier choice1Id = new YangInstanceIdentifier.NodeIdentifier(QName.create(
-                TestModel.TEST_QNAME, "choice1"));
-        final YangInstanceIdentifier ii = TestModel.TEST_PATH.node(choice1Id);
-        final ChoiceNode choice1 = Builders.choiceBuilder().withNodeIdentifier(choice1Id)
-                .withChild(leafNode(QName.create(TestModel.TEST_QNAME, "case1-leaf1"), "leaf-value")).build();
-
-        final InMemoryDataTreeModification modificationTree = inMemoryDataTree.takeSnapshot().newModification();
-        modificationTree.write(ii, choice1);
-        modificationTree.ready();
-        inMemoryDataTree.validate(modificationTree);
-        final DataTreeCandidate prepare = inMemoryDataTree.prepare(modificationTree);
-        inMemoryDataTree.commit(prepare);
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ErrorReportingTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ErrorReportingTest.java
deleted file mode 100644 (file)
index da04117..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ModifiedNodeDoesNotExistException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-public class Retest_ErrorReportingTest {
-
-    private InMemoryDataTree tree;
-
-    @Before
-    public void setup() throws ReactorException {
-        tree = (InMemoryDataTree) InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        tree.setSchemaContext(RetestModel.createTestContext());
-    }
-
-    @Test
-    public void writeWithoutParentExisting() {
-        InMemoryDataTreeModification modification = tree.takeSnapshot().newModification();
-        // We write node without creating parent
-        modification.write(TestModel.OUTER_LIST_PATH, ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        modification.ready();
-        try {
-            tree.validate(modification);
-            fail("ModifiedNodeDoesNotExistException should be raised");
-        } catch (ModifiedNodeDoesNotExistException e) {
-            assertEquals(TestModel.TEST_PATH, e.getPath());
-        } catch (DataValidationFailedException e) {
-            fail("ModifiedNodeDoesNotExistException expected");
-        }
-    }
-
-    @Test
-    public void parentConcurrentlyDeletedExisting() {
-        InMemoryDataTreeModification initial = tree.takeSnapshot().newModification();
-        // We write node without creating parent
-        initial.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-        initial.ready();
-        // We commit transaction
-        tree.commit(tree.prepare(initial));
-
-        InMemoryDataTreeModification writeTx = tree.takeSnapshot().newModification();
-        InMemoryDataTreeModification deleteTx = tree.takeSnapshot().newModification();
-        deleteTx.delete(TestModel.TEST_PATH);
-        deleteTx.ready();
-        // We commit delete modification
-        tree.commit(tree.prepare(deleteTx));
-
-        writeTx.write(TestModel.OUTER_LIST_PATH, ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-        writeTx.ready();
-        try {
-            tree.validate(writeTx);
-            fail("ConflictingModificationAppliedException should be raised");
-        } catch (ConflictingModificationAppliedException e) {
-            assertEquals(TestModel.TEST_PATH, e.getPath());
-        } catch (DataValidationFailedException e) {
-            fail("ConflictingModificationAppliedException expected");
-        }
-
-    }
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ModificationMetadataTreeTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_ModificationMetadataTreeTest.java
deleted file mode 100644 (file)
index 7fb92d1..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
-import com.google.common.base.Optional;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNodeFactory;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-
-/**
- *
- * Schema structure of document is
- *
- * <pre>
- * container root { 
- *      list list-a {
- *              key leaf-a;
- *              leaf leaf-a;
- *              choice choice-a {
- *                      case one {
- *                              leaf one;
- *                      }
- *                      case two-three {
- *                              leaf two;
- *                              leaf three;
- *                      }
- *              }
- *              list list-b {
- *                      key leaf-b;
- *                      leaf leaf-b;
- *              }
- *      }
- * }
- * </pre>
- *
- */
-public class Retest_ModificationMetadataTreeTest {
-
-    private static final Short ONE_ID = 1;
-    private static final Short TWO_ID = 2;
-    private static final String TWO_ONE_NAME = "one";
-    private static final String TWO_TWO_NAME = "two";
-
-    private static final YangInstanceIdentifier OUTER_LIST_1_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
-            .build();
-
-    private static final YangInstanceIdentifier OUTER_LIST_2_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .build();
-
-    private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier.builder(OUTER_LIST_2_PATH)
-            .node(TestModel.INNER_LIST_QNAME) //
-            .nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, TWO_TWO_NAME) //
-            .build();
-
-    private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH = YangInstanceIdentifier.builder(TWO_TWO_PATH)
-            .node(TestModel.VALUE_QNAME) //
-            .build();
-
-    private static final MapEntryNode BAR_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME) //
-                    .withChild(mapEntry(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, TWO_ONE_NAME)) //
-                    .withChild(mapEntry(TestModel.INNER_LIST_QNAME,TestModel.NAME_QNAME, TWO_TWO_NAME)) //
-                    .build()) //
-                    .build();
-
-    private SchemaContext schemaContext;
-    private RootModificationApplyOperation rootOper;
-
-    @Before
-    public void prepare() throws ReactorException {
-        schemaContext = RetestModel.createTestContext();
-        assertNotNull("Schema context must not be null.", schemaContext);
-        rootOper = RootModificationApplyOperation.from(SchemaAwareApplyOperation.from(schemaContext, TreeType.OPERATIONAL));
-    }
-
-    /**
-     * Returns a test document
-     *
-     * <pre>
-     * test
-     *     outer-list
-     *          id 1
-     *     outer-list
-     *          id 2
-     *          inner-list
-     *                  name "one"
-     *          inner-list
-     *                  name "two"
-     *
-     * </pre>
-     *
-     * @return
-     */
-    public NormalizedNode<?, ?> createDocumentOne() {
-        return ImmutableContainerNodeBuilder
-                .create()
-                .withNodeIdentifier(new NodeIdentifier(schemaContext.getQName()))
-                .withChild(createTestContainer()).build();
-
-    }
-
-    private static ContainerNode createTestContainer() {
-        return ImmutableContainerNodeBuilder
-                .create()
-                .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(
-                        mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
-                        .withChild(mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID))
-                        .withChild(BAR_NODE).build()).build();
-    }
-
-    @Test
-    public void basicReadWrites() {
-        final DataTreeModification modificationTree = new InMemoryDataTreeModification(new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper),
-                rootOper);
-        final Optional<NormalizedNode<?, ?>> originalBarNode = modificationTree.readNode(OUTER_LIST_2_PATH);
-        assertTrue(originalBarNode.isPresent());
-        assertSame(BAR_NODE, originalBarNode.get());
-
-        // writes node to /outer-list/1/inner_list/two/value
-        modificationTree.write(TWO_TWO_VALUE_PATH, ImmutableNodes.leafNode(TestModel.VALUE_QNAME, "test"));
-
-        // reads node to /outer-list/1/inner_list/two/value
-        // and checks if node is already present
-        final Optional<NormalizedNode<?, ?>> barTwoCModified = modificationTree.readNode(TWO_TWO_VALUE_PATH);
-        assertTrue(barTwoCModified.isPresent());
-        assertEquals(ImmutableNodes.leafNode(TestModel.VALUE_QNAME, "test"), barTwoCModified.get());
-
-        // delete node to /outer-list/1/inner_list/two/value
-        modificationTree.delete(TWO_TWO_VALUE_PATH);
-        final Optional<NormalizedNode<?, ?>> barTwoCAfterDelete = modificationTree.readNode(TWO_TWO_VALUE_PATH);
-        assertFalse(barTwoCAfterDelete.isPresent());
-    }
-
-
-    public DataTreeModification createEmptyModificationTree() {
-        /**
-         * Creates empty Snapshot with associated schema context.
-         */
-        final DataTree t = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
-        t.setSchemaContext(schemaContext);
-
-        /**
-         *
-         * Creates Mutable Data Tree based on provided snapshot and schema
-         * context.
-         *
-         */
-        return t.takeSnapshot().newModification();
-    }
-
-    @Test
-    public void createFromEmptyState() {
-
-        final DataTreeModification modificationTree = createEmptyModificationTree();
-        /**
-         * Writes empty container node to /test
-         *
-         */
-        modificationTree.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
-
-        /**
-         * Writes empty list node to /test/outer-list
-         */
-        modificationTree.write(TestModel.OUTER_LIST_PATH, ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
-
-        /**
-         * Reads list node from /test/outer-list
-         */
-        final Optional<NormalizedNode<?, ?>> potentialOuterList = modificationTree.readNode(TestModel.OUTER_LIST_PATH);
-        assertTrue(potentialOuterList.isPresent());
-
-        /**
-         * Reads container node from /test and verifies that it contains test
-         * node
-         */
-        final Optional<NormalizedNode<?, ?>> potentialTest = modificationTree.readNode(TestModel.TEST_PATH);
-        final ContainerNode containerTest = assertPresentAndType(potentialTest, ContainerNode.class);
-
-        /**
-         *
-         * Gets list from returned snapshot of /test and verifies it contains
-         * outer-list
-         *
-         */
-        assertPresentAndType(containerTest.getChild(new NodeIdentifier(TestModel.OUTER_LIST_QNAME)), MapNode.class);
-
-    }
-
-    @Test
-    public void writeSubtreeReadChildren() {
-        final DataTreeModification modificationTree = createEmptyModificationTree();
-        modificationTree.write(TestModel.TEST_PATH, createTestContainer());
-        final Optional<NormalizedNode<?, ?>> potential = modificationTree.readNode(TWO_TWO_PATH);
-        assertPresentAndType(potential, MapEntryNode.class);
-    }
-
-    @Test
-    public void writeSubtreeDeleteChildren() {
-        final DataTreeModification modificationTree = createEmptyModificationTree();
-        modificationTree.write(TestModel.TEST_PATH, createTestContainer());
-
-        // We verify data are present
-        final Optional<NormalizedNode<?, ?>> potentialBeforeDelete = modificationTree.readNode(TWO_TWO_PATH);
-        assertPresentAndType(potentialBeforeDelete, MapEntryNode.class);
-
-        modificationTree.delete(TWO_TWO_PATH);
-        final Optional<NormalizedNode<?, ?>> potentialAfterDelete = modificationTree.readNode(TWO_TWO_PATH);
-        assertFalse(potentialAfterDelete.isPresent());
-
-    }
-
-    private static <T> T assertPresentAndType(final Optional<?> potential, final Class<T> type) {
-        assertNotNull(potential);
-        assertTrue(potential.isPresent());
-        assertTrue(type.isInstance(potential.get()));
-        return type.cast(potential.get());
-    }
-
-}
diff --git a/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_StoreTreeNodesTest.java b/yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/tree/Retest_StoreTreeNodesTest.java
deleted file mode 100644 (file)
index baef1ac..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.data.impl.schema.tree;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
-
-import com.google.common.base.Optional;
-
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.StoreTreeNodes;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNodeFactory;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Retest_StoreTreeNodesTest {
-    private static final Logger LOG = LoggerFactory.getLogger(Retest_StoreTreeNodesTest.class);
-
-    private static final Short ONE_ID = 1;
-    private static final Short TWO_ID = 2;
-    private static final String TWO_ONE_NAME = "one";
-    private static final String TWO_TWO_NAME = "two";
-
-    private static final YangInstanceIdentifier OUTER_LIST_1_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID) //
-            .build();
-
-    private static final YangInstanceIdentifier OUTER_LIST_2_PATH = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-            .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .build();
-
-    private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier.builder(OUTER_LIST_2_PATH)
-            .node(TestModel.INNER_LIST_QNAME) //
-            .nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, TWO_TWO_NAME) //
-            .build();
-
-    private static final MapEntryNode BAR_NODE = mapEntryBuilder(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, TWO_ID) //
-            .withChild(mapNodeBuilder(TestModel.INNER_LIST_QNAME) //
-                    .withChild(mapEntry(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, TWO_ONE_NAME)) //
-                    .withChild(mapEntry(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, TWO_TWO_NAME)) //
-                    .build()) //
-                    .build();
-
-    private SchemaContext schemaContext;
-    private RootModificationApplyOperation rootOper;
-
-    @Before
-    public void prepare() throws ReactorException {
-        schemaContext = RetestModel.createTestContext();
-        assertNotNull("Schema context must not be null.", schemaContext);
-        rootOper = RootModificationApplyOperation.from(SchemaAwareApplyOperation.from(schemaContext, TreeType.OPERATIONAL));
-    }
-
-    public NormalizedNode<?, ?> createDocumentOne() {
-        return ImmutableContainerNodeBuilder
-                .create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
-                .withChild(createTestContainer()).build();
-
-    }
-
-    private static ContainerNode createTestContainer() {
-        return ImmutableContainerNodeBuilder
-                .create()
-                .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME))
-                .withChild(
-                        mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
-                        .withChild(mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, ONE_ID))
-                        .withChild(BAR_NODE).build()).build();
-    }
-
-    private static <T> T assertPresentAndType(final Optional<?> potential, final Class<T> type) {
-        assertNotNull(potential);
-        assertTrue(potential.isPresent());
-        assertTrue(type.isInstance(potential.get()));
-        return type.cast(potential.get());
-    }
-
-    @Test
-    public void findNodeTestNodeFound() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        final Optional<TreeNode> node = StoreTreeNodes.findNode(rootNode, OUTER_LIST_1_PATH);
-        assertPresentAndType(node, TreeNode.class);
-    }
-
-    @Test
-    public void findNodeTestNodeNotFound() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        final YangInstanceIdentifier outerList1InvalidPath = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-                .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 3) //
-                .build();
-        final Optional<TreeNode> node = StoreTreeNodes.findNode(rootNode, outerList1InvalidPath);
-        assertFalse(node.isPresent());
-    }
-
-    @Test
-    public void findNodeCheckedTestNodeFound() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        TreeNode foundNode = null;
-        try {
-            foundNode = StoreTreeNodes.findNodeChecked(rootNode, OUTER_LIST_1_PATH);
-        } catch (final IllegalArgumentException e) {
-            fail("Illegal argument exception was thrown and should not have been" + e.getMessage());
-        }
-        assertNotNull(foundNode);
-    }
-
-    @Test
-    public void findNodeCheckedTestNodeNotFound() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        final YangInstanceIdentifier outerList1InvalidPath = YangInstanceIdentifier.builder(TestModel.OUTER_LIST_PATH)
-                .nodeWithKey(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 3) //
-                .build();
-        try {
-            StoreTreeNodes.findNodeChecked(rootNode, outerList1InvalidPath);
-            fail("Illegal argument exception should have been thrown");
-        } catch (final IllegalArgumentException e) {
-            LOG.debug("Illegal argument exception was thrown as expected: '{}' - '{}'", e.getClass(), e.getMessage());
-        }
-    }
-
-    @Test
-    public void findClosestOrFirstMatchTestNodeExists() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        final Optional<TreeNode> expectedNode = StoreTreeNodes.findNode(rootNode, TWO_TWO_PATH);
-        assertPresentAndType(expectedNode, TreeNode.class);
-        final Map.Entry<YangInstanceIdentifier, TreeNode> actualNode = StoreTreeNodes.findClosest(rootNode, TWO_TWO_PATH);
-        assertEquals("Expected node and actual node are not the same", expectedNode.get(), actualNode.getValue());
-    }
-
-    @Test
-    public void findClosestOrFirstMatchTestNodeDoesNotExist() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        final YangInstanceIdentifier outerListInnerListPath = YangInstanceIdentifier.builder(OUTER_LIST_2_PATH)
-                .node(TestModel.INNER_LIST_QNAME)
-                .build();
-        final YangInstanceIdentifier twoTwoInvalidPath = YangInstanceIdentifier.builder(OUTER_LIST_2_PATH)
-                .node(TestModel.INNER_LIST_QNAME) //
-                .nodeWithKey(TestModel.INNER_LIST_QNAME, TestModel.NAME_QNAME, "three") //
-                .build();
-        final Optional<TreeNode> expectedNode = StoreTreeNodes.findNode(rootNode, outerListInnerListPath);
-        assertPresentAndType(expectedNode, TreeNode.class);
-        final Map.Entry<YangInstanceIdentifier, TreeNode> actualNode = StoreTreeNodes.findClosest(rootNode, twoTwoInvalidPath);
-        assertEquals("Expected node and actual node are not the same", expectedNode.get(), actualNode.getValue());
-    }
-
-    @Test
-    public void getChildTestChildFound() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        final Optional<TreeNode> node = StoreTreeNodes.getChild(Optional.fromNullable(rootNode),
-                TestModel.TEST_PATH.getLastPathArgument());
-        assertPresentAndType(node, TreeNode.class);
-    }
-
-    @Test
-    public void getChildTestChildNotFound() {
-        final InMemoryDataTreeSnapshot inMemoryDataTreeSnapshot = new InMemoryDataTreeSnapshot(schemaContext,
-                TreeNodeFactory.createTreeNodeRecursively(createDocumentOne(), Version.initial()), rootOper);
-        final TreeNode rootNode = inMemoryDataTreeSnapshot.getRootNode();
-        final Optional<TreeNode> node = StoreTreeNodes.getChild(Optional.fromNullable(rootNode),
-                TestModel.OUTER_LIST_PATH.getLastPathArgument());
-        assertFalse(node.isPresent());
-    }
-}
index f191518007641dd406948e14bb0607f7af03cfc4..237d61a5796e20c351d16408e05c8457f70c5682 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -17,7 +17,9 @@ import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.ma
 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
 
 import com.google.common.base.Optional;
+
 import java.util.Map;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -31,6 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.TreeNodeFactory;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.spi.Version;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,7 +69,7 @@ public class StoreTreeNodesTest {
     private RootModificationApplyOperation rootOper;
 
     @Before
-    public void prepare() {
+    public void prepare() throws ReactorException {
         schemaContext = TestModel.createTestContext();
         assertNotNull("Schema context must not be null.", schemaContext);
         rootOper = RootModificationApplyOperation.from(SchemaAwareApplyOperation.from(schemaContext, TreeType.OPERATIONAL));
index 25e651914858f33fcdcf4dffbe50dcbc0e7cf9db..221042ac3c362956631974928de1029f8710f062 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -7,20 +7,20 @@
  */
 package org.opendaylight.yangtools.yang.data.impl.schema.tree;
 
-import com.google.common.io.Resources;
-import java.io.IOException;
 import java.io.InputStream;
+import java.util.Arrays;
 import java.util.Collections;
+
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.impl.TestUtils;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
-public final class TestModel {
+public class TestModel {
 
-    public static final QName TEST_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13",
-        "test");
+    public static final QName TEST_QNAME = QName.create(
+            "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13", "test");
     public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
     public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
     public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice");
@@ -30,29 +30,21 @@ public final class TestModel {
     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
     public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
-    public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+    public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH)
+            .node(OUTER_LIST_QNAME).build();
     public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
     public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
 
-    private TestModel() {
-        throw new UnsupportedOperationException();
-    }
-
     public static InputStream getDatastoreTestInputStream() {
         return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
     }
 
-    public static SchemaContext createTestContext() {
-        return createTestContext(DATASTORE_TEST_YANG);
+    public static SchemaContext createTestContext() throws ReactorException {
+        return TestUtils.parseYangStreams(Arrays.asList(getDatastoreTestInputStream()));
     }
 
-    public static SchemaContext createTestContext(String resourcePath) {
-        YangParserImpl parser = new YangParserImpl();
-        try {
-            return parser.parseSources(Collections.singleton(Resources.asByteSource(TestModel.class
-                    .getResource(resourcePath))));
-        } catch (IOException | YangSyntaxErrorException e) {
-            throw new IllegalStateException("Failed to create context", e);
-        }
+    public static SchemaContext createTestContext(String resourcePath) throws ReactorException {
+        InputStream yangStream = TestModel.class.getResourceAsStream(resourcePath);
+        return TestUtils.parseYangStreams(Collections.singletonList(yangStream));
     }
 }
index 4013366cbba00a022d70450a43b8966257d47099..be8ba083f66f2ac8ff6d1b5e81a81160319da522 100644 (file)
@@ -47,6 +47,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.xpath.XPathResult;
 import org.opendaylight.yangtools.yang.data.api.schema.xpath.XPathSchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class JaxenTest {
     private ConverterNamespaceContext convertNctx;
@@ -67,7 +68,7 @@ public class JaxenTest {
 
     @Before
     public void setup() throws URISyntaxException, IOException, ParseException, XPathExpressionException,
-            UnsupportedAxisException {
+            UnsupportedAxisException, ReactorException {
         final SchemaContext schemaContext = createSchemaContext();
         assertNotNull(schemaContext);
 
@@ -214,8 +215,8 @@ public class JaxenTest {
         return SchemaPath.create(true, rootQName, listAQName, leafAQName);
     }
 
-    private SchemaContext createSchemaContext() throws IOException, URISyntaxException {
-        return TestUtils.loadSchemaContext(getClass().getResource("/test/documentTest").toURI());
+    private SchemaContext createSchemaContext() throws IOException, URISyntaxException, ReactorException {
+        return TestUtils.loadModules("/test/documentTest");
     }
 
     private static NormalizedNode<?, ?> createNormalizedNodes() {
index 406475315b2e82092ded239d53db627332a0081a..9a5ff3ba716d80e5ad0115bb6efe6c0d42f31d78 100644 (file)
@@ -13,10 +13,13 @@ import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.ma
 import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -25,6 +28,12 @@ import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
+import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 
 final class TestUtils {
 
@@ -47,19 +56,46 @@ final class TestUtils {
     private TestUtils() {
     }
 
-    public static SchemaContext loadSchemaContext(final URI resourceDirectory) throws IOException {
-        final YangParserImpl parser = new YangParserImpl();
-        final File testDir = new File(resourceDirectory);
+    static SchemaContext loadModules(final String resourceDirectory) throws IOException, URISyntaxException,
+            ReactorException {
+        URI path = TestUtils.class.getResource(resourceDirectory).toURI();
+        final File testDir = new File(path);
         final String[] fileList = testDir.list();
         final List<File> testFiles = new ArrayList<>();
         if (fileList == null) {
-            throw new FileNotFoundException(resourceDirectory.toString());
+            throw new FileNotFoundException(resourceDirectory);
         }
         for (String fileName : fileList) {
-            testFiles.add(new File(testDir, fileName));
+            if (!new File(testDir, fileName).isDirectory()) {
+                testFiles.add(new File(testDir, fileName));
+            }
         }
-        SchemaContext ctx = parser.parseFiles(testFiles);
-        return ctx;
+        return parseYangSources(testFiles);
+    }
+
+    public static SchemaContext parseYangSources(StatementStreamSource... sources)
+            throws SourceException, ReactorException {
+
+        CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
+                .newBuild();
+        reactor.addSources(sources);
+
+        return reactor.buildEffective();
+    }
+
+    public static SchemaContext parseYangSources(File... files) throws SourceException, ReactorException, FileNotFoundException {
+
+        StatementStreamSource[] sources = new StatementStreamSource[files.length];
+
+        for(int i = 0; i<files.length; i++) {
+            sources[i] = new YangStatementSourceImpl(new FileInputStream(files[i]));
+        }
+
+        return parseYangSources(sources);
+    }
+
+    public static SchemaContext parseYangSources(Collection<File> files) throws SourceException, ReactorException, FileNotFoundException {
+        return parseYangSources(files.toArray(new File[files.size()]));
     }
 
     /**
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/AbstractBuilderTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/AbstractBuilderTest.java
deleted file mode 100644 (file)
index 684b068..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import com.google.common.base.Optional;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import org.junit.Before;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.util.MustDefinitionImpl;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-
-/**
- * Created by lukas on 10/14/14.
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public abstract class AbstractBuilderTest {
-
-    protected final static String MODULE_NAMESPACE = "urn:opendaylight.rpc:def:test-model";
-    protected final static String REVISION = "2014-10-06";
-    protected final static String MODULE_NAME = "test-module";
-    protected final static DateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-mm-dd");
-    protected final static String MODULE_PATH = "test/module/path/test-module@" + REVISION + ".yang";
-
-    protected ModuleBuilder module;
-
-    @Before
-    public void setUp() throws Exception {
-        module = new ModuleBuilder(MODULE_NAME, MODULE_PATH);
-        final Date moduleRevision = SIMPLE_DATE_FORMAT.parse(REVISION);
-        module.setRevision(moduleRevision);
-        module.setNamespace(URI.create(MODULE_NAMESPACE));
-        module.setPrefix("mod");
-    }
-
-    protected MustDefinition provideMustDefinition() {
-        return MustDefinitionImpl.create("must-condition == value",
-            Optional.fromNullable("desc"), Optional.fromNullable("reference"), Optional.fromNullable("error-apptag"),
-            Optional.fromNullable("error-message"));
-    }
-
-    protected UnknownSchemaNodeBuilder provideUnknownNodeBuilder() {
-        final QName unknownType = QName.create(module.getNamespace(), module.getRevision(), "unknown-type");
-        final QName unknownNode = QName.create(module.getNamespace(), module.getRevision(), "unknown-ext-use");
-        final SchemaPath unknownNodePath = SchemaPath.create(true, unknownNode);
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = new UnknownSchemaNodeBuilderImpl(module.getModuleName(),
-            25, unknownNode, unknownNodePath);
-        unknownNodeBuilder.setNodeType(unknownType);
-        return unknownNodeBuilder;
-    }
-
-    protected UnknownSchemaNodeBuilder provideUnknownNodeBuilder(final QName innerPathSegment) {
-        final QName unknownType = QName.create(module.getNamespace(), module.getRevision(), "unknown-type");
-        final QName unknownNode = QName.create(module.getNamespace(), module.getRevision(), "unknown-ext-use");
-        final SchemaPath unknownNodePath = SchemaPath.create(true, innerPathSegment, unknownNode);
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = new UnknownSchemaNodeBuilderImpl(module.getModuleName(),
-            25, unknownNode, unknownNodePath);
-        unknownNodeBuilder.setNodeType(unknownType);
-        return unknownNodeBuilder;
-    }
-
-    protected ChoiceBuilder provideChoiceBuilder(final String choiceLocalName) {
-        final QName choiceName = QName.create(module.getNamespace(), module.getRevision(), choiceLocalName);
-        final SchemaPath choicePath = SchemaPath.create(true, choiceName);
-        final ChoiceBuilder choiceBuilder = new ChoiceBuilder(module.getModuleName(), 22, choiceName, choicePath);
-
-        return choiceBuilder;
-    }
-
-    protected UsesNodeBuilder provideUsesNodeBuilder(final String usesGroupingName) {
-        final QName targetQName = QName.create(module.getNamespace(), module.getRevision(), usesGroupingName);
-        return new UsesNodeBuilderImpl(module.getModuleName(), 10, SchemaPath.create(true, targetQName));
-    }
-
-    protected ContainerSchemaNodeBuilder provideContainerBuilder(final String containerLocalName) {
-        final QName containerQName = QName.create(module.getNamespace(), module.getRevision(), containerLocalName);
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-
-        return new ContainerSchemaNodeBuilder(module.getModuleName(), 10,
-            containerQName, containerPath);
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/BuilderUtilsTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/BuilderUtilsTest.java
deleted file mode 100644 (file)
index 11a3f84..0000000
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import com.google.common.base.Optional;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.NavigableMap;
-import java.util.TreeMap;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.util.Uint16;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Test suite for increasing of test coverage of BuilderUtils implementation.
- *
- * @see org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils
- *
- * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class BuilderUtilsTest {
-
-    private final static String MASTER_MODULE_NAMESPACE = "urn:opendaylight.master-model";
-    private final static String MODULES_REVISION = "2014-10-06";
-    private final static String MASTER_MODULE = "master-module";
-    private final static String DEPENDENT_MODULE_NAMESPACE = "urn:opendaylight.secondary-model";
-    private final static String DEPENDENT_MODULE = "depend-module";
-    private final static String MASTER_MODULE_PATH = "test/module/path/master-module@" + MODULES_REVISION + ".yang";
-    private final static String DEPENDENT_MODULE_PATH = "test/module/path/depend-module@" + MODULES_REVISION + ".yang";
-    private final static String DEPENDENT_MODULE_PREFIX = "dep";
-
-    private final static DateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-mm-dd");
-
-    private ModuleBuilder masterModule;
-    private ModuleBuilder dependentModule;
-
-    @Before
-    public void setUp() throws Exception {
-        masterModule = new ModuleBuilder(MASTER_MODULE, MASTER_MODULE_PATH);
-        dependentModule = new ModuleBuilder(DEPENDENT_MODULE, DEPENDENT_MODULE_PATH);
-
-        final Date moduleRevision = SIMPLE_DATE_FORMAT.parse(MODULES_REVISION);
-        masterModule.setRevision(moduleRevision);
-        dependentModule.setRevision(moduleRevision);
-
-        masterModule.setNamespace(URI.create(MASTER_MODULE_NAMESPACE));
-        dependentModule.setNamespace(URI.create(DEPENDENT_MODULE_NAMESPACE));
-
-        masterModule.setNamespace(URI.create(MASTER_MODULE_NAMESPACE));
-        dependentModule.setNamespace(URI.create(DEPENDENT_MODULE_NAMESPACE));
-
-        masterModule.setPrefix("mod");
-        dependentModule.setPrefix("mod");
-        masterModule.addModuleImport(dependentModule.getModuleName(), dependentModule.getRevision(), DEPENDENT_MODULE_PREFIX);
-    }
-
-    @Test
-    public void testFindModuleFromBuildersWithNullPrefix() throws Exception {
-        final Map<String, NavigableMap<Date, ModuleBuilder>> testModules = initModuleBuildersForTest();
-
-        ModuleBuilder result = BuilderUtils.findModuleFromBuilders(testModules, masterModule, null, 12);
-        assertEquals(masterModule, result);
-
-        result = BuilderUtils.findModuleFromBuilders(testModules, masterModule, masterModule.getPrefix(), 12);
-        assertEquals(masterModule, result);
-
-        result = BuilderUtils.findModuleFromBuilders(testModules, masterModule, DEPENDENT_MODULE_PREFIX, 12);
-        assertEquals(dependentModule, result);
-    }
-
-    private Map<String, NavigableMap<Date, ModuleBuilder>> initModuleBuildersForTest() throws Exception {
-        final Map<String, NavigableMap<Date, ModuleBuilder>> modules = new HashMap<>();
-        final String module3Name = "Module3";
-
-        ModuleBuilder module3 = new ModuleBuilder(module3Name, "test/module/path/module3.yang");
-        final Date moduleRevision = SIMPLE_DATE_FORMAT.parse(MODULES_REVISION);
-
-        module3.setRevision(moduleRevision);
-        module3.setNamespace(URI.create("urn:opendaylight.ternary-model"));
-        module3.setPrefix("mod");
-
-        dependentModule.addModuleImport(module3.getModuleName(), module3.getRevision(), "ter");
-
-        final NavigableMap<Date, ModuleBuilder> module1Map = new TreeMap<>();
-        module1Map.put(masterModule.getRevision(), masterModule);
-
-        final NavigableMap<Date, ModuleBuilder> module2Map = new TreeMap<>();
-        module2Map.put(dependentModule.getRevision(), dependentModule);
-
-        final NavigableMap<Date, ModuleBuilder> module3Map = new TreeMap<>();
-        module3Map.put(module3.getRevision(), module3);
-
-        modules.put(masterModule.getName(), module1Map);
-        modules.put(dependentModule.getName(), module2Map);
-        modules.put(module3Name, module3Map);
-
-        return modules;
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testFindModuleFromBuildersWithNoImportedModule() throws Exception {
-        final Map<String, NavigableMap<Date, ModuleBuilder>> testModules = initModuleBuildersForTest();
-
-        BuilderUtils.findModuleFromBuilders(testModules, masterModule, "eth", 12);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testFindModuleFromContextWithDependentModuleImportEqualsToNull() {
-        final SchemaContext mockContext = mock(SchemaContext.class);
-
-        BuilderUtils.findModuleFromContext(mockContext, masterModule, "inalid-prefix", 14);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testFindModuleFromContextWhereModuleIsNotPresent() {
-        final SchemaContext mockContext = mock(SchemaContext.class);
-
-        BuilderUtils.findModuleFromContext(mockContext, masterModule, DEPENDENT_MODULE_PREFIX, 14);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testFillAugmentTargetForInvalidTarget() {
-        AugmentationSchemaBuilder augBuilder = mock(AugmentationSchemaBuilder.class);
-        Builder invalidTarget = mock(Builder.class);
-        BuilderUtils.fillAugmentTarget(augBuilder, invalidTarget);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testFillAugmentTargetWithChoiceBuilderContainingInvalidUsesNodeBuilder() {
-        final QName usesQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "test-grouping");
-        final UsesNodeBuilder usesNodeBuilder = new UsesNodeBuilderImpl(masterModule.getModuleName(), 10, SchemaPath.create(true, usesQName));
-
-        final QName augTargetQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "target");
-        final AugmentationSchemaBuilder augBuilder = new AugmentationSchemaBuilderImpl(masterModule.getModuleName(), 12,
-            "/target", SchemaPath.create(true, augTargetQName), 1);
-
-        augBuilder.setParent(usesNodeBuilder);
-
-        final QName choiceQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "test-choice");
-        final ChoiceBuilder choiceBuilder = new ChoiceBuilder(masterModule.getModuleName(), 14, choiceQName,
-            SchemaPath.create(true, choiceQName));
-
-        augBuilder.addUsesNode(usesNodeBuilder);
-        BuilderUtils.fillAugmentTarget(augBuilder, choiceBuilder);
-    }
-
-    @Test
-    public void testFillAugmentTargetSetNodeAddedByUses() {
-        final QName augTargetQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "target");
-        final AugmentationSchemaBuilder augBuilder = new AugmentationSchemaBuilderImpl(masterModule.getModuleName(), 12,
-            "/target", SchemaPath.create(true, augTargetQName), 1);
-
-        final String containerLocalName = "top-level-container";
-        final QName containerQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), containerLocalName);
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        augBuilder.addChildNode(
-            new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 10, containerQName, containerPath));
-
-        final QName choiceQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "test-choice");
-        final ChoiceBuilder choiceBuilder = new ChoiceBuilder(masterModule.getModuleName(), 14, choiceQName,
-            SchemaPath.create(true, choiceQName));
-
-        BuilderUtils.fillAugmentTarget(augBuilder, choiceBuilder);
-
-        ChoiceCaseBuilder result = choiceBuilder.getCaseNodeByName(containerLocalName);
-        assertNotNull(result);
-    }
-
-    @Test
-    public void testFindUnknownNodeInDataNodeContainer() {
-        final String parentLocalName = "parent";
-        final QName containerQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), parentLocalName);
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-
-        final ContainerSchemaNodeBuilder containerBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 10,
-            containerQName, containerPath);
-
-        final String unknownLocalName = "unknown-ext-use";
-        final QName unknownNode = QName.create(masterModule.getNamespace(), masterModule.getRevision(), unknownLocalName);
-        SchemaPath unknownNodePath = SchemaPath.create(true, containerQName, unknownNode);
-        UnknownSchemaNodeBuilderImpl unknownNodeBuilder = new UnknownSchemaNodeBuilderImpl(masterModule.getModuleName(),
-            22, unknownNode, unknownNodePath);
-        containerBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        List<QName> path = new ArrayList<>(2);
-        path.add(unknownNode);
-
-        SchemaNodeBuilder result = BuilderUtils.findSchemaNode(path, containerBuilder);
-        assertNotNull(result);
-        assertEquals(unknownNodeBuilder, result);
-
-        path.add(QName.create(masterModule.getNamespace(), masterModule.getRevision(), "foo"));
-        assertNull(BuilderUtils.findSchemaNode(path, containerBuilder));
-
-        final QName choiceQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "select");
-        SchemaPath choicePath = SchemaPath.create(true, choiceQName);
-
-        final ChoiceBuilder choiceBuilder = new ChoiceBuilder(masterModule.getModuleName(), 33, choiceQName, choicePath);
-
-        final QName caseQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "simple-case");
-        SchemaPath casePath = SchemaPath.create(true, choiceQName, caseQName);
-
-        ChoiceCaseBuilder caseBuilder = new ChoiceCaseBuilder(masterModule.getModuleName(), 35, caseQName, casePath);
-        choiceBuilder.addCase(caseBuilder);
-
-        choiceBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        path.clear();
-        path.add(caseQName);
-        result = BuilderUtils.findSchemaNode(path, choiceBuilder);
-        assertNotNull(result);
-        assertTrue(result instanceof ChoiceCaseBuilder);
-        assertEquals(caseBuilder, result);
-
-        path.clear();
-        path.add(unknownNode);
-        result = BuilderUtils.findSchemaNode(path, choiceBuilder);
-        assertNotNull(result);
-        assertEquals(unknownNodeBuilder, result);
-
-        path.add(QName.create(masterModule.getNamespace(), masterModule.getRevision(), "foo"));
-        result = BuilderUtils.findSchemaNode(path, choiceBuilder);
-        assertNull(result);
-
-        final QName rpcQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), parentLocalName);
-        SchemaPath rpcPath = SchemaPath.create(true, rpcQName);
-        final RpcDefinitionBuilder rpcBuilder = new RpcDefinitionBuilder(masterModule.getModuleName(), 45, rpcQName, rpcPath);
-
-        final QName inputQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "input");
-        final SchemaPath inputPath = SchemaPath.create(true, rpcQName, inputQName);
-
-        final QName outputQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "output");
-        final SchemaPath outputPath = SchemaPath.create(true, rpcQName, outputQName);
-
-        final ContainerSchemaNodeBuilder inputBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 46,
-            inputQName, inputPath);
-        final ContainerSchemaNodeBuilder outputBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 76,
-            outputQName, outputPath);
-
-        rpcBuilder.setInput(inputBuilder);
-        rpcBuilder.setOutput(outputBuilder);
-        rpcBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        path.clear();
-        path.add(inputQName);
-        result = BuilderUtils.findSchemaNode(path, rpcBuilder);
-        assertNotNull(result);
-        assertEquals(inputBuilder, result);
-
-        path.clear();
-        path.add(outputQName);
-        result = BuilderUtils.findSchemaNode(path, rpcBuilder);
-        assertNotNull(result);
-        assertEquals(outputBuilder, result);
-
-        path.clear();
-        path.add(unknownNode);
-        result = BuilderUtils.findSchemaNode(path, rpcBuilder);
-        assertNotNull(result);
-        assertEquals(unknownNodeBuilder, result);
-
-        final QName leafQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "simple-leaf");
-        SchemaPath leafPath = SchemaPath.create(true, leafQName);
-
-        final LeafSchemaNodeBuilder leafBuilder = new LeafSchemaNodeBuilder(masterModule.getModuleName(), 10, leafQName, leafPath);
-        leafBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        path.clear();
-        path.add(unknownNode);
-        result = BuilderUtils.findSchemaNode(path, leafBuilder);
-        assertNotNull(result);
-        assertEquals(unknownNodeBuilder, result);
-    }
-
-    @Test
-    public void testFindUnknownSchemaNodeInModule() {
-        final String parentLocalName = "parent";
-        final QName containerQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), parentLocalName);
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-
-        final ContainerSchemaNodeBuilder containerBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 10,
-            containerQName, containerPath);
-
-        final String unknownLocalName = "unknown-ext-use";
-        final QName unknownNode = QName.create(masterModule.getNamespace(), masterModule.getRevision(), unknownLocalName);
-        final SchemaPath unknownNodePath = SchemaPath.create(true, containerQName, unknownNode);
-        UnknownSchemaNodeBuilderImpl unknownNodeBuilder = new UnknownSchemaNodeBuilderImpl(masterModule.getModuleName(),
-            22, unknownNode, unknownNodePath);
-        containerBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        masterModule.addChildNode(containerBuilder);
-
-        Optional<SchemaNodeBuilder> result = BuilderUtils.findSchemaNodeInModule(unknownNodePath, masterModule);
-
-        assertTrue(result.isPresent());
-        assertEquals(result.get(), unknownNodeBuilder);
-
-        final QName invalidUnknownNode = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "invalid-ext-use");
-        final SchemaPath invalidPath = SchemaPath.create(true, containerQName, invalidUnknownNode);
-
-        result = BuilderUtils.findSchemaNodeInModule(invalidPath, masterModule);
-        assertFalse(result.isPresent());
-    }
-
-    @Test
-    public void testFindContainerInRPC() {
-
-        final QName rpcQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "send-message");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcQName);
-        final RpcDefinitionBuilder rpcBuilder = masterModule.addRpc(45, rpcQName, rpcPath);
-
-        final QName inputQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "input");
-        final SchemaPath inputPath = SchemaPath.create(true, rpcQName, inputQName);
-
-        final QName outputQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "output");
-        final SchemaPath outputPath = SchemaPath.create(true, rpcQName, outputQName);
-
-        Optional<SchemaNodeBuilder> requestResult = BuilderUtils.findSchemaNodeInModule(inputPath, masterModule);
-        assertTrue(requestResult.isPresent());
-
-        Optional<SchemaNodeBuilder> responseResult = BuilderUtils.findSchemaNodeInModule(outputPath, masterModule);
-        assertTrue(responseResult.isPresent());
-
-        final ContainerSchemaNodeBuilder inputBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 46,
-            inputQName, inputPath);
-        final ContainerSchemaNodeBuilder outputBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 76,
-            outputQName, outputPath);
-
-        final QName request = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "request");
-        final SchemaPath requestPath = SchemaPath.create(true, rpcQName, inputQName, request);
-
-        final QName response = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "response");
-        final SchemaPath responsePath = SchemaPath.create(true, rpcQName, outputQName, response);
-
-        final ContainerSchemaNodeBuilder requestBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 50,
-            request, requestPath);
-        final ContainerSchemaNodeBuilder responseBuilder = new ContainerSchemaNodeBuilder(masterModule.getModuleName(), 80,
-            response, responsePath);
-
-        inputBuilder.addChildNode(requestBuilder);
-        outputBuilder.addChildNode(responseBuilder);
-
-        rpcBuilder.setInput(inputBuilder);
-        rpcBuilder.setOutput(outputBuilder);
-
-        requestResult = BuilderUtils.findSchemaNodeInModule(requestPath, masterModule);
-        assertTrue(requestResult.isPresent());
-
-        responseResult = BuilderUtils.findSchemaNodeInModule(responsePath, masterModule);
-        assertTrue(responseResult.isPresent());
-
-        final SchemaPath invalidPath = SchemaPath.create(true, rpcQName, response);
-        Optional<SchemaNodeBuilder> invalidResult = BuilderUtils.findSchemaNodeInModule(invalidPath, masterModule);
-        assertFalse(invalidResult.isPresent());
-    }
-
-    @Test
-    public void testFindIdentity() {
-        assertNull(BuilderUtils.findIdentity(Collections.emptySet(), "test-identity"));
-    }
-
-    @Test
-    public void testGetModuleByPrefix() {
-        assertEquals(BuilderUtils.getModuleByPrefix(masterModule, null), masterModule);
-        assertEquals(BuilderUtils.getModuleByPrefix(masterModule, ""), masterModule);
-        assertEquals(BuilderUtils.getModuleByPrefix(masterModule, masterModule.getPrefix()), masterModule);
-    }
-
-    @Test
-    public void testFindModule() {
-        final Map<URI, NavigableMap<Date, ModuleBuilder>> modules = new HashMap<>(1);
-        final NavigableMap<Date, ModuleBuilder> masterModuleMap = new TreeMap<>();
-        masterModuleMap.put(masterModule.getRevision(), masterModule);
-        modules.put(masterModule.getNamespace(), masterModuleMap);
-
-        assertNull(BuilderUtils.findModule(QName.create("test-urn:namespace", "2014-10-08", "impossible-module"), modules));
-
-        assertEquals(BuilderUtils.findModule(QName.create(masterModule.getNamespace(), null, masterModule.getName()), modules),
-            masterModule);
-    }
-
-    @Test
-    public void testFindBaseIdentity() {
-        assertNull(BuilderUtils.findBaseIdentity(masterModule, "prefix:ident", 27));
-
-        final QName identity = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "ident");
-        masterModule.addIdentity(identity, 22, SchemaPath.create(true, identity));
-
-        final IdentitySchemaNodeBuilder result = BuilderUtils
-            .findBaseIdentity(masterModule, masterModule.getPrefix() + ":ident", 22);
-        assertNotNull(result);
-        assertEquals(result.getQName(), identity);
-    }
-
-    @Test
-    public void testWrapChildNode() {
-        final QName leafQName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "parent-leaf");
-        final SchemaPath leafPath = SchemaPath.create(true, leafQName);
-        final LeafListSchemaNodeBuilder leafListBuilder = new LeafListSchemaNodeBuilder(masterModule.getModuleName(),
-            27, leafQName, leafPath);
-        leafListBuilder.setType(Uint16.getInstance());
-
-        final LeafListSchemaNode leafList = leafListBuilder.build();
-
-        DataSchemaNodeBuilder wrapedLeafList = BuilderUtils
-            .wrapChildNode(masterModule.getModuleName(), 72, leafList, leafPath, leafQName);
-
-        assertNotNull(wrapedLeafList);
-        assertEquals(wrapedLeafList.getQName(), leafList.getQName());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void wrapChildNodeForUnknownNode() {
-        final QName qName = QName.create(masterModule.getNamespace(), masterModule.getRevision(), "name");
-        final SchemaPath path = SchemaPath.create(true, qName);
-
-        BuilderUtils
-            .wrapChildNode(masterModule.getModuleName(), 72, new NotExistingDataSchemaNodeImpl(), path, qName);
-    }
-
-    private static class NotExistingDataSchemaNodeImpl implements DataSchemaNode {
-
-        @Override public boolean isAugmenting() {
-            return false;
-        }
-
-        @Override public boolean isAddedByUses() {
-            return false;
-        }
-
-        @Override public boolean isConfiguration() {
-            return false;
-        }
-
-        @Override public ConstraintDefinition getConstraints() {
-            return null;
-        }
-
-        @Override public QName getQName() {
-            return null;
-        }
-
-        @Override public SchemaPath getPath() {
-            return null;
-        }
-
-        @Override public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-            return null;
-        }
-
-        @Override public String getDescription() {
-            return null;
-        }
-
-        @Override public String getReference() {
-            return null;
-        }
-
-        @Override public Status getStatus() {
-            return null;
-        }
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/CopyUtilsTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/CopyUtilsTest.java
deleted file mode 100644 (file)
index 5edc747..0000000
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import java.util.List;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.util.Uint16;
-import org.opendaylight.yangtools.yang.parser.builder.api.AugmentationSchemaBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.ConstraintsBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.SchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UsesNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Test suite for increasing of test coverage of CopyUtils implementation.
- *
- * @see org.opendaylight.yangtools.yang.parser.builder.impl.CopyUtils
- *
- * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class CopyUtilsTest extends AbstractBuilderTest {
-
-    @Test(expected = YangParseException.class)
-    public void testCopyOfUnknownTypeOfDataSchemaNode() {
-        final String leafLocalName = "leaf-to-refine";
-        final QName leafName = QName.create(module.getNamespace(), module.getRevision(), leafLocalName);
-        final SchemaPath leafPath = SchemaPath.create(true, leafName);
-        final LeafSchemaNodeBuilder leafBuilder = new LeafSchemaNodeBuilder(module.getModuleName(), 22, leafName, leafPath);
-
-        CopyUtils.copy(new InvalidDataSchemaNodeBuilder(), leafBuilder, false);
-    }
-
-    @Test
-    public void testCopyAnyxmlWithAnyxmlOriginalNodeAndUnknownNodes() {
-        final String parentAnyxmlLocalName = "original-anyxml";
-        final QName parentAnyxmlName = QName.create(module.getNamespace(), module.getRevision(), parentAnyxmlLocalName);
-        final SchemaPath parentAnyxmlPath = SchemaPath.create(true, parentAnyxmlName);
-        final AnyXmlBuilder parentAnyXmlBuilder = new AnyXmlBuilder(module.getModuleName(), 22, parentAnyxmlName, parentAnyxmlPath);
-
-        final String anyxmlLocalName = "anyxml";
-        final QName anyxmlName = QName.create(module.getNamespace(), module.getRevision(), anyxmlLocalName);
-        final SchemaPath anyxmlPath = SchemaPath.create(true, anyxmlName);
-        final AnyXmlBuilder anyXmlBuilder = new AnyXmlBuilder(module.getModuleName(), 22, anyxmlName, anyxmlPath);
-
-        anyXmlBuilder.setOriginal(parentAnyXmlBuilder);
-
-        final UnknownSchemaNodeBuilder unknownSchemaNodeBuilder = provideUnknownNodeBuilder(anyxmlName);
-        anyXmlBuilder.addUnknownNodeBuilder(unknownSchemaNodeBuilder);
-
-        final AnyXmlBuilder copy = (AnyXmlBuilder) CopyUtils.copy(anyXmlBuilder, anyXmlBuilder, false);
-        assertFalse(copy.getUnknownNodes().isEmpty());
-        assertNotNull(copy.getOriginal());
-        assertEquals(copy.getOriginal(), parentAnyXmlBuilder);
-    }
-
-    @Test
-    public void testCopyChoiceBuilderWithUnknownNodesAndAugmentation() {
-        final String originalChoiceLocalName = "original-choice-to-copy";
-        final ChoiceBuilder originalChoiceBuilder = provideChoiceBuilder(originalChoiceLocalName);
-
-        final String choiceLocalName = "choice-to-copy";
-        final ChoiceBuilder choiceBuilder = provideChoiceBuilder(choiceLocalName);
-        choiceBuilder.setOriginal(originalChoiceBuilder);
-
-        final UnknownSchemaNodeBuilder unknownSchemaNodeBuilder = provideUnknownNodeBuilder(choiceBuilder.getQName());
-        final SchemaPath augPath = SchemaPath.create(true, choiceBuilder.getQName());
-
-        final AugmentationSchemaBuilder augBuilder = new AugmentationSchemaBuilderImpl(module.getModuleName(), 22,
-            "/imaginary/path", augPath, 0);
-
-        final UsesNodeBuilder usesNodeBuilder = provideUsesNodeBuilder("test-grouping-use");
-            augBuilder.addUsesNode(usesNodeBuilder);
-        augBuilder.addUnknownNodeBuilder(unknownSchemaNodeBuilder);
-
-        choiceBuilder.addUnknownNodeBuilder(unknownSchemaNodeBuilder);
-        choiceBuilder.addAugmentation(augBuilder);
-
-        final ChoiceBuilder copy = (ChoiceBuilder)CopyUtils.copy(choiceBuilder, module, false);
-        List<AugmentationSchemaBuilder> augmentations = copy.getAugmentationBuilders();
-
-        assertFalse(copy.getUnknownNodes().isEmpty());
-
-        final UnknownSchemaNodeBuilder copyUnknownNode = copy.getUnknownNodes().get(0);
-        assertEquals(copyUnknownNode, unknownSchemaNodeBuilder);
-
-        assertFalse(augmentations.isEmpty());
-        final AugmentationSchemaBuilder copyAugBuilder = augmentations.get(0);
-
-        assertEquals(copyAugBuilder, augBuilder);
-        assertEquals(copyAugBuilder.getUnknownNodes().get(0), augBuilder.getUnknownNodes().get(0));
-        assertNotEquals(copyAugBuilder.getUsesNodeBuilders().get(0), augBuilder.getUsesNodeBuilders().get(0));
-    }
-
-    @Test
-    public void testCopyChoiceCaseBuilder() {
-        final String originalChoiceCaseLocalName = "original-choice-case";
-        final QName originalChoiceCaseQName = QName.create(module.getNamespace(), module.getRevision(),
-            originalChoiceCaseLocalName);
-        final SchemaPath originalChoiceCasePath = SchemaPath.create(true, originalChoiceCaseQName);
-        final ChoiceCaseBuilder originalChoiceCaseBuilder = new ChoiceCaseBuilder(module.getModuleName(), 10,
-            originalChoiceCaseQName, originalChoiceCasePath);
-
-        final String choiceCaseLocalName = "test-choice-case";
-        final QName choiceCaseQName = QName.create(module.getNamespace(), module.getRevision(), choiceCaseLocalName);
-        final SchemaPath choiceCasePath = SchemaPath.create(true, choiceCaseQName);
-        final ChoiceCaseBuilder choiceCaseBuilder = new ChoiceCaseBuilder(module.getModuleName(), 10, choiceCaseQName,
-            choiceCasePath);
-
-        choiceCaseBuilder.setOriginal(originalChoiceCaseBuilder);
-
-        final UsesNodeBuilder usesNodeBuilder = provideUsesNodeBuilder("test-grouping-use");
-
-        UnknownSchemaNodeBuilder unknownSchemaNodeBuilder = provideUnknownNodeBuilder(choiceCaseQName);
-
-        choiceCaseBuilder.addUsesNode(usesNodeBuilder);
-        choiceCaseBuilder.addUnknownNodeBuilder(unknownSchemaNodeBuilder);
-
-        ChoiceCaseBuilder copy = (ChoiceCaseBuilder) CopyUtils.copy(choiceCaseBuilder, module, true);
-
-        assertNotNull(copy);
-        assertEquals(copy.getUnknownNodes().get(0), choiceCaseBuilder.getUnknownNodes().get(0));
-        assertFalse(copy.getUsesNodeBuilders().isEmpty());
-        assertNotEquals(copy.getUsesNodeBuilders().get(0), choiceCaseBuilder.getUsesNodeBuilders().get(0));
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddGroupingIntoChoiceCaseBuilder() {
-        final String choiceCaseLocalName = "test-choice-case";
-        final QName choiceCaseQName = QName.create(module.getNamespace(), module.getRevision(), choiceCaseLocalName);
-        final SchemaPath choiceCasePath = SchemaPath.create(true, choiceCaseQName);
-        final ChoiceCaseBuilder choiceCaseBuilder = new ChoiceCaseBuilder(module.getModuleName(), 10, choiceCaseQName,
-            choiceCasePath);
-
-        final String groupLocalName = "test-group";
-        final QName testGroup = QName.create(module.getNamespace(), module.getRevision(), groupLocalName);
-        final SchemaPath groupPath = SchemaPath.create(true, choiceCaseQName, testGroup);
-        final GroupingBuilder grouping = module.addGrouping(12, testGroup, groupPath);
-        choiceCaseBuilder.addGrouping(grouping);
-    }
-
-    @Test
-    public void testCopyContainerSchemaNodeBuilder() {
-        final ContainerSchemaNodeBuilder containerBuilder = provideContainerBuilder("parent-container");
-
-        final String groupLocalName = "test-group";
-        final GroupingBuilder grouping = provideNestedGroupingDefinition(containerBuilder.getQName(), groupLocalName);
-
-        final String typedefLocalName = "test-type-definition";
-        final TypeDefinitionBuilder typedefBuilder = provideNestedTypedef(containerBuilder.getQName(), typedefLocalName);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder(containerBuilder.getQName());
-
-        containerBuilder.addGrouping(grouping);
-        containerBuilder.addTypedef(typedefBuilder);
-        containerBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        final ContainerSchemaNodeBuilder copy = (ContainerSchemaNodeBuilder) CopyUtils.copy(containerBuilder, module, true);
-
-        assertNotNull(copy);
-
-        assertFalse(copy.getGroupingBuilders().isEmpty());
-        assertFalse(copy.getTypeDefinitionBuilders().isEmpty());
-        assertFalse(copy.getUnknownNodes().isEmpty());
-    }
-
-    private GroupingBuilder provideNestedGroupingDefinition(final QName parentName, final String groupLocalName) {
-        final QName testGroup = QName.create(module.getNamespace(), module.getRevision(), groupLocalName);
-        final SchemaPath groupPath = SchemaPath.create(true, parentName, testGroup);
-        final GroupingBuilder grouping = module.addGrouping(12, testGroup, groupPath);
-
-        return grouping;
-    }
-
-    private TypeDefinitionBuilder provideNestedTypedef(final QName parentName, final String typedefLocalName) {
-        final QName typedefQname = QName.create(module.getNamespace(), module.getRevision(), typedefLocalName);
-        final SchemaPath typedefPath = SchemaPath.create(true, parentName, typedefQname);
-        final TypeDefinitionBuilder typedefBuilder = new TypeDefinitionBuilderImpl(module.getModuleName(), 12,
-            typedefQname, typedefPath);
-        typedefBuilder.setType(Uint16.getInstance());
-
-        return typedefBuilder;
-    }
-
-    @Test
-    public void testCopyLeafSchemaNodeBuilder() {
-        final String leafLocalName = "original-leaf";
-        final QName leafName = QName.create(module.getNamespace(), module.getRevision(), leafLocalName);
-        final SchemaPath leafPath = SchemaPath.create(true, leafName);
-        final LeafSchemaNodeBuilder leafBuilder = new LeafSchemaNodeBuilder(module.getModuleName(), 22, leafName, leafPath);
-        leafBuilder.setType(Uint16.getInstance());
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder(leafName);
-        leafBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        final LeafSchemaNodeBuilder copy = (LeafSchemaNodeBuilder)CopyUtils.copy(leafBuilder, module, true);
-
-        assertNotNull(copy);
-        assertFalse(leafBuilder.getUnknownNodes().isEmpty());
-    }
-
-    @Test
-    public void testCopyLeafListSchemaNodeBuilder() {
-        final String origLeafListLocalName = "original-list-to";
-        final QName origLeafListQName = QName.create(module.getNamespace(), module.getRevision(), origLeafListLocalName );
-        final SchemaPath origLeafListPath = SchemaPath.create(true, origLeafListQName);
-        final LeafListSchemaNodeBuilder origLeafListBuilder = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            10, origLeafListQName, origLeafListPath);
-        origLeafListBuilder.setType(Uint16.getInstance());
-
-        final String leafListLocalName = "leaflist-copy";
-        final QName leafListQName = QName.create(module.getNamespace(), module.getRevision(), leafListLocalName);
-        final SchemaPath leafListPath = SchemaPath.create(true, leafListQName);
-        final LeafListSchemaNodeBuilder leafListBuilder = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            20, leafListQName, leafListPath);
-        leafListBuilder.setType(Uint16.getInstance());
-
-        leafListBuilder.setOriginal(origLeafListBuilder);
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder(leafListQName);
-        leafListBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        final LeafListSchemaNodeBuilder copy = (LeafListSchemaNodeBuilder)CopyUtils.copy(leafListBuilder, module, true);
-
-        assertNotNull(copy);
-        assertFalse(copy.getUnknownNodes().isEmpty());
-        assertNotNull(copy.getUnknownNodes().get(0));
-    }
-
-    @Test
-    public void testCopyListSchemaNodeBuilder() {
-        final String origListLocalName = "original-list";
-        final QName origListQName = QName.create(module.getNamespace(), module.getRevision(), origListLocalName);
-        final SchemaPath origListPath = SchemaPath.create(true, origListQName);
-        final ListSchemaNodeBuilder origListBuilder = new ListSchemaNodeBuilder(module.getModuleName(),
-            10, origListQName, origListPath);
-
-        final String listLocalName = "copy-of-list";
-        final QName listQName = QName.create(module.getNamespace(), module.getRevision(), listLocalName);
-        final SchemaPath listPath = SchemaPath.create(true, listQName);
-        final ListSchemaNodeBuilder listBuilder = new ListSchemaNodeBuilder(module.getModuleName(),
-            20, listQName, listPath);
-
-        listBuilder.setOriginal(origListBuilder);
-
-        final String groupLocalName = "test-group";
-        final GroupingBuilder grouping = provideNestedGroupingDefinition(listBuilder.getQName(), groupLocalName);
-        listBuilder.addGrouping(grouping);
-
-        final String typedefLocalName = "test-type-definition";
-        final TypeDefinitionBuilder typedefBuilder = provideNestedTypedef(listBuilder.getQName(), typedefLocalName);
-        listBuilder.addTypedef(typedefBuilder);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder(listBuilder.getQName());
-        listBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        final UsesNodeBuilder usesNodeBuilder = provideUsesNodeBuilder("test-grouping-use");
-        listBuilder.addUsesNode(usesNodeBuilder);
-
-        final SchemaPath augPath = SchemaPath.create(true, listBuilder.getQName());
-        final AugmentationSchemaBuilder augBuilder = new AugmentationSchemaBuilderImpl(module.getModuleName(), 22,
-            "/imaginary/path", augPath, 0);
-        listBuilder.addAugmentation(augBuilder);
-
-        ListSchemaNodeBuilder copy = (ListSchemaNodeBuilder) CopyUtils.copy(listBuilder, module, true);
-        assertNotNull(copy);
-        assertFalse(copy.getGroupingBuilders().isEmpty());
-        assertFalse(copy.getTypeDefinitionBuilders().isEmpty());
-        assertFalse(copy.getUnknownNodes().isEmpty());
-        assertFalse(copy.getUsesNodeBuilders().isEmpty());
-        assertFalse(copy.getAugmentationBuilders().isEmpty());
-    }
-
-    @Test
-    public void testCopyGroupingBuilder() {
-        final String groupLocalName = "test-group";
-        final QName testGroup = QName.create(module.getNamespace(), module.getRevision(), groupLocalName);
-        final SchemaPath groupPath = SchemaPath.create(true, testGroup);
-        final GroupingBuilder grouping = module.addGrouping(12, testGroup, groupPath);
-
-        final String innerGroupLocalName = "inner-group";
-        final QName innerGroup = QName.create(module.getNamespace(), module.getRevision(), innerGroupLocalName);
-        final SchemaPath innerGroupPath = SchemaPath.create(true, testGroup, innerGroup);
-        final GroupingBuilder innerGrouping = module.addGrouping(12, innerGroup, innerGroupPath);
-
-        grouping.addGrouping(innerGrouping);
-
-        final String typedefLocalName = "test-type-definition";
-        final TypeDefinitionBuilder typedefBuilder = provideNestedTypedef(grouping.getQName(), typedefLocalName);
-        grouping.addTypedef(typedefBuilder);
-
-        final UsesNodeBuilder usesNodeBuilder = provideUsesNodeBuilder(innerGroupLocalName);
-        grouping.addUsesNode(usesNodeBuilder);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder(grouping.getQName());
-        grouping.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        final GroupingBuilder copy = CopyUtils.copy(grouping, module, true);
-        assertNotNull(copy);
-        assertFalse(copy.getGroupingBuilders().isEmpty());
-        assertFalse(copy.getTypeDefinitionBuilders().isEmpty());
-        assertFalse(copy.getUsesNodeBuilders().isEmpty());
-        assertFalse(copy.getUnknownNodes().isEmpty());
-    }
-
-    @Test
-    public void testCopyIdentityrefTypeBuilder() {
-        final String typedefLocalName = "identity-ref-test-type";
-        final QName typedefQname = QName.create(module.getNamespace(), module.getRevision(), typedefLocalName);
-        final SchemaPath typedefPath = SchemaPath.create(true, typedefQname);
-        final IdentityrefTypeBuilder typeBuilder = new IdentityrefTypeBuilder(module.getModuleName(), 12,
-            "base:parent-identity", typedefPath);
-
-        final TypeDefinitionBuilder copy = CopyUtils.copy(typeBuilder, module, true);
-        assertNotNull(copy);
-
-        //TODO: add additional asserts
-    }
-
-    @Test
-    public void testCopyTypeDefinitionBuilderWithUnknownNodes() {
-        final String typedefLocalName = "test-typedef-with-ext";
-        final QName typedefQname = QName.create(module.getNamespace(), module.getRevision(), typedefLocalName);
-        final SchemaPath typedefPath = SchemaPath.create(true, typedefQname);
-        final TypeDefinitionBuilder typedefBuilder = new TypeDefinitionBuilderImpl(module.getModuleName(), 12,
-            typedefQname, typedefPath);
-        typedefBuilder.setType(Uint16.getInstance());
-
-        typedefBuilder.addUnknownNodeBuilder(provideUnknownNodeBuilder());
-
-        TypeDefinitionBuilder copy = CopyUtils.copy(typedefBuilder, module, true);
-        assertNotNull(copy);
-        assertFalse(copy.getUnknownNodes().isEmpty());
-    }
-
-    // FIXME: Use Mockito instead of this monstrosity
-    private static final class InvalidDataSchemaNodeBuilder implements DataSchemaNodeBuilder {
-
-        @Override
-        public SchemaNodeBuilder getOriginal() {
-            return null;
-        }
-
-        @Override
-        public void setOriginal(final SchemaNodeBuilder original) {
-
-        }
-
-        @Override
-        public boolean isAugmenting() {
-            return false;
-        }
-
-        @Override
-        public void setAugmenting(final boolean augmenting) {
-
-        }
-
-        @Override
-        public boolean isConfiguration() {
-            return false;
-        }
-
-        @Override
-        public void setConfiguration(final boolean config) {
-
-        }
-
-        @Override
-        public ConstraintsBuilder getConstraints() {
-            return null;
-        }
-
-        @Override
-        public QName getQName() {
-            return null;
-        }
-
-        @Override
-        public SchemaPath getPath() {
-            return null;
-        }
-
-        @Override
-        public void setPath(final SchemaPath path) {
-
-        }
-
-        @Override
-        public String getModuleName() {
-            return null;
-        }
-
-        @Override
-        public int getLine() {
-            return 0;
-        }
-
-        @Override
-        public Builder getParent() {
-            return null;
-        }
-
-        @Override
-        public void setParent(final Builder parent) {
-
-        }
-
-        @Override
-        public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
-
-        }
-
-        @Override
-        public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-            return null;
-        }
-
-        @Override
-        public DataSchemaNode build() {
-            return null;
-        }
-
-        @Override
-        public String getDescription() {
-            return null;
-        }
-
-        @Override
-        public void setDescription(final String description) {
-
-        }
-
-        @Override
-        public String getReference() {
-            return null;
-        }
-
-        @Override
-        public void setReference(final String reference) {
-
-        }
-
-        @Override
-        public Status getStatus() {
-            return null;
-        }
-
-        @Override
-        public void setStatus(final Status status) {
-
-        }
-
-        @Override
-        public boolean isAddedByUses() {
-            return false;
-        }
-
-        @Override
-        public void setAddedByUses(final boolean addedByUses) {
-
-        }
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeBuilderTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/LeafListSchemaNodeBuilderTest.java
deleted file mode 100644 (file)
index 54d511b..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.util.Uint16;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-
-/**
- * Test suite for increasing of test coverage of LeafListSchemaNodeBuilder implementation.
- *
- * @see org.opendaylight.yangtools.yang.parser.builder.impl.LeafListSchemaNodeBuilder
- *
- * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class LeafListSchemaNodeBuilderTest extends AbstractBuilderTest {
-
-    @Test
-    public void testLeafListSchemaNodeBuilderWithBaseLeafListSchemaNode() {
-        final String baseLeafListLocalName = "base-leaf-list";
-        final QName baseLeafListQName = QName.create(module.getNamespace(), module.getRevision(), baseLeafListLocalName);
-        final SchemaPath baseLeafListPath = SchemaPath.create(true, baseLeafListQName);
-        final LeafListSchemaNodeBuilder baseLeafListBuilder = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            10, baseLeafListQName, baseLeafListPath);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder();
-
-        baseLeafListBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-        baseLeafListBuilder.setType(Uint16.getInstance());
-        final LeafListSchemaNode leafList = baseLeafListBuilder.build();
-
-        assertNotNull(leafList);
-        assertFalse(leafList.getUnknownSchemaNodes().isEmpty());
-        assertEquals(leafList.getUnknownSchemaNodes().size(), 1);
-
-        final String leafListLocalName = "extended-leaf-list";
-        final QName leafListQName = QName.create(module.getNamespace(), module.getRevision(), leafListLocalName);
-        final SchemaPath leafListPath = SchemaPath.create(true, leafListQName);
-        final LeafListSchemaNodeBuilder leafListBuilder = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            15, leafListQName, leafListPath, leafList);
-
-        final LeafListSchemaNode extendedLeafList = leafListBuilder.build();
-
-        assertNotNull(extendedLeafList);
-        assertFalse(extendedLeafList.getUnknownSchemaNodes().isEmpty());
-        assertEquals(extendedLeafList.getUnknownSchemaNodes().size(), 1);
-
-        assertNotEquals(leafList, extendedLeafList);
-
-        assertTrue(extendedLeafList instanceof DerivableSchemaNode);
-        assertTrue(((DerivableSchemaNode) extendedLeafList).getOriginal().isPresent());
-        assertEquals(leafList, ((DerivableSchemaNode) extendedLeafList).getOriginal().get());
-    }
-
-    @Test
-    public void testEquals() {
-        final String baseLeafListLocalName = "leaf-list1";
-        final QName baseLeafListQName = QName.create(module.getNamespace(), module.getRevision(), baseLeafListLocalName);
-        final SchemaPath baseLeafListPath = SchemaPath.create(true, baseLeafListQName);
-        final LeafListSchemaNodeBuilder baseLeafListBuilder = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            10, baseLeafListQName, baseLeafListPath);
-
-        baseLeafListBuilder.setType(Uint16.getInstance());
-        final LeafListSchemaNode leafList = baseLeafListBuilder.build();
-
-        final String leafListLocalName = "leaf-list2";
-        final QName leafListQName2 = QName.create(module.getNamespace(), module.getRevision(), leafListLocalName);
-        final SchemaPath leafListPath2 = SchemaPath.create(true, leafListQName2);
-        final LeafListSchemaNodeBuilder leafListBuilder2 = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            10, leafListQName2, leafListPath2);
-
-        leafListBuilder2.setType(Uint16.getInstance());
-        final LeafListSchemaNode leafList2 = leafListBuilder2.build();
-
-        assertNotEquals(baseLeafListBuilder, null);
-        assertNotEquals(baseLeafListBuilder, leafListBuilder2);
-
-        assertNotEquals(leafList, null);
-        assertNotEquals(leafList, leafList2);
-
-        final QName containerQName = QName.create(module.getNamespace(), module.getRevision(), "parent-container");
-        final String leafListLocalName3 = "leaf-list2";
-        final QName leafListQName3 = QName.create(module.getNamespace(), module.getRevision(), leafListLocalName3);
-        final SchemaPath leafListPath3 = SchemaPath.create(true, containerQName, leafListQName3);
-        final LeafListSchemaNodeBuilder leafListBuilder3 = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            10, leafListQName3, leafListPath3);
-
-        baseLeafListBuilder.setType(Uint16.getInstance());
-        final LeafListSchemaNode leafList3 = baseLeafListBuilder.build();
-
-        assertNotEquals(leafListBuilder2, leafListBuilder3);
-        assertNotEquals(leafList3, leafList2);
-    }
-
-    @Test
-    public void testLeafListSchemaNodeImplProperties() {
-        final String descString = "my leaf list description";
-        final String leafListLocalName = "base-leaf-list";
-        final QName leafListQName = QName.create(module.getNamespace(), module.getRevision(), leafListLocalName);
-        final SchemaPath leafListPath = SchemaPath.create(true, leafListQName);
-        final LeafListSchemaNodeBuilder leafListBuilder = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            10, leafListQName, leafListPath);
-
-        leafListBuilder.setType(Uint16.getInstance());
-        leafListBuilder.setDescription(descString);
-        final LeafListSchemaNode leafList = leafListBuilder.build();
-
-        assertEquals(leafList.getQName(), leafListQName);
-        assertEquals(leafList.getDescription(), descString);
-        assertEquals(leafList.getStatus(), Status.CURRENT);
-        assertEquals(leafList.getPath(), leafListPath);
-        assertEquals(leafList.getType(), Uint16.getInstance());
-        assertNull(leafList.getReference());
-
-        assertEquals("LeafListSchemaNodeImpl[(urn:opendaylight.rpc:def:test-model?revision=2014-01-06)base-leaf-list]",
-            leafList.toString());
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleBuilderTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/ModuleBuilderTest.java
deleted file mode 100644 (file)
index 07360be..0000000
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import java.net.URI;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.util.Uint16;
-import org.opendaylight.yangtools.yang.parser.builder.api.Builder;
-import org.opendaylight.yangtools.yang.parser.builder.api.DataSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Test suite for increasing of test coverage of ModuleBuilder implementation.
- *
- * @see org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder
- *
- * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class ModuleBuilderTest {
-
-    private final static String TEST_MODULE_NAMESPACE = "urn:opendaylight.foo";
-    private final static String TEST_MODULE_REVISION = "2014-09-22";
-    private final static String MODULE_NAME = "TestModule";
-    private static final String TEST_MODULE_PATH = "/test/module/path";
-
-    private ModuleBuilder moduleBuilder;
-
-    @Before
-    public void setUp() throws Exception {
-        moduleBuilder = new ModuleBuilder(MODULE_NAME , TEST_MODULE_PATH);
-    }
-
-    @Test
-    public void testGetSetModuleBuilderMethods() throws Exception {
-        assertEquals("module", moduleBuilder.getStatementName());
-        assertEquals(TEST_MODULE_PATH, moduleBuilder.getModuleSourcePath());
-        assertNotNull(moduleBuilder.getAllLists());
-        final URI namespace = URI.create(TEST_MODULE_NAMESPACE + "?" + TEST_MODULE_REVISION);
-        moduleBuilder.setNamespace(namespace);
-        assertEquals(namespace, moduleBuilder.getNamespace());
-        moduleBuilder.setBelongsTo("TEST_SUBMODULE");
-        assertEquals("TEST_SUBMODULE", moduleBuilder.getBelongsTo());
-        final Date revision = new SimpleDateFormat("yyyy-dd-mm").parse(TEST_MODULE_REVISION);
-        moduleBuilder.setRevision(revision);
-        assertEquals(revision, moduleBuilder.getRevision());
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testCheckPrefixFailOnPrefixNull() {
-        moduleBuilder.addModuleImport("TEST_MODULE", null, null);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testCheckPrefixFailOnPrefixStringIsEmpty() {
-        moduleBuilder.addModuleImport("TEST_MODULE", null, "");
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testCheckPrefixFailOnPrefixEqualsModuleBuilderPrefix() {
-        moduleBuilder.setPrefix("prefix");
-        moduleBuilder.addModuleImport("TEST_MODULE", null, "prefix");
-    }
-
-    @Test
-    public void testGetActualNodeNullResult() {
-        moduleBuilder.exitNode();
-        assertNull(moduleBuilder.getActualNode());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testSetParent() throws Exception {
-        moduleBuilder.setParent(new Builder() {
-            @Override
-            public String getModuleName() {
-                return null;
-            }
-
-            @Override
-            public int getLine() {
-                return 0;
-            }
-
-            @Override
-            public Builder getParent() {
-                return null;
-            }
-
-            @Override
-            public void setParent(final Builder parent) {
-
-            }
-
-            @Override
-            public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
-
-            }
-
-            @Override
-            public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-                return null;
-            }
-
-            @Override
-            public Object build() {
-                return null;
-            }
-        });
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddExtensionWhereParentNodeIsNotModuleBuilder() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-        final QName extQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-ext");
-        SchemaPath extPath = SchemaPath.create(true, containerQName, extQName);
-        moduleBuilder.addExtension(extQName, 12, extPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddExtensionWhereNameOfExtensionCollides() throws Exception {
-        final QName extQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-ext");
-        SchemaPath extPath = SchemaPath.create(true, extQName);
-        moduleBuilder.addExtension(extQName, 12, extPath);
-
-        final QName extQName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-ext");
-        moduleBuilder.addExtension(extQName2, 22, extPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateGroupingIntoModule() {
-        final QName testGroup1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath1 = SchemaPath.create(true, testGroup1);
-
-        final QName testGroup2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath2 = SchemaPath.create(true, testGroup2);
-
-        moduleBuilder.addGrouping(12, testGroup1, groupPath1);
-        moduleBuilder.addGrouping(12, testGroup2, groupPath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateGroupingIntoDataNodeContainer() {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-        final QName testGroup1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath1 = SchemaPath.create(true, containerQName, testGroup1);
-
-        final QName testGroup2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath2 = SchemaPath.create(true, containerQName, testGroup2);
-
-        moduleBuilder.addGrouping(12, testGroup1, groupPath1);
-        moduleBuilder.addGrouping(22, testGroup2, groupPath2);
-    }
-
-    @Test
-    public void testAddTwoGroupingIntoDataNodeContainer() {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-        final QName testGroup1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath1 = SchemaPath.create(true, containerQName, testGroup1);
-
-        final QName testGroup2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group2");
-        final SchemaPath groupPath2 = SchemaPath.create(true, containerQName, testGroup2);
-
-        GroupingBuilder grouping1 = moduleBuilder.addGrouping(12, testGroup1, groupPath1);
-        GroupingBuilder grouping2 = moduleBuilder.addGrouping(22, testGroup2, groupPath2);
-
-        assertNotNull(grouping1);
-        assertNotNull(grouping2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateGroupingIntoRpcDefinition() {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.enterNode(new RpcDefinitionBuilder(MODULE_NAME, 10, rpcDefName, rpcPath));
-        final QName testGroup1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath1 = SchemaPath.create(true, rpcDefName, testGroup1);
-
-        final QName testGroup2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath2 = SchemaPath.create(true, rpcDefName, testGroup2);
-
-        moduleBuilder.addGrouping(12, testGroup1, groupPath1);
-        moduleBuilder.addGrouping(22, testGroup2, groupPath2);
-    }
-
-    @Test
-    public void testAddTwoGroupingsIntoRpcDefinition() {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.enterNode(new RpcDefinitionBuilder(MODULE_NAME, 10, rpcDefName, rpcPath));
-        final QName testGroup1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath1 = SchemaPath.create(true, rpcDefName, testGroup1);
-
-        final QName testGroup2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group2");
-        final SchemaPath groupPath2 = SchemaPath.create(true, rpcDefName, testGroup2);
-
-        GroupingBuilder grouping1 = moduleBuilder.addGrouping(12, testGroup1, groupPath1);
-        GroupingBuilder grouping2 = moduleBuilder.addGrouping(22, testGroup2, groupPath2);
-
-        assertNotNull(grouping1);
-        assertNotNull(grouping2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddGroupingIntoNonValidStatementDefinition() {
-        final QName leafListDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-leaflist");
-        SchemaPath leaflistPath = SchemaPath.create(true, leafListDefName);
-        moduleBuilder.enterNode(new LeafListSchemaNodeBuilder(MODULE_NAME, 10, leafListDefName, leaflistPath));
-        final QName testGroup = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath = SchemaPath.create(true, leafListDefName, testGroup);
-
-        moduleBuilder.addGrouping(12, testGroup, groupPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testInvalidAugmentPathTargetString() {
-        final QName targetSchemaName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "fictive-target-container");
-        moduleBuilder.addAugment(12, "something/something", SchemaPath.create(true, targetSchemaName), 0);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testInvalidAugmentPathTargetStringInUsesNode() {
-        final QName usesNode = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "fictive-uses-node");
-        SchemaPath targetPath = SchemaPath.create(true, usesNode);
-        moduleBuilder.enterNode(new UsesNodeBuilderImpl(MODULE_NAME, 10, targetPath));
-        final QName targetSchemaName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "fictive-target-container");
-        moduleBuilder.addAugment(12, "/something/something", SchemaPath.create(true, targetSchemaName), 0);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testInvalidAugmentDefinition() {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName targetSchemaName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "fictive-target-container");
-        moduleBuilder.addAugment(12, "/something/something", SchemaPath.create(true, targetSchemaName), 0);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testInvalidUsesNodeUse() {
-        final QName leafListDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-leaflist");
-        SchemaPath leaflistPath = SchemaPath.create(true, leafListDefName);
-        moduleBuilder.enterNode(new LeafListSchemaNodeBuilder(MODULE_NAME, 10, leafListDefName, leaflistPath));
-
-        final QName testGroup = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-group");
-        final SchemaPath groupPath = SchemaPath.create(true, testGroup);
-
-        moduleBuilder.addUsesNode(17, groupPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddRefineToNonUsesNodeBuilder() throws Exception {
-        final QName leafListDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-leaflist");
-        SchemaPath leaflistPath = SchemaPath.create(true, leafListDefName);
-        moduleBuilder.enterNode(new LeafListSchemaNodeBuilder(MODULE_NAME, 10, leafListDefName, leaflistPath));
-
-        moduleBuilder.addRefine(new RefineHolderImpl(MODULE_NAME, 12, "testRefineName"));
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddRpcToNonModuleBuilder() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-
-        moduleBuilder.addRpc(17, rpcDefName, rpcPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddRpcWithSameNameAsAlreadyExistingDataNodeContainer() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "element-foo");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.addContainerNode(10, containerQName, containerPath);
-
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "element-foo");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.addRpc(17, rpcDefName, rpcPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateRpc() throws Exception {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.addRpc(17, rpcDefName, rpcPath);
-
-        final QName rpcDefName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        SchemaPath rpcPath2 = SchemaPath.create(true, rpcDefName2);
-        moduleBuilder.addRpc(23, rpcDefName2, rpcPath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddRpcWithSameNameAsAlreadyDefinedNotification() throws Exception {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.addNotification(17, rpcDefName, rpcPath);
-
-        final QName rpcDefName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        SchemaPath rpcPath2 = SchemaPath.create(true, rpcDefName2);
-        moduleBuilder.addRpc(23, rpcDefName2, rpcPath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddRpcInputForInvalidParent() throws Exception {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        final QName rpcInput = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "input");
-        SchemaPath rpcInputPath = SchemaPath.create(true, rpcDefName, rpcInput);
-
-        moduleBuilder.addRpcInput(23, rpcInput, rpcInputPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddRpcOutputForInvalidParent() throws Exception {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "rpc-definition");
-        final QName rpcOutput = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "output");
-        SchemaPath rpcOutputPath = SchemaPath.create(true, rpcDefName, rpcOutput);
-
-        moduleBuilder.addRpcOutput(rpcOutputPath, rpcOutput, 23);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddNotificationForInvalidParent() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName notificationName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify-this");
-        SchemaPath notificationPath = SchemaPath.create(true, notificationName);
-
-        moduleBuilder.addNotification(12, notificationName, notificationPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddNotificationWithSameNameAsAlreadyExistingDataNodeContainer() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.addContainerNode(10, containerQName, containerPath);
-
-        final QName notificationName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify");
-        SchemaPath notificationPath = SchemaPath.create(true, notificationName);
-
-        moduleBuilder.addNotification(12, notificationName, notificationPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateNotification() throws Exception {
-        final QName notificationName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify-this");
-        SchemaPath notificationPath = SchemaPath.create(true, notificationName);
-
-        moduleBuilder.addNotification(12, notificationName, notificationPath);
-
-        final QName notificationName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify-this");
-        SchemaPath notificationPath2 = SchemaPath.create(true, notificationName2);
-
-        moduleBuilder.addNotification(17, notificationName2, notificationPath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddNotificationWithSameNameAsAlreadyDefinedRpc() throws Exception {
-        final QName rpcDefName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify-this");
-        SchemaPath rpcPath2 = SchemaPath.create(true, rpcDefName2);
-        moduleBuilder.addRpc(17, rpcDefName2, rpcPath2);
-
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify-this");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.addNotification(23, rpcDefName, rpcPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddFeatureIntoNonModuleBuilder() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName testFeature = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-feature");
-        SchemaPath featurePath = SchemaPath.create(true, testFeature);
-
-        moduleBuilder.addFeature(23, testFeature, featurePath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateFeature() throws Exception {
-        final QName testFeature = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-feature");
-        SchemaPath featurePath = SchemaPath.create(true, testFeature);
-
-        moduleBuilder.addFeature(23, testFeature, featurePath);
-
-        final QName testFeature2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-feature");
-        SchemaPath featurePath2 = SchemaPath.create(true, testFeature2);
-
-        moduleBuilder.addFeature(23, testFeature2, featurePath2);
-    }
-
-    @Test
-    public void testAddTwoFeatures() throws Exception {
-        final QName testFeature = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-feature");
-        SchemaPath featurePath = SchemaPath.create(true, testFeature);
-
-        final FeatureBuilder feature1 = moduleBuilder.addFeature(23, testFeature, featurePath);
-
-        final QName testFeature2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-feature2");
-        SchemaPath featurePath2 = SchemaPath.create(true, testFeature2);
-
-        final FeatureBuilder feature2 = moduleBuilder.addFeature(23, testFeature2, featurePath2);
-
-        assertNotNull(feature1);
-        assertNotNull(feature2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddCaseWhenParentIsNull() throws Exception {
-        moduleBuilder.exitNode();
-        addTestCase();
-    }
-
-    private void addTestCase() {
-        final QName testCase = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-case");
-        SchemaPath testCasePath = SchemaPath.create(true, testCase);
-
-        moduleBuilder.addCase(72, testCase, testCasePath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddCaseWhenParentIsModule() throws Exception {
-        addTestCase();
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddCaseWhenParentIsNotChoiceNorAugmentation() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-        addTestCase();
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateTypedefIntoContainer() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        tryToAddDuplicateTypedef();
-    }
-
-    private void tryToAddDuplicateTypedef() {
-        final QName testTypedef1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-type-definition");
-        SchemaPath testTypedefPath1 = SchemaPath.create(true, testTypedef1);
-
-        final QName testTypedef2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-type-definition");
-        SchemaPath testTypedefPath2 = SchemaPath.create(true, testTypedef2);
-
-        moduleBuilder.addTypedef(23, testTypedef1, testTypedefPath1);
-        moduleBuilder.addTypedef(44, testTypedef2, testTypedefPath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateTypedefIntoRpcDefinition() throws Exception {
-        final QName rpcQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-rpc");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcQName);
-        moduleBuilder.enterNode(new RpcDefinitionBuilder(MODULE_NAME, 10, rpcQName, rpcPath));
-
-        tryToAddDuplicateTypedef();
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddTypedefIntoNonValidStatement() throws Exception {
-        final QName leafName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-leaf");
-        SchemaPath leafPath = SchemaPath.create(true, leafName);
-        moduleBuilder.enterNode(new LeafSchemaNodeBuilder(MODULE_NAME, 10, leafName, leafPath));
-
-        final QName testRpc = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-type-definition");
-        SchemaPath testRpcPath = SchemaPath.create(true, testRpc);
-
-        moduleBuilder.addTypedef(23, testRpc, testRpcPath);
-    }
-
-    @Test
-    public void testAddTwoTypedefsIntoContainer() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        tryToAddTwoTypedefs();
-    }
-
-    private void tryToAddTwoTypedefs() {
-        final QName testTypedef1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-type-definition");
-        SchemaPath testTypedefPath1 = SchemaPath.create(true, testTypedef1);
-
-        final QName testTypedef2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-type-definition2");
-        SchemaPath testTypedefPath2 = SchemaPath.create(true, testTypedef2);
-
-        final TypeDefinitionBuilderImpl typedef1 = moduleBuilder.addTypedef(23, testTypedef1, testTypedefPath1);
-        final TypeDefinitionBuilderImpl typedef2 = moduleBuilder.addTypedef(44, testTypedef2, testTypedefPath2);
-
-        assertNotNull(typedef1);
-        assertNotNull(typedef2);
-    }
-
-    @Test
-    public void testAddTwoTypedefsIntoRpcDefinition() throws Exception {
-        final QName rpcQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-rpc");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcQName);
-        moduleBuilder.enterNode(new RpcDefinitionBuilder(MODULE_NAME, 10, rpcQName, rpcPath));
-
-        tryToAddTwoTypedefs();
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testSetType() throws Exception {
-        final Uint16 uint = Uint16.getInstance();
-        moduleBuilder.setType(uint);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddUnionTypeWhenParentIsNull() throws Exception {
-        moduleBuilder.exitNode();
-
-        tryToAddUnionType();
-    }
-
-    private void tryToAddUnionType() {
-        final QName unionQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "union-type-def");
-        moduleBuilder.addUnionType(25, QNameModule.create(unionQName.getNamespace(), unionQName.getRevision()));
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddUnionTypeWhenParentIsNotTypeAwareBuilder() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        tryToAddUnionType();
-    }
-
-    @Test(expected = YangParseException.class)
-    public void addIdentityrefTypeWhenParentIsNull() throws Exception {
-        moduleBuilder.exitNode();
-        tryToAddIdentityrefType();
-    }
-
-    private void tryToAddIdentityrefType() {
-        final QName identityrefQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "identityref-type-def");
-        SchemaPath identityrefPath = SchemaPath.create(true, identityrefQName);
-        moduleBuilder.addIdentityrefType(25, identityrefPath, "simplebase");
-    }
-
-    @Test(expected = YangParseException.class)
-    public void addIdentityrefTypeWhenParentIsNotTypeAwareBuilder() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        tryToAddIdentityrefType();
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDeviationWhereParentIsNotModule() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName deviationQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-deviation-name");
-        SchemaPath deviationPath = SchemaPath.create(true, deviationQName);
-
-        moduleBuilder.addDeviation(78, deviationPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddIdentityWhereParentIsNotModule() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        tryToAddIdentity();
-    }
-
-    private void tryToAddIdentity() {
-        final QName identityQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "test-identity-name");
-        SchemaPath identityPath = SchemaPath.create(true, identityQName);
-
-        moduleBuilder.addIdentity(identityQName, 78, identityPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateIdentity() throws Exception {
-        tryToAddIdentity();
-        tryToAddIdentity();
-    }
-
-    @Test
-    public void testAddUnknownSchemaNodeDirectlyToParent() throws Exception {
-        final QName unknownQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "my-extension-use");
-        SchemaPath unknownPath = SchemaPath.create(true, unknownQName);
-        assertTrue(moduleBuilder.getUnknownNodes().isEmpty());
-        moduleBuilder.addUnknownSchemaNode(72, unknownQName, unknownPath);
-        assertFalse(moduleBuilder.getUnknownNodes().isEmpty());
-    }
-
-    @Test
-    public void testAddUnknownSchemaNodeIntoDataNodeContainer() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName unknownQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "my-extension-use");
-        SchemaPath unknownPath = SchemaPath.create(true, unknownQName);
-        assertTrue(moduleBuilder.getAllUnknownNodes().isEmpty());
-        moduleBuilder.addUnknownSchemaNode(72, unknownQName, unknownPath);
-        assertFalse(moduleBuilder.getAllUnknownNodes().isEmpty());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddUnknownSchemaNodeIntoNonSchemaNode() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-non-schema-node");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new NonSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName unknownQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "my-extension-use");
-        SchemaPath unknownPath = SchemaPath.create(true, unknownQName);
-        assertTrue(moduleBuilder.getUnknownNodes().isEmpty());
-        moduleBuilder.addUnknownSchemaNode(72, unknownQName, unknownPath);
-        assertFalse(moduleBuilder.getUnknownNodes().isEmpty());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddContainerWithSameNameAsRpcDefintion() throws Exception {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "message");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.addRpc(70, rpcDefName, rpcPath);
-        tryToAddContainer();
-    }
-
-    private void tryToAddContainer() {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "message");
-        final SchemaPath containerPath = SchemaPath.create(true, containerQName);
-
-        moduleBuilder.addContainerNode(22, containerQName, containerPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddContainerWithSameNameAsNotificationDefintion() throws Exception {
-        final QName notificationName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "message");
-        SchemaPath notificationPath = SchemaPath.create(true, notificationName);
-        moduleBuilder.addNotification(70, notificationName, notificationPath);
-        tryToAddContainer();
-    }
-
-    @Test
-    public void testAddContainerWithAlreadyAddedRpcDefintion() throws Exception {
-        final QName rpcDefName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "send-message");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcDefName);
-        moduleBuilder.addRpc(70, rpcDefName, rpcPath);
-        tryToAddContainer();
-
-        DataSchemaNodeBuilder addedContainer = moduleBuilder.getDataChildByName("message");
-        assertNotNull(addedContainer);
-    }
-
-    @Test
-    public void testAddContainerWithAlreadyAddedNotificationDefintion() throws Exception {
-        final QName notificationName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "notify-me");
-        SchemaPath notificationPath = SchemaPath.create(true, notificationName);
-        moduleBuilder.addNotification(70, notificationName, notificationPath);
-        tryToAddContainer();
-
-        DataSchemaNodeBuilder addedContainer = moduleBuilder.getDataChildByName("message");
-        assertNotNull(addedContainer);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateSchemaNodeIntoSubnodeOfModule() throws Exception {
-        final QName containerQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath containerPath = SchemaPath.create(true, containerQName);
-        moduleBuilder.enterNode(new ContainerSchemaNodeBuilder(MODULE_NAME, 10, containerQName, containerPath));
-
-        final QName leafQName1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-leaf");
-        SchemaPath leafPath1 = SchemaPath.create(true, containerQName, leafQName1);
-
-        final QName leafQName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-leaf");
-        SchemaPath leafPath2 = SchemaPath.create(true, containerQName, leafQName2);
-
-        moduleBuilder.addLeafNode(12, leafQName1, leafPath1);
-        moduleBuilder.addLeafNode(20, leafQName2, leafPath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddDuplicateCaseIntoChoiceCaseNode() throws Exception {
-        //FIXME: move this into ChoiceBuilderTest !!!
-        final QName choiceQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "top-level-container");
-        SchemaPath choicePath = SchemaPath.create(true, choiceQName);
-
-        moduleBuilder.enterNode(new ChoiceBuilder(MODULE_NAME, 10, choiceQName, choicePath));
-
-        final QName caseQName1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-case");
-        SchemaPath casePath1 = SchemaPath.create(true, choiceQName, caseQName1);
-
-        final QName caseQName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-case");
-        SchemaPath casePath2 = SchemaPath.create(true, choiceQName, caseQName2);
-
-        moduleBuilder.addCase(12, caseQName1, casePath1);
-        moduleBuilder.addCase(20, caseQName2, casePath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddChoiceWithSameNameAsCase() throws Exception {
-        final QName choiceQName = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "my-choice");
-        SchemaPath choicePath = SchemaPath.create(true, choiceQName);
-
-        final ChoiceBuilder choiceBuilder = moduleBuilder.addChoice(8, choiceQName, choicePath);
-        moduleBuilder.enterNode(choiceBuilder);
-
-        final QName caseQName1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-case");
-        SchemaPath casePath1 = SchemaPath.create(true, choiceQName, caseQName1);
-
-        final QName caseQName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-case");
-        SchemaPath casePath2 = SchemaPath.create(true, choiceQName, caseQName2);
-
-        moduleBuilder.addCase(12, caseQName1, casePath1);
-        moduleBuilder.addChoice(20, caseQName2, casePath2);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testAddChildToSubnodeForNonDataNodeContainerAndNonChoiceNode() {
-        final QName leafQName1 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-leaf");
-        SchemaPath leafPath1 = SchemaPath.create(true, leafQName1);
-
-        final LeafSchemaNodeBuilder leafBuilder = moduleBuilder.addLeafNode(10, leafQName1, leafPath1);
-        moduleBuilder.enterNode(leafBuilder);
-
-        final QName leafQName2 = QName.create(TEST_MODULE_NAMESPACE, TEST_MODULE_REVISION, "simple-leaf");
-        SchemaPath leafPath2 = SchemaPath.create(true, leafQName1, leafQName2);
-
-        moduleBuilder.addLeafNode(12, leafQName2, leafPath2);
-    }
-
-    private static class NonSchemaNodeBuilder implements Builder {
-
-        String moduleName;
-        final int line;
-        final QName name;
-        final SchemaPath path;
-
-        public NonSchemaNodeBuilder(final String moduleName, final int line, final QName name, final SchemaPath path) {
-            this.moduleName = moduleName;
-            this.line = line;
-            this.name = name;
-            this.path = path;
-        }
-
-        @Override
-        public String getModuleName() {
-            return moduleName;
-        }
-
-        @Override
-        public int getLine() {
-            return line;
-        }
-
-        @Override
-        public Builder getParent() {
-            return null;
-        }
-
-        @Override
-        public void setParent(final Builder parent) {
-
-        }
-
-        @Override
-        public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
-
-        }
-
-        @Override
-        public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-            return null;
-        }
-
-        @Override
-        public Object build() {
-            return null;
-        }
-    }
-}
\ No newline at end of file
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineUtilsTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/RefineUtilsTest.java
deleted file mode 100644 (file)
index 3c43ecf..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-/**
- * Test suite for increasing of test coverage of RefineUtils implementation.
- *
- * @see org.opendaylight.yangtools.yang.parser.builder.impl.RefineUtils
- *
- * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class RefineUtilsTest extends AbstractBuilderTest {
-
-    @Test
-    public void testRefineLeafWithEmptyDefaultString() {
-        final String leafLocalName = "leaf-to-refine";
-        final QName leafName = QName.create(module.getNamespace(), module.getRevision(), leafLocalName);
-        final SchemaPath leafPath = SchemaPath.create(true, leafName);
-        final LeafSchemaNodeBuilder leafBuilder = new LeafSchemaNodeBuilder(module.getModuleName(), 22, leafName, leafPath);
-
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+leafLocalName);
-        refineBuilder.setDefaultStr("");
-
-        RefineUtils.performRefine(leafBuilder, refineBuilder);
-        assertNull(leafBuilder.getDefaultStr());
-    }
-
-    @Test
-    public void testRefineContainer() {
-        final String containerLocalName = "container-to-refine";
-        final QName containerName = QName.create(module.getNamespace(), module.getRevision(), containerLocalName);
-        final SchemaPath containerPath = SchemaPath.create(true, containerName);
-        final ContainerSchemaNodeBuilder containerBuilder = new ContainerSchemaNodeBuilder(module.getModuleName(),
-            10, containerName, containerPath);
-
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+containerLocalName);
-        refineBuilder.setPresence(null);
-
-        final MustDefinition must = provideMustDefinition();
-        refineBuilder.setMust(must);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder();
-        refineBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        RefineUtils.performRefine(containerBuilder, refineBuilder);
-
-        assertFalse(containerBuilder.getConstraints().getMustDefinitions().isEmpty());
-        assertEquals(containerBuilder.getConstraints().getMustDefinitions().size(), 1);
-        assertFalse(containerBuilder.getUnknownNodes().isEmpty());
-        assertEquals(containerBuilder.getUnknownNodes().get(0), unknownNodeBuilder);
-    }
-
-
-
-    @Test
-    public void testRefineList() {
-        final String listLocalName = "list-to-refine";
-        final QName listQName = QName.create(module.getNamespace(), module.getRevision(), listLocalName);
-        final SchemaPath listPath = SchemaPath.create(true, listQName);
-        final ListSchemaNodeBuilder listBuilder = new ListSchemaNodeBuilder(module.getModuleName(),
-            10, listQName, listPath);
-
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+listLocalName);
-
-        final MustDefinition must = provideMustDefinition();
-        refineBuilder.setMust(must);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder();
-        refineBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        refineBuilder.setMinElements(null);
-        refineBuilder.setMaxElements(null);
-
-        RefineUtils.performRefine(listBuilder, refineBuilder);
-        assertFalse(listBuilder.getConstraints().getMustDefinitions().isEmpty());
-        assertEquals(listBuilder.getConstraints().getMustDefinitions().size(), 1);
-        assertNull(listBuilder.getConstraints().getMinElements());
-        assertNull(listBuilder.getConstraints().getMaxElements());
-        assertFalse(listBuilder.getUnknownNodes().isEmpty());
-        assertEquals(listBuilder.getUnknownNodes().get(0), unknownNodeBuilder);
-    }
-
-    @Test
-    public void testRefineLeafList() {
-        final String leafListLocalName = "list-to-refine";
-        final QName leafListQName = QName.create(module.getNamespace(), module.getRevision(), leafListLocalName);
-        final SchemaPath leafListPath = SchemaPath.create(true, leafListQName);
-        final LeafListSchemaNodeBuilder leafListBuilder = new LeafListSchemaNodeBuilder(module.getModuleName(),
-            10, leafListQName, leafListPath);
-
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+leafListLocalName);
-
-        final MustDefinition must = provideMustDefinition();
-        refineBuilder.setMust(null);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder();
-        refineBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        refineBuilder.setMinElements(null);
-        refineBuilder.setMaxElements(null);
-
-        RefineUtils.performRefine(leafListBuilder, refineBuilder);
-        assertTrue(leafListBuilder.getConstraints().getMustDefinitions().isEmpty());
-        assertNull(leafListBuilder.getConstraints().getMinElements());
-        assertNull(leafListBuilder.getConstraints().getMaxElements());
-        assertFalse(leafListBuilder.getUnknownNodes().isEmpty());
-        assertEquals(leafListBuilder.getUnknownNodes().get(0), unknownNodeBuilder);
-
-        refineBuilder.setMinElements(Integer.MIN_VALUE);
-        refineBuilder.setMaxElements(Integer.MAX_VALUE);
-        refineBuilder.setMust(must);
-
-        RefineUtils.performRefine(leafListBuilder, refineBuilder);
-        assertFalse(leafListBuilder.getConstraints().getMustDefinitions().isEmpty());
-        assertEquals(leafListBuilder.getConstraints().getMustDefinitions().size(), 1);
-
-        assertNotNull(leafListBuilder.getConstraints().getMinElements());
-        assertNotNull(leafListBuilder.getConstraints().getMaxElements());
-    }
-
-    @Test
-    public void testRefineChoice() {
-        final String choiceLocalName = "choice-to-refine";
-        final ChoiceBuilder choiceBuilder = provideChoiceBuilder(choiceLocalName);
-
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+choiceLocalName);
-        refineBuilder.setDefaultStr(null);
-        refineBuilder.setMandatory(null);
-
-        RefineUtils.performRefine(choiceBuilder, refineBuilder);
-        assertNull(choiceBuilder.getDefaultCase());
-        assertFalse(choiceBuilder.getConstraints().isMandatory());
-
-        final String defaultValue = "choice-default-case";
-        refineBuilder.setDefaultStr(defaultValue);
-        refineBuilder.setMandatory(true);
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder();
-        refineBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        RefineUtils.performRefine(choiceBuilder, refineBuilder);
-        assertNotNull(choiceBuilder.getDefaultCase());
-        assertNotNull(choiceBuilder.getConstraints().isMandatory());
-        assertFalse(choiceBuilder.getUnknownNodes().isEmpty());
-        assertEquals(choiceBuilder.getUnknownNodes().get(0), unknownNodeBuilder);
-    }
-
-    @Test
-    public void testRefineAnyxml() {
-        final String anyxmlLocalName = "anyxml-to-refine";
-        final QName anyxmlName = QName.create(module.getNamespace(), module.getRevision(), anyxmlLocalName);
-        final SchemaPath anyxmlPath = SchemaPath.create(true, anyxmlName);
-        final AnyXmlBuilder anyXmlBuilder = new AnyXmlBuilder(module.getModuleName(), 22, anyxmlName, anyxmlPath);
-
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+anyxmlLocalName);
-        refineBuilder.setMandatory(null);
-        refineBuilder.setMust(null);
-
-        RefineUtils.performRefine(anyXmlBuilder, refineBuilder);
-        assertNull(refineBuilder.isMandatory());
-        assertNull(refineBuilder.getMust());
-
-        final MustDefinition must = provideMustDefinition();
-
-        refineBuilder.setMandatory(true);
-        refineBuilder.setMust(must);
-
-        final UnknownSchemaNodeBuilder unknownNodeBuilder = provideUnknownNodeBuilder();
-        refineBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        RefineUtils.performRefine(anyXmlBuilder, refineBuilder);
-        assertFalse(anyXmlBuilder.getConstraints().getMustDefinitions().isEmpty());
-        assertEquals(anyXmlBuilder.getConstraints().getMustDefinitions().size(), 1);
-        assertFalse(anyXmlBuilder.getUnknownNodes().isEmpty());
-        assertEquals(anyXmlBuilder.getUnknownNodes().get(0), unknownNodeBuilder);
-        assertTrue(anyXmlBuilder.getConstraints().isMandatory());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testCheckRefineDefault() {
-        final String groupLocalName = "test-group";
-        final QName testGroup = QName.create(module.getNamespace(), module.getRevision(), groupLocalName);
-        final SchemaPath groupPath = SchemaPath.create(true, testGroup);
-        final GroupingBuilder grouping = module.addGrouping(12, testGroup, groupPath);
-
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+groupLocalName);
-        refineBuilder.setDefaultStr("invalid-default-value");
-
-        RefineUtils.performRefine(grouping, refineBuilder);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testCheckRefineMandatory() {
-        final TypeDefinitionBuilderImpl typedef = initTypedef();
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+typedef.getQName().getLocalName());
-        refineBuilder.setMandatory(true);
-        RefineUtils.performRefine(typedef, refineBuilder);
-    }
-
-    private TypeDefinitionBuilderImpl initTypedef() {
-        final String typedefLocalName = "test-type-definition";
-        final QName testTypedef = QName.create(module.getNamespace(), module.getRevision(), typedefLocalName);
-        SchemaPath testTypedefPath = SchemaPath.create(true, testTypedef);
-
-        return module.addTypedef(23, testTypedef, testTypedefPath);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testCheckRefineMust() {
-        final TypeDefinitionBuilderImpl typedef = initTypedef();
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+typedef.getQName().getLocalName());
-
-        final MustDefinition must = provideMustDefinition();
-        refineBuilder.setMust(must);
-        RefineUtils.performRefine(typedef, refineBuilder);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testCheckRefineMin() {
-        final TypeDefinitionBuilderImpl typedef = initTypedef();
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+typedef.getQName().getLocalName());
-
-        refineBuilder.setMinElements(Integer.MIN_VALUE);
-        RefineUtils.performRefine(typedef, refineBuilder);
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testCheckRefineMax() {
-        final TypeDefinitionBuilderImpl typedef = initTypedef();
-        final RefineHolderImpl refineBuilder = new RefineHolderImpl(module.getModuleName(), 23, "/"+typedef.getQName().getLocalName());
-
-        refineBuilder.setMaxElements(Integer.MAX_VALUE);
-        RefineUtils.performRefine(typedef, refineBuilder);
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionBuilderTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/RpcDefinitionBuilderTest.java
deleted file mode 100644 (file)
index 56b6a18..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.util.Uint16;
-import org.opendaylight.yangtools.yang.parser.builder.api.GroupingBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-/**
- * Test suite for increasing of test coverage of RpcDefinitionBuilder implementation.
- *
- * @see org.opendaylight.yangtools.yang.parser.builder.impl.RpcDefinitionBuilder
- *
- * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
- *
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class RpcDefinitionBuilderTest extends AbstractBuilderTest {
-
-    @Test
-    public void testBuild() {
-        final QName rpcQName = QName.create(module.getNamespace(), module.getRevision(), "send-message");
-        SchemaPath rpcPath = SchemaPath.create(true, rpcQName);
-        final RpcDefinitionBuilder rpcBuilder = new RpcDefinitionBuilder(module.getModuleName(), 10, rpcQName, rpcPath);
-
-        final QName testTypedef = QName.create(module.getNamespace(), module.getRevision(), "test-typedef");
-        final SchemaPath testTypedefPath = SchemaPath.create(true, rpcQName, testTypedef);
-        final TypeDefinitionBuilder typedefBuilder = new TypeDefinitionBuilderImpl(module.getModuleName(),
-            12, testTypedef, testTypedefPath);
-        typedefBuilder.setType(Uint16.getInstance());
-
-        rpcBuilder.addTypedef(typedefBuilder);
-
-        final QName testGroup = QName.create(module.getNamespace(), module.getRevision(), "test-group");
-        final SchemaPath groupPath = SchemaPath.create(true, rpcQName, testGroup);
-        final GroupingBuilder groupBuilder = new GroupingBuilderImpl(module.getModuleName(), 15, testGroup, groupPath);
-
-        rpcBuilder.addGrouping(groupBuilder);
-
-        final QName unknownNode = QName.create(module.getNamespace(), module.getRevision(), "unknown-ext-use");
-        final SchemaPath unknownNodePath = SchemaPath.create(true, rpcQName, unknownNode);
-        final UnknownSchemaNodeBuilder unknownNodeBuilder =  new UnknownSchemaNodeBuilderImpl(module.getModuleName(),
-            25, unknownNode, unknownNodePath);
-
-        rpcBuilder.addUnknownNodeBuilder(unknownNodeBuilder);
-
-        final RpcDefinitionBuilder rpcBuilder2 = new RpcDefinitionBuilder(module.getModuleName(), 10, rpcQName, rpcPath);
-        final RpcDefinitionBuilder rpcBuilder3 = new RpcDefinitionBuilder(module.getModuleName(), 10, unknownNode, rpcPath);
-        final RpcDefinitionBuilder rpcBuilder4 = new RpcDefinitionBuilder(module.getModuleName(), 10, rpcQName, unknownNodePath);
-
-        assertEquals(rpcBuilder, rpcBuilder2);
-        assertNotEquals(rpcBuilder, null);
-        assertNotEquals(rpcBuilder, rpcBuilder3);
-        assertNotEquals(rpcBuilder, rpcBuilder4);
-
-        assertEquals(rpcBuilder.toString(), "rpc send-message");
-
-        final RpcDefinition instance = rpcBuilder.build();
-
-        assertNotNull(instance);
-
-        final RpcDefinition sameInstance = rpcBuilder.build();
-        assertTrue(sameInstance == instance);
-        assertEquals(sameInstance, instance);
-
-        assertEquals(instance.getPath(), rpcPath);
-        assertEquals(instance.getStatus(), Status.CURRENT);
-        assertNull(instance.getOutput());
-        assertFalse(instance.getTypeDefinitions().isEmpty());
-        assertFalse(instance.getGroupings().isEmpty());
-        assertFalse(instance.getUnknownSchemaNodes().isEmpty());
-
-        assertEquals(instance.getTypeDefinitions().size(), 1);
-        assertEquals(instance.getGroupings().size(), 1);
-        assertEquals(instance.getUnknownSchemaNodes().size(), 1);
-
-        RpcDefinition instance2 = rpcBuilder2.build();
-        RpcDefinition instance3 = rpcBuilder3.build();
-        RpcDefinition instance4 = rpcBuilder4.build();
-
-        assertEquals(instance, instance2);
-        assertNotEquals(instance, null);
-        assertNotEquals(instance, instance3);
-        assertNotEquals(instance, instance4);
-
-        assertEquals(instance.toString(), "RpcDefinitionImpl[qname=(urn:opendaylight.rpc:def:test-model?" +
-            "revision=2014-01-06)send-message, path=AbsoluteSchemaPath{path=[(urn:opendaylight.rpc:def:test-model?" +
-            "revision=2014-01-06)send-message]}, input=null, output=null]");
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeDefinitionBuilderImplTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/builder/impl/TypeDefinitionBuilderImplTest.java
deleted file mode 100644 (file)
index 4ee6635..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- */
-package org.opendaylight.yangtools.yang.parser.builder.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import java.util.List;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.util.Int16;
-import org.opendaylight.yangtools.yang.parser.builder.api.UnknownSchemaNodeBuilder;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class TypeDefinitionBuilderImplTest {
-
-    @Test
-    public void getUnknownNodesTest() {
-
-        SchemaPath path = SchemaPath.create(true, QName.create("myModuleName"),QName.create("MyTypeDefName"));
-        int line = 1;
-        String moduleName = "myModuleName";
-        QName qName = QName.create("MyTypeDefName");
-
-        TypeDefinitionBuilderImpl typeDefinitionBuilderImpl = new TypeDefinitionBuilderImpl(moduleName,line,qName,path);
-        typeDefinitionBuilderImpl.setType(Int16.getInstance());
-
-        path = SchemaPath.create(true, QName.create("myModuleName"),QName.create("MyUnknownNodeName1"));
-        line = 1;
-        moduleName = "myModuleName";
-        qName = QName.create("MyUnknownNodeName1");
-
-        UnknownSchemaNodeBuilderImpl unknownSchemaNodeBuilder1 = new UnknownSchemaNodeBuilderImpl(moduleName,line,qName,path);
-
-        path = SchemaPath.create(true, QName.create("myModuleName"),QName.create("MyUnknownNodeName2"));
-        line = 2;
-        moduleName = "myModuleName";
-        qName = QName.create("MyUnknownNodeName2");
-
-        UnknownSchemaNodeBuilderImpl unknownSchemaNodeBuilder2 = new UnknownSchemaNodeBuilderImpl(moduleName,line,qName,path);
-
-        typeDefinitionBuilderImpl.addUnknownNodeBuilder(unknownSchemaNodeBuilder1);
-        typeDefinitionBuilderImpl.addUnknownNodeBuilder(unknownSchemaNodeBuilder2);
-
-        List<UnknownSchemaNodeBuilder> unknownNodesBuilders = typeDefinitionBuilderImpl.getUnknownNodes();
-
-        assertNotNull(unknownNodesBuilders);
-        assertFalse(unknownNodesBuilders.isEmpty());
-        assertEquals(2,unknownNodesBuilders.size());
-        assertTrue(unknownNodesBuilders.contains(unknownSchemaNodeBuilder1));
-        assertTrue(unknownNodesBuilders.contains(unknownSchemaNodeBuilder2));
-
-        TypeDefinition<? extends TypeDefinition<?>> instance = typeDefinitionBuilderImpl.build();
-
-        List<UnknownSchemaNode> unknownNodes = instance.getUnknownSchemaNodes();
-
-        assertNotNull(unknownNodes);
-        assertFalse(unknownNodes.isEmpty());
-        assertEquals(2,unknownNodes.size());
-        assertTrue(unknownNodes.contains(unknownSchemaNodeBuilder1.build()));
-        assertTrue(unknownNodes.contains(unknownSchemaNodeBuilder2.build()));
-
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentTest.java
deleted file mode 100644 (file)
index e53afc9..0000000
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import java.io.FileNotFoundException;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.util.BaseTypes;
-
-public class AugmentTest {
-    private static final URI fooNS = URI.create("urn:opendaylight.foo");
-    private static final URI barNS = URI.create("urn:opendaylight.bar");
-    private static final URI bazNS = URI.create("urn:opendaylight.baz");
-    private static Date fooRev;
-    private static Date barRev;
-    private static Date bazRev;
-    private static QName q0;
-    private static QName q1;
-    private static QName q2;
-
-    private Set<Module> modules;
-
-    @BeforeClass
-    public static void init() throws FileNotFoundException, ParseException {
-        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        fooRev = simpleDateFormat.parse("2013-10-13");
-        barRev = simpleDateFormat.parse("2013-10-14");
-        bazRev = simpleDateFormat.parse("2013-10-15");
-
-        q0 = QName.create(barNS, barRev, "interfaces");
-        q1 = QName.create(barNS, barRev, "ifEntry");
-        q2 = QName.create(bazNS, bazRev, "augment-holder");
-    }
-
-    @Test
-    public void testAugmentParsing() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment").toURI());
-        SchemaPath expectedSchemaPath;
-        List<QName> qnames = new ArrayList<>();
-        qnames.add(q0);
-        qnames.add(q1);
-        qnames.add(q2);
-
-        // foo.yang
-        Module module1 = TestUtils.findModule(modules, "foo");
-        Set<AugmentationSchema> augmentations = module1.getAugmentations();
-        assertEquals(1, augmentations.size());
-        AugmentationSchema augment = augmentations.iterator().next();
-        assertNotNull(augment);
-
-        expectedSchemaPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedSchemaPath, augment.getTargetPath());
-
-        Collection<DataSchemaNode> augmentChildren = augment.getChildNodes();
-        assertEquals(4, augmentChildren.size());
-        for (DataSchemaNode dsn : augmentChildren) {
-            TestUtils.checkIsAugmenting(dsn, false);
-        }
-
-        LeafSchemaNode ds0ChannelNumber = (LeafSchemaNode) augment.getDataChildByName("ds0ChannelNumber");
-        LeafSchemaNode interfaceId = (LeafSchemaNode) augment.getDataChildByName("interface-id");
-        ContainerSchemaNode schemas = (ContainerSchemaNode) augment.getDataChildByName("schemas");
-        ChoiceSchemaNode odl = (ChoiceSchemaNode) augment.getDataChildByName("odl");
-
-        assertNotNull(ds0ChannelNumber);
-        assertNotNull(interfaceId);
-        assertNotNull(schemas);
-        assertNotNull(odl);
-
-        // leaf ds0ChannelNumber
-        QName qname = QName.create(fooNS, fooRev, "ds0ChannelNumber");
-        qnames.add(qname);
-        assertEquals(qname, ds0ChannelNumber.getQName());
-        expectedSchemaPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedSchemaPath, ds0ChannelNumber.getPath());
-        assertFalse(ds0ChannelNumber.isAugmenting());
-        // type of leaf ds0ChannelNumber
-        QName typeQName = BaseTypes.constructQName("string");
-        List<QName> typePath = Collections.singletonList(typeQName);
-        expectedSchemaPath = SchemaPath.create(typePath, true);
-        assertEquals(expectedSchemaPath, ds0ChannelNumber.getType().getPath());
-
-        // leaf interface-id
-        qname = QName.create(fooNS, fooRev, "interface-id");
-        assertEquals(qname, interfaceId.getQName());
-        qnames.set(3, qname);
-        expectedSchemaPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedSchemaPath, interfaceId.getPath());
-        assertFalse(interfaceId.isAugmenting());
-
-        // container schemas
-        qname = QName.create(fooNS, fooRev, "schemas");
-        assertEquals(qname, schemas.getQName());
-        qnames.set(3, qname);
-        expectedSchemaPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedSchemaPath, schemas.getPath());
-        assertFalse(schemas.isAugmenting());
-
-        // choice odl
-        qname = QName.create(fooNS, fooRev, "odl");
-        assertEquals(qname, odl.getQName());
-        qnames.set(3, qname);
-        expectedSchemaPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedSchemaPath, odl.getPath());
-        assertFalse(odl.isAugmenting());
-
-        // baz.yang
-        Module module3 = TestUtils.findModule(modules, "baz");
-        augmentations = module3.getAugmentations();
-        assertEquals(3, augmentations.size());
-        AugmentationSchema augment1 = null;
-        AugmentationSchema augment2 = null;
-        AugmentationSchema augment3 = null;
-        for (AugmentationSchema as : augmentations) {
-            if (as.getWhenCondition() == null) {
-                augment3 = as;
-            } else if ("if:ifType='ds0'".equals(as.getWhenCondition().toString())) {
-                augment1 = as;
-            } else if ("if:ifType='ds2'".equals(as.getWhenCondition().toString())) {
-                augment2 = as;
-            }
-        }
-        assertNotNull(augment1);
-        assertNotNull(augment2);
-        assertNotNull(augment3);
-
-        assertEquals(1, augment1.getChildNodes().size());
-        ContainerSchemaNode augmentHolder = (ContainerSchemaNode) augment1.getDataChildByName("augment-holder");
-        assertNotNull(augmentHolder);
-
-        assertEquals(1, augment2.getChildNodes().size());
-        ContainerSchemaNode augmentHolder2 = (ContainerSchemaNode) augment2.getDataChildByName("augment-holder2");
-        assertNotNull(augmentHolder2);
-
-        assertEquals(1, augment3.getChildNodes().size());
-        LeafSchemaNode pause = (LeafSchemaNode) augment3.getDataChildByName("pause");
-        assertNotNull(pause);
-    }
-
-    @Test
-    public void testAugmentResolving() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment").toURI());
-        Module module2 = TestUtils.findModule(modules, "bar");
-        ContainerSchemaNode interfaces = (ContainerSchemaNode) module2.getDataChildByName("interfaces");
-        ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
-
-        SchemaPath expectedPath;
-        List<QName> qnames = new ArrayList<>();
-        qnames.add(q0);
-        qnames.add(q1);
-        qnames.add(q2);
-
-        // baz.yang
-        // augment "/br:interfaces/br:ifEntry" {
-        ContainerSchemaNode augmentHolder = (ContainerSchemaNode) ifEntry.getDataChildByName("augment-holder");
-        TestUtils.checkIsAugmenting(augmentHolder, true);
-        assertEquals(q2, augmentHolder.getQName());
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, augmentHolder.getPath());
-
-        // foo.yang
-        // augment "/br:interfaces/br:ifEntry/bz:augment-holder"
-        LeafSchemaNode ds0ChannelNumber = (LeafSchemaNode) augmentHolder.getDataChildByName("ds0ChannelNumber");
-        LeafSchemaNode interfaceId = (LeafSchemaNode) augmentHolder.getDataChildByName("interface-id");
-        ContainerSchemaNode schemas = (ContainerSchemaNode) augmentHolder.getDataChildByName("schemas");
-        ChoiceSchemaNode odl = (ChoiceSchemaNode) augmentHolder.getDataChildByName("odl");
-
-        assertNotNull(ds0ChannelNumber);
-        assertNotNull(interfaceId);
-        assertNotNull(schemas);
-        assertNotNull(odl);
-
-        // leaf ds0ChannelNumber
-        QName qname = QName.create(fooNS, fooRev, "ds0ChannelNumber");
-        assertEquals(qname, ds0ChannelNumber.getQName());
-        qnames.add(qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, ds0ChannelNumber.getPath());
-
-        // leaf interface-id
-        qname = QName.create(fooNS, fooRev, "interface-id");
-        assertEquals(qname, interfaceId.getQName());
-        qnames.set(3, qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, interfaceId.getPath());
-
-        // container schemas
-        qname = QName.create(fooNS, fooRev, "schemas");
-        assertEquals(qname, schemas.getQName());
-        qnames.set(3, qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, schemas.getPath());
-
-        // choice odl
-        qname = QName.create(fooNS, fooRev, "odl");
-        assertEquals(qname, odl.getQName());
-        qnames.set(3, qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, odl.getPath());
-    }
-
-    @Test
-    public void testAugmentedChoice() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-augment").toURI());
-        Module module2 = TestUtils.findModule(modules, "bar");
-        ContainerSchemaNode interfaces = (ContainerSchemaNode) module2.getDataChildByName("interfaces");
-        ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
-        ContainerSchemaNode augmentedHolder = (ContainerSchemaNode) ifEntry.getDataChildByName("augment-holder");
-        TestUtils.checkIsAugmenting(augmentedHolder, true);
-
-        // foo.yang
-        // augment "/br:interfaces/br:ifEntry/bz:augment-holder"
-        ChoiceSchemaNode odl = (ChoiceSchemaNode) augmentedHolder.getDataChildByName("odl");
-        assertNotNull(odl);
-        Set<ChoiceCaseNode> cases = odl.getCases();
-        assertEquals(4, cases.size());
-
-        ChoiceCaseNode id = null;
-        ChoiceCaseNode node1 = null;
-        ChoiceCaseNode node2 = null;
-        ChoiceCaseNode node3 = null;
-
-        for (ChoiceCaseNode ccn : cases) {
-            if ("id".equals(ccn.getQName().getLocalName())) {
-                id = ccn;
-            } else if ("node1".equals(ccn.getQName().getLocalName())) {
-                node1 = ccn;
-            } else if ("node2".equals(ccn.getQName().getLocalName())) {
-                node2 = ccn;
-            } else if ("node3".equals(ccn.getQName().getLocalName())) {
-                node3 = ccn;
-            }
-        }
-
-        assertNotNull(id);
-        assertNotNull(node1);
-        assertNotNull(node2);
-        assertNotNull(node3);
-
-        SchemaPath expectedPath;
-        List<QName> qnames = new ArrayList<>();
-        qnames.add(q0);
-        qnames.add(q1);
-        qnames.add(q2);
-        qnames.add(QName.create(fooNS, fooRev, "odl"));
-
-        // case id
-        QName qname = QName.create(fooNS, fooRev, "id");
-        assertEquals(qname, id.getQName());
-        qnames.add(qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, id.getPath());
-        Collection<DataSchemaNode> idChildren = id.getChildNodes();
-        assertEquals(1, idChildren.size());
-
-        // case node1
-        qname = QName.create(fooNS, fooRev, "node1");
-        assertEquals(qname, node1.getQName());
-        qnames.set(4, qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, node1.getPath());
-        Collection<DataSchemaNode> node1Children = node1.getChildNodes();
-        assertTrue(node1Children.isEmpty());
-
-        // case node2
-        qname = QName.create(fooNS, fooRev, "node2");
-        assertEquals(qname, node2.getQName());
-        qnames.set(4, qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, node2.getPath());
-        Collection<DataSchemaNode> node2Children = node2.getChildNodes();
-        assertTrue(node2Children.isEmpty());
-
-        // case node3
-        qname = QName.create(fooNS, fooRev, "node3");
-        assertEquals(qname, node3.getQName());
-        qnames.set(4, qname);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, node3.getPath());
-        Collection<DataSchemaNode> node3Children = node3.getChildNodes();
-        assertEquals(1, node3Children.size());
-
-        // test cases
-        qnames.clear();
-        qnames.add(q0);
-        qnames.add(q1);
-        qnames.add(q2);
-        qnames.add(QName.create(fooNS, fooRev, "odl"));
-
-        // case id child
-        qnames.add(QName.create(fooNS, fooRev, "id"));
-        qnames.add(QName.create(fooNS, fooRev, "id"));
-        LeafSchemaNode caseIdChild = (LeafSchemaNode) idChildren.iterator().next();
-        assertNotNull(caseIdChild);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, caseIdChild.getPath());
-
-        // case node3 child
-        qnames.set(4, QName.create(fooNS, fooRev, "node3"));
-        qnames.set(5, QName.create(fooNS, fooRev, "node3"));
-        ContainerSchemaNode caseNode3Child = (ContainerSchemaNode) node3Children.iterator().next();
-        assertNotNull(caseNode3Child);
-        expectedPath = SchemaPath.create(qnames, true);
-        assertEquals(expectedPath, caseNode3Child.getPath());
-    }
-
-    @Test
-    public void testAugmentRpc() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/augment-test/rpc").toURI());
-        final URI NS_BAR = URI.create("urn:opendaylight:bar");
-        final URI NS_FOO = URI.create("urn:opendaylight:foo");
-        final Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2013-10-11");
-
-        Module bar = TestUtils.findModule(modules, "bar");
-        Set<RpcDefinition> rpcs = bar.getRpcs();
-        assertEquals(2, rpcs.size());
-
-        RpcDefinition submit = null;
-        for (RpcDefinition rpc : rpcs) {
-            if ("submit".equals(rpc.getQName().getLocalName())) {
-                submit = rpc;
-                break;
-            }
-        }
-        assertNotNull(submit);
-
-        QName submitQName = QName.create(NS_BAR, revision, "submit");
-        assertEquals(submitQName, submit.getQName());
-        ContainerSchemaNode input = submit.getInput();
-        QName inputQName = QName.create(NS_BAR, revision, "input");
-        assertEquals(inputQName, input.getQName());
-        ChoiceSchemaNode arguments = (ChoiceSchemaNode) input.getDataChildByName("arguments");
-        QName argumentsQName = QName.create(NS_BAR, revision, "arguments");
-        assertEquals(argumentsQName, arguments.getQName());
-        assertFalse(arguments.isAugmenting());
-        Set<ChoiceCaseNode> cases = arguments.getCases();
-        assertEquals(3, cases.size());
-
-        ChoiceCaseNode attach = null;
-        ChoiceCaseNode create = null;
-        ChoiceCaseNode destroy = null;
-        for (ChoiceCaseNode child : cases) {
-            if ("attach".equals(child.getQName().getLocalName())) {
-                attach = child;
-            } else if ("create".equals(child.getQName().getLocalName())) {
-                create = child;
-            } else if ("destroy".equals(child.getQName().getLocalName())) {
-                destroy = child;
-            }
-        }
-        assertNotNull(attach);
-        assertNotNull(create);
-        assertNotNull(destroy);
-
-        assertTrue(attach.isAugmenting());
-        assertTrue(create.isAugmenting());
-        assertTrue(destroy.isAugmenting());
-
-        SchemaPath expectedPath;
-        QName[] qnames = new QName[4];
-        qnames[0] = submitQName;
-        qnames[1] = inputQName;
-        qnames[2] = argumentsQName;
-
-        // case attach
-        qnames[3] = QName.create(NS_FOO, revision, "attach");
-        assertEquals(qnames[3], attach.getQName());
-        expectedPath = SchemaPath.create(Arrays.asList(qnames), true);
-        assertEquals(expectedPath, attach.getPath());
-        Collection<DataSchemaNode> attachChildren = attach.getChildNodes();
-        assertEquals(1, attachChildren.size());
-
-        // case create
-        qnames[3] = QName.create(NS_FOO, revision, "create");
-        assertEquals(qnames[3], create.getQName());
-        expectedPath = SchemaPath.create(Arrays.asList(qnames), true);
-        assertEquals(expectedPath, create.getPath());
-        Collection<DataSchemaNode> createChildren = create.getChildNodes();
-        assertEquals(1, createChildren.size());
-
-        // case attach
-        qnames[3] = QName.create(NS_FOO, revision, "destroy");
-        assertEquals(qnames[3], destroy.getQName());
-        expectedPath = SchemaPath.create(Arrays.asList(qnames), true);
-        assertEquals(expectedPath, destroy.getPath());
-        Collection<DataSchemaNode> destroyChildren = destroy.getChildNodes();
-        assertEquals(1, destroyChildren.size());
-    }
-
-    @Test
-    public void testAugmentInUsesResolving() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/augment-test/augment-in-uses").toURI());
-        assertEquals(1, modules.size());
-
-        Module test = modules.iterator().next();
-        DataNodeContainer links = (DataNodeContainer) test.getDataChildByName("links");
-        DataNodeContainer link = (DataNodeContainer) links.getDataChildByName("link");
-        DataNodeContainer nodes = (DataNodeContainer) link.getDataChildByName("nodes");
-        ContainerSchemaNode node = (ContainerSchemaNode) nodes.getDataChildByName("node");
-        Set<AugmentationSchema> augments = node.getAvailableAugmentations();
-        assertEquals(1, augments.size());
-        assertEquals(1, node.getChildNodes().size());
-        LeafSchemaNode id = (LeafSchemaNode) node.getDataChildByName("id");
-        assertTrue(id.isAugmenting());
-    }
-
-    @Test
-    public void caseShortHandAugmentingTest() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/choice-case-type-test-models").toURI());
-
-        Module findModule = TestUtils.findModule(modules, "choice-monitoring");
-
-        ContainerSchemaNode netconf =  (ContainerSchemaNode) findModule.getDataChildByName("netconf-state");
-        ContainerSchemaNode datastores =  (ContainerSchemaNode) netconf.getDataChildByName("datastores");
-        ListSchemaNode datastore =  (ListSchemaNode) datastores.getDataChildByName("datastore");
-        ContainerSchemaNode locks =  (ContainerSchemaNode) datastore.getDataChildByName("locks");
-        ChoiceSchemaNode lockType =  (ChoiceSchemaNode)locks.getDataChildByName("lock-type");
-
-        ChoiceCaseNode leafAugCase = lockType.getCaseNodeByName("leaf-aug-case");
-        assertTrue(leafAugCase.isAugmenting());
-        DataSchemaNode leafAug = leafAugCase.getDataChildByName("leaf-aug-case");
-        assertFalse(leafAug.isAugmenting());
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentToExtensionTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentToExtensionTest.java
deleted file mode 100644 (file)
index d8e2789..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Set;
-
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-public class AugmentToExtensionTest {
-    private Set<Module> modules;
-
-    @Test(expected = YangParseException.class)
-    public void testIncorrectPath() throws IOException, URISyntaxException {
-        modules = TestUtils.loadModules(getClass().getResource("/augment-to-extension-test/incorrect-path").toURI());
-
-    }
-
-    @Test
-    public void testCorrectPathIntoUnsupportedTarget() throws IOException, URISyntaxException {
-        modules = TestUtils.loadModules(getClass().getResource(
-                "/augment-to-extension-test/correct-path-into-unsupported-target").toURI());
-
-        Module devicesModul = TestUtils.findModule(modules, "augment-module");
-
-        ContainerSchemaNode devicesContainer = (ContainerSchemaNode) devicesModul.getDataChildByName("my-container");
-        Set<UsesNode> uses = devicesContainer.getUses();
-
-        boolean augmentationIsInContainer = false;
-        for (UsesNode usesNode : uses) {
-            Set<AugmentationSchema> augmentations = usesNode.getAugmentations();
-            for (AugmentationSchema augmentationSchema : augmentations) {
-                augmentationIsInContainer = true;
-            }
-        }
-
-        assertFalse(augmentationIsInContainer);
-    }
-
-    @Test
-    public void testCorrectAugment() throws IOException, URISyntaxException {
-        modules = TestUtils.loadModules(getClass().getResource("/augment-to-extension-test/correct-augment").toURI());
-
-        Module devicesModul = TestUtils.findModule(modules, "augment-module");
-
-        ContainerSchemaNode devicesContainer = (ContainerSchemaNode) devicesModul.getDataChildByName("my-container");
-        Set<UsesNode> uses = devicesContainer.getUses();
-
-        boolean augmentationIsInContainer = false;
-        for (UsesNode usesNode : uses) {
-            Set<AugmentationSchema> augmentations = usesNode.getAugmentations();
-            for (AugmentationSchema augmentationSchema : augmentations) {
-                augmentationIsInContainer = true;
-            }
-        }
-
-        assertTrue(augmentationIsInContainer);
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentationSchemaBuilderImplTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/AugmentationSchemaBuilderImplTest.java
deleted file mode 100644 (file)
index ce0648f..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.impl.AugmentationSchemaBuilderImpl;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class AugmentationSchemaBuilderImplTest {
-
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl;
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl2;
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl3;
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl4;
-    private AugmentationSchema augmentSchema;
-
-    @Before
-    public void init() {
-        augmentSchemaBuilderImpl = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc", SchemaPath.ROOT, 1);
-        augmentSchemaBuilderImpl2 = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc2", SchemaPath.ROOT, 1);
-        augmentSchemaBuilderImpl3 = augmentSchemaBuilderImpl;
-        augmentSchemaBuilderImpl4 = new AugmentationSchemaBuilderImpl("test-module", 10, null, SchemaPath.ROOT, 1);
-        augmentSchema = augmentSchemaBuilderImpl.build();
-    }
-
-    @Test
-    public void testgetPath() {
-        assertTrue(Iterables.isEmpty(augmentSchemaBuilderImpl.getPath().getPathFromRoot()));
-    }
-
-    @Test
-    public void testEquals() {
-        assertFalse(augmentSchemaBuilderImpl.equals("test"));
-        assertFalse(augmentSchemaBuilderImpl.equals(null));
-        assertTrue(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl3));
-        assertFalse(augmentSchemaBuilderImpl4.equals(augmentSchemaBuilderImpl));
-        assertFalse(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl2));
-    }
-
-    @Test
-    public void testGetOriginalDefinition() {
-        augmentSchema = augmentSchemaBuilderImpl.build();
-        Optional<AugmentationSchema> origDefinition = augmentSchema.getOriginalDefinition();
-        assertFalse(origDefinition.isPresent());
-    }
-
-    @Test
-    public void testGetUnknownSchemaNodes() {
-        assertTrue(Iterables.isEmpty(augmentSchema.getUnknownSchemaNodes()));
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug1412Test.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug1412Test.java
deleted file mode 100644 (file)
index 1ff22d9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.net.URI;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * Test ANTLR4 grammar capability to parse description statement in unknown node.
- *
- * Note: Everything under unknown node is unknown node.
- */
-public class Bug1412Test {
-
-    @Test
-    public void test() throws Exception {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/bugs/bug1412").toURI());
-        Module bug1412 = TestUtils.findModule(modules, "bug1412");
-        assertNotNull(bug1412);
-
-        ContainerSchemaNode node = (ContainerSchemaNode) bug1412.getDataChildByName("node");
-        List<UnknownSchemaNode> unknownNodes = node.getUnknownSchemaNodes();
-        assertEquals(1, unknownNodes.size());
-        UnknownSchemaNode action = unknownNodes.get(0);
-
-        Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-07-25");
-        QNameModule qm = QNameModule.create(URI.create("urn:test:bug1412"), revision);
-        QName expectedNodeType = QName.create("urn:test:bug1412:ext:definitions", "2014-07-25", "action");
-        assertEquals(expectedNodeType, action.getNodeType());
-        assertEquals("hello", action.getNodeParameter());
-        QName expectedQName = QName.create(qm, "hello");
-        assertEquals(expectedQName, action.getQName());
-
-        unknownNodes = action.getUnknownSchemaNodes();
-        assertEquals(4, unknownNodes.size());
-        UnknownSchemaNode info = null;
-        UnknownSchemaNode description = null;
-        UnknownSchemaNode actionPoint = null;
-        UnknownSchemaNode output = null;
-        for (UnknownSchemaNode un : unknownNodes) {
-            if ("info".equals(un.getNodeType().getLocalName())) {
-                info = un;
-            } else if ("description".equals(un.getNodeType().getLocalName())) {
-                description = un;
-            } else if ("actionpoint".equals(un.getNodeType().getLocalName())) {
-                actionPoint = un;
-            } else if ("output".equals(un.getNodeType().getLocalName())) {
-                output = un;
-            }
-        }
-        assertNotNull(info);
-        assertNotNull(description);
-        assertNotNull(actionPoint);
-        assertNotNull(output);
-
-        expectedNodeType = QName.create("urn:test:bug1412:ext:definitions", "2014-07-25", "info");
-        assertEquals(expectedNodeType, info.getNodeType());
-        assertEquals("greeting", info.getNodeParameter());
-
-        expectedNodeType = QName.create(qm, "description");
-        assertEquals(expectedNodeType, description.getNodeType());
-        assertEquals("say greeting", description.getNodeParameter());
-
-        expectedNodeType = QName.create("urn:test:bug1412:ext:definitions", "2014-07-25", "actionpoint");
-        assertEquals(expectedNodeType, actionPoint.getNodeType());
-        assertEquals("entry", actionPoint.getNodeParameter());
-
-        expectedNodeType = QName.create(qm, "output");
-        assertEquals(expectedNodeType, output.getNodeType());
-        assertEquals("", output.getNodeParameter());
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug1413Test.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug1413Test.java
deleted file mode 100644 (file)
index e9f09bb..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.Module;
-
-/**
- * Test ANTLR4 grammar capability to parse unknown node in extension argument
- * declaration.
- *
- * Note: Everything under unknown node is unknown node.
- */
-public class Bug1413Test {
-
-    @Test
-    public void test() throws Exception {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/bugs/bug1413").toURI());
-        Module bug1413 = TestUtils.findModule(modules, "bug1413");
-        assertNotNull(bug1413);
-
-        List<ExtensionDefinition> extensions = bug1413.getExtensionSchemaNodes();
-        assertEquals(1, extensions.size());
-
-        ExtensionDefinition info = extensions.get(0);
-        assertEquals("text", info.getArgument());
-        assertTrue(info.isYinElement());
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug2291Test.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug2291Test.java
deleted file mode 100644 (file)
index 1e19ea2..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import java.io.File;
-import java.util.Arrays;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-
-public class Bug2291Test {
-
-    @Test
-    public void testRevisionWithExt() throws Exception {
-        File extdef = new File(getClass().getResource("/bugs/bug2291/bug2291-ext.yang").toURI());
-        File bug = new File(getClass().getResource("/bugs/bug2291/bug2291.yang").toURI());
-        File inet = new File(getClass().getResource("/ietf/ietf-inet-types@2010-09-24.yang").toURI());
-        YangContextParser parser = new YangParserImpl();
-        parser.parseFiles(Arrays.asList(extdef, bug, inet));
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug3799Test.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug3799Test.java
deleted file mode 100644 (file)
index b9caef7..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collection;
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-
-public class Bug3799Test {
-
-    @Test
-    public void test() throws Exception {
-
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource(
-                "/bugs/bug3799").toURI());
-        assertNotNull(modules);
-        assertEquals(1, modules.size());
-
-        Module testModule = modules.iterator().next();
-        Set<Module> subModules = testModule.getSubmodules();
-        assertNotNull(subModules);
-        assertEquals(1, subModules.size());
-
-        Module testSubmodule = subModules.iterator().next();
-
-        Set<NotificationDefinition> notifications = testSubmodule
-                .getNotifications();
-        assertNotNull(notifications);
-        assertEquals(1, notifications.size());
-
-        NotificationDefinition bazNotification = notifications.iterator()
-                .next();
-        Collection<DataSchemaNode> childNodes = bazNotification.getChildNodes();
-        assertNotNull(childNodes);
-        assertEquals(1, childNodes.size());
-
-        DataSchemaNode child = childNodes.iterator().next();
-        assertTrue(child instanceof LeafSchemaNode);
-
-        LeafSchemaNode leafBar = (LeafSchemaNode) child;
-        String bar = leafBar.getQName().getLocalName();
-        assertEquals("bar", bar);
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug394Test.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug394Test.java
deleted file mode 100644 (file)
index 4219266..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-
-/**
- * Test antlr grammar capability to parse nested unknown nodes.
- */
-public class Bug394Test {
-
-    @Test
-    public void testParseList() throws Exception {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/bugs/bug394").toURI());
-        Module bug394 = TestUtils.findModule(modules, "bug394");
-        assertNotNull(bug394);
-        Module bug394_ext = TestUtils.findModule(modules, "bug394-ext");
-        assertNotNull(bug394_ext);
-
-        ContainerSchemaNode logrecords = (ContainerSchemaNode) bug394.getDataChildByName("logrecords");
-        assertNotNull(logrecords);
-
-        List<UnknownSchemaNode> nodes = logrecords.getUnknownSchemaNodes();
-        assertEquals(2, nodes.size());
-
-        List<ExtensionDefinition> extensions = bug394_ext.getExtensionSchemaNodes();
-        assertEquals(2, extensions.size());
-
-        assertTrue(extensions.contains(nodes.get(0).getExtensionDefinition()));
-        assertTrue(extensions.contains(nodes.get(1).getExtensionDefinition()));
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug4079Test.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug4079Test.java
deleted file mode 100644 (file)
index 626a399..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URISyntaxException;
-import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Module;
-
-public class Bug4079Test {
-
-    private Set<Module> modules;
-
-    @Test
-    public void testModuleCompilation() throws URISyntaxException, IOException {
-        modules = TestUtils.loadModules(getClass().getResource("/bugs/bug4079").toURI());
-        assertNotNull(modules);
-    }
-
-    @Test
-    public void testValidPatternFix() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        Method method = ParserListenerUtils.class.getDeclaredMethod("fixUnicodeScriptPattern", String.class);
-        assertNotNull(method);
-        assertEquals("fixUnicodeScriptPattern", method.getName());
-
-        method.setAccessible(true);
-
-        String fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsArrows})*+");
-        assertEquals("(\\p{InArrows})*+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsDingbats})++");
-        assertEquals("(\\p{InDingbats})++", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsSpecials})?+");
-        assertEquals("(\\p{InSpecials})?+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsBatak}){4}+");
-        assertEquals("(\\p{IsBatak}){4}+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsLatin}){4,6}+");
-        assertEquals("(\\p{IsLatin}){4,6}+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsTibetan}){4,}+");
-        assertEquals("(\\p{IsTibetan}){4,}+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsAlphabetic}){4}?");
-        assertEquals("(\\p{IsAlphabetic}){4}?", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsLowercase}){4,6}?");
-        assertEquals("(\\p{IsLowercase}){4,6}?", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsUppercase}){4,}?");
-        assertEquals("(\\p{IsUppercase}){4,}?", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsBasicLatin}|\\p{IsLatin-1Supplement})*");
-        assertEquals("(\\p{InBasicLatin}|\\p{InLatin-1Supplement})*", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{InBasicLatin}|\\p{InLatin-1Supplement})+");
-        assertEquals("(\\p{InBasicLatin}|\\p{InLatin-1Supplement})+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsBasicLatin}|\\p{InLatin-1Supplement})?");
-        assertEquals("(\\p{InBasicLatin}|\\p{InLatin-1Supplement})?", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{InBasicLatin}|\\p{IsLatin-1Supplement}){4}");
-        assertEquals("(\\p{InBasicLatin}|\\p{InLatin-1Supplement}){4}", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsLatin}|\\p{IsArmenian}){2,4}");
-        assertEquals("(\\p{IsLatin}|\\p{IsArmenian}){2,4}", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsLatin}|\\p{IsBasicLatin}){2,}");
-        assertEquals("(\\p{IsLatin}|\\p{InBasicLatin}){2,}", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsBasicLatin}|\\p{IsLatin})*?");
-        assertEquals("(\\p{InBasicLatin}|\\p{IsLatin})*?", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{IsBasicLatin}|\\p{IsLatin-1Supplement}" +
-                "|\\p{IsArrows})+?");
-        assertEquals("(\\p{InBasicLatin}|\\p{InLatin-1Supplement}|\\p{InArrows})+?", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null, "(\\p{InBasicLatin}|\\p{IsLatin-1Supplement}|" +
-                "\\p{IsLatin})??");
-        assertEquals("(\\p{InBasicLatin}|\\p{InLatin-1Supplement}|\\p{IsLatin})??", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\\\\\p{IsBasicLatin})*+");
-        assertEquals("(\\\\\\p{InBasicLatin})*+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\\\\\\\\\p{IsBasicLatin})*+");
-        assertEquals("(\\\\\\\\\\p{InBasicLatin})*+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-
-        fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\\\\\\\\\\\\\p{IsBasicLatin})*+");
-        assertEquals("(\\\\\\\\\\\\\\p{InBasicLatin})*+", fixedUnicodeScriptPattern);
-        assertNotNull(Pattern.compile(fixedUnicodeScriptPattern));
-    }
-
-    @Test(expected = PatternSyntaxException.class)
-    public void testInvalidPattern() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        Method method = ParserListenerUtils.class.getDeclaredMethod("fixUnicodeScriptPattern", String.class);
-        assertNotNull(method);
-        assertEquals("fixUnicodeScriptPattern", method.getName());
-
-        method.setAccessible(true);
-
-        String fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\\\p{IsBasicLatin})*+");
-        assertEquals("(\\\\p{IsBasicLatin})*+", fixedUnicodeScriptPattern);
-        // should throw exception
-        Pattern.compile(fixedUnicodeScriptPattern);
-    }
-
-    @Test(expected = PatternSyntaxException.class)
-    public void testInvalidPattern2() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        Method method = ParserListenerUtils.class.getDeclaredMethod("fixUnicodeScriptPattern", String.class);
-        assertNotNull(method);
-        assertEquals("fixUnicodeScriptPattern", method.getName());
-
-        method.setAccessible(true);
-
-        String fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\p{IsSpecials}|\\\\\\\\p{IsBasicLatin})*+");
-        assertEquals("(\\p{InSpecials}|\\\\\\\\p{IsBasicLatin})*+", fixedUnicodeScriptPattern);
-        // should throw exception
-        Pattern.compile(fixedUnicodeScriptPattern);
-    }
-
-    @Test(expected = PatternSyntaxException.class)
-    public void testInvalidPattern3() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
-        Method method = ParserListenerUtils.class.getDeclaredMethod("fixUnicodeScriptPattern", String.class);
-        assertNotNull(method);
-        assertEquals("fixUnicodeScriptPattern", method.getName());
-
-        method.setAccessible(true);
-
-        String fixedUnicodeScriptPattern = (String) method.invoke(null,"(\\\\\\\\\\\\p{IsBasicLatin}|\\p{IsTags})*+");
-        assertEquals("(\\\\\\\\\\\\p{IsBasicLatin}|\\p{IsTags})*+", fixedUnicodeScriptPattern);
-        // should throw exception
-        Pattern.compile(fixedUnicodeScriptPattern);
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/GroupingTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/GroupingTest.java
deleted file mode 100644 (file)
index fc6ed21..0000000
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.util.SchemaNodeUtils;
-
-public class GroupingTest {
-    private Set<Module> modules;
-
-    @Before
-    public void init() throws IOException, URISyntaxException {
-        modules = TestUtils.loadModules(getClass().getResource("/model").toURI());
-        assertEquals(3, modules.size());
-    }
-
-    @Test
-    public void testRefine() {
-        Module testModule = TestUtils.findModule(modules, "foo");
-        ContainerSchemaNode peer = (ContainerSchemaNode) testModule.getDataChildByName("peer");
-        ContainerSchemaNode destination = (ContainerSchemaNode) peer.getDataChildByName("destination");
-
-        Set<UsesNode> usesNodes = destination.getUses();
-        assertEquals(1, usesNodes.size());
-        UsesNode usesNode = usesNodes.iterator().next();
-        Map<SchemaPath, SchemaNode> refines = usesNode.getRefines();
-        assertEquals(4, refines.size());
-
-        LeafSchemaNode refineLeaf = null;
-        ContainerSchemaNode refineContainer = null;
-        ListSchemaNode refineList = null;
-        LeafSchemaNode refineInnerLeaf = null;
-        for (Map.Entry<SchemaPath, SchemaNode> entry : refines.entrySet()) {
-            SchemaNode value = entry.getValue();
-            if ("address".equals(value.getQName().getLocalName())) {
-                refineLeaf = (LeafSchemaNode) value;
-            } else if ("port".equals(value.getQName().getLocalName())) {
-                refineContainer = (ContainerSchemaNode) value;
-            } else if ("addresses".equals(value.getQName().getLocalName())) {
-                refineList = (ListSchemaNode) value;
-            } else if ("id".equals(value.getQName().getLocalName())) {
-                refineInnerLeaf = (LeafSchemaNode) value;
-            }
-        }
-
-        // leaf address
-        assertNotNull(refineLeaf);
-        assertEquals("IP address of target node", refineLeaf.getDescription());
-        assertEquals("address reference added by refine", refineLeaf.getReference());
-        assertFalse(refineLeaf.isConfiguration());
-        assertFalse(refineLeaf.getConstraints().isMandatory());
-        Set<MustDefinition> leafMustConstraints = refineLeaf.getConstraints().getMustConstraints();
-        assertEquals(1, leafMustConstraints.size());
-        MustDefinition leafMust = leafMustConstraints.iterator().next();
-        assertEquals("\"ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)\"", leafMust.toString());
-        assertEquals(1, refineLeaf.getUnknownSchemaNodes().size());
-
-        // container port
-        assertNotNull(refineContainer);
-        Set<MustDefinition> mustConstraints = refineContainer.getConstraints().getMustConstraints();
-        assertTrue(mustConstraints.isEmpty());
-        assertEquals("description of port defined by refine", refineContainer.getDescription());
-        assertEquals("port reference added by refine", refineContainer.getReference());
-        assertFalse(refineContainer.isConfiguration());
-        assertTrue(refineContainer.isPresenceContainer());
-
-        // list addresses
-        assertNotNull(refineList);
-        assertEquals("description of addresses defined by refine", refineList.getDescription());
-        assertEquals("addresses reference added by refine", refineList.getReference());
-        assertFalse(refineList.isConfiguration());
-        assertEquals(2, (int) refineList.getConstraints().getMinElements());
-        assertEquals(Integer.MAX_VALUE, (int) refineList.getConstraints().getMaxElements());
-
-        // leaf id
-        assertNotNull(refineInnerLeaf);
-        assertEquals("id of address", refineInnerLeaf.getDescription());
-    }
-
-    @Test
-    public void testGrouping() {
-        Module testModule = TestUtils.findModule(modules, "baz");
-        Set<GroupingDefinition> groupings = testModule.getGroupings();
-        assertEquals(1, groupings.size());
-        GroupingDefinition grouping = groupings.iterator().next();
-        Collection<DataSchemaNode> children = grouping.getChildNodes();
-        assertEquals(5, children.size());
-    }
-
-    @Test
-    public void testUses() {
-        // suffix _u = added by uses
-        // suffix _g = defined in grouping
-
-        Module testModule = TestUtils.findModule(modules, "baz");
-
-        // get grouping
-        Set<GroupingDefinition> groupings = testModule.getGroupings();
-        assertEquals(1, groupings.size());
-        GroupingDefinition grouping = groupings.iterator().next();
-
-        testModule = TestUtils.findModule(modules, "foo");
-
-        // get node containing uses
-        ContainerSchemaNode peer = (ContainerSchemaNode) testModule.getDataChildByName("peer");
-        ContainerSchemaNode destination = (ContainerSchemaNode) peer.getDataChildByName("destination");
-
-        // check uses
-        Set<UsesNode> uses = destination.getUses();
-        assertEquals(1, uses.size());
-
-        // check uses process
-        AnyXmlSchemaNode data_u = (AnyXmlSchemaNode) destination.getDataChildByName("data");
-        assertNotNull(data_u);
-        assertTrue(data_u.isAddedByUses());
-
-        AnyXmlSchemaNode data_g = (AnyXmlSchemaNode) grouping.getDataChildByName("data");
-        assertNotNull(data_g);
-        assertFalse(data_g.isAddedByUses());
-        assertFalse(data_u.equals(data_g));
-        assertEquals(data_g,  SchemaNodeUtils.getRootOriginalIfPossible(data_u));
-
-        ChoiceSchemaNode how_u = (ChoiceSchemaNode) destination.getDataChildByName("how");
-        assertNotNull(how_u);
-        TestUtils.checkIsAddedByUses(how_u, true);
-        assertEquals(2, how_u.getCases().size());
-
-        ChoiceSchemaNode how_g = (ChoiceSchemaNode) grouping.getDataChildByName("how");
-        assertNotNull(how_g);
-        TestUtils.checkIsAddedByUses(how_g, false);
-        assertEquals(2, how_g.getCases().size());
-        assertFalse(how_u.equals(how_g));
-        assertEquals(how_g, SchemaNodeUtils.getRootOriginalIfPossible(how_u));
-
-        LeafSchemaNode address_u = (LeafSchemaNode) destination.getDataChildByName("address");
-        assertNotNull(address_u);
-        assertEquals("1.2.3.4", address_u.getDefault());
-        assertEquals("IP address of target node", address_u.getDescription());
-        assertEquals("address reference added by refine", address_u.getReference());
-        assertFalse(address_u.isConfiguration());
-        assertTrue(address_u.isAddedByUses());
-        assertFalse(address_u.getConstraints().isMandatory());
-
-        LeafSchemaNode address_g = (LeafSchemaNode) grouping.getDataChildByName("address");
-        assertNotNull(address_g);
-        assertFalse(address_g.isAddedByUses());
-        assertNull(address_g.getDefault());
-        assertEquals("Target IP address", address_g.getDescription());
-        assertNull(address_g.getReference());
-        assertTrue(address_g.isConfiguration());
-        assertFalse(address_u.equals(address_g));
-        assertTrue(address_g.getConstraints().isMandatory());
-        assertEquals(address_g, SchemaNodeUtils.getRootOriginalIfPossible(address_u));
-
-        ContainerSchemaNode port_u = (ContainerSchemaNode) destination.getDataChildByName("port");
-        assertNotNull(port_u);
-        TestUtils.checkIsAddedByUses(port_u, true);
-
-        ContainerSchemaNode port_g = (ContainerSchemaNode) grouping.getDataChildByName("port");
-        assertNotNull(port_g);
-        TestUtils.checkIsAddedByUses(port_g, false);
-        assertFalse(port_u.equals(port_g));
-        assertEquals(port_g, SchemaNodeUtils.getRootOriginalIfPossible(port_u));
-
-        ListSchemaNode addresses_u = (ListSchemaNode) destination.getDataChildByName("addresses");
-        assertNotNull(addresses_u);
-        TestUtils.checkIsAddedByUses(addresses_u, true);
-
-        ListSchemaNode addresses_g = (ListSchemaNode) grouping.getDataChildByName("addresses");
-        assertNotNull(addresses_g);
-        TestUtils.checkIsAddedByUses(addresses_g, false);
-        assertFalse(addresses_u.equals(addresses_g));
-        assertEquals(addresses_g, SchemaNodeUtils.getRootOriginalIfPossible(addresses_u));
-
-        // grouping defined by 'uses'
-        Set<GroupingDefinition> groupings_u = destination.getGroupings();
-        assertEquals(1, groupings_u.size());
-        GroupingDefinition grouping_u = groupings_u.iterator().next();
-        TestUtils.checkIsAddedByUses(grouping_u, true);
-
-        // grouping defined in 'grouping' node
-        Set<GroupingDefinition> groupings_g = grouping.getGroupings();
-        assertEquals(1, groupings_g.size());
-        GroupingDefinition grouping_g = groupings_g.iterator().next();
-        TestUtils.checkIsAddedByUses(grouping_g, false);
-        assertFalse(grouping_u.equals(grouping_g));
-
-        List<UnknownSchemaNode> nodes_u = destination.getUnknownSchemaNodes();
-        assertEquals(1, nodes_u.size());
-        UnknownSchemaNode node_u = nodes_u.get(0);
-        assertTrue(node_u.isAddedByUses());
-
-        List<UnknownSchemaNode> nodes_g = grouping.getUnknownSchemaNodes();
-        assertEquals(1, nodes_g.size());
-        UnknownSchemaNode node_g = nodes_g.get(0);
-        assertFalse(node_g.isAddedByUses());
-        assertFalse(node_u.equals(node_g));
-    }
-
-    @Test
-    public void testUsesUnderModule() {
-        // suffix _u = added by uses
-        // suffix _g = defined in grouping
-
-        Module testModule = TestUtils.findModule(modules, "baz");
-
-        // get grouping
-        Set<GroupingDefinition> groupings = testModule.getGroupings();
-        assertEquals(1, groupings.size());
-        GroupingDefinition grouping = groupings.iterator().next();
-
-        // get node containing uses
-        Module foo = TestUtils.findModule(modules, "foo");
-
-        // check uses
-        Set<UsesNode> uses = foo.getUses();
-        assertEquals(1, uses.size());
-
-        // check uses process
-        AnyXmlSchemaNode data_u = (AnyXmlSchemaNode) foo.getDataChildByName("data");
-        assertNotNull(data_u);
-        assertTrue(data_u.isAddedByUses());
-
-        AnyXmlSchemaNode data_g = (AnyXmlSchemaNode) grouping.getDataChildByName("data");
-        assertNotNull(data_g);
-        assertFalse(data_g.isAddedByUses());
-        assertFalse(data_u.equals(data_g));
-        assertEquals(data_g, SchemaNodeUtils.getRootOriginalIfPossible(data_u));
-
-        ChoiceSchemaNode how_u = (ChoiceSchemaNode) foo.getDataChildByName("how");
-        assertNotNull(how_u);
-        TestUtils.checkIsAddedByUses(how_u, true);
-        assertFalse(how_u.isAugmenting());
-        Set<ChoiceCaseNode> cases_u = how_u.getCases();
-        assertEquals(2, cases_u.size());
-        ChoiceCaseNode interval = how_u.getCaseNodeByName("interval");
-        assertFalse(interval.isAugmenting());
-        LeafSchemaNode name = (LeafSchemaNode) interval.getDataChildByName("name");
-        assertTrue(name.isAugmenting());
-        LeafSchemaNode intervalLeaf = (LeafSchemaNode) interval.getDataChildByName("interval");
-        assertFalse(intervalLeaf.isAugmenting());
-
-        ChoiceSchemaNode how_g = (ChoiceSchemaNode) grouping.getDataChildByName("how");
-        assertNotNull(how_g);
-        TestUtils.checkIsAddedByUses(how_g, false);
-        assertFalse(how_u.equals(how_g));
-        assertEquals(how_g, SchemaNodeUtils.getRootOriginalIfPossible(how_u));
-
-        LeafSchemaNode address_u = (LeafSchemaNode) foo.getDataChildByName("address");
-        assertNotNull(address_u);
-        assertNull(address_u.getDefault());
-        assertEquals("Target IP address", address_u.getDescription());
-        assertNull(address_u.getReference());
-        assertTrue(address_u.isConfiguration());
-        assertTrue(address_u.isAddedByUses());
-
-        LeafSchemaNode address_g = (LeafSchemaNode) grouping.getDataChildByName("address");
-        assertNotNull(address_g);
-        assertFalse(address_g.isAddedByUses());
-        assertNull(address_g.getDefault());
-        assertEquals("Target IP address", address_g.getDescription());
-        assertNull(address_g.getReference());
-        assertTrue(address_g.isConfiguration());
-        assertFalse(address_u.equals(address_g));
-        assertEquals(address_g, SchemaNodeUtils.getRootOriginalIfPossible(address_u));
-
-        ContainerSchemaNode port_u = (ContainerSchemaNode) foo.getDataChildByName("port");
-        assertNotNull(port_u);
-        TestUtils.checkIsAddedByUses(port_u, true);
-
-        ContainerSchemaNode port_g = (ContainerSchemaNode) grouping.getDataChildByName("port");
-        assertNotNull(port_g);
-        TestUtils.checkIsAddedByUses(port_g, false);
-        assertFalse(port_u.equals(port_g));
-        assertEquals(port_g, SchemaNodeUtils.getRootOriginalIfPossible(port_u));
-
-        ListSchemaNode addresses_u = (ListSchemaNode) foo.getDataChildByName("addresses");
-        assertNotNull(addresses_u);
-        TestUtils.checkIsAddedByUses(addresses_u, true);
-
-        ListSchemaNode addresses_g = (ListSchemaNode) grouping.getDataChildByName("addresses");
-        assertNotNull(addresses_g);
-        TestUtils.checkIsAddedByUses(addresses_g, false);
-        assertFalse(addresses_u.equals(addresses_g));
-        assertEquals(addresses_g, SchemaNodeUtils.getRootOriginalIfPossible(addresses_u));
-
-        // grouping defined by 'uses'
-        Set<GroupingDefinition> groupings_u = foo.getGroupings();
-        assertEquals(1, groupings_u.size());
-        GroupingDefinition grouping_u = groupings_u.iterator().next();
-        TestUtils.checkIsAddedByUses(grouping_u, true);
-
-        // grouping defined in 'grouping' node
-        Set<GroupingDefinition> groupings_g = grouping.getGroupings();
-        assertEquals(1, groupings_g.size());
-        GroupingDefinition grouping_g = groupings_g.iterator().next();
-        TestUtils.checkIsAddedByUses(grouping_g, false);
-        assertFalse(grouping_u.equals(grouping_g));
-
-        List<UnknownSchemaNode> nodes_u = foo.getUnknownSchemaNodes();
-        assertEquals(1, nodes_u.size());
-        UnknownSchemaNode node_u = nodes_u.get(0);
-        assertTrue(node_u.isAddedByUses());
-
-        List<UnknownSchemaNode> nodes_g = grouping.getUnknownSchemaNodes();
-        assertEquals(1, nodes_g.size());
-        UnknownSchemaNode node_g = nodes_g.get(0);
-        assertFalse(node_g.isAddedByUses());
-        assertFalse(node_u.equals(node_g));
-
-        UsesNode un = uses.iterator().next();
-        Set<AugmentationSchema> usesAugments = un.getAugmentations();
-        assertEquals(1, usesAugments.size());
-        AugmentationSchema augment = usesAugments.iterator().next();
-        assertEquals("inner augment", augment.getDescription());
-        Collection<DataSchemaNode> children = augment.getChildNodes();
-        assertEquals(1, children.size());
-        DataSchemaNode leaf = children.iterator().next();
-        assertTrue(leaf instanceof LeafSchemaNode);
-        assertEquals("name", leaf.getQName().getLocalName());
-    }
-
-    @Test
-    public void testCascadeUses() throws Exception {
-        File yangFile = new File(getClass().getResource("/grouping-test/cascade-uses.yang").toURI());
-        YangContextParser parser = new YangParserImpl();
-        modules = parser.parseFiles(Collections.singleton(yangFile)).getModules();
-        assertEquals(1, modules.size());
-
-        Module testModule = TestUtils.findModule(modules, "cascade-uses");
-        Set<GroupingDefinition> groupings = testModule.getGroupings();
-
-        GroupingDefinition gu = null;
-        GroupingDefinition gv = null;
-        GroupingDefinition gx = null;
-        GroupingDefinition gy = null;
-        GroupingDefinition gz = null;
-        GroupingDefinition gzz = null;
-        for (GroupingDefinition gd : groupings) {
-            String name = gd.getQName().getLocalName();
-            switch (name) {
-            case "grouping-U":
-                gu = gd;
-                break;
-            case "grouping-V":
-                gv = gd;
-                break;
-            case "grouping-X":
-                gx = gd;
-                break;
-            case "grouping-Y":
-                gy = gd;
-                break;
-            case "grouping-Z":
-                gz = gd;
-                break;
-            case "grouping-ZZ":
-                gzz = gd;
-                break;
-            }
-        }
-        assertNotNull(gu);
-        assertNotNull(gv);
-        assertNotNull(gx);
-        assertNotNull(gy);
-        assertNotNull(gz);
-        assertNotNull(gzz);
-
-        URI expectedNS = URI.create("urn:grouping:cascade-uses");
-        Date expectedRev = new SimpleDateFormat("yyyy-MM-dd").parse("2013-07-18");
-        String expectedPref = "cu";
-        SchemaPath expectedPath;
-
-        // grouping-U
-        Collection<DataSchemaNode> childNodes = gu.getChildNodes();
-        assertEquals(7, childNodes.size());
-
-        LeafSchemaNode leafGroupingU = (LeafSchemaNode) gu.getDataChildByName("leaf-grouping-U");
-        assertNotNull(leafGroupingU);
-        assertFalse(leafGroupingU.isAddedByUses());
-        assertFalse(SchemaNodeUtils.getOriginalIfPossible(leafGroupingU).isPresent());
-
-        for (DataSchemaNode childNode : childNodes) {
-            if (!(childNode.getQName().equals(leafGroupingU.getQName()))) {
-                TestUtils.checkIsAddedByUses(childNode, true);
-            }
-        }
-
-        // grouping-V
-        childNodes = gv.getChildNodes();
-        assertEquals(4, childNodes.size());
-        LeafSchemaNode leafGroupingV = null;
-        ContainerSchemaNode containerGroupingV = null;
-        for (DataSchemaNode childNode : childNodes) {
-            if ("leaf-grouping-V".equals(childNode.getQName().getLocalName())) {
-                leafGroupingV = (LeafSchemaNode) childNode;
-            } else if ("container-grouping-V".equals(childNode.getQName().getLocalName())) {
-                containerGroupingV = (ContainerSchemaNode) childNode;
-            } else {
-                TestUtils.checkIsAddedByUses(childNode, true);
-            }
-        }
-        assertNotNull(leafGroupingV);
-        assertFalse(leafGroupingV.isAddedByUses());
-
-        // grouping-V/container-grouping-V
-        assertNotNull(containerGroupingV);
-        assertFalse(containerGroupingV.isAddedByUses());
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-V",
-                "container-grouping-V");
-        assertEquals(expectedPath, containerGroupingV.getPath());
-        childNodes = containerGroupingV.getChildNodes();
-        assertEquals(2, childNodes.size());
-        for (DataSchemaNode childNode : childNodes) {
-            TestUtils.checkIsAddedByUses(childNode, true);
-        }
-
-        // grouping-V/container-grouping-V/leaf-grouping-X
-        LeafSchemaNode leafXinContainerV = (LeafSchemaNode) containerGroupingV.getDataChildByName("leaf-grouping-X");
-        assertNotNull(leafXinContainerV);
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-V",
-                "container-grouping-V", "leaf-grouping-X");
-        assertEquals(expectedPath, leafXinContainerV.getPath());
-        // grouping-V/container-grouping-V/leaf-grouping-Y
-        LeafSchemaNode leafYinContainerV = (LeafSchemaNode) containerGroupingV.getDataChildByName("leaf-grouping-Y");
-        assertNotNull(leafYinContainerV);
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-V",
-                "container-grouping-V", "leaf-grouping-Y");
-        assertEquals(expectedPath, leafYinContainerV.getPath());
-
-        // grouping-X
-        childNodes = gx.getChildNodes();
-        assertEquals(2, childNodes.size());
-
-        // grouping-X/leaf-grouping-X
-        LeafSchemaNode leafXinGX = (LeafSchemaNode) gx.getDataChildByName("leaf-grouping-X");
-        assertNotNull(leafXinGX);
-        assertFalse(leafXinGX.isAddedByUses());
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-X",
-                "leaf-grouping-X");
-        assertEquals(expectedPath, leafXinGX.getPath());
-
-        // grouping-X/leaf-grouping-Y
-        LeafSchemaNode leafYinGX = (LeafSchemaNode) gx.getDataChildByName("leaf-grouping-Y");
-        assertNotNull(leafYinGX);
-        assertTrue(leafYinGX.isAddedByUses());
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-X",
-                "leaf-grouping-Y");
-        assertEquals(expectedPath, leafYinGX.getPath());
-
-        // grouping-Y
-        childNodes = gy.getChildNodes();
-        assertEquals(1, childNodes.size());
-
-        // grouping-Y/leaf-grouping-Y
-        LeafSchemaNode leafYinGY = (LeafSchemaNode) gy.getDataChildByName("leaf-grouping-Y");
-        assertNotNull(leafYinGY);
-        assertFalse(leafYinGY.isAddedByUses());
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-Y",
-                "leaf-grouping-Y");
-        assertEquals(expectedPath, leafYinGY.getPath());
-
-        // grouping-Z
-        childNodes = gz.getChildNodes();
-        assertEquals(1, childNodes.size());
-
-        // grouping-Z/leaf-grouping-Z
-        LeafSchemaNode leafZinGZ = (LeafSchemaNode) gz.getDataChildByName("leaf-grouping-Z");
-        assertNotNull(leafZinGZ);
-        assertFalse(leafZinGZ.isAddedByUses());
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-Z",
-                "leaf-grouping-Z");
-        assertEquals(expectedPath, leafZinGZ.getPath());
-
-        // grouping-ZZ
-        childNodes = gzz.getChildNodes();
-        assertEquals(1, childNodes.size());
-
-        // grouping-ZZ/leaf-grouping-ZZ
-        LeafSchemaNode leafZZinGZZ = (LeafSchemaNode) gzz.getDataChildByName("leaf-grouping-ZZ");
-        assertNotNull(leafZZinGZZ);
-        assertFalse(leafZZinGZZ.isAddedByUses());
-        expectedPath = TestUtils.createPath(true, expectedNS, expectedRev, expectedPref, "grouping-ZZ",
-                "leaf-grouping-ZZ");
-        assertEquals(expectedPath, leafZZinGZZ.getPath());
-
-        // TEST getOriginal from grouping-U
-        assertEquals(gv.getDataChildByName("leaf-grouping-V"), SchemaNodeUtils.getRootOriginalIfPossible(gu.getDataChildByName("leaf-grouping-V")));
-        containerGroupingV = (ContainerSchemaNode) gu.getDataChildByName("container-grouping-V");
-        assertEquals(gv.getDataChildByName("container-grouping-V"), SchemaNodeUtils.getRootOriginalIfPossible(containerGroupingV));
-        assertEquals(gx.getDataChildByName("leaf-grouping-X"), SchemaNodeUtils.getRootOriginalIfPossible(containerGroupingV.getDataChildByName("leaf-grouping-X")
-                ));
-        assertEquals(gy.getDataChildByName("leaf-grouping-Y"), SchemaNodeUtils.getRootOriginalIfPossible(containerGroupingV.getDataChildByName("leaf-grouping-Y")
-                ));
-
-        assertEquals(gz.getDataChildByName("leaf-grouping-Z"), SchemaNodeUtils.getRootOriginalIfPossible(gu.getDataChildByName("leaf-grouping-Z")));
-        assertEquals(gzz.getDataChildByName("leaf-grouping-ZZ"), SchemaNodeUtils.getRootOriginalIfPossible(gu.getDataChildByName("leaf-grouping-ZZ")
-                ));
-
-        // TEST getOriginal from grouping-V
-        assertEquals(gz.getDataChildByName("leaf-grouping-Z"), SchemaNodeUtils.getRootOriginalIfPossible(gv.getDataChildByName("leaf-grouping-Z")));
-        assertEquals(gzz.getDataChildByName("leaf-grouping-ZZ"), SchemaNodeUtils.getRootOriginalIfPossible(gv.getDataChildByName("leaf-grouping-ZZ")
-                ));
-
-        // TEST getOriginal from grouping-X
-        assertEquals(gy.getDataChildByName("leaf-grouping-Y"),SchemaNodeUtils.getRootOriginalIfPossible( gx.getDataChildByName("leaf-grouping-Y")));
-    }
-
-    @Test
-    public void testAddedByUsesLeafTypeQName() throws IOException,
-            URISyntaxException {
-
-        Set<Module> loadModules = TestUtils.loadModules(getClass().getResource(
-                "/added-by-uses-leaf-test").toURI());
-
-        assertEquals(2, loadModules.size());
-
-        Module foo = null;
-        Module imp = null;
-        for (Module module : loadModules) {
-            if (module.getName().equals("foo")) {
-                foo = module;
-            }
-            if (module.getName().equals("import-module")) {
-                imp = module;
-            }
-        }
-
-        LeafSchemaNode leaf = (LeafSchemaNode) ((ContainerSchemaNode) foo
-                .getDataChildByName("my-container"))
-                .getDataChildByName("my-leaf");
-
-        TypeDefinition<?> impType = null;
-        Set<TypeDefinition<?>> typeDefinitions = imp.getTypeDefinitions();
-        for (TypeDefinition<?> typeDefinition : typeDefinitions) {
-            if (typeDefinition.getQName().getLocalName().equals("imp-type")) {
-                impType = typeDefinition;
-                break;
-            }
-        }
-
-        assertEquals(leaf.getType().getQName(), impType.getQName());
-
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ListKeysTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ListKeysTest.java
deleted file mode 100644 (file)
index 41d3b08..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-public class ListKeysTest {
-
-    @Test
-    public void correctListKeysTest() throws IOException, YangSyntaxErrorException, URISyntaxException {
-        File yangFile = new File(getClass().getResource("/list-keys-test/correct-list-keys-test.yang").toURI());
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        parser.parseFile(yangFile, yangFile.getParentFile());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void incorrectListKeysTest1() throws IOException, YangSyntaxErrorException, URISyntaxException {
-        File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test.yang").toURI());
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        parser.parseFile(yangFile, yangFile.getParentFile());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void incorrectListKeysTest2() throws IOException, YangSyntaxErrorException, URISyntaxException {
-        File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test2.yang").toURI());
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        parser.parseFile(yangFile, yangFile.getParentFile());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void incorrectListKeysTest3() throws IOException, YangSyntaxErrorException, URISyntaxException {
-        File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test3.yang").toURI());
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        parser.parseFile(yangFile, yangFile.getParentFile());
-    }
-
-    @Test(expected = YangParseException.class)
-    public void incorrectListKeysTest4() throws IOException, YangSyntaxErrorException, URISyntaxException {
-        File yangFile = new File(getClass().getResource("/list-keys-test/incorrect-list-keys-test4.yang").toURI());
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        parser.parseFile(yangFile, yangFile.getParentFile());
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/OrderingTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/OrderingTest.java
deleted file mode 100644 (file)
index 8aabb81..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-
-public class OrderingTest {
-
-    @Test
-    public void testOrderingTypedef() throws IOException, URISyntaxException {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/model").toURI());
-        Module bar = TestUtils.findModule(modules, "bar");
-        Set<TypeDefinition<?>> typedefs = bar.getTypeDefinitions();
-        String[] expectedOrder = new String[] { "int32-ext1", "int32-ext2", "invalid-string-pattern",
-            "multiple-pattern-string", "my-decimal-type", "my-union", "my-union-ext", "nested-union2",
-            "string-ext1", "string-ext2", "string-ext3", "string-ext4" };
-        String[] actualOrder = new String[typedefs.size()];
-
-        int i = 0;
-        for (TypeDefinition<?> type : typedefs) {
-            actualOrder[i] = type.getQName().getLocalName();
-            i++;
-        }
-        assertArrayEquals(expectedOrder, actualOrder);
-    }
-
-    @Test
-    public void testOrderingChildNodes() throws IOException, URISyntaxException {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/model").toURI());
-        Module foo = TestUtils.findModule(modules, "foo");
-        AugmentationSchema augment1 = null;
-        for (AugmentationSchema as : foo.getAugmentations()) {
-            if ("if:ifType='ds0'".equals(as.getWhenCondition().toString())) {
-                augment1 = as;
-                break;
-            }
-        }
-        assertNotNull(augment1);
-
-        String[] expectedOrder = new String[] { "ds0ChannelNumber", "interface-id", "my-type", "schemas", "odl" };
-        String[] actualOrder = new String[expectedOrder.length];
-
-        int i = 0;
-        for (DataSchemaNode augmentChild : augment1.getChildNodes()) {
-            actualOrder[i] = augmentChild.getQName().getLocalName();
-            i++;
-        }
-
-        assertArrayEquals(expectedOrder, actualOrder);
-    }
-
-    @Test
-    public void testOrderingNestedChildNodes1() throws IOException, URISyntaxException {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/model").toURI());
-        Module foo = TestUtils.findModule(modules, "foo");
-
-        Collection<DataSchemaNode> childNodes = foo.getChildNodes();
-        String[] expectedOrder = new String[] { "int32-leaf", "string-leaf", "invalid-pattern-string-leaf",
-                "invalid-direct-string-pattern-def-leaf", "multiple-pattern-string-leaf",
-                "multiple-pattern-direct-string-def-leaf", "length-leaf", "decimal-leaf", "decimal-leaf2", "ext",
-                "union-leaf", "custom-union-leaf", "transfer", "datas", "mycont", "data", "how", "address", "port",
-                "addresses", "peer", "id", "foo-id","sub-ext", "sub-transfer", "sub-datas" };
-        String[] actualOrder = new String[childNodes.size()];
-
-        int i = 0;
-        for (DataSchemaNode child : childNodes) {
-            actualOrder[i] = child.getQName().getLocalName();
-            i++;
-        }
-        assertArrayEquals(expectedOrder, actualOrder);
-    }
-
-    @Test
-    public void testOrderingNestedChildNodes2() throws IOException, URISyntaxException {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/model").toURI());
-        Module baz = TestUtils.findModule(modules, "baz");
-        Set<GroupingDefinition> groupings = baz.getGroupings();
-        assertEquals(1, groupings.size());
-        GroupingDefinition target = groupings.iterator().next();
-
-        Collection<DataSchemaNode> childNodes = target.getChildNodes();
-        String[] expectedOrder = new String[] { "data", "how", "address", "port", "addresses" };
-        String[] actualOrder = new String[childNodes.size()];
-
-        int i = 0;
-        for (DataSchemaNode child : childNodes) {
-            actualOrder[i] = child.getQName().getLocalName();
-            i++;
-        }
-        assertArrayEquals(expectedOrder, actualOrder);
-    }
-
-    @Test
-    public void testOrderingNestedChildNodes3() throws Exception {
-        Module baz = TestUtils.loadModule(getClass().getResourceAsStream("/ordering/foo.yang"));
-        ContainerSchemaNode x = (ContainerSchemaNode) baz.getDataChildByName("x");
-        Collection<DataSchemaNode> childNodes = x.getChildNodes();
-
-        String[] expectedOrder = new String[] { "x15", "x10", "x5", "x1", "a5", "a1", "x2", "b5", "b1", "x3", "ax15", "ax5" };
-        String[] actualOrder = new String[childNodes.size()];
-
-        int i = 0;
-        for (DataSchemaNode child : childNodes) {
-            actualOrder[i] = child.getQName().getLocalName();
-            i++;
-        }
-        assertArrayEquals(expectedOrder, actualOrder);
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ParsingExtensionValueTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ParsingExtensionValueTest.java
deleted file mode 100644 (file)
index 404b208..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Module;
-
-/**
- * Test for testing of extensions and their arguments.
- *
- * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
- */
-public class ParsingExtensionValueTest {
-
-    private Set<Module> modules;
-
-    @Before
-    public void init() throws Exception {
-        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-
-        modules = TestUtils.loadModules(getClass().getResource("/extensions").toURI());
-        assertEquals(2, modules.size());
-    }
-
-    @Test
-    public void parsingExtensionArgsTest() {
-
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/SameQNamesInChoiceTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/SameQNamesInChoiceTest.java
deleted file mode 100644 (file)
index 9aef068..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-import java.net.URI;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-public class SameQNamesInChoiceTest {
-
-    @Rule
-    public ExpectedException thrown = ExpectedException.none();
-
-    @Test
-    public void testSameQNameInChoice() throws Exception {
-        thrown.expect(YangParseException.class);
-        thrown.expectMessage("Choice has two nodes case with same qnames");
-
-        SchemaContext context;
-        File yangFile = new File(getClass().getResource("/bugs/qnameDuplicity/two-same-node-in-choice/two-same-nodes-in-choice-case.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/bugs/qnameDuplicity/two-same-node-in-choice").toURI());
-        YangContextParser parser = new YangParserImpl();
-        context = parser.parseFile(yangFile, dependenciesDir);
-
-        Module testModule = context.findModuleByNamespace(URI.create("urn:test:two:same-nodes-in-choice-case")).iterator().next();
-        assertNotNull(testModule);
-    }
-
-
-    @Test
-    public void testAugmentedNodeIntoChoiceCase() throws Exception {
-        thrown.expect(YangParseException.class);
-        thrown.expectMessage("Choice has two nodes case with same qnames");
-
-        SchemaContext context;
-        File yangFile = new File(getClass().getResource("/bugs/qnameDuplicity/augment/two-cases.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/bugs/qnameDuplicity/augment").toURI());
-        YangContextParser parser = new YangParserImpl();
-        context = parser.parseFile(yangFile, dependenciesDir);
-
-        Module testModule = context.findModuleByNamespace(URI.create("urn:test:two:cases")).iterator().next();
-        assertNotNull(testModule);
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/SchemaContextTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/SchemaContextTest.java
deleted file mode 100644 (file)
index b358ea8..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-
-import com.google.common.collect.ImmutableSet;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.ParseException;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Map;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-
-public class SchemaContextTest {
-    @Mock
-    private Module oldModule;
-
-    @Mock
-    private Module newModule;
-
-    private Map<ModuleIdentifier, String> sources;
-
-    private URI ns;
-    private Date oldDate;
-    private Date newDate;
-
-    @Before
-    public void setUp() throws ParseException, URISyntaxException {
-        MockitoAnnotations.initMocks(this);
-
-        ns = new URI("http://abc");
-        oldDate = SimpleDateFormatUtil.getRevisionFormat().parse("2014-07-20");
-        newDate = SimpleDateFormatUtil.getRevisionFormat().parse("2014-07-22");
-
-        doReturn("abc").when(oldModule).getName();
-        doReturn(oldDate).when(oldModule).getRevision();
-        doReturn(ns).when(oldModule).getNamespace();
-        doReturn("abc").when(newModule).getName();
-        doReturn(newDate).when(newModule).getRevision();
-        doReturn(ns).when(newModule).getNamespace();
-
-        sources = Collections.emptyMap();
-    }
-
-    @Test
-    public void testModuleOrdering() {
-        SchemaContext sc;
-        Module m;
-
-        sc = new SchemaContextImpl(ImmutableSet.of(newModule, oldModule), sources);
-        m = sc.findModuleByName("abc", null);
-        assertEquals(newDate, m.getRevision());
-        m = sc.findModuleByNamespaceAndRevision(ns, null);
-        assertEquals(newDate, m.getRevision());
-
-        sc = new SchemaContextImpl(ImmutableSet.of(oldModule, newModule), sources);
-        m = sc.findModuleByName("abc", null);
-        assertEquals(newDate, m.getRevision());
-        m = sc.findModuleByNamespaceAndRevision(ns, null);
-        assertEquals(newDate, m.getRevision());
-    }
-
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TestUtils.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TestUtils.java
deleted file mode 100644 (file)
index dcbaa85..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import com.google.common.io.ByteSource;
-import com.google.common.io.ByteStreams;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils;
-import org.opendaylight.yangtools.yang.parser.util.NamedByteArrayInputStream;
-
-final class TestUtils {
-
-    private TestUtils() {
-    }
-
-    public static SchemaContext loadSchemaContext(final URI resourceDirectory)
-            throws IOException {
-        final YangContextParser parser = new YangParserImpl();
-        final File testDir = new File(resourceDirectory);
-        final String[] fileList = testDir.list();
-        final List<File> testFiles = new ArrayList<>();
-        if (fileList == null) {
-            throw new FileNotFoundException(resourceDirectory.toString());
-        }
-        for (String fileName : fileList) {
-            testFiles.add(new File(testDir, fileName));
-        }
-        return parser.parseFiles(testFiles);
-    }
-
-    public static Set<Module> loadModules(final URI resourceDirectory)
-            throws IOException {
-        return loadSchemaContext(resourceDirectory).getModules();
-    }
-
-    public static Set<Module> loadModules(final List<InputStream> input) throws IOException, YangSyntaxErrorException {
-        Collection<ByteSource> sources = BuilderUtils.streamsToByteSources(input);
-        final YangContextParser parser = new YangParserImpl();
-        SchemaContext ctx = parser.parseSources(sources);
-        return ctx.getModules();
-    }
-
-    public static Module loadModule(final InputStream stream) throws IOException, YangSyntaxErrorException {
-        final YangContextParser parser = new YangParserImpl();
-        ByteSource source = new ByteSource() {
-            @Override
-            public InputStream openStream() throws IOException {
-                return NamedByteArrayInputStream.create(stream);
-            }
-        };
-        final Collection<ByteSource> sources = Collections.singletonList(source);
-        SchemaContext ctx = parser.parseSources(sources);
-        return ctx.getModules().iterator().next();
-    }
-
-    public static Module loadModuleWithContext(final String name, final InputStream stream, final SchemaContext context)
-            throws IOException, YangSyntaxErrorException {
-        final YangContextParser parser = new YangParserImpl();
-
-        final byte[] streamContent = ByteStreams.toByteArray(stream);
-
-        ByteSource source = new ByteSource() {
-            @Override
-            public InputStream openStream() throws IOException {
-                return new ByteArrayInputStream(streamContent);
-            }
-        };
-
-        final Collection<ByteSource> sources = Collections.singletonList(source);
-        SchemaContext ctx = parser.parseSources(sources, context);
-        final Set<Module> modules = ctx.getModules();
-        stream.close();
-        Module result = null;
-        for (Module module : modules) {
-            if (module.getName().equals(name)) {
-                result = module;
-                break;
-            }
-        }
-        return result;
-    }
-
-    public static Set<Module> loadModulesWithContext(final Collection<InputStream> input, final SchemaContext context)
-            throws IOException, YangSyntaxErrorException {
-        Collection<ByteSource> sources = BuilderUtils.streamsToByteSources(input);
-        final YangContextParser parser = new YangParserImpl();
-        SchemaContext ctx = parser.parseSources(sources, context);
-        final Set<Module> modules = ctx.getModules();
-        return modules;
-    }
-
-    public static Module findModule(final Set<Module> modules, final String moduleName) {
-        Module result = null;
-        for (Module module : modules) {
-            if (module.getName().equals(moduleName)) {
-                result = module;
-                break;
-            }
-        }
-        return result;
-    }
-
-    public static ModuleImport findImport(final Set<ModuleImport> imports, final String prefix) {
-        ModuleImport result = null;
-        for (ModuleImport moduleImport : imports) {
-            if (moduleImport.getPrefix().equals(prefix)) {
-                result = moduleImport;
-                break;
-            }
-        }
-        return result;
-    }
-
-    public static TypeDefinition<?> findTypedef(final Set<TypeDefinition<?>> typedefs, final String name) {
-        TypeDefinition<?> result = null;
-        for (TypeDefinition<?> td : typedefs) {
-            if (td.getQName().getLocalName().equals(name)) {
-                result = td;
-                break;
-            }
-        }
-        return result;
-    }
-
-    public static SchemaPath createPath(final boolean absolute, final URI namespace, final Date revision, final String prefix, final String... names) {
-        List<QName> path = new ArrayList<>();
-        for (String name : names) {
-            path.add(QName.create(namespace, revision, name));
-        }
-        return SchemaPath.create(path, absolute);
-    }
-
-    public static Date createDate(final String date) {
-        Date result;
-        final DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        try {
-            result = simpleDateFormat.parse(date);
-        } catch (ParseException e) {
-            result = null;
-        }
-        return result;
-    }
-
-    /**
-     * Test if node has augmenting flag set to expected value. In case this is
-     * DataNodeContainer/ChoiceNode, check its child nodes/case nodes too.
-     *
-     * @param node
-     *            node to check
-     * @param expected
-     *            expected value
-     */
-    public static void checkIsAugmenting(final DataSchemaNode node, final boolean expected) {
-        assertEquals(expected, node.isAugmenting());
-        if (node instanceof DataNodeContainer) {
-            for (DataSchemaNode child : ((DataNodeContainer) node).getChildNodes()) {
-                checkIsAugmenting(child, expected);
-            }
-        } else if (node instanceof ChoiceSchemaNode) {
-            for (ChoiceCaseNode caseNode : ((ChoiceSchemaNode) node).getCases()) {
-                checkIsAugmenting(caseNode, expected);
-            }
-        }
-    }
-
-    /**
-     * Check if node has addedByUses flag set to expected value. In case this is
-     * DataNodeContainer/ChoiceNode, check its child nodes/case nodes too.
-     *
-     * @param node
-     *            node to check
-     * @param expected
-     *            expected value
-     */
-    public static void checkIsAddedByUses(final DataSchemaNode node, final boolean expected) {
-        assertEquals(expected, node.isAddedByUses());
-        if (node instanceof DataNodeContainer) {
-            for (DataSchemaNode child : ((DataNodeContainer) node).getChildNodes()) {
-                checkIsAddedByUses(child, expected);
-            }
-        } else if (node instanceof ChoiceSchemaNode) {
-            for (ChoiceCaseNode caseNode : ((ChoiceSchemaNode) node).getCases()) {
-                checkIsAddedByUses(caseNode, expected);
-            }
-        }
-    }
-
-    public static void checkIsAddedByUses(final GroupingDefinition node, final boolean expected) {
-        assertEquals(expected, node.isAddedByUses());
-        for (DataSchemaNode child : ((DataNodeContainer) node).getChildNodes()) {
-            checkIsAddedByUses(child, expected);
-        }
-    }
-
-    public static List<Module> findModules(final Set<Module> modules, final String moduleName) {
-        List<Module> result = new ArrayList<>();
-        for (Module module : modules) {
-            if (module.getName().equals(moduleName)) {
-                result.add(module);
-            }
-        }
-        return result;
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TwoRevisionsTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TwoRevisionsTest.java
deleted file mode 100644 (file)
index 5e29a76..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Module;
-
-public class TwoRevisionsTest {
-
-    @Test
-    public void testTwoRevisions() throws Exception {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource("/ietf").toURI());
-        assertEquals(2, TestUtils.findModules(modules, "network-topology").size());
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TypesResolutionTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/TypesResolutionTest.java
deleted file mode 100644 (file)
index d88f88b..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.math.BigInteger;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit;
-import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.util.BitsType;
-import org.opendaylight.yangtools.yang.model.util.EnumerationType;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.model.util.IdentityrefType;
-import org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType;
-import org.opendaylight.yangtools.yang.model.util.UnionType;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-public class TypesResolutionTest {
-    private Set<Module> testedModules;
-
-    @Before
-    public void init() throws Exception {
-        File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/ietf").toURI());
-        YangContextParser parser = new YangParserImpl();
-        testedModules = parser.parseFile(yangFile, dependenciesDir).getModules();
-        assertEquals(4, testedModules.size());
-    }
-
-    @Test
-    public void testIPVersion() {
-        Module tested = TestUtils.findModule(testedModules, "ietf-inet-types");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        assertEquals(14, typedefs.size());
-
-        TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-version");
-        assertTrue(type.getDescription().contains("This value represents the version of the IP protocol."));
-        assertTrue(type.getReference().contains("RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"));
-
-        EnumerationType enumType = (EnumerationType) type.getBaseType();
-        List<EnumPair> values = enumType.getValues();
-        assertEquals(3, values.size());
-
-        EnumPair value0 = values.get(0);
-        assertEquals("unknown", value0.getName());
-        assertEquals(0, (int) value0.getValue());
-        assertEquals("An unknown or unspecified version of the Internet protocol.", value0.getDescription());
-
-        EnumPair value1 = values.get(1);
-        assertEquals("ipv4", value1.getName());
-        assertEquals(1, (int) value1.getValue());
-        assertEquals("The IPv4 protocol as defined in RFC 791.", value1.getDescription());
-
-        EnumPair value2 = values.get(2);
-        assertEquals("ipv6", value2.getName());
-        assertEquals(2, (int) value2.getValue());
-        assertEquals("The IPv6 protocol as defined in RFC 2460.", value2.getDescription());
-    }
-
-    @Test
-    public void testEnumeration() {
-        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-
-        TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-version");
-        EnumerationType enumType = (EnumerationType) type.getBaseType();
-        List<EnumPair> values = enumType.getValues();
-        assertEquals(4, values.size());
-
-        EnumPair value0 = values.get(0);
-        assertEquals("unknown", value0.getName());
-        assertEquals(0, (int) value0.getValue());
-        assertEquals("An unknown or unspecified version of the Internet protocol.", value0.getDescription());
-
-        EnumPair value1 = values.get(1);
-        assertEquals("ipv4", value1.getName());
-        assertEquals(19, (int) value1.getValue());
-        assertEquals("The IPv4 protocol as defined in RFC 791.", value1.getDescription());
-
-        EnumPair value2 = values.get(2);
-        assertEquals("ipv6", value2.getName());
-        assertEquals(7, (int) value2.getValue());
-        assertEquals("The IPv6 protocol as defined in RFC 2460.", value2.getDescription());
-
-        EnumPair value3 = values.get(3);
-        assertEquals("default", value3.getName());
-        assertEquals(20, (int) value3.getValue());
-        assertEquals("default ip", value3.getDescription());
-    }
-
-    @Test
-    public void testIpAddress() {
-        Module tested = TestUtils.findModule(testedModules, "ietf-inet-types");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-address");
-        UnionType baseType = (UnionType) type.getBaseType();
-        List<TypeDefinition<?>> unionTypes = baseType.getTypes();
-
-        ExtendedType ipv4 = (ExtendedType) unionTypes.get(0);
-        assertTrue(ipv4.getBaseType() instanceof StringTypeDefinition);
-        String expectedPattern = "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}"
-                + "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" + "(%[\\p{N}\\p{L}]+)?$";
-        assertEquals(expectedPattern, ipv4.getPatternConstraints().get(0).getRegularExpression());
-
-        ExtendedType ipv6 = (ExtendedType) unionTypes.get(1);
-        assertTrue(ipv6.getBaseType() instanceof StringTypeDefinition);
-        List<PatternConstraint> ipv6Patterns = ipv6.getPatternConstraints();
-        expectedPattern = "^((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}"
-                + "((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|" + "(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}"
-                + "(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))" + "(%[\\p{N}\\p{L}]+)?$";
-        assertEquals(expectedPattern, ipv6Patterns.get(0).getRegularExpression());
-
-        expectedPattern = "^(([^:]+:){6}(([^:]+:[^:]+)|(.*\\..*)))|" + "((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)"
-                + "(%.+)?$";
-        assertEquals(expectedPattern, ipv6Patterns.get(1).getRegularExpression());
-    }
-
-    @Test
-    public void testDomainName() {
-        Module tested = TestUtils.findModule(testedModules, "ietf-inet-types");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        ExtendedType type = (ExtendedType) TestUtils.findTypedef(typedefs, "domain-name");
-        assertTrue(type.getBaseType() instanceof StringTypeDefinition);
-        List<PatternConstraint> patterns = type.getPatternConstraints();
-        assertEquals(1, patterns.size());
-        String expectedPattern = "^((([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.)*"
-                + "([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.?)" + "|\\.$";
-        assertEquals(expectedPattern, patterns.get(0).getRegularExpression());
-
-        List<LengthConstraint> lengths = type.getLengthConstraints();
-        assertEquals(1, lengths.size());
-        LengthConstraint length = type.getLengthConstraints().get(0);
-        assertEquals(BigInteger.ONE, length.getMin());
-        assertEquals(BigInteger.valueOf(253), length.getMax());
-    }
-
-    @Test
-    public void testInstanceIdentifier1() {
-        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf1");
-        InstanceIdentifierType leafType = (InstanceIdentifierType) leaf.getType();
-        assertFalse(leafType.requireInstance());
-        assertEquals(1, leaf.getUnknownSchemaNodes().size());
-    }
-
-    @Test
-    public void testInstanceIdentifier2() {
-        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf2");
-        InstanceIdentifierType leafType = (InstanceIdentifierType) leaf.getType();
-        assertTrue(leafType.requireInstance());
-    }
-
-    @Test
-    public void testIdentity() {
-        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        Set<IdentitySchemaNode> identities = tested.getIdentities();
-        assertEquals(5, identities.size());
-        IdentitySchemaNode cryptoAlg = null;
-        IdentitySchemaNode cryptoBase = null;
-        IdentitySchemaNode cryptoId = null;
-        for (IdentitySchemaNode id : identities) {
-            if (id.getQName().getLocalName().equals("crypto-alg")) {
-                cryptoAlg = id;
-            } else if ("crypto-base".equals(id.getQName().getLocalName())) {
-                cryptoBase = id;
-            } else if ("crypto-id".equals(id.getQName().getLocalName())) {
-                cryptoId = id;
-            }
-        }
-        assertNotNull(cryptoAlg);
-        IdentitySchemaNode baseIdentity = cryptoAlg.getBaseIdentity();
-        assertEquals("crypto-base", baseIdentity.getQName().getLocalName());
-        assertTrue(cryptoAlg.getDerivedIdentities().isEmpty());
-        assertNull(baseIdentity.getBaseIdentity());
-
-        assertNotNull(cryptoBase);
-        assertNull(cryptoBase.getBaseIdentity());
-        assertEquals(3, cryptoBase.getDerivedIdentities().size());
-
-        assertNotNull(cryptoId);
-        assertEquals(1, cryptoId.getUnknownSchemaNodes().size());
-    }
-
-    @Test
-    public void testBitsType1() {
-        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("mybits");
-        BitsType leafType = (BitsType) leaf.getType();
-        List<Bit> bits = leafType.getBits();
-        assertEquals(3, bits.size());
-
-        Bit bit1 = bits.get(0);
-        assertEquals("disable-nagle", bit1.getName());
-        assertEquals(0L, (long) bit1.getPosition());
-
-        Bit bit2 = bits.get(1);
-        assertEquals("auto-sense-speed", bit2.getName());
-        assertEquals(1L, (long) bit2.getPosition());
-
-        Bit bit3 = bits.get(2);
-        assertEquals("10-Mb-only", bit3.getName());
-        assertEquals(2L, (long) bit3.getPosition());
-    }
-
-    @Test
-    public void testBitsType2() {
-        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "access-operations-type");
-
-        BitsType bitsType = (BitsType) testedType.getBaseType();
-        List<Bit> bits = bitsType.getBits();
-        assertEquals(5, bits.size());
-
-        Bit bit0 = bits.get(0);
-        assertEquals(0L, (long) bit0.getPosition());
-
-        Bit bit1 = bits.get(1);
-        assertEquals(500L, (long) bit1.getPosition());
-
-        Bit bit2 = bits.get(2);
-        assertEquals(501L, (long) bit2.getPosition());
-
-        Bit bit3 = bits.get(3);
-        assertEquals(365L, (long) bit3.getPosition());
-
-        Bit bit4 = bits.get(4);
-        assertEquals(502L, (long) bit4.getPosition());
-    }
-
-    @Test
-    public void testIanaTimezones() {
-        Module tested = TestUtils.findModule(testedModules, "iana-timezones");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "iana-timezone");
-
-        String expectedDesc = "A timezone location as defined by the IANA timezone";
-        assertTrue(testedType.getDescription().contains(expectedDesc));
-        assertTrue(testedType.getReference().isEmpty());
-        assertEquals(Status.CURRENT, testedType.getStatus());
-
-        QName testedTypeQName = testedType.getQName();
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:iana-timezones"), testedTypeQName.getNamespace());
-        assertEquals(TestUtils.createDate("2012-07-09"), testedTypeQName.getRevision());
-        assertEquals("iana-timezone", testedTypeQName.getLocalName());
-
-        EnumerationType enumType = (EnumerationType) testedType.getBaseType();
-        List<EnumPair> values = enumType.getValues();
-        assertEquals(415, values.size()); // 0-414
-
-        EnumPair enum168 = values.get(168);
-        assertEquals("America/Danmarkshavn", enum168.getName());
-        assertEquals(168, (int) enum168.getValue());
-        assertEquals("east coast, north of Scoresbysund", enum168.getDescription());
-
-        EnumPair enum374 = values.get(374);
-        assertEquals("America/Indiana/Winamac", enum374.getName());
-        assertEquals(374, (int) enum374.getValue());
-        assertEquals("Eastern Time - Indiana - Pulaski County", enum374.getDescription());
-    }
-
-    @Test
-    public void testObjectId128() {
-        Module tested = TestUtils.findModule(testedModules, "ietf-yang-types");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        ExtendedType testedType = (ExtendedType) TestUtils.findTypedef(typedefs, "object-identifier-128");
-
-        List<PatternConstraint> patterns = testedType.getPatternConstraints();
-        assertEquals(1, patterns.size());
-        PatternConstraint pattern = patterns.get(0);
-        assertEquals("^\\d*(\\.\\d*){1,127}$", pattern.getRegularExpression());
-
-        QName testedTypeQName = testedType.getQName();
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types"), testedTypeQName.getNamespace());
-        assertEquals(TestUtils.createDate("2010-09-24"), testedTypeQName.getRevision());
-        assertEquals("object-identifier-128", testedTypeQName.getLocalName());
-
-        ExtendedType testedTypeBase = (ExtendedType) testedType.getBaseType();
-        patterns = testedTypeBase.getPatternConstraints();
-        assertEquals(1, patterns.size());
-
-        pattern = patterns.get(0);
-        assertEquals("^(([0-1](\\.[1-3]?[0-9]))|(2\\.(0|([1-9]\\d*))))(\\.(0|([1-9]\\d*)))*$",
-                pattern.getRegularExpression());
-
-        QName testedTypeBaseQName = testedTypeBase.getQName();
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types"), testedTypeBaseQName.getNamespace());
-        assertEquals(TestUtils.createDate("2010-09-24"), testedTypeBaseQName.getRevision());
-        assertEquals("object-identifier", testedTypeBaseQName.getLocalName());
-    }
-
-    @Test
-    public void testIdentityref() {
-        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "service-type-ref");
-        IdentityrefType baseType = (IdentityrefType) testedType.getBaseType();
-        QName identity = baseType.getIdentity().getQName();
-        assertEquals(URI.create("urn:custom.types.demo"), identity.getNamespace());
-        assertEquals(TestUtils.createDate("2012-04-16"), identity.getRevision());
-        assertEquals("service-type", identity.getLocalName());
-
-        LeafSchemaNode type = (LeafSchemaNode) tested.getDataChildByName("type");
-        assertNotNull(type);
-    }
-
-    @Test
-    public void testUnionWithExt() throws Exception {
-        File extdef = new File(getClass().getResource("/types/union-with-ext/extdef.yang").toURI());
-        File unionbug = new File(getClass().getResource("/types/union-with-ext/unionbug.yang").toURI());
-        File inet = new File(getClass().getResource("/ietf/ietf-inet-types@2010-09-24.yang").toURI());
-        YangContextParser parser = new YangParserImpl();
-        parser.parseFiles(Arrays.asList(extdef, unionbug, inet));
-    }
-
-    @Test
-    public void testUnionWithBits() throws Exception {
-        File unionbits = new File(getClass().getResource("/types/union-with-bits/union-bits-model.yang").toURI());
-        YangContextParser parser = new YangParserImpl();
-        parser.parseFiles(Collections.singletonList(unionbits));
-    }
-
-    @Test(expected = YangParseException.class)
-    public void testUnionInList() throws Exception {
-       File unioninlist = new File(getClass().getResource("/types/union-in-list/unioninlisttest.yang").toURI());
-       YangContextParser parser = new YangParserImpl();
-       parser.parseFiles(Collections.singletonList(unioninlist));
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/UsesAugmentTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/UsesAugmentTest.java
deleted file mode 100644 (file)
index 48ce134..0000000
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import com.google.common.collect.Lists;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.BaseTypes;
-import org.opendaylight.yangtools.yang.model.util.BooleanType;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.model.util.Uint32;
-import org.opendaylight.yangtools.yang.model.util.Uint8;
-import org.opendaylight.yangtools.yang.model.util.UnionType;
-
-public class UsesAugmentTest {
-    private static final URI UG_NS = URI.create("urn:opendaylight:params:xml:ns:yang:uses-grouping");
-    private static final URI GD_NS = URI.create("urn:opendaylight:params:xml:ns:yang:grouping-definitions");
-    private Date UG_REV;
-    private Date GD_REV;
-
-    private Set<Module> modules;
-
-    @Before
-    public void init() throws FileNotFoundException, ParseException {
-        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        UG_REV = simpleDateFormat.parse("2013-07-30");
-        GD_REV = simpleDateFormat.parse("2013-09-04");
-    }
-
-    /**
-     * Structure of testing model:
-     *
-     * notification pcreq
-     * |-- leaf version (U)
-     * |-- leaf type (U)
-     * |-- list requests
-     * |-- |-- container rp
-     * |-- |-- |-- leaf priority (U)
-     * |-- |-- |-- container box (U)
-     * |-- |-- |-- |-- container order (A)
-     * |-- |-- |-- |-- |-- leaf delete (U)
-     * |-- |-- |-- |-- |-- |-- leaf setup (U)
-     * |-- |-- |-- leaf processing-rule (U)
-     * |-- |-- |-- leaf ignore (U)
-     * |-- |-- path-key-expansion
-     * |-- |-- |-- container path-key
-     * |-- |-- |-- |-- list path-keys (U)
-     * |-- |-- |-- |-- |-- leaf version (U)
-     * |-- |-- |-- |-- |-- leaf type (U)
-     * |-- |-- |-- |-- |-- leaf processing-rule (U)
-     * |-- |-- |-- |-- |-- leaf ignore (U)
-     * |-- |-- container segment-computation
-     * |-- |-- |-- container p2p
-     * |-- |-- |-- |-- container endpoints
-     * |-- |-- |-- |-- |-- leaf processing-rule (U)
-     * |-- |-- |-- |-- |-- leaf ignore (U)
-     * |-- |-- |-- |-- |-- container box (U)
-     * |-- |-- |-- |-- |-- choice address-family (U)
-     * |-- |-- |-- |-- |-- |-- case ipv4
-     * |-- |-- |-- |-- |-- |-- |-- leaf source-ipv4-address
-     * |-- |-- |-- |-- |-- |-- case ipv6
-     * |-- |-- |-- |-- |-- |-- |-- leaf source-ipv6-address
-     * |-- |-- |-- |-- container reported-route
-     * |-- |-- |-- |-- |-- container bandwidth
-     * |-- |-- |-- |-- |-- list subobjects(U)
-     * |-- |-- |-- |-- |-- leaf processing-rule (U)
-     * |-- |-- |-- |-- |-- leaf ignore (U)
-     * |-- |-- |-- |-- container bandwidth (U)
-     * |-- |-- |-- |-- |-- container bandwidth (U)
-     * |-- |-- |-- |-- |-- leaf processing-rule (U)
-     * |-- |-- |-- |-- |-- leaf ignore (U)
-     * |-- list svec
-     * |-- |-- list metric
-     * |-- |-- |-- leaf metric-type (U)
-     * |-- |-- |-- container box (U)
-     * |-- |-- |-- leaf processing-rule (U)
-     * |-- |-- |-- leaf ignore (U)
-     * |-- |-- leaf link-diverse (U)
-     * |-- |-- leaf processing-rule (U)
-     * |-- |-- leaf ignore (U)
-     *
-     * U = added by uses A = added by augment
-     *
-     * @throws Exception if exception occurs
-     */
-    @Test
-    public void testAugmentInUses() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI());
-        Module testModule = TestUtils.findModule(modules, "uses-grouping");
-
-        LinkedList<QName> path = new LinkedList<>();
-
-        // * notification pcreq
-        Set<NotificationDefinition> notifications = testModule.getNotifications();
-        assertEquals(1, notifications.size());
-        NotificationDefinition pcreq = notifications.iterator().next();
-        assertNotNull(pcreq);
-        QName expectedQName = QName.create(UG_NS, UG_REV, "pcreq");
-        path.offer(expectedQName);
-        SchemaPath expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, pcreq.getPath());
-        Collection<DataSchemaNode> childNodes = pcreq.getChildNodes();
-        assertEquals(4, childNodes.size());
-        // * |-- leaf version
-        LeafSchemaNode version = (LeafSchemaNode) pcreq.getDataChildByName("version");
-        assertNotNull(version);
-        expectedQName = QName.create(UG_NS, UG_REV, "version");
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, version.getPath());
-        expectedQName = QName.create(GD_NS, GD_REV, "protocol-version");
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(Lists.newArrayList(expectedQName), true);
-        assertEquals(expectedPath, version.getType().getPath());
-        assertEquals(Uint8.getInstance(), version.getType().getBaseType());
-        assertTrue(version.isAddedByUses());
-        // * |-- leaf type
-        LeafSchemaNode type = (LeafSchemaNode) pcreq.getDataChildByName("type");
-        assertNotNull(type);
-        expectedQName = QName.create(UG_NS, UG_REV, "type");
-        assertTrue(type.isAddedByUses());
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, type.getPath());
-        expectedQName = QName.create(GD_NS, GD_REV, "int-ext");
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(Lists.newArrayList(expectedQName), true);
-        assertEquals(expectedPath, type.getType().getPath());
-        UnionType union = (UnionType)type.getType().getBaseType();
-        assertEquals(SchemaPath.create(true, BaseTypes.constructQName("union")), union.getPath());
-        assertEquals(2, union.getTypes().size());
-        // * |-- list requests
-        ListSchemaNode requests = (ListSchemaNode) pcreq.getDataChildByName("requests");
-        assertNotNull(requests);
-        expectedQName = QName.create(UG_NS, UG_REV, "requests");
-        assertEquals(expectedQName, requests.getQName());
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, requests.getPath());
-        assertFalse(requests.isAddedByUses());
-        childNodes = requests.getChildNodes();
-        assertEquals(3, childNodes.size());
-        // * |-- |-- container rp
-        ContainerSchemaNode rp = (ContainerSchemaNode) requests.getDataChildByName("rp");
-        assertNotNull(rp);
-        expectedQName = QName.create(UG_NS, UG_REV, "rp");
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, rp.getPath());
-        assertFalse(rp.isAddedByUses());
-        childNodes = rp.getChildNodes();
-        assertEquals(4, childNodes.size());
-        // * |-- |-- |-- leaf processing-rule
-        LeafSchemaNode processingRule = (LeafSchemaNode) rp.getDataChildByName("processing-rule");
-        assertNotNull(processingRule);
-        expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
-        assertEquals(expectedQName, processingRule.getQName());
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, processingRule.getPath());
-        assertEquals(BooleanType.getInstance(), processingRule.getType());
-        assertTrue(processingRule.isAddedByUses());
-        // * |-- |-- |-- leaf ignore
-        LeafSchemaNode ignore = (LeafSchemaNode) rp.getDataChildByName("ignore");
-        assertNotNull(ignore);
-        expectedQName = QName.create(UG_NS, UG_REV, "ignore");
-        assertEquals(expectedQName, ignore.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, ignore.getPath());
-        assertEquals(BooleanType.getInstance(), ignore.getType());
-        assertTrue(ignore.isAddedByUses());
-        // * |-- |-- |-- leaf priority
-        LeafSchemaNode priority = (LeafSchemaNode) rp.getDataChildByName("priority");
-        assertNotNull(priority);
-        expectedQName = QName.create(UG_NS, UG_REV, "priority");
-        assertEquals(expectedQName, priority.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, priority.getPath());
-        expectedQName = QName.create(UG_NS, UG_REV, "uint8");
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        // TODO
-        //assertEquals(expectedPath, priority.getType().getPath());
-        assertEquals(Uint8.getInstance(), priority.getType().getBaseType());
-        assertTrue(priority.isAddedByUses());
-        // * |-- |-- |-- container box
-        ContainerSchemaNode box = (ContainerSchemaNode) rp.getDataChildByName("box");
-        assertNotNull(box);
-        expectedQName = QName.create(UG_NS, UG_REV, "box");
-        assertEquals(expectedQName, box.getQName());
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, box.getPath());
-        assertTrue(box.isAddedByUses());
-        // * |-- |-- |-- |-- container order
-        ContainerSchemaNode order = (ContainerSchemaNode) box.getDataChildByName("order");
-        assertNotNull(order);
-        expectedQName = QName.create(UG_NS, UG_REV, "order");
-        assertEquals(expectedQName, order.getQName());
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, order.getPath());
-        assertTrue(order.isAddedByUses());
-        assertTrue(order.isAugmenting());
-        assertEquals(2, order.getChildNodes().size());
-        // * |-- |-- |-- |-- |-- leaf delete
-        LeafSchemaNode delete = (LeafSchemaNode) order.getDataChildByName("delete");
-        assertNotNull(delete);
-        expectedQName = QName.create(UG_NS, UG_REV, "delete");
-        assertEquals(expectedQName, delete.getQName());
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, delete.getPath());
-        assertEquals(Uint32.getInstance(), delete.getType());
-        assertTrue(delete.isAddedByUses());
-        // * |-- |-- |-- |-- |-- leaf setup
-        LeafSchemaNode setup = (LeafSchemaNode) order.getDataChildByName("setup");
-        assertNotNull(setup);
-        expectedQName = QName.create(UG_NS, UG_REV, "setup");
-        assertEquals(expectedQName, setup.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, setup.getPath());
-        assertEquals(Uint32.getInstance(), setup.getType());
-        assertTrue(setup.isAddedByUses());
-        // * |-- |-- path-key-expansion
-        ContainerSchemaNode pke = (ContainerSchemaNode) requests.getDataChildByName("path-key-expansion");
-        assertNotNull(pke);
-        expectedQName = QName.create(UG_NS, UG_REV, "path-key-expansion");
-        assertEquals(expectedQName, pke.getQName());
-        path.pollLast();
-        path.pollLast();
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, pke.getPath());
-        assertFalse(pke.isAddedByUses());
-        // * |-- |-- |-- path-key
-        ContainerSchemaNode pathKey = (ContainerSchemaNode) pke.getDataChildByName("path-key");
-        assertNotNull(pathKey);
-        expectedQName = QName.create(UG_NS, UG_REV, "path-key");
-        assertEquals(expectedQName, pathKey.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, pathKey.getPath());
-        assertFalse(pathKey.isAddedByUses());
-        assertEquals(3, pathKey.getChildNodes().size());
-        // * |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) pathKey.getDataChildByName("processing-rule");
-        assertNotNull(processingRule);
-        expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
-        assertEquals(expectedQName, processingRule.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, processingRule.getPath());
-        assertEquals(BooleanType.getInstance(), processingRule.getType());
-        assertTrue(processingRule.isAddedByUses());
-        // * |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) pathKey.getDataChildByName("ignore");
-        assertNotNull(ignore);
-        expectedQName = QName.create(UG_NS, UG_REV, "ignore");
-        assertEquals(expectedQName, ignore.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, ignore.getPath());
-        assertEquals(BooleanType.getInstance(), ignore.getType());
-        assertTrue(ignore.isAddedByUses());
-        // * |-- |-- |-- |-- list path-keys
-        ListSchemaNode pathKeys = (ListSchemaNode) pathKey.getDataChildByName("path-keys");
-        assertNotNull(pathKeys);
-        expectedQName = QName.create(UG_NS, UG_REV, "path-keys");
-        assertEquals(expectedQName, pathKeys.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, pathKeys.getPath());
-        assertTrue(pathKeys.isAddedByUses());
-        childNodes = pathKeys.getChildNodes();
-        assertEquals(2, childNodes.size());
-        // * |-- |-- |-- |-- |-- leaf version
-        version = (LeafSchemaNode) pathKeys.getDataChildByName("version");
-        assertNotNull(version);
-        expectedQName = QName.create(UG_NS, UG_REV, "version");
-        assertEquals(expectedQName, version.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, version.getPath());
-        assertTrue(version.getType() instanceof ExtendedType);
-        assertEquals(Uint8.getInstance(), version.getType().getBaseType());
-        assertTrue(version.isAddedByUses());
-        assertTrue(version.isAugmenting());
-        // * |-- |-- |-- |-- |-- leaf type
-        type = (LeafSchemaNode) pathKeys.getDataChildByName("type");
-        assertNotNull(type);
-        expectedQName = QName.create(UG_NS, UG_REV, "type");
-        assertEquals(expectedQName, type.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, type.getPath());
-        assertTrue(type.getType() instanceof ExtendedType);
-        assertTrue(type.isAddedByUses());
-        assertTrue(type.isAugmenting());
-        // * |-- |-- container segment-computation
-        ContainerSchemaNode sc = (ContainerSchemaNode) requests.getDataChildByName("segment-computation");
-        assertNotNull(sc);
-        expectedQName = QName.create(UG_NS, UG_REV, "segment-computation");
-        assertEquals(expectedQName, sc.getQName());
-        path.pollLast();
-        path.pollLast();
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, sc.getPath());
-        assertFalse(sc.isAddedByUses());
-        // * |-- |-- |-- container p2p
-        ContainerSchemaNode p2p = (ContainerSchemaNode) sc.getDataChildByName("p2p");
-        assertNotNull(p2p);
-        expectedQName = QName.create(UG_NS, UG_REV, "p2p");
-        assertEquals(expectedQName, p2p.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, p2p.getPath());
-        assertFalse(p2p.isAddedByUses());
-        // * |-- |-- |-- |-- container endpoints
-        ContainerSchemaNode endpoints = (ContainerSchemaNode) p2p.getDataChildByName("endpoints");
-        assertNotNull(endpoints);
-        expectedQName = QName.create(UG_NS, UG_REV, "endpoints");
-        assertEquals(expectedQName, endpoints.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, endpoints.getPath());
-        assertFalse(endpoints.isAddedByUses());
-        // * |-- |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) endpoints.getDataChildByName("processing-rule");
-        assertNotNull(processingRule);
-        expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
-        assertEquals(expectedQName, processingRule.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, processingRule.getPath());
-        assertEquals(BooleanType.getInstance(), processingRule.getType());
-        assertTrue(processingRule.isAddedByUses());
-        // * |-- |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) endpoints.getDataChildByName("ignore");
-        assertNotNull(ignore);
-        expectedQName = QName.create(UG_NS, UG_REV, "ignore");
-        assertEquals(expectedQName, ignore.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, ignore.getPath());
-        assertEquals(BooleanType.getInstance(), ignore.getType());
-        assertTrue(ignore.isAddedByUses());
-        // * |-- |-- |-- |-- |-- container box
-        box = (ContainerSchemaNode) endpoints.getDataChildByName("box");
-        assertNotNull(box);
-        expectedQName = QName.create(UG_NS, UG_REV, "box");
-        assertEquals(expectedQName, box.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, box.getPath());
-        assertTrue(box.isAddedByUses());
-        // * |-- |-- |-- |-- |-- choice address-family
-        ChoiceSchemaNode af = (ChoiceSchemaNode) endpoints.getDataChildByName("address-family");
-        assertNotNull(af);
-        expectedQName = QName.create(UG_NS, UG_REV, "address-family");
-        assertEquals(expectedQName, af.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, af.getPath());
-        assertTrue(af.isAddedByUses());
-        // * |-- |-- |-- |-- container reported-route
-        ContainerSchemaNode reportedRoute = (ContainerSchemaNode) p2p.getDataChildByName("reported-route");
-        assertNotNull(reportedRoute);
-        expectedQName = QName.create(UG_NS, UG_REV, "reported-route");
-        assertEquals(expectedQName, reportedRoute.getQName());
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, reportedRoute.getPath());
-        assertFalse(reportedRoute.isAddedByUses());
-        // * |-- |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) reportedRoute.getDataChildByName("processing-rule");
-        assertNotNull(processingRule);
-        expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
-        assertEquals(expectedQName, processingRule.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, processingRule.getPath());
-        assertEquals(BooleanType.getInstance(), processingRule.getType());
-        assertTrue(processingRule.isAddedByUses());
-        // * |-- |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) reportedRoute.getDataChildByName("ignore");
-        assertNotNull(ignore);
-        expectedQName = QName.create(UG_NS, UG_REV, "ignore");
-        assertEquals(expectedQName, ignore.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, ignore.getPath());
-        assertEquals(BooleanType.getInstance(), ignore.getType());
-        assertTrue(ignore.isAddedByUses());
-        // * |-- |-- |-- |-- |-- list subobjects
-        ListSchemaNode subobjects = (ListSchemaNode) reportedRoute.getDataChildByName("subobjects");
-        assertNotNull(subobjects);
-        expectedQName = QName.create(UG_NS, UG_REV, "subobjects");
-        assertEquals(expectedQName, subobjects.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, subobjects.getPath());
-        assertTrue(subobjects.isAddedByUses());
-        // * |-- |-- |-- |-- |-- container bandwidth
-        ContainerSchemaNode bandwidth = (ContainerSchemaNode) reportedRoute.getDataChildByName("bandwidth");
-        assertNotNull(bandwidth);
-        expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
-        assertEquals(expectedQName, bandwidth.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, bandwidth.getPath());
-        assertFalse(bandwidth.isAddedByUses());
-        // * |-- |-- |-- |-- container bandwidth
-        bandwidth = (ContainerSchemaNode) p2p.getDataChildByName("bandwidth");
-        assertNotNull(bandwidth);
-        expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
-        assertEquals(expectedQName, bandwidth.getQName());
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, bandwidth.getPath());
-        assertTrue(bandwidth.isAddedByUses());
-        // * |-- |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) bandwidth.getDataChildByName("processing-rule");
-        assertNotNull(processingRule);
-        expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
-        assertEquals(expectedQName, processingRule.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, processingRule.getPath());
-        assertEquals(BooleanType.getInstance(), processingRule.getType());
-        assertTrue(processingRule.isAddedByUses());
-        // * |-- |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) bandwidth.getDataChildByName("ignore");
-        assertNotNull(ignore);
-        expectedQName = QName.create(UG_NS, UG_REV, "ignore");
-        assertEquals(expectedQName, ignore.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, ignore.getPath());
-        assertEquals(BooleanType.getInstance(), ignore.getType());
-        assertTrue(ignore.isAddedByUses());
-        // * |-- |-- |-- |-- |-- container bandwidth
-        ContainerSchemaNode bandwidthInner = (ContainerSchemaNode) bandwidth.getDataChildByName("bandwidth");
-        assertNotNull(bandwidthInner);
-        expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
-        assertEquals(expectedQName, bandwidth.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, bandwidthInner.getPath());
-        assertTrue(bandwidthInner.isAddedByUses());
-        // * |-- list svec
-        ListSchemaNode svec = (ListSchemaNode) pcreq.getDataChildByName("svec");
-        assertNotNull(svec);
-        expectedQName = QName.create(UG_NS, UG_REV, "svec");
-        assertEquals(expectedQName, svec.getQName());
-        path.pollLast();
-        path.pollLast();
-        path.pollLast();
-        path.pollLast();
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, svec.getPath());
-        assertFalse(svec.isAddedByUses());
-        // * |-- |-- leaf link-diverse
-        LeafSchemaNode linkDiverse = (LeafSchemaNode) svec.getDataChildByName("link-diverse");
-        assertNotNull(linkDiverse);
-        expectedQName = QName.create(UG_NS, UG_REV, "link-diverse");
-        assertEquals(expectedQName, linkDiverse.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, linkDiverse.getPath());
-        assertEquals(BooleanType.getInstance(), linkDiverse.getType());
-        assertTrue(linkDiverse.isAddedByUses());
-        // * |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) svec.getDataChildByName("processing-rule");
-        assertNotNull(processingRule);
-        expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
-        assertEquals(expectedQName, processingRule.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, processingRule.getPath());
-        assertEquals(BooleanType.getInstance(), processingRule.getType());
-        assertTrue(processingRule.isAddedByUses());
-        // * |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) svec.getDataChildByName("ignore");
-        assertNotNull(ignore);
-        expectedQName = QName.create(UG_NS, UG_REV, "ignore");
-        assertEquals(expectedQName, ignore.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, ignore.getPath());
-        assertEquals(BooleanType.getInstance(), ignore.getType());
-        assertTrue(ignore.isAddedByUses());
-        // * |-- |-- list metric
-        ListSchemaNode metric = (ListSchemaNode) svec.getDataChildByName("metric");
-        assertNotNull(metric);
-        expectedQName = QName.create(UG_NS, UG_REV, "metric");
-        assertEquals(expectedQName, metric.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, metric.getPath());
-        assertFalse(metric.isAddedByUses());
-        // * |-- |-- |-- leaf metric-type
-        LeafSchemaNode metricType = (LeafSchemaNode) metric.getDataChildByName("metric-type");
-        assertNotNull(metricType);
-        expectedQName = QName.create(UG_NS, UG_REV, "metric-type");
-        assertEquals(expectedQName, metricType.getQName());
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, metricType.getPath());
-        assertEquals(Uint8.getInstance(), metricType.getType());
-        assertTrue(metricType.isAddedByUses());
-        // * |-- |-- |-- box
-        box = (ContainerSchemaNode) metric.getDataChildByName("box");
-        assertNotNull(box);
-        expectedQName = QName.create(UG_NS, UG_REV, "box");
-        assertEquals(expectedQName, box.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, box.getPath());
-        assertTrue(box.isAddedByUses());
-        // * |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) metric.getDataChildByName("processing-rule");
-        assertNotNull(processingRule);
-        expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
-        assertEquals(expectedQName, processingRule.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, processingRule.getPath());
-        assertEquals(BooleanType.getInstance(), processingRule.getType());
-        assertTrue(processingRule.isAddedByUses());
-        // * |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) metric.getDataChildByName("ignore");
-        assertNotNull(ignore);
-        expectedQName = QName.create(UG_NS, UG_REV, "ignore");
-        assertEquals(expectedQName, ignore.getQName());
-        path.pollLast();
-        path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
-        assertEquals(expectedPath, ignore.getPath());
-        assertEquals(BooleanType.getInstance(), ignore.getType());
-        assertTrue(ignore.isAddedByUses());
-    }
-
-    @Test
-    public void testTypedefs() throws IOException, URISyntaxException {
-        modules = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI());
-        Module testModule = TestUtils.findModule(modules, "grouping-definitions");
-        Set<TypeDefinition<?>> types = testModule.getTypeDefinitions();
-
-        TypeDefinition<?> intExt = null;
-        for(TypeDefinition<?> td : types) {
-            if("int-ext".equals(td.getQName().getLocalName())) {
-                intExt = td;
-            }
-        }
-        assertNotNull(intExt);
-
-        List<QName> path = Lists.newArrayList(QName.create(GD_NS, GD_REV, "int-ext"));
-        SchemaPath expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, intExt.getPath());
-
-        UnionType union = (UnionType)intExt.getBaseType();
-
-        TypeDefinition<?> uint8 = null;
-        TypeDefinition<?> pv = null;
-        for(TypeDefinition<?> td : union.getTypes()) {
-            if("uint8".equals(td.getQName().getLocalName())) {
-                uint8 = td;
-            } else if("protocol-version".equals(td.getQName().getLocalName())) {
-                pv = td;
-            }
-        }
-        assertNotNull(uint8);
-        assertNotNull(pv);
-
-        QName q1 = BaseTypes.constructQName("union");
-        expectedPath = SchemaPath.create(Lists.newArrayList(q1), true);
-        assertEquals(expectedPath, union.getPath());
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationListTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationListTest.java
deleted file mode 100644 (file)
index b4fab3b..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Default_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Key_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Leaf_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.List_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Mandatory_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Ordered_by_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Type_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Unique_stmtContext;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationListTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testKeyValidationDuplicates() {
-
-        List_stmtContext list = YangModelValidationTest.mockStatement(
-                List_stmtContext.class, "list");
-        Key_stmtContext key = YangModelValidationTest.mockStatement(
-                Key_stmtContext.class, "leaf1 leaf2 leaf1 leaf1");
-        YangModelValidationTest.addChild(list, key);
-
-        try {
-            valid.enterKey_stmt(key);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(),
-                    containsString("contains duplicates:[leaf1]"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testUniqueValidationDuplicates() {
-        List_stmtContext list = YangModelValidationTest.mockStatement(
-                List_stmtContext.class, "list");
-        Unique_stmtContext unique = YangModelValidationTest.mockStatement(
-                Unique_stmtContext.class, "leaf1/a leaf2/n leaf1/a leaf1");
-        YangModelValidationTest.addChild(list, unique);
-
-        try {
-            valid.enterUnique_stmt(unique);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(),
-                    containsString("contains duplicates:[leaf1/a]"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testOrderBy() {
-        Ordered_by_argContext ctx = YangModelValidationTest.mockStatement(
-                Ordered_by_argContext.class, "unknown");
-
-        try {
-            valid.enterOrdered_by_arg(ctx);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Ordered-by:unknown, illegal value for Ordered-by statement, only permitted:"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testLeaf() {
-        Leaf_stmtContext ctx = YangModelValidationTest.mockStatement(
-                Leaf_stmtContext.class, "leaf1");
-        Default_stmtContext def = YangModelValidationTest.mockStatement(
-                Default_stmtContext.class, "default");
-        YangModelValidationTest.addChild(ctx, def);
-        Type_stmtContext typ = YangModelValidationTest.mockStatement(
-                Type_stmtContext.class, "type");
-        YangModelValidationTest.addChild(ctx, def);
-        YangModelValidationTest.addChild(ctx, typ);
-
-        Mandatory_stmtContext mand = YangModelValidationTest.mockStatement(
-                Mandatory_stmtContext.class, null);
-        YangModelValidationTest.addChild(ctx, mand);
-
-        try {
-            valid.enterLeaf_stmt(ctx);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Both Mandatory and Default statement present"));
-            throw e;
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationModuleTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationModuleTest.java
deleted file mode 100644 (file)
index 47dce2c..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Namespace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Yang_version_stmtContext;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationModuleTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testRevisionInvalidDateFormat() {
-        Revision_stmtContext mockedRev = mockModuleWithRevision("badFormat",
-                "module1");
-
-        try {
-            valid.enterRevision_stmt(mockedRev);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Revision:badFormat, invalid date format expected date format is:"));
-            throw e;
-        }
-    }
-
-    @Test
-    public void testRevisionValidDateFormat() {
-        Revision_stmtContext mockedRev = mockModuleWithRevision(
-                YangModelValidationTest.getFormattedDate(), "module1");
-
-        valid.enterRevision_stmt(mockedRev);
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoHeaderStmts() {
-        Revision_stmtContext rev = mockModuleWithRevision("1999-4-5", "module1");
-
-        try {
-            valid.enterModule_stmt((Module_stmtContext) rev.getParent()
-                    .getParent());
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Module-header statement in Module:module1"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testMultipleModulesPerSession() {
-        Module_stmtContext module1 = (Module_stmtContext) mockModuleWithRevision(
-                "1999-09-10", "m1").getParent().getParent();
-        YangModelValidationTest.addChild(module1, YangModelValidationTest
-                .mockStatement(Namespace_stmtContext.class, ""));
-
-        Module_stmtContext module2 = (Module_stmtContext) mockModuleWithRevision(
-                "1999-09-10", "m2").getParent().getParent();
-        YangModelValidationTest.addChild(module1, YangModelValidationTest
-                .mockStatement(Namespace_stmtContext.class, ""));
-        valid.enterModule_stmt(module1);
-
-        try {
-            valid.enterModule_stmt(module2);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(),
-                    containsString("Multiple (sub)modules per file"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoNamespace() {
-        Module_header_stmtsContext header = YangModelValidationTest
-                .mockStatement(Module_header_stmtsContext.class, null);
-        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-                Module_stmtContext.class, "module1");
-        YangModelValidationTest.addChild(mod, header);
-
-        try {
-            valid.enterModule_header_stmts(header);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Namespace statement in Module-header:"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoPrefix() {
-        Module_header_stmtsContext header = YangModelValidationTest
-                .mockStatement(Module_header_stmtsContext.class, null);
-        Namespace_stmtContext nmspc = YangModelValidationTest.mockStatement(
-                Namespace_stmtContext.class, "http://test");
-        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-                Module_stmtContext.class, "module1");
-        YangModelValidationTest.addChild(mod, header);
-        YangModelValidationTest.addChild(header, nmspc);
-
-        try {
-            valid.enterModule_header_stmts(header);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Prefix statement in Module-header:"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testInvalidYangVersion() {
-
-        Yang_version_stmtContext yangVersion = YangModelValidationTest
-                .mockStatement(Yang_version_stmtContext.class, "55Unsup");
-
-        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-                Module_stmtContext.class, "module1");
-        YangModelValidationTest.addChild(mod, yangVersion);
-
-        try {
-            valid.enterYang_version_stmt(yangVersion);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Unsupported yang version:55Unsup, supported version:"
-                            + BasicValidations.SUPPORTED_YANG_VERSION));
-            throw e;
-        }
-    }
-
-    @Test
-    public void testValidYangVersion() {
-
-        Yang_version_stmtContext ctx = mock(Yang_version_stmtContext.class);
-        doReturn(1).when(ctx).getChildCount();
-        YangModelValidationTest.mockName(ctx, "1");
-
-        valid.enterYang_version_stmt(ctx);
-    }
-
-    private static Revision_stmtContext mockModuleWithRevision(final String date,
-            final String moduleName) {
-        Revision_stmtContext mockedRev = YangModelValidationTest.mockStatement(
-                Revision_stmtContext.class, date);
-        Revision_stmtsContext revs = YangModelValidationTest.mockStatement(
-                Revision_stmtsContext.class, null);
-        Module_stmtContext mod = YangModelValidationTest.mockStatement(
-                Module_stmtContext.class, moduleName);
-
-        YangModelValidationTest.addChild(revs, mockedRev);
-        YangModelValidationTest.addChild(mod, revs);
-        return mockedRev;
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationSubModuleTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationSubModuleTest.java
deleted file mode 100644 (file)
index 9d5bb19..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Belongs_to_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_header_stmtsContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Submodule_stmtContext;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationSubModuleTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoRevision() {
-
-        Submodule_stmtContext ctx = YangModelValidationTest.mockStatement(
-                Submodule_stmtContext.class, "submodule1");
-
-        try {
-            valid.enterSubmodule_stmt(ctx);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Submodule-header statement in Submodule:submodule"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testNoBelongsTo() {
-        Submodule_header_stmtsContext header = mock(Submodule_header_stmtsContext.class);
-        mockSubmoduleParent(header, "submodule");
-
-        try {
-            valid.enterSubmodule_header_stmts(header);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Belongs-to statement in Submodule-header:"));
-            throw e;
-        }
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testBelongsToNoPrefix() {
-        Belongs_to_stmtContext belongsTo = YangModelValidationTest
-                .mockStatement(Belongs_to_stmtContext.class, "supermodule");
-
-        mockSubmoduleParent(belongsTo, "submodule");
-
-        try {
-            valid.enterBelongs_to_stmt(belongsTo);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Missing Prefix statement in Belongs-to:supermodule"));
-            throw e;
-        }
-    }
-
-    private static Submodule_stmtContext mockSubmoduleParent(final ParseTree child,
-            final String moduleName) {
-        Submodule_stmtContext ctx = YangModelValidationTest.mockStatement(
-                Submodule_stmtContext.class, moduleName);
-        YangModelValidationTest.addChild(ctx, child);
-        return ctx;
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangModelValidationTest.java
deleted file mode 100644 (file)
index 1fb4303..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import com.google.common.collect.Sets;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Augment_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviate_add_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviate_delete_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Deviation_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Import_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Include_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Module_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Namespace_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Prefix_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Revision_date_stmtContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.Status_argContext;
-import org.opendaylight.yangtools.antlrv4.code.gen.YangParser.StringContext;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangModelValidationTest {
-
-    private YangModelBasicValidationListener valid;
-
-    @Before
-    public void setUp() {
-
-        valid = new YangModelBasicValidationListener();
-    }
-
-    @Test
-    public void testPrefixes() {
-        Prefix_stmtContext pref = mockStatement(Prefix_stmtContext.class, "unique1");
-        Module_stmtContext module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, pref);
-
-        valid.enterPrefix_stmt(pref);
-
-        pref = mockStatement(Prefix_stmtContext.class, "unique1");
-        module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, pref);
-
-        try {
-            valid.enterPrefix_stmt(pref);
-        } catch (Exception e) {
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-    @Test
-    public void testNamespace() {
-
-        Namespace_stmtContext namespace = mockStatement(Namespace_stmtContext.class, "http://test.parsing.uri.com");
-        Module_stmtContext module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, namespace);
-
-        valid.enterNamespace_stmt(namespace);
-
-        namespace = mockStatement(Namespace_stmtContext.class, "invalid uri");
-        module = mockStatement(Module_stmtContext.class, "module1");
-        addChild(module, namespace);
-
-        try {
-            valid.enterNamespace_stmt(namespace);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("Namespace:invalid uri cannot be parsed as URI"));
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-    @Test
-    public void testImports() {
-        Import_stmtContext impor = mockImport("unique1", "p1");
-        Module_stmtContext mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, impor);
-
-        valid.enterImport_stmt(impor);
-
-        impor = mockImport("unique1", "p2");
-        mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, impor);
-
-        try {
-            valid.enterImport_stmt(impor);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("Import:unique1 not unique"));
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-    @Test
-    public void testIncludes() {
-        Include_stmtContext incl = mockInclude("unique1");
-        Module_stmtContext mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, incl);
-        valid.enterInclude_stmt(incl);
-
-        incl = mockInclude("unique1");
-        mod = mockStatement(Module_stmtContext.class, "module1");
-        addChild(mod, incl);
-
-        try {
-            valid.enterInclude_stmt(incl);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("Include:unique1 not unique in (sub)module"));
-            return;
-        }
-
-        fail("Validation Exception should have occured");
-    }
-
-    @Test
-    public void testIdentifierMatching() {
-        List<String> ids = new ArrayList<>();
-        // valid
-        ids.add("_ok98-.87.-.8...88-asdAD");
-        ids.add("AA.bcd");
-        ids.add("a");
-        // invalid
-        ids.add("9aa");
-        ids.add("-");
-        ids.add(".");
-
-        int thrown = 0;
-        for (String id : ids) {
-            try {
-                Module_stmtContext module = mock(Module_stmtContext.class);
-                Token token = mock(Token.class);
-                when(module.getStart()).thenReturn(token);
-                BasicValidations.checkIdentifierInternal(module, id);
-            } catch (YangValidationException e) {
-                thrown++;
-            }
-        }
-
-        assertEquals(3, thrown);
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testAugument() {
-        Augment_stmtContext augument = mockStatement(Augment_stmtContext.class, "/a:*abc/a:augument1");
-        Module_stmtContext mod1 = mockStatement(Module_stmtContext.class, "mod1");
-        addChild(mod1, augument);
-
-        Token token = mock(Token.class);
-        when(augument.getStart()).thenReturn(token);
-
-        try {
-            valid.enterAugment_stmt(augument);
-        } catch (YangValidationException e) {
-            assertThat(
-                    e.getMessage(),
-                    containsString("Schema node id:/a:*abc/a:augument1 not in required format, details:Prefixed id:a:*abc not in required format"));
-            throw e;
-        }
-    }
-
-    @Test
-    public void testDeviate() {
-        Deviation_stmtContext ctx = mockStatement(Deviation_stmtContext.class, "deviations");
-        Deviate_add_stmtContext add = mockStatement(Deviate_add_stmtContext.class, "add");
-        Deviate_delete_stmtContext del = mockStatement(Deviate_delete_stmtContext.class, "delete");
-
-        addChild(ctx, add);
-        addChild(ctx, del);
-
-        valid.enterDeviation_stmt(ctx);
-
-        HashSet<Class<? extends ParseTree>> types = Sets.newHashSet();
-        types.add(Deviate_add_stmtContext.class);
-        types.add(Deviate_delete_stmtContext.class);
-
-        int count = ValidationUtil.countPresentChildrenOfType(ctx, types);
-        assertEquals(2, count);
-    }
-
-    @Test(expected = YangValidationException.class)
-    public void testStatus() throws Exception {
-        Status_argContext status = mockStatement(Status_argContext.class, "unknown");
-        try {
-            valid.enterStatus_arg(status);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("illegal value for Status statement, only permitted:"));
-            throw e;
-        }
-    }
-
-    private static Import_stmtContext mockImport(final String name, final String prefixName) {
-        Import_stmtContext impor = mockStatement(Import_stmtContext.class, name);
-
-        Prefix_stmtContext prefix = mockStatement(Prefix_stmtContext.class, prefixName);
-        Revision_date_stmtContext revDate = mockStatement(Revision_date_stmtContext.class, getFormattedDate());
-
-        addChild(impor, prefix);
-        addChild(impor, revDate);
-        return impor;
-    }
-
-    static String getFormattedDate() {
-        return new SimpleDateFormat("yyyy-MM-dd").format(new Date());
-    }
-
-    private static Include_stmtContext mockInclude(final String name) {
-        Include_stmtContext incl = mockStatement(Include_stmtContext.class, name);
-
-        Revision_date_stmtContext revDate = mockStatement(Revision_date_stmtContext.class, getFormattedDate());
-
-        addChild(incl, revDate);
-        return incl;
-    }
-
-    static void mockName(final ParseTree stmt, final String name) {
-        doReturn(1).when(stmt).getChildCount();
-
-        TerminalNode terminalNode = mock(TerminalNode.class);
-        doReturn(name).when(terminalNode).getText();
-
-        StringContext nameCtx = mock(StringContext.class);
-        doReturn(nameCtx).when(stmt).getChild(0);
-        doReturn(terminalNode).when(nameCtx).getChild(0);
-        doReturn(name).when(terminalNode).getText();
-
-        doReturn(Collections.singletonList(terminalNode)).when(nameCtx).STRING();
-    }
-
-    static <T extends ParseTree> T mockStatement(final Class<T> stmtType, final String name) {
-        T stmt = stmtType.cast(mock(stmtType));
-
-        doReturn(0).when(stmt).getChildCount();
-
-        if (name != null) {
-            mockName(stmt, name);
-        }
-        return stmt;
-    }
-
-    static void addChild(final ParseTree parent, final ParseTree child) {
-        int childCount = parent.getChildCount() + 1;
-        doReturn(childCount).when(parent).getChildCount();
-        doReturn(child).when(parent).getChild(childCount - 1);
-        doReturn(parent).when(child).getParent();
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserIdentityTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserIdentityTest.java
deleted file mode 100644 (file)
index 7888026..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URISyntaxException;
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-public class YangParserIdentityTest {
-
-    // base identity name equals identity name
-    @Test(expected = YangParseException.class)
-    public void testParsingIdentityTestModuleShouldThrowYangParseException()
-            throws IOException, URISyntaxException, YangSyntaxErrorException {
-        File yang = new File(getClass().getResource(
-                "/identity/identitytest.yang").toURI());
-        InputStream stream = new FileInputStream(yang);
-        TestUtils.loadModule(stream);
-    }
-
-    // same module prefixed base identity name equals identity name
-    @Test(expected = YangParseException.class)
-    public void testParsingPrefixIdentityTestModuleShouldThrowYangParseException()
-            throws URISyntaxException, IOException, YangSyntaxErrorException {
-        File yang = new File(getClass().getResource(
-                "/identity/prefixidentitytest.yang").toURI());
-        InputStream stream = new FileInputStream(yang);
-        TestUtils.loadModule(stream);
-    }
-
-    // imported module prefixed base identity name equals identity name, but
-    // prefix differs
-    @Test
-    public void testParsingImportPrefixIdentityTestModuleShouldThrowYangParseException()
-            throws URISyntaxException, IOException, YangSyntaxErrorException {
-        Set<Module> modules = TestUtils.loadModules(getClass().getResource(
-                "/identity/import").toURI());
-        Module module = TestUtils.findModule(modules,
-                "prefiximportidentitytest");
-        Set<ModuleImport> imports = module.getImports();
-        assertEquals(imports.size(), 1);
-        ModuleImport dummy = TestUtils.findImport(imports, "dummy");
-        assertNotEquals(dummy.getPrefix(), module.getPrefix());
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserNegativeTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserNegativeTest.java
deleted file mode 100644 (file)
index 41d76c3..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
-
-public class YangParserNegativeTest {
-
-    @Test
-    public void testInvalidImport() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/testfile1.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("ValidationException should by thrown");
-            }
-        } catch (YangValidationException e) {
-            assertTrue(e.getMessage().contains("Not existing module imported"));
-        }
-    }
-
-    @Test
-    public void testTypeNotFound() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/testfile2.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            assertEquals(e.getMessage(), "Error in module 'test2' at line 24: Referenced type 'int-ext' not found.");
-        }
-    }
-
-    @Test
-    public void testInvalidAugmentTarget() throws Exception {
-        File yang1 = new File(getClass().getResource("/negative-scenario/testfile0.yang").toURI());
-        File yang2 = new File(getClass().getResource("/negative-scenario/testfile3.yang").toURI());
-        try {
-            final List<InputStream> streams = new ArrayList<>(2);
-            try (InputStream testFile0 = new FileInputStream(yang1)) {
-                streams.add(testFile0);
-                try (InputStream testFile3 = new FileInputStream(yang2)) {
-                    streams.add(testFile3);
-                    assertEquals("Expected loaded files count is 2", 2, streams.size());
-                    TestUtils.loadModules(streams);
-                    fail("YangParseException should by thrown");
-                }
-            }
-        } catch (YangParseException e) {
-            assertEquals(
-                    "Error in module 'test3' at line 10: Error in augment parsing: failed to find augment target: augment /data:unknown",
-                    e.getMessage());
-        }
-    }
-
-    @Test
-    public void testInvalidRefine() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/testfile4.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            assertTrue(e.getMessage().contains("Can not refine 'presence' for 'node'."));
-        }
-    }
-
-    @Test
-    public void testInvalidLength() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/testfile5.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            assertTrue(e.getMessage().contains("Invalid length constraint: <4, 10>"));
-        }
-    }
-
-    @Test
-    public void testInvalidRange() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/testfile6.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            assertTrue(e.getMessage().contains("Invalid range constraint: <5, 20>"));
-        }
-    }
-
-    @Test
-    public void testDuplicateContainer() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/duplicity/container.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            String expected = "Error in module 'container' at line 10: Can not add 'container foo': node with same name 'foo' already declared at line 6.";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-    @Test
-    public void testDuplicateContainerList() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/duplicity/container-list.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            String expected = "Error in module 'container-list' at line 10: Can not add 'list foo': node with same name 'foo' already declared at line 6.";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-    @Test
-    public void testDuplicateContainerLeaf() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/duplicity/container-leaf.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            String expected = "Error in module 'container-leaf' at line 10: Can not add 'leaf foo': node with same name 'foo' already declared at line 6.";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-    @Test
-    public void testDuplicateTypedef() throws Exception {
-        File yang = new File(getClass().getResource("/negative-scenario/duplicity/typedef.yang").toURI());
-        try {
-            try (InputStream stream = new FileInputStream(yang)) {
-                TestUtils.loadModule(stream);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            String expected = "Error in module 'typedef' at line 10: typedef with same name 'int-ext' already declared at line 6.";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-    @Test
-    public void testDuplicityInAugmentTarget1() throws Exception {
-        File yang1 = new File(getClass().getResource("/negative-scenario/duplicity/augment0.yang").toURI());
-        File yang2 = new File(getClass().getResource("/negative-scenario/duplicity/augment1.yang").toURI());
-        try {
-            try (InputStream stream1 = new FileInputStream(yang1); InputStream stream2 = new FileInputStream(yang2)) {
-                TestUtils.loadModules(Arrays.asList(stream1, stream2));
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            assertTrue(e.getMessage().contains("Error in module 'augment1'"));
-            assertTrue(e.getMessage().contains("Failed to perform augmentation:"));
-
-        }
-    }
-
-    @Test
-    public void testDuplicityInAugmentTarget2() throws Exception {
-        File yang1 = new File(getClass().getResource("/negative-scenario/duplicity/augment0.yang").toURI());
-        File yang2 = new File(getClass().getResource("/negative-scenario/duplicity/augment2.yang").toURI());
-        try {
-            try (InputStream stream1 = new FileInputStream(yang1); InputStream stream2 = new FileInputStream(yang2)) {
-                TestUtils.loadModules(Arrays.asList(stream1, stream2));
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            assertTrue(e.getMessage().contains("Error in module "));
-            assertTrue(e.getMessage().contains("case with same name already declared "));
-        }
-    }
-
-    @Test
-    public void testMandatoryInAugment() throws Exception {
-        File yang1 = new File(getClass().getResource("/negative-scenario/testfile8.yang").toURI());
-        File yang2 = new File(getClass().getResource("/negative-scenario/testfile7.yang").toURI());
-        try {
-            try (InputStream stream1 = new FileInputStream(yang1); InputStream stream2 = new FileInputStream(yang2)) {
-                TestUtils.loadModules(Arrays.asList(stream1, stream2));
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            String expected = "Error in module 'testfile7' at line 18: Error in augment parsing: cannot augment mandatory node linkleaf";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-    @Test
-    public void testWrongDependenciesDir() throws Exception {
-        try {
-            File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-            File dependenciesDir = new File("/invalid");
-            YangContextParser parser = new YangParserImpl();
-            parser.parseFile(yangFile, dependenciesDir);
-            fail("Exception should by thrown");
-        } catch (IllegalStateException e) {
-            String expected = File.separator + "invalid does not exists";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-    @Test
-    public void testWrongDependenciesDir2() throws Exception {
-        try {
-            File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-            File dependenciesDir = new File(getClass().getResource("/model").toURI());
-            YangContextParser parser = new YangParserImpl();
-            parser.parseFile(yangFile, dependenciesDir);
-            fail("Exception should by thrown");
-        } catch (YangValidationException e) {
-            String expected = "Not existing module imported";
-            assertTrue(e.getMessage().contains(expected));
-        }
-    }
-
-    @Test
-    public void testInvalidListKeyDefinition() throws Exception {
-        File yang1 = new File(getClass().getResource("/negative-scenario/invalid-list-key-def.yang").toURI());
-        try {
-            try (InputStream stream1 = new FileInputStream(yang1)) {
-                TestUtils.loadModule(stream1);
-                fail("YangParseException should by thrown");
-            }
-        } catch (YangParseException e) {
-            String expected = "Error in module 'invalid-list-key-def' at line 6: Failed to resolve list key for name rib-id";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserSimpleTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserSimpleTest.java
deleted file mode 100644 (file)
index afc6de2..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-
-public class YangParserSimpleTest {
-    private final URI snNS = URI.create("urn:opendaylight:simple-nodes");
-    private Date snRev;
-    private final String snPref = "sn";
-
-    private final DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-    private Set<Module> modules;
-
-    @Before
-    public void init() throws Exception {
-        snRev = simpleDateFormat.parse("2013-07-30");
-        modules = TestUtils.loadModules(getClass().getResource("/simple-test").toURI());
-    }
-
-    @Test
-    public void testParseAnyXml() {
-        Module testModule = TestUtils.findModule(modules, "simple-nodes");
-        AnyXmlSchemaNode data = (AnyXmlSchemaNode) testModule.getDataChildByName("data");
-        assertNotNull("'anyxml data not found'", data);
-
-        // test SchemaNode args
-        QName qname = data.getQName();
-        assertEquals("data", qname.getLocalName());
-        assertEquals(snNS, qname.getNamespace());
-        assertEquals(snRev, qname.getRevision());
-        assertEquals("anyxml desc", data.getDescription());
-        assertEquals("data ref", data.getReference());
-        assertEquals(Status.OBSOLETE, data.getStatus());
-        assertEquals(0, data.getUnknownSchemaNodes().size());
-        // test DataSchemaNode args
-        assertFalse(data.isAugmenting());
-        assertFalse(data.isConfiguration());
-        ConstraintDefinition constraints = data.getConstraints();
-        assertEquals("class != 'wheel'", constraints.getWhenCondition().toString());
-        Set<MustDefinition> mustConstraints = constraints.getMustConstraints();
-        assertEquals(2, constraints.getMustConstraints().size());
-
-        String must1 = "\"ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)\"";
-        String errMsg1 = "An ethernet MTU must be 1500";
-        String must2 = "\"ifType != 'atm' or (ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)\"";
-        String errMsg2 = "An atm MTU must be  64 .. 17966";
-
-        boolean found1 = false;
-        boolean found2 = false;
-        for (MustDefinition must : mustConstraints) {
-            if (must1.equals(must.toString())) {
-                found1 = true;
-                assertEquals(errMsg1, must.getErrorMessage());
-            } else if (must2.equals(must.toString())) {
-                found2 = true;
-                assertEquals(errMsg2, must.getErrorMessage());
-                assertEquals("anyxml data error-app-tag", must.getErrorAppTag());
-                assertEquals("an error occured in data", must.getDescription());
-                assertEquals("data must ref", must.getReference());
-            }
-        }
-        assertTrue(found1);
-        assertTrue(found2);
-
-        assertTrue(constraints.isMandatory());
-        assertNull(constraints.getMinElements());
-        assertNull(constraints.getMaxElements());
-    }
-
-    @Test
-    public void testParseContainer() {
-        Module test = TestUtils.findModule(modules, "simple-nodes");
-
-        ContainerSchemaNode nodes = (ContainerSchemaNode) test.getDataChildByName("nodes");
-        // test SchemaNode args
-        QName expectedQName = QName.create(snNS, snRev, "nodes");
-        assertEquals(expectedQName, nodes.getQName());
-        SchemaPath expectedPath = TestUtils.createPath(true, snNS, snRev, snPref, "nodes");
-        assertEquals(expectedPath, nodes.getPath());
-        assertEquals("nodes collection", nodes.getDescription());
-        assertEquals("nodes ref", nodes.getReference());
-        assertEquals(Status.CURRENT, nodes.getStatus());
-        assertEquals(0, nodes.getUnknownSchemaNodes().size());
-        // test DataSchemaNode args
-        assertFalse(nodes.isAugmenting());
-        assertFalse(nodes.isConfiguration());
-
-        // constraints
-        ConstraintDefinition constraints = nodes.getConstraints();
-        assertEquals("class != 'wheel'", constraints.getWhenCondition().toString());
-        Set<MustDefinition> mustConstraints = constraints.getMustConstraints();
-        assertEquals(2, constraints.getMustConstraints().size());
-
-        String must1 = "\"ifType != 'atm' or (ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)\"";
-        String errMsg1 = "An atm MTU must be  64 .. 17966";
-        String must2 = "ifId != 0";
-
-        boolean found1 = false;
-        boolean found2 = false;
-        for (MustDefinition must : mustConstraints) {
-            if (must1.equals(must.toString())) {
-                found1 = true;
-                assertEquals(errMsg1, must.getErrorMessage());
-            } else if (must2.equals(must.toString())) {
-                found2 = true;
-                assertNull(must.getErrorMessage());
-                assertNull(must.getErrorAppTag());
-                assertNull(must.getDescription());
-                assertNull(must.getReference());
-            }
-        }
-        assertTrue(found1);
-        assertTrue(found2);
-
-        assertFalse(constraints.isMandatory());
-        assertNull(constraints.getMinElements());
-        assertNull(constraints.getMaxElements());
-        assertTrue(nodes.isPresenceContainer());
-
-        // typedef
-        Set<TypeDefinition<?>> typedefs = nodes.getTypeDefinitions();
-        assertEquals(1, typedefs.size());
-        TypeDefinition<?> nodesType = typedefs.iterator().next();
-        QName typedefQName = QName.create(snNS, snRev, "nodes-type");
-        assertEquals(typedefQName, nodesType.getQName());
-        SchemaPath nodesTypePath = TestUtils.createPath(true, snNS, snRev, snPref, "nodes", "nodes-type");
-        assertEquals(nodesTypePath, nodesType.getPath());
-        assertTrue(nodesType.getDescription().isEmpty());
-        assertTrue(nodesType.getReference().isEmpty());
-        assertEquals(Status.CURRENT, nodesType.getStatus());
-        assertEquals(0, nodesType.getUnknownSchemaNodes().size());
-
-        // child nodes
-        // total size = 8: defined 6, inserted by uses 2
-        assertEquals(8, nodes.getChildNodes().size());
-        LeafListSchemaNode added = (LeafListSchemaNode)nodes.getDataChildByName("added");
-        assertEquals(createPath("nodes", "added"), added.getPath());
-        assertEquals(createPath("mytype"), added.getType().getPath());
-
-        ListSchemaNode links = (ListSchemaNode) nodes.getDataChildByName("links");
-        assertFalse(links.isUserOrdered());
-
-        Set<GroupingDefinition> groupings = nodes.getGroupings();
-        assertEquals(1, groupings.size());
-        GroupingDefinition nodeGroup = groupings.iterator().next();
-        QName groupQName = QName.create(snNS, snRev, "node-group");
-        assertEquals(groupQName, nodeGroup.getQName());
-        SchemaPath nodeGroupPath = TestUtils.createPath(true, snNS, snRev, snPref, "nodes", "node-group");
-        assertEquals(nodeGroupPath, nodeGroup.getPath());
-
-        Set<UsesNode> uses = nodes.getUses();
-        assertEquals(1, uses.size());
-        UsesNode use = uses.iterator().next();
-        assertEquals(nodeGroupPath, use.getGroupingPath());
-    }
-
-
-    private final URI ns = URI.create("urn:opendaylight:simple-nodes");
-    private Date rev;
-    private final String prefix = "sn";
-
-    private SchemaPath createPath(final String... names) {
-        try {
-            rev = new SimpleDateFormat("yyyy-MM-dd").parse("2013-07-30");
-        } catch (ParseException e) {
-            e.printStackTrace();
-        }
-
-        List<QName> path = new ArrayList<>();
-        for (String name : names) {
-            path.add(QName.create(ns, rev, name));
-        }
-        return SchemaPath.create(path, true);
-    }
-
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserTest.java
deleted file mode 100644 (file)
index a8da2ba..0000000
+++ /dev/null
@@ -1,963 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Deviation;
-import org.opendaylight.yangtools.yang.model.api.Deviation.Deviate;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
-import org.opendaylight.yangtools.yang.model.api.ModuleImport;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.util.Decimal64;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.model.util.Int16;
-import org.opendaylight.yangtools.yang.model.util.Int32;
-import org.opendaylight.yangtools.yang.model.util.StringType;
-import org.opendaylight.yangtools.yang.model.util.Uint32;
-import org.opendaylight.yangtools.yang.model.util.UnionType;
-import org.opendaylight.yangtools.yang.parser.builder.impl.BuilderUtils;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-public class YangParserTest {
-    public static final String FS = File.separator;
-
-    private final URI fooNS = URI.create("urn:opendaylight.foo");
-    private final URI barNS = URI.create("urn:opendaylight.bar");
-    private final URI bazNS = URI.create("urn:opendaylight.baz");
-    private Date fooRev;
-    private Date barRev;
-    private Date bazRev;
-
-    private Set<Module> modules;
-
-    @Before
-    public void init() throws Exception {
-        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        fooRev = simpleDateFormat.parse("2013-02-27");
-        barRev = simpleDateFormat.parse("2013-07-03");
-        bazRev = simpleDateFormat.parse("2013-02-27");
-
-        modules = TestUtils.loadModules(getClass().getResource("/model").toURI());
-        assertEquals(3, modules.size());
-    }
-
-    @Test
-    public void testHeaders() throws ParseException {
-        Module foo = TestUtils.findModule(modules, "foo");
-
-        assertEquals("foo", foo.getName());
-        assertEquals("1", foo.getYangVersion());
-        assertEquals(fooNS, foo.getNamespace());
-        assertEquals("foo", foo.getPrefix());
-
-        Set<ModuleImport> imports = foo.getImports();
-        assertEquals(2, imports.size());
-
-        ModuleImport import2 = TestUtils.findImport(imports, "br");
-        assertEquals("bar", import2.getModuleName());
-        assertEquals(barRev, import2.getRevision());
-
-        ModuleImport import3 = TestUtils.findImport(imports, "bz");
-        assertEquals("baz", import3.getModuleName());
-        assertEquals(bazRev, import3.getRevision());
-
-        assertEquals("opendaylight", foo.getOrganization());
-        assertEquals("http://www.opendaylight.org/", foo.getContact());
-        Date expectedRevision = TestUtils.createDate("2013-02-27");
-        assertEquals(expectedRevision, foo.getRevision());
-        assertEquals(" WILL BE DEFINED LATER", foo.getReference());
-    }
-
-    @Test
-    public void testParseList() {
-        Module bar = TestUtils.findModule(modules, "bar");
-        URI expectedNamespace = URI.create("urn:opendaylight.bar");
-        String expectedPrefix = "bar";
-
-        ContainerSchemaNode interfaces = (ContainerSchemaNode) bar.getDataChildByName("interfaces");
-
-        ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
-        // test SchemaNode args
-        QName expectedQName = QName.create(expectedNamespace, barRev, "ifEntry");
-        assertEquals(expectedQName, ifEntry.getQName());
-        SchemaPath expectedPath = TestUtils.createPath(true, expectedNamespace, barRev, expectedPrefix, "interfaces",
-                "ifEntry");
-        assertEquals(expectedPath, ifEntry.getPath());
-        assertNull(ifEntry.getDescription());
-        assertNull(ifEntry.getReference());
-        assertEquals(Status.CURRENT, ifEntry.getStatus());
-        assertEquals(0, ifEntry.getUnknownSchemaNodes().size());
-        // test DataSchemaNode args
-        assertFalse(ifEntry.isAugmenting());
-        assertTrue(ifEntry.isConfiguration());
-        ConstraintDefinition constraints = ifEntry.getConstraints();
-        assertNull(constraints.getWhenCondition());
-        assertEquals(0, constraints.getMustConstraints().size());
-        assertTrue(constraints.isMandatory());
-        assertEquals(1, (int) constraints.getMinElements());
-        assertEquals(11, (int) constraints.getMaxElements());
-        // test AugmentationTarget args
-        Set<AugmentationSchema> availableAugmentations = ifEntry.getAvailableAugmentations();
-        assertEquals(2, availableAugmentations.size());
-        // test ListSchemaNode args
-        List<QName> expectedKey = new ArrayList<>();
-        expectedKey.add(QName.create(expectedNamespace, barRev, "ifIndex"));
-        assertEquals(expectedKey, ifEntry.getKeyDefinition());
-        assertFalse(ifEntry.isUserOrdered());
-        // test DataNodeContainer args
-        assertEquals(0, ifEntry.getTypeDefinitions().size());
-        assertEquals(4, ifEntry.getChildNodes().size());
-        assertEquals(0, ifEntry.getGroupings().size());
-        assertEquals(0, ifEntry.getUses().size());
-
-        LeafSchemaNode ifIndex = (LeafSchemaNode) ifEntry.getDataChildByName("ifIndex");
-        assertEquals(ifEntry.getKeyDefinition().get(0), ifIndex.getQName());
-        assertTrue(ifIndex.getType() instanceof Uint32);
-        LeafSchemaNode ifMtu = (LeafSchemaNode) ifEntry.getDataChildByName("ifMtu");
-        assertTrue(ifMtu.getType() instanceof Int32);
-    }
-
-    @Test
-    public void testTypedefRangesResolving() throws ParseException {
-        Module foo = TestUtils.findModule(modules, "foo");
-        LeafSchemaNode int32Leaf = (LeafSchemaNode) foo.getDataChildByName("int32-leaf");
-
-        ExtendedType leafType = (ExtendedType) int32Leaf.getType();
-        QName leafTypeQName = leafType.getQName();
-        assertEquals("int32-ext2", leafTypeQName.getLocalName());
-        assertEquals(fooNS, leafTypeQName.getNamespace());
-        assertEquals(fooRev, leafTypeQName.getRevision());
-        assertNull(leafType.getUnits());
-        assertNull(leafType.getDefaultValue());
-        assertTrue(leafType.getLengthConstraints().isEmpty());
-        assertTrue(leafType.getPatternConstraints().isEmpty());
-        List<RangeConstraint> ranges = leafType.getRangeConstraints();
-        assertEquals(1, ranges.size());
-        RangeConstraint range = ranges.get(0);
-        assertEquals(BigInteger.valueOf(12), range.getMin());
-        assertEquals(BigInteger.valueOf(20), range.getMax());
-
-        ExtendedType baseType = (ExtendedType) leafType.getBaseType();
-        QName baseTypeQName = baseType.getQName();
-        assertEquals("int32-ext2", baseTypeQName.getLocalName());
-        assertEquals(barNS, baseTypeQName.getNamespace());
-        assertEquals(barRev, baseTypeQName.getRevision());
-        assertEquals("mile", baseType.getUnits());
-        assertEquals("11", baseType.getDefaultValue());
-        assertTrue(leafType.getLengthConstraints().isEmpty());
-        assertTrue(leafType.getPatternConstraints().isEmpty());
-        List<RangeConstraint> baseTypeRanges = baseType.getRangeConstraints();
-        assertEquals(2, baseTypeRanges.size());
-        RangeConstraint baseTypeRange1 = baseTypeRanges.get(0);
-        assertEquals(BigInteger.valueOf(3), baseTypeRange1.getMin());
-        assertEquals(BigInteger.valueOf(9), baseTypeRange1.getMax());
-        RangeConstraint baseTypeRange2 = baseTypeRanges.get(1);
-        assertEquals(BigInteger.valueOf(11), baseTypeRange2.getMin());
-        assertEquals(BigInteger.valueOf(20), baseTypeRange2.getMax());
-
-        ExtendedType base = (ExtendedType) baseType.getBaseType();
-        QName baseQName = base.getQName();
-        assertEquals("int32-ext1", baseQName.getLocalName());
-        assertEquals(barNS, baseQName.getNamespace());
-        assertEquals(barRev, baseQName.getRevision());
-        assertNull(base.getUnits());
-        assertNull(base.getDefaultValue());
-        assertTrue(leafType.getLengthConstraints().isEmpty());
-        assertTrue(leafType.getPatternConstraints().isEmpty());
-        List<RangeConstraint> baseRanges = base.getRangeConstraints();
-        assertEquals(1, baseRanges.size());
-        RangeConstraint baseRange = baseRanges.get(0);
-        assertEquals(BigInteger.valueOf(2), baseRange.getMin());
-        assertEquals(BigInteger.valueOf(20), baseRange.getMax());
-
-        assertTrue(base.getBaseType() instanceof Int32);
-    }
-
-    @Test
-    public void testTypedefPatternsResolving() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        LeafSchemaNode stringleaf = (LeafSchemaNode) foo.getDataChildByName("string-leaf");
-
-        ExtendedType type = (ExtendedType) stringleaf.getType();
-        QName typeQName = type.getQName();
-        assertEquals("string-ext4", typeQName.getLocalName());
-        assertEquals(barNS, typeQName.getNamespace());
-        assertEquals(barRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        List<PatternConstraint> patterns = type.getPatternConstraints();
-        assertEquals(1, patterns.size());
-        PatternConstraint pattern = patterns.iterator().next();
-        assertEquals("^[e-z]*$", pattern.getRegularExpression());
-        assertTrue(type.getLengthConstraints().isEmpty());
-        assertTrue(type.getRangeConstraints().isEmpty());
-
-        ExtendedType baseType1 = (ExtendedType) type.getBaseType();
-        QName baseType1QName = baseType1.getQName();
-        assertEquals("string-ext3", baseType1QName.getLocalName());
-        assertEquals(barNS, baseType1QName.getNamespace());
-        assertEquals(barRev, baseType1QName.getRevision());
-        assertNull(baseType1.getUnits());
-        assertNull(baseType1.getDefaultValue());
-        patterns = baseType1.getPatternConstraints();
-        assertEquals(1, patterns.size());
-        pattern = patterns.iterator().next();
-        assertEquals("^[b-u]*$", pattern.getRegularExpression());
-        assertTrue(baseType1.getLengthConstraints().isEmpty());
-        assertTrue(baseType1.getRangeConstraints().isEmpty());
-
-        ExtendedType baseType2 = (ExtendedType) baseType1.getBaseType();
-        QName baseType2QName = baseType2.getQName();
-        assertEquals("string-ext2", baseType2QName.getLocalName());
-        assertEquals(barNS, baseType2QName.getNamespace());
-        assertEquals(barRev, baseType2QName.getRevision());
-        assertNull(baseType2.getUnits());
-        assertNull(baseType2.getDefaultValue());
-        assertTrue(baseType2.getPatternConstraints().isEmpty());
-        List<LengthConstraint> baseType2Lengths = baseType2.getLengthConstraints();
-        assertEquals(1, baseType2Lengths.size());
-        LengthConstraint length = baseType2Lengths.get(0);
-        assertEquals(BigInteger.valueOf(6), length.getMin());
-        assertEquals(BigInteger.TEN, length.getMax());
-        assertTrue(baseType2.getRangeConstraints().isEmpty());
-
-        ExtendedType baseType3 = (ExtendedType) baseType2.getBaseType();
-        QName baseType3QName = baseType3.getQName();
-        assertEquals("string-ext1", baseType3QName.getLocalName());
-        assertEquals(barNS, baseType3QName.getNamespace());
-        assertEquals(barRev, baseType3QName.getRevision());
-        assertNull(baseType3.getUnits());
-        assertNull(baseType3.getDefaultValue());
-        patterns = baseType3.getPatternConstraints();
-        assertEquals(1, patterns.size());
-        pattern = patterns.iterator().next();
-        assertEquals("^[a-k]*$", pattern.getRegularExpression());
-        List<LengthConstraint> baseType3Lengths = baseType3.getLengthConstraints();
-        assertEquals(1, baseType3Lengths.size());
-        length = baseType3Lengths.get(0);
-        assertEquals(BigInteger.valueOf(5), length.getMin());
-        assertEquals(BigInteger.valueOf(11), length.getMax());
-        assertTrue(baseType3.getRangeConstraints().isEmpty());
-
-        assertTrue(baseType3.getBaseType() instanceof StringType);
-    }
-
-    @Test
-    public void testTypedefInvalidPatternsResolving() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        final LeafSchemaNode invalidPatternStringLeaf = (LeafSchemaNode) foo.getDataChildByName("invalid-pattern-string-leaf");
-        ExtendedType type = (ExtendedType) invalidPatternStringLeaf.getType();
-        QName typeQName = type.getQName();
-        assertEquals("invalid-string-pattern", typeQName.getLocalName());
-        assertEquals(barNS, typeQName.getNamespace());
-        assertEquals(barRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        List<PatternConstraint> patterns = type.getPatternConstraints();
-        assertTrue(patterns.isEmpty());
-
-        final LeafSchemaNode invalidDirectStringPatternDefLeaf = (LeafSchemaNode) foo.getDataChildByName("invalid-direct-string-pattern-def-leaf");
-        type = (ExtendedType) invalidDirectStringPatternDefLeaf.getType();
-        typeQName = type.getQName();
-        assertEquals("string", typeQName.getLocalName());
-        assertEquals(fooNS, typeQName.getNamespace());
-        assertEquals(fooRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        patterns = type.getPatternConstraints();
-        assertTrue(patterns.isEmpty());
-
-        final LeafSchemaNode multiplePatternStringLeaf = (LeafSchemaNode) foo.getDataChildByName("multiple-pattern-string-leaf");
-        type = (ExtendedType) multiplePatternStringLeaf.getType();
-        typeQName = type.getQName();
-        assertEquals("multiple-pattern-string", typeQName.getLocalName());
-        assertEquals(barNS, typeQName.getNamespace());
-        assertEquals(barRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        patterns = type.getPatternConstraints();
-        assertTrue(!patterns.isEmpty());
-        assertEquals(1, patterns.size());
-        PatternConstraint pattern = patterns.iterator().next();
-        assertEquals("^[e-z]*$", pattern.getRegularExpression());
-        assertTrue(type.getLengthConstraints().isEmpty());
-        assertTrue(type.getRangeConstraints().isEmpty());
-
-        final LeafSchemaNode multiplePatternDirectStringDefLeaf = (LeafSchemaNode) foo.getDataChildByName("multiple-pattern-direct-string-def-leaf");
-        type = (ExtendedType) multiplePatternDirectStringDefLeaf.getType();
-        typeQName = type.getQName();
-        assertEquals("string", typeQName.getLocalName());
-        assertEquals(fooNS, typeQName.getNamespace());
-        assertEquals(fooRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        patterns = type.getPatternConstraints();
-        assertTrue(!patterns.isEmpty());
-        assertEquals(2, patterns.size());
-
-        boolean isEZPattern = false;
-        boolean isADPattern = false;
-        for (final PatternConstraint patternConstraint : patterns) {
-            if (patternConstraint.getRegularExpression().equals("^[e-z]*$")) {
-                isEZPattern = true;
-            } else if (patternConstraint.getRegularExpression().equals("^[a-d]*$")) {
-                isADPattern = true;
-            }
-        }
-        assertTrue(isEZPattern);
-        assertTrue( isADPattern);
-    }
-
-    @Test
-    public void testTypedefLengthsResolving() {
-        Module foo = TestUtils.findModule(modules, "foo");
-
-        LeafSchemaNode lengthLeaf = (LeafSchemaNode) foo.getDataChildByName("length-leaf");
-        ExtendedType type = (ExtendedType) lengthLeaf.getType();
-
-        QName typeQName = type.getQName();
-        assertEquals("string-ext2", typeQName.getLocalName());
-        assertEquals(fooNS, typeQName.getNamespace());
-        assertEquals(fooRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        assertTrue(type.getPatternConstraints().isEmpty());
-        List<LengthConstraint> typeLengths = type.getLengthConstraints();
-        assertEquals(1, typeLengths.size());
-        LengthConstraint length = typeLengths.get(0);
-        assertEquals(BigInteger.valueOf(7), length.getMin());
-        assertEquals(BigInteger.TEN, length.getMax());
-        assertTrue(type.getRangeConstraints().isEmpty());
-
-        ExtendedType baseType1 = (ExtendedType) type.getBaseType();
-        QName baseType1QName = baseType1.getQName();
-        assertEquals("string-ext2", baseType1QName.getLocalName());
-        assertEquals(barNS, baseType1QName.getNamespace());
-        assertEquals(barRev, baseType1QName.getRevision());
-        assertNull(baseType1.getUnits());
-        assertNull(baseType1.getDefaultValue());
-        assertTrue(baseType1.getPatternConstraints().isEmpty());
-        List<LengthConstraint> baseType2Lengths = baseType1.getLengthConstraints();
-        assertEquals(1, baseType2Lengths.size());
-        length = baseType2Lengths.get(0);
-        assertEquals(BigInteger.valueOf(6), length.getMin());
-        assertEquals(BigInteger.TEN, length.getMax());
-        assertTrue(baseType1.getRangeConstraints().isEmpty());
-
-        ExtendedType baseType2 = (ExtendedType) baseType1.getBaseType();
-        QName baseType2QName = baseType2.getQName();
-        assertEquals("string-ext1", baseType2QName.getLocalName());
-        assertEquals(barNS, baseType2QName.getNamespace());
-        assertEquals(barRev, baseType2QName.getRevision());
-        assertNull(baseType2.getUnits());
-        assertNull(baseType2.getDefaultValue());
-        List<PatternConstraint> patterns = baseType2.getPatternConstraints();
-        assertEquals(1, patterns.size());
-        PatternConstraint pattern = patterns.iterator().next();
-        assertEquals("^[a-k]*$", pattern.getRegularExpression());
-        List<LengthConstraint> baseType3Lengths = baseType2.getLengthConstraints();
-        assertEquals(1, baseType3Lengths.size());
-        length = baseType3Lengths.get(0);
-        assertEquals(BigInteger.valueOf(5), length.getMin());
-        assertEquals(BigInteger.valueOf(11), length.getMax());
-        assertTrue(baseType2.getRangeConstraints().isEmpty());
-
-        assertTrue(baseType2.getBaseType() instanceof StringType);
-    }
-
-    @Test
-    public void testTypedefDecimal1() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        LeafSchemaNode testleaf = (LeafSchemaNode) foo.getDataChildByName("decimal-leaf");
-
-        ExtendedType type = (ExtendedType) testleaf.getType();
-        QName typeQName = type.getQName();
-        assertEquals("my-decimal-type", typeQName.getLocalName());
-        assertEquals(fooNS, typeQName.getNamespace());
-        assertEquals(fooRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        assertEquals(4, (int) type.getFractionDigits());
-        assertTrue(type.getLengthConstraints().isEmpty());
-        assertTrue(type.getPatternConstraints().isEmpty());
-        assertTrue(type.getRangeConstraints().isEmpty());
-
-        ExtendedType typeBase = (ExtendedType) type.getBaseType();
-        QName typeBaseQName = typeBase.getQName();
-        assertEquals("my-decimal-type", typeBaseQName.getLocalName());
-        assertEquals(barNS, typeBaseQName.getNamespace());
-        assertEquals(barRev, typeBaseQName.getRevision());
-        assertNull(typeBase.getUnits());
-        assertNull(typeBase.getDefaultValue());
-        assertNull(typeBase.getFractionDigits());
-        assertTrue(typeBase.getLengthConstraints().isEmpty());
-        assertTrue(typeBase.getPatternConstraints().isEmpty());
-        assertTrue(typeBase.getRangeConstraints().isEmpty());
-
-        Decimal64 decimal = (Decimal64) typeBase.getBaseType();
-        assertEquals(6, (int) decimal.getFractionDigits());
-    }
-
-    @Test
-    public void testTypedefDecimal2() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        LeafSchemaNode testleaf = (LeafSchemaNode) foo.getDataChildByName("decimal-leaf2");
-
-        ExtendedType type = (ExtendedType) testleaf.getType();
-        QName typeQName = type.getQName();
-        assertEquals("my-decimal-type", typeQName.getLocalName());
-        assertEquals(barNS, typeQName.getNamespace());
-        assertEquals(barRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        assertNull(type.getFractionDigits());
-        assertTrue(type.getLengthConstraints().isEmpty());
-        assertTrue(type.getPatternConstraints().isEmpty());
-        assertTrue(type.getRangeConstraints().isEmpty());
-
-        Decimal64 baseTypeDecimal = (Decimal64) type.getBaseType();
-        assertEquals(6, (int) baseTypeDecimal.getFractionDigits());
-    }
-
-    @Test
-    public void testTypedefUnion() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        LeafSchemaNode unionleaf = (LeafSchemaNode) foo.getDataChildByName("union-leaf");
-
-        ExtendedType type = (ExtendedType) unionleaf.getType();
-        QName typeQName = type.getQName();
-        assertEquals("my-union-ext", typeQName.getLocalName());
-        assertEquals(barNS, typeQName.getNamespace());
-        assertEquals(barRev, typeQName.getRevision());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        assertNull(type.getFractionDigits());
-        assertTrue(type.getLengthConstraints().isEmpty());
-        assertTrue(type.getPatternConstraints().isEmpty());
-        assertTrue(type.getRangeConstraints().isEmpty());
-
-        ExtendedType baseType = (ExtendedType) type.getBaseType();
-        QName baseTypeQName = baseType.getQName();
-        assertEquals("my-union", baseTypeQName.getLocalName());
-        assertEquals(barNS, baseTypeQName.getNamespace());
-        assertEquals(barRev, baseTypeQName.getRevision());
-        assertNull(baseType.getUnits());
-        assertNull(baseType.getDefaultValue());
-        assertNull(baseType.getFractionDigits());
-        assertTrue(baseType.getLengthConstraints().isEmpty());
-        assertTrue(baseType.getPatternConstraints().isEmpty());
-        assertTrue(baseType.getRangeConstraints().isEmpty());
-
-        UnionType unionType = (UnionType) baseType.getBaseType();
-        List<TypeDefinition<?>> unionTypes = unionType.getTypes();
-        assertEquals(2, unionTypes.size());
-
-        ExtendedType unionType1 = (ExtendedType) unionTypes.get(0);
-        QName unionType1QName = baseType.getQName();
-        assertEquals("my-union", unionType1QName.getLocalName());
-        assertEquals(barNS, unionType1QName.getNamespace());
-        assertEquals(barRev, unionType1QName.getRevision());
-        assertNull(unionType1.getUnits());
-        assertNull(unionType1.getDefaultValue());
-        assertNull(unionType1.getFractionDigits());
-        assertTrue(unionType1.getLengthConstraints().isEmpty());
-        assertTrue(unionType1.getPatternConstraints().isEmpty());
-        List<RangeConstraint> ranges = unionType1.getRangeConstraints();
-        assertEquals(1, ranges.size());
-        RangeConstraint range = ranges.get(0);
-        assertEquals(BigInteger.ONE, range.getMin());
-        assertEquals(BigInteger.valueOf(100), range.getMax());
-        assertTrue(unionType1.getBaseType() instanceof Int16);
-
-        assertTrue(unionTypes.get(1) instanceof Int32);
-    }
-
-    @Test
-    public void testNestedUnionResolving() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        LeafSchemaNode testleaf = (LeafSchemaNode) foo.getDataChildByName("custom-union-leaf");
-
-        ExtendedType type = (ExtendedType) testleaf.getType();
-        QName testleafTypeQName = type.getQName();
-        assertEquals(bazNS, testleafTypeQName.getNamespace());
-        assertEquals(bazRev, testleafTypeQName.getRevision());
-        assertEquals("union1", testleafTypeQName.getLocalName());
-        assertNull(type.getUnits());
-        assertNull(type.getDefaultValue());
-        assertNull(type.getFractionDigits());
-        assertTrue(type.getLengthConstraints().isEmpty());
-        assertTrue(type.getPatternConstraints().isEmpty());
-        assertTrue(type.getRangeConstraints().isEmpty());
-
-        ExtendedType typeBase = (ExtendedType) type.getBaseType();
-        QName typeBaseQName = typeBase.getQName();
-        assertEquals(bazNS, typeBaseQName.getNamespace());
-        assertEquals(bazRev, typeBaseQName.getRevision());
-        assertEquals("union2", typeBaseQName.getLocalName());
-        assertNull(typeBase.getUnits());
-        assertNull(typeBase.getDefaultValue());
-        assertNull(typeBase.getFractionDigits());
-        assertTrue(typeBase.getLengthConstraints().isEmpty());
-        assertTrue(typeBase.getPatternConstraints().isEmpty());
-        assertTrue(typeBase.getRangeConstraints().isEmpty());
-
-        UnionType union = (UnionType) typeBase.getBaseType();
-        List<TypeDefinition<?>> unionTypes = union.getTypes();
-        assertEquals(2, unionTypes.size());
-        assertTrue(unionTypes.get(0) instanceof Int32);
-        assertTrue(unionTypes.get(1) instanceof ExtendedType);
-
-        ExtendedType unionType1 = (ExtendedType) unionTypes.get(1);
-        QName uniontType1QName = unionType1.getQName();
-        assertEquals(barNS, uniontType1QName.getNamespace());
-        assertEquals(barRev, uniontType1QName.getRevision());
-        assertEquals("nested-union2", uniontType1QName.getLocalName());
-        assertNull(unionType1.getUnits());
-        assertNull(unionType1.getDefaultValue());
-        assertNull(unionType1.getFractionDigits());
-        assertTrue(unionType1.getLengthConstraints().isEmpty());
-        assertTrue(unionType1.getPatternConstraints().isEmpty());
-        assertTrue(unionType1.getRangeConstraints().isEmpty());
-
-        UnionType nestedUnion = (UnionType) unionType1.getBaseType();
-        List<TypeDefinition<?>> nestedUnion2Types = nestedUnion.getTypes();
-        assertEquals(2, nestedUnion2Types.size());
-        assertTrue(nestedUnion2Types.get(0) instanceof StringType);
-        assertTrue(nestedUnion2Types.get(1) instanceof ExtendedType);
-
-        ExtendedType myUnionExt = (ExtendedType) nestedUnion2Types.get(1);
-        QName myUnionExtQName = myUnionExt.getQName();
-        assertEquals(barNS, myUnionExtQName.getNamespace());
-        assertEquals(barRev, myUnionExtQName.getRevision());
-        assertEquals("my-union-ext", myUnionExtQName.getLocalName());
-        assertNull(myUnionExt.getUnits());
-        assertNull(myUnionExt.getDefaultValue());
-        assertNull(myUnionExt.getFractionDigits());
-        assertTrue(myUnionExt.getLengthConstraints().isEmpty());
-        assertTrue(myUnionExt.getPatternConstraints().isEmpty());
-        assertTrue(myUnionExt.getRangeConstraints().isEmpty());
-
-        ExtendedType myUnion = (ExtendedType) myUnionExt.getBaseType();
-        QName myUnionQName = myUnion.getQName();
-        assertEquals(barNS, myUnionQName.getNamespace());
-        assertEquals(barRev, myUnionQName.getRevision());
-        assertEquals("my-union", myUnionQName.getLocalName());
-        assertNull(myUnion.getUnits());
-        assertNull(myUnion.getDefaultValue());
-        assertNull(myUnion.getFractionDigits());
-        assertTrue(myUnion.getLengthConstraints().isEmpty());
-        assertTrue(myUnion.getPatternConstraints().isEmpty());
-        assertTrue(myUnion.getRangeConstraints().isEmpty());
-
-        UnionType myUnionBase = (UnionType) myUnion.getBaseType();
-        List<TypeDefinition<?>> myUnionBaseTypes = myUnionBase.getTypes();
-        assertEquals(2, myUnionBaseTypes.size());
-        assertTrue(myUnionBaseTypes.get(0) instanceof ExtendedType);
-        assertTrue(myUnionBaseTypes.get(1) instanceof Int32);
-
-        ExtendedType int16Ext = (ExtendedType) myUnionBaseTypes.get(0);
-        QName int16ExtQName = int16Ext.getQName();
-        assertEquals(barNS, int16ExtQName.getNamespace());
-        assertEquals(barRev, int16ExtQName.getRevision());
-        assertEquals("int16", int16ExtQName.getLocalName());
-        assertNull(int16Ext.getUnits());
-        assertNull(int16Ext.getDefaultValue());
-        assertNull(int16Ext.getFractionDigits());
-        assertTrue(int16Ext.getLengthConstraints().isEmpty());
-        assertTrue(int16Ext.getPatternConstraints().isEmpty());
-        List<RangeConstraint> ranges = int16Ext.getRangeConstraints();
-        assertEquals(1, ranges.size());
-        RangeConstraint range = ranges.get(0);
-        assertEquals(BigInteger.ONE, range.getMin());
-        assertEquals(BigInteger.valueOf(100), range.getMax());
-
-        assertTrue(int16Ext.getBaseType() instanceof Int16);
-    }
-
-    @Test
-    public void testChoice() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        ContainerSchemaNode transfer = (ContainerSchemaNode) foo.getDataChildByName("transfer");
-        ChoiceSchemaNode how = (ChoiceSchemaNode) transfer.getDataChildByName("how");
-        Set<ChoiceCaseNode> cases = how.getCases();
-        assertEquals(5, cases.size());
-        ChoiceCaseNode input = null;
-        ChoiceCaseNode output = null;
-        for (ChoiceCaseNode caseNode : cases) {
-            if ("input".equals(caseNode.getQName().getLocalName())) {
-                input = caseNode;
-            } else if ("output".equals(caseNode.getQName().getLocalName())) {
-                output = caseNode;
-            }
-        }
-        assertNotNull(input);
-        assertNotNull(input.getPath());
-        assertNotNull(output);
-        assertNotNull(output.getPath());
-    }
-
-    @Test
-    public void testDeviation() {
-        Module foo = TestUtils.findModule(modules, "foo");
-        Set<Deviation> deviations = foo.getDeviations();
-        assertEquals(1, deviations.size());
-        Deviation dev = deviations.iterator().next();
-        assertEquals("system/user ref", dev.getReference());
-
-        List<QName> path = new ArrayList<>();
-        path.add(QName.create(barNS, barRev, "interfaces"));
-        path.add(QName.create(barNS, barRev, "ifEntry"));
-        SchemaPath expectedPath = SchemaPath.create(path, true);
-
-        assertEquals(expectedPath, dev.getTargetPath());
-        assertEquals(Deviate.ADD, dev.getDeviate());
-    }
-
-    @Test
-    public void testUnknownNode() {
-        Module baz = TestUtils.findModule(modules, "baz");
-        ContainerSchemaNode network = (ContainerSchemaNode) baz.getDataChildByName("network");
-        List<UnknownSchemaNode> unknownNodes = network.getUnknownSchemaNodes();
-        assertEquals(1, unknownNodes.size());
-        UnknownSchemaNode unknownNode = unknownNodes.get(0);
-        assertNotNull(unknownNode.getNodeType());
-        assertEquals("point", unknownNode.getNodeParameter());
-    }
-
-    @Test
-    public void testFeature() {
-        Module baz = TestUtils.findModule(modules, "baz");
-        Set<FeatureDefinition> features = baz.getFeatures();
-        assertEquals(1, features.size());
-    }
-
-    @Test
-    public void testExtension() {
-        Module baz = TestUtils.findModule(modules, "baz");
-        List<ExtensionDefinition> extensions = baz.getExtensionSchemaNodes();
-        assertEquals(1, extensions.size());
-        ExtensionDefinition extension = extensions.get(0);
-        assertEquals("name", extension.getArgument());
-        assertEquals("Takes as argument a name string. Makes the code generator use the given name in the #define.",
-                extension.getDescription());
-        assertTrue(extension.isYinElement());
-    }
-
-    @Test
-    public void testNotification() {
-        Module baz = TestUtils.findModule(modules, "baz");
-        String expectedPrefix = "c";
-
-        Set<NotificationDefinition> notifications = baz.getNotifications();
-        assertEquals(1, notifications.size());
-
-        NotificationDefinition notification = notifications.iterator().next();
-        // test SchemaNode args
-        QName expectedQName = QName.create(bazNS, bazRev, "event");
-        assertEquals(expectedQName, notification.getQName());
-        SchemaPath expectedPath = TestUtils.createPath(true, bazNS, bazRev, expectedPrefix, "event");
-        assertEquals(expectedPath, notification.getPath());
-        assertNull(notification.getDescription());
-        assertNull(notification.getReference());
-        assertEquals(Status.CURRENT, notification.getStatus());
-        assertEquals(0, notification.getUnknownSchemaNodes().size());
-        // test DataNodeContainer args
-        assertEquals(0, notification.getTypeDefinitions().size());
-        assertEquals(3, notification.getChildNodes().size());
-        assertEquals(0, notification.getGroupings().size());
-        assertEquals(0, notification.getUses().size());
-
-        LeafSchemaNode eventClass = (LeafSchemaNode) notification.getDataChildByName("event-class");
-        assertTrue(eventClass.getType() instanceof StringType);
-        LeafSchemaNode severity = (LeafSchemaNode) notification.getDataChildByName("severity");
-        assertTrue(severity.getType() instanceof StringType);
-    }
-
-    @Test
-    public void testRpc() {
-        Module baz = TestUtils.findModule(modules, "baz");
-
-        Set<RpcDefinition> rpcs = baz.getRpcs();
-        assertEquals(1, rpcs.size());
-
-        RpcDefinition rpc = rpcs.iterator().next();
-        assertEquals("Retrieve all or part of a specified configuration.", rpc.getDescription());
-        assertEquals("RFC 6241, Section 7.1", rpc.getReference());
-    }
-
-    @Test
-    public void testTypePath() throws ParseException {
-        Module bar = TestUtils.findModule(modules, "bar");
-        Set<TypeDefinition<?>> types = bar.getTypeDefinitions();
-
-        // int32-ext1
-        ExtendedType int32ext1 = (ExtendedType) TestUtils.findTypedef(types, "int32-ext1");
-        QName int32TypedefQName = int32ext1.getQName();
-
-        assertEquals(barNS, int32TypedefQName.getNamespace());
-        assertEquals(barRev, int32TypedefQName.getRevision());
-        assertEquals("int32-ext1", int32TypedefQName.getLocalName());
-
-        SchemaPath typeSchemaPath = int32ext1.getPath();
-        Iterable<QName> typePath = typeSchemaPath.getPathFromRoot();
-        Iterator<QName> typePathIt = typePath.iterator();
-        assertEquals(int32TypedefQName, typePathIt.next());
-        assertFalse(typePathIt.hasNext());
-
-        // int32-ext1/int32
-        Int32 int32 = (Int32) int32ext1.getBaseType();
-        assertEquals(Int32.getInstance(), int32);
-    }
-
-    @Test
-    public void testTypePath2() throws ParseException {
-        Module bar = TestUtils.findModule(modules, "bar");
-        Set<TypeDefinition<?>> types = bar.getTypeDefinitions();
-
-        // my-decimal-type
-        ExtendedType myDecType = (ExtendedType) TestUtils.findTypedef(types, "my-decimal-type");
-        QName myDecTypeQName = myDecType.getQName();
-
-        assertEquals(barNS, myDecTypeQName.getNamespace());
-        assertEquals(barRev, myDecTypeQName.getRevision());
-        assertEquals("my-decimal-type", myDecTypeQName.getLocalName());
-
-        SchemaPath typeSchemaPath = myDecType.getPath();
-        Iterable<QName> typePath = typeSchemaPath.getPathFromRoot();
-        Iterator<QName> typePathIt = typePath.iterator();
-        assertEquals(myDecTypeQName, typePathIt.next());
-        assertFalse(typePathIt.hasNext());
-
-        // my-base-int32-type/int32
-        Decimal64 dec64 = (Decimal64) myDecType.getBaseType();
-        QName dec64QName = dec64.getQName();
-
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:1"), dec64QName.getNamespace());
-        assertNull(dec64QName.getRevision());
-        assertEquals("decimal64", dec64QName.getLocalName());
-
-        SchemaPath dec64SchemaPath = dec64.getPath();
-        Iterable<QName> dec64Path = dec64SchemaPath.getPathFromRoot();
-        Iterator<QName> dec64PathIt = dec64Path.iterator();
-        assertEquals(myDecTypeQName, dec64PathIt.next());
-        assertEquals(dec64QName, dec64PathIt.next());
-        assertFalse(dec64PathIt.hasNext());
-    }
-
-    @Test
-    public void testParseMethod1() throws Exception {
-        File yangFile = new File(getClass().getResource("/parse-methods/m1.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/parse-methods").toURI());
-        YangContextParser parser = new YangParserImpl();
-        modules = parser.parseFile(yangFile, dependenciesDir).getModules();
-        assertEquals(6, modules.size());
-    }
-
-    @Test
-    public void testParseMethod2() throws Exception {
-        File yangFile = new File(getClass().getResource("/parse-methods/m1.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/parse-methods/dependencies").toURI());
-        YangContextParser parser = new YangParserImpl();
-        modules = parser.parseFile(yangFile, dependenciesDir).getModules();
-        assertEquals(6, modules.size());
-    }
-
-    @Test
-    public void testSorting() throws Exception {
-        // Correct order: m2, m4, m6, m8, m7, m6, m3, m1
-        File yangFile = new File(getClass().getResource("/sorting-test/m1.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/sorting-test").toURI());
-        YangContextParser parser = new YangParserImpl();
-        modules = parser.parseFile(yangFile, dependenciesDir).getModules();
-        SchemaContext ctx = new SchemaContextImpl(modules, Collections.emptyMap());
-        checkOrder(modules);
-        assertSetEquals(modules, ctx.getModules());
-
-        // ##########
-        parser = new YangParserImpl();
-        final File testDir = dependenciesDir;
-        final String[] fileList = testDir.list();
-        final List<File> testFiles = new ArrayList<>();
-        if (fileList == null) {
-            throw new FileNotFoundException(dependenciesDir.getAbsolutePath());
-        }
-        for (String fileName : fileList) {
-            testFiles.add(new File(testDir, fileName));
-        }
-        Set<Module> newModules = parser.parseFiles(testFiles).getModules();
-        assertSetEquals(newModules, modules);
-        ctx = new SchemaContextImpl(newModules, Collections.emptyMap());
-        assertSetEquals(newModules, ctx.getModules());
-        // ##########
-        newModules = parser.parseFiles(testFiles, null).getModules();
-        assertSetEquals(newModules, modules);
-        ctx = new SchemaContextImpl(newModules, Collections.emptyMap());
-        assertSetEquals(newModules, ctx.getModules());
-        // ##########
-        List<InputStream> streams = new ArrayList<>();
-        for (File f : testFiles) {
-            streams.add(new FileInputStream(f));
-        }
-        newModules = parser.parseSources(BuilderUtils.filesToByteSources(testFiles)).getModules();
-        assertSetEquals(newModules, modules);
-        ctx = new SchemaContextImpl(newModules, Collections.emptyMap());
-        assertSetEquals(newModules, ctx.getModules());
-        // ##########
-        streams.clear();
-        for (File f : testFiles) {
-            streams.add(new FileInputStream(f));
-        }
-        newModules = parser.parseSources(BuilderUtils.filesToByteSources(testFiles), null).getModules();
-        assertSetEquals(newModules, modules);
-        ctx = new SchemaContextImpl(newModules, Collections.emptyMap());
-        assertSetEquals(newModules, ctx.getModules());
-    }
-
-    private static void checkOrder(final Collection<Module> modules) {
-        Iterator<Module> it = modules.iterator();
-        Module m = it.next();
-        assertEquals("m2", m.getName());
-        m = it.next();
-        assertEquals("m4", m.getName());
-        m = it.next();
-        assertEquals("m6", m.getName());
-        m = it.next();
-        assertEquals("m8", m.getName());
-        m = it.next();
-        assertEquals("m7", m.getName());
-        m = it.next();
-        assertEquals("m5", m.getName());
-        m = it.next();
-        assertEquals("m3", m.getName());
-        m = it.next();
-        assertEquals("m1", m.getName());
-    }
-
-    private static void assertSetEquals(final Set<Module> s1, final Set<Module> s2) {
-        assertEquals(s1, s2);
-        Iterator<Module> it = s1.iterator();
-        for (Module m : s2) {
-            assertEquals(m, it.next());
-        }
-    }
-
-    @Test
-    public void testSubmodules() throws Exception {
-        Module foo = TestUtils.findModule(modules, "foo");
-
-        DataSchemaNode id = foo.getDataChildByName("id");
-        assertNotNull(id);
-        DataSchemaNode subExt = foo.getDataChildByName("sub-ext");
-        assertNotNull(subExt);
-        DataSchemaNode subTransfer = foo.getDataChildByName("sub-transfer");
-        assertNotNull(subTransfer);
-
-        assertEquals(2, foo.getExtensionSchemaNodes().size());
-        assertEquals(2, foo.getAugmentations().size());
-    }
-
-    @Test
-    public void unknownStatementInSubmoduleHeaderTest() throws IOException, URISyntaxException {
-
-        File yang = new File(getClass().getResource("/yang-grammar-test/submodule-header-extension.yang").toURI());
-
-        try {
-            YangParserImpl.getInstance().parseFile(yang, yang.getParentFile());
-        } catch (YangSyntaxErrorException | YangParseException e) {
-            e.printStackTrace();
-            fail("YangSyntaxErrorException or YangParseException should not be thrown");
-        }
-
-    }
-
-    @Test
-    public void unknownStatementBetweenRevisionsTest() throws IOException, URISyntaxException {
-
-        File yangModul = new File(getClass().getResource("/yang-grammar-test/revisions-extension.yang").toURI());
-        File yangSubmodul = new File(getClass().getResource("/yang-grammar-test/submodule-header-extension.yang")
-                .toURI());
-
-        List<File> yangs = new ArrayList<>();
-        yangs.add(yangModul);
-        yangs.add(yangSubmodul);
-
-        try {
-            YangParserImpl.getInstance().parseFiles(yangs);
-        } catch (YangParseException e) {
-            e.printStackTrace();
-            fail("YangParseException should not be thrown");
-        }
-    }
-
-    @Test
-    public void unknownStatementsInStatementsTest() throws IOException, URISyntaxException {
-        File yangModule1 = new File(getClass().getResource("/yang-grammar-test/stmtsep-in-statements.yang").toURI());
-        File yangModule2 = new File(getClass().getResource("/yang-grammar-test/stmtsep-in-statements2.yang").toURI());
-        File yangSubModule = new File(getClass().getResource("/yang-grammar-test/stmtsep-in-statements-sub.yang").toURI());
-
-        List<File> yangs = new ArrayList<>();
-        yangs.add(yangModule1);
-        yangs.add(yangModule2);
-        yangs.add(yangSubModule);
-
-        try {
-            YangParserImpl.getInstance().parseFiles(yangs);
-        } catch (YangParseException e) {
-            e.printStackTrace();
-            fail("YangParseException should not be thrown");
-        }
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserWithContextTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/YangParserWithContextTest.java
deleted file mode 100644 (file)
index 3103774..0000000
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.parser.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import com.google.common.collect.Lists;
-import com.google.common.io.ByteSource;
-import com.google.common.io.Resources;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigInteger;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Deviation;
-import org.opendaylight.yangtools.yang.model.api.Deviation.Deviate;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-
-public class YangParserWithContextTest {
-    private final DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-    private final YangParserImpl parser = new YangParserImpl();
-
-    private SchemaContext createContext(final String... resources) throws IOException, YangSyntaxErrorException {
-        final List<ByteSource> srcs = new ArrayList<>(resources.length);
-        for (String resource : resources) {
-            srcs.add(Resources.asByteSource(getClass().getResource(resource)));
-        }
-
-        return parser.parseSources(srcs);
-    }
-
-    @Test
-    public void testTypeFromContext() throws Exception {
-        SchemaContext context = createContext("/ietf/ietf-inet-types@2010-09-24.yang");
-
-        InputStream stream2 = new FileInputStream(new File(getClass().getResource("/context-test/test1.yang").toURI()));
-        Module module = TestUtils.loadModuleWithContext("test1", stream2, context);
-        stream2.close();
-        assertNotNull(module);
-
-        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName("id");
-
-        ExtendedType leafType = (ExtendedType) leaf.getType();
-        QName qname = leafType.getQName();
-        assertEquals(URI.create("urn:simple.demo.test1"), qname.getNamespace());
-        assertEquals(simpleDateFormat.parse("2013-06-18"), qname.getRevision());
-        assertEquals("port-number", qname.getLocalName());
-
-        ExtendedType leafBaseType = (ExtendedType) leafType.getBaseType();
-        qname = leafBaseType.getQName();
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:ietf-inet-types"), qname.getNamespace());
-        assertEquals(simpleDateFormat.parse("2010-09-24"), qname.getRevision());
-        assertEquals("port-number", qname.getLocalName());
-
-        ExtendedType dscpExt = (ExtendedType) TestUtils.findTypedef(module.getTypeDefinitions(), "dscp-ext");
-        List<RangeConstraint> ranges = dscpExt.getRangeConstraints();
-        assertEquals(1, ranges.size());
-        RangeConstraint range = ranges.get(0);
-        assertEquals(BigInteger.ZERO, range.getMin());
-        assertEquals(BigInteger.valueOf(63), range.getMax());
-    }
-
-    @Test
-    public void testUsesFromContext() throws Exception {
-        SchemaContext context = createContext("/model/baz.yang", "/model/bar.yang", "/model/foo.yang", "/model/subfoo.yang");
-        Module testModule;
-        try (InputStream stream = new FileInputStream(new File(getClass().getResource("/context-test/test2.yang")
-                .toURI()))) {
-            testModule = TestUtils.loadModuleWithContext("test2", stream, context);
-        }
-        assertNotNull(testModule);
-
-        // suffix _u = added by uses
-        // suffix _g = defined in grouping from context
-
-        // get grouping
-        Module contextModule = context.findModuleByNamespace(URI.create("urn:opendaylight.baz")).iterator().next();
-        assertNotNull(contextModule);
-        Set<GroupingDefinition> groupings = contextModule.getGroupings();
-        assertEquals(1, groupings.size());
-        GroupingDefinition grouping = groupings.iterator().next();
-
-        // get node containing uses
-        ContainerSchemaNode peer = (ContainerSchemaNode) testModule.getDataChildByName("peer");
-        ContainerSchemaNode destination = (ContainerSchemaNode) peer.getDataChildByName("destination");
-
-        // check uses
-        Set<UsesNode> uses = destination.getUses();
-        assertEquals(1, uses.size());
-
-        // check uses process
-        AnyXmlSchemaNode data_u = (AnyXmlSchemaNode) destination.getDataChildByName("data");
-        assertNotNull(data_u);
-        assertTrue(data_u.isAddedByUses());
-
-        AnyXmlSchemaNode data_g = (AnyXmlSchemaNode) grouping.getDataChildByName("data");
-        assertNotNull(data_g);
-        assertFalse(data_g.isAddedByUses());
-        assertFalse(data_u.equals(data_g));
-
-        ChoiceSchemaNode how_u = (ChoiceSchemaNode) destination.getDataChildByName("how");
-        assertNotNull(how_u);
-        assertTrue(how_u.isAddedByUses());
-
-        ChoiceSchemaNode how_g = (ChoiceSchemaNode) grouping.getDataChildByName("how");
-        assertNotNull(how_g);
-        assertFalse(how_g.isAddedByUses());
-        assertFalse(how_u.equals(how_g));
-
-        LeafSchemaNode address_u = (LeafSchemaNode) destination.getDataChildByName("address");
-        assertNotNull(address_u);
-        assertTrue(address_u.isAddedByUses());
-
-        LeafSchemaNode address_g = (LeafSchemaNode) grouping.getDataChildByName("address");
-        assertNotNull(address_g);
-        assertFalse(address_g.isAddedByUses());
-        assertFalse(address_u.equals(address_g));
-
-        ContainerSchemaNode port_u = (ContainerSchemaNode) destination.getDataChildByName("port");
-        assertNotNull(port_u);
-        assertTrue(port_u.isAddedByUses());
-
-        ContainerSchemaNode port_g = (ContainerSchemaNode) grouping.getDataChildByName("port");
-        assertNotNull(port_g);
-        assertFalse(port_g.isAddedByUses());
-        assertFalse(port_u.equals(port_g));
-
-        ListSchemaNode addresses_u = (ListSchemaNode) destination.getDataChildByName("addresses");
-        assertNotNull(addresses_u);
-        assertTrue(addresses_u.isAddedByUses());
-
-        ListSchemaNode addresses_g = (ListSchemaNode) grouping.getDataChildByName("addresses");
-        assertNotNull(addresses_g);
-        assertFalse(addresses_g.isAddedByUses());
-        assertFalse(addresses_u.equals(addresses_g));
-
-        // grouping defined by 'uses'
-        Set<GroupingDefinition> groupings_u = destination.getGroupings();
-        assertEquals(1, groupings_u.size());
-        GroupingDefinition grouping_u = groupings_u.iterator().next();
-        assertTrue(grouping_u.isAddedByUses());
-
-        // grouping defined in 'grouping' node
-        Set<GroupingDefinition> groupings_g = grouping.getGroupings();
-        assertEquals(1, groupings_g.size());
-        GroupingDefinition grouping_g = groupings_g.iterator().next();
-        assertFalse(grouping_g.isAddedByUses());
-        assertFalse(grouping_u.equals(grouping_g));
-
-        List<UnknownSchemaNode> nodes_u = destination.getUnknownSchemaNodes();
-        assertEquals(1, nodes_u.size());
-        UnknownSchemaNode node_u = nodes_u.get(0);
-        assertTrue(node_u.isAddedByUses());
-
-        List<UnknownSchemaNode> nodes_g = grouping.getUnknownSchemaNodes();
-        assertEquals(1, nodes_g.size());
-        UnknownSchemaNode node_g = nodes_g.get(0);
-        assertFalse(node_g.isAddedByUses());
-        assertFalse(node_u.equals(node_g));
-    }
-
-    @Test
-    public void testUsesRefineFromContext() throws Exception {
-        SchemaContext context = createContext("/model/baz.yang", "/model/bar.yang", "/model/foo.yang", "/model/subfoo.yang");
-
-        Module module;
-        try (InputStream stream = new FileInputStream(new File(getClass().getResource("/context-test/test2.yang")
-                .toURI()))) {
-            module = TestUtils.loadModuleWithContext("test2", stream, context);
-        }
-        assertNotNull(module);
-
-        ContainerSchemaNode peer = (ContainerSchemaNode) module.getDataChildByName("peer");
-        ContainerSchemaNode destination = (ContainerSchemaNode) peer.getDataChildByName("destination");
-        Set<UsesNode> usesNodes = destination.getUses();
-        assertEquals(1, usesNodes.size());
-        UsesNode usesNode = usesNodes.iterator().next();
-
-        // test grouping path
-        List<QName> path = new ArrayList<>();
-        QName qname = QName.create(URI.create("urn:opendaylight.baz"), simpleDateFormat.parse("2013-02-27"), "target");
-        path.add(qname);
-        SchemaPath expectedPath = SchemaPath.create(path, true);
-        assertEquals(expectedPath, usesNode.getGroupingPath());
-
-        // test refine
-        Map<SchemaPath, SchemaNode> refines = usesNode.getRefines();
-        assertEquals(3, refines.size());
-
-        LeafSchemaNode refineLeaf = null;
-        ContainerSchemaNode refineContainer = null;
-        ListSchemaNode refineList = null;
-        for (Map.Entry<SchemaPath, SchemaNode> entry : refines.entrySet()) {
-            SchemaNode value = entry.getValue();
-            if (value instanceof LeafSchemaNode) {
-                refineLeaf = (LeafSchemaNode) value;
-            } else if (value instanceof ContainerSchemaNode) {
-                refineContainer = (ContainerSchemaNode) value;
-            } else if (value instanceof ListSchemaNode) {
-                refineList = (ListSchemaNode) value;
-            }
-        }
-
-        // leaf address
-        assertNotNull(refineLeaf);
-        assertEquals("address", refineLeaf.getQName().getLocalName());
-        assertEquals("description of address defined by refine", refineLeaf.getDescription());
-        assertEquals("address reference added by refine", refineLeaf.getReference());
-        assertFalse(refineLeaf.isConfiguration());
-        assertTrue(refineLeaf.getConstraints().isMandatory());
-        Set<MustDefinition> leafMustConstraints = refineLeaf.getConstraints().getMustConstraints();
-        assertEquals(1, leafMustConstraints.size());
-        MustDefinition leafMust = leafMustConstraints.iterator().next();
-        assertEquals("\"ifType != 'ethernet' or (ifType = 'ethernet' and ifMTU = 1500)\"", leafMust.toString());
-
-        // container port
-        assertNotNull(refineContainer);
-        Set<MustDefinition> mustConstraints = refineContainer.getConstraints().getMustConstraints();
-        assertTrue(mustConstraints.isEmpty());
-        assertEquals("description of port defined by refine", refineContainer.getDescription());
-        assertEquals("port reference added by refine", refineContainer.getReference());
-        assertFalse(refineContainer.isConfiguration());
-        assertTrue(refineContainer.isPresenceContainer());
-
-        // list addresses
-        assertNotNull(refineList);
-        assertEquals("description of addresses defined by refine", refineList.getDescription());
-        assertEquals("addresses reference added by refine", refineList.getReference());
-        assertFalse(refineList.isConfiguration());
-        assertEquals(2, (int) refineList.getConstraints().getMinElements());
-        assertEquals(12, (int) refineList.getConstraints().getMaxElements());
-    }
-
-    @Test
-    public void testIdentity() throws Exception {
-        SchemaContext context;
-        File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/ietf").toURI());
-        YangContextParser parser = new YangParserImpl();
-        context = parser.parseFile(yangFile, dependenciesDir);
-
-        Module module;
-        try (InputStream stream = new FileInputStream(new File(getClass().getResource("/context-test/test3.yang")
-                .toURI()))) {
-            module = TestUtils.loadModuleWithContext("test3", stream, context);
-        }
-        assertNotNull(module);
-
-        Set<IdentitySchemaNode> identities = module.getIdentities();
-        assertEquals(1, identities.size());
-
-        IdentitySchemaNode identity = identities.iterator().next();
-        QName idQName = identity.getQName();
-        assertEquals(URI.create("urn:simple.demo.test3"), idQName.getNamespace());
-        assertEquals(simpleDateFormat.parse("2013-06-18"), idQName.getRevision());
-        assertEquals("pt", idQName.getLocalName());
-
-        IdentitySchemaNode baseIdentity = identity.getBaseIdentity();
-        QName idBaseQName = baseIdentity.getQName();
-        assertEquals(URI.create("urn:custom.types.demo"), idBaseQName.getNamespace());
-        assertEquals(simpleDateFormat.parse("2012-04-16"), idBaseQName.getRevision());
-        assertEquals("service-type", idBaseQName.getLocalName());
-    }
-
-    @Test
-    public void testUnknownNodes() throws Exception {
-        SchemaContext context;
-        File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/ietf").toURI());
-        YangContextParser parser = new YangParserImpl();
-        context = parser.parseFile(yangFile, dependenciesDir);
-
-        Module module;
-        try (InputStream stream = new FileInputStream(new File(getClass().getResource("/context-test/test3.yang")
-                .toURI()))) {
-            module = TestUtils.loadModuleWithContext("test3", stream, context);
-        }
-
-        ContainerSchemaNode network = (ContainerSchemaNode) module.getDataChildByName("network");
-        List<UnknownSchemaNode> unknownNodes = network.getUnknownSchemaNodes();
-        assertEquals(1, unknownNodes.size());
-
-        UnknownSchemaNode un = unknownNodes.get(0);
-        QName unType = un.getNodeType();
-        assertEquals(URI.create("urn:custom.types.demo"), unType.getNamespace());
-        assertEquals(simpleDateFormat.parse("2012-04-16"), unType.getRevision());
-        assertEquals("mountpoint", unType.getLocalName());
-        assertEquals("point", un.getNodeParameter());
-        assertNotNull(un.getExtensionDefinition());
-    }
-
-    @Test
-    public void testAugment() throws Exception {
-        // load first module
-        String resource = "/context-augment-test/test4.yang";
-        SchemaContext context = parser.parseFiles(Collections.singleton(new File(getClass().getResource(resource)
-                .toURI())));
-
-        // load another modules and parse them against already existing context
-        File test1 = new File(getClass().getResource("/context-augment-test/test1.yang").toURI());
-        File test2 = new File(getClass().getResource("/context-augment-test/test2.yang").toURI());
-        File test3 = new File(getClass().getResource("/context-augment-test/test3.yang").toURI());
-        Set<Module> modules = parser.parseFiles(Arrays.asList(test1, test2, test3), context).getModules();
-        assertNotNull(modules);
-
-        Module t4 = TestUtils.findModule(modules, "test4");
-        ContainerSchemaNode interfaces = (ContainerSchemaNode) t4.getDataChildByName("interfaces");
-        ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
-
-        // test augmentation process
-        ContainerSchemaNode augmentHolder = (ContainerSchemaNode) ifEntry.getDataChildByName("augment-holder");
-        assertNotNull(augmentHolder);
-        DataSchemaNode ds0 = augmentHolder.getDataChildByName("ds0ChannelNumber");
-        assertNotNull(ds0);
-        DataSchemaNode interfaceId = augmentHolder.getDataChildByName("interface-id");
-        assertNotNull(interfaceId);
-        DataSchemaNode higherLayerIf = augmentHolder.getDataChildByName("higher-layer-if");
-        assertNotNull(higherLayerIf);
-        ContainerSchemaNode schemas = (ContainerSchemaNode) augmentHolder.getDataChildByName("schemas");
-        assertNotNull(schemas);
-        assertNotNull(schemas.getDataChildByName("id"));
-
-        // test augment target after augmentation: check if it is same instance
-        ListSchemaNode ifEntryAfterAugment = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
-        assertTrue(ifEntry == ifEntryAfterAugment);
-    }
-
-    @Test
-    public void testDeviation() throws Exception {
-        // load first module
-        SchemaContext context = parser.parseFiles(Collections.singleton(
-            new File(getClass().getResource("/model/bar.yang").toURI())));
-
-        // load another modules and parse them against already existing context
-        Set<Module> modules;
-        try (InputStream stream = new FileInputStream(new File(getClass().getResource(
-                "/context-test/deviation-test.yang").toURI()))) {
-            List<InputStream> input = Lists.newArrayList(stream);
-            modules = TestUtils.loadModulesWithContext(input, context);
-        }
-        assertNotNull(modules);
-
-        // test deviation
-        Module testModule = TestUtils.findModule(modules, "deviation-test");
-        Set<Deviation> deviations = testModule.getDeviations();
-        assertEquals(1, deviations.size());
-        Deviation dev = deviations.iterator().next();
-
-        assertEquals("system/user ref", dev.getReference());
-
-        URI expectedNS = URI.create("urn:opendaylight.bar");
-        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date expectedRev = simpleDateFormat.parse("2013-07-03");
-        List<QName> path = new ArrayList<>();
-        path.add(QName.create(expectedNS, expectedRev, "interfaces"));
-        path.add(QName.create(expectedNS, expectedRev, "ifEntry"));
-        SchemaPath expectedPath = SchemaPath.create(path, true);
-
-        assertEquals(expectedPath, dev.getTargetPath());
-        assertEquals(Deviate.ADD, dev.getDeviate());
-    }
-
-}
index 3b7bcb60fb1a476c92ecbaeee5f055f169ca8390..7a166f7af293665f7a9a47e0bb1e77434d4f426f 100644 (file)
@@ -38,7 +38,8 @@ import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException
 import org.opendaylight.yangtools.yang.model.util.Int32;
 import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class SchemaContextUtilTest {
     @Mock
@@ -73,13 +74,9 @@ public class SchemaContextUtilTest {
 
     @Test
     public void findNodeInSchemaContextTest() throws URISyntaxException, IOException, YangSyntaxErrorException,
-            ParseException {
+            ParseException, ReactorException {
 
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module myModule = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -191,13 +188,9 @@ public class SchemaContextUtilTest {
 
     @Test
     public void findNodeInSchemaContextTest2() throws URISyntaxException, IOException, YangSyntaxErrorException,
-            ParseException {
-
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
+            ParseException, ReactorException {
 
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test") ;
 
         Module myModule = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -289,13 +282,9 @@ public class SchemaContextUtilTest {
 
     @Test
     public void findNodeInSchemaContextTest3() throws URISyntaxException, IOException, YangSyntaxErrorException,
-            ParseException {
-
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
+            ParseException, ReactorException {
 
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module myModule = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -358,13 +347,10 @@ public class SchemaContextUtilTest {
     }
 
     @Test
-    public void findParentModuleTest() throws URISyntaxException, IOException, YangSyntaxErrorException, ParseException {
+    public void findParentModuleTest() throws URISyntaxException, IOException, YangSyntaxErrorException, ParseException,
+            ReactorException {
 
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module myModule = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -419,13 +405,10 @@ public class SchemaContextUtilTest {
     }
 
     @Test
-    public void findDataSchemaNodeTest() throws URISyntaxException, IOException, YangSyntaxErrorException {
-
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
+    public void findDataSchemaNodeTest() throws URISyntaxException, IOException, YangSyntaxErrorException,
+            ReactorException {
 
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module module = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -446,15 +429,11 @@ public class SchemaContextUtilTest {
     }
 
     @Test
-    public void findDataSchemaNodeTest2() throws URISyntaxException, IOException, YangSyntaxErrorException {
+    public void findDataSchemaNodeTest2() throws URISyntaxException, IOException, YangSyntaxErrorException, ReactorException {
         // findDataSchemaNode(final SchemaContext context, final Module module,
         // final RevisionAwareXPath nonCondXPath) {
 
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module module = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -539,13 +518,9 @@ public class SchemaContextUtilTest {
 
     @Test
     public void findNodeInSchemaContextGroupingsTest() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, ParseException {
-
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
+            YangSyntaxErrorException, ParseException, ReactorException {
 
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module myModule = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -733,13 +708,9 @@ public class SchemaContextUtilTest {
 
     @Test
     public void findNodeInSchemaContextGroupingsTest2() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, ParseException {
+            YangSyntaxErrorException, ParseException, ReactorException {
 
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
-
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module myModule = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
@@ -874,13 +845,9 @@ public class SchemaContextUtilTest {
 
     @Test
     public void findNodeInSchemaContextTheSameNameOfSiblingsTest() throws URISyntaxException, IOException,
-            YangSyntaxErrorException, ParseException {
-
-        File resourceFile = new File(getClass().getResource("/schema-context-util-test/my-module.yang").toURI());
-        File resourceDir = resourceFile.getParentFile();
+            YangSyntaxErrorException, ParseException, ReactorException {
 
-        YangParserImpl parser = YangParserImpl.getInstance();
-        SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+        SchemaContext context = TestUtils.parseYangSources("/schema-context-util-test");
 
         Module myModule = context.findModuleByNamespaceAndRevision(new URI("uri:my-module"),
                 QName.parseRevision("2014-10-07"));
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentArgumentParsingTest.java
index 76503fea51c4285577053f4d31f2e657db9101e5..8313267f71b138b1d13f2bcb1d73a41999a50b2e 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveModelContext
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 
-public class AugmentTest {
+public class AugmentArgumentParsingTest {
 
     private static final YangStatementSourceImpl IMPORTED = new YangStatementSourceImpl(
             "/semantic-statement-parser/augment-arg-parsing/imported.yang", false);
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentProcessTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentProcessTest.java
index 890c47b0fc65fa4f49d9d07cc97f84935cf055a5..4df3f4069b2dcde642bd1dfb56a3593abeed8acf 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 93%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/AugmentSimplestTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentSimplestTest.java
index e64cc5b9a49f5d3496bfb283c040890dff8b5d90..51d0d0b5cb587b177bc35cdc37d7ff88e04abdb8 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/AugmentTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentTest.java
index 066ece47f84c7eb505d7234c7d5ea465ba333a40..febf7b747e3227a24ad3f870903543e54f3d57fc 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 89%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/AugmentToExtensionTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/AugmentToExtensionTest.java
index 4a2b330053b70d7242a34a0f701ee128ab82cfb5..a5d766fb197f41d499bc3e3a57f7949d4d72b945 100644 (file)
@@ -1,12 +1,14 @@
-/**
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertTrue;
 
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
-
 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
 import java.net.URISyntaxException;
 import java.util.Set;
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug1412Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug1412Test.java
index 674900de1bfb6d11119d72c632b3232322077c81..c87b34c022a53a0b1b2f33044962cdbd0a0958c6 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 91%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug1413Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug1413Test.java
index 31825cf1d82699c18418f7afdad0500fcbae19ca..22d196712bd91607b38b2cf6072585eb1bb83688 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug2219Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug2219Test.java
index 5834e145f7b15c2bdbfea7f20be7b9b6c0704d54..5a3202b03e9bee6b50294af792c4565807daa2b3 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.impl;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 
similarity index 88%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug2291Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug2291Test.java
index ad6a0dd0dc16fd0946eb9c2f1ec376a2f8ad0946..ac80873e3c739c6fa58b0f1c71015016ef044865 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
similarity index 85%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug3799Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug3799Test.java
index aa948710ba52a28fafa47c6514d294b242f21832..c322fed9f5716a12dc07a8804f0b3cca241afa85 100644 (file)
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 85%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug3859Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug3859Test.java
index a67ffb49817935a7ae66861f32715df0b297aacc..012cc1fa5500f2926c1390354cb248bad4ba69ed 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.impl;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug3874ExtensionTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug3874ExtensionTest.java
index e27d6e0db1e9eaf4e1fe68d2ec52e1cb31519273..0441cca3980f36148a517f196b7799219375b12d 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
similarity index 93%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug394Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug394Test.java
index 82c3165c500430d8a6e7d4b97eb342ba493af974..6d6fc0c232f2450192a69de4bccaa1494636a120 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug4079Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4079Test.java
index 7793a61f3260a60c78de141fa3a42309aa9f3b17..1669b1a477649b62f759a2a4c27bc2c499263b96 100644 (file)
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 81%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug4231Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4231Test.java
index 1f7ec433a0d7b2781300142c237f350ead2edb62..3840f86ddf88b0e66c2a155da14bffc6088935d1 100644 (file)
@@ -1,34 +1,33 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.impl;
+package org.opendaylight.yangtools.yang.stmt;
 
-import static org.junit.Assert.*;
-
-import java.text.ParseException;
+import static org.junit.Assert.assertNotNull;
 
+import java.io.IOException;
 import java.net.URI;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
-import org.opendaylight.yangtools.yang.common.QNameModule;
+import java.net.URISyntaxException;
+import java.text.ParseException;
+import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.common.QNameModule;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import org.junit.Test;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class Bug4231Test {
 
     @Test
-    public void test() throws IOException, URISyntaxException, ParseException {
-        SchemaContext context = TestUtils.loadSchemaContext(getClass()
-                .getResource("/bugs/bug4231").toURI());
+    public void test() throws IOException, URISyntaxException, ParseException, ReactorException {
+        SchemaContext context = TestUtils.parseYangSources("/bugs/bug4231");
 
         assertNotNull(context);
 
similarity index 92%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4410Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4410Test.java
index f8a939bf01a861726810e8fcdf171b897ed0dfbe..c281af83110f8d92f35f446d4a97b7bff0545429 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4456Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4456Test.java
index 88eb8cdba4adfa440839487a00e803ad6251094e..01cea68b48ceec021899fb95e044f3a92aca4135 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4459Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4459Test.java
index 2d95e5fca56a89ed7f8b908fdfe393105e4b698b..82dfcc24eeb0ec88bcb03e1a9693195326e771b4 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4610Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4610Test.java
index e3e9fb71930443e1275f31f298856f6465b01179..2c189753f94ace866c7653d2b95eb5bc13aa5245 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
similarity index 65%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/Bug4623Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4623Test.java
index 79f904e0c85d2e3d42c525467fdc83eae6401e03..8d4ba967263dc2f17f6d7f45bf2d885d43573906 100644 (file)
@@ -1,19 +1,24 @@
-package org.opendaylight.yangtools.yang.parser.impl;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import java.io.File;
-import java.math.BigInteger;
-import java.util.Arrays;
 import java.util.List;
-
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
+import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
 
 public class Bug4623Test {
 
@@ -22,10 +27,9 @@ public class Bug4623Test {
         // given
         File extdef = new File(getClass().getResource("/bugs/bug4623/extension-def.yang").toURI());
         File stringWithExt = new File(getClass().getResource("/bugs/bug4623/string-with-ext.yang").toURI());
-        YangContextParser parser = new YangParserImpl();
 
         // when
-        SchemaContext schemaContext = parser.parseFiles(Arrays.asList(extdef, stringWithExt));
+        SchemaContext schemaContext = TestUtils.parseYangSources(extdef, stringWithExt);
 
         LeafSchemaNode leaf = (LeafSchemaNode) schemaContext
                 .findModuleByName("types", null)
@@ -33,19 +37,19 @@ public class Bug4623Test {
 
         // then
         Assert.assertNotNull(leaf);
-        Assert.assertNotNull(leaf.getType());
 
-        final List<UnknownSchemaNode> unknownSchemaNodes = leaf.getUnknownSchemaNodes();
-        Assert.assertNotNull(leaf.getUnknownSchemaNodes());
+        final TypeDefinition<?> type = leaf.getType();
+        Assert.assertNotNull(type);
+        final List<UnknownSchemaNode> unknownSchemaNodes = type.getUnknownSchemaNodes();
+        Assert.assertNotNull(unknownSchemaNodes);
         Assert.assertFalse(unknownSchemaNodes.size() == 0);
 
         final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.get(0);
         Assert.assertEquals(unknownSchemaNode.getNodeParameter(), "unknown");
         Assert.assertEquals(unknownSchemaNode.getNodeType().getModule().getNamespace().toString(), "urn:simple.extension.typedefs");
 
-        final ExtendedType type = (ExtendedType) leaf.getType();
-        final List<LengthConstraint> lengthConstraints = type.getLengthConstraints();
-        final List<PatternConstraint> patternConstraints = type.getPatternConstraints();
+        final List<LengthConstraint> lengthConstraints = ((StringTypeDefinition) type).getLengthConstraints();
+        final List<PatternConstraint> patternConstraints = ((StringTypeDefinition) type).getPatternConstraints();
 
         Assert.assertNotNull(lengthConstraints);
         Assert.assertNotNull(patternConstraints);
@@ -53,23 +57,21 @@ public class Bug4623Test {
         Assert.assertFalse(patternConstraints.size() == 0);
 
         final LengthConstraint lengthConstraint = lengthConstraints.get(0);
-        Assert.assertEquals(lengthConstraint.getMin(), BigInteger.valueOf(2L));
-        Assert.assertEquals(lengthConstraint.getMax(), BigInteger.TEN);
+        Assert.assertEquals(lengthConstraint.getMin(), Integer.valueOf(2));
+        Assert.assertEquals(lengthConstraint.getMax(), Integer.valueOf(10));
 
         final PatternConstraint patternConstraint = patternConstraints.get(0);
         Assert.assertEquals(patternConstraint.getRegularExpression(), "^[0-9a-fA-F]$");
     }
 
-
     @Test
     public void testStringTypeWithUnknownSchemaNodeBetweenStringRestrictionStatements() throws Exception {
         // given
         File extdef = new File(getClass().getResource("/bugs/bug4623/extension-def.yang").toURI());
         File stringWithExt = new File(getClass().getResource("/bugs/bug4623/string-with-ext.yang").toURI());
-        YangContextParser parser = new YangParserImpl();
 
         // when
-        SchemaContext schemaContext = parser.parseFiles(Arrays.asList(extdef, stringWithExt));
+        SchemaContext schemaContext = TestUtils.parseYangSources(extdef, stringWithExt);
 
         LeafSchemaNode leaf = (LeafSchemaNode) schemaContext
                 .findModuleByName("types", null)
@@ -77,19 +79,19 @@ public class Bug4623Test {
 
         // then
         Assert.assertNotNull(leaf);
-        Assert.assertNotNull(leaf.getType());
 
-        final List<UnknownSchemaNode> unknownSchemaNodes = leaf.getUnknownSchemaNodes();
-        Assert.assertNotNull(leaf.getUnknownSchemaNodes());
+        final TypeDefinition<?> type = leaf.getType();
+        Assert.assertNotNull(type);
+        final List<UnknownSchemaNode> unknownSchemaNodes = type.getUnknownSchemaNodes();
+        Assert.assertNotNull(unknownSchemaNodes);
         Assert.assertFalse(unknownSchemaNodes.size() == 0);
 
         final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.get(0);
         Assert.assertEquals(unknownSchemaNode.getNodeParameter(), "unknown");
         Assert.assertEquals(unknownSchemaNode.getNodeType().getModule().getNamespace().toString(), "urn:simple.extension.typedefs");
 
-        final ExtendedType type = (ExtendedType) leaf.getType();
-        final List<LengthConstraint> lengthConstraints = type.getLengthConstraints();
-        final List<PatternConstraint> patternConstraints = type.getPatternConstraints();
+        final List<LengthConstraint> lengthConstraints = ((StringTypeDefinition) type).getLengthConstraints();
+        final List<PatternConstraint> patternConstraints = ((StringTypeDefinition) type).getPatternConstraints();
 
         Assert.assertNotNull(lengthConstraints);
         Assert.assertNotNull(patternConstraints);
@@ -97,8 +99,8 @@ public class Bug4623Test {
         Assert.assertFalse(patternConstraints.size() == 0);
 
         final LengthConstraint lengthConstraint = lengthConstraints.get(0);
-        Assert.assertEquals(lengthConstraint.getMin(), BigInteger.valueOf(2L));
-        Assert.assertEquals(lengthConstraint.getMax(), BigInteger.TEN);
+        Assert.assertEquals(lengthConstraint.getMin(), Integer.valueOf(2));
+        Assert.assertEquals(lengthConstraint.getMax(), Integer.valueOf(10));
 
         final PatternConstraint patternConstraint = patternConstraints.get(0);
         Assert.assertEquals(patternConstraint.getRegularExpression(), "^[0-9a-fA-F]$");
@@ -109,10 +111,9 @@ public class Bug4623Test {
         // given
         File extdef = new File(getClass().getResource("/bugs/bug4623/extension-def.yang").toURI());
         File stringWithExt = new File(getClass().getResource("/bugs/bug4623/string-with-ext.yang").toURI());
-        YangContextParser parser = new YangParserImpl();
 
         // when
-        SchemaContext schemaContext = parser.parseFiles(Arrays.asList(extdef, stringWithExt));
+        SchemaContext schemaContext = TestUtils.parseYangSources(extdef, stringWithExt);
 
         LeafSchemaNode leaf = (LeafSchemaNode) schemaContext
                 .findModuleByName("types", null)
@@ -120,19 +121,19 @@ public class Bug4623Test {
 
         // then
         Assert.assertNotNull(leaf);
-        Assert.assertNotNull(leaf.getType());
 
-        final List<UnknownSchemaNode> unknownSchemaNodes = leaf.getUnknownSchemaNodes();
-        Assert.assertNotNull(leaf.getUnknownSchemaNodes());
+        final TypeDefinition<?> type = leaf.getType();
+        Assert.assertNotNull(type);
+        final List<UnknownSchemaNode> unknownSchemaNodes = type.getUnknownSchemaNodes();
+        Assert.assertNotNull(unknownSchemaNodes);
         Assert.assertFalse(unknownSchemaNodes.size() == 0);
 
         final UnknownSchemaNode unknownSchemaNode = unknownSchemaNodes.get(0);
         Assert.assertEquals(unknownSchemaNode.getNodeParameter(), "unknown");
         Assert.assertEquals(unknownSchemaNode.getNodeType().getModule().getNamespace().toString(), "urn:simple.extension.typedefs");
 
-        final ExtendedType type = (ExtendedType) leaf.getType();
-        final List<LengthConstraint> lengthConstraints = type.getLengthConstraints();
-        final List<PatternConstraint> patternConstraints = type.getPatternConstraints();
+        final List<LengthConstraint> lengthConstraints = ((StringTypeDefinition) type).getLengthConstraints();
+        final List<PatternConstraint> patternConstraints = ((StringTypeDefinition) type).getPatternConstraints();
 
         Assert.assertNotNull(lengthConstraints);
         Assert.assertNotNull(patternConstraints);
@@ -140,8 +141,8 @@ public class Bug4623Test {
         Assert.assertFalse(patternConstraints.size() == 0);
 
         final LengthConstraint lengthConstraint = lengthConstraints.get(0);
-        Assert.assertEquals(lengthConstraint.getMin(), BigInteger.valueOf(2L));
-        Assert.assertEquals(lengthConstraint.getMax(), BigInteger.TEN);
+        Assert.assertEquals(lengthConstraint.getMin(), Integer.valueOf(2));
+        Assert.assertEquals(lengthConstraint.getMax(), Integer.valueOf(10));
 
         final PatternConstraint patternConstraint = patternConstraints.get(0);
         Assert.assertEquals(patternConstraint.getRegularExpression(), "^[0-9a-fA-F]$");
similarity index 93%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug4933Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4933Test.java
index 14ba17be33d0909ad988dfaa758ad69e665fe9d6..b927b18325d2174a913bd273ba86ea290acde4d2 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 88%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5059.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5059.java
index 35f2437ee59a016dd007f7b829cac2e6f3e558f6..87544fdb47f421e4d3fe02373f929486841231ef 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5101.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5101.java
index 38e26a2e059aff80dd95d7e6de7a03d6ef6d3bd5..a1aa9b1ea7314c2cd5013e900e5ad81c53073844 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5335.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5335.java
index 79466129744566e835fe836f75fbedd59543608b..4904566c28ddc126edebb7a58886dccd116b80de 100644 (file)
@@ -5,7 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5396.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5396.java
index 932339604cdd49281d08da38569dc304739a97d5..be64e022aeda776124ed1fb98a23e8fbcd1dd67c 100644 (file)
@@ -5,7 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5437.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5437.java
index d912aa869692623d72b667aa8057e61b5b478cf9..3dcadbfc2f6993f037d9ce24da5dce03e22cf0f4 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5481.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5481.java
index 703c5884bbd3ffda9eacd624ab968a4fd90cb365..71f6a89ffaa9b51e5cefeb6da76eb874675bb8a1 100644 (file)
@@ -5,7 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 93%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/Bug5550.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5550.java
index 828c7eb6f3b2c1e5cd5b3d895dbf187ea5caa9f1..88952ef702d502e88c68a8c5e5c25fe9a53d8b1e 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug5693Test.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5693Test.java
index a4cec623a68188ea83ec6a772c0781852dc528bd..f6f30606327634eb1ee38d0306feecbdf6644cf2 100644 (file)
@@ -5,7 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/CaseStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/CaseStmtTest.java
index 72c001fa50f7809b22850b12182c5f5e25dcf89c..0aa86e76a78dfd25a866efaef689c7c67c1d5623 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ChoiceStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ChoiceStmtTest.java
index b63e9d87863ba086497afb583381d9559ddb8c2a..e20922e2e609051fc36f06bb95096aa6c8f40406 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ControllerStmtParserTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ControllerStmtParserTest.java
index 1a379d5a3b353769b6ca4b1693ea63aaffb91437..8dfcfbc37f9c03598d7705034e618682ad0c8fd7 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/DeclaredStatementsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/DeclaredStatementsTest.java
index fb6133449ba5eaf8a14297b7867dcaa6d2cbaefd..04eb76b7c47b78dc83c4240e72d2cd662c40f7a5 100644 (file)
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveBuildTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveBuildTest.java
index 31e28fdb2d867354d0d7b324d7a2b54372feaed5..8371a46de4eab1fbc939a74f73cba3b4b2f4417d 100644 (file)
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.effective.build.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 92%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveIdentityTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveIdentityTest.java
index 109800d5dfcdee082805cc8ea8ca4f24f1f7335c..c62354933ed632b5e670614cf57ffc120e833e87 100644 (file)
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.effective.build.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -19,7 +27,6 @@ import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 import org.junit.Test;
 
 public class EffectiveIdentityTest {
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/effective/build/test/EffectiveModuleTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/EffectiveModuleTest.java
index 257e23716c5dfe468ddcf9c66dd9afbea5266d64..7345f40ad8aafb1fcb3d051ae6b25ff593ddc202 100644 (file)
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.effective.build.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.effective.build.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -19,7 +27,6 @@ import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementR
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 
 public class EffectiveModulesAndSubmodulesTest {
 
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.effective.build.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.effective.build.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -24,7 +32,6 @@ import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementR
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 
 public class EffectiveUsesRefineAndConstraintsTest {
 
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ExtensionStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ExtensionStmtTest.java
index d52a8b548326385acdcb3df08d1e26c7e55024b4..a1656d11b72b59336995534cb6e656e654bde7d3 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/GroupingAndUsesStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/GroupingAndUsesStmtTest.java
index 2cff899fbbc26c9cd5faf274d26c96e42d024313..29ef6aa8e7def704f39c6cbbe78c78219bb2f2fc 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.is;
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/GroupingTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/GroupingTest.java
index 4104c3997622baaa19ab0d40e5ba3375dd0019a5..4ea17ae02977476c5564a7478ee5f43a3450229b 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IdentityStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IdentityStmtTest.java
index 3f8551f6a9392b8057946a172b47ce24b873dfb4..8703c20c8d81523c943f5dfe37633ac4cb26895c 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.is;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ImportResolutionBasicTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ImportResolutionBasicTest.java
index cd56e7e472a873549f6ac97a69cad1cb0674d100..7e1189f90034e3442f65e266a9457418df441a67 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ImportRevisionsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ImportRevisionsTest.java
index 67d2f7f703b586ce6c8c73179902c647fe03950b..57058b5b01211a1fab1b05abe8c880fb1642d5c8 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 
similarity index 92%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IncludeResolutionTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IncludeResolutionTest.java
index 49236cffa67e12e051a924143467559b55e1241c..745f71f22d9403fdad6bb1a6fb740e68a6ce6e95 100644 (file)
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IncludeRevisionsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IncludeRevisionsTest.java
index 0b48f1f2c3d348165cc93396933333c6646195db..cfc5e89e63d53fa464637960c223b32ec14f8eb0 100644 (file)
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/IncludedStmtsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/IncludedStmtsTest.java
index 111fee905e43df581391f9d7a9ace775dd18d77c..e293bdf4c420a8bd67a0c5ef695b86dbf20f5451 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.is;
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/KeyTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/KeyTest.java
index bf6fef1fabf482182b18cbebc699fd17920b43f5..5c3eb5f16c3c2a2e82e016a78c67e625ce947df2 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/ListKeysTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ListKeysTest.java
index 9183fae91503ac95e3af1139c41ebc00f7f147f2..d772e493c183ebcdf56b43702081b0b8b97134fd 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/ListTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ListTest.java
index 8dae4dd3369c5d1d6b17750ec093142066ae5c43..9555b5646a2774b569b62e921e93c54c664a4f09 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.effective.build.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import java.io.FileNotFoundException;
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/impl/ModuleIdentifierTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ModuleIdentifierTest.java
index 22d30c5a675528e351234e384d14e0db036b9c21..5db2262ebf1a205b25c89472785ed39e14e764cf 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.parser.impl;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/MoreRevisionsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MoreRevisionsTest.java
index 8b7a08524643960a5d92c09d6ba53ca1a60becac..4002451dfe658feea225dd4a2ade9ae72b07dede 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/MustAndWhenStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/MustAndWhenStmtTest.java
index 1c0200f96292e32ae092029d991940f519b04d33..63d51c1afa943c93386529dcd8f376efc685f5ad 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.is;
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/NotificationStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/NotificationStmtTest.java
index e5ae792a3249e604ef87c8012206e092139d8874..8918f44d62d548df4475d1a741d904b4d24f4432 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/OrderingTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/OrderingTest.java
index 7fa2df4e0b38602702d3687a3aa892b4d32a6fbd..3c94b8ebdc761e3b1ae9abdc25a24bff0217b46b 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
similarity index 88%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/ParsingExtensionValueTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/ParsingExtensionValueTest.java
index 01704fc2eb52c70dc0f8ba69de90d1edfc4ae6d6..10590da39e62fa477851b3215fa0e2d81da60bb6 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/RpcStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/RpcStmtTest.java
index 2fa97092af8709424c29970112995b9aa669c380..47a4b8834b12566cd5fbb391eea2e78c15882639 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/SchemaContextTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/SchemaContextTest.java
index d6677a9339c715b75812027adbe83ebfdc8fef3a..18ac884e4ccb247bfa70f6d24bdcd05c8a2a8e79 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.mockito.Mockito.doReturn;
 import java.net.URI;
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/SchemaContextUtilTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/SchemaContextUtilTest.java
index bd614c138152d830519550a4635c5310ac8a0b94..e0349c59017f567a28d65456c07253d9bf3515e5 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/StmtTestUtils.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java
index e264b192082115733b9774735be8ccab3becebc0..68550261279b0624044234d50b6eeebbd7f13eb7 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import java.io.FileFilter;
 
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/SubstatementValidatorTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/SubstatementValidatorTest.java
index f4fe296a26ef73c6bcddef7b07013ce0d8518076..4bd9f8e8a83f2870c506f445dc338ece727892fc 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -24,7 +24,7 @@ import org.junit.rules.ExpectedException;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.MissingSubstatementException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class SubstatementValidatorTest {
 
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/TestUtils.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TestUtils.java
index 50af9ba031315e4a8ab4a472e4e6eda8a62889cc..94d63ae004575ab3726152d4a8825a470a40ec06 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import java.io.File;
@@ -42,7 +42,6 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceIm
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YinStatementSourceImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
 import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
similarity index 86%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/TwoRevisionsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TwoRevisionsTest.java
index 7e6c419926fea13df26affc6afa6faeac21a5bdf..edd46fe8489c8492a45a0c9ac49bed6cbf50f116 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 
similarity index 88%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/TypedefConstraintsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TypedefConstraintsTest.java
index d8b6fc29b4d475d0f16fdb56586d2012050afffe..19017bf025eca725e8c880a86e117e545a9d8e21 100644 (file)
@@ -1,4 +1,12 @@
-package org.opendaylight.yangtools.yang.stmt.test;
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/TypedefSubStmtsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TypedefSubStmtsTest.java
index 7effe22d3984e07948a1441db459836ebb039273..075a3846ccb006b800153b37bfc619718b6dcef0 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 83%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/TypesResolutionTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TypesResolutionTest.java
index 94b4464139f6e8851bab6e1c21044584eea23342..01c44391d570053942492bd369343e0dc5baa269 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -13,8 +13,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import java.io.File;
-import java.math.BigInteger;
 import java.net.URI;
 import java.util.List;
 import java.util.Set;
@@ -26,20 +24,18 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit;
+import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair;
+import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.util.BitsType;
-import org.opendaylight.yangtools.yang.model.util.EnumerationType;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.model.util.IdentityrefType;
-import org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType;
-import org.opendaylight.yangtools.yang.model.util.UnionType;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
@@ -50,10 +46,17 @@ public class TypesResolutionTest {
 
     @Before
     public void init() throws Exception {
-        File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/ietf").toURI());
-        YangContextParser parser = new YangParserImpl();
-        testedModules = parser.parseFile(yangFile, dependenciesDir).getModules();
+        final StatementStreamSource yangFile =
+                new YangStatementSourceImpl("/types/custom-types-test@2012-4-4.yang", false);
+        final StatementStreamSource yangFileDependency1 =
+                new YangStatementSourceImpl ("/ietf/iana-timezones@2012-07-09.yang", false);
+        final StatementStreamSource yangFileDependency2 =
+                new YangStatementSourceImpl ("/ietf/ietf-inet-types@2010-09-24.yang", false);
+        final StatementStreamSource yangFileDependency3 =
+                new YangStatementSourceImpl ("/ietf/ietf-yang-types@2010-09-24.yang", false);
+
+        testedModules = TestUtils.parseYangSources(yangFile, yangFileDependency1, yangFileDependency2,
+                yangFileDependency3).getModules();
         assertEquals(4, testedModules.size());
     }
 
@@ -67,7 +70,7 @@ public class TypesResolutionTest {
         assertTrue(type.getDescription().contains("This value represents the version of the IP protocol."));
         assertTrue(type.getReference().contains("RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"));
 
-        EnumerationType enumType = (EnumerationType) type.getBaseType();
+        EnumTypeDefinition enumType = (EnumTypeDefinition) type.getBaseType();
         List<EnumPair> values = enumType.getValues();
         assertEquals(3, values.size());
 
@@ -93,7 +96,7 @@ public class TypesResolutionTest {
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
 
         TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-version");
-        EnumerationType enumType = (EnumerationType) type.getBaseType();
+        EnumTypeDefinition enumType = (EnumTypeDefinition) type.getBaseType();
         List<EnumPair> values = enumType.getValues();
         assertEquals(4, values.size());
 
@@ -123,16 +126,16 @@ public class TypesResolutionTest {
         Module tested = TestUtils.findModule(testedModules, "ietf-inet-types");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
         TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-address");
-        UnionType baseType = (UnionType) type.getBaseType();
+        UnionTypeDefinition baseType = (UnionTypeDefinition) type.getBaseType();
         List<TypeDefinition<?>> unionTypes = baseType.getTypes();
 
-        ExtendedType ipv4 = (ExtendedType) unionTypes.get(0);
+        StringTypeDefinition ipv4 = (StringTypeDefinition) unionTypes.get(0);
         assertTrue(ipv4.getBaseType() instanceof StringTypeDefinition);
         String expectedPattern = "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}"
                 + "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" + "(%[\\p{N}\\p{L}]+)?$";
         assertEquals(expectedPattern, ipv4.getPatternConstraints().get(0).getRegularExpression());
 
-        ExtendedType ipv6 = (ExtendedType) unionTypes.get(1);
+        StringTypeDefinition ipv6 = (StringTypeDefinition) unionTypes.get(1);
         assertTrue(ipv6.getBaseType() instanceof StringTypeDefinition);
         List<PatternConstraint> ipv6Patterns = ipv6.getPatternConstraints();
         expectedPattern = "^((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}"
@@ -149,7 +152,7 @@ public class TypesResolutionTest {
     public void testDomainName() {
         Module tested = TestUtils.findModule(testedModules, "ietf-inet-types");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        ExtendedType type = (ExtendedType) TestUtils.findTypedef(typedefs, "domain-name");
+        StringTypeDefinition type = (StringTypeDefinition) TestUtils.findTypedef(typedefs, "domain-name");
         assertTrue(type.getBaseType() instanceof StringTypeDefinition);
         List<PatternConstraint> patterns = type.getPatternConstraints();
         assertEquals(1, patterns.size());
@@ -160,15 +163,16 @@ public class TypesResolutionTest {
         List<LengthConstraint> lengths = type.getLengthConstraints();
         assertEquals(1, lengths.size());
         LengthConstraint length = type.getLengthConstraints().get(0);
-        assertEquals(BigInteger.ONE, length.getMin());
-        assertEquals(BigInteger.valueOf(253), length.getMax());
+        assertEquals(Integer.valueOf(1), length.getMin());
+        assertEquals(Integer.valueOf(253), length.getMax());
     }
 
     @Test
     public void testInstanceIdentifier1() {
         Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf1");
-        InstanceIdentifierType leafType = (InstanceIdentifierType) leaf.getType();
+        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
+                QName.create(tested.getQNameModule(), "inst-id-leaf1"));
+        InstanceIdentifierTypeDefinition leafType = (InstanceIdentifierTypeDefinition) leaf.getType();
         assertFalse(leafType.requireInstance());
         assertEquals(1, leaf.getUnknownSchemaNodes().size());
     }
@@ -176,9 +180,10 @@ public class TypesResolutionTest {
     @Test
     public void testInstanceIdentifier2() {
         Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf2");
-        InstanceIdentifierType leafType = (InstanceIdentifierType) leaf.getType();
-        assertTrue(leafType.requireInstance());
+        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
+                QName.create(tested.getQNameModule(), "inst-id-leaf2"));
+        InstanceIdentifierTypeDefinition leafType = (InstanceIdentifierTypeDefinition) leaf.getType();
+        assertFalse(leafType.requireInstance());
     }
 
     @Test
@@ -215,8 +220,9 @@ public class TypesResolutionTest {
     @Test
     public void testBitsType1() {
         Module tested = TestUtils.findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("mybits");
-        BitsType leafType = (BitsType) leaf.getType();
+        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName(
+                QName.create(tested.getQNameModule(), "mybits"));
+        BitsTypeDefinition leafType = (BitsTypeDefinition) leaf.getType();
         List<Bit> bits = leafType.getBits();
         assertEquals(3, bits.size());
 
@@ -239,7 +245,7 @@ public class TypesResolutionTest {
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
         TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "access-operations-type");
 
-        BitsType bitsType = (BitsType) testedType.getBaseType();
+        BitsTypeDefinition bitsType = (BitsTypeDefinition) testedType.getBaseType();
         List<Bit> bits = bitsType.getBits();
         assertEquals(5, bits.size());
 
@@ -253,10 +259,10 @@ public class TypesResolutionTest {
         assertEquals(501L, (long) bit2.getPosition());
 
         Bit bit3 = bits.get(3);
-        assertEquals(365L, (long) bit3.getPosition());
+        assertEquals(502L, (long) bit3.getPosition());
 
         Bit bit4 = bits.get(4);
-        assertEquals(502L, (long) bit4.getPosition());
+        assertEquals(365L, (long) bit4.getPosition());
     }
 
     @Test
@@ -267,7 +273,7 @@ public class TypesResolutionTest {
 
         String expectedDesc = "A timezone location as defined by the IANA timezone";
         assertTrue(testedType.getDescription().contains(expectedDesc));
-        assertTrue(testedType.getReference().isEmpty());
+        assertNull(testedType.getReference());
         assertEquals(Status.CURRENT, testedType.getStatus());
 
         QName testedTypeQName = testedType.getQName();
@@ -275,7 +281,7 @@ public class TypesResolutionTest {
         assertEquals(TestUtils.createDate("2012-07-09"), testedTypeQName.getRevision());
         assertEquals("iana-timezone", testedTypeQName.getLocalName());
 
-        EnumerationType enumType = (EnumerationType) testedType.getBaseType();
+        EnumTypeDefinition enumType = (EnumTypeDefinition) testedType.getBaseType();
         List<EnumPair> values = enumType.getValues();
         assertEquals(415, values.size()); // 0-414
 
@@ -294,7 +300,8 @@ public class TypesResolutionTest {
     public void testObjectId128() {
         Module tested = TestUtils.findModule(testedModules, "ietf-yang-types");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        ExtendedType testedType = (ExtendedType) TestUtils.findTypedef(typedefs, "object-identifier-128");
+        StringTypeDefinition testedType = (StringTypeDefinition) TestUtils.findTypedef(typedefs,
+                "object-identifier-128");
 
         List<PatternConstraint> patterns = testedType.getPatternConstraints();
         assertEquals(1, patterns.size());
@@ -306,7 +313,7 @@ public class TypesResolutionTest {
         assertEquals(TestUtils.createDate("2010-09-24"), testedTypeQName.getRevision());
         assertEquals("object-identifier-128", testedTypeQName.getLocalName());
 
-        ExtendedType testedTypeBase = (ExtendedType) testedType.getBaseType();
+        StringTypeDefinition testedTypeBase = testedType.getBaseType();
         patterns = testedTypeBase.getPatternConstraints();
         assertEquals(1, patterns.size());
 
@@ -325,13 +332,13 @@ public class TypesResolutionTest {
         Module tested = TestUtils.findModule(testedModules, "custom-types-test");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
         TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "service-type-ref");
-        IdentityrefType baseType = (IdentityrefType) testedType.getBaseType();
+        IdentityrefTypeDefinition baseType = (IdentityrefTypeDefinition) testedType.getBaseType();
         QName identity = baseType.getIdentity().getQName();
         assertEquals(URI.create("urn:custom.types.demo"), identity.getNamespace());
         assertEquals(TestUtils.createDate("2012-04-16"), identity.getRevision());
         assertEquals("service-type", identity.getLocalName());
 
-        LeafSchemaNode type = (LeafSchemaNode) tested.getDataChildByName("type");
+        LeafSchemaNode type = (LeafSchemaNode) tested.getDataChildByName(QName.create(tested.getQNameModule(), "type"));
         assertNotNull(type);
     }
 
similarity index 99%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/UsesAugmentTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/UsesAugmentTest.java
index 4adc20e38e5230a4eee89e8be2f8eb94cef2d845..d88d36eade2eddc86431baa94e63c0c368c5737e 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/YangFileStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangFileStmtTest.java
index c4481c38ca268fef6945b7f31b3d9660e997f338..9cf23810b50d7cb2c47b18d9426ed10cacacad86 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 
similarity index 97%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangModelValidationListTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationListTest.java
index 70a9926836b0f32f6a64378cc2e299c8765e675c..8e6013bc4609d5af48f46f0dcf8b19ab540e3663 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangModelValidationModuleTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationModuleTest.java
index 6088ec569c2f4d3dde2acc58af1519ac02e36f1a..8818e15b973cfdc75190b3d164bdffba98d9a79a 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangModelValidationTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangModelValidationTest.java
index 2cc4f1530499b79508e04f78f3107631ae4a643d..88be16d2805e95f108037f2fdf56f7a4a6c8e532 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertThat;
similarity index 93%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserIdentityTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserIdentityTest.java
index 662022dbabc22114e2e20f5783daa83043067825..17899d1aa71825f6d6add6d25c9824b2b1c79277 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
@@ -21,7 +21,6 @@ import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
 import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 
 public class YangParserIdentityTest {
 
similarity index 88%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserNegativeTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserNegativeTest.java
index cd6e6f5ff5443b3ff75440146cfc8812da1fc510..29543ee044925e853727b1cb2bd8885f6d62f491 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -22,13 +22,10 @@ import java.util.List;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
-import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
 
 public class YangParserNegativeTest {
 
@@ -243,34 +240,6 @@ public class YangParserNegativeTest {
         }
     }
 
-    @Test
-    public void testWrongDependenciesDir() throws Exception {
-        try {
-            File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-            File dependenciesDir = new File("/invalid");
-            YangContextParser parser = new YangParserImpl();
-            parser.parseFile(yangFile, dependenciesDir);
-            fail("Exception should be thrown");
-        } catch (IllegalStateException e) {
-            String expected = File.separator + "invalid does not exists";
-            assertEquals(expected, e.getMessage());
-        }
-    }
-
-    @Test
-    public void testWrongDependenciesDir2() throws Exception {
-        try {
-            File yangFile = new File(getClass().getResource("/types/custom-types-test@2012-4-4.yang").toURI());
-            File dependenciesDir = new File(getClass().getResource("/model").toURI());
-            YangContextParser parser = new YangParserImpl();
-            parser.parseFile(yangFile, dependenciesDir);
-            fail("Exception should be thrown");
-        } catch (YangValidationException e) {
-            String expected = "Not existing module imported";
-            assertTrue(e.getMessage().contains(expected));
-        }
-    }
-
     @Test
     public void testInvalidListKeyDefinition() throws Exception {
         File yang1 = new File(getClass().getResource("/negative-scenario/invalid-list-key-def.yang").toURI());
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserSimpleTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserSimpleTest.java
index 5451ac7f12c39bd6b208f854ec4d942a612ae262..d7799e7ff833be72d599773ea14c2d36cf70e589 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
similarity index 88%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserTest.java
index 72771f6c04942332419f9242baeddffc486409fd..a541a29151aec5d1486674f1af865a8dde907aa4 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -58,11 +58,9 @@ import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
 import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
@@ -757,91 +755,6 @@ public class YangParserTest {
         assertFalse(dec64PathIt.hasNext());
     }
 
-    @Test
-    public void testParseMethod1() throws Exception {
-        File yangFile = new File(getClass().getResource("/parse-methods/m1.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/parse-methods").toURI());
-        YangContextParser parser = new YangParserImpl();
-        modules = parser.parseFile(yangFile, dependenciesDir).getModules();
-        assertEquals(6, modules.size());
-    }
-
-    @Test
-    public void testParseMethod2() throws Exception {
-        File yangFile = new File(getClass().getResource("/parse-methods/m1.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/parse-methods/dependencies").toURI());
-        YangContextParser parser = new YangParserImpl();
-        modules = parser.parseFile(yangFile, dependenciesDir).getModules();
-        assertEquals(6, modules.size());
-    }
-
-    // @Test
-    // public void testSorting() throws Exception {
-    // // Correct order: m2, m4, m6, m8, m7, m6, m3, m1
-    // File yangFile = new File(getClass().getResource("/sorting-test/m1.yang").toURI());
-    // File dependenciesDir = new File(getClass().getResource("/sorting-test").toURI());
-    // YangContextParser parser = new YangParserImpl();
-    // modules = parser.parseFile(yangFile, dependenciesDir).getModules();
-    // SchemaContext ctx = new SchemaContextImpl(modules, Collections.<ModuleIdentifier, String> emptyMap());
-    // checkOrder(modules);
-    // assertSetEquals(modules, ctx.getModules());
-    //
-    // // ##########
-    // parser = new YangParserImpl();
-    // final File testDir = dependenciesDir;
-    // final String[] fileList = testDir.list();
-    // final List<File> testFiles = new ArrayList<>();
-    // if (fileList == null) {
-    // throw new FileNotFoundException(dependenciesDir.getAbsolutePath());
-    // }
-    // for (String fileName : fileList) {
-    // testFiles.add(new File(testDir, fileName));
-    // }
-    // Set<Module> newModules = parser.parseFiles(testFiles).getModules();
-    // assertSetEquals(newModules, modules);
-    // ctx = new SchemaContextImpl(newModules, Collections.<ModuleIdentifier, String> emptyMap());
-    // assertSetEquals(newModules, ctx.getModules());
-    // // ##########
-    // newModules = parser.parseFiles(testFiles, null).getModules();
-    // assertSetEquals(newModules, modules);
-    // ctx = new SchemaContextImpl(newModules, Collections.<ModuleIdentifier, String> emptyMap());
-    // assertSetEquals(newModules, ctx.getModules());
-    // // ##########
-    // List<InputStream> streams = new ArrayList<>();
-    // for (File f : testFiles) {
-    // streams.add(new FileInputStream(f));
-    // }
-    // newModules = parser.parseSources(BuilderUtils.filesToByteSources(testFiles)).getModules();
-    // assertSetEquals(newModules, modules);
-    // ctx = new SchemaContextImpl(newModules, Collections.<ModuleIdentifier, String> emptyMap());
-    // assertSetEquals(newModules, ctx.getModules());
-    // // ##########
-    // streams.clear();
-    // for (File f : testFiles) {
-    // streams.add(new FileInputStream(f));
-    // }
-    // newModules = parser.parseSources(BuilderUtils.filesToByteSources(testFiles), null).getModules();
-    // assertSetEquals(newModules, modules);
-    // ctx = new SchemaContextImpl(newModules, Collections.<ModuleIdentifier, String> emptyMap());
-    // assertSetEquals(newModules, ctx.getModules());
-    // // ##########
-    // Map<File, Module> mapped = parser.parseYangModelsMapped(testFiles);
-    // newModules = new LinkedHashSet<>(mapped.values());
-    // assertSetEquals(newModules, modules);
-    // ctx = new SchemaContextImpl(newModules, Collections.<ModuleIdentifier, String> emptyMap());
-    // assertSetEquals(newModules, ctx.getModules());
-    // // ##########
-    // streams.clear();
-    // for (File f : testFiles) {
-    // streams.add(new FileInputStream(f));
-    // }
-    // Map<InputStream, Module> mappedStreams = parser.parseYangModelsFromStreamsMapped(streams);
-    // newModules = new LinkedHashSet<>(mappedStreams.values());
-    // assertSetEquals(newModules, modules);
-    // ctx = new SchemaContextImpl(newModules, Collections.<ModuleIdentifier, String> emptyMap());
-    // assertSetEquals(newModules, ctx.getModules());
-    // }
-
     private static void checkOrder(final Collection<Module> modules) {
         Iterator<Module> it = modules.iterator();
         Module m = it.next();
@@ -886,15 +799,16 @@ public class YangParserTest {
     }
 
     @Test
-    public void unknownStatementInSubmoduleHeaderTest() throws IOException, URISyntaxException {
-
-        File yang = new File(getClass().getResource("/yang-grammar-test/submodule-header-extension.yang").toURI());
+    public void unknownStatementInSubmoduleHeaderTest() throws IOException, URISyntaxException, ReactorException {
+        StatementStreamSource yang1 = new YangStatementSourceImpl("/yang-grammar-test/revisions-extension.yang", false);
+        StatementStreamSource yang2 = new YangStatementSourceImpl("/yang-grammar-test/submodule-header-extension.yang",
+                false);
 
         try {
-            YangParserImpl.getInstance().parseFile(yang, yang.getParentFile());
-        } catch (YangSyntaxErrorException | YangParseException e) {
+            TestUtils.parseYangSources(yang1, yang2);
+        } catch (YangParseException e) {
             e.printStackTrace();
-            fail("YangSyntaxErrorException or YangParseException should not be thrown");
+            fail("YangParseException should not be thrown");
         }
 
     }
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserWithContextTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserWithContextTest.java
index 8918a5adbbb1fa2254b8458ade6c6b3616817dec..c76545fd4eb314c970d435d1bfdac53b5ee7f576 100644 (file)
@@ -1,23 +1,20 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import java.io.File;
 import java.net.URI;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -44,16 +41,14 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.UsesNode;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 
 public class YangParserWithContextTest {
     private final DateFormat simpleDateFormat = new SimpleDateFormat(
             "yyyy-MM-dd");
-    private final YangParserImpl parser = new YangParserImpl();
 
     private static final YangStatementSourceImpl BAR = new YangStatementSourceImpl(
             "/model/bar.yang", false);
@@ -395,20 +390,13 @@ public class YangParserWithContextTest {
 
     @Test
     public void testAugment() throws Exception {
-        // load first module
-        String resource = "/context-augment-test/test4.yang";
-        SchemaContext context = parser.parseFiles(Collections
-                .singleton(new File(getClass().getResource(resource).toURI())));
-
-        // load another modules and parse them against already existing context
-        File test1 = new File(getClass().getResource(
-                "/context-augment-test/test1.yang").toURI());
-        File test2 = new File(getClass().getResource(
-                "/context-augment-test/test2.yang").toURI());
-        File test3 = new File(getClass().getResource(
-                "/context-augment-test/test3.yang").toURI());
-        Set<Module> modules = parser.parseFiles(
-                Arrays.asList(test1, test2, test3), context).getModules();
+        StatementStreamSource resource = new YangStatementSourceImpl("/context-augment-test/test4.yang", false);
+        StatementStreamSource test1 = new YangStatementSourceImpl("/context-augment-test/test1.yang", false);
+        StatementStreamSource test2 = new YangStatementSourceImpl("/context-augment-test/test2.yang", false);
+        StatementStreamSource test3 = new YangStatementSourceImpl("/context-augment-test/test3.yang", false);
+
+        SchemaContext context = TestUtils.parseYangSources(resource, test1, test2, test3);
+        Set<Module> modules = context.getModules();
         assertNotNull(modules);
 
         Module t4 = TestUtils.findModule(modules, "test4");
similarity index 98%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/YangTypes2StmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangTypes2StmtTest.java
index 1dcc82b1312f3a9fb5e5e743c8a5485c33f1c806..8df1d65a3dc178faf9ad5ff0efb4ee3b82c253a4 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/YangTypesStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangTypesStmtTest.java
index 83fe5b3ab99ba286a9b08ac812972d37d8c5aa7e..81ed21fdba7437bc3df399178ef2ed317650c462 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
 import org.junit.Test;
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/AugmentationSchemaBuilderImplTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/AugmentationSchemaBuilderImplTest.java
deleted file mode 100644 (file)
index c86351c..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.stmt.retest;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.impl.AugmentationSchemaBuilderImpl;
-
-/**
- * @deprecated Pre-Beryllium implementation, scheduled for removal.
- */
-@Deprecated
-public class AugmentationSchemaBuilderImplTest {
-
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl;
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl2;
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl3;
-    private AugmentationSchemaBuilderImpl augmentSchemaBuilderImpl4;
-    private AugmentationSchema augmentSchema;
-
-    @Before
-    public void init() {
-        augmentSchemaBuilderImpl = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc", SchemaPath.ROOT, 1);
-        augmentSchemaBuilderImpl2 = new AugmentationSchemaBuilderImpl("test-module", 10, "augment-test/rpc2", SchemaPath.ROOT, 1);
-        augmentSchemaBuilderImpl3 = augmentSchemaBuilderImpl;
-        augmentSchemaBuilderImpl4 = new AugmentationSchemaBuilderImpl("test-module", 10, null, SchemaPath.ROOT, 1);
-        augmentSchema = augmentSchemaBuilderImpl.build();
-    }
-
-    @Test
-    public void testgetPath() {
-        assertTrue(Iterables.isEmpty(augmentSchemaBuilderImpl.getPath().getPathFromRoot()));
-    }
-
-    @Test
-    public void testEquals() {
-        assertFalse(augmentSchemaBuilderImpl.equals("test"));
-        assertFalse(augmentSchemaBuilderImpl.equals(null));
-        assertTrue(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl3));
-        assertFalse(augmentSchemaBuilderImpl4.equals(augmentSchemaBuilderImpl));
-        assertFalse(augmentSchemaBuilderImpl.equals(augmentSchemaBuilderImpl2));
-    }
-
-    @Test
-    public void testGetOriginalDefinition() {
-        augmentSchema = augmentSchemaBuilderImpl.build();
-        Optional<AugmentationSchema> origDefinition = augmentSchema.getOriginalDefinition();
-        assertFalse(origDefinition.isPresent());
-    }
-
-    @Test
-    public void testGetUnknownSchemaNodes() {
-        assertTrue(Iterables.isEmpty(augmentSchema.getUnknownSchemaNodes()));
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug2219Test.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/Bug2219Test.java
deleted file mode 100644 (file)
index dc812cf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.stmt.retest;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.parser.builder.api.TypeDefinitionBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.CopyUtils;
-import org.opendaylight.yangtools.yang.parser.builder.impl.IdentityrefTypeBuilder;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
-
-/**
- * NPE is rised during use of CopyUtils.copy operation for IdentityrefTypeBuilder.
- * NPE occours in private getData method in CopyUtils.java during QName.create.
- *
- * The reason for exception is the old.getQName returns null since IdentityrefTypeBuilder.getQName()
- * by implementation returns always null.
- *
- */
-public class Bug2219Test {
-
-    private ModuleBuilder moduleBuilder;
-
-    @Before
-    public void init() {
-        moduleBuilder = new ModuleBuilder("test-module", "somePath");
-    }
-
-    @Test
-    public void testCopyIdentityrefTypeBuilder() {
-        final String typedefLocalName = "identity-ref-test-type";
-        final QName typedefQname = QName.create(moduleBuilder.getNamespace(), moduleBuilder.getRevision(), typedefLocalName);
-        final SchemaPath typedefPath = SchemaPath.create(true, typedefQname);
-        final IdentityrefTypeBuilder typeBuilder = new IdentityrefTypeBuilder(moduleBuilder.getModuleName(), 12,
-            "base:parent-identity", typedefPath);
-
-        final TypeDefinitionBuilder copy = CopyUtils.copy(typeBuilder, moduleBuilder, true);
-        assertNotNull(copy);
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/ModuleIdentifierTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/ModuleIdentifierTest.java
deleted file mode 100644 (file)
index 36311dd..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.stmt.retest;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.base.Optional;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Date;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
-import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleIdentifierImpl;
-
-public class ModuleIdentifierTest {
-
-    private ModuleIdentifier moduleIdentifier;
-    private ModuleIdentifier moduleIdentifier2;
-    private ModuleIdentifier moduleIdentifier3;
-    private ModuleIdentifier moduleIdentifier4;
-    private ModuleIdentifier moduleIdentifier5;
-
-    @Before
-    public void init() throws URISyntaxException {
-        Optional<URI> uri = Optional.of(new URI("testURI"));
-        Optional<URI> uri2 = Optional.of(new URI("testURI2"));
-        Optional<Date> revision = Optional.absent();
-        moduleIdentifier = new ModuleIdentifierImpl("test-modulue", uri, revision);
-        moduleIdentifier2 = new ModuleIdentifierImpl("test-modulue2", uri, revision);
-        moduleIdentifier3 = moduleIdentifier;
-        moduleIdentifier4 = new ModuleIdentifierImpl("test-modulue", uri2, revision);
-        moduleIdentifier5 = new ModuleIdentifierImpl("test-modulue", uri, revision);
-    }
-
-    @Test
-    public void testGetQNameModule() {
-        assertEquals(null, moduleIdentifier.getQNameModule().getRevision());
-    }
-
-    @Test
-    public void testGetRevision() {
-        assertEquals(null, moduleIdentifier.getRevision());
-    }
-
-    @Test
-    public void testGetName() {
-        assertEquals("test-modulue", moduleIdentifier.getName());
-    }
-
-    @Test
-    public void getNamespace() throws URISyntaxException {
-        assertEquals(new URI("testURI"), moduleIdentifier.getNamespace());
-    }
-
-    @Test
-    public void toStringTest() {
-        assertTrue(moduleIdentifier.toString().contains("ModuleIdentifier"));
-    }
-
-    @Test
-    public void testHashCode() {
-        assertFalse(moduleIdentifier.hashCode() == moduleIdentifier2.hashCode());
-    }
-
-    @Test
-    public void testEquals() {
-        assertTrue(moduleIdentifier.equals(moduleIdentifier3));
-        assertFalse(moduleIdentifier.equals(null));
-        assertFalse(moduleIdentifier.equals("test"));
-        assertFalse(moduleIdentifier.equals(moduleIdentifier2));
-        assertFalse(moduleIdentifier.equals(moduleIdentifier4));
-        assertTrue(moduleIdentifier.equals(moduleIdentifier5));
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/SameQNamesInChoiceTest.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/SameQNamesInChoiceTest.java
deleted file mode 100644 (file)
index 33e8dcb..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.stmt.retest;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-import java.net.URI;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.opendaylight.yangtools.yang.parser.util.YangParseException;
-
-public class SameQNamesInChoiceTest {
-
-    @Rule
-    public ExpectedException thrown = ExpectedException.none();
-
-    @Test
-    public void testSameQNameInChoice() throws Exception {
-        thrown.expect(YangParseException.class);
-        thrown.expectMessage("Choice has two nodes case with same qnames");
-
-        SchemaContext context;
-        File yangFile = new File(getClass().getResource("/bugs/qnameDuplicity/two-same-node-in-choice/two-same-nodes-in-choice-case.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/bugs/qnameDuplicity/two-same-node-in-choice").toURI());
-        YangContextParser parser = new YangParserImpl();
-        context = parser.parseFile(yangFile, dependenciesDir);
-
-        Module testModule = context.findModuleByNamespace(URI.create("urn:test:two:same-nodes-in-choice-case")).iterator().next();
-        assertNotNull(testModule);
-    }
-
-
-    @Test
-    public void testAugmentedNodeIntoChoiceCase() throws Exception {
-        thrown.expect(YangParseException.class);
-        thrown.expectMessage("Choice has two nodes case with same qnames");
-
-        SchemaContext context;
-        File yangFile = new File(getClass().getResource("/bugs/qnameDuplicity/augment/two-cases.yang").toURI());
-        File dependenciesDir = new File(getClass().getResource("/bugs/qnameDuplicity/augment").toURI());
-        YangContextParser parser = new YangParserImpl();
-        context = parser.parseFile(yangFile, dependenciesDir);
-
-        Module testModule = context.findModuleByNamespace(URI.create("urn:test:two:cases")).iterator().next();
-        assertNotNull(testModule);
-    }
-}
diff --git a/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/package-info.java b/yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/package-info.java
deleted file mode 100644 (file)
index fc98bd3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-/**
- * This package consists of JUnit tests run against new statement parser
- * in order to check and achieve desired functionality
- */
-package org.opendaylight.yangtools.yang.stmt.retest;
\ No newline at end of file
similarity index 92%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileAugmentStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileAugmentStmtTest.java
index 8616e923310f1ff100022730dc5cb469b66ad040..3ca25977232ea7f62bafd216cab2d9d0973f40bb 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileAugmentStmtTest {
 
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileChoiceStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileChoiceStmtTest.java
index 7f16c661733ff5fe578be16d3f4ad41c6d45efaa..dc289de2f9cb9b11552a29b904990b59c91126bb 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileChoiceStmtTest {
 
similarity index 96%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileExtensionStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileExtensionStmtTest.java
index d6290fdae45119724c6b49733f8d9f615676d175..99d68e23e98e25a33744a12b39c01cba36fd27bf 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -20,7 +20,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileExtensionStmtTest {
 
similarity index 90%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileFeatureStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileFeatureStmtTest.java
index d4740031f83cc78b3c2a334a8a0434c75b66a7df..d8236937610a2e8f38bbb2237564ec9085553477 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.core.Is.is;
@@ -21,7 +21,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.FeatureDefinition;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileFeatureStmtTest {
 
similarity index 93%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileGroupingStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileGroupingStmtTest.java
index 03d83e91725b4900eb2d2f0a828aef557e37a25c..a2514bbbcab8dcb08295f06514386cb40fb4f1ab 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileGroupingStmtTest {
 
similarity index 87%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileHeaderStmtsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileHeaderStmtsTest.java
index 518673b048295457910094516aebad6c7639f1a8..487b0a724f37b3b019343059de51146521d3c832 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 
@@ -16,7 +16,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileHeaderStmtsTest {
 
similarity index 91%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileIdentityStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileIdentityStmtTest.java
index 162f09a8a815c381e110fcb34bd8bbc323feee63..4d956a5bdc2eb0fc57ee8b69e675c58ec435c945 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.core.Is.is;
@@ -22,7 +22,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileIdentityStmtTest {
 
similarity index 91%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileImportStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileImportStmtTest.java
index a2e9dce99ea1eacb8e94a3d9d20c2ad3d3559a52..50eba7c013744c147a9057bf3c21529589f5a510 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.core.Is.is;
@@ -22,7 +22,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileImportStmtTest {
 
similarity index 89%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileIncludeStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileIncludeStmtTest.java
index 248b6951584ad8d8a2793f6b4581f82ebee49e69..8e6624f8d3b23b0625d346713527fabf7c3e9895 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -18,7 +18,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileIncludeStmtTest {
 
similarity index 91%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileLeafListStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileLeafListStmtTest.java
index 1d7cea04e34f6e1c714a894c655b7da3af468aa6..83b573a54e2cd84748663d5a0bc779e0196cd9d0 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileLeafListStmtTest {
 
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileListStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileListStmtTest.java
index 27a27313c3710e6a84058fcdc57dafe80d63f160..2f78914bc1c48ab03c29711eb1b2fb75a716d563 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -27,7 +27,7 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
 import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileListStmtTest {
 
similarity index 93%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileMetaStmtsTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileMetaStmtsTest.java
index 5b80c6e16c9c87e9b05ad9dee1690444cf2459f8..29244eff26bffec7120fa00813e24679eff0600a 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -16,7 +16,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileMetaStmtsTest {
 
similarity index 92%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileRpcStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileRpcStmtTest.java
index 3e2257f023ef6bb6855b7a5e5573c2aeda31ae00..c00cb6a4c95657934b036907e4b2970769196bae 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -18,7 +18,7 @@ import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileRpcStmtTest {
 
similarity index 95%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileStmtTest.java
index 7a794d324d85b70a16452a5f6e3e14b4476e3934..ed4d952184e4fb47619a472049a9c35ce261b5c6 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementR
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YinStatementSourceImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileStmtTest {
 
similarity index 90%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileTypeDefStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileTypeDefStmtTest.java
index 3c42f273fdc4896b69bc9e081c993aa023398159..0b66a3d24dc92143c6d35a945c4a0fbc72f0abd5 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -18,7 +18,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileTypeDefStmtTest {
 
similarity index 92%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/test/yin/YinFileUsesStmtTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/yin/YinFileUsesStmtTest.java
index 093276001467b3cdfa05490a31300dbf6bd42999..52c0bb37d51fb7b7ae237e158163b1b6d76730ec 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.test.yin;
+package org.opendaylight.yangtools.yang.stmt.yin;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.UsesNode;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.stmt.retest.TestUtils;
+import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
 public class YinFileUsesStmtTest {