[ONOS-4799],[ONOS-4351] Augment inter file linker and Generated Code refactored.
Change-Id: Id1f3ac9c90a632373f51cc75d499c3110216be17
diff --git a/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java b/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
index 49c5d60..7176760 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
@@ -16,16 +16,16 @@
package org.onosproject.yangutils.ietfyang;
+import java.io.IOException;
+
import org.apache.maven.plugin.MojoExecutionException;
import org.junit.Test;
import org.onosproject.yangutils.linker.impl.YangLinkerManager;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import org.onosproject.yangutils.plugin.manager.YangUtilManager;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-
-import java.io.IOException;
+import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
@@ -54,6 +54,7 @@
String userDir = System.getProperty("user.dir");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/ietfyang/l3vpnservice/");
+ yangPluginConfig.setManagerCodeGenDir("target/ietfyang/l3vpnservice/");
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
diff --git a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListenerTest.java b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListenerTest.java
index 6c0930a..146f410 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListenerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/parser/impl/listeners/AugmentListenerTest.java
@@ -20,12 +20,12 @@
import java.util.ListIterator;
import org.junit.Test;
-import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangAtomicPath;
import org.onosproject.yangutils.datamodel.YangAugment;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
+import org.onosproject.yangutils.datamodel.YangLeaf;
+import org.onosproject.yangutils.datamodel.YangModule;
+import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeType;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
@@ -48,16 +48,16 @@
YangNode node = manager.getDataModel("src/test/resources/ValidAugmentStatement.yang");
- assertThat((node instanceof YangModule), is(true));
+ assertThat(node instanceof YangModule, is(true));
assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE));
YangModule yangNode = (YangModule) node;
assertThat(yangNode.getName(), is("Test"));
YangAugment yangAugment = (YangAugment) yangNode.getChild();
- ListIterator<YangNodeIdentifier> nodeIdentifierIterator = yangAugment.getTargetNode().listIterator();
- YangNodeIdentifier yangNodeIdentifier = nodeIdentifierIterator.next();
- assertThat(yangNodeIdentifier.getPrefix(), is("if"));
- assertThat(yangNodeIdentifier.getName(), is("interfaces"));
+ ListIterator<YangAtomicPath> absPathIterator = yangAugment.getTargetNode().listIterator();
+ YangAtomicPath absPathIdentifier = absPathIterator.next();
+ assertThat(absPathIdentifier.getNodeIdentifier().getPrefix(), is("if"));
+ assertThat(absPathIdentifier.getNodeIdentifier().getName(), is("interfaces"));
ListIterator<YangLeaf> leafIterator = yangAugment.getListOfLeaf().listIterator();
YangLeaf leafInfo = leafIterator.next();
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
new file mode 100644
index 0000000..821a435
--- /dev/null
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.plugin.manager;
+
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
+import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
+
+/**
+ * Unit test case for augment translator.
+ */
+public class AugmentTranslatorTest {
+
+ private final YangUtilManager utilManager = new YangUtilManager();
+
+ /**
+ * Checks augment translation should not result in any exception.
+ *
+ * @throws MojoExecutionException
+ */
+ @Test
+ public void processAugmentTranslator() throws IOException, ParserException, MojoExecutionException {
+
+ String searchDir = "src/test/resources/augmentTranslator";
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ utilManager.resolveDependenciesUsingLinker();
+
+ YangPluginConfig yangPluginConfig = new YangPluginConfig();
+ yangPluginConfig.setCodeGenDir("target/augmentTranslator/");
+ yangPluginConfig.setManagerCodeGenDir("target/augmentTranslator/");
+ utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
+
+ deleteDirectory("target/augmentTranslator/");
+ }
+
+}
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
index a9516eb..789bf94 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
@@ -44,6 +44,7 @@
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/ChoiceCaseTestGenFile/");
+ yangPluginConfig.setManagerCodeGenDir("target/ChoiceCaseTestGenFile/");
generateJavaCode(node, yangPluginConfig);
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
index c8784c8..3fbf50f 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
@@ -45,6 +45,7 @@
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/EnumTestGenFile/");
+ yangPluginConfig.setManagerCodeGenDir("target/EnumTestGenFile/");
generateJavaCode(node, yangPluginConfig);
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
index 1554c5f..b5fd40b 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
@@ -19,6 +19,7 @@
import java.io.IOException;
import java.util.Iterator;
import java.util.ListIterator;
+
import org.apache.maven.plugin.MojoExecutionException;
import org.junit.Rule;
import org.junit.Test;
@@ -171,7 +172,7 @@
}
// Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
+ assertThat(selfNode instanceof YangModule, is(true));
// Check whether the node type is set properly to module.
assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
@@ -184,7 +185,7 @@
YangLeaf leafInfo;
// Check whether grouping is the sibling of module's child.
- assertThat((refNode.getChild() instanceof YangGrouping), is(true));
+ assertThat(refNode.getChild() instanceof YangGrouping, is(true));
YangGrouping grouping = (YangGrouping) refNode.getChild();
leafIterator = grouping.getListOfLeaf().listIterator();
@@ -196,7 +197,7 @@
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
// Check whether uses is module's child.
- assertThat((yangNode.getChild() instanceof YangUses), is(true));
+ assertThat(yangNode.getChild() instanceof YangUses, is(true));
YangUses uses = (YangUses) yangNode.getChild();
// Check whether uses get resolved.
@@ -317,7 +318,7 @@
}
// Check whether the data model tree returned is of type module.
- assertThat((selfNode instanceof YangModule), is(true));
+ assertThat(selfNode instanceof YangModule, is(true));
// Check whether the node type is set properly to module.
assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE));
@@ -330,7 +331,7 @@
YangLeaf leafInfo;
// Check whether grouping is the sibling of module's child.
- assertThat((refNode.getChild() instanceof YangGrouping), is(true));
+ assertThat(refNode.getChild() instanceof YangGrouping, is(true));
YangGrouping grouping = (YangGrouping) refNode.getChild();
leafIterator = grouping.getListOfLeaf().listIterator();
@@ -342,7 +343,7 @@
assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING));
// Check whether uses is module's child.
- assertThat((yangNode.getChild() instanceof YangUses), is(true));
+ assertThat(yangNode.getChild() instanceof YangUses, is(true));
YangUses uses = (YangUses) yangNode.getChild();
// Check whether uses get resolved.
@@ -637,13 +638,13 @@
utilManager.parseYangFileInfoSet();
utilManager.resolveDependenciesUsingLinker();
- String userDir = System.getProperty("user.dir");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/interfilewithusesreferringtype/");
+ yangPluginConfig.setManagerCodeGenDir("target/interfilewithusesreferringtype/");
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
- deleteDirectory(userDir + "/target/interfilewithusesreferringtype/");
+ deleteDirectory("target/interfilewithusesreferringtype/");
}
@@ -659,17 +660,16 @@
utilManager.parseYangFileInfoSet();
utilManager.resolveDependenciesUsingLinker();
- String userDir = System.getProperty("user.dir");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/file1UsesFile2TypeDefFile3Type/");
+ yangPluginConfig.setManagerCodeGenDir("target/file1UsesFile2TypeDefFile3Type/");
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
- deleteDirectory(userDir + "/target/file1UsesFile2TypeDefFile3Type/");
+ deleteDirectory("target/file1UsesFile2TypeDefFile3Type/");
}
-
/**
* Checks hierarchical intra with inter file type linking.
*/
@@ -682,17 +682,16 @@
utilManager.parseYangFileInfoSet();
utilManager.resolveDependenciesUsingLinker();
- String userDir = System.getProperty("user.dir");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/interfileietf/");
+ yangPluginConfig.setManagerCodeGenDir("target/interfileietf/");
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
- deleteDirectory(userDir + "/target/interfileietf/");
+ deleteDirectory("target/interfileietf/");
}
-
/**
* Checks hierarchical intra with inter file type linking.
*/
@@ -705,17 +704,16 @@
utilManager.parseYangFileInfoSet();
utilManager.resolveDependenciesUsingLinker();
- String userDir = System.getProperty("user.dir");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/usesInContainer/");
+ yangPluginConfig.setManagerCodeGenDir("target/usesInContainer/");
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
- deleteDirectory(userDir + "/target/usesInContainer/");
+ deleteDirectory("target/usesInContainer/");
}
-
/**
* Checks hierarchical intra with inter file type linking.
*/
@@ -728,13 +726,13 @@
utilManager.parseYangFileInfoSet();
utilManager.resolveDependenciesUsingLinker();
- String userDir = System.getProperty("user.dir");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/groupingNodeSameAsModule/");
+ yangPluginConfig.setManagerCodeGenDir("target/groupingNodeSameAsModule/");
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
- deleteDirectory(userDir + "/target/groupingNodeSameAsModule/");
+ deleteDirectory("target/groupingNodeSameAsModule/");
}
@@ -846,7 +844,7 @@
thrown.expect(LinkerException.class);
thrown.expectMessage(
- "YANG file error: Unable to find base leaf/leaf-list for given leafref");
+ "YANG file error: Unable to find base leaf/leaf-list for given leafref networks");
String searchDir = "src/test/resources/interfileleafrefwithinvaliddestinationnode";
utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
utilManager.parseYangFileInfoSet();
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
index cb9eff9..fcd2966 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
@@ -44,7 +44,7 @@
import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED;
import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED;
-import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.deSerializeDataModel;
+import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.deSerializeDataModel;
import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.parseJarFile;
import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.serializeDataModel;
import static org.onosproject.yangutils.utils.UtilConstants.SLASH;
@@ -189,6 +189,7 @@
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir(TARGET);
+ yangPluginConfig.setManagerCodeGenDir(TARGET);
utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
@@ -205,7 +206,7 @@
File folder = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_FOLDER);
File file = new File(System.getProperty("user.dir") + SLASH + FLOW_CLASSIFIER_MANAGER);
assertThat(true, is(folder.exists()));
- assertThat(true, is(file.exists()));
+ assertThat(false, is(file.exists()));
}
/**
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
index 368d5f9..81a4e70 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/IntraFileLeafrefLinkingTest.java
@@ -16,11 +16,17 @@
package org.onosproject.yangutils.plugin.manager;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.datamodel.YangAtomicPath;
import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangInput;
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangLeafList;
@@ -34,16 +40,10 @@
import org.onosproject.yangutils.datamodel.YangPathPredicate;
import org.onosproject.yangutils.datamodel.YangRelativePath;
import org.onosproject.yangutils.datamodel.utils.ResolvableStatus;
-import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.linker.exceptions.LinkerException;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.nullValue;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
new file mode 100644
index 0000000..817fb4e
--- /dev/null
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yangutils.plugin.manager;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yangutils.parser.exceptions.ParserException;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
+import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
+
+/**
+ * Unit test case to test code generation for root nodes.
+ */
+public class ManagerCodeGeneratorTest {
+
+ private final YangUtilManager utilManager = new YangUtilManager();
+
+ /**
+ * Checks manager translation should not result in any exception.
+ *
+ * @throws MojoExecutionException
+ */
+ @Test
+ public void processManagerTranslator() throws IOException, ParserException, MojoExecutionException {
+
+ String searchDir = "src/test/resources/manager";
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ utilManager.resolveDependenciesUsingLinker();
+
+ YangPluginConfig yangPluginConfig = new YangPluginConfig();
+ yangPluginConfig.setCodeGenDir("target/manager/");
+ yangPluginConfig.setManagerCodeGenDir("target/manager/");
+
+ utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
+ String file1 = "target/manager/org/onosproject/yang/gen/v1/test5/test/rev20160704/Test5Manager.java";
+ String file2 = "target/manager/org/onosproject/yang/gen/v1/test5/test/rev20160704/Test6Manager.java";
+ String file3 = "target/manager/org/onosproject/yang/gen/v1/test5/test/rev20160704/Test7Manager.java";
+ File manager = new File(file1);
+ assertThat(false, is(manager.exists()));
+
+ File manager2 = new File(file2);
+ assertThat(false, is(manager2.exists()));
+
+ File manager3 = new File(file3);
+ assertThat(true, is(manager3.exists()));
+
+ deleteDirectory("target/manager/");
+ }
+
+ /**
+ * Checks manager translation in different package should not result in any exception.
+ *
+ * @throws MojoExecutionException
+ */
+ @Test
+ public void processManagerInDifferentPackageTranslator() throws IOException, ParserException,
+ MojoExecutionException {
+
+ String searchDir = "src/test/resources/manager";
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ utilManager.resolveDependenciesUsingLinker();
+
+ YangPluginConfig yangPluginConfig = new YangPluginConfig();
+ yangPluginConfig.setCodeGenDir("target/manager/");
+ yangPluginConfig.setManagerCodeGenDir("target/manager1/");
+
+ utilManager.translateToJava(utilManager.getYangFileInfoSet(), yangPluginConfig);
+ String file3 = "target/manager1/org/onosproject/yang/gen/v1/test5/test/rev20160704/Test7Manager.java";
+
+ File manager3 = new File(file3);
+ assertThat(true, is(manager3.exists()));
+
+ deleteDirectory("target/manager/");
+ deleteDirectory("target/manager1/");
+ }
+}
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
index ab98c76..27b42e1 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
@@ -38,13 +38,14 @@
* Checks union translation should not result in any exception.
*/
@Test
- public void processUnionTranslator()
+ public void processNotificationTranslator()
throws IOException, ParserException {
YangNode node = manager.getDataModel("src/test/resources/NotificationTest.yang");
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/NotificationTest/");
+ yangPluginConfig.setManagerCodeGenDir("target/NotificationTest1/");
generateJavaCode(node, yangPluginConfig);
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
index e34613d..078ea50 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
@@ -45,6 +45,7 @@
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/RpcTestGenFile/");
+ yangPluginConfig.setManagerCodeGenDir("target/RpcTestGenFile/");
generateJavaCode(node, yangPluginConfig);
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
index b892edd..46d4f67 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
@@ -45,6 +45,7 @@
YangPluginConfig yangPluginConfig = new YangPluginConfig();
yangPluginConfig.setCodeGenDir("target/UnionTestGenFile/");
+ yangPluginConfig.setManagerCodeGenDir("target/UnionTestGenFile/");
generateJavaCode(node, yangPluginConfig);
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangPluginUtilsTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangPluginUtilsTest.java
index a6e2e08..891a280 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangPluginUtilsTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangPluginUtilsTest.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.onosproject.yangutils.plugin.manager;
import java.io.File;
@@ -11,7 +27,7 @@
import static org.onosproject.yangutils.plugin.manager.YangPluginUtils.addToCompilationRoot;
/**
- * Created by root1 on 16/6/16.
+ * Unit test case for YANG plugin utils.
*/
public class YangPluginUtilsTest {
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
new file mode 100644
index 0000000..946bac1
--- /dev/null
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/YangXpathLinkerTest.java
@@ -0,0 +1,598 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.onosproject.yangutils.plugin.manager;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
+import org.onosproject.yangutils.datamodel.ResolvableType;
+import org.onosproject.yangutils.datamodel.YangAugment;
+import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.YangReferenceResolver;
+import org.onosproject.yangutils.datamodel.YangResolutionInfo;
+import org.onosproject.yangutils.linker.impl.YangLinkerManager;
+import org.onosproject.yangutils.linker.impl.YangXpathLinker;
+import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Unit test cases for x-path linker.
+ */
+public class YangXpathLinkerTest {
+
+ private YangUtilManager utilManager = new YangUtilManager();
+ private YangXpathLinker linker = new YangXpathLinker();
+ private YangLinkerManager linkerManager = new YangLinkerManager();
+ private static final String INTRA_FILE_PATH = "src/test/resources/xPathLinker/IntraFile/";
+ private static final String INTER_FILE_PATH = "src/test/resources/xPathLinker/InterFile/";
+
+ /**
+ * Unit test case for intra file linking for single level container.
+ *
+ * @throws IOException when fails to do IO operations
+ * @throws MojoExecutionException
+ */
+ @Test
+ public void processIntraFileLinkingSingleLevel() throws IOException, MojoExecutionException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingle/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ utilManager.resolveDependenciesUsingLinker();
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ YangReferenceResolver ref = (YangReferenceResolver) node;
+ List<YangResolutionInfo> infos = ref.getUnresolvedResolutionList(ResolvableType.YANG_AUGMENT);
+ YangResolutionInfo info = infos.get(0);
+
+ YangAugment augment = (YangAugment) info.getEntityToResolveInfo().getEntityToResolve();
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = augment.getAugmentedNode();
+
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for intra file linking for multiple level container.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processIntraFileLinkingMultipleLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMulti/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for intra file linking for single level augment.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processIntraFileLinkingInAugmentSingleLevel() throws IOException {
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleAugment/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for intra file linking for multiple level augment.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processIntraFileLinkingInAugmentMultiLevel() throws IOException {
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiAugment/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+ linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+
+ }
+
+ /**
+ * Unit test case for intra file linking for multiple level submodule.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processIntraFileLinkingInSubModuleSingleLevel() throws IOException {
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleSubModule/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for intra file linking for multiple level submodule.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processIntraFileLinkingInSubModuleMultiLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiSubModule/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for intra file linking for single level uses.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processIntraFileLinkingInUsesSingleLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleUses/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for intra file linking for multi level uses.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processIntraFileLinkingInUsesMultiLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiUses/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for inter file linking for single level container.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingSingleLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingle/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for inter file linking for multi level container.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingMultipleLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMulti/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for inter file linking for single level augment.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingInAugmentSingleLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleAugment/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for inter file linking for multi level augment.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingInAugmentMultiLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiAugment/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for multipler inter file linking for single level augment.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processMultiInterFileLinkingInAugmentSingleLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiFileAugment/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for multiple inter file linking for multi level augment.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processMultiInterFileLinkingInAugmentMultiLevel() throws IOException {
+
+ utilManager
+ .createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiFileAugmentMulti/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for inter file linking for single level submodule.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingInSubModuleSingleLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleSubModule/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for inter file linking for multi level submodule.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingInSubModuleMultiLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiSubModule/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+ linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+ /**
+ * Unit test case for inter file linking for multi level uses inside augment.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingInUsesInAugment() throws IOException {
+
+ /* FIXME: when uses cloning is done test it.
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterSingleUses/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+ linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1)
+ .getNodeIdentifier().getName();
+ targetNode = linker.processXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ */
+ }
+
+ /**
+ * Unit test case for inter file linking for multi level uses.
+ *
+ * @throws IOException when fails to do IO operations
+ */
+ @Test
+ public void processInterFileLinkingInUsesMultiLevel() throws IOException {
+
+ utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiUses/"));
+ utilManager.parseYangFileInfoSet();
+ utilManager.createYangNodeSet();
+ linkerManager.createYangNodeSet(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet());
+ linkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet());
+ linkerManager.processInterFileLinking(utilManager.getYangNodeSet());
+
+ YangNode targetNode = null;
+ String targetNodeName = null;
+
+ for (YangNode node : utilManager.getYangNodeSet()) {
+ List<YangAugment> augments = linker.getListOfYangAugment(node);
+
+ for (YangAugment augment : augments) {
+ targetNodeName = augment.getTargetNode().get(augment.getTargetNode().size() - 1).getNodeIdentifier()
+ .getName();
+ targetNode = linker.processAugmentXpathLinking(augment.getTargetNode(), node);
+ }
+ }
+
+ assertThat(true, is(targetNode.getName().equals(targetNodeName)));
+ }
+
+}
diff --git a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGeneratorTest.java b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGeneratorTest.java
deleted file mode 100644
index 39d5205..0000000
--- a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGeneratorTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.yangutils.translator.tojava.utils;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertThat;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
-import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.IMPL_CLASS_MASK;
-import static org.onosproject.yangutils.translator.tojava.utils.ClassDefinitionGenerator.generateClassDefinition;
-
-/**
- * Unit tests for class definition generator for generated files.
- */
-public final class ClassDefinitionGeneratorTest {
-
- private static final String CLASS_NAME = "TestClass";
- private static final String INTERFACE_CLASS_DEF = "public interface TestClass {\n";
- private static final String BULDER_INTERFACE_CLASS_DEF = "interface TestClassBuilder {\n\n";
- private static final String BUILDER_CLASS_DEF = "public class TestClassBuilder implements "
- + "TestClass.TestClassBuilder {\n";
- private static final String IMPL_CLASS_DEF = "public final class TestClassImpl implements TestClass {\n";
- private static final String TYPE_DEF_CLASS_DEF = "public final class TestClass {\n";
-
- /**
- * Unit test for private constructor.
- *
- * @throws SecurityException if any security violation is observed
- * @throws NoSuchMethodException if when the method is not found
- * @throws IllegalArgumentException if there is illegal argument found
- * @throws InstantiationException if instantiation is provoked for the private constructor
- * @throws IllegalAccessException if instance is provoked or a method is provoked
- * @throws InvocationTargetException when an exception occurs by the method or constructor
- */
- @Test
- public void callPrivateConstructors()
- throws SecurityException, NoSuchMethodException, IllegalArgumentException,
- InstantiationException, IllegalAccessException, InvocationTargetException {
-
- Class<?>[] classesToConstruct = {ClassDefinitionGenerator.class };
- for (Class<?> clazz : classesToConstruct) {
- Constructor<?> constructor = clazz.getDeclaredConstructor();
- constructor.setAccessible(true);
- assertThat(null, not(constructor.newInstance()));
- }
- }
-
- /**
- * Unit test for builder class definition.
- */
- @Test
- public void generateBuilderClassDefinitionTest() {
- String builderClassDefinition = generateClassDefinition(BUILDER_CLASS_MASK, CLASS_NAME);
- assertThat(true, is(builderClassDefinition.equals(BUILDER_CLASS_DEF)));
- }
-
- /**
- * Unit test for builder interface definition.
- */
- @Test
- public void generateBuilderInterfaceDefinitionTest() {
- String builderInterfaceDefinition = generateClassDefinition(BUILDER_INTERFACE_MASK, CLASS_NAME);
- assertThat(true, is(builderInterfaceDefinition.equals(BULDER_INTERFACE_CLASS_DEF)));
- }
-
- /**
- * Unit test for impl class definition.
- */
- @Test
- public void generateImplDefinitionTest() {
- String implDefinition = generateClassDefinition(IMPL_CLASS_MASK, CLASS_NAME);
- assertThat(true, is(implDefinition.equals(IMPL_CLASS_DEF)));
- }
-
- /**
- * Unit test for interface definition.
- */
- @Test
- public void generateinterfaceDefinitionTest() {
- // TODO: need to add this test case.
- }
-
- /**
- * Unit test for typedef generated type.
- */
- @Test
- public void generateTypeDefTest() {
- String typeDef = generateClassDefinition(GENERATE_TYPEDEF_CLASS, CLASS_NAME);
- assertThat(true, is(typeDef.equals(TYPE_DEF_CLASS_DEF)));
- }
-}
diff --git a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
index d441c03..5a8f822 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
@@ -30,7 +30,6 @@
import static org.junit.Assert.assertThat;
import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getBuild;
import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getBuildForInterface;
import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getCheckNotNull;
@@ -58,7 +57,6 @@
import static org.onosproject.yangutils.utils.UtilConstants.EQUALS_STRING;
import static org.onosproject.yangutils.utils.UtilConstants.FOUR_SPACE_INDENTATION;
import static org.onosproject.yangutils.utils.UtilConstants.GET_METHOD_PREFIX;
-import static org.onosproject.yangutils.utils.UtilConstants.IMPL;
import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
import static org.onosproject.yangutils.utils.UtilConstants.NEW;
import static org.onosproject.yangutils.utils.UtilConstants.NEW_LINE;
@@ -83,6 +81,7 @@
import static org.onosproject.yangutils.utils.UtilConstants.TWELVE_SPACE_INDENTATION;
import static org.onosproject.yangutils.utils.UtilConstants.VALUE;
import static org.onosproject.yangutils.utils.UtilConstants.VOID;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
/**
* Unit tests for generated methods from the file type.
@@ -107,7 +106,7 @@
throws SecurityException, NoSuchMethodException, IllegalArgumentException,
InstantiationException, IllegalAccessException, InvocationTargetException {
- Class<?>[] classesToConstruct = {MethodsGenerator.class };
+ Class<?>[] classesToConstruct = {MethodsGenerator.class};
for (Class<?> clazz : classesToConstruct) {
Constructor<?> constructor = clazz.getDeclaredConstructor();
constructor.setAccessible(true);
@@ -135,7 +134,7 @@
String method = getBuild(CLASS_NAME);
assertThat(true, is(method.equals(FOUR_SPACE_INDENTATION + PUBLIC + SPACE + CLASS_NAME + SPACE + BUILD
+ OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SPACE + OPEN_CURLY_BRACKET + NEW_LINE + EIGHT_SPACE_INDENTATION
- + RETURN + SPACE + NEW + SPACE + CLASS_NAME + IMPL + OPEN_PARENTHESIS + THIS + CLOSE_PARENTHESIS
+ + RETURN + SPACE + NEW + SPACE + "Default" + CLASS_NAME + OPEN_PARENTHESIS + THIS + CLOSE_PARENTHESIS
+ SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET)));
}
@@ -167,7 +166,7 @@
public void getConstructorTest() {
JavaAttributeInfo testAttr = getTestAttribute();
YangPluginConfig pluginConfig = new YangPluginConfig();
- String method = getConstructor(CLASS_NAME, testAttr, GENERATE_SERVICE_AND_MANAGER, pluginConfig);
+ String method = getConstructor(testAttr, GENERATE_SERVICE_AND_MANAGER, pluginConfig);
assertThat(true, is(method.contains(THIS + PERIOD + CLASS_NAME + SPACE + EQUAL + SPACE + "builder" + OBJECT
+ PERIOD + GET_METHOD_PREFIX + "Testname" + OPEN_PARENTHESIS + CLOSE_PARENTHESIS + SEMI_COLAN)));
}
@@ -179,7 +178,7 @@
public void getConstructorStartTest() {
YangPluginConfig pluginConfig = new YangPluginConfig();
String method = getConstructorStart(CLASS_NAME, pluginConfig);
- assertThat(true, is(method.contains(PUBLIC + SPACE + CLASS_NAME + IMPL + OPEN_PARENTHESIS + CLASS_NAME
+ assertThat(true, is(method.contains(PUBLIC + SPACE + "Default" + CLASS_NAME + OPEN_PARENTHESIS + CLASS_NAME
+ BUILDER + SPACE + BUILDER.toLowerCase() + OBJECT + CLOSE_PARENTHESIS + SPACE
+ OPEN_CURLY_BRACKET + NEW_LINE)));
}
diff --git a/plugin/src/test/resources/augmentTranslator/test.yang b/plugin/src/test/resources/augmentTranslator/test.yang
new file mode 100644
index 0000000..76ea6c9
--- /dev/null
+++ b/plugin/src/test/resources/augmentTranslator/test.yang
@@ -0,0 +1,68 @@
+module test {
+ namespace "test:test";
+ prefix test ;
+
+
+ import test1{
+ prefix test1;
+ }
+
+ import test2{
+ prefix test2;
+ }
+
+ include acme-types;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ container cont2 {
+ leaf leaf {
+ type int32;
+ }
+ }
+ }
+
+
+ augment /cont3 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont1/cont2 {
+ leaf leaf2 {
+ type int32;
+ }
+ }
+
+ augment /test1:cont1/test1:cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+
+ augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s {
+ leaf a {
+ type int32;
+ }
+ }
+
+ augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s/test2:aa {
+ leaf a {
+ type int32;
+ }
+ container aa {
+ }
+ }
+
+}
+
diff --git a/plugin/src/test/resources/augmentTranslator/test2.yang b/plugin/src/test/resources/augmentTranslator/test2.yang
new file mode 100644
index 0000000..3b5de76
--- /dev/null
+++ b/plugin/src/test/resources/augmentTranslator/test2.yang
@@ -0,0 +1,30 @@
+module test1 {
+ namespace "test1:test1";
+ prefix test1 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ container cont2 {
+ }
+ }
+
+ augment /cont1/cont2 {
+ leaf leaf4 {
+ type int32;
+ }
+ container cont1s {
+ container cont1s {
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/augmentTranslator/test3.yang b/plugin/src/test/resources/augmentTranslator/test3.yang
new file mode 100644
index 0000000..dca558c
--- /dev/null
+++ b/plugin/src/test/resources/augmentTranslator/test3.yang
@@ -0,0 +1,26 @@
+module test2 {
+ namespace "test2:test2";
+ prefix test2 ;
+
+ import test1{
+ prefix test1;
+ }
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+
+ augment /test1:cont1/test1:cont2/test1:cont1s/test1:cont1s {
+ leaf leaf5 {
+ type int32;
+ }
+ container aa {
+ }
+ }
+}
diff --git a/plugin/src/test/resources/augmentTranslator/test4.yang b/plugin/src/test/resources/augmentTranslator/test4.yang
new file mode 100644
index 0000000..daa0f88
--- /dev/null
+++ b/plugin/src/test/resources/augmentTranslator/test4.yang
@@ -0,0 +1,21 @@
+submodule acme-types {
+
+ belongs-to "test" {
+ prefix "test";
+ }
+ import test1{
+ prefix test1;
+ }
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont3 {
+ }
+}
diff --git a/plugin/src/test/resources/interfileietf/ietf-te-topology.yang b/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
index 5b65dff..106b2aa 100644
--- a/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
+++ b/plugin/src/test/resources/interfileietf/ietf-te-topology.yang
@@ -1723,8 +1723,9 @@
uses tet:te-link-state-derived;
}
+ /*
augment "/te-link-event/te-link-attributes/underlay" {
description "Add state attributes to te-link underlay.";
uses te-link-state-underlay-attributes;
- }
+ } */
}
diff --git a/plugin/src/test/resources/manager/module.yang b/plugin/src/test/resources/manager/module.yang
new file mode 100644
index 0000000..212b171
--- /dev/null
+++ b/plugin/src/test/resources/manager/module.yang
@@ -0,0 +1,12 @@
+module test5 {
+ namespace "test5:test";
+ prefix test ;
+
+ revision "2016-07-04" {
+ description "Initial revision.";
+ }
+ typedef abc {
+ type int32;
+ }
+
+}
diff --git a/plugin/src/test/resources/manager/submodule.yang b/plugin/src/test/resources/manager/submodule.yang
new file mode 100644
index 0000000..961147c
--- /dev/null
+++ b/plugin/src/test/resources/manager/submodule.yang
@@ -0,0 +1,15 @@
+submodule test6 {
+
+ belongs-to "test5" {
+ prefix "test";
+ }
+
+ revision "2016-07-04" {
+ description "Initial revision.";
+ }
+ grouping abc {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+}
diff --git a/plugin/src/test/resources/manager/test.yang b/plugin/src/test/resources/manager/test.yang
new file mode 100644
index 0000000..7b2861c
--- /dev/null
+++ b/plugin/src/test/resources/manager/test.yang
@@ -0,0 +1,13 @@
+module test7 {
+ namespace "test5:test";
+ prefix test ;
+
+ revision "2016-07-04" {
+ description "Initial revision.";
+ }
+
+ leaf abc {
+ type int32;
+ }
+
+}
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
new file mode 100644
index 0000000..772f792
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test.yang
@@ -0,0 +1,25 @@
+module test {
+ namespace "xpath:inter:single";
+ prefix test ;
+
+ import test1{
+ prefix test1;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test1:cont1/test1:cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
new file mode 100644
index 0000000..9c1cdb0
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMulti/test1.yang
@@ -0,0 +1,26 @@
+module test1 {
+ namespace "xpath:inter:single";
+ prefix test1 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
new file mode 100644
index 0000000..640a15a
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test.yang
@@ -0,0 +1,25 @@
+module test {
+ namespace "xpath:inter:single";
+ prefix test ;
+
+ import test1{
+ prefix test1;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test1:cont1/test1:cont2/test1:cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
new file mode 100644
index 0000000..c9fbeab
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiAugment/test1.yang
@@ -0,0 +1,34 @@
+module test1 {
+ namespace "xpath:inter:single";
+ prefix test1 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont1 {
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
new file mode 100644
index 0000000..53ed780
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test.yang
@@ -0,0 +1,29 @@
+module test {
+ namespace "xpath:inter:single";
+ prefix test ;
+
+ import test1{
+ prefix test1;
+ }
+
+ import test2{
+ prefix test2;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test2:cont1/test2:cont2/test1:cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
new file mode 100644
index 0000000..9ae5e24
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test1.yang
@@ -0,0 +1,51 @@
+module test1 {
+ namespace "xpath:inter:single";
+ prefix test1 ;
+
+ import test2{
+ prefix test2;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont1 {
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+ }
+
+ augment /test2:cont1/test2:cont2 {
+ leaf a {
+ type int32;
+ }
+
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugment/test2.yang
@@ -0,0 +1,26 @@
+module test2 {
+ namespace "xpath:inter:multi";
+ prefix test2 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
new file mode 100644
index 0000000..139e2c5
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test.yang
@@ -0,0 +1,29 @@
+module test {
+ namespace "xpath:inter:single";
+ prefix test ;
+
+ import test1{
+ prefix test1;
+ }
+
+ import test2{
+ prefix test2;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test2:cont1/test2:cont2/test2:cont3/test1:cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
new file mode 100644
index 0000000..ed3716f
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test1.yang
@@ -0,0 +1,51 @@
+module test1 {
+ namespace "xpath:inter:single";
+ prefix test1 ;
+
+ import test2{
+ prefix test2;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont1 {
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+ }
+
+ augment /test2:cont1/test2:cont2/test2:cont3 {
+ leaf a {
+ type int32;
+ }
+
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
new file mode 100644
index 0000000..f65bef0
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiFileAugmentMulti/test2.yang
@@ -0,0 +1,34 @@
+module test2 {
+ namespace "xpath:inter:multi";
+ prefix test2 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+
+ augment /cont1/cont2 {
+ container cont3 {
+ leaf a {
+ type string;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
new file mode 100644
index 0000000..40b2386
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test.yang
@@ -0,0 +1,33 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ import test2 {
+ prefix test2;
+ }
+
+ include test1;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test2:cont1/test2:cont2/cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+
+ augment /cont2/cont3/cont4 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
new file mode 100644
index 0000000..a19ba35
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test1.yang
@@ -0,0 +1,50 @@
+submodule test1 {
+
+ belongs-to test {
+ prefix test;
+ }
+
+ import test2 {
+ prefix test2;
+ }
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont3 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+
+ augment /cont2/cont3 {
+ container cont4 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+
+ augment /test2:cont1/test2:cont2 {
+ leaf a {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiSubModule/test2.yang
@@ -0,0 +1,26 @@
+module test2 {
+ namespace "xpath:inter:multi";
+ prefix test2 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
new file mode 100644
index 0000000..80ee110
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test.yang
@@ -0,0 +1,32 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ import test2 {
+ prefix test2;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont2 {
+ leaf a {
+ type int32;
+ }
+ uses test2:group1;
+ }
+
+ augment /cont2/group1/cont1/cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
new file mode 100644
index 0000000..298d443
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterMultiUses/test2.yang
@@ -0,0 +1,28 @@
+module test2 {
+ namespace "xpath:inter:multi";
+ prefix test2 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ grouping group1 {
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
new file mode 100644
index 0000000..102ec39
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test.yang
@@ -0,0 +1,25 @@
+module test {
+ namespace "xpath:inter:single";
+ prefix test ;
+
+ import test1{
+ prefix test1;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test1:cont1 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
new file mode 100644
index 0000000..243ddfe
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingle/test1.yang
@@ -0,0 +1,21 @@
+module test1 {
+ namespace "xpath:inter:single";
+ prefix test1 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
new file mode 100644
index 0000000..772f792
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test.yang
@@ -0,0 +1,25 @@
+module test {
+ namespace "xpath:inter:single";
+ prefix test ;
+
+ import test1{
+ prefix test1;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test1:cont1/test1:cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
new file mode 100644
index 0000000..b9c5e32
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleAugment/test1.yang
@@ -0,0 +1,29 @@
+module test1 {
+ namespace "xpath:inter:single";
+ prefix test1 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont1 {
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
new file mode 100644
index 0000000..a8340ab
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test.yang
@@ -0,0 +1,27 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ import test2 {
+ prefix test2;
+ }
+
+ include test1;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test2:cont1/test2:cont2/cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
new file mode 100644
index 0000000..ebc8750
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test1.yang
@@ -0,0 +1,31 @@
+submodule test1 {
+
+ belongs-to test {
+ prefix test;
+ }
+
+ import test2 {
+ prefix test2;
+ }
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test2:cont1/test2:cont2 {
+ leaf a {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleSubModule/test2.yang
@@ -0,0 +1,26 @@
+module test2 {
+ namespace "xpath:inter:multi";
+ prefix test2 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
new file mode 100644
index 0000000..4b15645
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test.yang
@@ -0,0 +1,34 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ import test2 {
+ prefix test2;
+ }
+
+ include test1;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ augment /test2:cont1/test2:cont2/cont2 {
+ leaf a {
+ type int32;
+ }
+ uses group1;
+ }
+
+ augment /test2:cont1/test2:cont2/cont2/group1/cont1/cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
new file mode 100644
index 0000000..fbc3bcb
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test1.yang
@@ -0,0 +1,42 @@
+submodule test1 {
+
+ belongs-to test {
+ prefix test;
+ }
+
+ import test2 {
+ prefix test2;
+ }
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+
+ grouping group1 {
+ container cont1 {
+ container cont2 {
+ leaf a {
+ type string;
+ }
+ }
+ }
+ }
+
+ augment /test2:cont1/test2:cont2 {
+ leaf a {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
new file mode 100644
index 0000000..f20ac7d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/InterFile/InterSingleUses/test2.yang
@@ -0,0 +1,26 @@
+module test2 {
+ namespace "xpath:inter:multi";
+ prefix test2 ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang
new file mode 100644
index 0000000..77d61b9
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMulti/test.yang
@@ -0,0 +1,37 @@
+module test {
+ namespace "xpath:intra:multi";
+ prefix test ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf2 {
+ type int32;
+ }
+ container cont3 {
+ leaf leaf3 {
+ type int32;
+ }
+ }
+ }
+ }
+
+ augment /cont1/cont2/cont3 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/test.yang
new file mode 100644
index 0000000..b53012c
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiAugment/test.yang
@@ -0,0 +1,54 @@
+module test {
+ namespace "xpath:intra:multi";
+ prefix test ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont2 {
+ leaf leaf2 {
+ type int32;
+ }
+ container cont3 {
+ leaf leaf3 {
+ type int32;
+ }
+ }
+ }
+ }
+
+ augment /cont1/cont2/cont3 {
+ leaf a {
+ type int32;
+ }
+ container cont4 {
+ leaf leaf2 {
+ type int32;
+ }
+ }
+ }
+
+ augment /cont1/cont2/cont3/cont4 {
+ leaf a {
+ type int32;
+ }
+
+ container cont5 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang
new file mode 100644
index 0000000..b5d1c8d
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test.yang
@@ -0,0 +1,28 @@
+module test {
+ namespace "xpath:intra:multi";
+ prefix test ;
+
+ include test1;
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont2/cont3 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang
new file mode 100644
index 0000000..faf672e
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiSubModule/test1.yang
@@ -0,0 +1,28 @@
+submodule test1 {
+
+ belongs-to "test" {
+ prefix "test";
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont3 {
+ leaf leaf3 {
+ type int32;
+ }
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
new file mode 100644
index 0000000..6cfb133
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraMultiUses/test.yang
@@ -0,0 +1,38 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ grouping group1 {
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ container cont3 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+ }
+
+ container cont2 {
+ uses group1;
+ }
+
+ augment /cont2/group1/cont1/cont3 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang
new file mode 100644
index 0000000..95d9c2b
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingle/test.yang
@@ -0,0 +1,27 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont1 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang
new file mode 100644
index 0000000..2925dcf
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleAugment/test.yang
@@ -0,0 +1,39 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont1 {
+ leaf a {
+ type int32;
+ }
+
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+
+ augment /cont1/cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang
new file mode 100644
index 0000000..77401da
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test.yang
@@ -0,0 +1,28 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ include test1;
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+
+ augment /cont2 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang
new file mode 100644
index 0000000..47d4c5c
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleSubModule/test1.yang
@@ -0,0 +1,23 @@
+submodule test1 {
+
+ belongs-to test {
+ prefix test;
+ }
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ container cont2 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+}
+
diff --git a/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
new file mode 100644
index 0000000..c60668a
--- /dev/null
+++ b/plugin/src/test/resources/xPathLinker/IntraFile/IntraSingleUses/test.yang
@@ -0,0 +1,33 @@
+module test {
+ namespace "xpath:intra:single";
+ prefix test ;
+
+ organization "";
+ contact "";
+
+ description
+ "Defines basic service types for L3VPN service.";
+
+ revision "2015-12-16" {
+ reference "";
+ }
+
+ grouping group1 {
+ container cont1 {
+ leaf leaf1 {
+ type int32;
+ }
+ }
+ }
+
+ container cont2 {
+ uses group1;
+ }
+
+ augment /cont2/group1/cont1 {
+ leaf a {
+ type int32;
+ }
+ }
+}
+