Bug 7847: Implement YANG 1.1 XPath functions in YangFunctionContext
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / UsesAugmentTest.java
index d88d36eade2eddc86431baa94e63c0c368c5737e..4d2b1a2277972f5c8edf97744770cc9c218e1495 100644 (file)
@@ -11,12 +11,11 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+
 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.ArrayDeque;
 import java.util.Collection;
 import java.util.Date;
@@ -25,6 +24,7 @@ import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
@@ -37,8 +37,6 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
 import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
 public class UsesAugmentTest {
     private static final URI UG_NS = URI.create("urn:opendaylight:params:xml:ns:yang:uses-grouping");
@@ -50,7 +48,7 @@ public class UsesAugmentTest {
 
     @Before
     public void init() throws FileNotFoundException, ParseException {
-        DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        final DateFormat simpleDateFormat = SimpleDateFormatUtil.getRevisionFormat();
         UG_REV = simpleDateFormat.parse("2013-07-30");
         GD_REV = simpleDateFormat.parse("2013-09-04");
     }
@@ -114,14 +112,14 @@ public class UsesAugmentTest {
     @Test
     public void testAugmentInUses() throws Exception {
         modules = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI());
-        Module testModule = TestUtils.findModule(modules, "uses-grouping");
+        final Module testModule = TestUtils.findModule(modules, "uses-grouping");
 
-        Deque<QName> path = new ArrayDeque<>();
+        final Deque<QName> path = new ArrayDeque<>();
 
         // * notification pcreq
-        Set<NotificationDefinition> notifications = testModule.getNotifications();
+        final Set<NotificationDefinition> notifications = testModule.getNotifications();
         assertEquals(1, notifications.size());
-        NotificationDefinition pcreq = notifications.iterator().next();
+        final NotificationDefinition pcreq = notifications.iterator().next();
         assertNotNull(pcreq);
         QName expectedQName = QName.create(UG_NS, UG_REV, "pcreq");
         path.offer(expectedQName);
@@ -130,7 +128,8 @@ public class UsesAugmentTest {
         Collection<DataSchemaNode> childNodes = pcreq.getChildNodes();
         assertEquals(4, childNodes.size());
         // * |-- leaf version
-        LeafSchemaNode version = (LeafSchemaNode) pcreq.getDataChildByName("version");
+        LeafSchemaNode version = (LeafSchemaNode) pcreq.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "version"));
         assertNotNull(version);
         expectedQName = QName.create(UG_NS, UG_REV, "version");
         path.offer(expectedQName);
@@ -143,7 +142,8 @@ public class UsesAugmentTest {
         assertEquals(BaseTypes.uint8Type(), version.getType().getBaseType().getBaseType());
         assertTrue(version.isAddedByUses());
         // * |-- leaf type
-        LeafSchemaNode type = (LeafSchemaNode) pcreq.getDataChildByName("type");
+        LeafSchemaNode type = (LeafSchemaNode) pcreq.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "type"));
         assertNotNull(type);
         expectedQName = QName.create(UG_NS, UG_REV, "type");
         assertTrue(type.isAddedByUses());
@@ -156,11 +156,12 @@ public class UsesAugmentTest {
         path.offer(expectedQName);
         expectedPath = SchemaPath.create(true, expectedQName);
         assertEquals(expectedPath, type.getType().getPath());
-        UnionTypeDefinition union = (UnionTypeDefinition) type.getType().getBaseType();
+        final UnionTypeDefinition union = (UnionTypeDefinition) type.getType().getBaseType();
         assertEquals(SchemaPath.create(true, expectedQName, QName.create(expectedQName, "union")), union.getPath());
         assertEquals(2, union.getTypes().size());
         // * |-- list requests
-        ListSchemaNode requests = (ListSchemaNode) pcreq.getDataChildByName("requests");
+        final ListSchemaNode requests = (ListSchemaNode) pcreq.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "requests"));
         assertNotNull(requests);
         expectedQName = QName.create(UG_NS, UG_REV, "requests");
         assertEquals(expectedQName, requests.getQName());
