Fixed module dependency sort to allow parsing modules with same name and different... 27/3127/1
authorMartin Vitez <mvitez@cisco.com>
Wed, 27 Nov 2013 13:46:38 +0000 (14:46 +0100)
committerMartin Vitez <mvitez@cisco.com>
Wed, 27 Nov 2013 13:46:38 +0000 (14:46 +0100)
Signed-off-by: Martin Vitez <mvitez@cisco.com>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ModuleDependencySort.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/util/ModuleDependencySortTest.java

index fd417493d2376440a9a08068703c031a2e8c5c2a..8f22718eb865f3dd5acbebdd7bb07a727fcb0524 100644 (file)
@@ -131,10 +131,11 @@ public final class ModuleDependencySort {
      * Extract module:revision from module builders
      */
     private static void processDependencies(Map<String, Map<Date, ModuleNodeImpl>> moduleGraph, List<?> builders) {
-        Map<String, Date> imported = Maps.newHashMap();
+
 
         // Create edges in graph
         for (Object mb : builders) {
+            Map<String, Date> imported = Maps.newHashMap();
 
             String fromName = null;
             Date fromRevision = null;
index 203e9e06107d451c454176f0d95a67603f2aca4d..106580ad19bb3f9432987594e3b67580012104f0 100644 (file)
@@ -118,26 +118,6 @@ public class ModuleDependencySortTest {
         ModuleDependencySort.sort(builders);
     }
 
-    @Test(expected = YangValidationException.class)
-    public void testImportTwiceDifferentRevision() throws Exception {
-        Date date1 = new Date(463846463486L);
-        Date date2 = new Date(364896446683L);
-        b = mockModuleBuilder("b", date1);
-        ModuleBuilder b2 = mockModuleBuilder("b", date2);
-
-        mockDependency(a, b);
-        mockDependency(c, b2);
-
-        ModuleBuilder[] builders = new ModuleBuilder[] { a, c, b, b2 };
-        try {
-            ModuleDependencySort.sort(builders);
-        } catch (YangValidationException e) {
-            assertThat(e.getMessage(), containsString("Module:b imported twice with different revisions:"
-                    + SIMPLE_DATE_FORMAT.format(date1) + ", " + SIMPLE_DATE_FORMAT.format(date2)));
-            throw e;
-        }
-    }
-
     @Test
     public void testModuleTwiceWithDifferentRevs() throws Exception {
         ModuleBuilder a2 = mockModuleBuilder("a", new Date());