Vidyashree Rama
Committed by Gerrit Code Review

[ONOS-4636]grouping and uses

Change-Id: Ic410d03a838003ad23b2b0e8874b91503da84153
/*
* 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.datamodel;
/**
* Represents data model tree traversal types.
*/
public enum TraversalType {
/**
* Start of traversal at the tree root.
*/
ROOT,
/**
* Child node traversal.
*/
CHILD,
/**
* Sibling node traversal.
*/
SIBILING,
/**
* Parent node traversal.
*/
PARENT
}
......@@ -17,6 +17,13 @@ package org.onosproject.yangutils.datamodel;
import java.io.Serializable;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.utils.Parsable;
import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.cloneLeaves;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
/**
* Represents base class of a node in data model tree.
......@@ -226,4 +233,189 @@ public abstract class YangNode
newChild.setPreviousSibling(curNode);
}
}
/**
* Clones the current node contents and create a new node.
*
* @return cloned node
* @throws CloneNotSupportedException clone is not supported by the referred
* node
*/
public YangNode clone()
throws CloneNotSupportedException {
YangNode clonedNode = (YangNode) super.clone();
if (clonedNode instanceof YangLeavesHolder) {
try {
cloneLeaves((YangLeavesHolder) clonedNode);
} catch (DataModelException e) {
throw new CloneNotSupportedException(e.getMessage());
}
}
clonedNode.setParent(null);
clonedNode.setChild(null);
clonedNode.setNextSibling(null);
clonedNode.setPreviousSibling(null);
return clonedNode;
}
/**
* Clones the subtree from the specified source node to the mentioned target
* node. The source and target root node cloning is carried out by the
* caller.
*
* @param srcRootNode source node for sub tree cloning
* @param dstRootNode destination node where the sub tree needs to be cloned
* @throws DataModelException data model error
*/
public static void cloneSubTree(YangNode srcRootNode, YangNode dstRootNode)
throws DataModelException {
YangNode nextNodeToClone = srcRootNode;
TraversalType curTraversal;
YangNode clonedTreeCurNode = dstRootNode;
YangNode newNode = null;
nextNodeToClone = nextNodeToClone.getChild();
if (nextNodeToClone == null) {
return;
} else {
/**
* Root level cloning is taken care in the caller.
*/
curTraversal = CHILD;
}
/**
* Caller ensures the cloning of the root nodes
*/
try {
while (nextNodeToClone != srcRootNode) {
if (nextNodeToClone == null) {
throw new DataModelException("Internal error: Cloning failed, source tree null pointer reached");
}
if (curTraversal != PARENT) {
newNode = nextNodeToClone.clone();
detectCollisionWhileCloning(clonedTreeCurNode, newNode, curTraversal);
}
if (curTraversal == CHILD) {
/**
* add the new node to the cloned tree.
*/
clonedTreeCurNode.addChild(newNode);
/**
* update the cloned tree's traversal current node as the
* new node.
*/
clonedTreeCurNode = newNode;
} else if (curTraversal == SIBILING) {
clonedTreeCurNode.addNextSibling(newNode);
clonedTreeCurNode = newNode;
} else if (curTraversal == PARENT) {
if (clonedTreeCurNode instanceof YangLeavesHolder) {
updateClonedLeavesUnionEnumRef((YangLeavesHolder) clonedTreeCurNode);
}
clonedTreeCurNode = clonedTreeCurNode.getParent();
}
if (curTraversal != PARENT && nextNodeToClone.getChild() != null) {
curTraversal = CHILD;
/**
* update the traversal's current node.
*/
nextNodeToClone = nextNodeToClone.getChild();
} else if (nextNodeToClone.getNextSibling() != null) {
curTraversal = SIBILING;
nextNodeToClone = nextNodeToClone.getNextSibling();
} else {
curTraversal = PARENT;
nextNodeToClone = nextNodeToClone.getParent();
}
}
} catch (CloneNotSupportedException e) {
throw new DataModelException("Failed to clone the tree");
}
}
/**
* Detects collision when the grouping is deep copied to the uses's parent.
*
* @param currentNode parent/previous sibling node for the new node
* @param newNode node which has to be added
* @param addAs traversal type of the node
* @throws DataModelException data model error
*/
private static void detectCollisionWhileCloning(YangNode currentNode, YangNode newNode, TraversalType addAs)
throws DataModelException {
if (!(currentNode instanceof CollisionDetector)
|| !(newNode instanceof Parsable)) {
throw new DataModelException("Node in data model tree does not support collision detection");
}
CollisionDetector collisionDetector = (CollisionDetector) currentNode;
Parsable parsable = (Parsable) newNode;
if (addAs == TraversalType.CHILD) {
collisionDetector.detectCollidingChild(newNode.getName(), parsable.getYangConstructType());
} else if (addAs == TraversalType.SIBILING) {
currentNode = currentNode.getParent();
if (!(currentNode instanceof CollisionDetector)) {
throw new DataModelException("Node in data model tree does not support collision detection");
}
collisionDetector = (CollisionDetector) currentNode;
collisionDetector.detectCollidingChild(newNode.getName(), parsable.getYangConstructType());
} else {
throw new DataModelException("Errored tree cloning");
}
}
/**
* Adds a new next sibling.
*
* @param newSibling new sibling to be added
* @throws DataModelException data model error
*/
private void addNextSibling(YangNode newSibling)
throws DataModelException {
if (newSibling.getNodeType() == null) {
throw new DataModelException("Cloned abstract node cannot be inserted into a tree");
}
if (newSibling.getParent() == null) {
/**
* Since the siblings needs to have a common parent, set the parent
* as the current node's parent
*/
newSibling.setParent(getParent());
} else {
throw new DataModelException("Node is already part of a tree, and cannot be added as a sibling");
}
if (newSibling.getPreviousSibling() == null) {
newSibling.setPreviousSibling(this);
setNextSibling(newSibling);
} else {
throw new DataModelException("New sibling to be added is not atomic, it already has a previous sibling");
}
if (newSibling.getChild() != null) {
throw new DataModelException("Sibling to be added is not atomic, it already has a child");
}
if (newSibling.getNextSibling() != null) {
throw new DataModelException("Sibling to be added is not atomic, it already has a next sibling");
}
}
}
......
......@@ -25,6 +25,7 @@ import org.onosproject.yangutils.datamodel.utils.YangConstructType;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.detectCollidingChildUtil;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.updateClonedLeavesUnionEnumRef;
/*-
* Reference RFC 6020.
......@@ -329,42 +330,45 @@ public class YangUses
}
YangLeavesHolder usesParentLeavesHolder = (YangLeavesHolder) usesParentNode;
if (referredGrouping.getListOfLeaf() != null
&& referredGrouping.getListOfLeaf().size() != 0) {
addLeavesOfGrouping(
cloneLeavesList(referredGrouping.getListOfLeaf(),
usesParentLeavesHolder));
}
if (referredGrouping.getListOfLeafList() != null
&& referredGrouping.getListOfLeafList().size() != 0) {
addListOfLeafListOfGrouping(
cloneListOfLeafList(referredGrouping.getListOfLeafList(),
usesParentLeavesHolder));
if (referredGrouping.getListOfLeaf() != null) {
for (YangLeaf leaf : referredGrouping.getListOfLeaf()) {
YangLeaf clonedLeaf = null;
try {
((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leaf.getName(),
YangConstructType.LEAF_DATA);
clonedLeaf = leaf.clone();
} catch (CloneNotSupportedException | DataModelException e) {
throw new DataModelException(e.getMessage());
}
clonedLeaf.setContainedIn(usesParentLeavesHolder);
usesParentLeavesHolder.addLeaf(clonedLeaf);
}
}
YangNode childInGrouping = referredGrouping.getChild();
while (childInGrouping != null) {
if (childInGrouping instanceof YangEnumeration
|| childInGrouping instanceof YangUnion
|| childInGrouping instanceof YangTypeDef) {
/*
* No need to copy the leaves, union / enum class, as these will
* be generated in the scope of grouping
*/
childInGrouping = childInGrouping.getNextSibling();
continue;
} else if (childInGrouping instanceof YangUses) {
addResolvedUsesInfoOfGrouping((YangUses) childInGrouping,
usesParentLeavesHolder);
} else {
addNodeOfGrouping(childInGrouping);
if (referredGrouping.getListOfLeafList() != null) {
for (YangLeafList leafList : referredGrouping.getListOfLeafList()) {
YangLeafList clonedLeafList = null;
try {
((CollisionDetector) usesParentLeavesHolder).detectCollidingChild(leafList.getName(),
YangConstructType.LEAF_LIST_DATA);
clonedLeafList = leafList.clone();
} catch (CloneNotSupportedException | DataModelException e) {
throw new DataModelException(e.getMessage());
}
clonedLeafList.setContainedIn(usesParentLeavesHolder);
usesParentLeavesHolder.addLeafList(clonedLeafList);
}
}
childInGrouping = childInGrouping.getNextSibling();
try {
YangNode.cloneSubTree(referredGrouping, usesParentNode);
} catch (DataModelException e) {
throw new DataModelException(e.getMessage());
}
updateClonedLeavesUnionEnumRef(usesParentLeavesHolder);
}
/**
......
......@@ -20,6 +20,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
......@@ -28,6 +29,7 @@ import org.onosproject.yangutils.datamodel.ResolvableType;
import org.onosproject.yangutils.datamodel.YangIfFeature;
import org.onosproject.yangutils.datamodel.YangAugment;
import org.onosproject.yangutils.datamodel.YangBase;
import org.onosproject.yangutils.datamodel.YangEnumeration;
import org.onosproject.yangutils.datamodel.YangIdentityRef;
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangLeafList;
......@@ -38,8 +40,10 @@ import org.onosproject.yangutils.datamodel.YangReferenceResolver;
import org.onosproject.yangutils.datamodel.YangResolutionInfo;
import org.onosproject.yangutils.datamodel.YangRpc;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.datamodel.YangUnion;
import org.onosproject.yangutils.datamodel.YangUses;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
/**
* Represents utilities for data model tree.
......@@ -307,4 +311,104 @@ public final class DataModelUtils {
}
return nodes;
}
/**
* Clones the list of leaves and list of leaf list in the leaves holder.
*
* @param leavesHolder YANG node potentially containing leaves or leaf lists
* @throws CloneNotSupportedException clone is not supported
* @throws DataModelException data model error
*/
public static void cloneLeaves(YangLeavesHolder leavesHolder)
throws CloneNotSupportedException, DataModelException {
List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf();
if (currentListOfLeaves != null) {
List<YangLeaf> clonedLeavesList = new LinkedList<YangLeaf>();
for (YangLeaf leaf : currentListOfLeaves) {
YangLeaf clonedLeaf = leaf.clone();
clonedLeaf.setContainedIn(leavesHolder);
clonedLeavesList.add(clonedLeaf);
}
leavesHolder.setListOfLeaf(clonedLeavesList);
}
List<YangLeafList> currentListOfLeafList = leavesHolder.getListOfLeafList();
if (currentListOfLeafList != null) {
List<YangLeafList> clonedListOfLeafList = new LinkedList<YangLeafList>();
for (YangLeafList leafList : currentListOfLeafList) {
YangLeafList clonedLeafList = leafList.clone();
clonedLeafList.setContainedIn(leavesHolder);
clonedListOfLeafList.add(clonedLeafList);
}
leavesHolder.setListOfLeafList(clonedListOfLeafList);
}
}
/**
* Clones the union or enum leaves. If there is any cloned leaves whose type is union/enum then the corresponding
* type info needs to be updated to the cloned new type node.
*
* @param leavesHolder cloned leaves holder, for whom the leaves reference needs to be updated
*/
public static void updateClonedLeavesUnionEnumRef(YangLeavesHolder leavesHolder) throws DataModelException {
List<YangLeaf> currentListOfLeaves = leavesHolder.getListOfLeaf();
if (currentListOfLeaves != null) {
for (YangLeaf leaf : currentListOfLeaves) {
if (leaf.getDataType().getDataType() == YangDataTypes.ENUMERATION
|| leaf.getDataType().getDataType() == YangDataTypes.UNION) {
try {
updateClonedTypeRef(leaf.getDataType(), leavesHolder);
} catch (DataModelException e) {
throw e;
}
}
}
}
List<YangLeafList> currentListOfLeafList = leavesHolder.getListOfLeafList();
if (currentListOfLeafList != null) {
for (YangLeafList leafList : currentListOfLeafList) {
if (leafList.getDataType().getDataType() == YangDataTypes.ENUMERATION
|| leafList.getDataType().getDataType() == YangDataTypes.UNION) {
try {
updateClonedTypeRef(leafList.getDataType(), leavesHolder);
} catch (DataModelException e) {
throw e;
}
}
}
}
}
/**
* Updates the types extended info pointer to point to the cloned type node.
*
* @param dataType data type, whose extended info needs to be pointed to the cloned type
* @param leavesHolder the leaves holder having the cloned type
*/
private static void updateClonedTypeRef(YangType dataType, YangLeavesHolder leavesHolder)
throws DataModelException {
if (!(leavesHolder instanceof YangNode)) {
throw new DataModelException("Data model error: cloned leaves holder is not a node");
}
YangNode potentialTypeNode = ((YangNode) leavesHolder).getChild();
while (potentialTypeNode != null) {
String dataTypeName = null;
if (dataType.getDataType() == YangDataTypes.ENUMERATION) {
YangEnumeration enumNode = (YangEnumeration) dataType.getDataTypeExtendedInfo();
dataTypeName = enumNode.getName();
} else if (dataType.getDataType() == YangDataTypes.UNION) {
YangUnion unionNode = (YangUnion) dataType.getDataTypeExtendedInfo();
dataTypeName = unionNode.getName();
}
if (potentialTypeNode.getName().contentEquals(dataTypeName)) {
dataType.setDataTypeExtendedInfo((Object) potentialTypeNode);
return;
}
potentialTypeNode = potentialTypeNode.getNextSibling();
}
throw new DataModelException("Data model error: cloned leaves type is not found");
}
}
......
/*
* 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.exception;
/**
* Represents custom translator exception for translator's operations.
*/
public class InvalidNodeForTranslatorException extends RuntimeException {
private static final long serialVersionUID = 20160311L;
private String fileName;
/**
* Create a new exception.
*/
public InvalidNodeForTranslatorException() {
super();
}
/**
* Creates a new exception with given message.
*
* @param message the detail of exception in string
*/
public InvalidNodeForTranslatorException(String message) {
super(message);
}
/**
* Creates a new exception from given message and cause.
*
* @param message the detail of exception in string
* @param cause underlying cause of the error
*/
public InvalidNodeForTranslatorException(final String message, final Throwable cause) {
super(message, cause);
}
/**
* Creates a new exception from cause.
*
* @param cause underlying cause of the error
*/
public InvalidNodeForTranslatorException(final Throwable cause) {
super(cause);
}
/**
* Returns generated file name for the exception.
*
* @return generated file name for the exception
*/
public String getFileName() {
return this.fileName;
}
/**
* Sets file name in translator exception.
*
* @param fileName generated file name
*/
public void setFileName(String fileName) {
this.fileName = fileName;
}
}
......@@ -17,17 +17,16 @@
package org.onosproject.yangutils.translator.tojava;
import java.io.IOException;
import org.onosproject.yangutils.datamodel.TraversalType;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangTypeDef;
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.TraversalType.CHILD;
import static org.onosproject.yangutils.translator.tojava.TraversalType.PARENT;
import static org.onosproject.yangutils.translator.tojava.TraversalType.ROOT;
import static org.onosproject.yangutils.translator.tojava.TraversalType.SIBILING;
import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
import static org.onosproject.yangutils.datamodel.TraversalType.ROOT;
import static org.onosproject.yangutils.datamodel.TraversalType.SIBILING;
/**
* Representation of java code generator based on application schema.
......@@ -82,23 +81,18 @@ public final class JavaCodeGeneratorUtil {
if (!(codeGenNode instanceof JavaCodeGenerator)) {
throw new TranslatorException("Unsupported node to generate code");
}
if (codeGenNode instanceof YangTypeDef) {
YangTypeDef typeDef = (YangTypeDef) codeGenNode;
if (typeDef.getTypeDefBaseType().getDataType() == YangDataTypes.LEAFREF
|| typeDef.getTypeDefBaseType().getDataType() == YangDataTypes.IDENTITYREF) {
if (codeGenNode.getNextSibling() != null) {
curTraversal = SIBILING;
codeGenNode = codeGenNode.getNextSibling();
} else {
curTraversal = PARENT;
codeGenNode = codeGenNode.getParent();
}
continue;
}
}
setCurNode(codeGenNode);
try {
generateCodeEntry(codeGenNode, yangPlugin);
} catch (InvalidNodeForTranslatorException e) {
if (codeGenNode.getNextSibling() != null) {
curTraversal = SIBILING;
codeGenNode = codeGenNode.getNextSibling();
} else {
curTraversal = PARENT;
codeGenNode = codeGenNode.getParent();
}
continue;
} catch (Exception e) {
throw new TranslatorException(e.getMessage());
}
......
......@@ -15,9 +15,8 @@
*/
package org.onosproject.yangutils.translator.tojava.javamodel;
import java.io.IOException;
import org.onosproject.yangutils.datamodel.YangGrouping;
import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
......@@ -25,8 +24,6 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.updatePackageInfo;
/**
* Represents grouping information extended to support java code generation.
*/
......@@ -102,11 +99,7 @@ public class YangJavaGrouping
@Override
public void generateCodeEntry(YangPluginConfig yangPlugin)
throws TranslatorException {
try {
updatePackageInfo(this, yangPlugin);
} catch (IOException e) {
throw new TranslatorException(e.getCause());
}
throw new InvalidNodeForTranslatorException();
}
@Override
......
......@@ -15,14 +15,8 @@
*/
package org.onosproject.yangutils.translator.tojava.javamodel;
import java.io.IOException;
import java.util.List;
import org.onosproject.yangutils.datamodel.YangGrouping;
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangUses;
import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
......@@ -30,10 +24,6 @@ import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.addCurNodeAsAttributeInTargetTempFile;
import static org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModelUtils.updatePackageInfo;
/**
* Represents uses information extended to support java code generation.
*/
......@@ -108,42 +98,7 @@ public class YangJavaUses
@Override
public void generateCodeEntry(YangPluginConfig yangPlugin)
throws TranslatorException {
try {
updatePackageInfo(this, yangPlugin);
if (!(getParentNodeInGenCode(this) instanceof JavaCodeGeneratorInfo)) {
throw new TranslatorException("invalid container of uses");
}
JavaCodeGeneratorInfo javaCodeGeneratorInfo = (JavaCodeGeneratorInfo) getParentNodeInGenCode(this);
if (javaCodeGeneratorInfo instanceof YangGrouping) {
/*
* Do nothing, since it will taken care in the groupings uses.
*/
return;
}
for (List<YangLeaf> leavesList : getUsesResolvedLeavesList()) {
// add the resolved leaves to the parent as an attribute
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
.getBeanTempFiles().addLeavesInfoToTempFiles(leavesList, yangPlugin);
}
for (List<YangLeafList> listOfLeafLists : getUsesResolvedListOfLeafList()) {
// add the resolved leaf-list to the parent as an attribute
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
.getBeanTempFiles().addLeafListInfoToTempFiles(listOfLeafLists, yangPlugin);
}
for (YangNode usesResolvedNode : getUsesResolvedNodeList()) {
// add the resolved nodes to the parent as an attribute
addCurNodeAsAttributeInTargetTempFile(usesResolvedNode, yangPlugin,
getParentNodeInGenCode(this));
}
} catch (IOException e) {
throw new TranslatorException(e.getCause());
}
throw new InvalidNodeForTranslatorException();
}
@Override
......
......@@ -26,6 +26,7 @@ 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.exceptions.LinkerException;
import org.onosproject.yangutils.linker.impl.YangLinkerManager;
import org.onosproject.yangutils.linker.impl.YangXpathLinker;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
......@@ -229,7 +230,7 @@ public class YangXpathLinkerTest {
*
* @throws IOException when fails to do IO operations
*/
@Test
@Test(expected = LinkerException.class)
public void processIntraFileLinkingInUsesSingleLevel() throws IOException {
utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraSingleUses/"));
......@@ -259,7 +260,7 @@ public class YangXpathLinkerTest {
*
* @throws IOException when fails to do IO operations
*/
@Test
@Test(expected = LinkerException.class)
public void processIntraFileLinkingInUsesMultiLevel() throws IOException {
utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTRA_FILE_PATH + "IntraMultiUses/"));
......@@ -568,7 +569,7 @@ public class YangXpathLinkerTest {
*
* @throws IOException when fails to do IO operations
*/
@Test
@Test(expected = LinkerException.class)
public void processInterFileLinkingInUsesMultiLevel() throws IOException {
utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(INTER_FILE_PATH + "InterMultiUses/"));
......