@@ -173,7 +174,8 @@ public class UsesAugmentTest {
         childNodes = requests.getChildNodes();
         assertEquals(3, childNodes.size());
         // * |-- |-- container rp
-        ContainerSchemaNode rp = (ContainerSchemaNode) requests.getDataChildByName("rp");
+        final ContainerSchemaNode rp = (ContainerSchemaNode) requests.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "rp"));
         assertNotNull(rp);
         expectedQName = QName.create(UG_NS, UG_REV, "rp");
         path.offer(expectedQName);
@@ -183,7 +185,8 @@ public class UsesAugmentTest {
         childNodes = rp.getChildNodes();
         assertEquals(4, childNodes.size());
         // * |-- |-- |-- leaf processing-rule
-        LeafSchemaNode processingRule = (LeafSchemaNode) rp.getDataChildByName("processing-rule");
+        LeafSchemaNode processingRule = (LeafSchemaNode) rp.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "processing-rule"));
         assertNotNull(processingRule);
         expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
         assertEquals(expectedQName, processingRule.getQName());
@@ -193,7 +196,8 @@ public class UsesAugmentTest {
         assertEquals(BaseTypes.booleanType(), processingRule.getType());
         assertTrue(processingRule.isAddedByUses());
         // * |-- |-- |-- leaf ignore
-        LeafSchemaNode ignore = (LeafSchemaNode) rp.getDataChildByName("ignore");
+        LeafSchemaNode ignore = (LeafSchemaNode) rp.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "ignore"));
         assertNotNull(ignore);
         expectedQName = QName.create(UG_NS, UG_REV, "ignore");
         assertEquals(expectedQName, ignore.getQName());
@@ -204,7 +208,8 @@ public class UsesAugmentTest {
         assertEquals(BaseTypes.booleanType(), ignore.getType());
         assertTrue(ignore.isAddedByUses());
         // * |-- |-- |-- leaf priority
-        LeafSchemaNode priority = (LeafSchemaNode) rp.getDataChildByName("priority");
+        final LeafSchemaNode priority = (LeafSchemaNode) rp.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "priority"));
         assertNotNull(priority);
         expectedQName = QName.create(UG_NS, UG_REV, "priority");
         assertEquals(expectedQName, priority.getQName());
@@ -216,11 +221,12 @@ public class UsesAugmentTest {
         path.offer(expectedQName);
         expectedPath = SchemaPath.create(path, true);
         // TODO
-        //assertEquals(expectedPath, priority.getType().getPath());
+        // assertEquals(expectedPath, priority.getType().getPath());
         assertEquals(BaseTypes.uint8Type(), priority.getType().getBaseType());
         assertTrue(priority.isAddedByUses());
         // * |-- |-- |-- container box
-        ContainerSchemaNode box = (ContainerSchemaNode) rp.getDataChildByName("box");
+        ContainerSchemaNode box = (ContainerSchemaNode) rp.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "box"));
         assertNotNull(box);
         expectedQName = QName.create(UG_NS, UG_REV, "box");
         assertEquals(expectedQName, box.getQName());
@@ -231,7 +237,8 @@ public class UsesAugmentTest {
         assertEquals(expectedPath, box.getPath());
         assertTrue(box.isAddedByUses());
         // * |-- |-- |-- |-- container order
-        ContainerSchemaNode order = (ContainerSchemaNode) box.getDataChildByName("order");
+        final ContainerSchemaNode order = (ContainerSchemaNode) box.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "order"));
         assertNotNull(order);
         expectedQName = QName.create(UG_NS, UG_REV, "order");
         assertEquals(expectedQName, order.getQName());
@@ -242,7 +249,8 @@ public class UsesAugmentTest {
         assertTrue(order.isAugmenting());
         assertEquals(2, order.getChildNodes().size());
         // * |-- |-- |-- |-- |-- leaf delete
-        LeafSchemaNode delete = (LeafSchemaNode) order.getDataChildByName("delete");
+        final LeafSchemaNode delete = (LeafSchemaNode) order.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "delete"));
         assertNotNull(delete);
         expectedQName = QName.create(UG_NS, UG_REV, "delete");
         assertEquals(expectedQName, delete.getQName());
