Fix broken tests according to yangtools changes
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / test / java / org / opendaylight / controller / md / sal / dom / store / impl / TestModel.java
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());
     }
 }