Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +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 | |
Gaurav Agrawal | c5f6327 | 2016-06-16 13:09:53 +0530 | [diff] [blame] | 17 | package org.onosproject.yangutils.plugin.manager; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 18 | |
Vidyashree Rama | 36f2fab | 2016-07-15 14:06:56 +0530 | [diff] [blame] | 19 | import java.io.IOException; |
| 20 | import java.util.Iterator; |
| 21 | import java.util.ListIterator; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 22 | import org.apache.maven.plugin.MojoExecutionException; |
janani b | e18b534 | 2016-07-13 21:06:41 +0530 | [diff] [blame] | 23 | import org.junit.Rule; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 24 | import org.junit.Test; |
janani b | e18b534 | 2016-07-13 21:06:41 +0530 | [diff] [blame] | 25 | import org.junit.rules.ExpectedException; |
Vidyashree Rama | 36f2fab | 2016-07-15 14:06:56 +0530 | [diff] [blame] | 26 | import org.onosproject.yangutils.datamodel.YangAugment; |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 27 | import org.onosproject.yangutils.datamodel.YangChoice; |
Vidyashree Rama | 36f2fab | 2016-07-15 14:06:56 +0530 | [diff] [blame] | 28 | import org.onosproject.yangutils.datamodel.YangContainer; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 29 | import org.onosproject.yangutils.datamodel.YangDerivedInfo; |
| 30 | import org.onosproject.yangutils.datamodel.YangGrouping; |
| 31 | import org.onosproject.yangutils.datamodel.YangLeaf; |
Vidyashree Rama | 36f2fab | 2016-07-15 14:06:56 +0530 | [diff] [blame] | 32 | import org.onosproject.yangutils.datamodel.YangList; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 33 | import org.onosproject.yangutils.datamodel.YangModule; |
| 34 | import org.onosproject.yangutils.datamodel.YangNode; |
| 35 | import org.onosproject.yangutils.datamodel.YangNodeType; |
| 36 | import org.onosproject.yangutils.datamodel.YangTypeDef; |
| 37 | import org.onosproject.yangutils.datamodel.YangUses; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 38 | import org.onosproject.yangutils.datamodel.utils.ResolvableStatus; |
janani b | 23ccc31 | 2016-07-14 19:35:22 +0530 | [diff] [blame] | 39 | import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 40 | import org.onosproject.yangutils.linker.impl.YangLinkerManager; |
| 41 | import org.onosproject.yangutils.parser.exceptions.ParserException; |
janani b | e18b534 | 2016-07-13 21:06:41 +0530 | [diff] [blame] | 42 | import org.onosproject.yangutils.parser.impl.YangUtilsParserManager; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 43 | import org.onosproject.yangutils.utils.io.impl.YangFileScanner; |
Shankara-Huawei | bdf24bb | 2016-08-02 18:13:13 +0530 | [diff] [blame] | 44 | import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 45 | |
| 46 | import static org.hamcrest.CoreMatchers.nullValue; |
| 47 | import static org.hamcrest.MatcherAssert.assertThat; |
| 48 | import static org.hamcrest.core.Is.is; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 49 | import static org.onosproject.yangutils.datamodel.YangNodeType.MODULE_NODE; |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 50 | import static org.onosproject.yangutils.datamodel.utils.ResolvableStatus.RESOLVED; |
janani b | 23ccc31 | 2016-07-14 19:35:22 +0530 | [diff] [blame] | 51 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DERIVED; |
| 52 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.STRING; |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 53 | import static org.onosproject.yangutils.linker.impl.YangLinkerUtils.updateFilePriority; |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 54 | import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Test cases for testing inter file linking. |
| 58 | */ |
| 59 | public class InterFileLinkingTest { |
| 60 | |
janani b | e18b534 | 2016-07-13 21:06:41 +0530 | [diff] [blame] | 61 | @Rule |
| 62 | public ExpectedException thrown = ExpectedException.none(); |
| 63 | |
| 64 | private final YangUtilsParserManager manager = new YangUtilsParserManager(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 65 | private final YangUtilManager utilManager = new YangUtilManager(); |
| 66 | private final YangLinkerManager yangLinkerManager = new YangLinkerManager(); |
| 67 | |
| 68 | /** |
| 69 | * Checks inter file type linking. |
| 70 | */ |
| 71 | @Test |
| 72 | public void processInterFileTypeLinking() |
| 73 | throws IOException, ParserException, MojoExecutionException { |
| 74 | |
| 75 | String searchDir = "src/test/resources/interfiletype"; |
| 76 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 77 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 78 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 79 | |
| 80 | YangNode refNode = null; |
| 81 | YangNode selfNode = null; |
| 82 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 83 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 84 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 85 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 86 | // Add references to import list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 87 | yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 88 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 89 | updateFilePriority(utilManager.getYangNodeSet()); |
| 90 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 91 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 92 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 93 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 94 | Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 95 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 96 | YangNode rootNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 97 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 98 | if (rootNode.getName().equals("module1")) { |
| 99 | selfNode = rootNode; |
| 100 | refNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 101 | } else { |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 102 | refNode = rootNode; |
| 103 | selfNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | // Check whether the data model tree returned is of type module. |
| 107 | assertThat(selfNode instanceof YangModule, is(true)); |
| 108 | |
| 109 | // Check whether the node type is set properly to module. |
| 110 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 111 | |
| 112 | // Check whether the module name is set correctly. |
| 113 | YangModule yangNode = (YangModule) selfNode; |
| 114 | assertThat(yangNode.getName(), is("module1")); |
| 115 | |
| 116 | ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
| 117 | YangLeaf leafInfo = leafIterator.next(); |
| 118 | |
| 119 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 120 | assertThat(leafInfo.getDataType().getDataTypeName(), is("hello")); |
| 121 | assertThat(leafInfo.getDataType().getDataType(), is(DERIVED)); |
| 122 | |
| 123 | assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(), |
| 124 | is((YangTypeDef) refNode.getChild())); |
| 125 | |
| 126 | assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED)); |
| 127 | |
| 128 | YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo(); |
| 129 | |
| 130 | // Check for the effective built-in type. |
| 131 | assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING)); |
| 132 | |
| 133 | // Check for the restriction. |
| 134 | assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue())); |
| 135 | assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue())); |
| 136 | assertThat(derivedInfo.getPatternRestriction(), is(nullValue())); |
| 137 | assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue())); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Checks inter file uses linking. |
| 142 | */ |
| 143 | @Test |
| 144 | public void processInterFileUsesLinking() |
| 145 | throws IOException, ParserException, MojoExecutionException { |
| 146 | |
| 147 | String searchDir = "src/test/resources/interfileuses"; |
| 148 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 149 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 150 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 151 | |
| 152 | YangNode refNode = null; |
| 153 | YangNode selfNode = null; |
| 154 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 155 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 156 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 157 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 158 | // Add references to import list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 159 | yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 160 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 161 | updateFilePriority(utilManager.getYangNodeSet()); |
| 162 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 163 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 164 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 165 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 166 | Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 167 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 168 | YangNode rootNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 169 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 170 | if (rootNode.getName().equals("module1")) { |
| 171 | selfNode = rootNode; |
| 172 | refNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 173 | } else { |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 174 | refNode = rootNode; |
| 175 | selfNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | // Check whether the data model tree returned is of type module. |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 179 | assertThat(selfNode instanceof YangModule, is(true)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 180 | |
| 181 | // Check whether the node type is set properly to module. |
| 182 | assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 183 | |
| 184 | // Check whether the module name is set correctly. |
| 185 | YangModule yangNode = (YangModule) selfNode; |
| 186 | assertThat(yangNode.getName(), is("module1")); |
| 187 | |
| 188 | ListIterator<YangLeaf> leafIterator; |
| 189 | YangLeaf leafInfo; |
| 190 | |
| 191 | // Check whether grouping is the sibling of module's child. |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 192 | assertThat(refNode.getChild() instanceof YangGrouping, is(true)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 193 | |
| 194 | YangGrouping grouping = (YangGrouping) refNode.getChild(); |
| 195 | leafIterator = grouping.getListOfLeaf().listIterator(); |
| 196 | leafInfo = leafIterator.next(); |
| 197 | |
| 198 | // Check whether the information in the leaf is correct under grouping. |
| 199 | assertThat(leafInfo.getName(), is("hello")); |
| 200 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
| 201 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 202 | |
| 203 | // Check whether uses is module's child. |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 204 | assertThat(yangNode.getChild() instanceof YangUses, is(true)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 205 | YangUses uses = (YangUses) yangNode.getChild(); |
| 206 | |
| 207 | // Check whether uses get resolved. |
| 208 | assertThat(uses.getResolvableStatus(), |
| 209 | is(ResolvableStatus.RESOLVED)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | /** |
| 213 | * Checks inter file type linking with include list. |
| 214 | */ |
| 215 | @Test |
| 216 | public void processInterFileTypeLinkingWithIncludeList() |
| 217 | throws IOException, ParserException, MojoExecutionException { |
| 218 | |
| 219 | String searchDir = "src/test/resources/interfiletypewithinclude"; |
| 220 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 221 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 222 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 223 | |
| 224 | YangNode refNode = null; |
| 225 | YangNode selfNode = null; |
| 226 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 227 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 228 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 229 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 230 | // Carry out linking of sub module with module. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 231 | yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 232 | |
| 233 | // Add reference to include list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 234 | yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 235 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 236 | updateFilePriority(utilManager.getYangNodeSet()); |
| 237 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 238 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 239 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 240 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 241 | Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 242 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 243 | YangNode rootNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 244 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 245 | if (rootNode.getName().equals("module1")) { |
| 246 | selfNode = rootNode; |
| 247 | refNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 248 | } else { |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 249 | refNode = rootNode; |
| 250 | selfNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | // Check whether the data model tree returned is of type module. |
| 254 | assertThat(selfNode instanceof YangModule, is(true)); |
| 255 | |
| 256 | // Check whether the node type is set properly to module. |
| 257 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 258 | |
| 259 | // Check whether the module name is set correctly. |
| 260 | YangModule yangNode = (YangModule) selfNode; |
| 261 | assertThat(yangNode.getName(), is("module1")); |
| 262 | |
| 263 | ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
| 264 | YangLeaf leafInfo = leafIterator.next(); |
| 265 | |
| 266 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 267 | assertThat(leafInfo.getDataType().getDataTypeName(), is("hello")); |
| 268 | assertThat(leafInfo.getDataType().getDataType(), is(DERIVED)); |
| 269 | |
| 270 | assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(), |
| 271 | is((YangTypeDef) refNode.getChild())); |
| 272 | |
| 273 | assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED)); |
| 274 | |
| 275 | YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo(); |
| 276 | |
| 277 | // Check for the effective built-in type. |
| 278 | assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING)); |
| 279 | |
| 280 | // Check for the restriction. |
| 281 | assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue())); |
| 282 | assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue())); |
| 283 | assertThat(derivedInfo.getPatternRestriction(), is(nullValue())); |
| 284 | assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue())); |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Checks inter file uses linking with include list. |
| 289 | */ |
| 290 | @Test |
| 291 | public void processInterFileUsesLinkingWithInclude() |
| 292 | throws IOException, ParserException, MojoExecutionException { |
| 293 | |
| 294 | String searchDir = "src/test/resources/interfileuseswithinclude"; |
| 295 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 296 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 297 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 298 | |
| 299 | YangNode refNode = null; |
| 300 | YangNode selfNode = null; |
| 301 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 302 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 303 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 304 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 305 | // Carry out linking of sub module with module. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 306 | yangLinkerManager.linkSubModulesToParentModule(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 307 | |
| 308 | // Add reference to include list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 309 | yangLinkerManager.addRefToYangFilesIncludeList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 310 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 311 | updateFilePriority(utilManager.getYangNodeSet()); |
| 312 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 313 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 314 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 315 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 316 | Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 317 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 318 | YangNode rootNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 319 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 320 | if (rootNode.getName().equals("module1")) { |
| 321 | selfNode = rootNode; |
| 322 | refNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 323 | } else { |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 324 | refNode = rootNode; |
| 325 | selfNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 326 | } |
| 327 | |
| 328 | // Check whether the data model tree returned is of type module. |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 329 | assertThat(selfNode instanceof YangModule, is(true)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 330 | |
| 331 | // Check whether the node type is set properly to module. |
| 332 | assertThat(selfNode.getNodeType(), is(YangNodeType.MODULE_NODE)); |
| 333 | |
| 334 | // Check whether the module name is set correctly. |
| 335 | YangModule yangNode = (YangModule) selfNode; |
| 336 | assertThat(yangNode.getName(), is("module1")); |
| 337 | |
| 338 | ListIterator<YangLeaf> leafIterator; |
| 339 | YangLeaf leafInfo; |
| 340 | |
| 341 | // Check whether grouping is the sibling of module's child. |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 342 | assertThat(refNode.getChild() instanceof YangGrouping, is(true)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 343 | |
| 344 | YangGrouping grouping = (YangGrouping) refNode.getChild(); |
| 345 | leafIterator = grouping.getListOfLeaf().listIterator(); |
| 346 | leafInfo = leafIterator.next(); |
| 347 | |
| 348 | // Check whether the information in the leaf is correct under grouping. |
| 349 | assertThat(leafInfo.getName(), is("hello")); |
| 350 | assertThat(leafInfo.getDataType().getDataTypeName(), is("string")); |
| 351 | assertThat(leafInfo.getDataType().getDataType(), is(YangDataTypes.STRING)); |
| 352 | |
| 353 | // Check whether uses is module's child. |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 354 | assertThat(yangNode.getChild() instanceof YangUses, is(true)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 355 | YangUses uses = (YangUses) yangNode.getChild(); |
| 356 | |
| 357 | // Check whether uses get resolved. |
| 358 | assertThat(uses.getResolvableStatus(), |
| 359 | is(ResolvableStatus.RESOLVED)); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | /** |
| 363 | * Checks inter file type linking with revision. |
| 364 | */ |
| 365 | @Test |
| 366 | public void processInterFileTypeLinkingWithRevision() |
| 367 | throws IOException, ParserException, MojoExecutionException { |
| 368 | |
| 369 | String searchDir = "src/test/resources/interfiletypewithrevision"; |
| 370 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 371 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 372 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 373 | |
| 374 | YangNode refNode = null; |
| 375 | YangNode selfNode = null; |
| 376 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 377 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 378 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 379 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 380 | // Add references to import list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 381 | yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 382 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 383 | updateFilePriority(utilManager.getYangNodeSet()); |
| 384 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 385 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 386 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 387 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 388 | Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 389 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 390 | YangNode rootNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 391 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 392 | if (rootNode.getName().equals("module1")) { |
| 393 | selfNode = rootNode; |
| 394 | refNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 395 | } else { |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 396 | refNode = rootNode; |
| 397 | selfNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | // Check whether the data model tree returned is of type module. |
| 401 | assertThat(selfNode instanceof YangModule, is(true)); |
| 402 | |
| 403 | // Check whether the node type is set properly to module. |
| 404 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 405 | |
| 406 | // Check whether the module name is set correctly. |
| 407 | YangModule yangNode = (YangModule) selfNode; |
| 408 | assertThat(yangNode.getName(), is("module1")); |
| 409 | |
| 410 | ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
| 411 | YangLeaf leafInfo = leafIterator.next(); |
| 412 | |
| 413 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 414 | assertThat(leafInfo.getDataType().getDataTypeName(), is("hello")); |
| 415 | assertThat(leafInfo.getDataType().getDataType(), is(DERIVED)); |
| 416 | |
| 417 | assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(), |
| 418 | is((YangTypeDef) refNode.getChild())); |
| 419 | |
| 420 | assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED)); |
| 421 | |
| 422 | YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo(); |
| 423 | |
| 424 | // Check for the effective built-in type. |
| 425 | assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING)); |
| 426 | |
| 427 | // Check for the restriction. |
| 428 | assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue())); |
| 429 | assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue())); |
| 430 | assertThat(derivedInfo.getPatternRestriction(), is(nullValue())); |
| 431 | assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue())); |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Checks inter file type linking with revision in name. |
| 436 | */ |
| 437 | @Test |
| 438 | public void processInterFileTypeLinkingWithRevisionInName() |
| 439 | throws IOException, ParserException, MojoExecutionException { |
| 440 | |
| 441 | String searchDir = "src/test/resources/interfiletypewithrevisioninname"; |
| 442 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 443 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 444 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 445 | |
| 446 | YangNode refNode = null; |
| 447 | YangNode selfNode = null; |
| 448 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 449 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 450 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 451 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 452 | // Add references to import list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 453 | yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 454 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 455 | updateFilePriority(utilManager.getYangNodeSet()); |
| 456 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 457 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 458 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 459 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 460 | Iterator<YangNode> yangNodeIterator = utilManager.getYangNodeSet().iterator(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 461 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 462 | YangNode rootNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 463 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 464 | if (rootNode.getName().equals("module1")) { |
| 465 | selfNode = rootNode; |
| 466 | refNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 467 | } else { |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 468 | refNode = rootNode; |
| 469 | selfNode = yangNodeIterator.next(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 470 | } |
| 471 | |
| 472 | // Check whether the data model tree returned is of type module. |
| 473 | assertThat(selfNode instanceof YangModule, is(true)); |
| 474 | |
| 475 | // Check whether the node type is set properly to module. |
| 476 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 477 | |
| 478 | // Check whether the module name is set correctly. |
| 479 | YangModule yangNode = (YangModule) selfNode; |
| 480 | assertThat(yangNode.getName(), is("module1")); |
| 481 | |
| 482 | ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
| 483 | YangLeaf leafInfo = leafIterator.next(); |
| 484 | |
| 485 | assertThat(leafInfo.getName(), is("invalid-interval")); |
| 486 | assertThat(leafInfo.getDataType().getDataTypeName(), is("hello")); |
| 487 | assertThat(leafInfo.getDataType().getDataType(), is(DERIVED)); |
| 488 | |
| 489 | assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(), |
| 490 | is((YangTypeDef) refNode.getChild())); |
| 491 | |
| 492 | assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED)); |
| 493 | |
| 494 | YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo(); |
| 495 | |
| 496 | // Check for the effective built-in type. |
| 497 | assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING)); |
| 498 | |
| 499 | // Check for the restriction. |
| 500 | assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue())); |
| 501 | assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue())); |
| 502 | assertThat(derivedInfo.getPatternRestriction(), is(nullValue())); |
| 503 | assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue())); |
| 504 | } |
| 505 | |
| 506 | /** |
| 507 | * Checks hierarchical inter file type linking. |
| 508 | */ |
| 509 | @Test |
| 510 | public void processHierarchicalInterFileTypeLinking() |
| 511 | throws IOException, ParserException, MojoExecutionException { |
| 512 | |
| 513 | String searchDir = "src/test/resources/hierarchicalinterfiletype"; |
| 514 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 515 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 516 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 517 | |
| 518 | YangNode refNode1 = null; |
| 519 | YangNode refNode2 = null; |
| 520 | YangNode selfNode = null; |
| 521 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 522 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 523 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 524 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 525 | // Add references to import list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 526 | yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 527 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 528 | updateFilePriority(utilManager.getYangNodeSet()); |
| 529 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 530 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 531 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 532 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 533 | for (YangNode rootNode : utilManager.getYangNodeSet()) { |
| 534 | if (rootNode.getName().equals("ietf-network-topology")) { |
| 535 | selfNode = rootNode; |
| 536 | } else if (rootNode.getName().equals("ietf-network")) { |
| 537 | refNode1 = rootNode; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 538 | } else { |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 539 | refNode2 = rootNode; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 540 | } |
| 541 | } |
| 542 | |
| 543 | // Check whether the data model tree returned is of type module. |
| 544 | assertThat(selfNode instanceof YangModule, is(true)); |
| 545 | |
| 546 | // Check whether the node type is set properly to module. |
| 547 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 548 | |
| 549 | // Check whether the module name is set correctly. |
| 550 | YangModule yangNode = (YangModule) selfNode; |
| 551 | assertThat(yangNode.getName(), is("ietf-network-topology")); |
| 552 | |
| 553 | ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
| 554 | YangLeaf leafInfo = leafIterator.next(); |
| 555 | |
| 556 | assertThat(leafInfo.getName(), is("source-node")); |
| 557 | assertThat(leafInfo.getDataType().getDataTypeName(), is("node-id")); |
| 558 | assertThat(leafInfo.getDataType().getDataType(), is(DERIVED)); |
| 559 | |
| 560 | assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(), |
| 561 | is((YangTypeDef) refNode1.getChild())); |
| 562 | |
| 563 | assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED)); |
| 564 | |
| 565 | YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo(); |
| 566 | |
| 567 | // Check for the effective built-in type. |
| 568 | assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING)); |
| 569 | |
| 570 | // Check for the restriction. |
| 571 | assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue())); |
| 572 | assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue())); |
| 573 | assertThat(derivedInfo.getPatternRestriction(), is(nullValue())); |
| 574 | assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue())); |
| 575 | } |
| 576 | |
| 577 | /** |
| 578 | * Checks hierarchical intra with inter file type linking. |
| 579 | */ |
| 580 | @Test |
| 581 | public void processHierarchicalIntraWithInterFileTypeLinking() |
| 582 | throws IOException, ParserException, MojoExecutionException { |
| 583 | |
| 584 | String searchDir = "src/test/resources/hierarchicalintrawithinterfiletype"; |
| 585 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 586 | utilManager.parseYangFileInfoSet(); |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 587 | utilManager.createYangNodeSet(); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 588 | |
| 589 | YangNode refNode1 = null; |
| 590 | YangNode selfNode = null; |
| 591 | |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 592 | // Create YANG node set |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 593 | yangLinkerManager.createYangNodeSet(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 95b416c | 2016-06-07 14:00:26 +0530 | [diff] [blame] | 594 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 595 | // Add references to import list. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 596 | yangLinkerManager.addRefToYangFilesImportList(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 597 | |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 598 | updateFilePriority(utilManager.getYangNodeSet()); |
| 599 | |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 600 | // Carry out inter-file linking. |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 601 | yangLinkerManager.processInterFileLinking(utilManager.getYangNodeSet()); |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 602 | |
Gaurav Agrawal | 8a5af14 | 2016-06-15 13:58:01 +0530 | [diff] [blame] | 603 | for (YangNode rootNode : utilManager.getYangNodeSet()) { |
| 604 | if (rootNode.getName().equals("ietf-network")) { |
| 605 | selfNode = rootNode; |
| 606 | } else if (rootNode.getName().equals("ietf-inet-types")) { |
| 607 | refNode1 = rootNode; |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 608 | } |
| 609 | } |
| 610 | |
| 611 | // Check whether the data model tree returned is of type module. |
| 612 | assertThat(selfNode instanceof YangModule, is(true)); |
| 613 | |
| 614 | // Check whether the node type is set properly to module. |
| 615 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 616 | |
| 617 | // Check whether the module name is set correctly. |
| 618 | YangModule yangNode = (YangModule) selfNode; |
| 619 | assertThat(yangNode.getName(), is("ietf-network")); |
| 620 | |
| 621 | ListIterator<YangLeaf> leafIterator = yangNode.getListOfLeaf().listIterator(); |
| 622 | YangLeaf leafInfo = leafIterator.next(); |
| 623 | |
| 624 | assertThat(leafInfo.getName(), is("node-ref")); |
| 625 | assertThat(leafInfo.getDataType().getDataTypeName(), is("node-id")); |
| 626 | assertThat(leafInfo.getDataType().getDataType(), is(DERIVED)); |
| 627 | |
| 628 | assertThat(((YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo()).getReferredTypeDef(), |
| 629 | is((YangTypeDef) selfNode.getChild())); |
| 630 | |
| 631 | assertThat(leafInfo.getDataType().getResolvableStatus(), is(RESOLVED)); |
| 632 | |
| 633 | YangDerivedInfo<?> derivedInfo = (YangDerivedInfo<?>) leafInfo.getDataType().getDataTypeExtendedInfo(); |
| 634 | |
| 635 | // Check for the effective built-in type. |
| 636 | assertThat(derivedInfo.getEffectiveBuiltInType(), is(STRING)); |
| 637 | |
| 638 | // Check for the restriction. |
| 639 | assertThat(derivedInfo.getLengthRestrictionString(), is(nullValue())); |
| 640 | assertThat(derivedInfo.getRangeRestrictionString(), is(nullValue())); |
| 641 | assertThat(derivedInfo.getPatternRestriction(), is(nullValue())); |
| 642 | assertThat(derivedInfo.getResolvedExtendedInfo(), is(nullValue())); |
| 643 | } |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 644 | |
| 645 | /** |
| 646 | * Checks hierarchical intra with inter file type linking. |
| 647 | */ |
| 648 | @Test |
| 649 | public void interFileWithUsesReferringType() |
| 650 | throws IOException, ParserException, MojoExecutionException { |
| 651 | |
| 652 | String searchDir = "src/test/resources/interfilewithusesreferringtype"; |
| 653 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 654 | utilManager.parseYangFileInfoSet(); |
| 655 | utilManager.resolveDependenciesUsingLinker(); |
| 656 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 657 | YangPluginConfig yangPluginConfig = new YangPluginConfig(); |
| 658 | yangPluginConfig.setCodeGenDir("target/interfilewithusesreferringtype/"); |
| 659 | |
Bharat saraswal | d50c638 | 2016-07-14 21:57:13 +0530 | [diff] [blame] | 660 | utilManager.translateToJava(yangPluginConfig); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 661 | |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 662 | deleteDirectory("target/interfilewithusesreferringtype/"); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 663 | |
| 664 | } |
| 665 | |
| 666 | /** |
| 667 | * Checks hierarchical intra with inter file type linking. |
| 668 | */ |
| 669 | @Test |
| 670 | public void file1UsesFile2TypeDefFile3Type() |
| 671 | throws IOException, ParserException, MojoExecutionException { |
| 672 | |
| 673 | String searchDir = "src/test/resources/file1UsesFile2TypeDefFile3Type"; |
| 674 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 675 | utilManager.parseYangFileInfoSet(); |
| 676 | utilManager.resolveDependenciesUsingLinker(); |
| 677 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 678 | YangPluginConfig yangPluginConfig = new YangPluginConfig(); |
| 679 | yangPluginConfig.setCodeGenDir("target/file1UsesFile2TypeDefFile3Type/"); |
| 680 | |
Bharat saraswal | d50c638 | 2016-07-14 21:57:13 +0530 | [diff] [blame] | 681 | utilManager.translateToJava(yangPluginConfig); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 682 | |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 683 | deleteDirectory("target/file1UsesFile2TypeDefFile3Type/"); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 684 | |
| 685 | } |
| 686 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 687 | /** |
| 688 | * Checks hierarchical intra with inter file type linking. |
| 689 | */ |
| 690 | @Test |
| 691 | public void interFileIetf() |
| 692 | throws IOException, ParserException, MojoExecutionException { |
| 693 | |
| 694 | String searchDir = "src/test/resources/interfileietf"; |
| 695 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 696 | utilManager.parseYangFileInfoSet(); |
| 697 | utilManager.resolveDependenciesUsingLinker(); |
| 698 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 699 | YangPluginConfig yangPluginConfig = new YangPluginConfig(); |
| 700 | yangPluginConfig.setCodeGenDir("target/interfileietf/"); |
| 701 | |
Bharat saraswal | d50c638 | 2016-07-14 21:57:13 +0530 | [diff] [blame] | 702 | utilManager.translateToJava(yangPluginConfig); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 703 | |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 704 | deleteDirectory("target/interfileietf/"); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 705 | |
| 706 | } |
| 707 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 708 | /** |
| 709 | * Checks hierarchical intra with inter file type linking. |
| 710 | */ |
| 711 | @Test |
| 712 | public void usesInContainer() |
| 713 | throws IOException, ParserException, MojoExecutionException { |
| 714 | |
| 715 | String searchDir = "src/test/resources/usesInContainer"; |
| 716 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 717 | utilManager.parseYangFileInfoSet(); |
| 718 | utilManager.resolveDependenciesUsingLinker(); |
| 719 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 720 | YangPluginConfig yangPluginConfig = new YangPluginConfig(); |
| 721 | yangPluginConfig.setCodeGenDir("target/usesInContainer/"); |
| 722 | |
Bharat saraswal | d50c638 | 2016-07-14 21:57:13 +0530 | [diff] [blame] | 723 | utilManager.translateToJava(yangPluginConfig); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 724 | |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 725 | deleteDirectory("target/usesInContainer/"); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 726 | |
| 727 | } |
| 728 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 729 | /** |
| 730 | * Checks hierarchical intra with inter file type linking. |
| 731 | */ |
| 732 | @Test |
| 733 | public void groupingNodeSameAsModule() |
| 734 | throws IOException, ParserException, MojoExecutionException { |
| 735 | |
| 736 | String searchDir = "src/test/resources/groupingNodeSameAsModule"; |
| 737 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 738 | utilManager.parseYangFileInfoSet(); |
| 739 | utilManager.resolveDependenciesUsingLinker(); |
| 740 | |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 741 | YangPluginConfig yangPluginConfig = new YangPluginConfig(); |
| 742 | yangPluginConfig.setCodeGenDir("target/groupingNodeSameAsModule/"); |
| 743 | |
Bharat saraswal | d50c638 | 2016-07-14 21:57:13 +0530 | [diff] [blame] | 744 | utilManager.translateToJava(yangPluginConfig); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 745 | |
Bharat saraswal | b1170bd | 2016-07-14 13:26:18 +0530 | [diff] [blame] | 746 | deleteDirectory("target/groupingNodeSameAsModule/"); |
VinodKumarS-Huawei | 2ee9e7e | 2016-06-01 14:30:22 +0530 | [diff] [blame] | 747 | |
| 748 | } |
janani b | e18b534 | 2016-07-13 21:06:41 +0530 | [diff] [blame] | 749 | |
| 750 | /** |
Vidyashree Rama | 1b49906 | 2016-07-12 20:52:48 +0530 | [diff] [blame] | 751 | * Checks priority of the file. |
| 752 | */ |
| 753 | @Test |
| 754 | public void interFilePriority() |
| 755 | throws IOException, ParserException, MojoExecutionException { |
| 756 | |
| 757 | String searchDir = "src/test/resources/interfilepriority"; |
| 758 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 759 | utilManager.parseYangFileInfoSet(); |
| 760 | utilManager.resolveDependenciesUsingLinker(); |
| 761 | |
| 762 | YangNode selfNode = null; |
| 763 | YangNode refNode1 = null; |
| 764 | YangNode refNode2 = null; |
| 765 | |
| 766 | for (YangNode rootNode : utilManager.getYangNodeSet()) { |
| 767 | if (rootNode.getName().equals("module1")) { |
| 768 | selfNode = rootNode; |
| 769 | } else if (rootNode.getName().equals("module2")) { |
| 770 | refNode1 = rootNode; |
| 771 | } else { |
| 772 | refNode2 = rootNode; |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | // Check whether the data model tree returned is of type module. |
| 777 | assertThat(selfNode instanceof YangModule, is(true)); |
| 778 | |
| 779 | // Check whether the node type is set properly to module. |
| 780 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 781 | |
| 782 | // Check whether the module name is set correctly. |
| 783 | YangModule yangNode = (YangModule) selfNode; |
| 784 | assertThat(yangNode.getName(), is("module1")); |
| 785 | assertThat(yangNode.getPriority(), is(2)); |
| 786 | |
| 787 | // Check whether the data model tree returned is of type module. |
| 788 | assertThat(refNode1 instanceof YangModule, is(true)); |
| 789 | |
| 790 | // Check whether the node type is set properly to module. |
| 791 | assertThat(refNode1.getNodeType(), is(MODULE_NODE)); |
| 792 | |
| 793 | YangModule referredNode1 = (YangModule) refNode1; |
| 794 | assertThat(referredNode1.getName(), is("module2")); |
| 795 | assertThat(referredNode1.getPriority(), is(3)); |
| 796 | } |
Vidyashree Rama | 36f2fab | 2016-07-15 14:06:56 +0530 | [diff] [blame] | 797 | |
| 798 | /** |
| 799 | * Checks contents of uses are copied as child of grouping. |
| 800 | */ |
| 801 | @Test |
| 802 | public void usesInsideChildOfGrouping() |
| 803 | throws IOException, ParserException, MojoExecutionException { |
| 804 | |
| 805 | String searchDir = "src/test/resources/usesInsideChildOfGrouping"; |
| 806 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 807 | utilManager.parseYangFileInfoSet(); |
| 808 | utilManager.resolveDependenciesUsingLinker(); |
| 809 | |
| 810 | YangNode selfNode = null; |
| 811 | YangNode refNode1 = null; |
| 812 | |
| 813 | for (YangNode rootNode : utilManager.getYangNodeSet()) { |
| 814 | if (rootNode.getName().equals("ietf-network")) { |
| 815 | selfNode = rootNode; |
| 816 | } else if (rootNode.getName().equals("ietf-te-topology")) { |
| 817 | refNode1 = rootNode; |
| 818 | } |
| 819 | } |
| 820 | |
| 821 | // Check whether the data model tree returned is of type module. |
| 822 | assertThat(selfNode instanceof YangModule, is(true)); |
| 823 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 824 | YangModule yangNode = (YangModule) selfNode; |
| 825 | assertThat(yangNode.getName(), is("ietf-network")); |
| 826 | |
| 827 | YangModule refNode = (YangModule) refNode1; |
| 828 | assertThat(refNode.getName(), is("ietf-te-topology")); |
| 829 | |
| 830 | YangAugment augment = ((YangAugment) refNode.getChild().getNextSibling(). |
| 831 | getNextSibling().getNextSibling().getNextSibling()); |
| 832 | assertThat(augment.getName(), is("/nw:networks/nw:network/nw:node")); |
| 833 | |
| 834 | YangUses uses = ((YangUses) augment.getChild()); |
| 835 | YangContainer container = ((YangContainer) uses.getNextSibling()); |
| 836 | assertThat(container.getName(), is("te")); |
| 837 | |
| 838 | container = ((YangContainer) container.getChild()); |
| 839 | assertThat(container.getName(), is("config")); |
| 840 | |
| 841 | uses = ((YangUses) container.getChild().getNextSibling()); |
| 842 | assertThat(uses.getName(), is("te-node-config-attributes")); |
| 843 | |
| 844 | YangContainer container1 = ((YangContainer) uses.getNextSibling()); |
| 845 | assertThat(container1.getName(), is("te-node-attributes")); |
| 846 | |
| 847 | uses = ((YangUses) container1.getChild()); |
| 848 | assertThat(uses.getName(), is("te-node-connectivity-matrix")); |
| 849 | |
| 850 | YangList list = ((YangList) uses.getNextSibling()); |
| 851 | assertThat(list.getName(), is("connectivity-matrix")); |
| 852 | } |
Vidyashree Rama | 07c26bb | 2016-07-28 17:33:15 +0530 | [diff] [blame] | 853 | |
| 854 | /** |
| 855 | * Checks contents of uses are copied as child of grouping. |
| 856 | */ |
| 857 | @Test |
| 858 | public void interFileUsesInsideChildOfGrouping() |
| 859 | throws IOException, ParserException, MojoExecutionException { |
| 860 | |
| 861 | String searchDir = "src/test/resources/interFileUsesInsideChildOfGrouping"; |
| 862 | utilManager.createYangFileInfoSet(YangFileScanner.getYangFiles(searchDir)); |
| 863 | utilManager.parseYangFileInfoSet(); |
| 864 | utilManager.resolveDependenciesUsingLinker(); |
| 865 | |
| 866 | YangNode selfNode = null; |
| 867 | YangNode refNode1 = null; |
| 868 | |
| 869 | for (YangNode rootNode : utilManager.getYangNodeSet()) { |
| 870 | if (rootNode.getName().equals("ietf-network")) { |
| 871 | selfNode = rootNode; |
| 872 | } else if (rootNode.getName().equals("ietf-te-topology")) { |
| 873 | refNode1 = rootNode; |
| 874 | } |
| 875 | } |
| 876 | |
| 877 | // Check whether the data model tree returned is of type module. |
| 878 | assertThat(selfNode instanceof YangModule, is(true)); |
| 879 | assertThat(selfNode.getNodeType(), is(MODULE_NODE)); |
| 880 | YangModule yangNode = (YangModule) selfNode; |
| 881 | assertThat(yangNode.getName(), is("ietf-network")); |
| 882 | |
| 883 | YangModule refNode = (YangModule) refNode1; |
| 884 | assertThat(refNode.getName(), is("ietf-te-topology")); |
| 885 | |
| 886 | YangAugment augment = ((YangAugment) refNode.getChild().getNextSibling(). |
| 887 | getNextSibling().getNextSibling().getNextSibling().getNextSibling()); |
| 888 | assertThat(augment.getName(), is("/nw:networks/nw:network/nt:link")); |
| 889 | |
| 890 | YangUses uses = ((YangUses) augment.getChild()); |
| 891 | assertThat(uses.getResolvableStatus(), is(RESOLVED)); |
| 892 | YangContainer container = ((YangContainer) uses.getNextSibling()); |
| 893 | assertThat(container.getName(), is("te")); |
| 894 | |
| 895 | container = ((YangContainer) container.getChild()); |
| 896 | assertThat(container.getName(), is("config")); |
| 897 | |
| 898 | uses = ((YangUses) container.getChild().getNextSibling()); |
| 899 | assertThat(uses.getName(), is("te-link-config-attributes")); |
| 900 | assertThat(uses.getResolvableStatus(), is(RESOLVED)); |
| 901 | |
| 902 | YangContainer container1 = ((YangContainer) uses.getNextSibling()); |
| 903 | assertThat(container1.getName(), is("te-link-attributes")); |
| 904 | |
| 905 | container = ((YangContainer) container1.getChild()); |
| 906 | assertThat(container.getName(), is("underlay")); |
| 907 | |
| 908 | uses = ((YangUses) container.getChild()); |
| 909 | assertThat(uses.getName(), is("te-link-underlay-attributes")); |
| 910 | assertThat(uses.getResolvableStatus(), is(RESOLVED)); |
| 911 | |
| 912 | container = ((YangContainer) uses.getNextSibling()); |
| 913 | assertThat(container.getName(), is("underlay-primary-path")); |
| 914 | |
| 915 | YangList yangList = ((YangList) container.getChild()); |
| 916 | assertThat(yangList.getName(), is("path-element")); |
| 917 | |
| 918 | uses = ((YangUses) yangList.getChild()); |
| 919 | assertThat(uses.getName(), is("te-path-element")); |
| 920 | assertThat(uses.getResolvableStatus(), is(RESOLVED)); |
| 921 | |
| 922 | uses = ((YangUses) uses.getNextSibling()); |
| 923 | assertThat(uses.getName(), is("explicit-route-subobject")); |
| 924 | assertThat(uses.getResolvableStatus(), is(RESOLVED)); |
| 925 | |
| 926 | YangChoice choice = ((YangChoice) uses.getNextSibling()); |
| 927 | assertThat(choice.getName(), is("type")); |
| 928 | } |
Gaurav Agrawal | 0d43bb5 | 2016-05-17 18:06:38 +0530 | [diff] [blame] | 929 | } |