@@ -252,7 +260,8 @@ public class UsesAugmentTest {
         assertEquals(BaseTypes.uint32Type(), delete.getType());
         assertTrue(delete.isAddedByUses());
         // * |-- |-- |-- |-- |-- leaf setup
-        LeafSchemaNode setup = (LeafSchemaNode) order.getDataChildByName("setup");
+        final LeafSchemaNode setup = (LeafSchemaNode) order.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "setup"));
         assertNotNull(setup);
         expectedQName = QName.create(UG_NS, UG_REV, "setup");
         assertEquals(expectedQName, setup.getQName());
@@ -263,7 +272,8 @@ public class UsesAugmentTest {
         assertEquals(BaseTypes.uint32Type(), setup.getType());
         assertTrue(setup.isAddedByUses());
         // * |-- |-- path-key-expansion
-        ContainerSchemaNode pke = (ContainerSchemaNode) requests.getDataChildByName("path-key-expansion");
+        final ContainerSchemaNode pke = (ContainerSchemaNode) requests.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "path-key-expansion"));
         assertNotNull(pke);
         expectedQName = QName.create(UG_NS, UG_REV, "path-key-expansion");
         assertEquals(expectedQName, pke.getQName());
@@ -276,74 +286,78 @@ public class UsesAugmentTest {
         assertEquals(expectedPath, pke.getPath());
         assertFalse(pke.isAddedByUses());
         // * |-- |-- |-- path-key
-        ContainerSchemaNode pathKey = (ContainerSchemaNode) pke.getDataChildByName("path-key");
+        final ContainerSchemaNode pathKey = (ContainerSchemaNode) pke.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "path-key"));
         assertNotNull(pathKey);
         expectedQName = QName.create(UG_NS, UG_REV, "path-key");
         assertEquals(expectedQName, pathKey.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, pathKey.getPath());
         assertFalse(pathKey.isAddedByUses());
         assertEquals(3, pathKey.getChildNodes().size());
         // * |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) pathKey.getDataChildByName("processing-rule");
+        processingRule = (LeafSchemaNode) pathKey.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "processing-rule"));
         assertNotNull(processingRule);
         expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
         assertEquals(expectedQName, processingRule.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, processingRule.getPath());
         assertEquals(BaseTypes.booleanType(), processingRule.getType());
         assertTrue(processingRule.isAddedByUses());
         // * |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) pathKey.getDataChildByName("ignore");
+        ignore = (LeafSchemaNode) pathKey.getDataChildByName(QName.create(testModule.getQNameModule(), "ignore"));
         assertNotNull(ignore);
         expectedQName = QName.create(UG_NS, UG_REV, "ignore");
         assertEquals(expectedQName, ignore.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, ignore.getPath());
         assertEquals(BaseTypes.booleanType(), ignore.getType());
         assertTrue(ignore.isAddedByUses());
         // * |-- |-- |-- |-- list path-keys
-        ListSchemaNode pathKeys = (ListSchemaNode) pathKey.getDataChildByName("path-keys");
+        final ListSchemaNode pathKeys = (ListSchemaNode) pathKey.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "path-keys"));
         assertNotNull(pathKeys);
         expectedQName = QName.create(UG_NS, UG_REV, "path-keys");
         assertEquals(expectedQName, pathKeys.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, pathKeys.getPath());
         assertTrue(pathKeys.isAddedByUses());
         childNodes = pathKeys.getChildNodes();
         assertEquals(2, childNodes.size());
         // * |-- |-- |-- |-- |-- leaf version
