janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.yangutils.linker; |
| 18 | |
| 19 | import java.io.IOException; |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 20 | import java.util.List; |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 21 | import java.util.ListIterator; |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 22 | import org.junit.Rule; |
| 23 | import org.junit.Test; |
| 24 | import org.junit.rules.ExpectedException; |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 25 | import org.onosproject.yangutils.datamodel.YangContainer; |
| 26 | import org.onosproject.yangutils.datamodel.YangDataTypes; |
| 27 | import org.onosproject.yangutils.datamodel.YangGrouping; |
| 28 | import org.onosproject.yangutils.datamodel.YangLeaf; |
| 29 | import org.onosproject.yangutils.datamodel.YangList; |
| 30 | import org.onosproject.yangutils.datamodel.YangModule; |
| 31 | import org.onosproject.yangutils.datamodel.YangNode; |
| 32 | import org.onosproject.yangutils.datamodel.YangNodeType; |
| 33 | import org.onosproject.yangutils.datamodel.YangTypeDef; |
| 34 | import org.onosproject.yangutils.datamodel.YangUses; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 35 | import org.onosproject.yangutils.linker.exceptions.LinkerException; |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 36 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
| 37 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
| 38 | |
| 39 | import static org.hamcrest.MatcherAssert.assertThat; |
| 40 | import static org.hamcrest.core.Is.is; |
| 41 | |
| 42 | /** |
| 43 | * Test cases for testing uses intra file linking. |
| 44 | */ |
| 45 | public class IntraFileUsesLinkingTest { |
| 46 | |
| 47 | @Rule |
| 48 | public ExpectedException thrown = ExpectedException.none(); |
| 49 | |
| 50 | private final YangUtilsParserManager manager = new YangUtilsParserManager(); |
| 51 | |
| 52 | /** |
| 53 | * Checks self resolution when grouping and uses are siblings. |
| 54 | * Grouping followed by uses. |
| 55 | */ |
| 56 | @Test |
| 57 | public void processSelfResolutionWhenUsesAndGroupingAtRootLevel() |
| 58 | throws IOException, ParserException { |
| 59 | |
| 60 | YangNode node = manager.getDataModel("src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevel.yang"); |
| 61 | |
| 62 | // Check whether the data model tree returned is of type module. |
| 63 | assertThat((node instanceof YangModule), is(true)); |
| 64 | |
| 65 | // Check whether the node type is set properly to module. |
| 66 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 67 | |
| 68 | // Check whether the module name is set correctly. |
| 69 | YangModule yangNode = (YangModule) node; |
| 70 | assertThat(yangNode.getName(), is("Test")); |
| 71 | |
| 72 | ListIterator<YangLeaf> leafIterator; |
| 73 | YangLeaf leafInfo; |
| 74 | |
| 75 | // Check whether grouping is the sibling of module's child. |
| 76 | assertThat((yangNode.getChild().getNextSibling() instanceof YangGrouping), is(true)); |
| 77 | |
| 78 | YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling(); |
| 79 | leafIterator = grouping.getListOfLeaf().listIterator(); |
| 80 | leafInfo = leafIterator.next(); |
| 81 | |
| 82 | // Check whether the information in the leaf is correct under grouping. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 83 | assertThat(leafInfo.getName(), is("hello")); |
Gaurav Agrawal | cfa1c41 | 2016-05-03 00:41:48 +0530 | [diff] [blame] | 84 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 85 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 86 | |
| 87 | // Check whether uses is module's child. |
| 88 | assertThat((yangNode.getChild() instanceof YangUses), is(true)); |
| 89 | YangUses uses = (YangUses) yangNode.getChild(); |
| 90 | |
| 91 | // Check whether uses get resolved. |
| 92 | assertThat(uses.getResolvableStatus(), |
| 93 | is(ResolvableStatus.RESOLVED)); |
| 94 | |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 95 | ListIterator<List<YangLeaf>> leafIterator1 = uses.getUsesResolvedLeavesList().listIterator(); |
| 96 | List<YangLeaf> leafInfo1 = leafIterator1.next(); |
| 97 | ListIterator<YangLeaf> leafIterator2 = leafInfo1.listIterator(); |
| 98 | YangLeaf leafInfo2 = leafIterator2.next(); |
| 99 | |
| 100 | // Check whether the information in the leaf is correct under module. |
| 101 | assertThat(leafInfo2.getName(), is("hello")); |
| 102 | assertThat(leafInfo2.getDataType().getDataTypeName(), is("string")); |
| 103 | assertThat(leafInfo2.getDataType().getDataType(), is(YangDataTypes.STRING)); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 104 | |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Checks self resolution when grouping and uses are siblings. |
| 109 | * Grouping has a child node. |
| 110 | */ |
| 111 | @Test |
| 112 | public void processSelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild() |
| 113 | throws IOException, ParserException { |
| 114 | |
| 115 | YangNode node = manager.getDataModel( |
| 116 | "src/test/resources/SelfResolutionWhenUsesAndGroupingAtRootLevelGroupingWithChild.yang"); |
| 117 | |
| 118 | // Check whether the data model tree returned is of type module. |
| 119 | assertThat((node instanceof YangModule), is(true)); |
| 120 | |
| 121 | // Check whether the node type is set properly to module. |
| 122 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 123 | |
| 124 | // Check whether the module name is set correctly. |
| 125 | YangModule yangNode = (YangModule) node; |
| 126 | assertThat(yangNode.getName(), is("Test")); |
| 127 | |
| 128 | ListIterator<YangLeaf> leafIterator; |
| 129 | YangLeaf leafInfo; |
| 130 | |
| 131 | // Check whether grouping is the sibling of module's child. |
| 132 | assertThat((yangNode.getChild().getNextSibling() instanceof YangGrouping), is(true)); |
| 133 | |
| 134 | YangGrouping grouping = (YangGrouping) yangNode.getChild().getNextSibling(); |
| 135 | leafIterator = grouping.getListOfLeaf().listIterator(); |
| 136 | leafInfo = leafIterator.next(); |
| 137 | |
| 138 | // Check whether the information in the leaf is correct under grouping. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 139 | assertThat(leafInfo.getName(), is("treat")); |
Gaurav Agrawal | cfa1c41 | 2016-05-03 00:41:48 +0530 | [diff] [blame] | 140 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 141 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 142 | |
| 143 | // Check whether container is the child of grouping. |
| 144 | assertThat((grouping.getChild() instanceof YangContainer), is(true)); |
| 145 | YangContainer container = (YangContainer) grouping.getChild(); |
| 146 | |
| 147 | // Check whether the container name is set correctly which is under grouping. |
| 148 | assertThat(container.getName(), is("test")); |
| 149 | |
| 150 | leafIterator = container.getListOfLeaf().listIterator(); |
| 151 | leafInfo = leafIterator.next(); |
| 152 | |
| 153 | // Check whether the information in the leaf is correct under container which is under grouping. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 154 | assertThat(leafInfo.getName(), is("leaf2")); |
Gaurav Agrawal | cfa1c41 | 2016-05-03 00:41:48 +0530 | [diff] [blame] | 155 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 156 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 157 | |
| 158 | // Check whether uses is module's child. |
| 159 | assertThat((yangNode.getChild() instanceof YangUses), is(true)); |
| 160 | YangUses uses = (YangUses) yangNode.getChild(); |
| 161 | |
| 162 | // Check whether uses get resolved. |
| 163 | assertThat(uses.getResolvableStatus(), |
| 164 | is(ResolvableStatus.RESOLVED)); |
| 165 | |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 166 | ListIterator<List<YangLeaf>> leafIterator1 = uses.getUsesResolvedLeavesList().listIterator(); |
| 167 | List<YangLeaf> leafInfo1 = leafIterator1.next(); |
| 168 | ListIterator<YangLeaf> leafIterator2 = leafInfo1.listIterator(); |
| 169 | YangLeaf leafInfo2 = leafIterator2.next(); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 170 | |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 171 | // Check whether the information in the leaf is correct under module. |
| 172 | assertThat(leafInfo2.getName(), is("treat")); |
| 173 | assertThat(leafInfo2.getDataType().getDataTypeName(), is("string")); |
| 174 | assertThat(leafInfo2.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 175 | |
| 176 | ListIterator<YangNode> usesChildren = uses.getUsesResolvedNodeList().listIterator(); |
| 177 | YangNode usesChild = usesChildren.next(); |
| 178 | // Check whether container is the child of module. |
| 179 | assertThat((usesChild instanceof YangContainer), is(true)); |
| 180 | container = (YangContainer) usesChild; |
| 181 | |
| 182 | // Check whether the container name is set correctly which is under module. |
| 183 | assertThat(container.getName(), is("test")); |
| 184 | |
| 185 | leafIterator = container.getListOfLeaf().listIterator(); |
| 186 | leafInfo = leafIterator.next(); |
| 187 | |
| 188 | // Check whether the information in the leaf is correct under container which is under module. |
| 189 | assertThat(leafInfo.getName(), is("leaf2")); |
| 190 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
| 191 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | /** |
| 195 | * Checks self resolution when grouping in rpc and uses in output of the same rpc. |
| 196 | * Uses is followed by grouping. |
| 197 | */ |
| 198 | @Test |
| 199 | public void processSelfResolutionGroupingInRpcAndUsesInOutput() |
| 200 | throws IOException, ParserException { |
| 201 | |
| 202 | YangNode node = manager |
| 203 | .getDataModel("src/test/resources/SelfResolutionGroupingInRpcAndUsesInOutput.yang"); |
| 204 | |
| 205 | // Check whether the data model tree returned is of type module. |
| 206 | assertThat((node instanceof YangModule), is(true)); |
| 207 | |
| 208 | // Check whether the node type is set properly to module. |
| 209 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 210 | |
| 211 | // Check whether the module name is set correctly. |
| 212 | YangModule yangNode = (YangModule) node; |
| 213 | assertThat(yangNode.getName(), is("rock")); |
| 214 | |
| 215 | ListIterator<YangLeaf> leafIterator; |
| 216 | YangLeaf leafInfo; |
| 217 | |
| 218 | // Check whether grouping is the child of rpc. |
| 219 | assertThat((yangNode.getChild().getChild() instanceof YangGrouping), is(true)); |
| 220 | YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild(); |
| 221 | |
| 222 | // Check whether the grouping name is set correctly. |
| 223 | assertThat(grouping.getName(), is("hello")); |
| 224 | |
| 225 | // Check whether list is the child of grouping. |
| 226 | assertThat((grouping.getChild() instanceof YangList), is(true)); |
| 227 | YangList yangListNode = (YangList) grouping.getChild(); |
| 228 | |
| 229 | // Check whether the list name is set correctly. |
| 230 | assertThat(yangListNode.getName(), is("valid")); |
| 231 | |
| 232 | leafIterator = yangListNode.getListOfLeaf().listIterator(); |
| 233 | leafInfo = leafIterator.next(); |
| 234 | |
| 235 | // Check whether the information in the leaf is correct under list which is under grouping. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 236 | assertThat(leafInfo.getName(), is("invalid-interval")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 237 | assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); |
| 238 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); |
| 239 | assertThat(leafInfo.getUnits(), is("\"seconds\"")); |
| 240 | assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); |
| 241 | |
| 242 | // Check whether uses is input's child. |
| 243 | assertThat((yangNode.getChild().getChild().getNextSibling().getChild() instanceof YangUses), is(true)); |
| 244 | YangUses uses = (YangUses) yangNode.getChild().getChild().getNextSibling().getChild(); |
| 245 | |
| 246 | // Check whether uses get resolved. |
| 247 | assertThat(uses.getResolvableStatus(), |
| 248 | is(ResolvableStatus.RESOLVED)); |
| 249 | |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 250 | ListIterator<YangNode> usesChildren = uses.getUsesResolvedNodeList().listIterator(); |
| 251 | YangNode usesChild = usesChildren.next(); |
| 252 | |
| 253 | // Check whether list is the sibling of uses which has been deep copied from grouping. |
| 254 | assertThat((usesChild instanceof YangList), is(true)); |
| 255 | |
| 256 | YangList yangList = (YangList) usesChild; |
| 257 | |
| 258 | // Check whether the list name is set correctly. |
| 259 | assertThat(yangList.getName(), is("valid")); |
| 260 | |
| 261 | leafIterator = yangList.getListOfLeaf().listIterator(); |
| 262 | leafInfo = leafIterator.next(); |
| 263 | |
| 264 | // Check whether the information in the leaf is correct under list which is deep copied. |
| 265 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 266 | assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); |
| 267 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); |
| 268 | assertThat(leafInfo.getUnits(), is("\"seconds\"")); |
| 269 | assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); |
| 270 | |
| 271 | // Check whether uses is output's child. |
| 272 | assertThat((yangNode.getChild().getChild().getNextSibling().getNextSibling().getChild() instanceof YangUses), |
| 273 | is(true)); |
| 274 | YangUses usesInOuput = (YangUses) yangNode.getChild().getChild().getNextSibling().getNextSibling().getChild(); |
| 275 | |
| 276 | // Check whether uses get resolved. |
| 277 | assertThat(usesInOuput.getResolvableStatus(), |
| 278 | is(ResolvableStatus.RESOLVED)); |
| 279 | |
| 280 | ListIterator<YangNode> usesInOuputChildren = usesInOuput.getUsesResolvedNodeList().listIterator(); |
| 281 | YangNode usesInOuputChild = usesInOuputChildren.next(); |
| 282 | |
| 283 | // Check whether list is the sibling of uses which has been deep copied from grouping. |
| 284 | assertThat((usesInOuputChild instanceof YangList), is(true)); |
| 285 | |
| 286 | YangList yangListInOutput = (YangList) usesInOuputChild; |
| 287 | |
| 288 | // Check whether the list name is set correctly. |
| 289 | assertThat(yangListInOutput.getName(), is("valid")); |
| 290 | |
| 291 | leafIterator = yangListInOutput.getListOfLeaf().listIterator(); |
| 292 | leafInfo = leafIterator.next(); |
| 293 | |
| 294 | // Check whether the information in the leaf is correct under list which is deep copied. |
| 295 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 296 | assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); |
| 297 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); |
| 298 | assertThat(leafInfo.getUnits(), is("\"seconds\"")); |
| 299 | assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Checks the failure scenario when uses is referring to its own grouping directly. |
| 304 | */ |
| 305 | @Test |
| 306 | public void processSelfResolutionGroupingReferencingItselfFailureScenerio() |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 307 | throws IOException { |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 308 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 309 | thrown.expect(LinkerException.class); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 310 | thrown.expectMessage( |
| 311 | "YANG file error: Duplicate input identifier detected, same as leaf \"zip-code\""); |
| 312 | YangNode node = manager |
| 313 | .getDataModel("src/test/resources/SelfResolutionGroupingReferencingItselfFailureScenerio.yang"); |
| 314 | |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Checks the when multiple uses are present and are referred to the grouping at different levels. |
| 319 | */ |
| 320 | @Test |
| 321 | public void processSelfResolutionGroupingWithMultipleUses() |
| 322 | throws IOException, ParserException { |
| 323 | |
| 324 | YangNode node = manager |
| 325 | .getDataModel("src/test/resources/SelfResolutionGroupingWithMultipleUses.yang"); |
| 326 | |
| 327 | // Check whether the data model tree returned is of type module. |
| 328 | assertThat((node instanceof YangModule), is(true)); |
| 329 | |
| 330 | // Check whether the node type is set properly to module. |
| 331 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 332 | |
| 333 | // Check whether the module name is set correctly. |
| 334 | YangModule yangNode = (YangModule) node; |
| 335 | assertThat(yangNode.getName(), is("Test")); |
| 336 | |
| 337 | ListIterator<YangLeaf> leafIterator; |
| 338 | YangLeaf leafInfo; |
| 339 | |
| 340 | // Check whether grouping is the child of container. |
| 341 | assertThat((yangNode.getChild().getChild() instanceof YangGrouping), is(true)); |
| 342 | YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild(); |
| 343 | |
| 344 | // Check whether the grouping name is set correctly. |
| 345 | assertThat(grouping.getName(), is("endpoint")); |
| 346 | |
| 347 | // Check whether uses is endpoint-grouping's child. |
| 348 | assertThat((grouping.getChild() instanceof YangUses), is(true)); |
| 349 | YangUses firstUses = (YangUses) grouping.getChild(); |
| 350 | |
| 351 | // Check whether uses get resolved. |
| 352 | assertThat(firstUses.getResolvableStatus(), |
| 353 | is(ResolvableStatus.RESOLVED)); |
| 354 | |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 355 | ListIterator<YangNode> firstUsesChildren = firstUses.getUsesResolvedNodeList().listIterator(); |
| 356 | YangNode firstUsesChild = firstUsesChildren.next(); |
| 357 | |
| 358 | // Check whether list is the sibling of uses. |
| 359 | assertThat((firstUsesChild instanceof YangList), is(true)); |
| 360 | YangList yangList = (YangList) firstUsesChild; |
| 361 | assertThat(yangList.getName(), is("valid")); |
| 362 | |
| 363 | leafIterator = yangList.getListOfLeaf().listIterator(); |
| 364 | leafInfo = leafIterator.next(); |
| 365 | |
| 366 | // Check whether the information in the leaf is correct under list which has been deep copied from grouping. |
| 367 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 368 | assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); |
| 369 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); |
| 370 | assertThat(leafInfo.getUnits(), is("\"seconds\"")); |
| 371 | assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); |
| 372 | |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 373 | // Check whether container is the sibling of uses. |
| 374 | assertThat((firstUses.getNextSibling() instanceof YangContainer), is(true)); |
| 375 | YangContainer yangContainer = (YangContainer) firstUses.getNextSibling(); |
| 376 | |
| 377 | // Check whether the container name is set correctly. |
| 378 | assertThat(yangContainer.getName(), is("design")); |
| 379 | |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 380 | // Check whether uses is design-container's child. |
| 381 | assertThat((yangContainer.getChild() instanceof YangUses), is(true)); |
| 382 | YangUses secondUses = (YangUses) yangContainer.getChild(); |
| 383 | |
| 384 | // Check whether uses get resolved. |
| 385 | assertThat(secondUses.getResolvableStatus(), |
| 386 | is(ResolvableStatus.RESOLVED)); |
| 387 | |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 388 | ListIterator<List<YangLeaf>> leafIterator1 = secondUses.getUsesResolvedLeavesList().listIterator(); |
| 389 | List<YangLeaf> leafInfo1 = leafIterator1.next(); |
| 390 | ListIterator<YangLeaf> leafIterator2 = leafInfo1.listIterator(); |
| 391 | YangLeaf leafInfo2 = leafIterator2.next(); |
| 392 | |
| 393 | // Check whether the information in the leaf is correct under design-container. |
| 394 | assertThat(leafInfo2.getName(), is("ink")); |
| 395 | assertThat(leafInfo2.getDataType().getDataTypeName(), is("int32")); |
| 396 | assertThat(leafInfo2.getDataType().getDataType(), is(YangDataTypes.INT32)); |
| 397 | |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 398 | // Check whether container is the sibling of uses. |
| 399 | assertThat((secondUses.getNextSibling() instanceof YangContainer), is(true)); |
| 400 | YangContainer yangContainer2 = (YangContainer) secondUses.getNextSibling(); |
| 401 | assertThat(yangContainer2.getName(), is("correct")); |
| 402 | |
| 403 | leafIterator = yangContainer2.getListOfLeaf().listIterator(); |
| 404 | leafInfo = leafIterator.next(); |
| 405 | |
| 406 | // Check whether the information in the leaf is correct under correct-container. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 407 | assertThat(leafInfo.getName(), is("newone")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 408 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
| 409 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 410 | |
| 411 | // Check whether uses is correct container's child. |
| 412 | assertThat((yangContainer2.getChild() instanceof YangUses), is(true)); |
| 413 | YangUses thirdUses = (YangUses) yangContainer2.getChild(); |
| 414 | |
| 415 | // Check whether uses get resolved. |
| 416 | assertThat(thirdUses.getResolvableStatus(), |
| 417 | is(ResolvableStatus.RESOLVED)); |
| 418 | |
janani b | 8178bd3 | 2016-06-03 18:55:03 +0530 | [diff] [blame] | 419 | ListIterator<YangNode> thirdUsesChildren = thirdUses.getUsesResolvedNodeList().listIterator(); |
| 420 | YangNode thirdUsesChild = thirdUsesChildren.next(); |
| 421 | |
| 422 | // Check whether container is the child of uses. |
| 423 | assertThat((thirdUsesChild instanceof YangContainer), is(true)); |
| 424 | |
| 425 | YangContainer yangContainer3 = (YangContainer) thirdUsesChild; |
| 426 | assertThat(yangContainer3.getName(), is("value")); |
| 427 | |
| 428 | leafIterator = yangContainer3.getListOfLeaf().listIterator(); |
| 429 | leafInfo = leafIterator.next(); |
| 430 | |
| 431 | // Check whether the information in the leaf is correct under container |
| 432 | // which has been deep copied from grouping. |
| 433 | assertThat(leafInfo.getName(), is("zip-code")); |
| 434 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
| 435 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 436 | |
| 437 | |
| 438 | // Check whether uses is the sibling of container-design. |
| 439 | assertThat((yangContainer.getNextSibling() instanceof YangUses), is(true)); |
| 440 | YangUses fourthUses = (YangUses) yangContainer.getNextSibling(); |
| 441 | assertThat(fourthUses.getName(), is("fourth")); |
| 442 | // Check whether uses get resolved. |
| 443 | assertThat(fourthUses.getResolvableStatus(), |
| 444 | is(ResolvableStatus.RESOLVED)); |
| 445 | |
| 446 | ListIterator<List<YangLeaf>> fourthUsesChildren = fourthUses.getUsesResolvedLeavesList().listIterator(); |
| 447 | List<YangLeaf> fourthUsesChild = fourthUsesChildren.next(); |
| 448 | ListIterator<YangLeaf> fourthUsesChildren1 = fourthUsesChild.listIterator(); |
| 449 | YangLeaf fourthUsesChild1 = fourthUsesChildren1.next(); |
| 450 | |
| 451 | // Check whether the information in the leaf is correct under correct-container. |
| 452 | assertThat(fourthUsesChild1.getName(), is("correct")); |
| 453 | assertThat(fourthUsesChild1.getDataType().getDataTypeName(), is("my-type")); |
| 454 | assertThat(fourthUsesChild1.getDataType().getDataType(), is(YangDataTypes.DERIVED)); |
| 455 | |
| 456 | // Check whether uses is the sibling of previous uses. |
| 457 | assertThat((fourthUses.getNextSibling() instanceof YangUses), is(true)); |
| 458 | YangUses fifthUses = (YangUses) fourthUses.getNextSibling(); |
| 459 | assertThat(fifthUses.getName(), is("fifth")); |
| 460 | |
| 461 | // Check whether uses get resolved. |
| 462 | assertThat(fifthUses.getResolvableStatus(), |
| 463 | is(ResolvableStatus.RESOLVED)); |
| 464 | |
| 465 | ListIterator<List<YangLeaf>> fifthUsesChildren = fifthUses.getUsesResolvedLeavesList().listIterator(); |
| 466 | List<YangLeaf> fifthUsesChild = fifthUsesChildren.next(); |
| 467 | ListIterator<YangLeaf> fifthUsesChildren1 = fifthUsesChild.listIterator(); |
| 468 | YangLeaf fifthUsesChild1 = fifthUsesChildren1.next(); |
| 469 | |
| 470 | //Check whether the information in the leaf is correct under correct-container. |
| 471 | assertThat(fifthUsesChild1.getName(), is("abc")); |
| 472 | assertThat(fifthUsesChild1.getDataType().getDataTypeName(), is("string")); |
| 473 | assertThat(fifthUsesChild1.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 474 | |
| 475 | //Check whether uses is endpoint-grouping's sibling. |
| 476 | assertThat((grouping.getNextSibling() instanceof YangUses), is(true)); |
| 477 | YangUses endpointUses = (YangUses) grouping.getNextSibling(); |
| 478 | |
| 479 | // Check whether uses get resolved. |
| 480 | assertThat(endpointUses.getResolvableStatus(), |
| 481 | is(ResolvableStatus.RESOLVED)); |
| 482 | assertThat(endpointUses.getName(), is("endpoint")); |
| 483 | |
| 484 | ListIterator<YangNode> endpointUsesUsesChildren = endpointUses.getUsesResolvedNodeList().listIterator(); |
| 485 | YangNode endpointUsesUsesChild = endpointUsesUsesChildren.next(); |
| 486 | |
| 487 | // Check whether list is the sibling of uses. |
| 488 | assertThat((endpointUsesUsesChild instanceof YangList), is(true)); |
| 489 | YangList yangList1 = (YangList) firstUsesChild; |
| 490 | assertThat(yangList1.getName(), is("valid")); |
| 491 | |
| 492 | leafIterator = yangList1.getListOfLeaf().listIterator(); |
| 493 | leafInfo = leafIterator.next(); |
| 494 | |
| 495 | // Check whether the information in the leaf is correct under list which has been deep copied from grouping. |
| 496 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 497 | assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); |
| 498 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); |
| 499 | assertThat(leafInfo.getUnits(), is("\"seconds\"")); |
| 500 | assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 501 | } |
| 502 | |
| 503 | /** |
| 504 | * Checks the failure scenario when uses is present under the same node many times. |
| 505 | */ |
| 506 | @Test |
| 507 | public void processSelfResolutionGroupingHavingSameUsesManyTimes() |
| 508 | throws IOException, ParserException { |
| 509 | |
| 510 | thrown.expect(ParserException.class); |
| 511 | thrown.expectMessage( |
| 512 | "YANG file error: Duplicate input identifier detected, same as uses \"failure\""); |
| 513 | YangNode node = manager |
| 514 | .getDataModel("src/test/resources/SelfResolutionGroupingHavingSameUsesManyTimes.yang"); |
| 515 | } |
| 516 | |
| 517 | /** |
| 518 | * Checks the rpc having both typedef and grouping. |
| 519 | * It also checks that the grouping under different nodes will not give any problem in resolving uses. |
| 520 | */ |
| 521 | @Test |
| 522 | public void processSelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode() |
| 523 | throws IOException, ParserException { |
| 524 | |
| 525 | YangNode node = manager |
| 526 | .getDataModel( |
| 527 | "src/test/resources/SelfResolutionRpcWithOneTypedefAndTwoGroupingUnderDifferentNode.yang"); |
| 528 | |
| 529 | // Check whether the data model tree returned is of type module. |
| 530 | assertThat((node instanceof YangModule), is(true)); |
| 531 | |
| 532 | // Check whether the node type is set properly to module. |
| 533 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 534 | |
| 535 | // Check whether the module name is set correctly. |
| 536 | YangModule yangNode = (YangModule) node; |
| 537 | assertThat(yangNode.getName(), is("rock")); |
| 538 | |
| 539 | ListIterator<YangLeaf> leafIterator; |
| 540 | YangLeaf leafInfo; |
| 541 | |
| 542 | // Check whether grouping is the child of input. |
| 543 | assertThat((yangNode.getChild().getChild().getChild() instanceof YangGrouping), is(true)); |
| 544 | YangGrouping groupingUnderInput = (YangGrouping) yangNode.getChild().getChild().getChild(); |
| 545 | |
| 546 | // Check whether the grouping name is set correctly. |
| 547 | assertThat(groupingUnderInput.getName(), is("creative")); |
| 548 | |
| 549 | leafIterator = groupingUnderInput.getListOfLeaf().listIterator(); |
| 550 | leafInfo = leafIterator.next(); |
| 551 | |
| 552 | // Check whether the information in the leaf is correct under grouping. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 553 | assertThat(leafInfo.getName(), is("carry")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 554 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
| 555 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 556 | |
| 557 | // Check whether grouping is the child of output. |
| 558 | assertThat((yangNode.getChild().getChild().getNextSibling().getChild() instanceof YangGrouping), is(true)); |
| 559 | YangGrouping grouping = (YangGrouping) yangNode.getChild().getChild().getNextSibling().getChild(); |
| 560 | assertThat(grouping.getName(), is("creative")); |
| 561 | |
| 562 | // Check whether typedef is the sibling of grouping. |
| 563 | assertThat((grouping.getNextSibling() instanceof YangTypeDef), is(true)); |
| 564 | |
| 565 | YangTypeDef typedef = (YangTypeDef) grouping.getNextSibling(); |
| 566 | assertThat(typedef.getName(), is("my-type")); |
| 567 | |
| 568 | // Check whether uses is the sibling of typedef. |
| 569 | assertThat((typedef.getNextSibling() instanceof YangUses), is(true)); |
| 570 | |
| 571 | // Check whether uses get resolved. |
| 572 | YangUses uses = (YangUses) typedef.getNextSibling(); |
| 573 | assertThat(uses.getName(), is("creative")); |
| 574 | assertThat(uses.getResolvableStatus(), |
| 575 | is(ResolvableStatus.RESOLVED)); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 576 | } |
| 577 | |
| 578 | /** |
| 579 | * Checks the failure scenario when uses is cannot resolve its grouping. |
| 580 | */ |
| 581 | @Test |
| 582 | public void processSelfResolutionNestedGroupingWithUnresolvedUses() |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame^] | 583 | throws IOException, LinkerException { |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 584 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame^] | 585 | thrown.expect(LinkerException.class); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 586 | thrown.expectMessage( |
Vidyashree Rama | 210c01d | 2016-05-20 16:29:25 +0530 | [diff] [blame] | 587 | "YANG file error: Unable to find base grouping for given uses"); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 588 | |
| 589 | YangNode node = manager |
| 590 | .getDataModel("src/test/resources/SelfResolutionNestedGroupingWithUnresolvedUses.yang"); |
| 591 | } |
| 592 | |
| 593 | /** |
| 594 | * Checks self resolution when typedef hierarchical references are present |
| 595 | * with last type is unresolved. |
| 596 | */ |
| 597 | @Test |
| 598 | public void processSelfFileLinkingWithGroupingHierarchicalRefUnresolved() |
| 599 | throws IOException, ParserException { |
| 600 | |
| 601 | YangNode node = manager |
| 602 | .getDataModel("src/test/resources/SelfFileLinkingWithGroupingHierarchicalRefUnresolved.yang"); |
| 603 | |
| 604 | // Check whether the data model tree returned is of type module. |
| 605 | assertThat((node instanceof YangModule), is(true)); |
| 606 | |
| 607 | // Check whether the node type is set properly to module. |
| 608 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 609 | |
| 610 | // Check whether the module name is set correctly. |
| 611 | YangModule yangNode = (YangModule) node; |
| 612 | assertThat(yangNode.getName(), is("Test")); |
| 613 | |
| 614 | // Check whether container is the sibling of grouping. |
| 615 | assertThat((yangNode.getChild().getNextSibling() instanceof YangContainer), is(true)); |
| 616 | YangContainer containerWithUses = (YangContainer) yangNode.getChild().getNextSibling(); |
| 617 | assertThat(containerWithUses.getName(), is("test")); |
| 618 | |
| 619 | // Check whether uses is the child of container. |
| 620 | assertThat((containerWithUses.getChild() instanceof YangUses), is(true)); |
| 621 | YangUses uses = (YangUses) containerWithUses.getChild(); |
| 622 | assertThat(uses.getName(), is("create")); |
| 623 | |
| 624 | // Check whether uses is getting resolved. |
| 625 | assertThat(uses.getResolvableStatus(), |
| 626 | is(ResolvableStatus.RESOLVED)); |
| 627 | |
| 628 | // Check whether grouping is the child of module. |
| 629 | assertThat((yangNode.getChild() instanceof YangGrouping), is(true)); |
| 630 | YangGrouping groupingWithUses = (YangGrouping) yangNode.getChild(); |
| 631 | assertThat(groupingWithUses.getName(), is("create")); |
| 632 | |
| 633 | // Check whether uses with prefix from from other file, is the child of grouping. |
| 634 | assertThat((groupingWithUses.getChild() instanceof YangUses), is(true)); |
| 635 | YangUses uses1 = (YangUses) groupingWithUses.getChild(); |
| 636 | assertThat(uses1.getName(), is("valid")); |
| 637 | |
| 638 | // Check whether this uses is getting intra-file-resolved. |
| 639 | assertThat(uses1.getResolvableStatus(), |
| 640 | is(ResolvableStatus.INTRA_FILE_RESOLVED)); |
| 641 | } |
| 642 | |
| 643 | /** |
| 644 | * Checks self resolution when uses has prefix of self module. |
| 645 | */ |
| 646 | @Test |
| 647 | public void processSelfFileLinkingWithGroupingWithSelfModulePrefix() |
| 648 | throws IOException, ParserException { |
| 649 | |
| 650 | YangNode node = manager.getDataModel("src/test/resources/SelfFileLinkingWithGroupingWithSelfModulePrefix.yang"); |
| 651 | |
| 652 | // Check whether the data model tree returned is of type module. |
| 653 | assertThat((node instanceof YangModule), is(true)); |
| 654 | |
| 655 | // Check whether the node type is set properly to module. |
| 656 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 657 | |
| 658 | // Check whether the module name is set correctly. |
| 659 | YangModule yangNode = (YangModule) node; |
| 660 | assertThat(yangNode.getName(), is("Test")); |
| 661 | |
| 662 | // Check whether container is the sibling of grouping. |
| 663 | YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling(); |
| 664 | |
| 665 | // Check whether list is the child of container. |
| 666 | YangList yangList = (YangList) yangContainer.getChild(); |
| 667 | |
| 668 | // Check whether uses is the child of list. |
| 669 | assertThat((yangList.getChild() instanceof YangUses), is(true)); |
| 670 | YangUses yangUses1 = (YangUses) yangList.getChild(); |
| 671 | assertThat(yangUses1.getName(), is("FirstClass")); |
| 672 | |
| 673 | // Check whether uses is getting resolved. |
| 674 | assertThat(yangUses1.getResolvableStatus(), |
| 675 | is(ResolvableStatus.RESOLVED)); |
| 676 | |
| 677 | // Check whether grouping is the sibling of uses. |
| 678 | YangGrouping yangGrouping1 = (YangGrouping) yangUses1.getNextSibling(); |
| 679 | assertThat(yangGrouping1.getName(), is("FirstClass")); |
| 680 | |
| 681 | // Check whether uses is the child of grouping. |
| 682 | YangUses yangUses2 = (YangUses) yangGrouping1.getChild(); |
| 683 | assertThat(yangUses2.getName(), is("PassingClass")); |
| 684 | |
| 685 | // Check the uses gets resolved. |
| 686 | assertThat(yangUses2.getResolvableStatus(), |
| 687 | is(ResolvableStatus.RESOLVED)); |
| 688 | |
| 689 | // Check whether grouping is the sibling of list. |
| 690 | YangGrouping yangGrouping2 = (YangGrouping) yangList.getNextSibling(); |
| 691 | assertThat(yangGrouping2.getName(), is("PassingClass")); |
| 692 | |
| 693 | // Check uses is the child of that grouping which has prefix of the same module. |
| 694 | YangUses yangUses3 = (YangUses) yangGrouping2.getChild(); |
| 695 | assertThat(yangUses3.getName(), is("Percentage")); |
| 696 | |
| 697 | // Check uses is getting resolved. |
| 698 | assertThat(yangUses3.getResolvableStatus(), |
| 699 | is(ResolvableStatus.RESOLVED)); |
| 700 | |
| 701 | // Check grouping is the child of module. |
| 702 | YangGrouping yangGrouping3 = (YangGrouping) node.getChild(); |
| 703 | |
| 704 | ListIterator<YangLeaf> leafIterator; |
| 705 | YangLeaf leafInfo; |
| 706 | leafIterator = yangGrouping3.getListOfLeaf().listIterator(); |
| 707 | leafInfo = leafIterator.next(); |
| 708 | |
| 709 | // Check whether the information in the leaf is correct under grouping. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 710 | assertThat(leafInfo.getName(), is("hello")); |
Gaurav Agrawal | cfa1c41 | 2016-05-03 00:41:48 +0530 | [diff] [blame] | 711 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 712 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 713 | |
| 714 | } |
| 715 | |
| 716 | /** |
| 717 | * Checks self resolution when some type uses prefix of self module |
| 718 | * some uses external prefix. |
| 719 | */ |
| 720 | @Test |
| 721 | public void processSelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix() |
| 722 | throws IOException, ParserException { |
| 723 | |
| 724 | YangNode node = manager |
| 725 | .getDataModel("src/test/resources/SelfFileLinkingWithGroupingWithSelfAndExternalPrefixMix.yang"); |
| 726 | |
| 727 | // Check whether the data model tree returned is of type module. |
| 728 | assertThat((node instanceof YangModule), is(true)); |
| 729 | |
| 730 | // Check whether the node type is set properly to module. |
| 731 | assertThat(node.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 732 | |
| 733 | // Check whether the module name is set correctly. |
| 734 | YangModule yangNode = (YangModule) node; |
| 735 | assertThat(yangNode.getName(), is("Test")); |
| 736 | |
| 737 | // Check whether container is the sibling of grouping. |
| 738 | YangContainer yangContainer = (YangContainer) node.getChild().getNextSibling(); |
| 739 | |
| 740 | // Check whether list is the child of container. |
| 741 | YangList yangList = (YangList) yangContainer.getChild(); |
| 742 | |
| 743 | // Check whether uses is the child of list. |
| 744 | assertThat((yangList.getChild() instanceof YangUses), is(true)); |
| 745 | YangUses yangUses1 = (YangUses) yangList.getChild(); |
| 746 | assertThat(yangUses1.getName(), is("FirstClass")); |
| 747 | |
| 748 | // Check whether uses is getting resolved. |
| 749 | assertThat(yangUses1.getResolvableStatus(), |
| 750 | is(ResolvableStatus.RESOLVED)); |
| 751 | |
| 752 | // Check whether grouping is the sibling of uses. |
| 753 | YangGrouping yangGrouping1 = (YangGrouping) yangUses1.getNextSibling(); |
| 754 | assertThat(yangGrouping1.getName(), is("FirstClass")); |
| 755 | |
| 756 | // Check whether uses is the child of grouping which has prefix from other module. |
| 757 | YangUses yangUses2 = (YangUses) yangGrouping1.getChild(); |
| 758 | assertThat(yangUses2.getName(), is("PassingClass")); |
| 759 | |
| 760 | // Check whether uses gets intra-file-resolved. |
| 761 | assertThat(yangUses2.getResolvableStatus(), |
| 762 | is(ResolvableStatus.INTRA_FILE_RESOLVED)); |
| 763 | |
| 764 | // Check whether grouping is the sibling of list. |
| 765 | YangGrouping yangGrouping2 = (YangGrouping) yangList.getNextSibling(); |
| 766 | assertThat(yangGrouping2.getName(), is("PassingClass")); |
| 767 | |
| 768 | // Check uses is the child of that grouping which has prefix of the same module. |
| 769 | YangUses yangUses3 = (YangUses) yangGrouping2.getChild(); |
| 770 | assertThat(yangUses3.getName(), is("Percentage")); |
| 771 | |
| 772 | // Check uses is getting resolved. |
| 773 | assertThat(yangUses3.getResolvableStatus(), |
| 774 | is(ResolvableStatus.RESOLVED)); |
| 775 | |
| 776 | // Check grouping is the child of module. |
| 777 | YangGrouping yangGrouping3 = (YangGrouping) node.getChild(); |
| 778 | ListIterator<YangLeaf> leafIterator; |
| 779 | YangLeaf leafInfo; |
| 780 | leafIterator = yangGrouping3.getListOfLeaf().listIterator(); |
| 781 | leafInfo = leafIterator.next(); |
| 782 | |
| 783 | // Check whether the information in the leaf is correct under grouping. |
Vinod Kumar S | e4b9b0c | 2016-04-30 21:09:15 +0530 | [diff] [blame] | 784 | assertThat(leafInfo.getName(), is("hello")); |
Gaurav Agrawal | cfa1c41 | 2016-05-03 00:41:48 +0530 | [diff] [blame] | 785 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
janani b | 4e53f9b | 2016-04-26 18:49:20 +0530 | [diff] [blame] | 786 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 787 | } |
| 788 | |
| 789 | } |