Committed by
Gerrit Code Review
Uses intra linking UT updation
Change-Id: I2f45f17ed1bab4cbfbbc33ed3abaaddbdaaf5574 (cherry picked from commit 8178bd32)
Showing
1 changed file
with
196 additions
and
162 deletions
... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
17 | package org.onosproject.yangutils.linker; | 17 | package org.onosproject.yangutils.linker; |
18 | 18 | ||
19 | import java.io.IOException; | 19 | import java.io.IOException; |
20 | +import java.util.List; | ||
20 | import java.util.ListIterator; | 21 | import java.util.ListIterator; |
21 | 22 | ||
22 | import org.junit.Rule; | 23 | import org.junit.Rule; |
... | @@ -92,13 +93,15 @@ public class IntraFileUsesLinkingTest { | ... | @@ -92,13 +93,15 @@ public class IntraFileUsesLinkingTest { |
92 | assertThat(uses.getResolvableStatus(), | 93 | assertThat(uses.getResolvableStatus(), |
93 | is(ResolvableStatus.RESOLVED)); | 94 | is(ResolvableStatus.RESOLVED)); |
94 | 95 | ||
95 | -// leafIterator = yangNode.getListOfLeaf().listIterator(); | 96 | + ListIterator<List<YangLeaf>> leafIterator1 = uses.getUsesResolvedLeavesList().listIterator(); |
96 | -// leafInfo = leafIterator.next(); | 97 | + List<YangLeaf> leafInfo1 = leafIterator1.next(); |
97 | -// | 98 | + ListIterator<YangLeaf> leafIterator2 = leafInfo1.listIterator(); |
98 | -// // Check whether the information in the leaf is correct under module. | 99 | + YangLeaf leafInfo2 = leafIterator2.next(); |
99 | -// assertThat(leafInfo.getName(), is("hello")); | 100 | + |
100 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); | 101 | + // Check whether the information in the leaf is correct under module. |
101 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); | 102 | + assertThat(leafInfo2.getName(), is("hello")); |
103 | + assertThat(leafInfo2.getDataType().getDataTypeName(), is("string")); | ||
104 | + assertThat(leafInfo2.getDataType().getDataType(), is(YangDataTypes.STRING)); | ||
102 | 105 | ||
103 | } | 106 | } |
104 | 107 | ||
... | @@ -161,28 +164,32 @@ public class IntraFileUsesLinkingTest { | ... | @@ -161,28 +164,32 @@ public class IntraFileUsesLinkingTest { |
161 | assertThat(uses.getResolvableStatus(), | 164 | assertThat(uses.getResolvableStatus(), |
162 | is(ResolvableStatus.RESOLVED)); | 165 | is(ResolvableStatus.RESOLVED)); |
163 | 166 | ||
164 | -// leafIterator = yangNode.getListOfLeaf().listIterator(); | 167 | + ListIterator<List<YangLeaf>> leafIterator1 = uses.getUsesResolvedLeavesList().listIterator(); |
165 | -// leafInfo = leafIterator.next(); | 168 | + List<YangLeaf> leafInfo1 = leafIterator1.next(); |
166 | -// | 169 | + ListIterator<YangLeaf> leafIterator2 = leafInfo1.listIterator(); |
167 | -// // Check whether the information in the leaf is correct under module. | 170 | + YangLeaf leafInfo2 = leafIterator2.next(); |
168 | -// assertThat(leafInfo.getName(), is("treat")); | 171 | + |
169 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); | 172 | + // Check whether the information in the leaf is correct under module. |
170 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); | 173 | + assertThat(leafInfo2.getName(), is("treat")); |
171 | - | 174 | + assertThat(leafInfo2.getDataType().getDataTypeName(), is("string")); |
172 | -// // Check whether container is the child of module. | 175 | + assertThat(leafInfo2.getDataType().getDataType(), is(YangDataTypes.STRING)); |
173 | -// assertThat((grouping.getNextSibling() instanceof YangContainer), is(true)); | 176 | + |
174 | -// container = (YangContainer) grouping.getNextSibling(); | 177 | + ListIterator<YangNode> usesChildren = uses.getUsesResolvedNodeList().listIterator(); |
175 | -// | 178 | + YangNode usesChild = usesChildren.next(); |
176 | -// // Check whether the container name is set correctly which is under module. | 179 | + // Check whether container is the child of module. |
177 | -// assertThat(container.getName(), is("test")); | 180 | + assertThat((usesChild instanceof YangContainer), is(true)); |
178 | -// | 181 | + container = (YangContainer) usesChild; |
179 | -// leafIterator = container.getListOfLeaf().listIterator(); | 182 | + |
180 | -// leafInfo = leafIterator.next(); | 183 | + // Check whether the container name is set correctly which is under module. |
181 | -// | 184 | + assertThat(container.getName(), is("test")); |
182 | -// // Check whether the information in the leaf is correct under container which is under module. | 185 | + |
183 | -// assertThat(leafInfo.getName(), is("leaf2")); | 186 | + leafIterator = container.getListOfLeaf().listIterator(); |
184 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); | 187 | + leafInfo = leafIterator.next(); |
185 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); | 188 | + |
189 | + // Check whether the information in the leaf is correct under container which is under module. | ||
190 | + assertThat(leafInfo.getName(), is("leaf2")); | ||
191 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); | ||
192 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); | ||
186 | } | 193 | } |
187 | 194 | ||
188 | /** | 195 | /** |
... | @@ -241,52 +248,56 @@ public class IntraFileUsesLinkingTest { | ... | @@ -241,52 +248,56 @@ public class IntraFileUsesLinkingTest { |
241 | assertThat(uses.getResolvableStatus(), | 248 | assertThat(uses.getResolvableStatus(), |
242 | is(ResolvableStatus.RESOLVED)); | 249 | is(ResolvableStatus.RESOLVED)); |
243 | 250 | ||
244 | -// // Check whether list is the sibling of uses which has been deep copied from grouping. | 251 | + ListIterator<YangNode> usesChildren = uses.getUsesResolvedNodeList().listIterator(); |
245 | -// assertThat((yangNode.getChild().getChild().getNextSibling().getChild().getNextSibling() instanceof YangList), | 252 | + YangNode usesChild = usesChildren.next(); |
246 | -// is(true)); | 253 | + |
247 | -// YangList yangList = (YangList) yangNode.getChild().getChild().getNextSibling().getChild().getNextSibling(); | 254 | + // Check whether list is the sibling of uses which has been deep copied from grouping. |
248 | -// | 255 | + assertThat((usesChild instanceof YangList), is(true)); |
249 | -// // Check whether the list name is set correctly. | 256 | + |
250 | -// assertThat(yangList.getName(), is("valid")); | 257 | + YangList yangList = (YangList) usesChild; |
251 | -// | 258 | + |
252 | -// leafIterator = yangList.getListOfLeaf().listIterator(); | 259 | + // Check whether the list name is set correctly. |
253 | -// leafInfo = leafIterator.next(); | 260 | + assertThat(yangList.getName(), is("valid")); |
254 | -// | 261 | + |
255 | -// // Check whether the information in the leaf is correct under list which is deep copied. | 262 | + leafIterator = yangList.getListOfLeaf().listIterator(); |
256 | -// assertThat(leafInfo.getName(), is("invalid-interval")); | 263 | + leafInfo = leafIterator.next(); |
257 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); | 264 | + |
258 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); | 265 | + // Check whether the information in the leaf is correct under list which is deep copied. |
259 | -// assertThat(leafInfo.getUnits(), is("\"seconds\"")); | 266 | + assertThat(leafInfo.getName(), is("invalid-interval")); |
260 | -// assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); | 267 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); |
261 | -// | 268 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); |
262 | -// // Check whether uses is output's child. | 269 | + assertThat(leafInfo.getUnits(), is("\"seconds\"")); |
263 | -// assertThat((yangNode.getChild().getChild().getNextSibling().getNextSibling().getChild() instanceof YangUses), | 270 | + assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); |
264 | -// is(true)); | 271 | + |
265 | -// YangUses usesInOuput = (YangUses) yangNode.getChild().getChild().getNextSibling().getNextSibling().getChild(); | 272 | + // Check whether uses is output's child. |
266 | -// | 273 | + assertThat((yangNode.getChild().getChild().getNextSibling().getNextSibling().getChild() instanceof YangUses), |
267 | -// // Check whether uses get resolved. | 274 | + is(true)); |
268 | -// assertThat(usesInOuput.getResolvableStatus(), | 275 | + YangUses usesInOuput = (YangUses) yangNode.getChild().getChild().getNextSibling().getNextSibling().getChild(); |
269 | -// is(ResolvableStatus.RESOLVED)); | 276 | + |
270 | -// | 277 | + // Check whether uses get resolved. |
271 | -// // Check whether list is the sibling of uses which has been deep copied from grouping. | 278 | + assertThat(usesInOuput.getResolvableStatus(), |
272 | -// assertThat((yangNode.getChild().getChild().getNextSibling().getChild().getNextSibling() instanceof YangList), | 279 | + is(ResolvableStatus.RESOLVED)); |
273 | -// is(true)); | 280 | + |
274 | -// | 281 | + ListIterator<YangNode> usesInOuputChildren = usesInOuput.getUsesResolvedNodeList().listIterator(); |
275 | -// YangList yangListInOutput = (YangList) yangNode.getChild().getChild().getNextSibling().getNextSibling() | 282 | + YangNode usesInOuputChild = usesInOuputChildren.next(); |
276 | -// .getChild().getNextSibling(); | 283 | + |
277 | -// | 284 | + // Check whether list is the sibling of uses which has been deep copied from grouping. |
278 | -// // Check whether the list name is set correctly. | 285 | + assertThat((usesInOuputChild instanceof YangList), is(true)); |
279 | -// assertThat(yangListInOutput.getName(), is("valid")); | 286 | + |
280 | -// | 287 | + YangList yangListInOutput = (YangList) usesInOuputChild; |
281 | -// leafIterator = yangListInOutput.getListOfLeaf().listIterator(); | 288 | + |
282 | -// leafInfo = leafIterator.next(); | 289 | + // Check whether the list name is set correctly. |
283 | -// | 290 | + assertThat(yangListInOutput.getName(), is("valid")); |
284 | -// // Check whether the information in the leaf is correct under list which is deep copied. | 291 | + |
285 | -// assertThat(leafInfo.getName(), is("invalid-interval")); | 292 | + leafIterator = yangListInOutput.getListOfLeaf().listIterator(); |
286 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); | 293 | + leafInfo = leafIterator.next(); |
287 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); | 294 | + |
288 | -// assertThat(leafInfo.getUnits(), is("\"seconds\"")); | 295 | + // Check whether the information in the leaf is correct under list which is deep copied. |
289 | -// assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); | 296 | + assertThat(leafInfo.getName(), is("invalid-interval")); |
297 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); | ||
298 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); | ||
299 | + assertThat(leafInfo.getUnits(), is("\"seconds\"")); | ||
300 | + assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); | ||
290 | } | 301 | } |
291 | 302 | ||
292 | /** | 303 | /** |
... | @@ -342,6 +353,24 @@ public class IntraFileUsesLinkingTest { | ... | @@ -342,6 +353,24 @@ public class IntraFileUsesLinkingTest { |
342 | assertThat(firstUses.getResolvableStatus(), | 353 | assertThat(firstUses.getResolvableStatus(), |
343 | is(ResolvableStatus.RESOLVED)); | 354 | is(ResolvableStatus.RESOLVED)); |
344 | 355 | ||
356 | + ListIterator<YangNode> firstUsesChildren = firstUses.getUsesResolvedNodeList().listIterator(); | ||
357 | + YangNode firstUsesChild = firstUsesChildren.next(); | ||
358 | + | ||
359 | + // Check whether list is the sibling of uses. | ||
360 | + assertThat((firstUsesChild instanceof YangList), is(true)); | ||
361 | + YangList yangList = (YangList) firstUsesChild; | ||
362 | + assertThat(yangList.getName(), is("valid")); | ||
363 | + | ||
364 | + leafIterator = yangList.getListOfLeaf().listIterator(); | ||
365 | + leafInfo = leafIterator.next(); | ||
366 | + | ||
367 | + // Check whether the information in the leaf is correct under list which has been deep copied from grouping. | ||
368 | + assertThat(leafInfo.getName(), is("invalid-interval")); | ||
369 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); | ||
370 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); | ||
371 | + assertThat(leafInfo.getUnits(), is("\"seconds\"")); | ||
372 | + assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); | ||
373 | + | ||
345 | // Check whether container is the sibling of uses. | 374 | // Check whether container is the sibling of uses. |
346 | assertThat((firstUses.getNextSibling() instanceof YangContainer), is(true)); | 375 | assertThat((firstUses.getNextSibling() instanceof YangContainer), is(true)); |
347 | YangContainer yangContainer = (YangContainer) firstUses.getNextSibling(); | 376 | YangContainer yangContainer = (YangContainer) firstUses.getNextSibling(); |
... | @@ -349,14 +378,6 @@ public class IntraFileUsesLinkingTest { | ... | @@ -349,14 +378,6 @@ public class IntraFileUsesLinkingTest { |
349 | // Check whether the container name is set correctly. | 378 | // Check whether the container name is set correctly. |
350 | assertThat(yangContainer.getName(), is("design")); | 379 | assertThat(yangContainer.getName(), is("design")); |
351 | 380 | ||
352 | -// leafIterator = yangContainer.getListOfLeaf().listIterator(); | ||
353 | -// leafInfo = leafIterator.next(); | ||
354 | -// | ||
355 | -// // Check whether the information in the leaf is correct under design-container. | ||
356 | -// assertThat(leafInfo.getName(), is("ink")); | ||
357 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("int32")); | ||
358 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.INT32)); | ||
359 | - | ||
360 | // Check whether uses is design-container's child. | 381 | // Check whether uses is design-container's child. |
361 | assertThat((yangContainer.getChild() instanceof YangUses), is(true)); | 382 | assertThat((yangContainer.getChild() instanceof YangUses), is(true)); |
362 | YangUses secondUses = (YangUses) yangContainer.getChild(); | 383 | YangUses secondUses = (YangUses) yangContainer.getChild(); |
... | @@ -365,6 +386,16 @@ public class IntraFileUsesLinkingTest { | ... | @@ -365,6 +386,16 @@ public class IntraFileUsesLinkingTest { |
365 | assertThat(secondUses.getResolvableStatus(), | 386 | assertThat(secondUses.getResolvableStatus(), |
366 | is(ResolvableStatus.RESOLVED)); | 387 | is(ResolvableStatus.RESOLVED)); |
367 | 388 | ||
389 | + ListIterator<List<YangLeaf>> leafIterator1 = secondUses.getUsesResolvedLeavesList().listIterator(); | ||
390 | + List<YangLeaf> leafInfo1 = leafIterator1.next(); | ||
391 | + ListIterator<YangLeaf> leafIterator2 = leafInfo1.listIterator(); | ||
392 | + YangLeaf leafInfo2 = leafIterator2.next(); | ||
393 | + | ||
394 | + // Check whether the information in the leaf is correct under design-container. | ||
395 | + assertThat(leafInfo2.getName(), is("ink")); | ||
396 | + assertThat(leafInfo2.getDataType().getDataTypeName(), is("int32")); | ||
397 | + assertThat(leafInfo2.getDataType().getDataType(), is(YangDataTypes.INT32)); | ||
398 | + | ||
368 | // Check whether container is the sibling of uses. | 399 | // Check whether container is the sibling of uses. |
369 | assertThat((secondUses.getNextSibling() instanceof YangContainer), is(true)); | 400 | assertThat((secondUses.getNextSibling() instanceof YangContainer), is(true)); |
370 | YangContainer yangContainer2 = (YangContainer) secondUses.getNextSibling(); | 401 | YangContainer yangContainer2 = (YangContainer) secondUses.getNextSibling(); |
... | @@ -386,85 +417,88 @@ public class IntraFileUsesLinkingTest { | ... | @@ -386,85 +417,88 @@ public class IntraFileUsesLinkingTest { |
386 | assertThat(thirdUses.getResolvableStatus(), | 417 | assertThat(thirdUses.getResolvableStatus(), |
387 | is(ResolvableStatus.RESOLVED)); | 418 | is(ResolvableStatus.RESOLVED)); |
388 | 419 | ||
389 | -// // Check whether container is the sibling of uses. | 420 | + ListIterator<YangNode> thirdUsesChildren = thirdUses.getUsesResolvedNodeList().listIterator(); |
390 | -// assertThat((thirdUses.getNextSibling() instanceof YangContainer), is(true)); | 421 | + YangNode thirdUsesChild = thirdUsesChildren.next(); |
391 | -// | 422 | + |
392 | -// YangContainer yangContainer3 = (YangContainer) thirdUses.getNextSibling(); | 423 | + // Check whether container is the child of uses. |
393 | -// assertThat(yangContainer3.getName(), is("value")); | 424 | + assertThat((thirdUsesChild instanceof YangContainer), is(true)); |
394 | -// | 425 | + |
395 | -// leafIterator = yangContainer3.getListOfLeaf().listIterator(); | 426 | + YangContainer yangContainer3 = (YangContainer) thirdUsesChild; |
396 | -// leafInfo = leafIterator.next(); | 427 | + assertThat(yangContainer3.getName(), is("value")); |
397 | -// | 428 | + |
398 | -// // Check whether the information in the leaf is correct under container | 429 | + leafIterator = yangContainer3.getListOfLeaf().listIterator(); |
399 | -// // which has been deep copied from grouping. | 430 | + leafInfo = leafIterator.next(); |
400 | -// assertThat(leafInfo.getName(), is("zip-code")); | 431 | + |
401 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); | 432 | + // Check whether the information in the leaf is correct under container |
402 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); | 433 | + // which has been deep copied from grouping. |
403 | -// | 434 | + assertThat(leafInfo.getName(), is("zip-code")); |
404 | -// // Check whether uses is the sibling of container-design. | 435 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
405 | -// assertThat((yangContainer.getNextSibling() instanceof YangUses), is(true)); | 436 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
406 | -// YangUses fourthUses = (YangUses) yangContainer.getNextSibling(); | 437 | + |
407 | -// | 438 | + |
408 | -// // Check whether uses get resolved. | 439 | + // Check whether uses is the sibling of container-design. |
409 | -// assertThat(fourthUses.getResolvableStatus(), | 440 | + assertThat((yangContainer.getNextSibling() instanceof YangUses), is(true)); |
410 | -// is(ResolvableStatus.RESOLVED)); | 441 | + YangUses fourthUses = (YangUses) yangContainer.getNextSibling(); |
411 | -// | 442 | + assertThat(fourthUses.getName(), is("fourth")); |
412 | -// // Check whether uses is the sibling of previous uses. | 443 | + // Check whether uses get resolved. |
413 | -// assertThat((fourthUses.getNextSibling() instanceof YangUses), is(true)); | 444 | + assertThat(fourthUses.getResolvableStatus(), |
414 | -// YangUses fifthUses = (YangUses) fourthUses.getNextSibling(); | 445 | + is(ResolvableStatus.RESOLVED)); |
415 | -// | 446 | + |
416 | -// // Check whether uses get resolved. | 447 | + ListIterator<List<YangLeaf>> fourthUsesChildren = fourthUses.getUsesResolvedLeavesList().listIterator(); |
417 | -// assertThat(fifthUses.getResolvableStatus(), | 448 | + List<YangLeaf> fourthUsesChild = fourthUsesChildren.next(); |
418 | -// is(ResolvableStatus.RESOLVED)); | 449 | + ListIterator<YangLeaf> fourthUsesChildren1 = fourthUsesChild.listIterator(); |
419 | -// | 450 | + YangLeaf fourthUsesChild1 = fourthUsesChildren1.next(); |
420 | -// // Check whether list is the sibling of uses. | 451 | + |
421 | -// assertThat((fifthUses.getNextSibling() instanceof YangList), is(true)); | 452 | + // Check whether the information in the leaf is correct under correct-container. |
422 | -// YangList yangList = (YangList) fifthUses.getNextSibling(); | 453 | + assertThat(fourthUsesChild1.getName(), is("correct")); |
423 | -// assertThat(yangList.getName(), is("valid")); | 454 | + assertThat(fourthUsesChild1.getDataType().getDataTypeName(), is("my-type")); |
424 | -// | 455 | + assertThat(fourthUsesChild1.getDataType().getDataType(), is(YangDataTypes.DERIVED)); |
425 | -// leafIterator = yangList.getListOfLeaf().listIterator(); | 456 | + |
426 | -// leafInfo = leafIterator.next(); | 457 | + // Check whether uses is the sibling of previous uses. |
427 | -// | 458 | + assertThat((fourthUses.getNextSibling() instanceof YangUses), is(true)); |
428 | -// // Check whether the information in the leaf is correct under list which has been deep copied from grouping. | 459 | + YangUses fifthUses = (YangUses) fourthUses.getNextSibling(); |
429 | -// assertThat(leafInfo.getName(), is("invalid-interval")); | 460 | + assertThat(fifthUses.getName(), is("fifth")); |
430 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); | 461 | + |
431 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); | 462 | + // Check whether uses get resolved. |
432 | -// assertThat(leafInfo.getUnits(), is("\"seconds\"")); | 463 | + assertThat(fifthUses.getResolvableStatus(), |
433 | -// assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); | 464 | + is(ResolvableStatus.RESOLVED)); |
434 | -// | 465 | + |
435 | -// // Check whether typedef is the sibling of list. | 466 | + ListIterator<List<YangLeaf>> fifthUsesChildren = fifthUses.getUsesResolvedLeavesList().listIterator(); |
436 | -// assertThat((yangList.getNextSibling() instanceof YangTypeDef), is(true)); | 467 | + List<YangLeaf> fifthUsesChild = fifthUsesChildren.next(); |
437 | -// YangTypeDef yangTypeDef = (YangTypeDef) yangList.getNextSibling(); | 468 | + ListIterator<YangLeaf> fifthUsesChildren1 = fifthUsesChild.listIterator(); |
438 | -// assertThat(yangTypeDef.getName(), is("my-type")); | 469 | + YangLeaf fifthUsesChild1 = fifthUsesChildren1.next(); |
439 | -// | 470 | + |
440 | -// leafIterator = grouping.getListOfLeaf().listIterator(); | 471 | + //Check whether the information in the leaf is correct under correct-container. |
441 | -// leafInfo = leafIterator.next(); | 472 | + assertThat(fifthUsesChild1.getName(), is("abc")); |
442 | -// | 473 | + assertThat(fifthUsesChild1.getDataType().getDataTypeName(), is("string")); |
443 | -// // Check whether the information in the leaf is correct under grouping. | 474 | + assertThat(fifthUsesChild1.getDataType().getDataType(), is(YangDataTypes.STRING)); |
444 | -// assertThat(leafInfo.getName(), is("zip-code")); | 475 | + |
445 | -// assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); | 476 | + //Check whether uses is endpoint-grouping's sibling. |
446 | -// assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); | 477 | + assertThat((grouping.getNextSibling() instanceof YangUses), is(true)); |
447 | -// | 478 | + YangUses endpointUses = (YangUses) grouping.getNextSibling(); |
448 | -// // Check whether uses is endpoint-grouping's sibling. | 479 | + |
449 | -// assertThat((grouping.getNextSibling() instanceof YangUses), is(true)); | 480 | + // Check whether uses get resolved. |
450 | -// YangUses endpointUses = (YangUses) grouping.getNextSibling(); | 481 | + assertThat(endpointUses.getResolvableStatus(), |
451 | -// | 482 | + is(ResolvableStatus.RESOLVED)); |
452 | -// // Check whether uses get resolved. | 483 | + assertThat(endpointUses.getName(), is("endpoint")); |
453 | -// assertThat(endpointUses.getResolvableStatus(), | 484 | + |
454 | -// is(ResolvableStatus.RESOLVED)); | 485 | + ListIterator<YangNode> endpointUsesUsesChildren = endpointUses.getUsesResolvedNodeList().listIterator(); |
455 | -// | 486 | + YangNode endpointUsesUsesChild = endpointUsesUsesChildren.next(); |
456 | -// assertThat((endpointUses.getNextSibling().getNextSibling().getNextSibling().getNextSibling().getNextSibling() | 487 | + |
457 | -// .getNextSibling() instanceof YangUses), is(true)); | 488 | + // Check whether list is the sibling of uses. |
458 | -// | 489 | + assertThat((endpointUsesUsesChild instanceof YangList), is(true)); |
459 | -// YangUses yangUsesInEndpoint = (YangUses) endpointUses.getNextSibling().getNextSibling().getNextSibling() | 490 | + YangList yangList1 = (YangList) firstUsesChild; |
460 | -// .getNextSibling().getNextSibling().getNextSibling(); | 491 | + assertThat(yangList1.getName(), is("valid")); |
461 | -// assertThat(yangUsesInEndpoint.getResolvableStatus(), | 492 | + |
462 | -// is(ResolvableStatus.RESOLVED)); | 493 | + leafIterator = yangList1.getListOfLeaf().listIterator(); |
463 | -// | 494 | + leafInfo = leafIterator.next(); |
464 | -// assertThat((yangUsesInEndpoint.getNextSibling() instanceof YangContainer), is(true)); | 495 | + |
465 | -// YangContainer yangContainerInEndPoint = (YangContainer) yangUsesInEndpoint.getNextSibling(); | 496 | + // Check whether the information in the leaf is correct under list which has been deep copied from grouping. |
466 | -// | 497 | + assertThat(leafInfo.getName(), is("invalid-interval")); |
467 | -// assertThat(yangContainerInEndPoint.getName(), is("design")); | 498 | + assertThat(leafInfo.getDataType().getDataTypeName(), is("uint16")); |
499 | + assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.UINT16)); | ||
500 | + assertThat(leafInfo.getUnits(), is("\"seconds\"")); | ||
501 | + assertThat(leafInfo.getReference(), is("\"RFC 6020\"")); | ||
468 | } | 502 | } |
469 | 503 | ||
470 | /** | 504 | /** | ... | ... |
-
Please register or login to post a comment