-        version = (LeafSchemaNode) pathKeys.getDataChildByName("version");
+        version = (LeafSchemaNode) pathKeys.getDataChildByName(QName.create(testModule.getQNameModule(), "version"));
         assertNotNull(version);
         expectedQName = QName.create(UG_NS, UG_REV, "version");
         assertEquals(expectedQName, version.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, version.getPath());
         assertTrue(version.getType() instanceof UnsignedIntegerTypeDefinition);
         assertEquals(BaseTypes.uint8Type(), version.getType().getBaseType().getBaseType());
         assertTrue(version.isAddedByUses());
         assertTrue(version.isAugmenting());
         // * |-- |-- |-- |-- |-- leaf type
-        type = (LeafSchemaNode) pathKeys.getDataChildByName("type");
+        type = (LeafSchemaNode) pathKeys.getDataChildByName(QName.create(testModule.getQNameModule(), "type"));
         assertNotNull(type);
         expectedQName = QName.create(UG_NS, UG_REV, "type");
         assertEquals(expectedQName, type.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, type.getPath());
         assertTrue(type.getType() instanceof UnionTypeDefinition);
         assertTrue(type.isAddedByUses());
         assertTrue(type.isAugmenting());
         // * |-- |-- container segment-computation
-        ContainerSchemaNode sc = (ContainerSchemaNode) requests.getDataChildByName("segment-computation");
+        final ContainerSchemaNode sc = (ContainerSchemaNode) requests.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "segment-computation"));
         assertNotNull(sc);
         expectedQName = QName.create(UG_NS, UG_REV, "segment-computation");
         assertEquals(expectedQName, sc.getQName());
@@ -352,164 +366,176 @@ public class UsesAugmentTest {
         path.pollLast();
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, sc.getPath());
         assertFalse(sc.isAddedByUses());
         // * |-- |-- |-- container p2p
-        ContainerSchemaNode p2p = (ContainerSchemaNode) sc.getDataChildByName("p2p");
+        final ContainerSchemaNode p2p = (ContainerSchemaNode) sc.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "p2p"));
         assertNotNull(p2p);
         expectedQName = QName.create(UG_NS, UG_REV, "p2p");
         assertEquals(expectedQName, p2p.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, p2p.getPath());
         assertFalse(p2p.isAddedByUses());
         // * |-- |-- |-- |-- container endpoints
-        ContainerSchemaNode endpoints = (ContainerSchemaNode) p2p.getDataChildByName("endpoints");
+        final ContainerSchemaNode endpoints = (ContainerSchemaNode) p2p.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "endpoints"));
         assertNotNull(endpoints);
         expectedQName = QName.create(UG_NS, UG_REV, "endpoints");
         assertEquals(expectedQName, endpoints.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, endpoints.getPath());
         assertFalse(endpoints.isAddedByUses());
         // * |-- |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) endpoints.getDataChildByName("processing-rule");
+        processingRule = (LeafSchemaNode) endpoints.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "processing-rule"));
         assertNotNull(processingRule);
         expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
         assertEquals(expectedQName, processingRule.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, processingRule.getPath());
         assertEquals(BaseTypes.booleanType(), processingRule.getType());
         assertTrue(processingRule.isAddedByUses());
         // * |-- |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) endpoints.getDataChildByName("ignore");
+        ignore = (LeafSchemaNode) endpoints.getDataChildByName(QName.create(testModule.getQNameModule(), "ignore"));
         assertNotNull(ignore);
         expectedQName = QName.create(UG_NS, UG_REV, "ignore");
         assertEquals(expectedQName, ignore.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, ignore.getPath());
         assertEquals(BaseTypes.booleanType(), ignore.getType());
         assertTrue(ignore.isAddedByUses());
         // * |-- |-- |-- |-- |-- container box
-        box = (ContainerSchemaNode) endpoints.getDataChildByName("box");
+        box = (ContainerSchemaNode) endpoints.getDataChildByName(QName.create(testModule.getQNameModule(), "box"));
         assertNotNull(box);
         expectedQName = QName.create(UG_NS, UG_REV, "box");
         assertEquals(expectedQName, box.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, box.getPath());
         assertTrue(box.isAddedByUses());
         // * |-- |-- |-- |-- |-- choice address-family
