Revert "Fix broken tests according to yangtools... 70/63770/1
authorVratko Polak <vrpolak@cisco.com>
Thu, 28 Sep 2017 12:36:56 +0000 (14:36 +0200)
committerVratko Polak <vrpolak@cisco.com>
Thu, 28 Sep 2017 12:36:56 +0000 (14:36 +0200)
Oxygen is using Yangtools 1.2.0 again,
so that change towards 2.0.0-SNAPSHOT behavior has to be reverted.

This reverts commit 6a290d78a6d6f32eafcb808457a4bb06875151e0.

Change-Id: I31732adc545df92fdb82e7047a19624b2454639d
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
60 files changed:
binding/maven-sal-api-gen-plugin/src/test/java/org/opendaylight/mdsal/binding/yang/unified/doc/generator/maven/DocGenTest.java
binding/maven-sal-api-gen-plugin/src/test/java/org/opendaylight/mdsal/binding/yang/unified/doc/generator/maven/YangModuleInfoCompilationTest.java
binding/maven-sal-api-gen-plugin/src/test/java/org/opendaylight/mdsal/binding/yang/wadl/generator/maven/WadlGenTest.java
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/BindingToNormalizedNodeCodecTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/AugmentRelativeXPathTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/AugmentedTypeTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BinaryTypeTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BindingGeneratorImplTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BitAndUnionTOEnclosingTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/Bug4145Test.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/Bug6135Test.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/ChoiceCaseGenTypesTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/ControllerTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/ExtendedTypedefTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GenEnumResolvingTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GenTypesSubSetTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GenerateInnerClassForBitsAndUnionInLeavesTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GeneratedTypesBitsTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GeneratedTypesLeafrefTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GeneratedTypesStringTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GeneratedTypesTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/IdentityrefTypeTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/TypeProviderIntegrationTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/UnionTypeDefTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/UsesTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/BaseYangTypesTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/Bug4621.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/TypeProviderImplTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/TypeProviderModel.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/TypeProviderTest.java
binding/mdsal-binding-generator-util/src/test/java/org/opendaylight/mdsal/binding/model/util/BindingGeneratorUtilTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/AugmentToUsesInAugmentCompilationTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/Bug1276Test.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/Bug5151Test.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/Bug532Test.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/CascadeUsesCompilationTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/ClassCodeGeneratorTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/CompilationTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/EncodingInJavaDocTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/NestedGroupingCompilationTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/TypedefCompilationTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/UnionTypedefUnusedImportTest.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/test/UnionWithIdentityrefTest.java
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/class-name-collision [moved from binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/class-name-collision.yang with 100% similarity]
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/configuration [moved from binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/configuration.yang with 100% similarity]
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/other-module [moved from binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/other-module.yang with 100% similarity]
binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AugmentToGenTypeTest.java
binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/AuxiliaryGenUtilsTest.java
binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/BindingGeneratorImplTest.java
binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/Bug8542Test.java
binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/Bug8575Test.java
binding2/mdsal-binding2-generator-impl/src/test/java/org/opendaylight/mdsal/binding/javav2/generator/impl/YangTemplateTest.java
binding2/mdsal-binding2-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/javav2/java/api/generator/GeneratorJavaFileTest.java
binding2/mdsal-binding2-runtime/src/test/java/org/opendaylight/mdsal/binding/javav2/runtime/context/BindingRuntimeContextTest.java
binding2/mdsal-binding2-runtime/src/test/java/org/opendaylight/mdsal/binding/javav2/runtime/context/util/BindingSchemaContextUtilsTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/ShardedDOMDataTreeProducerMultiShardTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/ShardedDOMDataTreeTest.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/util/TestModel.java
dom/mdsal-dom-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDataStoreTest.java
dom/mdsal-dom-inmemory-datastore/src/test/java/org/opendaylight/controller/md/sal/dom/store/impl/TestModel.java

