Fix broken tests according to yangtools changes 67/63767/1
authorJakub Toth <jakub.toth@pantheon.tech>
Thu, 28 Sep 2017 10:35:35 +0000 (12:35 +0200)
committerJakub Toth <jakub.toth@pantheon.tech>
Thu, 28 Sep 2017 10:35:39 +0000 (12:35 +0200)
  * https://git.opendaylight.org/gerrit/#/c/62537/
  * fixed methods of YangParserTestUtils for parsing yangs
    and creating schema context

Change-Id: I313e91aeafd46c57d60aaf71372287bc84b8414a
Signed-off-by: Jakub Toth <jakub.toth@pantheon.tech>
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.yang [moved from binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/class-name-collision with 100% similarity]
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/configuration.yang [moved from binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/configuration with 100% similarity]
binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/other-module.yang [moved from binding/mdsal-binding-java-api-generator/src/test/resources/compilation/class-name-collision/other-module 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 0a38e9320e330a754caebd7bee58ea18bc2f4bd0..28b850d8a0f150b04eb631fb4d7715c3328e9f4d 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final Set<Module> modules = context.getModules();
         final BasicCodeGenerator generator = new DocumentationGeneratorImpl();
         Collection<File> generatedFiles = generator.generateSources(context, GENERATOR_OUTPUT_DIR, modules);
index 1a0731851a2725f25a02adc87a05575d3e532056..4755e11e7ce24a228da975df5fd25013f8621850 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         CodeGeneratorImpl codegen = new CodeGeneratorImpl();
         codegen.setBuildContext(new DefaultBuildContext());
         codegen.setResourceBaseDir(null);
index c94f8f40d086dbe40968a0ee4805012590d7245d..7e1e89a5361ed955d35edbe6a51d76a23726c86f 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final Set<Module> modules = context.getModules();
         final BasicCodeGenerator generator = new WadlGenerator();
         Collection<File> generatedWadlFiles = generator.generateSources(context, null, modules);
index fe6cd20e2489025ba44440d41ff837ff7ba41248..8743d3756dbe4e476c2a673be2a2bc48fae7dc14 100644 (file)
@@ -11,6 +11,7 @@ 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;
@@ -53,7 +54,8 @@ public class BindingToNormalizedNodeCodecTest {
      */
     @Test
     public void fromNormalizedNodeTest() throws Exception {
-        final SchemaContext schemaCtx = YangParserTestUtils.parseYangSource("/test.yang");
+        final SchemaContext schemaCtx =
+                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/test.yang").toURI()));
         final NormalizedNode<?, ?> data = prepareData(schemaCtx, 42);
         final Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode = fromNormalizedNode(data, schemaCtx);
 
@@ -83,7 +85,8 @@ public class BindingToNormalizedNodeCodecTest {
      */
     @Test
     public void fromNormalizedNodeWithAnotherInputDataTest() throws Exception {
-        final SchemaContext schemaCtx = YangParserTestUtils.parseYangSource("/test.yang");
+        final SchemaContext schemaCtx =
+                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/test.yang").toURI()));
         final NormalizedNode<?, ?> data = prepareData(schemaCtx, "42");
 
         final Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode = fromNormalizedNode(data, schemaCtx);
index 66f516baae58a2e699cae929b5c15428197942b0..f0ba3c292108a4d660ad80ee36d05c2d21efb321 100644 (file)
@@ -35,7 +35,7 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
     @Test
     public void AugmentationWithRelativeXPathTest() throws IOException, SourceException, ReactorException {
 
-        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index b3912d48d6bcd6f5ecd41d45578a321c7fd01c83..5a062c2ae7df1a10b4d2e905ad6dd03503b583cc 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.parseYangSources(abstractTopology, augmentTopology,
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, augmentTopology,
                 augmentNetworkLink, augmentTopologyTunnels, ietfInterfaces);
         assertNotNull("Schema Context is null", context);
 
index 4cb2cdbd8e491bcab7a4128e5cd4eec0d1744baa..142d50a66cd1a23048ea7db2eb16a92c981a9157 100644 (file)
@@ -11,7 +11,6 @@ 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;
@@ -19,11 +18,8 @@ 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 {
@@ -42,8 +38,8 @@ public class BinaryTypeTest {
     }
 
     @Test
-    public void binaryTypeTest() throws IOException, SourceException, ReactorException {
-        final SchemaContext context = YangParserTestUtils.parseYangSources(yangModels);
+    public void binaryTypeTest() throws Exception {
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(yangModels);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 8c89adaab689a8896388ec875ca2d46e8fdc081b..d2e9d8d5ff2ef0e8d0925d5a0a7e7419d556012f 100644 (file)
@@ -11,49 +11,42 @@ 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 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");
+    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());
 
-        SchemaContext context = YangParserTestUtils.parseYangStreams(ImmutableList.of(isis, l3, topo));
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(ImmutableList.of(isis, l3, topo));
         assertNotNull(context);
 
-        List<Type> generateTypes = new BindingGeneratorImpl(false)
+        final List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
 
         assertFalse(generateTypes.isEmpty());
     }
 
     @Test
-    public void choiceNodeGenerationTest() throws IOException,
-            URISyntaxException, ReactorException {
-        File resourceFile = new File(getClass().getResource(
+    public void choiceNodeGenerationTest() throws Exception {
+        final File resourceFile = new File(getClass().getResource(
                 "/binding-generator-impl-test/choice-test.yang").toURI());
 
-        SchemaContext context = YangParserTestUtils.parseYangSources(resourceFile);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(resourceFile);
 
-        List<Type> generateTypes = new BindingGeneratorImpl(false)
+        final List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
 
         GeneratedType choiceTestData = null;
@@ -63,7 +56,7 @@ public class BindingGeneratorImplTest {
         GeneratedType myList2 = null;
         GeneratedType myContainer2 = null;
 
-        for (Type type : generateTypes) {
+        for (final Type type : generateTypes) {
             switch (type.getName()) {
             case "ChoiceTestData":
                 choiceTestData = (GeneratedType) type;
@@ -95,7 +88,7 @@ public class BindingGeneratorImplTest {
 
         List<Type> implements1 = myContainer.getImplements();
         Type childOfParamType = null;
-        for (Type type : implements1) {
+        for (final Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -107,7 +100,7 @@ public class BindingGeneratorImplTest {
 
         implements1 = myList.getImplements();
         childOfParamType = null;
-        for (Type type : implements1) {
+        for (final Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -119,7 +112,7 @@ public class BindingGeneratorImplTest {
 
         implements1 = myContainer2.getImplements();
         childOfParamType = null;
-        for (Type type : implements1) {
+        for (final Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -131,7 +124,7 @@ public class BindingGeneratorImplTest {
 
         implements1 = myList2.getImplements();
         childOfParamType = null;
-        for (Type type : implements1) {
+        for (final Type type : implements1) {
             if (type.getName().equals("ChildOf")) {
                 childOfParamType = ((ParameterizedType) type)
                         .getActualTypeArguments()[0];
@@ -144,17 +137,17 @@ public class BindingGeneratorImplTest {
     }
 
     @Test
-    public void notificationGenerationTest() throws IOException, URISyntaxException, ReactorException {
-        File resourceFile = new File(getClass().getResource(
+    public void notificationGenerationTest() throws Exception {
+        final File resourceFile = new File(getClass().getResource(
                 "/binding-generator-impl-test/notification-test.yang").toURI());
 
-        SchemaContext context = YangParserTestUtils.parseYangSources(resourceFile);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(resourceFile);
 
-        List<Type> generateTypes = new BindingGeneratorImpl(false)
+        final List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
 
         GeneratedType foo = null;
-        for (Type type : generateTypes) {
+        for (final Type type : generateTypes) {
             if (type.getName().equals("Foo")) {
                 foo = (GeneratedType) type;
                 break;
@@ -163,8 +156,8 @@ public class BindingGeneratorImplTest {
 
         Type childOf = null;
         Type dataObject = null;
-        List<Type> impl = foo.getImplements();
-        for (Type type : impl) {
+        final List<Type> impl = foo.getImplements();
+        for (final Type type : impl) {
             switch (type.getName()) {
             case "ChildOf":
                 childOf = type;
index a740edb044707729326f5d9ff209fbf2cde194df..0afac68bdc7f7f7a91929727604648dbb861aa05 100644 (file)
@@ -38,7 +38,7 @@ public class BitAndUnionTOEnclosingTest {
 
     public static void parseResources() throws IOException, SourceException, ReactorException {
 
-        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index c5ea0f50733d5ca6235d860412b655ed5580c6e0..1d104f819ac0326b6785b8595599506a82fb14c5 100644 (file)
@@ -28,7 +28,7 @@ public class Bug4145Test {
         File resourceFile = new File(getClass().getResource(
                 "/bug-4145/foo.yang").toURI());
 
-        SchemaContext context = YangParserTestUtils.parseYangSources(resourceFile);
+        SchemaContext context = YangParserTestUtils.parseYangFiles(resourceFile);
 
         List<Type> generateTypes = new BindingGeneratorImpl(false)
                 .generateTypes(context);
index 91824645a64f5c99246a4148ca252fdbf74d329f..ef2a0fe50d0c3e60591d0ff1a569f36825a28f4d 100644 (file)
@@ -10,26 +10,23 @@ 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.FileNotFoundException;
-import java.net.URISyntaxException;
+import java.io.File;
 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 FileNotFoundException, ReactorException, URISyntaxException {
-        final SchemaContext context = YangParserTestUtils.parseYangSource("/bug-6135/foo.yang");
+    public void bug6135Test() throws Exception {
+        final SchemaContext context = YangParserTestUtils
+                .parseYangFiles(new File(Bug6135Test.class.getResource("/bug-6135/foo.yang").toURI()));
         assertNotNull(context);
 
         final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(context);
index 942c6f418743b11e214e2f70de0c5844217c1f5a..8129af65a792ce14f01e522f879f5a2b13168912 100644 (file)
@@ -59,7 +59,7 @@ public class ChoiceCaseGenTypesTest extends AbstractTypesTest {
 
     @Test
     public void choiceCaseResolvingTypeTest() throws IOException, SourceException, ReactorException {
-        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 3a349fe48aef1bd47f867cb781b82f2e91c883c2..985934633aea12a34f01f14778719628e1ac3b6e 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.parseYangSources(cn, co, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(cn, co, ietfInetTypes);
         assertNotNull("Schema Context is null", context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 630387876ff5b5d7aa3eecfa869fd2fa6c0bd965..6d0c7efec30ed549a4dde1849d593a5b72dc8a51 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.parseYangSources(abstractTopology, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInetTypes);
         assertNotNull("Schema Context is null", context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index d1496f0fb479b60a6228ce8320b86f7c186dd5f7..064f593fd1a39484ecbc8e9a8e7fc2884d48818c 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.parseYangSources(ietfInterfaces, ianaIfTypeModel);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(ianaIfType);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(abstractTopology, ietfInterfaces,
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInterfaces,
                 ianaIfType);
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index e1d53a7dc8122598e850e9b0eab07f1a3b7f1446..4d907b044befe475a898bc67082ab8850ed1f7ff 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.parseYangSources(abstractTopology, ietfInterfaces,
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(abstractTopology, ietfInterfaces,
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInterfaces,
                 ietfInetTypes, ietfYangTypes, ianaIfType);
         assertNotNull("Schema Context is null", context);
         final Set<Module> modules = context.getModules();
index 624b0a4b897ff4789a76e1e2ab90b0fe486fa9a1..fb0b51fcb5011ab7f75c7f613b2b2883a848b3c7 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.parseYangSources(new File(yangTypesPath));
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(new File(yangTypesPath));
         assertTrue(context != null);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 8146fd4bf487d4c035da6126a4dd6cf14f80df40..ed89c6add02717f4a22ae740988bf02f40914889 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.parseYangSources(new File(yangTypesPath));
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(new File(yangTypesPath));
         assertTrue(context != null);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 47c275a71d9fd41fd512003b14fab041aa82a8e7..9b9c75d92c06a147a89043cf50cdf921341aac04 100644 (file)
@@ -14,34 +14,29 @@ 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 URISyntaxException, IOException, SourceException, ReactorException {
-        File abstractTopology = new File(getClass().getResource(
+    public void testLeafrefResolving() throws Exception {
+        final File abstractTopology = new File(getClass().getResource(
                 "/leafref-test-models/abstract-topology@2013-02-08.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 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());
 
-        final SchemaContext context =  YangParserTestUtils.parseYangSources(abstractTopology, ietfInterfaces,
+        final SchemaContext context =  YangParserTestUtils.parseYangFiles(abstractTopology, ietfInterfaces,
                 ietfInetTypes, ietfYangTypes);
         assertNotNull(context);
         assertEquals(4, context.getModules().size());
@@ -61,7 +56,7 @@ public class GeneratedTypesLeafrefTest {
         GeneratedTransferObject gtTunnelKey = null;
         GeneratedType gtTopology = null;
         for (final Type type : genTypes) {
-            String name = type.getName();
+            final String name = type.getName();
             if ("InterfaceKey".equals(name)) {
                 gtIfcKey = (GeneratedTransferObject) type;
             } else if ("Interface".equals(name)) {
@@ -100,7 +95,7 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(condLeafref);
-        Type condLeafRT = condLeafref.getReturnType();
+        final Type condLeafRT = condLeafref.getReturnType();
         assertNotNull(condLeafRT);
         assertEquals("java.lang.Object", condLeafRT.getFullyQualifiedName());
 
@@ -114,7 +109,7 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(ifcIdProp);
-        Type ifcIdPropType = ifcIdProp.getReturnType();
+        final Type ifcIdPropType = ifcIdProp.getReturnType();
         assertNotNull(ifcIdPropType);
         assertEquals("java.lang.String", ifcIdPropType.getFullyQualifiedName());
 
@@ -131,13 +126,13 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(getIfcKey);
-        Type getIfcKeyType = getIfcKey.getReturnType();
+        final Type getIfcKeyType = getIfcKey.getReturnType();
         assertNotNull(getIfcKeyType);
         assertNotSame("java.lang.Void", getIfcKeyType);
         assertEquals("InterfaceKey", getIfcKeyType.getName());
 
         assertNotNull(getHigherLayerIf);
-        Type getHigherLayerIfType = getHigherLayerIf.getReturnType();
+        final Type getHigherLayerIfType = getHigherLayerIf.getReturnType();
         assertNotNull(getHigherLayerIfType);
         assertNotSame("java.lang.Void", getHigherLayerIfType);
         assertEquals("List", getHigherLayerIfType.getName());
@@ -146,13 +141,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtNetworkLinkMethods = gtNetworkLink.getMethodDefinitions();
         assertNotNull(gtNetworkLinkMethods);
         MethodSignature getIfc = null;
-        for (MethodSignature method : gtNetworkLinkMethods) {
+        for (final MethodSignature method : gtNetworkLinkMethods) {
             if (method.getName().equals("getInterface")) {
                 getIfc = method;
             }
         }
         assertNotNull(getIfc);
-        Type getIfcType = getIfc.getReturnType();
+        final Type getIfcType = getIfc.getReturnType();
         assertNotNull(getIfcType);
         assertNotSame("java.lang.Void", getIfcType);
         assertEquals("String", getIfcType.getName());
@@ -161,13 +156,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtSourceMethods = gtSource.getMethodDefinitions();
         assertNotNull(gtSourceMethods);
         MethodSignature getIdSource = null;
-        for (MethodSignature method : gtSourceMethods) {
+        for (final MethodSignature method : gtSourceMethods) {
             if (method.getName().equals("getId")) {
                 getIdSource = method;
             }
         }
         assertNotNull(getIdSource);
-        Type getIdType = getIdSource.getReturnType();
+        final Type getIdType = getIdSource.getReturnType();
         assertNotNull(getIdType);
         assertNotSame("java.lang.Void", getIdType);
         assertEquals("Uri", getIdType.getName());
@@ -176,13 +171,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtDestMethods = gtDest.getMethodDefinitions();
         assertNotNull(gtDestMethods);
         MethodSignature getIdDest = null;
-        for (MethodSignature method : gtDestMethods) {
+        for (final MethodSignature method : gtDestMethods) {
             if (method.getName().equals("getId")) {
                 getIdDest = method;
             }
         }
         assertNotNull(getIdDest);
-        Type getIdDestType = getIdDest.getReturnType();
+        final Type getIdDestType = getIdDest.getReturnType();
         assertNotNull(getIdDestType);
         assertNotSame("java.lang.Void", getIdDestType);
         assertEquals("Uri", getIdDestType.getName());
@@ -191,13 +186,13 @@ public class GeneratedTypesLeafrefTest {
         final List<MethodSignature> gtTunnelMethods = gtTunnel.getMethodDefinitions();
         assertNotNull(gtTunnelMethods);
         MethodSignature getTunnelKey = null;
-        for (MethodSignature method : gtTunnelMethods) {
+        for (final MethodSignature method : gtTunnelMethods) {
             if (method.getName().equals("getKey")) {
                 getTunnelKey = method;
             }
         }
         assertNotNull(getTunnelKey);
-        Type getTunnelKeyType = getTunnelKey.getReturnType();
+        final Type getTunnelKeyType = getTunnelKey.getReturnType();
         assertNotNull(getTunnelKeyType);
         assertNotSame("java.lang.Void", getTunnelKeyType);
         assertEquals("TunnelKey", getTunnelKeyType.getName());
@@ -212,18 +207,18 @@ public class GeneratedTypesLeafrefTest {
             }
         }
         assertNotNull(tunnelId);
-        Type tunnelIdType = tunnelId.getReturnType();
+        final Type tunnelIdType = tunnelId.getReturnType();
         assertNotNull(tunnelIdType);
         assertNotSame("java.lang.Void", tunnelIdType);
         assertEquals("Uri", tunnelIdType.getName());
     }
 
     @Test
-    public void testLeafrefInvalidPathResolving() throws URISyntaxException, IOException, SourceException, ReactorException {
+    public void testLeafrefInvalidPathResolving() throws Exception {
         final URI resource = getClass().getResource("/leafref-test-invalid-model/foo.yang").toURI();
         assertNotNull(resource);
 
-        final SchemaContext context =  YangParserTestUtils.parseYangSources(new File(resource));
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(new File(resource));
         assertNotNull(context);
         assertEquals(1, context.getModules().size());
 
@@ -231,8 +226,8 @@ public class GeneratedTypesLeafrefTest {
         try {
             bindingGen.generateTypes(context);
             fail("Expected IllegalArgumentException caused by invalid leafref path");
-        } catch (IllegalArgumentException e) {
-            String expected = "Failed to find leafref target";
+        } catch (final IllegalArgumentException e) {
+            final String expected = "Failed to find leafref target";
             assertTrue(e.getMessage().contains(expected));
         }
     }
index 067ae8eb6ef47a7bf255a67c9dfca0a659da5b50..4d81a65da11ede82f5e9d387d291f11fc8dd227c 100644 (file)
@@ -41,7 +41,7 @@ public class GeneratedTypesStringTest {
 
     @Test
     public void constantGenerationTest() throws IOException, SourceException, ReactorException {
-        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index b47b3dd1cb06bf71ffd7e3f85d3eca4807e2a3bb..3a5bfee0c5432b85cd93028146c36059f481aeb7 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.parseYangSources(abstractTopology, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testFile);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testFile);
         assertNotNull(context);
 
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index b206cdfa9b8d44df40af543a6038a2f4e3024df3..823b14865e50cb2365a71fdcc373efe2cc0f4f77 100644 (file)
@@ -60,7 +60,7 @@ public class IdentityrefTypeTest {
      */
     @Test
     public void testIdentityrefYangBuiltInType() throws IOException, SourceException, ReactorException {
-        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 9b6005cf67ed84b5fa17eabcfd7becdda566de94..c58f01e0eef9851f75ebef63e3ab48c54a1e5abd 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.parseYangSources(abstractTopology, ietfInetTypes);
+        context = YangParserTestUtils.parseYangFiles(abstractTopology, ietfInetTypes);
         assertNotNull(context);
     }
 
index 300b2a23963e1081e774f72a51b7552949025cac..788b037984cf2500c80a6f46ce0c33f56fe3763b 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.parseYangSources(abstractTopology, ietfInetTypes);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(yang);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(yang);
         assertNotNull(schemaContext);
         final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(schemaContext);
         assertNotNull(generateTypes);
index 7d07af750418348096c448c8a9c23db280a0381d..2c73beb7c9ae5db125617931a948450a36d729cc 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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index 64af70e8b4b6f3e940b8bf5827f842a1102f6d31..d2e21a0277f11cdcb2cedad114c428431ae796bd 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.InputStream;
+import java.io.File;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.Collections;
@@ -33,8 +33,6 @@ 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;
 
 /**
@@ -61,10 +59,10 @@ public class BaseYangTypesTest {
     private static BooleanTypeDefinition bool = null;
 
     @BeforeClass
-    public static void setup() throws SourceException, ReactorException {
-        final List<InputStream> modelsToParse = Collections
-            .singletonList(BaseYangTypesTest.class.getResourceAsStream("/base-yang-types.yang"));
-        schemaContext = YangParserTestUtils.parseYangStreams(modelsToParse);
+    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);
         assertNotNull(schemaContext);
         initTypeDefinitionsFromSchemaContext();
     }
index 81b733b8261596e655c8303f7a1c7ff799ffd513..1577884e76a22bb22d0a0a6fc03cbe3eadd7e5a2 100644 (file)
@@ -10,13 +10,10 @@ 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;
@@ -24,7 +21,6 @@ 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 {
@@ -33,10 +29,10 @@ public class Bug4621 {
     public ExpectedException expectedEx = ExpectedException.none();
 
     @Test
-    public void bug4621test() throws FileNotFoundException, ReactorException, URISyntaxException {
-        File file = new File(getClass().getResource("/bug-4621/foo.yang").toURI());
+    public void bug4621test() throws Exception {
+        final File file = new File(getClass().getResource("/bug-4621/foo.yang").toURI());
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(file);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(file);
         final Module moduleValid = schemaContext.findModuleByNamespace(new URI("foo")).iterator().next();
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
 
@@ -44,10 +40,10 @@ public class Bug4621 {
 
         final QName listNode = QName.create(moduleValid.getQNameModule(), "neighbor");
         final QName leafrefNode = QName.create(moduleValid.getQNameModule(), "neighbor2-id");
-        DataSchemaNode leafrefRel = ((ListSchemaNode) moduleValid.getDataChildByName(listNode))
+        final DataSchemaNode leafrefRel = ((ListSchemaNode) moduleValid.getDataChildByName(listNode))
                 .getDataChildByName(leafrefNode);
-        LeafSchemaNode leafRel = (LeafSchemaNode) leafrefRel;
-        TypeDefinition<?> leafTypeRel = leafRel.getType();
+        final LeafSchemaNode leafRel = (LeafSchemaNode) leafrefRel;
+        final TypeDefinition<?> leafTypeRel = leafRel.getType();
         assertNotNull(typeProvider.javaTypeForSchemaDefinitionType(leafTypeRel, leafRel));
     }
 }
\ No newline at end of file
index 0aa5658665f30f32f61323293395801a85112fa4..a99a820a574376be8e14bc31eb304345df9da88c 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.parseYangSources(relative);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(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.parseYangSources(relative);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(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.parseYangSources(valid);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(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.parseYangSources(abstractTopology);
+        final SchemaContext schemaContext = YangParserTestUtils.parseYangFiles(abstractTopology);
 
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
 
index 6349e65823aea9e3323c89bdf766edff8d18a1a2..8d20e9fee801bcd59e1a3c795b325535dcc15700 100644 (file)
@@ -7,12 +7,10 @@
  */
 package org.opendaylight.mdsal.binding.yang.types;
 
-import java.io.InputStream;
+import java.io.File;
 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;
 
 /**
@@ -27,20 +25,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 InputStream getInputStream(final String resourceName) {
-        return TypeProviderModel.class.getResourceAsStream(resourceName);
+    private static File getFile(final String resourceName) throws Exception {
+        return new File(TypeProviderModel.class.getResource(resourceName).toURI());
     }
 
-    private static List<InputStream> provideTestModelStreams() {
-        final List<InputStream> arrayList = new ArrayList<>();
+    private static List<File> provideTestModelStreams() throws Exception {
+        final List<File> arrayList = new ArrayList<>();
 
-        arrayList.add(getInputStream(BASE_YANG_TYPES_PATH));
-        arrayList.add(getInputStream(TEST_TYPE_PROVIDER_PATH));
-        arrayList.add(getInputStream(TEST_TYPE_PROVIDER_B_PATH));
+        arrayList.add(getFile(BASE_YANG_TYPES_PATH));
+        arrayList.add(getFile(TEST_TYPE_PROVIDER_PATH));
+        arrayList.add(getFile(TEST_TYPE_PROVIDER_B_PATH));
         return arrayList;
     }
 
-    public static SchemaContext createTestContext() throws SourceException, ReactorException {
-        return YangParserTestUtils.parseYangStreams(provideTestModelStreams());
+    public static SchemaContext createTestContext() throws Exception {
+        return YangParserTestUtils.parseYangFiles(provideTestModelStreams());
     }
 }
index fdd752336d89dfbefd8fa3ee0ea1450ba4dbc881..6af6031558253e469461805f701e993bf3e8c0c9 100644 (file)
@@ -46,8 +46,6 @@ 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
@@ -70,7 +68,7 @@ public class TypeProviderTest {
     private SchemaNode schemaNode;
 
     @Before
-    public void setUp() throws SourceException, ReactorException {
+    public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
         this.schemaContext = TypeProviderModel.createTestContext();
         assertNotNull(this.schemaContext);
index d37e495ab8b0f091d52e883e490ac2bdc2bf38b4..c5e5583ebebc9745759d554198e7422ac3da85b2 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.parseYangSources(testModels).getModules();
+        final Set<Module> modules = YangParserTestUtils.parseYangFiles(testModels).getModules();
         String packageName = "";
         Module module = null;
         for (Module m : modules) {
index 9ccc6d3891030f17e6044492ad775c5199f4955a..1b348fb8ee77956ae1d3d39fd72ff89a71781c9f 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 8dd59bd4e7d40e758e491d2424c4171fbd6adcb8..d34d6e63a0b1199ce238cedce9e669b92417bcdf 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index eb00557eb32366db11f1623b797ad9525838e8a1..cc3e303fabe710a8946ce99b9f09b1af56c7bbbb 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 410e233381ffc076e5749274eba65c59f7c7cd78..bd31b634b3e64ba3dee3f13378e9d77ca2de6c15 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 9f42e58536b44b92610c29fbc23b96523d8b97fc..d164574bff90a82d461ce6ed0f5439f212a31ea8 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 8a750aeed06f39fb316de01bf14e716b4af272d4..1b8cdbe761e7149378eb063a58debd08777438ce 100644 (file)
@@ -49,7 +49,7 @@ public class ClassCodeGeneratorTest {
     @Test
     public void compositeKeyClassTest() throws IOException, SourceException, ReactorException {
 
-        final SchemaContext context = YangParserTestUtils.parseYangSources(testModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
         assertNotNull(context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
index d694c029991f36345f6227e6b6ffbb6eccc60e0b..7499d8fe8088e3134b80ab1177ff546a6caa3aee 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(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 ca0a131a014c85dba16ce57321ddb051e66e2813..2e6369baab4b972c9fa437943c18a6f7aa6b91a8 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index a3230b8a5e6ab39f50bf2987831352d282477431..9f16a35f8c31018b4b40054ffac9548c8c48e0ca 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 53e6b1f9a1d4f5821ca8d5d7f36c54f51a41c0e9..3b0c0fe38ead57f2a40124dbe7be59b0538b5898 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index 0aacf1e8828b7327b04197de05326f4d02b29c79..cfa2e7a1a8646183ed37382b6766726599114edc 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(new HashSet<>(types));
         generator.generateToFile(sourcesOutputDir);
index 60d1aeecf72d75704d65de7810eaf3a563107d0e..a8478097d36a12e50677dc952795177d4073ac82 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.parseYangSources(sourceFiles);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(sourceFiles);
         final List<Type> types = bindingGenerator.generateTypes(context);
         final GeneratorJavaFile generator = new GeneratorJavaFile(ImmutableSet.copyOf(types));
         generator.generateToFile(sourcesOutputDir);
index fd5f15e370c753a034c292ceb8d7e3e9a7acb020..095e44b599adc738f1e4d79d289aab3ebc1ba64e 100644 (file)
@@ -15,6 +15,7 @@ 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;
@@ -165,7 +166,8 @@ public class AugmentToGenTypeTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/test.yang");
+        final SchemaContext context =
+                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/generator/test.yang").toURI()));
         final TypeProvider typeProvider = new TypeProviderImpl(context);
         final Map<Module, ModuleContext> genCtx = new HashMap<>();
         final Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders = new HashMap<>();
@@ -185,7 +187,8 @@ public class AugmentToGenTypeTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/test-augment.yang");
+        final SchemaContext context = YangParserTestUtils
+                .parseYangFiles(new File(getClass().getResource("/generator/test-augment.yang").toURI()));
         final TypeProvider typeProvider = new TypeProviderImpl(context);
         final Map<Module, ModuleContext> genCtx = mock(Map.class);
         final Collection<ModuleContext> moduleContexts = new ArrayList<>();
index f43d0caca3c2a0a9f07d494eabf6700e45860b38..2e37c5b54990fd14ab19ab3573b7b64a9834d35b 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,7 +194,8 @@ public class AuxiliaryGenUtilsTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/generator/test-list.yang");
+        final SchemaContext schemaContext = YangParserTestUtils
+                .parseYangFiles(new File(getClass().getResource("/generator/test-list.yang").toURI()));
         final ListSchemaNode containerSchemaNode =
                 (ListSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
         final String fullyQualifiedName =
@@ -222,7 +223,8 @@ public class AuxiliaryGenUtilsTest {
         generate.setAccessible(true);
 
         final SchemaContext schemaContext =
-                YangParserTestUtils.parseYangSource("/base/test-leaf-with-description.yang");
+                YangParserTestUtils.parseYangFiles(
+                        new File(getClass().getResource("/base/test-leaf-with-description.yang").toURI()));
         final LeafSchemaNode containerSchemaNode =
                 (LeafSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
         final String fullyQualifiedName = "test.base.cont.with.leaf.MyList";
@@ -241,7 +243,8 @@ public class AuxiliaryGenUtilsTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/base/test-module.yang");
+        final SchemaContext schemaContext =
+                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/base/test-module.yang").toURI()));
 
         final Object[] args = { schemaContext.getModules().iterator().next(), true };
         final String result = (String) generate.invoke(AuxiliaryGenUtils.class, args);
@@ -258,7 +261,8 @@ public class AuxiliaryGenUtilsTest {
         assertNotNull(generate);
         generate.setAccessible(true);
 
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/base/test-rpc-and-notification.yang");
+        final SchemaContext schemaContext = YangParserTestUtils
+                .parseYangFiles(new File(getClass().getResource("/base/test-rpc-and-notification.yang").toURI()));
         final Module module = schemaContext.getModules().iterator().next();
         Set schemaNodes = new HashSet<>();
         schemaNodes.add(module.getRpcs().iterator().next());
@@ -487,7 +491,8 @@ public class AuxiliaryGenUtilsTest {
 
         final GeneratedTypeBuilder typeBuilder =
                 new GeneratedTypeBuilderImpl("test.boolean.spc.def", "spec-type-def", new ModuleContext());
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource(yangPath);
+        final SchemaContext schemaContext =
+                YangParserTestUtils.parseYangFiles(new File(getClass().getResource(yangPath).toURI()));
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
         final LeafSchemaNode leafSchemaNode =
                 (LeafSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
@@ -511,7 +516,8 @@ public class AuxiliaryGenUtilsTest {
 
         final GeneratedTypeBuilder typeBuilder = new GeneratedTypeBuilderImpl("test.boolean.spc.def",
                 "spec-type-def", new ModuleContext());
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/base/test-union.yang");
+        final SchemaContext schemaContext =
+                YangParserTestUtils.parseYangFiles(new File(getClass().getResource("/base/test-union.yang").toURI()));
         final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
         final LeafSchemaNode leafSchemaNode =
                 (LeafSchemaNode) schemaContext.getModules().iterator().next().getChildNodes().iterator().next();
index fbfe586b692c6ff1493dfc51b90e3940039784b8..e06edd2c646e030e613ba769a026a727349665a7 100644 (file)
@@ -12,6 +12,8 @@ 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;
@@ -30,7 +32,8 @@ public class BindingGeneratorImplTest {
     @Test
     public void genTypesTypeDefTest() throws Exception {
         final BindingGeneratorImpl bg = new BindingGeneratorImpl(false);
-        final SchemaContext schemaContext = YangParserTestUtils.parseYangSource("/generator/test-typedef.yang");
+        final SchemaContext schemaContext = YangParserTestUtils
+                .parseYangFiles(new File(getClass().getResource("/generator/test-typedef.yang").toURI()));
         final List<Type> generateTypes = bg.generateTypes(schemaContext);
         assertNotNull(generateTypes);
         for (final Type genType : generateTypes) {
@@ -49,7 +52,8 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesEnumTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/apple-test.yang");
+        final SchemaContext context = YangParserTestUtils
+                .parseYangFiles(new File(getClass().getResource("/generator/apple-test.yang").toURI()));
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -72,10 +76,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesEnumLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        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<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<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -99,10 +103,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesBitsLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        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<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<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -110,7 +114,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafBits")) {
                         assertEquals("LeafBits", methodSignature.getReturnType().getName());
                     }
@@ -121,7 +125,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafBits")) {
                         assertEquals("LeafBits", methodSignature.getReturnType().getName());
                     }
@@ -133,10 +137,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesUnionLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        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<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<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -144,7 +148,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafUnion")) {
                         assertEquals("LeafUnion", methodSignature.getReturnType().getName());
                     }
@@ -155,7 +159,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafUnion")) {
                         assertEquals("LeafUnion", methodSignature.getReturnType().getName());
                     }
@@ -167,10 +171,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesLeafTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        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<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<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -178,7 +182,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafDecimal64")) {
                         assertEquals("BigDecimal", methodSignature.getReturnType().getName());
                     }
@@ -189,7 +193,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getLeafDecimal64")) {
                         assertEquals("BigDecimal", methodSignature.getReturnType().getName());
                     }
@@ -201,10 +205,10 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesUsesLeafInnertype3Test() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        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<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<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
@@ -212,7 +216,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getBandwidth")) {
                         assertEquals("Bandwidth", methodSignature.getReturnType().getName());
                     }
@@ -223,7 +227,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 (MethodSignature methodSignature : gt.getMethodDefinitions()) {
+                for (final MethodSignature methodSignature : gt.getMethodDefinitions()) {
                     if (methodSignature.getName().equals("getVersion")) {
                         assertEquals("ProtocolVersion", methodSignature.getReturnType().getName());
                     }
@@ -240,7 +244,8 @@ public class BindingGeneratorImplTest {
     @Test
     public void generatedTypesTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(false);
-        final SchemaContext context = YangParserTestUtils.parseYangSource("/generator/test-list.yang");
+        final SchemaContext context = YangParserTestUtils
+                .parseYangFiles(new File(getClass().getResource("/generator/test-list.yang").toURI()));
         final List<Type> generateTypes = bg.generateTypes(context);
 
         assertNotNull(generateTypes);
@@ -284,7 +289,7 @@ public class BindingGeneratorImplTest {
     @Test
     public void generateTypesDescriptionsTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(true);
-        final SchemaContext context = YangParserTestUtils.parseYangSources("/base/with_import/");
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(getFiles("/base/with_import/"));
         assertNotNull(context);
 
         final List<Type> generateTypes = bg.generateTypes(context, context.getModules());
@@ -306,7 +311,7 @@ public class BindingGeneratorImplTest {
     @Test
     public void generateTypesIdentityTest() throws Exception {
         final BindingGenerator bg = new BindingGeneratorImpl(true);
-        final SchemaContext context = YangParserTestUtils.parseYangSources("/identity/");
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(getFiles("/identity/"));
         assertNotNull(context);
 
         final List<Type> generateTypes = bg.generateTypes(context, context.getModules());
@@ -337,6 +342,10 @@ 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 a8c7c095b5cc366e5981fcfb300f1ac5f4f368df..3cc065c54ca58010b07453f9afdea61e45ba91a0 100644 (file)
@@ -11,18 +11,20 @@ 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.parseYangSource("/bug-8542/recursive-uses-augment.yang");
+        final SchemaContext context = YangParserTestUtils
+                .parseYangFiles(new File(getClass().getResource("/bug-8542/recursive-uses-augment.yang").toURI()));
         final List<Type> generateTypes = bg.generateTypes(context);
         assertNotNull(generateTypes);
         assertTrue(!generateTypes.isEmpty());
index c94f93346bc6226a6c947a891f0b6c2886e3016b..149fa062108265796b6d86bbe142f4e0ac1953ca 100644 (file)
@@ -38,7 +38,7 @@ public class Bug8575Test {
         File foo = new File(getClass().getResource(
                 "/bug-8575/foo.yang").toURI());
 
-        SchemaContext context = YangParserTestUtils.parseYangSources(foo);
+        SchemaContext context = YangParserTestUtils.parseYangFiles(foo);
 
         final QName groupingQname = QName.create("foo", "2017-05-15", "A");
         final QName containerQname = QName.create("foo", "2017-05-15", "A1");
index 2484b4a80bdade6b4fba7f832cee747841c17d9b..f6523140fbd425348c4ecf97367c96203d0713e8 100644 (file)
@@ -11,8 +11,10 @@ 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;
@@ -31,7 +33,8 @@ public class YangTemplateTest {
 
     @Before
     public void setup() throws URISyntaxException, ReactorException, FileNotFoundException {
-        this.modules = YangParserTestUtils.parseYangSources("/yang-template").getModules();
+        File[] listFiles = new File(getClass().getResource("/yang-template").toURI()).listFiles();
+        this.modules = YangParserTestUtils.parseYangFiles(listFiles).getModules();
     }
 
     @Test
index 57c7e8d95883367f3a1bf30cc6d36edea5083ecf..47bbe5b43dacdf3aa3e24162bca71bbf53d7272e 100644 (file)
@@ -27,7 +27,8 @@ public class GeneratorJavaFileTest {
 
     @Test
     public void generatedFilesTest() throws Exception {
-        final SchemaContext context = YangParserTestUtils.parseYangSources("/base/with_import/");
+        final File[] listFiles = new File(getClass().getResource("/base/with_import/").toURI()).listFiles();
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(listFiles);
         final BindingGenerator bindingGenerator = new BindingGeneratorImpl(true);
         final List<Type> types = bindingGenerator.generateTypes(context, context.getModules());
         final BuildContext buildContext = new DefaultBuildContext();
index 5df2959ebbe7e01629889aa93089a13d1b5b22de..74213576c7cb0cfb4a5db292ab0e2f2988af6cba 100644 (file)
@@ -29,7 +29,7 @@ public class BindingRuntimeContextTest {
 
     @Before
     public void setup() throws URISyntaxException, FileNotFoundException, ReactorException {
-        schemaContext = YangParserTestUtils.parseYangSources(
+        schemaContext = YangParserTestUtils.parseYangFiles(
                  new File(getClass().getResource("/yang/test-runtime.yang").toURI()));
         myCont = (DataNodeContainer) schemaContext.getChildNodes().iterator().next();
         brc = BindingRuntimeContext.create(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), schemaContext);
index d87b5685a056f3127ca9d8bedeebda21e45204db..c26a3f298984fed6205157bf5a0a44550dff878b 100644 (file)
@@ -36,7 +36,7 @@ public class BindingSchemaContextUtilsTest {
 
     @Before
     public void setup() throws URISyntaxException, FileNotFoundException, ReactorException {
-        schemaContext = YangParserTestUtils.parseYangSources(
+        schemaContext = YangParserTestUtils.parseYangFiles(
                 new File(getClass().getResource("/yang/test-runtime.yang").toURI()));
         myCont = (DataNodeContainer) schemaContext.getChildNodes().iterator().next();
         myChoice = (ChoiceSchemaNode) myCont.getChildNodes().iterator().next();
index 4da15e53fbba1a990b06ac321283f841dfee177b..5bd0a44f9211351c80c10c94f74486bc92e90251 100644 (file)
@@ -20,6 +20,7 @@ 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;
@@ -55,7 +56,6 @@ 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 ReactorException e) {
+        } catch (final URISyntaxException e) {
             LOG.error("Unable to create schema context for TestModel", e);
         }
     }
index 3a3a2e8a1b0cbac426a797ee20480f2bed72e619..90d034b37a36fcf60c8fac4ed291aa99de8d8095 100644 (file)
@@ -22,6 +22,7 @@ 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;
@@ -58,7 +59,6 @@ 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 ReactorException e) {
+        } catch (final URISyntaxException 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());
 
-        InMemoryDOMDataTreeShard testShard = InMemoryDOMDataTreeShard.create(TEST_ID, executor, 1);
+        final 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);
 
-        MapNode innerList = ImmutableMapNodeBuilder
+        final MapNode innerList = ImmutableMapNodeBuilder
                 .create()
                 .withNodeIdentifier(new NodeIdentifier(TestModel.INNER_LIST_QNAME))
                 .build();
index 2f97daa948ac67378f80bc5081d501f523dfda3e..9aa98879c118c10bfb38a27f703e50e08fb5246a 100644 (file)
@@ -7,12 +7,12 @@
  */
 package org.opendaylight.mdsal.dom.broker.util;
 
-import java.io.InputStream;
+import java.io.File;
+import java.net.URISyntaxException;
 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 ReactorException {
-        return YangParserTestUtils.parseYangStreams(Collections.singletonList(getInputStream()));
+    public static SchemaContext createTestContext() throws URISyntaxException {
+        return YangParserTestUtils.parseYangFiles(Collections.singletonList(getFile()));
     }
 
-    private static InputStream getInputStream() {
-        return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
+    private static File getFile() throws URISyntaxException {
+        return new File(TestModel.class.getResource(DATASTORE_TEST_YANG).toURI());
     }
 }
index 9748505cbff2ce7d7af447cccc60b0539e754c3c..38184890a7c0b0ffc80e5f36b47411d13c4c77da 100644 (file)
@@ -15,7 +15,6 @@ 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;
@@ -39,8 +38,6 @@ 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 {
 
@@ -48,7 +45,7 @@ public class InMemoryDataStoreTest {
     private InMemoryDOMDataStore domStore;
 
     @Before
-    public void setupStore() throws IOException, YangSyntaxErrorException, ReactorException {
+    public void setupStore() throws Exception {
         domStore = new InMemoryDOMDataStore("TEST", MoreExecutors.newDirectExecutorService());
         schemaContext = TestModel.createTestContext();
         domStore.onGlobalContextUpdated(schemaContext);
@@ -59,57 +56,57 @@ public class InMemoryDataStoreTest {
 
         assertNotNull(domStore);
 
-        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
-        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         /**
          * Writes /test in writeTx.
          */
-        NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+        final NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
         writeTx.write(TestModel.TEST_PATH, testNode);
 
         /**
          * Reads /test from writeTx Read should return container.
          */
-        ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
+        final 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.
          */
-        ListenableFuture<Optional<NormalizedNode<?, ?>>> readTxContainer = readTx.read(TestModel.TEST_PATH);
+        final ListenableFuture<Optional<NormalizedNode<?, ?>>> readTxContainer = readTx.read(TestModel.TEST_PATH);
         assertEquals("read: isPresent", false, readTxContainer.get().isPresent());
     }
 
     @Test
     public void testTransactionCommit() throws InterruptedException, ExecutionException {
 
-        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         /**
          * Writes /test in writeTx.
          */
-        NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
+        final NormalizedNode<?, ?> testNode = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
         writeTx.write(TestModel.TEST_PATH, testNode);
 
         /**
          * Reads /test from writeTx Read should return container.
          */
-        ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
+        final ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = writeTx.read(TestModel.TEST_PATH);
         assertEquals("read: isPresent", true, writeTxContainer.get().isPresent());
         assertEquals("read: data", testNode, writeTxContainer.get().get());
 
-        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
+        final DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
 
         assertThreePhaseCommit(cohort);
 
-        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH)
-                .get();
+        final 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());
     }
@@ -189,10 +186,10 @@ public class InMemoryDataStoreTest {
     @Test
     public void testExistsForExistingData() throws Exception {
 
-        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
-        ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
+        final ContainerNode containerNode = ImmutableContainerNodeBuilder.create()
             .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
             .addChild(ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME)
                 .addChild(ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME,
@@ -204,13 +201,13 @@ public class InMemoryDataStoreTest {
 
         assertEquals(Boolean.TRUE, exists.get());
 
-        DOMStoreThreePhaseCommitCohort ready = writeTx.ready();
+        final DOMStoreThreePhaseCommitCohort ready = writeTx.ready();
 
         ready.preCommit().get();
 
         ready.commit().get();
 
-        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         exists =
@@ -222,14 +219,14 @@ public class InMemoryDataStoreTest {
     @Test
     public void testExistsForNonExistingData() throws Exception {
 
-        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         ListenableFuture<Boolean> exists = writeTx.exists(TestModel.TEST_PATH);
 
         assertEquals(Boolean.FALSE, exists.get());
 
-        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         exists =
@@ -241,7 +238,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testExistsThrowsReadFailedException() throws Exception {
 
-        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         readTx.close();
@@ -254,7 +251,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadOnlyTransactionClosed() throws Throwable {
 
-        DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
+        final DOMStoreReadTransaction readTx = domStore.newReadOnlyTransaction();
         assertNotNull(readTx);
 
         readTx.close();
@@ -266,11 +263,11 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadOnlyTransactionFailure() throws Throwable {
 
-        DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
+        final DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
         Mockito.doThrow(new RuntimeException("mock ex")).when(mockSnapshot)
         .readNode(Mockito.any(YangInstanceIdentifier.class));
 
-        DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadTransaction("1", true, mockSnapshot);
+        final DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadTransaction("1", true, mockSnapshot);
 
         doReadAndThrowEx(readTx);
     }
@@ -279,7 +276,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadWriteTransactionClosed() throws Throwable {
 
-        DOMStoreReadTransaction readTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadTransaction readTx = domStore.newReadWriteTransaction();
         assertNotNull(readTx);
 
         readTx.close();
@@ -291,15 +288,15 @@ public class InMemoryDataStoreTest {
     @Test(expected = ReadFailedException.class)
     public void testReadWithReadWriteTransactionFailure() throws Throwable {
 
-        DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
-        DataTreeModification mockModification = Mockito.mock(DataTreeModification.class);
+        final DataTreeSnapshot mockSnapshot = Mockito.mock(DataTreeSnapshot.class);
+        final 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")
-        TransactionReadyPrototype<String> mockReady = Mockito.mock(TransactionReadyPrototype.class);
-        DOMStoreReadTransaction readTx = SnapshotBackedTransactions.newReadWriteTransaction(
-                "1", false, mockSnapshot, mockReady);
+        final TransactionReadyPrototype<String> mockReady = Mockito.mock(TransactionReadyPrototype.class);
+        final DOMStoreReadTransaction readTx =
+                SnapshotBackedTransactions.newReadWriteTransaction("1", false, mockSnapshot, mockReady);
 
         doReadAndThrowEx(readTx);
     }
@@ -308,7 +305,7 @@ public class InMemoryDataStoreTest {
     private static void doReadAndThrowEx(final DOMStoreReadTransaction readTx) throws Throwable {
         try {
             readTx.read(TestModel.TEST_PATH).get();
-        } catch (ExecutionException e) {
+        } catch (final ExecutionException e) {
             throw e.getCause();
         }
     }
@@ -316,7 +313,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = IllegalStateException.class)
     public void testWriteWithTransactionReady() throws Exception {
 
-        DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
+        final DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
 
         writeTx.ready();
 
@@ -327,7 +324,7 @@ public class InMemoryDataStoreTest {
     @Test(expected = IllegalStateException.class)
     public void testReadyWithTransactionAlreadyReady() throws Exception {
 
-        DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
+        final DOMStoreWriteTransaction writeTx = domStore.newWriteOnlyTransaction();
 
         writeTx.ready();
 
@@ -338,31 +335,31 @@ public class InMemoryDataStoreTest {
     @Test
     public void testTransactionAbort() throws InterruptedException, ExecutionException {
 
-        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
         assertNotNull(writeTx);
 
         assertTestContainerWrite(writeTx);
 
-        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
+        final DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
 
         assertTrue(cohort.canCommit().get().booleanValue());
         cohort.preCommit().get();
         cohort.abort().get();
 
-        Optional<NormalizedNode<?, ?>> afterCommitRead = domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH)
-                .get();
+        final Optional<NormalizedNode<?, ?>> afterCommitRead =
+                domStore.newReadOnlyTransaction().read(TestModel.TEST_PATH).get();
         assertFalse(afterCommitRead.isPresent());
     }
 
     @Test
     public void testTransactionChain() throws InterruptedException, ExecutionException {
-        DOMStoreTransactionChain txChain = domStore.createTransactionChain();
+        final DOMStoreTransactionChain txChain = domStore.createTransactionChain();
         assertNotNull(txChain);
 
         /**
          * We alocate new read-write transaction and write /test.
          */
-        DOMStoreReadWriteTransaction firstTx = txChain.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction firstTx = txChain.newReadWriteTransaction();
         assertTestContainerWrite(firstTx);
 
         /**
@@ -375,7 +372,7 @@ public class InMemoryDataStoreTest {
          * We alocate chained transaction - read transaction, note first one is
          * still not commited to datastore.
          */
-        DOMStoreReadTransaction secondReadTx = txChain.newReadOnlyTransaction();
+        final DOMStoreReadTransaction secondReadTx = txChain.newReadOnlyTransaction();
 
         /**
          * We test if we are able to read data from tx, read should not fail
@@ -387,7 +384,7 @@ public class InMemoryDataStoreTest {
          * We alocate next transaction, which is still based on first one, but
          * is read-write.
          */
-        DOMStoreReadWriteTransaction thirdDeleteTx = txChain.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction thirdDeleteTx = txChain.newReadWriteTransaction();
 
         /**
          * We test existence of /test in third transaction container should
@@ -403,7 +400,7 @@ public class InMemoryDataStoreTest {
         /**
          * third transaction is sealed.
          */
-        DOMStoreThreePhaseCommitCohort thirdDeleteTxCohort = thirdDeleteTx.ready();
+        final DOMStoreThreePhaseCommitCohort thirdDeleteTxCohort = thirdDeleteTx.ready();
 
         /**
          * We commit first transaction.
@@ -412,7 +409,7 @@ public class InMemoryDataStoreTest {
         assertThreePhaseCommit(firstWriteTxCohort);
 
         // Alocates store transacion
-        DOMStoreReadTransaction storeReadTx = domStore.newReadOnlyTransaction();
+        final DOMStoreReadTransaction storeReadTx = domStore.newReadOnlyTransaction();
         /**
          * We verify transaction is commited to store, container should exists
          * in datastore.
@@ -428,8 +425,8 @@ public class InMemoryDataStoreTest {
     @Test
     @Ignore
     public void testTransactionConflict() throws InterruptedException, ExecutionException {
-        DOMStoreReadWriteTransaction txOne = domStore.newReadWriteTransaction();
-        DOMStoreReadWriteTransaction txTwo = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction txOne = domStore.newReadWriteTransaction();
+        final DOMStoreReadWriteTransaction txTwo = domStore.newReadWriteTransaction();
         assertTestContainerWrite(txOne);
         assertTestContainerWrite(txTwo);
 
@@ -469,7 +466,7 @@ public class InMemoryDataStoreTest {
     private static Optional<NormalizedNode<?, ?>> assertTestContainerExists(final DOMStoreReadTransaction readTx)
             throws InterruptedException, ExecutionException {
 
-        ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = readTx.read(TestModel.TEST_PATH);
+        final ListenableFuture<Optional<NormalizedNode<?, ?>>> writeTxContainer = readTx.read(TestModel.TEST_PATH);
         assertTrue(writeTxContainer.get().isPresent());
         return writeTxContainer.get();
     }
index 8e4cf2b8f7401a553bae3c3b6cc0fd2ef280aa8f..a70dff231dc82132055869fa49824a15e32dc9f9 100644 (file)
@@ -7,14 +7,11 @@
  */
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.File;
 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 {
@@ -34,11 +31,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 IOException, YangSyntaxErrorException, ReactorException {
-        return YangParserTestUtils.parseYangStreams(Collections.singletonList(getInputStream()));
+    public static SchemaContext createTestContext() throws Exception {
+        return YangParserTestUtils.parseYangFiles(Collections.singletonList(getFile()));
     }
 
-    private static InputStream getInputStream() {
-        return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
+    private static File getFile() throws Exception {
+        return new File(TestModel.class.getResource(DATASTORE_TEST_YANG).toURI());
     }
 }