-        ChoiceSchemaNode af = (ChoiceSchemaNode) endpoints.getDataChildByName("address-family");
+        final ChoiceSchemaNode af = (ChoiceSchemaNode) endpoints.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "address-family"));
         assertNotNull(af);
         expectedQName = QName.create(UG_NS, UG_REV, "address-family");
         assertEquals(expectedQName, af.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, af.getPath());
         assertTrue(af.isAddedByUses());
         // * |-- |-- |-- |-- container reported-route
-        ContainerSchemaNode reportedRoute = (ContainerSchemaNode) p2p.getDataChildByName("reported-route");
+        final ContainerSchemaNode reportedRoute = (ContainerSchemaNode) p2p.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "reported-route"));
         assertNotNull(reportedRoute);
         expectedQName = QName.create(UG_NS, UG_REV, "reported-route");
         assertEquals(expectedQName, reportedRoute.getQName());
         path.pollLast();
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, reportedRoute.getPath());
         assertFalse(reportedRoute.isAddedByUses());
         // * |-- |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) reportedRoute.getDataChildByName("processing-rule");
+        processingRule = (LeafSchemaNode) reportedRoute.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "processing-rule"));
         assertNotNull(processingRule);
         expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
         assertEquals(expectedQName, processingRule.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, processingRule.getPath());
         assertEquals(BaseTypes.booleanType(), processingRule.getType());
         assertTrue(processingRule.isAddedByUses());
         // * |-- |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) reportedRoute.getDataChildByName("ignore");
+        ignore = (LeafSchemaNode) reportedRoute.getDataChildByName(QName.create(testModule.getQNameModule(), "ignore"));
         assertNotNull(ignore);
         expectedQName = QName.create(UG_NS, UG_REV, "ignore");
         assertEquals(expectedQName, ignore.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, ignore.getPath());
         assertEquals(BaseTypes.booleanType(), ignore.getType());
         assertTrue(ignore.isAddedByUses());
         // * |-- |-- |-- |-- |-- list subobjects
-        ListSchemaNode subobjects = (ListSchemaNode) reportedRoute.getDataChildByName("subobjects");
+        final ListSchemaNode subobjects = (ListSchemaNode) reportedRoute.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "subobjects"));
         assertNotNull(subobjects);
         expectedQName = QName.create(UG_NS, UG_REV, "subobjects");
         assertEquals(expectedQName, subobjects.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, subobjects.getPath());
         assertTrue(subobjects.isAddedByUses());
         // * |-- |-- |-- |-- |-- container bandwidth
-        ContainerSchemaNode bandwidth = (ContainerSchemaNode) reportedRoute.getDataChildByName("bandwidth");
+        ContainerSchemaNode bandwidth = (ContainerSchemaNode) reportedRoute.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "bandwidth"));
         assertNotNull(bandwidth);
         expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
         assertEquals(expectedQName, bandwidth.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, bandwidth.getPath());
         assertFalse(bandwidth.isAddedByUses());
         // * |-- |-- |-- |-- container bandwidth
-        bandwidth = (ContainerSchemaNode) p2p.getDataChildByName("bandwidth");
+        bandwidth = (ContainerSchemaNode) p2p
+                .getDataChildByName(QName.create(testModule.getQNameModule(), "bandwidth"));
         assertNotNull(bandwidth);
         expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
         assertEquals(expectedQName, bandwidth.getQName());
         path.pollLast();
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, bandwidth.getPath());
         assertTrue(bandwidth.isAddedByUses());
         // * |-- |-- |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) bandwidth.getDataChildByName("processing-rule");
+        processingRule = (LeafSchemaNode) bandwidth.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "processing-rule"));
         assertNotNull(processingRule);
         expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
         assertEquals(expectedQName, processingRule.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, processingRule.getPath());
         assertEquals(BaseTypes.booleanType(), processingRule.getType());
         assertTrue(processingRule.isAddedByUses());
         // * |-- |-- |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) bandwidth.getDataChildByName("ignore");
