Add ability to get yang sources from SchemaContext.
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / impl / UsesAugmentTest.java
index 47edbc2c87bfb63e2e282dc961e2fe6fe3e09963..c713f759f1c9e79089067acd45e2a716ea2538ab 100644 (file)
@@ -11,7 +11,10 @@ import static org.junit.Assert.*;
 
 import java.io.FileNotFoundException;
 import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.DateFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
@@ -50,8 +53,9 @@ public class UsesAugmentTest {
 
     @Before
     public void init() throws FileNotFoundException, ParseException {
-        UG_REV = TestUtils.simpleDateFormat.parse("2013-07-30");
-        GD_REV = TestUtils.simpleDateFormat.parse("2013-09-04");
+        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        UG_REV = simpleDateFormat.parse("2013-07-30");
+        GD_REV = simpleDateFormat.parse("2013-09-04");
     }
 
     /**
@@ -110,7 +114,7 @@ public class UsesAugmentTest {
      */
     @Test
     public void testAugmentInUses() throws Exception {
-        modules = TestUtils.loadModules(getClass().getResource("/grouping-test").getPath());
+        modules = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI());
         Module testModule = TestUtils.findModule(modules, "uses-grouping");
 
         LinkedList<QName> path = new LinkedList<>();
@@ -235,7 +239,7 @@ public class UsesAugmentTest {
         path.offer(expectedQName);
         expectedPath = new SchemaPath(path, true);
         assertEquals(expectedPath, order.getPath());
-        assertFalse(order.isAddedByUses());
+        assertTrue(order.isAddedByUses());
         assertTrue(order.isAugmenting());
         assertEquals(2, order.getChildNodes().size());
         // * |-- |-- |-- |-- |-- leaf delete
@@ -606,8 +610,8 @@ public class UsesAugmentTest {
     }
 
     @Test
-    public void testTypedefs() throws FileNotFoundException {
-        modules = TestUtils.loadModules(getClass().getResource("/grouping-test").getPath());
+    public void testTypedefs() throws FileNotFoundException, URISyntaxException {
+        modules = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI());
         Module testModule = TestUtils.findModule(modules, "grouping-definitions");
         Set<TypeDefinition<?>> types = testModule.getTypeDefinitions();