index 28b850d8a0f150b04eb631fb4d7715c3328e9f4d..0a38e9320e330a754caebd7bee58ea18bc2f4bd0 100644 (file)
@@ -50,7 +50,7 @@ public class DocGenTest {
     @Test
     public void testListGeneration() throws Exception {
         final List<File> sourceFiles = getSourceFiles("/doc-gen");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final Set<Module> modules = context.getModules();
         final BasicCodeGenerator generator = new DocumentationGeneratorImpl();
         Collection<File> generatedFiles = generator.generateSources(context, GENERATOR_OUTPUT_DIR, modules);
index 4755e11e7ce24a228da975df5fd25013f8621850..1a0731851a2725f25a02adc87a05575d3e532056 100644 (file)
@@ -136,7 +136,7 @@ public class YangModuleInfoCompilationTest {
 
     private static void generateTestSources(final String resourceDirPath, final File sourcesOutputDir) throws Exception {
         final List<File> sourceFiles = getSourceFiles(resourceDirPath);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         CodeGeneratorImpl codegen = new CodeGeneratorImpl();
         codegen.setBuildContext(new DefaultBuildContext());
         codegen.generateSources(context, sourcesOutputDir, context.getModules());
@@ -145,7 +145,7 @@ public class YangModuleInfoCompilationTest {
     @Test
     public void generateTestSourcesWithAdditionalConfig() throws Exception {
         final List<File> sourceFiles = getSourceFiles("/yang-module-info");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         CodeGeneratorImpl codegen = new CodeGeneratorImpl();
         codegen.setBuildContext(new DefaultBuildContext());
         codegen.setResourceBaseDir(null);
index 7e1e89a5361ed955d35edbe6a51d76a23726c86f..c94f8f40d086dbe40968a0ee4805012590d7245d 100644 (file)
@@ -52,7 +52,7 @@ public class WadlGenTest {
     @Test
     public void testListGeneration() throws Exception {
         final List<File> sourceFiles = getSourceFiles("/wadl-gen");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final Set<Module> modules = context.getModules();
         final BasicCodeGenerator generator = new WadlGenerator();
         Collection<File> generatedWadlFiles = generator.generateSources(context, GENERATOR_OUTPUT_DIR, modules);
@@ -63,7 +63,7 @@ public class WadlGenTest {
     @Test
     public void testListGenerationWithoutPath() throws Exception {
         final List<File> sourceFiles = getSourceFiles("/wadl-gen");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final Set<Module> modules = context.getModules();
         final BasicCodeGenerator generator = new WadlGenerator();
         Collection<File> generatedWadlFiles = generator.generateSources(context, null, modules);
index 8743d3756dbe4e476c2a673be2a2bc48fae7dc14..fe6cd20e2489025ba44440d41ff837ff7ba41248 100644 (file)
@@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
-import java.io.File;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
@@ -54,8 +53,7 @@ public class BindingToNormalizedNodeCodecTest {
      */
     @Test
     public void fromNormalizedNodeTest() throws Exception {
-        final SchemaContext schemaCtx =
-                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/test.yang").toURI()));
+        final SchemaContext schemaCtx = YangParserTestUtils.parseYangSource("/test.yang");
         final NormalizedNode<?, ?> data = prepareData(schemaCtx, 42);
         final Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode = fromNormalizedNode(data, schemaCtx);
 
@@ -85,8 +83,7 @@ public class BindingToNormalizedNodeCodecTest {
      */
     @Test
     public void fromNormalizedNodeWithAnotherInputDataTest() throws Exception {
-        final SchemaContext schemaCtx =
-                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/test.yang").toURI()));
+        final SchemaContext schemaCtx = YangParserTestUtils.parseYangSource("/test.yang");
         final NormalizedNode<?, ?> data = prepareData(schemaCtx, "42");
 
         final Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode = fromNormalizedNode(data, schemaCtx);
index f0ba3c292108a4d660ad80ee36d05c2d21efb321..66f516baae58a2e699cae929b5c15428197942b0 100644 (file)
@@ -35,7 +35,7 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
     @Test
     public void AugmentationWithRelativeXPathTest() throws IOException, SourceException, ReactorException {
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 5a062c2ae7df1a10b4d2e905ad6dd03503b583cc..b3912d48d6bcd6f5ecd41d45578a321c7fd01c83 100644 (file)
@@ -39,7 +39,7 @@ public class AugmentedTypeTest {
         File ietfInterfaces = new File(getClass().getResource("/augment-test-models/ietf-interfaces@2012-11-15.yang")
                 .toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, augmentTopology,
+        final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, augmentTopology,
                 augmentNetworkLink, augmentTopologyTunnels, ietfInterfaces);
         assertNotNull("Schema Context is null", context);
 
index 142d50a66cd1a23048ea7db2eb16a92c981a9157..4cb2cdbd8e491bcab7a4128e5cd4eec0d1744baa 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -18,8 +19,11 @@ import java.util.List;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.mdsal.binding.generator.api.BindingGenerator;
+import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
 import org.opendaylight.mdsal.binding.model.api.Type;
 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.test.util.YangParserTestUtils;
 
 public class BinaryTypeTest {
@@ -38,8 +42,8 @@ public class BinaryTypeTest {
     }
 
     @Test
-    public void binaryTypeTest() throws Exception {
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(yangModels);
+    public void binaryTypeTest() throws IOException, SourceException, ReactorException {
+        final SchemaContext context = YangParserTestUtils.parseYangSources(yangModels);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index d2e9d8d5ff2ef0e8d0925d5a0a7e7419d556012f..8c89adaab689a8896388ec875ca2d46e8fdc081b 100644 (file)
@@ -11,42 +11,49 @@ 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 com.google.common.collect.ImmutableList;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
 import java.util.List;
 import org.junit.Test;
+import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
 import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
 import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class BindingGeneratorImplTest {
 
     @Test
-    public void isisTotpologyStatementParserTest() throws Exception {
-        final File topo = new File(getClass().getResource("/isis-topology/network-topology@2013-10-21.yang").toURI());
-        final File isis = new File(getClass().getResource("/isis-topology/isis-topology@2013-10-21.yang").toURI());
-        final File l3 =
-                new File(getClass().getResource("/isis-topology/l3-unicast-igp-topology@2013-10-21.yang").toURI());
+    public void isisTotpologyStatementParserTest() throws IOException,
+            URISyntaxException, ReactorException {
+        final InputStream topo = getClass().getResourceAsStream("/isis-topology/network-topology@2013-10-21.yang");
+        final InputStream isis = getClass().getResourceAsStream("/isis-topology/isis-topology@2013-10-21.yang");
+        final InputStream l3 = getClass().getResourceAsStream("/isis-topology/l3-unicast-igp-topology@2013-10-21.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(ImmutableList.of(isis, l3, topo));
+        SchemaContext context = YangParserTestUtils.parseYangStreams(ImmutableList.of(isis, l3, topo));
         assertNotNull(context);
 
-        final List<Type> generateTypes = new BindingGeneratorImpl(false)
+        List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
 
         assertFalse(generateTypes.isEmpty());
     }
 
     @Test
-    public void choiceNodeGenerationTest() throws Exception {
-        final File resourceFile = new File(getClass().getResource(
+    public void choiceNodeGenerationTest() throws IOException,
+            URISyntaxException, ReactorException {
+        File resourceFile = new File(getClass().getResource(
                 "/binding-generator-impl-test/choice-test.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(resourceFile);
+        SchemaContext context = YangParserTestUtils.parseYangSources(resourceFile);
 
-        final List<Type> generateTypes = new BindingGeneratorImpl(false)
+        List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
 
         GeneratedType choiceTestData = null;
@@ -56,7 +63,7 @@ public class BindingGeneratorImplTest {
         GeneratedType myList2 = null;
         GeneratedType myContainer2 = null;
 
-        for (final Type type : generateTypes) {
+        for (Type type : generateTypes) {
             switch (type.getName()) {
             case "ChoiceTestData":
                 choiceTestData = (GeneratedType) type;
@@ -88,7 +95,7 @@ public class BindingGeneratorImplTest {
 
         List<Type> implements1 = myContainer.getImplements();
         Type childOfParamType = null;
-        for (final Type type : implements1) {
+        for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -100,7 +107,7 @@ public class BindingGeneratorImplTest {
 
         implements1 = myList.getImplements();
         childOfParamType = null;
-        for (final Type type : implements1) {
+        for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -112,7 +119,7 @@ public class BindingGeneratorImplTest {
 
         implements1 = myContainer2.getImplements();
         childOfParamType = null;
-        for (final Type type : implements1) {
+        for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -124,7 +131,7 @@ public class BindingGeneratorImplTest {
 
         implements1 = myList2.getImplements();
         childOfParamType = null;
-        for (final Type type : implements1) {
+        for (Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -137,17 +144,17 @@ public class BindingGeneratorImplTest {
     }
 
     @Test
-    public void notificationGenerationTest() throws Exception {
-        final File resourceFile = new File(getClass().getResource(
+    public void notificationGenerationTest() throws IOException, URISyntaxException, ReactorException {
+        File resourceFile = new File(getClass().getResource(
                 "/binding-generator-impl-test/notification-test.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(resourceFile);
+        SchemaContext context = YangParserTestUtils.parseYangSources(resourceFile);
 
-        final List<Type> generateTypes = new BindingGeneratorImpl(false)
+        List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
 
         GeneratedType foo = null;
-        for (final Type type : generateTypes) {
+        for (Type type : generateTypes) {
             if (type.getName().equals("Foo")) {
                 foo = (GeneratedType) type;
                 break;
@@ -156,8 +163,8 @@ public class BindingGeneratorImplTest {
 
         Type childOf = null;
         Type dataObject = null;
-        final List<Type> impl = foo.getImplements();
-        for (final Type type : impl) {
+        List<Type> impl = foo.getImplements();
+        for (Type type : impl) {
             switch (type.getName()) {
             case "ChildOf":
                 childOf = type;
index 0afac68bdc7f7f7a91929727604648dbb861aa05..a740edb044707729326f5d9ff209fbf2cde194df 100644 (file)
@@ -38,7 +38,7 @@ public class BitAndUnionTOEnclosingTest {
 
     public static void parseResources() throws IOException, SourceException, ReactorException {
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 1d104f819ac0326b6785b8595599506a82fb14c5..c5ea0f50733d5ca6235d860412b655ed5580c6e0 100644 (file)
@@ -28,7 +28,7 @@ public class Bug4145Test {
         File resourceFile = new File(getClass().getResource(
                 "/bug-4145/foo.yang").toURI());
 
-        SchemaContext context = YangParserTestUtils.parseYangFiles(resourceFile);
+        SchemaContext context = YangParserTestUtils.parseYangSources(resourceFile);
 
         List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
index ef2a0fe50d0c3e60591d0ff1a569f36825a28f4d..91824645a64f5c99246a4148ca252fdbf74d329f 100644 (file)
@@ -10,23 +10,26 @@ package org.opendaylight.mdsal.binding.generator.impl;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import java.io.File;
+
+import java.io.FileNotFoundException;
+import java.net.URISyntaxException;
 import java.util.List;
 import org.junit.Ignore;
 import org.junit.Test;
+import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
 import org.opendaylight.mdsal.binding.model.api.Enumeration;
 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
 import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class Bug6135Test {
 
     @Ignore
     @Test
-    public void bug6135Test() throws Exception {
-        final SchemaContext context = YangParserTestUtils
-                .parseYangFiles(new File(Bug6135Test.class.getResource("/bug-6135/foo.yang").toURI()));
+    public void bug6135Test() throws FileNotFoundException, ReactorException, URISyntaxException {
+        final SchemaContext context = YangParserTestUtils.parseYangSource("/bug-6135/foo.yang");
         assertNotNull(context);
 
         final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(context);
index 8129af65a792ce14f01e522f879f5a2b13168912..942c6f418743b11e214e2f70de0c5844217c1f5a 100644 (file)
@@ -59,7 +59,7 @@ public class ChoiceCaseGenTypesTest extends AbstractTypesTest {
 
     @Test
     public void choiceCaseResolvingTypeTest() throws IOException, SourceException, ReactorException {
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 985934633aea12a34f01f14778719628e1ac3b6e..3a349fe48aef1bd47f867cb781b82f2e91c883c2 100644 (file)
@@ -27,7 +27,7 @@ public class ControllerTest {
         File co = new File(getClass().getResource("/controller-models/controller-openflow.yang").toURI());
         File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(cn, co, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(cn, co, ietfInetTypes);
         assertNotNull("Schema Context is null", context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 6d0c7efec30ed549a4dde1849d593a5b72dc8a51..630387876ff5b5d7aa3eecfa869fd2fa6c0bd965 100644 (file)
@@ -31,7 +31,7 @@ public class ExtendedTypedefTest {
         File abstractTopology = new File(getClass().getResource("/typedef-of-typedef/typedef_of_typedef.yang").toURI());
         File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInetTypes);
         assertNotNull("Schema Context is null", context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 064f593fd1a39484ecbc8e9a8e7fc2884d48818c..d1496f0fb479b60a6228ce8320b86f7c186dd5f7 100644 (file)
@@ -35,7 +35,7 @@ public class GenEnumResolvingTest {
                 .toURI());
         File ianaIfTypeModel = new File(getClass().getResource("/ietf/iana-if-type.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(ietfInterfaces, ianaIfTypeModel);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(ietfInterfaces, ianaIfTypeModel);
         assertTrue(context != null);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -97,7 +97,7 @@ public class GenEnumResolvingTest {
     @Test
     public void testTypedefEnumResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
         File ianaIfType = new File(getClass().getResource("/ietf/iana-if-type.yang").toURI());
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(ianaIfType);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(ianaIfType);
         assertTrue(context != null);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
         final List<Type> genTypes = bindingGen.generateTypes(context);
@@ -119,7 +119,7 @@ public class GenEnumResolvingTest {
                 .toURI());
         File ianaIfType = new File(getClass().getResource("/ietf/iana-if-type.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInterfaces,
+        final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInterfaces,
                 ianaIfType);
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 4d907b044befe475a898bc67082ab8850ed1f7ff..e1d53a7dc8122598e850e9b0eab07f1a3b7f1446 100644 (file)
@@ -33,7 +33,7 @@ public class GenTypesSubSetTest {
         File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
         File ietfYangTypes = new File(getClass().getResource("/ietf/ietf-yang-types.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInterfaces,
+        final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInterfaces,
                 ietfInetTypes, ietfYangTypes);
         Set<Module> modules = context.getModules();
 
@@ -65,7 +65,7 @@ public class GenTypesSubSetTest {
         File ietfYangTypes = new File(getClass().getResource("/ietf/ietf-yang-types.yang").toURI());
         File ianaIfType = new File(getClass().getResource("/ietf/iana-if-type.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInterfaces,
+        final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInterfaces,
                 ietfInetTypes, ietfYangTypes, ianaIfType);
         assertNotNull("Schema Context is null", context);
         final Set<Module> modules = context.getModules();
index fb0b51fcb5011ab7f75c7f613b2b2883a848b3c7..624b0a4b897ff4789a76e1e2ab90b0fe486fa9a1 100644 (file)
@@ -28,7 +28,7 @@ public class GenerateInnerClassForBitsAndUnionInLeavesTest {
     public void testInnerClassCreationForBitsAndUnionsInLeafes() throws Exception {
         final URI yangTypesPath = getClass().getResource("/bit_and_union_in_leaf.yang").toURI();
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(new File(yangTypesPath));
+        final SchemaContext context = YangParserTestUtils.parseYangSources(new File(yangTypesPath));
         assertTrue(context != null);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index ed89c6add02717f4a22ae740988bf02f40914889..8146fd4bf487d4c035da6126a4dd6cf14f80df40 100644 (file)
@@ -33,7 +33,7 @@ public class GeneratedTypesBitsTest {
     public void testGeneretedTypesBitsTest() throws Exception {
         final URI yangTypesPath = getClass().getResource("/simple-bits-demo.yang").toURI();
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(new File(yangTypesPath));
+        final SchemaContext context = YangParserTestUtils.parseYangSources(new File(yangTypesPath));
         assertTrue(context != null);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 9b9c75d92c06a147a89043cf50cdf921341aac04..47c275a71d9fd41fd512003b14fab041aa82a8e7 100644 (file)
@@ -14,29 +14,34 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.mdsal.binding.generator.api.BindingGenerator;
+import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty;
 import org.opendaylight.mdsal.binding.model.api.GeneratedTransferObject;
 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
 import org.opendaylight.mdsal.binding.model.api.MethodSignature;
 import org.opendaylight.mdsal.binding.model.api.Type;
 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.test.util.YangParserTestUtils;
 
 public class GeneratedTypesLeafrefTest {
 
     @Test
-    public void testLeafrefResolving() throws Exception {
-        final File abstractTopology = new File(getClass().getResource(
+    public void testLeafrefResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
+        File abstractTopology = new File(getClass().getResource(
                 "/leafref-test-models/abstract-topology@2013-02-08.yang").toURI());
-        final File ietfInterfaces = new File(getClass().getResource("/ietf/ietf-interfaces.yang").toURI());
-        final File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
-        final File ietfYangTypes = new File(getClass().getResource("/ietf/ietf-yang-types.yang").toURI());
+        File ietfInterfaces = new File(getClass().getResource("/ietf/ietf-interfaces.yang").toURI());
+        File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
+        File ietfYangTypes = new File(getClass().getResource("/ietf/ietf-yang-types.yang").toURI());
 
-        final SchemaContext context =  YangParserTestUtils.parseYangFiles(abstractTopology, ietfInterfaces,
+        final SchemaContext context =  YangParserTestUtils.parseYangSources(abstractTopology, ietfInterfaces,
                 ietfInetTypes, ietfYangTypes);
         assertNotNull(context);
         assertEquals(4, context.getModules().size());
@@ -56,7 +61,7 @@ public class GeneratedTypesLeafrefTest {
         GeneratedTransferObject gtTunnelKey = null;
         GeneratedType gtTopology = null;
         for (final Type type : genTypes) {
-            final String name = type.getName();
+            String name = type.getName();
             if ("InterfaceKey".equals(name)) {
                 gtIfcKey = (GeneratedTransferObject) type;
             } else if ("Interface".equals(name)) {
@@ -95,7 +100,7 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(condLeafref);
-        final Type condLeafRT = condLeafref.getReturnType();
+        Type condLeafRT = condLeafref.getReturnType();
         assertNotNull(condLeafRT);
         assertEquals("java.lang.Object", condLeafRT.getFullyQualifiedName());
 
@@ -109,7 +114,7 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(ifcIdProp);
-        final Type ifcIdPropType = ifcIdProp.getReturnType();
+        Type ifcIdPropType = ifcIdProp.getReturnType();
         assertNotNull(ifcIdPropType);
         assertEquals("java.lang.String", ifcIdPropType.getFullyQualifiedName());
 
@@ -126,13 +131,13 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(getIfcKey);
-        final Type getIfcKeyType = getIfcKey.getReturnType();
+        Type getIfcKeyType = getIfcKey.getReturnType();
         assertNotNull(getIfcKeyType);
         assertNotSame("java.lang.Void", getIfcKeyType);
         assertEquals("InterfaceKey", getIfcKeyType.getName());
 
         assertNotNull(getHigherLayerIf);
-        final Type getHigherLayerIfType = getHigherLayerIf.getReturnType();
+        Type getHigherLayerIfType = getHigherLayerIf.getReturnType();
         assertNotNull(getHigherLayerIfType);
         assertNotSame("java.lang.Void", getHigherLayerIfType);
         assertEquals("List", getHigherLayerIfType.getName());
@@ -141,13 +146,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtNetworkLinkMethods = gtNetworkLink.getMethodDefinitions();
         assertNotNull(gtNetworkLinkMethods);
         MethodSignature getIfc = null;
-        for (final MethodSignature method : gtNetworkLinkMethods) {
+        for (MethodSignature method : gtNetworkLinkMethods) {
             if (method.getName().equals("getInterface")) {
                 getIfc = method;
             }
         }
         assertNotNull(getIfc);
-        final Type getIfcType = getIfc.getReturnType();
+        Type getIfcType = getIfc.getReturnType();
         assertNotNull(getIfcType);
         assertNotSame("java.lang.Void", getIfcType);
         assertEquals("String", getIfcType.getName());
@@ -156,13 +161,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtSourceMethods = gtSource.getMethodDefinitions();
         assertNotNull(gtSourceMethods);
         MethodSignature getIdSource = null;
-        for (final MethodSignature method : gtSourceMethods) {
+        for (MethodSignature method : gtSourceMethods) {
             if (method.getName().equals("getId")) {
                 getIdSource = method;
             }
         }
         assertNotNull(getIdSource);
-        final Type getIdType = getIdSource.getReturnType();
+        Type getIdType = getIdSource.getReturnType();
         assertNotNull(getIdType);
         assertNotSame("java.lang.Void", getIdType);
         assertEquals("Uri", getIdType.getName());
@@ -171,13 +176,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtDestMethods = gtDest.getMethodDefinitions();
         assertNotNull(gtDestMethods);
         MethodSignature getIdDest = null;
-        for (final MethodSignature method : gtDestMethods) {
+        for (MethodSignature method : gtDestMethods) {
             if (method.getName().equals("getId")) {
                 getIdDest = method;
             }
         }
         assertNotNull(getIdDest);
-        final Type getIdDestType = getIdDest.getReturnType();
+        Type getIdDestType = getIdDest.getReturnType();
         assertNotNull(getIdDestType);
         assertNotSame("java.lang.Void", getIdDestType);
         assertEquals("Uri", getIdDestType.getName());
@@ -186,13 +191,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtTunnelMethods = gtTunnel.getMethodDefinitions();
         assertNotNull(gtTunnelMethods);
         MethodSignature getTunnelKey = null;
-        for (final MethodSignature method : gtTunnelMethods) {
+        for (MethodSignature method : gtTunnelMethods) {
             if (method.getName().equals("getKey")) {
                 getTunnelKey = method;
             }
         }
         assertNotNull(getTunnelKey);
-        final Type getTunnelKeyType = getTunnelKey.getReturnType();
+        Type getTunnelKeyType = getTunnelKey.getReturnType();
         assertNotNull(getTunnelKeyType);
         assertNotSame("java.lang.Void", getTunnelKeyType);
         assertEquals("TunnelKey", getTunnelKeyType.getName());
@@ -207,18 +212,18 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(tunnelId);
-        final Type tunnelIdType = tunnelId.getReturnType();
+        Type tunnelIdType = tunnelId.getReturnType();
         assertNotNull(tunnelIdType);
         assertNotSame("java.lang.Void", tunnelIdType);
         assertEquals("Uri", tunnelIdType.getName());
     }
 
     @Test
-    public void testLeafrefInvalidPathResolving() throws Exception {
+    public void testLeafrefInvalidPathResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
         final URI resource = getClass().getResource("/leafref-test-invalid-model/foo.yang").toURI();
         assertNotNull(resource);
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(new File(resource));
+        final SchemaContext context =  YangParserTestUtils.parseYangSources(new File(resource));
         assertNotNull(context);
         assertEquals(1, context.getModules().size());
 
@@ -226,8 +231,8 @@ public class GeneratedTypesLeafrefTest {
         try {
             bindingGen.generateTypes(context);
             fail("Expected IllegalArgumentException caused by invalid leafref path");
-        } catch (final IllegalArgumentException e) {
-            final String expected = "Failed to find leafref target";
+        } catch (IllegalArgumentException e) {
+            String expected = "Failed to find leafref target";
             assertTrue(e.getMessage().contains(expected));
         }
     }
index 4d81a65da11ede82f5e9d387d291f11fc8dd227c..067ae8eb6ef47a7bf255a67c9dfca0a659da5b50 100644 (file)
@@ -41,7 +41,7 @@ public class GeneratedTypesStringTest {
 
     @Test
     public void constantGenerationTest() throws IOException, SourceException, ReactorException {
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 3a5bfee0c5432b85cd93028146c36059f481aeb7..b47b3dd1cb06bf71ffd7e3f85d3eca4807e2a3bb 100644 (file)
@@ -34,7 +34,7 @@ public class GeneratedTypesTest {
         File abstractTopology = new File(getClass().getResource("/abstract-topology.yang").toURI());
         File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInetTypes);
         assertNotNull(context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -47,7 +47,7 @@ public class GeneratedTypesTest {
     @Test
     public void testContainerResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
         final File testFile = new File(getClass().getResource("/simple-container-demo.yang").toURI());
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testFile);
         assertNotNull(context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -132,7 +132,7 @@ public class GeneratedTypesTest {
     @Test
     public void testLeafListResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
         final File testFile = new File(getClass().getResource("/simple-leaf-list-demo.yang").toURI());
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testFile);
         assertNotNull(context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -216,7 +216,7 @@ public class GeneratedTypesTest {
     @Test
     public void testListResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
         final File testFile = new File(getClass().getResource("/simple-list-demo.yang").toURI());
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testFile);
         assertNotNull(context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -339,7 +339,7 @@ public class GeneratedTypesTest {
     @Test
     public void testListCompositeKeyResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
         final File testFile = new File(getClass().getResource("/list-composite-key.yang").toURI());
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testFile);
         assertNotNull(context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -391,7 +391,7 @@ public class GeneratedTypesTest {
     @Test
     public void testGeneratedTypes() throws URISyntaxException, IOException, SourceException, ReactorException {
         final File testFile = new File(getClass().getResource("/demo-topology.yang").toURI());
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testFile);
         assertNotNull(context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 823b14865e50cb2365a71fdcc373efe2cc0f4f77..b206cdfa9b8d44df40af543a6038a2f4e3024df3 100644 (file)
@@ -60,7 +60,7 @@ public class IdentityrefTypeTest {
      */
     @Test
     public void testIdentityrefYangBuiltInType() throws IOException, SourceException, ReactorException {
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index c58f01e0eef9851f75ebef63e3ab48c54a1e5abd..9b6005cf67ed84b5fa17eabcfd7becdda566de94 100644 (file)
@@ -38,7 +38,7 @@ public class TypeProviderIntegrationTest {
                 .toURI());
         File ietfInetTypes = new File(TypeProviderIntegrationTest.class.getResource("/ietf/ietf-inet-types.yang")
                 .toURI());
-        context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInetTypes);
+        context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInetTypes);
         assertNotNull(context);
     }
 
index 788b037984cf2500c80a6f46ce0c33f56fe3763b..300b2a23963e1081e774f72a51b7552949025cac 100644 (file)
@@ -28,7 +28,7 @@ public class UnionTypeDefTest {
     public void unionTypeResolvingTest() throws Exception {
         final File abstractTopology = new File(getClass().getResource("/union-test-models/abstract-topology.yang").toURI());
         final File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInetTypes);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -43,7 +43,7 @@ public class UnionTypeDefTest {
     @Test
     public void unionTypedefLeafrefTest() throws Exception {
         final File yang = new File(getClass().getResource("/leafref_typedef_union/bug8449.yang").toURI());
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(yang);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(yang);
         assertNotNull(schemaContext);
         final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(schemaContext);
         assertNotNull(generateTypes);
index 2c73beb7c9ae5db125617931a948450a36d729cc..7d07af750418348096c448c8a9c23db280a0381d 100644 (file)
@@ -45,7 +45,7 @@ public class UsesTest {
     @Test
     public void usesInGroupingDependenciesTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-dependencies.yang");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -100,7 +100,7 @@ public class UsesTest {
     public void usesInCaseTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-case.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -148,7 +148,7 @@ public class UsesTest {
     public void usesInContainerTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-container.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -201,7 +201,7 @@ public class UsesTest {
     public void usesInGroupingTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-grouping.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -252,7 +252,7 @@ public class UsesTest {
     public void usesInListTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-list.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -334,7 +334,7 @@ public class UsesTest {
     public void usesInModulTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-modul.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -385,7 +385,7 @@ public class UsesTest {
     public void usesInRpcTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-rpc.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -478,7 +478,7 @@ public class UsesTest {
     public void usesInAugmentTest() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-augment.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
@@ -531,7 +531,7 @@ public class UsesTest {
     public void usesInNotification() throws IOException, SourceException, ReactorException {
         List<File> testModels = loadTestResources("/uses-of-grouping/uses-of-grouping-notification.yang");
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index d2e21a0277f11cdcb2cedad114c428431ae796bd..64af70e8b4b6f3e940b8bf5827f842a1102f6d31 100644 (file)
@@ -11,7 +11,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import java.io.File;
+import java.io.InputStream;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Collections;
@@ -33,6 +33,8 @@ import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
 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.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 /**
@@ -59,10 +61,10 @@ public class BaseYangTypesTest {
     private static BooleanTypeDefinition bool = null;
 
     @BeforeClass
-    public static void setup() throws Exception {
-        final List<File> modelsToParse = Collections
-            .singletonList(new File(BaseYangTypesTest.class.getResource("/base-yang-types.yang").toURI()));
-        schemaContext = YangParserTestUtils.parseYangFiles(modelsToParse);
+    public static void setup() throws SourceException, ReactorException {
+        final List<InputStream> modelsToParse = Collections
+            .singletonList(BaseYangTypesTest.class.getResourceAsStream("/base-yang-types.yang"));
+        schemaContext = YangParserTestUtils.parseYangStreams(modelsToParse);
         assertNotNull(schemaContext);
         initTypeDefinitionsFromSchemaContext();
     }
index 1577884e76a22bb22d0a0a6fc03cbe3eadd7e5a2..81b733b8261596e655c8303f7a1c7ff799ffd513 100644 (file)
@@ -10,10 +10,13 @@ package org.opendaylight.mdsal.binding.yang.types;
 import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
+import org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
@@ -21,6 +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.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class Bug4621 {
@@ -29,10 +33,10 @@ public class Bug4621 {
     public ExpectedException expectedEx = ExpectedException.none();
 
     @Test
-    public void bug4621test() throws Exception {
-        final File file = new File(getClass().getResource("/bug-4621/foo.yang").toURI());
+    public void bug4621test() throws FileNotFoundException, ReactorException, URISyntaxException {
+        File file = new File(getClass().getResource("/bug-4621/foo.yang").toURI());
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(file);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(file);
         final Module moduleValid = schemaContext.findModuleByNamespace(new URI("foo")).iterator().next();
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
 
@@ -40,10 +44,10 @@ public class Bug4621 {
 
         final QName listNode = QName.create(moduleValid.getQNameModule(), "neighbor");
         final QName leafrefNode = QName.create(moduleValid.getQNameModule(), "neighbor2-id");
-        final DataSchemaNode leafrefRel = ((ListSchemaNode) moduleValid.getDataChildByName(listNode))
+        DataSchemaNode leafrefRel = ((ListSchemaNode) moduleValid.getDataChildByName(listNode))
                 .getDataChildByName(leafrefNode);
-        final LeafSchemaNode leafRel = (LeafSchemaNode) leafrefRel;
-        final TypeDefinition<?> leafTypeRel = leafRel.getType();
+        LeafSchemaNode leafRel = (LeafSchemaNode) leafrefRel;
+        TypeDefinition<?> leafTypeRel = leafRel.getType();
         assertNotNull(typeProvider.javaTypeForSchemaDefinitionType(leafTypeRel, leafRel));
     }
 }
\ No newline at end of file
index a99a820a574376be8e14bc31eb304345df9da88c..0aa5658665f30f32f61323293395801a85112fa4 100644 (file)
@@ -48,7 +48,7 @@ public class TypeProviderImplTest {
     public void testLeafRefRelativeSelfReference() throws Exception {
         File relative = new File(getClass().getResource("/leafref/leafref-relative-invalid.yang").toURI());
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(relative);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(relative);
         final Module moduleRelative = schemaContext.findModuleByNamespace(new URI("urn:xml:ns:yang:lrr")).iterator()
                 .next();
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
@@ -67,7 +67,7 @@ public class TypeProviderImplTest {
     public void testLeafRefAbsoluteSelfReference() throws Exception {
         File relative = new File(getClass().getResource("/leafref/leafref-absolute-invalid.yang").toURI());
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(relative);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(relative);
         final Module moduleRelative = schemaContext.findModuleByNamespace(new URI("urn:xml:ns:yang:lra")).iterator()
                 .next();
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
@@ -86,7 +86,7 @@ public class TypeProviderImplTest {
     public void testLeafRefRelativeAndAbsoluteValidReference() throws Exception {
         File valid = new File(getClass().getResource("/leafref/leafref-valid.yang").toURI());
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(valid);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(valid);
         final Module moduleValid = schemaContext.findModuleByNamespace(new URI("urn:xml:ns:yang:lrv")).iterator()
                 .next();
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
@@ -113,7 +113,7 @@ public class TypeProviderImplTest {
     public void testMethodsOfTypeProviderImpl() throws Exception {
         final File abstractTopology = new File(getClass().getResource("/base-yang-types.yang").toURI());
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(abstractTopology);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(abstractTopology);
 
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
 
index 8d20e9fee801bcd59e1a3c795b325535dcc15700..6349e65823aea9e3323c89bdf766edff8d18a1a2 100644 (file)
@@ -7,10 +7,12 @@
  */
 package org.opendaylight.mdsal.binding.yang.types;
 
-import java.io.File;
+import java.io.InputStream;
 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;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 /**
@@ -25,20 +27,20 @@ public final class TypeProviderModel {
     private static final String TEST_TYPE_PROVIDER_PATH = "/"+TEST_TYPE_PROVIDER_MODULE_NAME+".yang";
     private static final String TEST_TYPE_PROVIDER_B_PATH = "/test-type-provider-b.yang";
 
-    private static File getFile(final String resourceName) throws Exception {
-        return new File(TypeProviderModel.class.getResource(resourceName).toURI());
+    private static InputStream getInputStream(final String resourceName) {
+        return TypeProviderModel.class.getResourceAsStream(resourceName);
     }
 
-    private static List<File> provideTestModelStreams() throws Exception {
-        final List<File> arrayList = new ArrayList<>();
+    private static List<InputStream> provideTestModelStreams() {
+        final List<InputStream> arrayList = new ArrayList<>();
 
-        arrayList.add(getFile(BASE_YANG_TYPES_PATH));
-        arrayList.add(getFile(TEST_TYPE_PROVIDER_PATH));
-        arrayList.add(getFile(TEST_TYPE_PROVIDER_B_PATH));
+        arrayList.add(getInputStream(BASE_YANG_TYPES_PATH));
+        arrayList.add(getInputStream(TEST_TYPE_PROVIDER_PATH));
+        arrayList.add(getInputStream(TEST_TYPE_PROVIDER_B_PATH));
         return arrayList;
     }
 
-    public static SchemaContext createTestContext() throws Exception {
-        return YangParserTestUtils.parseYangFiles(provideTestModelStreams());
+    public static SchemaContext createTestContext() throws SourceException, ReactorException {
+        return YangParserTestUtils.parseYangStreams(provideTestModelStreams());
     }
 }
index 6af6031558253e469461805f701e993bf3e8c0c9..fdd752336d89dfbefd8fa3ee0ea1450ba4dbc881 100644 (file)
@@ -46,6 +46,8 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 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.SourceException;
 
 /**
  * Test suite for testing public methods in TypeProviderImpl class
@@ -68,7 +70,7 @@ public class TypeProviderTest {
     private SchemaNode schemaNode;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() throws SourceException, ReactorException {
         MockitoAnnotations.initMocks(this);
         this.schemaContext = TypeProviderModel.createTestContext();
         assertNotNull(this.schemaContext);
index c5e5583ebebc9745759d554198e7422ac3da85b2..d37e495ab8b0f091d52e883e490ac2bdc2bf38b4 100644 (file)
@@ -83,7 +83,7 @@ public class BindingGeneratorUtilTest {
     public void testBindingGeneratorUtilMethods() throws Exception {
         List<File> testModels = loadTestResources("/module.yang");
 
-        final Set<Module> modules = YangParserTestUtils.parseYangFiles(testModels).getModules();
+        final Set<Module> modules = YangParserTestUtils.parseYangSources(testModels).getModules();
         String packageName = "";
         Module module = null;
         for (Module m : modules) {
index 1b348fb8ee77956ae1d3d39fd72ff89a71781c9f..9ccc6d3891030f17e6044492ad775c5199f4955a 100644 (file)
@@ -30,7 +30,7 @@ public class AugmentToUsesInAugmentCompilationTest extends BaseCompilationTest {
         assertTrue("Failed to create test file '" + compiledOutputDir + "'", compiledOutputDir.mkdir());
 
         final List<File> sourceFiles = CompilationTestUtils.getSourceFiles("/compilation/augment-uses-to-augment");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index d34d6e63a0b1199ce238cedce9e669b92417bcdf..8dd59bd4e7d40e758e491d2424c4171fbd6adcb8 100644 (file)
@@ -89,7 +89,7 @@ public class Bug1276Test extends BaseCompilationTest {
 
     private void generateTestSources(final String resourceDirPath, final File sourcesOutputDir) throws Exception {
         final List<File> sourceFiles = CompilationTestUtils.getSourceFiles(resourceDirPath);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index cc3e303fabe710a8946ce99b9f09b1af56c7bbbb..eb00557eb32366db11f1623b797ad9525838e8a1 100644 (file)
@@ -72,7 +72,7 @@ public class Bug5151Test extends BaseCompilationTest {
 
     private void generateTestSources(final String resourceDirPath, final File sourcesOutputDir) throws Exception {
         final List<File> sourceFiles = CompilationTestUtils.getSourceFiles(resourceDirPath);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index bd31b634b3e64ba3dee3f13378e9d77ca2de6c15..410e233381ffc076e5749274eba65c59f7c7cd78 100644 (file)
@@ -112,7 +112,7 @@ public class Bug532Test extends BaseCompilationTest {
 
     private void generateTestSources(final String resourceDirPath, final File sourcesOutputDir) throws Exception {
         final List<File> sourceFiles = getSourceFiles(resourceDirPath);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index d164574bff90a82d461ce6ed0f5439f212a31ea8..9f42e58536b44b92610c29fbc23b96523d8b97fc 100644 (file)
@@ -47,7 +47,7 @@ public class CascadeUsesCompilationTest extends BaseCompilationTest {
         assertTrue("Failed to create test file '" + compiledOutputDir + "'", compiledOutputDir.mkdir());
 
         final List<File> sourceFiles = getSourceFiles("/compilation/cascade-uses");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 1b8cdbe761e7149378eb063a58debd08777438ce..8a750aeed06f39fb316de01bf14e716b4af272d4 100644 (file)
@@ -49,7 +49,7 @@ public class ClassCodeGeneratorTest {
     @Test
     public void compositeKeyClassTest() throws IOException, SourceException, ReactorException {
 
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 7499d8fe8088e3134b80ab1177ff546a6caa3aee..d694c029991f36345f6227e6b6ffbb6eccc60e0b 100644 (file)
@@ -664,7 +664,7 @@ public class CompilationTest extends BaseCompilationTest {
 
     private void generateTestSources(final String resourceDirPath, final File sourcesOutputDir) throws Exception {
         final List<File> sourceFiles = CompilationTestUtils.getSourceFiles(resourceDirPath);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         Collections.sort(types, (o1, o2) -> o2.getName().compareTo(o1.getName()));
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
index 2e6369baab4b972c9fa437943c18a6f7aa6b91a8..ca0a131a014c85dba16ce57321ddb051e66e2813 100644 (file)
@@ -38,7 +38,7 @@ public class EncodingInJavaDocTest extends BaseCompilationTest {
         assertTrue("Failed to create test file '" + compiledOutputDir + "'", compiledOutputDir.mkdir());
 
         final List<File> sourceFiles = getSourceFiles("/compilation/encoding-javadoc");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 9f16a35f8c31018b4b40054ffac9548c8c48e0ca..a3230b8a5e6ab39f50bf2987831352d282477431 100644 (file)
@@ -78,7 +78,7 @@ public class NestedGroupingCompilationTest extends BaseCompilationTest {
 
     private void generateTestSources(final String resourceDirPath, final File sourcesOutputDir) throws Exception {
         final List<File> sourceFiles = getSourceFiles(resourceDirPath);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 3b0c0fe38ead57f2a40124dbe7be59b0538b5898..53e6b1f9a1d4f5821ca8d5d7f36c54f51a41c0e9 100644 (file)
@@ -45,7 +45,7 @@ public class TypedefCompilationTest extends BaseCompilationTest {
         assertTrue("Failed to create test file '" + compiledOutputDir + "'", compiledOutputDir.mkdir());
 
         final List<File> sourceFiles = CompilationTestUtils.getSourceFiles("/compilation/typedef");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index cfa2e7a1a8646183ed37382b6766726599114edc..0aacf1e8828b7327b04197de05326f4d02b29c79 100644 (file)
@@ -41,7 +41,7 @@ public class UnionTypedefUnusedImportTest extends BaseCompilationTest {
         assertTrue("Failed to create test file '" + compiledOutputDir + "'", compiledOutputDir.mkdir());
 
         final List<File> sourceFiles = getSourceFiles("/compilation/union-typedef");
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(new HashSet<>(types));
         generator.generateToFile(sourcesOutputDir);
index a8478097d36a12e50677dc952795177d4073ac82..60d1aeecf72d75704d65de7810eaf3a563107d0e 100644 (file)
@@ -71,7 +71,7 @@ public class UnionWithIdentityrefTest extends BaseCompilationTest {
 
     private void generateTestSources(final String resourceDirPath, final File sourcesOutputDir) throws Exception {
         final List<File> sourceFiles = CompilationTestUtils.getSourceFiles(resourceDirPath);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 095e44b599adc738f1e4d79d289aab3ebc1ba64e..fd5f15e370c753a034c292ceb8d7e3e9a7acb020 100644 (file)
@@ -15,7 +15,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import com.google.common.base.Optional;
-import java.io.File;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -166,8 +165,7 @@ public class AugmentToGenTypeTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext context =
-                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/generator/test.yang").toURI()));
+        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/test.yang");
         final TypeProvider typeProvider = new TypeProviderImpl(context);
         final Map<Module, ModuleContext> genCtx = new HashMap<>();
         final Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders = new HashMap<>();
@@ -187,8 +185,7 @@ public class AugmentToGenTypeTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext context = YangParserTestUtils
-                .parseYangFiles(new File(getClass().getResource("/generator/test-augment.yang").toURI()));
+        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/test-augment.yang");
         final TypeProvider typeProvider = new TypeProviderImpl(context);
         final Map<Module, ModuleContext> genCtx = mock(Map.class);
         final Collection<ModuleContext> moduleContexts = new ArrayList<>();
index 2e37c5b54990fd14ab19ab3573b7b64a9834d35b..f43d0caca3c2a0a9f07d494eabf6700e45860b38 100644 (file)
@@ -12,7 +12,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import java.io.File;
+
 import java.io.FileNotFoundException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -194,8 +194,7 @@ public class AuxiliaryGenUtilsTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext schemaContext = YangParserTestUtils
-                .parseYangFiles(new File(getClass().getResource("/generator/test-list.yang").toURI()));
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/generator/test-list.yang");
         final ListSchemaNode containerSchemaNode =
                 (ListSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
         final String fullyQualifiedName =
@@ -223,8 +222,7 @@ public class AuxiliaryGenUtilsTest {
         generate.setAccessible(true);
 
         final SchemaContext schemaContext =
-                YangParserTestUtils.parseYangFiles(
-                        new File(getClass().getResource("/base/test-leaf-with-description.yang").toURI()));
+                YangParserTestUtils.parseYangSource("/base/test-leaf-with-description.yang");
         final LeafSchemaNode containerSchemaNode =
                 (LeafSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
         final String fullyQualifiedName = "test.base.cont.with.leaf.MyList";
@@ -243,8 +241,7 @@ public class AuxiliaryGenUtilsTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext schemaContext =
-                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/base/test-module.yang").toURI()));
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/base/test-module.yang");
 
         final Object[] args = { schemaContext.getModules().iterator().next(), true };
         final String result = (String) generate.invoke(AuxiliaryGenUtils.class, args);
@@ -261,8 +258,7 @@ public class AuxiliaryGenUtilsTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext schemaContext = YangParserTestUtils
-                .parseYangFiles(new File(getClass().getResource("/base/test-rpc-and-notification.yang").toURI()));
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/base/test-rpc-and-notification.yang");
         final Module module = schemaContext.getModules().iterator().next();
         Set schemaNodes = new HashSet<>();
         schemaNodes.add(module.getRpcs().iterator().next());
@@ -491,8 +487,7 @@ public class AuxiliaryGenUtilsTest {
 
         final GeneratedTypeBuilder typeBuilder =
                 new GeneratedTypeBuilderImpl("test.boolean.spc.def", "spec-type-def", new ModuleContext());
-        final SchemaContext schemaContext =
-                YangParserTestUtils.parseYangFiles(new File(getClass().getResource(yangPath).toURI()));
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource(yangPath);
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
         final LeafSchemaNode leafSchemaNode =
                 (LeafSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
@@ -516,8 +511,7 @@ public class AuxiliaryGenUtilsTest {
 
         final GeneratedTypeBuilder typeBuilder = new GeneratedTypeBuilderImpl("test.boolean.spc.def",
                 "spec-type-def", new ModuleContext());
-        final SchemaContext schemaContext =
-                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/base/test-union.yang").toURI()));
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/base/test-union.yang");
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
         final LeafSchemaNode leafSchemaNode =
                 (LeafSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
index e06edd2c646e030e613ba769a026a727349665a7..fbfe586b692c6ff1493dfc51b90e3940039784b8 100644 (file)
@@ -12,8 +12,6 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import java.io.File;
-import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 import org.junit.Test;
@@ -32,8 +30,7 @@ public class BindingGeneratorImplTest {
     @Test
     public void genTypesTypeDefTest() throws Exception {
         final BindingGeneratorImpl bg = new BindingGeneratorImpl(false);
-        final SchemaContext schemaContext = YangParserTestUtils
-                .parseYangFiles(new File(getClass().getResource("/generator/test-typedef.yang").toURI()));
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/generator/test-typedef.yang");
         final List<Type> generateTypes = bg.generateTypes(schemaContext);
         assertNotNull(generateTypes);
         for (final Type genType : generateTypes) {
@@ -52,8 +49,7 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesEnumTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final SchemaContext context = YangParserTestUtils
-                .parseYangFiles(new File(getClass().getResource("/generator/apple-test.yang").toURI()));
+        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/apple-test.yang");
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -76,10 +72,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesEnumLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final List<File> sources = new ArrayList<>();
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype-base.yang").toURI()));
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype.yang").toURI()));
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sources);
+        final List<String> sources = new ArrayList<>();
+        sources.add("/uses-statement/test-uses-leaf-innertype-base.yang");
+        sources.add("/uses-statement/test-uses-leaf-innertype.yang");
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sources);
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -103,10 +99,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesBitsLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final List<File> sources = new ArrayList<>();
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype2-base.yang").toURI()));
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype2.yang").toURI()));
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sources);
+        final List<String> sources = new ArrayList<>();
+        sources.add("/uses-statement/test-uses-leaf-innertype2-base.yang");
+        sources.add("/uses-statement/test-uses-leaf-innertype2.yang");
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sources);
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -114,7 +110,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("MyCont") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype2.base.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafBits")) {
                         assertEquals("LeafBits", methodSignature.getReturnType().getName());
                     }
@@ -125,7 +121,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("MyCont") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype2.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafBits")) {
                         assertEquals("LeafBits", methodSignature.getReturnType().getName());
                     }
@@ -137,10 +133,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesUnionLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final List<File> sources = new ArrayList<>();
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype2-base.yang").toURI()));
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype2.yang").toURI()));
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sources);
+        final List<String> sources = new ArrayList<>();
+        sources.add("/uses-statement/test-uses-leaf-innertype2-base.yang");
+        sources.add("/uses-statement/test-uses-leaf-innertype2.yang");
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sources);
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -148,7 +144,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("MyCont") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype2.base.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafUnion")) {
                         assertEquals("LeafUnion", methodSignature.getReturnType().getName());
                     }
@@ -159,7 +155,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("MyCont") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype2.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafUnion")) {
                         assertEquals("LeafUnion", methodSignature.getReturnType().getName());
                     }
@@ -171,10 +167,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final List<File> sources = new ArrayList<>();
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype2-base.yang").toURI()));
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype2.yang").toURI()));
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sources);
+        final List<String> sources = new ArrayList<>();
+        sources.add("/uses-statement/test-uses-leaf-innertype2-base.yang");
+        sources.add("/uses-statement/test-uses-leaf-innertype2.yang");
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sources);
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -182,7 +178,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("MyCont") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype2.base.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafDecimal64")) {
                         assertEquals("BigDecimal", methodSignature.getReturnType().getName());
                     }
@@ -193,7 +189,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("MyCont") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype2.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafDecimal64")) {
                         assertEquals("BigDecimal", methodSignature.getReturnType().getName());
                     }
@@ -205,10 +201,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesLeafInnertype3Test() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final List<File> sources = new ArrayList<>();
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype3-base.yang").toURI()));
-        sources.add(new File(getClass().getResource("/uses-statement/test-uses-leaf-innertype3.yang").toURI()));
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(sources);
+        final List<String> sources = new ArrayList<>();
+        sources.add("/uses-statement/test-uses-leaf-innertype3-base.yang");
+        sources.add("/uses-statement/test-uses-leaf-innertype3.yang");
+        final SchemaContext context = YangParserTestUtils.parseYangSources(sources);
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -216,7 +212,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("MyCont") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype3.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getBandwidth")) {
                         assertEquals("Bandwidth", methodSignature.getReturnType().getName());
                     }
@@ -227,7 +223,7 @@ public class BindingGeneratorImplTest {
             if (type.getName().equals("Open") && type.getPackageName()
                     .equals("org.opendaylight.mdsal.gen.javav2.urn.test.uses.leaf.innertype3.rev170809.data")) {
                 final GeneratedType gt = (GeneratedType) type;
-                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getVersion")) {
                         assertEquals("ProtocolVersion", methodSignature.getReturnType().getName());
                     }
@@ -244,8 +240,7 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final SchemaContext context = YangParserTestUtils
-                .parseYangFiles(new File(getClass().getResource("/generator/test-list.yang").toURI()));
+        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/test-list.yang");
         final List<Type> generateTypes = bg.generateTypes(context);
 
         assertNotNull(generateTypes);
@@ -289,7 +284,7 @@ public class BindingGeneratorImplTest {
     @Test
     public void generateTypesDescriptionsTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(true);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(getFiles("/base/with_import/"));
+        final SchemaContext context = YangParserTestUtils.parseYangSources("/base/with_import/");
         assertNotNull(context);
 
         final List<Type> generateTypes = bg.generateTypes(context, context.getModules());
@@ -311,7 +306,7 @@ public class BindingGeneratorImplTest {
     @Test
     public void generateTypesIdentityTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(true);
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(getFiles("/identity/"));
+        final SchemaContext context = YangParserTestUtils.parseYangSources("/identity/");
         assertNotNull(context);
 
         final List<Type> generateTypes = bg.generateTypes(context, context.getModules());
@@ -342,10 +337,6 @@ public class BindingGeneratorImplTest {
         }
     }
 
-    private File[] getFiles(final String path) throws URISyntaxException {
-        return new File(getClass().getResource(path).toURI()).listFiles();
-    }
-
     private void testActualType(final GeneratedType t, final int[] test_i) {
         MethodSignature methodSignature = null;
         switch (t.getName()) {
index 3cc065c54ca58010b07453f9afdea61e45ba91a0..a8c7c095b5cc366e5981fcfb300f1ac5f4f368df 100644 (file)
@@ -11,20 +11,18 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import java.io.File;
-import java.util.List;
 import org.junit.Test;
 import org.opendaylight.mdsal.binding.javav2.generator.api.BindingGenerator;
 import org.opendaylight.mdsal.binding.javav2.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
+import java.util.List;
 
 public class Bug8542Test {
     @Test
     public void Bug8542Test() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final SchemaContext context = YangParserTestUtils
-                .parseYangFiles(new File(getClass().getResource("/bug-8542/recursive-uses-augment.yang").toURI()));
+        final SchemaContext context = YangParserTestUtils.parseYangSource("/bug-8542/recursive-uses-augment.yang");
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
index 149fa062108265796b6d86bbe142f4e0ac1953ca..c94f93346bc6226a6c947a891f0b6c2886e3016b 100644 (file)
@@ -38,7 +38,7 @@ public class Bug8575Test {
         File foo = new File(getClass().getResource(
                 "/bug-8575/foo.yang").toURI());
 
-        SchemaContext context = YangParserTestUtils.parseYangFiles(foo);
+        SchemaContext context = YangParserTestUtils.parseYangSources(foo);
 
         final QName groupingQname = QName.create("foo", "2017-05-15", "A");
         final QName containerQname = QName.create("foo", "2017-05-15", "A1");
index f6523140fbd425348c4ecf97367c96203d0713e8..2484b4a80bdade6b4fba7f832cee747841c17d9b 100644 (file)
@@ -11,10 +11,8 @@ package org.opendaylight.mdsal.binding.javav2.generator.impl;
 import static org.junit.Assert.assertTrue;
 
 import com.google.common.annotations.Beta;
-import java.io.File;
 import java.io.FileNotFoundException;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.util.Iterator;
 import java.util.Set;
 import org.junit.Assert;
@@ -33,8 +31,7 @@ public class YangTemplateTest {
 
     @Before
     public void setup() throws URISyntaxException, ReactorException, FileNotFoundException {
-        File[] listFiles = new File(getClass().getResource("/yang-template").toURI()).listFiles();
-        this.modules = YangParserTestUtils.parseYangFiles(listFiles).getModules();
+        this.modules = YangParserTestUtils.parseYangSources("/yang-template").getModules();
     }
 
     @Test
index 47bbe5b43dacdf3aa3e24162bca71bbf53d7272e..57c7e8d95883367f3a1bf30cc6d36edea5083ecf 100644 (file)
@@ -27,8 +27,7 @@ public class GeneratorJavaFileTest {
 
     @Test
     public void generatedFilesTest() throws Exception {
-        final File[] listFiles = new File(getClass().getResource("/base/with_import/").toURI()).listFiles();
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(listFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangSources("/base/with_import/");
         final BindingGenerator bindingGenerator = new BindingGeneratorImpl(true);
         final List<Type> types = bindingGenerator.generateTypes(context, context.getModules());
         final BuildContext buildContext = new DefaultBuildContext();
index 74213576c7cb0cfb4a5db292ab0e2f2988af6cba..5df2959ebbe7e01629889aa93089a13d1b5b22de 100644 (file)
@@ -29,7 +29,7 @@ public class BindingRuntimeContextTest {
 
     @Before
     public void setup() throws URISyntaxException, FileNotFoundException, ReactorException {
-        schemaContext = YangParserTestUtils.parseYangFiles(
+        schemaContext = YangParserTestUtils.parseYangSources(
                  new File(getClass().getResource("/yang/test-runtime.yang").toURI()));
         myCont = (DataNodeContainer) schemaContext.getChildNodes().iterator().next();
         brc = BindingRuntimeContext.create(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), schemaContext);
index c26a3f298984fed6205157bf5a0a44550dff878b..d87b5685a056f3127ca9d8bedeebda21e45204db 100644 (file)
@@ -36,7 +36,7 @@ public class BindingSchemaContextUtilsTest {
 
     @Before
     public void setup() throws URISyntaxException, FileNotFoundException, ReactorException {
-        schemaContext = YangParserTestUtils.parseYangFiles(
+        schemaContext = YangParserTestUtils.parseYangSources(
                 new File(getClass().getResource("/yang/test-runtime.yang").toURI()));
         myCont = (DataNodeContainer) schemaContext.getChildNodes().iterator().next();
         myChoice = (ChoiceSchemaNode) myCont.getChildNodes().iterator().next();
index 5bd0a44f9211351c80c10c94f74486bc92e90251..4da15e53fbba1a990b06ac321283f841dfee177b 100644 (file)
@@ -20,7 +20,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 
 import com.google.common.util.concurrent.Futures;
-import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -56,6 +55,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 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;
 
@@ -68,7 +68,7 @@ public class ShardedDOMDataTreeProducerMultiShardTest {
     static {
         try {
             schemaContext = TestModel.createTestContext();
-        } catch (final URISyntaxException e) {
+        } catch (final ReactorException e) {
             LOG.error("Unable to create schema context for TestModel", e);
         }
     }
index 90d034b37a36fcf60c8fac4ed291aa99de8d8095..3a3a2e8a1b0cbac426a797ee20480f2bed72e619 100644 (file)
@@ -22,7 +22,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 
 import com.google.common.util.concurrent.ListenableFuture;
-import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -59,6 +58,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableCo
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder;
 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;
 
@@ -71,7 +71,7 @@ public class ShardedDOMDataTreeTest {
     static {
         try {
             schemaContext = TestModel.createTestContext();
-        } catch (final URISyntaxException e) {
+        } catch (final ReactorException e) {
             LOG.error("Unable to create schema context for TestModel", e);
         }
     }
@@ -219,7 +219,7 @@ public class ShardedDOMDataTreeTest {
         final DOMDataTreeListener mockedDataTreeListener = mock(DOMDataTreeListener.class);
         doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap());
 
-        final InMemoryDOMDataTreeShard testShard = InMemoryDOMDataTreeShard.create(TEST_ID, executor, 1);
+        InMemoryDOMDataTreeShard testShard = InMemoryDOMDataTreeShard.create(TEST_ID, executor, 1);
         testShard.onGlobalContextUpdated(schemaContext);
 
         final DOMDataTreeProducer regProducer = dataTreeService.createProducer(Collections.singleton(TEST_ID));
@@ -277,7 +277,7 @@ public class ShardedDOMDataTreeTest {
                 tx.createCursor(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, oid1));
         assertNotNull(cursor);
 
-        final MapNode innerList = ImmutableMapNodeBuilder
+        MapNode innerList = ImmutableMapNodeBuilder
                 .create()
                 .withNodeIdentifier(new NodeIdentifier(TestModel.INNER_LIST_QNAME))
                 .build();
index 9aa98879c118c10bfb38a27f703e50e08fb5246a..2f97daa948ac67378f80bc5081d501f523dfda3e 100644 (file)
@@ -7,12 +7,12 @@
  */
 package org.opendaylight.mdsal.dom.broker.util;
 
-import java.io.File;
-import java.net.URISyntaxException;
+import java.io.InputStream;
 import java.util.Collections;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class TestModel {
@@ -49,11 +49,11 @@ public class TestModel {
             YangInstanceIdentifier.builder(ANOTHER_SHARD_PATH).node(NEW_SHARD_LIST).build();
     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
-    public static SchemaContext createTestContext() throws URISyntaxException {
-        return YangParserTestUtils.parseYangFiles(Collections.singletonList(getFile()));
+    public static SchemaContext createTestContext() throws ReactorException {
+        return YangParserTestUtils.parseYangStreams(Collections.singletonList(getInputStream()));
     }
 
-    private static File getFile() throws URISyntaxException {
-        return new File(TestModel.class.getResource(DATASTORE_TEST_YANG).toURI());
+    private static InputStream getInputStream() {
+        return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
     }
 }
index 38184890a7c0b0ffc80e5f36b47411d13c4c77da..9748505cbff2ce7d7af447cccc60b0539e754c3c 100644 (file)
@@ -15,6 +15,7 @@ import static org.junit.Assert.assertTrue;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
+import java.io.IOException;
 import java.util.concurrent.ExecutionException;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -38,6 +39,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
 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.model.parser.api.YangSyntaxErrorException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 
 public class InMemoryDataStoreTest {
 
@@ -45,7 +48,7 @@ public class InMemoryDataStoreTest {
     private InMemoryDOMDataStore domStore;
 
     @Before
-    public void setupStore() throws Exception {
+    public void setupStore() throws IOException, YangSyntaxErrorException, ReactorException {
         domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService());
         schemaContext = TestModel.createTestContext();
         domStore.onGlobalContextUpdated(schemaContext);
@@ -56,57 +59,57 @@ public class InMemoryDataStoreTest {
 
         assertNotNull(domStore);
 
-        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
-        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         /**
          * Writes /test in writeTx.
          */
-        final NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+        NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
         writeTx.write(TestModel.TEST_PATH, testNode);
 
         /**
          * Reads /test from writeTx Read should return container.
          */
-        final ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
         assertEquals("read: isPresent", true, writeTxContainer.get().isPresent());
         assertEquals("read: data", testNode, writeTxContainer.get().get());
 
         /**
          * Reads /test from readTx Read should return Absent.
          */
-        final ListenableFuture<Optional<NormalizedNode<?, ?>>> readTxContainer = readTx.read(TestModel.TEST_PATH);
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> readTxContainer = readTx.read(TestModel.TEST_PATH);
         assertEquals("read: isPresent", false, readTxContainer.get().isPresent());
     }
 
     @Test
     public void testTransactionCommit() throws InterruptedException, ExecutionException {
 
-        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         /**
          * Writes /test in writeTx.
          */
-        final NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+        NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
         writeTx.write(TestModel.TEST_PATH, testNode);
 
         /**
          * Reads /test from writeTx Read should return container.
          */
-        final ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
         assertEquals("read: isPresent", true, writeTxContainer.get().isPresent());
         assertEquals("read: data", testNode, writeTxContainer.get().get());
 
-        final DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
+        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
 
         assertThreePhaseCommit(cohort);
 
-        final Optional<NormalizedNode<?, ?>> afterCommitRead =
-                domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH).get();
+        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH)
+                .get();
         assertEquals("After commit read: isPresent", true, afterCommitRead.isPresent());
         assertEquals("After commit read: data", testNode, afterCommitRead.get());
     }
@@ -186,10 +189,10 @@ public class InMemoryDataStoreTest {
     @Test
     public void testExistsForExistingData() throws Exception {
 
-        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
-        final ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
+        ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
             .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
             .addChild(ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
                 .addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME,
@@ -201,13 +204,13 @@ public class InMemoryDataStoreTest {
 
         assertEquals(Boolean.TRUE, exists.get());
 
-        final DOMStoreThreePhaseCommitCohort ready = writeTx.ready();
+        DOMStoreThreePhaseCommitCohort ready = writeTx.ready();
 
         ready.preCommit().get();
 
         ready.commit().get();
 
-        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         exists =
@@ -219,14 +222,14 @@ public class InMemoryDataStoreTest {
     @Test
     public void testExistsForNonExistingData() throws Exception {
 
-        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         ListenableFuture<Boolean> exists = writeTx.exists(TestModel.TEST_PATH);
 
         assertEquals(Boolean.FALSE, exists.get());
 
-        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         exists =
@@ -238,7 +241,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testExistsThrowsReadFailedException() throws Exception {
 
-        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         readTx.close();
@@ -251,7 +254,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadOnlyTransactionClosed() throws Throwable {
 
-        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         readTx.close();
@@ -263,11 +266,11 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadOnlyTransactionFailure() throws Throwable {
 
-        final DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
+        DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
         Mockito.doThrow(new RuntimeException("mock ex")).when(mockSnapshot)
         .readNode(Mockito.any(YangInstanceIdentifier.class));
 
-        final DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadTransaction("1", true, mockSnapshot);
+        DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadTransaction("1", true, mockSnapshot);
 
         doReadAndThrowEx(readTx);
     }
@@ -276,7 +279,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadWriteTransactionClosed() throws Throwable {
 
-        final DOMStoreReadTransaction readTx = domStore.newReadWriteTransaction();
+        DOMStoreReadTransaction readTx = domStore.newReadWriteTransaction();
         assertNotNull(readTx);
 
         readTx.close();
@@ -288,15 +291,15 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadWriteTransactionFailure() throws Throwable {
 
-        final DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
-        final DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
+        DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
+        DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
         Mockito.doThrow(new RuntimeException("mock ex")).when(mockModification)
         .readNode(Mockito.any(YangInstanceIdentifier.class));
         Mockito.doReturn(mockModification).when(mockSnapshot).newModification();
         @SuppressWarnings("unchecked")
-        final TransactionReadyPrototype<String> mockReady = Mockito.mock(TransactionReadyPrototype.class);
-        final DOMStoreReadTransaction readTx =
-                SnapshotBackedTransactions.newReadWriteTransaction("1", false, mockSnapshot, mockReady);
+        TransactionReadyPrototype<String> mockReady = Mockito.mock(TransactionReadyPrototype.class);
+        DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadWriteTransaction(
+                "1", false, mockSnapshot, mockReady);
 
         doReadAndThrowEx(readTx);
     }
@@ -305,7 +308,7 @@ public class InMemoryDataStoreTest {
     private static void doReadAndThrowEx(final DOMStoreReadTransaction readTx) throws Throwable {
         try {
             readTx.read(TestModel.TEST_PATH).get();
-        } catch (final ExecutionException e) {
+        } catch (ExecutionException e) {
             throw e.getCause();
         }
     }
@@ -313,7 +316,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = IllegalStateException.class)
     public void testWriteWithTransactionReady() throws Exception {
 
-        final DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
+        DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
 
         writeTx.ready();
 
@@ -324,7 +327,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = IllegalStateException.class)
     public void testReadyWithTransactionAlreadyReady() throws Exception {
 
-        final DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
+        DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
 
         writeTx.ready();
 
@@ -335,31 +338,31 @@ public class InMemoryDataStoreTest {
     @Test
     public void testTransactionAbort() throws InterruptedException, ExecutionException {
 
-        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         assertTestContainerWrite(writeTx);
 
-        final DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
+        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
 
         assertTrue(cohort.canCommit().get().booleanValue());
         cohort.preCommit().get();
         cohort.abort().get();
 
-        final Optional<NormalizedNode<?, ?>> afterCommitRead =
-                domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH).get();
+        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH)
+                .get();
         assertFalse(afterCommitRead.isPresent());
     }
 
     @Test
     public void testTransactionChain() throws InterruptedException, ExecutionException {
-        final DOMStoreTransactionChain txChain = domStore.createTransactionChain();
+        DOMStoreTransactionChain txChain = domStore.createTransactionChain();
         assertNotNull(txChain);
 
         /**
          * We alocate new read-write transaction and write /test.
          */
-        final DOMStoreReadWriteTransaction firstTx = txChain.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction firstTx = txChain.newReadWriteTransaction();
         assertTestContainerWrite(firstTx);
 
         /**
@@ -372,7 +375,7 @@ public class InMemoryDataStoreTest {
          * We alocate chained transaction - read transaction, note first one is
          * still not commited to datastore.
          */
-        final DOMStoreReadTransaction secondReadTx = txChain.newReadOnlyTransaction();
+        DOMStoreReadTransaction secondReadTx = txChain.newReadOnlyTransaction();
 
         /**
          * We test if we are able to read data from tx, read should not fail
@@ -384,7 +387,7 @@ public class InMemoryDataStoreTest {
          * We alocate next transaction, which is still based on first one, but
          * is read-write.
          */
-        final DOMStoreReadWriteTransaction thirdDeleteTx = txChain.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction thirdDeleteTx = txChain.newReadWriteTransaction();
 
         /**
          * We test existence of /test in third transaction container should
@@ -400,7 +403,7 @@ public class InMemoryDataStoreTest {
         /**
          * third transaction is sealed.
          */
-        final DOMStoreThreePhaseCommitCohort thirdDeleteTxCohort = thirdDeleteTx.ready();
+        DOMStoreThreePhaseCommitCohort thirdDeleteTxCohort = thirdDeleteTx.ready();
 
         /**
          * We commit first transaction.
@@ -409,7 +412,7 @@ public class InMemoryDataStoreTest {
         assertThreePhaseCommit(firstWriteTxCohort);
 
         // Alocates store transacion
-        final DOMStoreReadTransaction storeReadTx = domStore.newReadOnlyTransaction();
+        DOMStoreReadTransaction storeReadTx = domStore.newReadOnlyTransaction();
         /**
          * We verify transaction is commited to store, container should exists
          * in datastore.
@@ -425,8 +428,8 @@ public class InMemoryDataStoreTest {
     @Test
     @Ignore
     public void testTransactionConflict() throws InterruptedException, ExecutionException {
-        final DOMStoreReadWriteTransaction txOne = domStore.newReadWriteTransaction();
-        final DOMStoreReadWriteTransaction txTwo = domStore.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction txOne = domStore.newReadWriteTransaction();
+        DOMStoreReadWriteTransaction txTwo = domStore.newReadWriteTransaction();
         assertTestContainerWrite(txOne);
         assertTestContainerWrite(txTwo);
 
@@ -466,7 +469,7 @@ public class InMemoryDataStoreTest {
     private static Optional<NormalizedNode<?, ?>> assertTestContainerExists(final DOMStoreReadTransaction readTx)
             throws InterruptedException, ExecutionException {
 
-        final ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = readTx.read(TestModel.TEST_PATH);
+        ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = readTx.read(TestModel.TEST_PATH);
         assertTrue(writeTxContainer.get().isPresent());
         return writeTxContainer.get();
     }
index a70dff231dc82132055869fa49824a15e32dc9f9..8e4cf2b8f7401a553bae3c3b6cc0fd2ef280aa8f 100644 (file)
@@ -7,11 +7,14 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Collections;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class TestModel {
@@ -31,11 +34,11 @@ public class TestModel {
             YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
 
-    public static SchemaContext createTestContext() throws Exception {
-        return YangParserTestUtils.parseYangFiles(Collections.singletonList(getFile()));
+    public static SchemaContext createTestContext() throws IOException, YangSyntaxErrorException, ReactorException {
+        return YangParserTestUtils.parseYangStreams(Collections.singletonList(getInputStream()));
     }
 
-    private static File getFile() throws Exception {
-        return new File(TestModel.class.getResource(DATASTORE_TEST_YANG).toURI());
+    private static InputStream getInputStream() {
+        return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
     }
 }