+        ignore = (LeafSchemaNode) bandwidth.getDataChildByName(QName.create(testModule.getQNameModule(), "ignore"));
         assertNotNull(ignore);
         expectedQName = QName.create(UG_NS, UG_REV, "ignore");
         assertEquals(expectedQName, ignore.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, ignore.getPath());
         assertEquals(BaseTypes.booleanType(), ignore.getType());
         assertTrue(ignore.isAddedByUses());
         // * |-- |-- |-- |-- |-- container bandwidth
-        ContainerSchemaNode bandwidthInner = (ContainerSchemaNode) bandwidth.getDataChildByName("bandwidth");
+        final ContainerSchemaNode bandwidthInner = (ContainerSchemaNode) bandwidth.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "bandwidth"));
         assertNotNull(bandwidthInner);
         expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
         assertEquals(expectedQName, bandwidth.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, bandwidthInner.getPath());
         assertTrue(bandwidthInner.isAddedByUses());
         // * |-- list svec
-        ListSchemaNode svec = (ListSchemaNode) pcreq.getDataChildByName("svec");
+        final ListSchemaNode svec = (ListSchemaNode) pcreq.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "svec"));
         assertNotNull(svec);
         expectedQName = QName.create(UG_NS, UG_REV, "svec");
         assertEquals(expectedQName, svec.getQName());
@@ -519,104 +545,109 @@ public class UsesAugmentTest {
         path.pollLast();
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, svec.getPath());
         assertFalse(svec.isAddedByUses());
         // * |-- |-- leaf link-diverse
-        LeafSchemaNode linkDiverse = (LeafSchemaNode) svec.getDataChildByName("link-diverse");
+        final LeafSchemaNode linkDiverse = (LeafSchemaNode) svec.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "link-diverse"));
         assertNotNull(linkDiverse);
         expectedQName = QName.create(UG_NS, UG_REV, "link-diverse");
         assertEquals(expectedQName, linkDiverse.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, linkDiverse.getPath());
         assertEquals(BaseTypes.booleanType(), linkDiverse.getType().getBaseType());
         assertTrue(linkDiverse.isAddedByUses());
         // * |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) svec.getDataChildByName("processing-rule");
+        processingRule = (LeafSchemaNode) svec.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "processing-rule"));
         assertNotNull(processingRule);
         expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
         assertEquals(expectedQName, processingRule.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, processingRule.getPath());
         assertEquals(BaseTypes.booleanType(), processingRule.getType());
         assertTrue(processingRule.isAddedByUses());
         // * |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) svec.getDataChildByName("ignore");
+        ignore = (LeafSchemaNode) svec.getDataChildByName(QName.create(testModule.getQNameModule(), "ignore"));
         assertNotNull(ignore);
         expectedQName = QName.create(UG_NS, UG_REV, "ignore");
         assertEquals(expectedQName, ignore.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, ignore.getPath());
         assertEquals(BaseTypes.booleanType(), ignore.getType());
         assertTrue(ignore.isAddedByUses());
         // * |-- |-- list metric
-        ListSchemaNode metric = (ListSchemaNode) svec.getDataChildByName("metric");
+        final ListSchemaNode metric = (ListSchemaNode) svec.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "metric"));
         assertNotNull(metric);
         expectedQName = QName.create(UG_NS, UG_REV, "metric");
         assertEquals(expectedQName, metric.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, metric.getPath());
         assertFalse(metric.isAddedByUses());
         // * |-- |-- |-- leaf metric-type
-        LeafSchemaNode metricType = (LeafSchemaNode) metric.getDataChildByName("metric-type");
+        final LeafSchemaNode metricType = (LeafSchemaNode) metric.getDataChildByName(QName.create(
+                testModule.getQNameModule(), "metric-type"));
         assertNotNull(metricType);
         expectedQName = QName.create(UG_NS, UG_REV, "metric-type");
         assertEquals(expectedQName, metricType.getQName());
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, metricType.getPath());
         assertEquals(BaseTypes.uint8Type(), metricType.getType());
         assertTrue(metricType.isAddedByUses());
         // * |-- |-- |-- box
-        box = (ContainerSchemaNode) metric.getDataChildByName("box");
+        box = (ContainerSchemaNode) metric.getDataChildByName(QName.create(testModule.getQNameModule(), "box"));
         assertNotNull(box);
         expectedQName = QName.create(UG_NS, UG_REV, "box");
         assertEquals(expectedQName, box.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, box.getPath());
         assertTrue(box.isAddedByUses());
         // * |-- |-- |-- leaf processing-rule
-        processingRule = (LeafSchemaNode) metric.getDataChildByName("processing-rule");
+        processingRule = (LeafSchemaNode) metric.getDataChildByName(QName.create(testModule.getQNameModule(),
+                "processing-rule"));
         assertNotNull(processingRule);
         expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
         assertEquals(expectedQName, processingRule.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, processingRule.getPath());
         assertEquals(BaseTypes.booleanType(), processingRule.getType());
         assertTrue(processingRule.isAddedByUses());
         // * |-- |-- |-- leaf ignore
-        ignore = (LeafSchemaNode) metric.getDataChildByName("ignore");
+        ignore = (LeafSchemaNode) metric.getDataChildByName(QName.create(testModule.getQNameModule(), "ignore"));
         assertNotNull(ignore);
         expectedQName = QName.create(UG_NS, UG_REV, "ignore");
         assertEquals(expectedQName, ignore.getQName());
         path.pollLast();
         path.offer(expectedQName);
-        expectedPath= SchemaPath.create(path, true);
+        expectedPath = SchemaPath.create(path, true);
         assertEquals(expectedPath, ignore.getPath());
         assertEquals(BaseTypes.booleanType(), ignore.getType());
         assertTrue(ignore.isAddedByUses());
     }
 
     @Test
-    public void testTypedefs() throws URISyntaxException, SourceException, ReactorException {
+    public void testTypedefs() throws Exception {
         modules = TestUtils.loadModules(getClass().getResource("/grouping-test").toURI());
-        Module testModule = TestUtils.findModule(modules, "grouping-definitions");
-        Set<TypeDefinition<?>> types = testModule.getTypeDefinitions();
+        final Module testModule = TestUtils.findModule(modules, "grouping-definitions");
+        final Set<TypeDefinition<?>> types = testModule.getTypeDefinitions();
 
         TypeDefinition<?> intExt = null;
-        for(TypeDefinition<?> td : types) {
-            if("int-ext".equals(td.getQName().getLocalName())) {
+        for (final TypeDefinition<?> td : types) {
+            if ("int-ext".equals(td.getQName().getLocalName())) {
                 intExt = td;
             }
         }
@@ -625,21 +656,22 @@ public class UsesAugmentTest {
         SchemaPath expectedPath = SchemaPath.create(true, QName.create(GD_NS, GD_REV, "int-ext"));
         assertEquals(expectedPath, intExt.getPath());
 
-        UnionTypeDefinition union = (UnionTypeDefinition)intExt.getBaseType();
+        final UnionTypeDefinition union = (UnionTypeDefinition) intExt.getBaseType();
 
         TypeDefinition<?> uint8 = null;
         TypeDefinition<?> pv = null;
-        for(TypeDefinition<?> td : union.getTypes()) {
-            if("uint8".equals(td.getQName().getLocalName())) {
+        for (final TypeDefinition<?> td : union.getTypes()) {
+            if ("uint8".equals(td.getQName().getLocalName())) {
                 uint8 = td;
-            } else if("protocol-version".equals(td.getQName().getLocalName())) {
+            } else if ("protocol-version".equals(td.getQName().getLocalName())) {
                 pv = td;
             }
         }
         assertNotNull(uint8);
         assertNotNull(pv);
 
-        expectedPath = SchemaPath.create(true, QName.create(GD_NS, GD_REV, "int-ext"), QName.create(GD_NS, GD_REV, "union"));
+        expectedPath = SchemaPath.create(true, QName.create(GD_NS, GD_REV, "int-ext"),
+                QName.create(GD_NS, GD_REV, "union"));
         assertEquals(expectedPath, union.getPath());
     }