Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 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.yms.app.ych; |
| 18 | |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 19 | import static org.junit.Assert.assertEquals; |
| 20 | import static org.junit.Assert.assertNotNull; |
| 21 | import static org.junit.Assert.assertNull; |
| 22 | import static org.onosproject.yms.ych.YangProtocolEncodingFormat.XML; |
| 23 | import static org.onosproject.yms.ydt.YmsOperationType.QUERY_CONFIG_REQUEST; |
| 24 | import static org.onosproject.yms.ydt.YmsOperationType.QUERY_REQUEST; |
| 25 | |
| 26 | import java.io.BufferedReader; |
| 27 | import java.io.FileReader; |
| 28 | import java.io.IOException; |
| 29 | import java.util.ArrayList; |
| 30 | import java.util.BitSet; |
| 31 | import java.util.HashMap; |
| 32 | import java.util.Iterator; |
| 33 | import java.util.List; |
| 34 | import java.util.Map; |
| 35 | |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 36 | import org.junit.Test; |
| 37 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.CombinedOpParam; |
| 38 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.AsNum; |
| 39 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.Attributes; |
| 40 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.DefaultAttributes; |
| 41 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.Metric; |
| 42 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.PathId; |
| 43 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.Aigp; |
| 44 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.BgpParameters; |
| 45 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultAigp; |
| 46 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultBgpParameters; |
| 47 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultLocalPref; |
| 48 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultMultiExitDisc; |
| 49 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultOrigin; |
| 50 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.DefaultUnrecognizedAttributes; |
| 51 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.LocalPref; |
| 52 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.MultiExitDisc; |
| 53 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.Origin; |
| 54 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.UnrecognizedAttributes; |
| 55 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.aigp.AigpTlv; |
| 56 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.aigp.DefaultAigpTlv; |
| 57 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.DefaultOptionalCapabilities; |
| 58 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.OptionalCapabilities; |
| 59 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.Cparameters; |
| 60 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.DefaultCparameters; |
| 61 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.cparameters.As4BytesCapability; |
| 62 | import org.onosproject.yang.gen.v1.ych.combined.rev20160524.combined.attributes.bgpparameters.optionalcapabilities.cparameters.DefaultAs4BytesCapability; |
| 63 | import org.onosproject.yang.gen.v1.ych.empty.container.rev20160524.EmptyContainerOpParam; |
| 64 | import org.onosproject.yang.gen.v1.ych.empty.container.rev20160524.emptycontainer.EmptyContainer; |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 65 | import org.onosproject.yang.gen.v1.ych.purchasing.supervisor.rev20160524.YchPurchasingsupervisor.OnosYangOpType; |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 66 | import org.onosproject.yang.gen.v1.ych.purchasing.supervisor.rev20160524.YchPurchasingsupervisorOpParam; |
| 67 | import org.onosproject.yang.gen.v1.ych.purchasing.supervisor.rev20160524.ychpurchasingsupervisor.DefaultYchPurchasingSupervisor; |
| 68 | import org.onosproject.yang.gen.v1.ych.purchasing.supervisor.rev20160524.ychpurchasingsupervisor.YchPurchasingSupervisor; |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 69 | import org.onosproject.yang.gen.v1.ych.purchasing.supervisor.rev20160524.ychpurchasingsupervisor.ychpurchasingsupervisor.DefaultYchIsManager; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 70 | import org.onosproject.yang.gen.v1.ydt.customs.supervisor.rev20160524.CustomssupervisorOpParam; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 71 | import org.onosproject.yang.gen.v1.ydt.material.supervisor.rev20160524.MaterialsupervisorOpParam; |
| 72 | import org.onosproject.yang.gen.v1.ydt.material.supervisor.rev20160524.materialsupervisor.DefaultSupervisor; |
| 73 | import org.onosproject.yang.gen.v1.ydt.material.supervisor.rev20160524.materialsupervisor.Supervisor; |
| 74 | import org.onosproject.yang.gen.v1.ydt.merchandiser.supervisor.rev20160524.MerchandisersupervisorOpParam; |
| 75 | import org.onosproject.yang.gen.v1.ydt.root.rev20160524.LogisticsManagerOpParam; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 76 | import org.onosproject.yang.gen.v1.ydt.trading.supervisor.rev20160524.TradingsupervisorOpParam; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 77 | import org.onosproject.yms.app.ych.defaultcodecs.YangCodecRegistry; |
| 78 | import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry; |
| 79 | import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider; |
| 80 | import org.onosproject.yms.ych.YangCompositeEncoding; |
| 81 | |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 82 | /** |
| 83 | * Unit test case for default codec handler. |
| 84 | */ |
| 85 | public class DefaultYangCodecHandlerTest { |
| 86 | private TestYangSchemaNodeProvider testYangSchemaNodeProvider = |
| 87 | new TestYangSchemaNodeProvider(); |
| 88 | private static final String AM_XML = "Incorrect XML generated: "; |
| 89 | private static final String AM_OBJ = "Incorrect object generated: "; |
| 90 | private static final String EMPTY_CONTAINER = "EmptyContainerOpParam"; |
| 91 | private static final String LOGISTIC_MOD = "LogisticsManagerOpParam"; |
| 92 | private static final String MERCHA_MOD = "MerchandisersupervisorOpParam"; |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 93 | private static final String PURCH_MOD = "YchPurchasingsupervisorOpParam"; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 94 | |
| 95 | /** |
| 96 | * Returns the xml string for customssupervisor module. |
| 97 | * |
| 98 | * @return the xml string for customssupervisor module |
| 99 | */ |
| 100 | private static String customsXml() { |
| 101 | return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 102 | "<supervisor xmlns=\"ydt.customs-supervisor\">" + |
| 103 | "Customssupervisor</supervisor>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 104 | "</filter>"; |
| 105 | } |
| 106 | |
| 107 | /** |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 108 | * Returns the xml string for purchasesupervisor with empty selection node. |
| 109 | * |
| 110 | * @return the xml string for purchasesupervisor with empty selection node |
| 111 | */ |
| 112 | private static String purchaseXmlEmptySelectionNode() { |
| 113 | return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" + |
| 114 | "<ych-purchasing-supervisor xmlns=\"ych.purchasing-supervisor\">" + |
| 115 | "<ych-purchasing-specialist/>" + |
| 116 | "</ych-purchasing-supervisor>" + |
| 117 | "</filter>"; |
| 118 | } |
| 119 | |
| 120 | /** |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 121 | * Returns the xml string for merchandisersupervisor module. |
| 122 | * |
| 123 | * @return the xml string for merchandisersupervisor module |
| 124 | */ |
| 125 | private static String merchandXml() { |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 126 | return "<config xmlns=\"ydt.root\" " + |
| 127 | "xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 128 | "<supervisor xmlns=\"ydt.Merchandiser-supervisor\">" + |
| 129 | "Merchandisersupervisor</supervisor>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 130 | "</config>"; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Returns the xml string for tradingsupervisor module. |
| 135 | * |
| 136 | * @return the xml string for tradingsupervisor module |
| 137 | */ |
| 138 | private static String tradingXml() { |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 139 | return "<config xmlns=\"ydt.root\" " + |
| 140 | "xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 141 | "<supervisor xmlns=\"ydt.trading-supervisor\">" + |
| 142 | "Tradingsupervisor</supervisor>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 143 | "</config>"; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Returns the xml string for customssupervisor module. |
| 148 | * |
| 149 | * @return the xml string for customssupervisor module |
| 150 | */ |
| 151 | private static String customsCompositeXml() { |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 152 | return "<filter xmlns=\"ydt.filter-type\">" + |
| 153 | "<supervisor xmlns=\"ydt.customs-supervisor\">" + |
| 154 | "Customssupervisor</supervisor></filter>"; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Returns the xml string for customssupervisor module with filter-type. |
| 159 | * |
| 160 | * @return the xml string for customssupervisor module with filter-type |
| 161 | */ |
| 162 | private static String customsEmptyXml() { |
| 163 | return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 164 | "</filter>"; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Returns the xml string for materialsupervisor module. |
| 169 | * |
| 170 | * @return the xml string for materialsupervisor module |
| 171 | */ |
| 172 | private static String materialXml() { |
| 173 | return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 174 | "<supervisor xmlns=\"ydt.material-supervisor\">" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 175 | "<name>abc1</name><departmentId>xyz1</departmentId>" + |
| 176 | "</supervisor>" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 177 | "<supervisor xmlns=\"ydt.material-supervisor\"" + |
| 178 | "><name>abc2</name><departmentId>xyz2</departmentId>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 179 | "</supervisor>" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 180 | "<supervisor xmlns=\"ydt.material-supervisor\"" + |
| 181 | "><name>abc3</name><departmentId>xyz3</departmentId>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 182 | "</supervisor>" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 183 | "<supervisor xmlns=\"ydt.material-supervisor\"" + |
| 184 | "><name>abc4</name><departmentId>xyz4</departmentId>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 185 | "</supervisor>" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 186 | "<supervisor xmlns=\"ydt.material-supervisor\"" + |
| 187 | "><name>abc5</name><departmentId>xyz5</departmentId>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 188 | "</supervisor>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 189 | "</filter>"; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Returns the xml string for EmptyContainer module. |
| 194 | * |
| 195 | * @return the xml string for EmptyContainer module |
| 196 | */ |
| 197 | private static String containerEmptyXml() { |
| 198 | return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 199 | "</filter>"; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Returns the xml string for Combined module. |
| 204 | * |
| 205 | * @return the xml string for Combined module |
| 206 | */ |
| 207 | private static String listTestXml() { |
| 208 | return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\">" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 209 | "<attributes xmlns=\"ych:combined\">" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 210 | "<origin><value>123</value></origin>" + |
| 211 | "<multi-exit-disc><med>456</med></multi-exit-disc>" + |
| 212 | "<local-pref><pref>23</pref></local-pref>" + |
| 213 | "<aigp><aigp-tlv><metric>456</metric></aigp-tlv></aigp>" + |
| 214 | "<unrecognized-attributes><partial>false</partial>" + |
| 215 | "<transitive>false</transitive><type>1</type>" + |
| 216 | "<value>QUJD</value></unrecognized-attributes>" + |
| 217 | "<unrecognized-attributes><partial>true</partial>" + |
| 218 | "<transitive>true</transitive><type>2</type>" + |
| 219 | "<value>QUJD</value></unrecognized-attributes>" + |
| 220 | "<unrecognized-attributes><partial>true</partial>" + |
| 221 | "<transitive>false</transitive><type>3</type>" + |
| 222 | "<value>QUJD</value></unrecognized-attributes>" + |
| 223 | "<unrecognized-attributes><partial>false</partial>" + |
| 224 | "<transitive>true</transitive><type>4</type>" + |
| 225 | "<value>QUJD</value></unrecognized-attributes>" + |
| 226 | "<bgp-parameters><optional-capabilities><c-parameters>" + |
| 227 | "<as4-bytes-capability><as-number>11</as-number>" + |
| 228 | "</as4-bytes-capability></c-parameters>" + |
| 229 | "</optional-capabilities><optional-capabilities>" + |
| 230 | "<c-parameters><as4-bytes-capability>" + |
| 231 | "<as-number>22</as-number></as4-bytes-capability>" + |
| 232 | "</c-parameters></optional-capabilities>" + |
| 233 | "<optional-capabilities><c-parameters><as4-bytes-capability>" + |
| 234 | "<as-number>33</as-number></as4-bytes-capability>" + |
| 235 | "</c-parameters></optional-capabilities></bgp-parameters>" + |
| 236 | "<bgp-parameters><optional-capabilities><c-parameters>" + |
| 237 | "<as4-bytes-capability><as-number>11</as-number>" + |
| 238 | "</as4-bytes-capability></c-parameters>" + |
| 239 | "</optional-capabilities><optional-capabilities>" + |
| 240 | "<c-parameters><as4-bytes-capability>" + |
| 241 | "<as-number>22</as-number></as4-bytes-capability>" + |
| 242 | "</c-parameters></optional-capabilities>" + |
| 243 | "<optional-capabilities><c-parameters><as4-bytes-capability>" + |
| 244 | "<as-number>33</as-number></as4-bytes-capability>" + |
| 245 | "</c-parameters></optional-capabilities>" + |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 246 | "</bgp-parameters></attributes></filter>"; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Returns the xml string for ych-purchasingsupervisor module. |
| 251 | * |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 252 | * @return the XML string for ych-purchasingsupervisor module |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 253 | */ |
| 254 | private static String purchaseXml() { |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 255 | return "<config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" " + |
| 256 | "xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" + |
| 257 | "<ych-purchasing-supervisor xmlns=\"ych.purchasing-supervisor\" " + |
| 258 | "nc:operation=\"create\">" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 259 | "<ych-purchasing-specialist>purchasingSpecialist" + |
| 260 | "</ych-purchasing-specialist>" + |
| 261 | "<ych-purchasing-support>support</ych-purchasing-support>" + |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 262 | "<ych-is-manager/>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 263 | "</ych-purchasing-supervisor>" + |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 264 | "</config>"; |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 265 | } |
| 266 | |
| 267 | /** |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 268 | * Returns the xml string for ych-purchasingsupervisor module with BitSet options. |
| 269 | * |
| 270 | * @return the XML string for ych-purchasingsupervisor module |
| 271 | */ |
| 272 | private static String purchaseXmlOptions(BitSet options) { |
| 273 | boolean isFirst = true; |
| 274 | |
| 275 | StringBuffer sb = new StringBuffer(); |
| 276 | sb.append("<config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" "); |
| 277 | sb.append("xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"); |
| 278 | sb.append("<ych-purchasing-supervisor xmlns=\"ych.purchasing-supervisor\" " + |
| 279 | "nc:operation=\"create\">"); |
| 280 | sb.append("<ych-purchasing-support>support</ych-purchasing-support>"); |
| 281 | if (options == null || options.isEmpty()) { |
| 282 | sb.append("<ych-purchasing-options/>"); |
| 283 | } else { |
| 284 | sb.append("<ych-purchasing-options>"); |
| 285 | for (int i = 0; i < 4; i++) { |
| 286 | if (options.get(i)) { |
| 287 | if (isFirst) { |
| 288 | isFirst = false; |
| 289 | } else { |
| 290 | sb.append(' '); |
| 291 | } |
| 292 | sb.append("option" + i); |
| 293 | } |
| 294 | } |
| 295 | sb.append("</ych-purchasing-options>"); |
| 296 | } |
| 297 | sb.append("</ych-purchasing-supervisor>"); |
| 298 | sb.append("</config>"); |
| 299 | |
| 300 | return sb.toString(); |
| 301 | } |
| 302 | |
| 303 | /** |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 304 | * Returns the xml string for employeeid module. |
| 305 | * |
| 306 | * @return the xml string for employeeid module |
| 307 | */ |
| 308 | private static String emplyIdXml() { |
| 309 | return "<config xmlns=\"ydt.root\">" + |
| 310 | "<employeeid xmlns=\"ydt.employee-id\">" + |
| 311 | "<employeeid>Employ1</employeeid>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 312 | "<employeeid>Employ2</employeeid>" + |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 313 | "<employeeid>Employ3</employeeid>" + |
| 314 | "<employeeid>Employ4</employeeid>" + |
| 315 | "<employeeid>Employ5</employeeid>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 316 | "</employeeid>" + |
| 317 | "</config>"; |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * Returns the xml string for warehousesupervisor module. |
| 322 | * |
| 323 | * @return the xml string for warehousesupervisor module |
| 324 | */ |
| 325 | private static String wareHseXml() { |
| 326 | return "<config xmlns=\"ydt.root\">" + |
| 327 | "<warehousesupervisor xmlns=\"ydt.warehouse-supervisor\">" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 328 | "<supervisor>supervisor1</supervisor>" + |
| 329 | "<supervisor>supervisor2</supervisor>" + |
| 330 | "<supervisor>supervisor3</supervisor>" + |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 331 | "<supervisor>supervisor4</supervisor>" + |
| 332 | "<supervisor>supervisor5</supervisor>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 333 | "</warehousesupervisor>" + |
| 334 | "</config>"; |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * Returns the xml string for more than one module. |
| 339 | * |
| 340 | * @return the xml string for more than one module |
| 341 | */ |
| 342 | private static String multiModuleXml() { |
| 343 | return "<config xmlns=\"ydt.root\">" + |
| 344 | "<customssupervisor xmlns=\"ydt.customs-supervisor\">" + |
| 345 | "<supervisor>Customssupervisor</supervisor>" + |
| 346 | "</customssupervisor>" + |
| 347 | "<merchandisersupervisor xmlns=\"ydt.Merchandiser-supervisor\">" + |
| 348 | "<supervisor>Merchandisersupervisor</supervisor>" + |
| 349 | "</merchandisersupervisor>" + |
| 350 | "<materialsupervisor xmlns=\"ydt.material-supervisor\">" + |
| 351 | "<supervisor>" + |
| 352 | "<name>abc1</name>" + |
| 353 | "<departmentId>xyz1</departmentId>" + |
| 354 | "</supervisor>" + |
| 355 | "<supervisor>" + |
| 356 | "<name>abc2</name>" + |
| 357 | "<departmentId>xyz2</departmentId>" + |
| 358 | "</supervisor>" + |
| 359 | "<supervisor>" + |
| 360 | "<name>abc3</name>" + |
| 361 | "<departmentId>xyz3</departmentId>" + |
| 362 | "</supervisor>" + |
| 363 | "<supervisor>" + |
| 364 | "<name>abc4</name>" + |
| 365 | "<departmentId>xyz4</departmentId>" + |
| 366 | "</supervisor>" + |
| 367 | "<supervisor>" + |
| 368 | "<name>abc5</name>" + |
| 369 | "<departmentId>xyz5</departmentId>" + |
| 370 | "</supervisor>" + |
| 371 | "</materialsupervisor>" + |
| 372 | "<ych-purchasingsupervisor xmlns=\"ych.purchasing-supervisor\">" + |
| 373 | "<ych-purchasing-supervisor>" + |
| 374 | "<ych-purchasing-specialist>purchasingSpecialist" + |
| 375 | "</ych-purchasing-specialist>" + |
| 376 | "<ych-purchasing-support>support</ych-purchasing-support>" + |
| 377 | "</ych-purchasing-supervisor>" + |
| 378 | "</ych-purchasingsupervisor>" + |
| 379 | "<warehousesupervisor xmlns=\"ydt.warehouse-supervisor\">" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 380 | "<supervisor>supervisor1</supervisor>" + |
| 381 | "<supervisor>supervisor2</supervisor>" + |
| 382 | "<supervisor>supervisor3</supervisor>" + |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 383 | "<supervisor>supervisor4</supervisor>" + |
| 384 | "<supervisor>supervisor5</supervisor>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 385 | "</warehousesupervisor>" + |
| 386 | "<tradingsupervisor xmlns=\"ydt.trading-supervisor\">" + |
| 387 | "<supervisor>Tradingsupervisor</supervisor>" + |
| 388 | "</tradingsupervisor>" + |
| 389 | "<employeeid xmlns=\"ydt.employee-id\">" + |
| 390 | "<employeeid>Employ1</employeeid>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 391 | "<employeeid>Employ2</employeeid>" + |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 392 | "<employeeid>Employ3</employeeid>" + |
| 393 | "<employeeid>Employ4</employeeid>" + |
| 394 | "<employeeid>Employ5</employeeid>" + |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 395 | "</employeeid>" + |
| 396 | "</config>"; |
| 397 | } |
| 398 | |
| 399 | /** |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 400 | * Returns the xml string for more than one module. |
| 401 | * |
| 402 | * @return the xml string for more than one module |
| 403 | */ |
| 404 | private String multipleAppxml() { |
| 405 | return "<filter xmlns=\"ydt.filter-type\" type=\"subtree\"><supervisor" + |
| 406 | " xmlns=\"ydt.customs-supervisor\">Customssupervisor" + |
| 407 | "</supervisor><supervisor xmlns=\"ydt.material-supervisor\"" + |
| 408 | "><name>abc1</name><departmentId>xyz1</departmentId" + |
| 409 | "></supervisor><supervisor xmlns=\"ydt.material-supervisor\">" + |
| 410 | "<name>abc2</name><departmentId>xyz2</departmentId>" + |
| 411 | "</supervisor><supervisor xmlns=\"ydt" + |
| 412 | ".material-supervisor\"><name>abc3</name><departmentId>xyz3" + |
| 413 | "</departmentId></supervisor><supervisor xmlns=\"ydt" + |
| 414 | ".material-supervisor\"><name>abc4</name><departmentId>xyz4" + |
| 415 | "</departmentId></supervisor><supervisor xmlns=\"ydt" + |
| 416 | ".material-supervisor\"><name>abc5</name><departmentId>xyz5" + |
| 417 | "</departmentId></supervisor></filter>"; |
| 418 | } |
| 419 | |
| 420 | /** |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 421 | * Unit test case in which verifying xml string for module object with leaf |
| 422 | * for composite encode. |
| 423 | */ |
| 424 | @Test |
| 425 | public void proceessCodecHandlerForCompositeEnc() { |
| 426 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 427 | DefaultYangSchemaRegistry schemaRegistry = testYangSchemaNodeProvider |
| 428 | .getDefaultYangSchemaRegistry(); |
| 429 | |
| 430 | // Creating the object |
| 431 | Object object = CustomssupervisorOpParam.builder() |
| 432 | .supervisor("Customssupervisor").build(); |
| 433 | |
| 434 | // Get the xml string and compare |
| 435 | Map<String, String> tagAttr = new HashMap<String, String>(); |
| 436 | tagAttr.put("type", "subtree"); |
| 437 | |
| 438 | YangCodecRegistry.initializeDefaultCodec(); |
| 439 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 440 | new DefaultYangCodecHandler(schemaRegistry); |
| 441 | YangCompositeEncoding xml = |
| 442 | defaultYangCodecHandler |
| 443 | .encodeCompositeOperation("filter", "ydt.filter-type", |
| 444 | object, XML, null); |
| 445 | |
| 446 | assertNull("customs-super: resource id not null", |
| 447 | xml.getResourceIdentifier()); |
| 448 | assertEquals(AM_XML + "customs-super: comp res info", |
| 449 | customsCompositeXml(), xml.getResourceInformation()); |
| 450 | |
| 451 | // Creating the object |
| 452 | object = MerchandisersupervisorOpParam.builder() |
| 453 | .supervisor("Merchandisersupervisor").build(); |
| 454 | |
| 455 | // Get the xml string and compare |
| 456 | xml = defaultYangCodecHandler.encodeCompositeOperation("config", |
| 457 | "ydt.root", |
| 458 | object, XML, |
| 459 | null); |
| 460 | assertNull("merch-super: res id not null", xml.getResourceIdentifier()); |
| 461 | assertEquals(AM_XML + "merch-super: comp res info", |
| 462 | merchandXml(), xml.getResourceInformation()); |
| 463 | |
| 464 | // Creating the object |
| 465 | object = TradingsupervisorOpParam.builder() |
| 466 | .supervisor("Tradingsupervisor").build(); |
| 467 | |
| 468 | // Get the xml string and compare |
| 469 | xml = defaultYangCodecHandler |
| 470 | .encodeCompositeOperation("config", "ydt.root", object, XML, |
| 471 | null); |
| 472 | assertNull("trading-super: res id not null", |
| 473 | xml.getResourceIdentifier()); |
| 474 | assertEquals(AM_XML + "trading-super: comp res info", |
| 475 | tradingXml(), xml.getResourceInformation()); |
| 476 | } |
| 477 | |
| 478 | /** |
| 479 | * Unit test case in which verifying xml string for module object with leaf. |
| 480 | */ |
| 481 | @Test |
| 482 | public void proceessCodecHandlerForLeaf() { |
| 483 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 484 | DefaultYangSchemaRegistry schemaRegistry = testYangSchemaNodeProvider |
| 485 | .getDefaultYangSchemaRegistry(); |
| 486 | List<Object> yangModuleList = new ArrayList<>(); |
| 487 | |
| 488 | // Creating the object |
| 489 | Object object = CustomssupervisorOpParam.builder() |
| 490 | .supervisor("Customssupervisor").build(); |
| 491 | yangModuleList.add(object); |
| 492 | |
| 493 | // Get the xml string and compare |
| 494 | Map<String, String> tagAttr = new HashMap<String, String>(); |
| 495 | tagAttr.put("type", "subtree"); |
| 496 | |
| 497 | YangCodecRegistry.initializeDefaultCodec(); |
| 498 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 499 | new DefaultYangCodecHandler(schemaRegistry); |
| 500 | String xml = |
| 501 | defaultYangCodecHandler.encodeOperation("filter", |
| 502 | "ydt.filter-type", |
| 503 | tagAttr, yangModuleList, |
| 504 | XML, null); |
| 505 | |
| 506 | assertEquals(AM_XML + "customs-super: leaf info", customsXml(), xml); |
| 507 | |
| 508 | // Creating the object |
| 509 | object = MerchandisersupervisorOpParam.builder() |
| 510 | .supervisor("Merchandisersupervisor").build(); |
| 511 | yangModuleList.clear(); |
| 512 | yangModuleList.add(object); |
| 513 | |
| 514 | // Get the xml string and compare |
| 515 | xml = defaultYangCodecHandler.encodeOperation("config", "ydt.root", |
| 516 | null, yangModuleList, |
| 517 | XML, null); |
| 518 | assertEquals(AM_XML + "merchandiser-super: leaf info", merchandXml(), |
| 519 | xml); |
| 520 | |
| 521 | // Creating the object |
| 522 | object = TradingsupervisorOpParam.builder() |
| 523 | .supervisor("Tradingsupervisor").build(); |
| 524 | yangModuleList.clear(); |
| 525 | yangModuleList.add(object); |
| 526 | |
| 527 | // Get the xml string and compare |
| 528 | xml = defaultYangCodecHandler.encodeOperation("config", "ydt.root", |
| 529 | null, yangModuleList, |
| 530 | XML, null); |
| 531 | assertEquals(AM_XML + "trading-super: leaf info", tradingXml(), xml); |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * Unit test case in which verifying xml string for module object with |
| 536 | * empty leaf. |
| 537 | */ |
| 538 | @Test |
| 539 | public void proceessCodecHandlerForEmptyLeaf() { |
| 540 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 541 | DefaultYangSchemaRegistry schemaRegistry = testYangSchemaNodeProvider |
| 542 | .getDefaultYangSchemaRegistry(); |
| 543 | List<Object> yangModuleList = new ArrayList<>(); |
| 544 | |
| 545 | // Creating the object |
| 546 | Object object = CustomssupervisorOpParam.builder().supervisor("") |
| 547 | .build(); |
| 548 | yangModuleList.add(object); |
| 549 | |
| 550 | // Get the xml string and compare |
| 551 | Map<String, String> tagAttr = new HashMap<String, String>(); |
| 552 | tagAttr.put("type", "subtree"); |
| 553 | |
| 554 | YangCodecRegistry.initializeDefaultCodec(); |
| 555 | DefaultYangCodecHandler codecHandler = |
| 556 | new DefaultYangCodecHandler(schemaRegistry); |
| 557 | String xml = codecHandler.encodeOperation("filter", "ydt.filter-type", |
| 558 | tagAttr, yangModuleList, |
| 559 | XML, null); |
| 560 | |
| 561 | assertEquals(AM_XML + "customs-super: leaf is not empty", |
| 562 | customsEmptyXml(), xml); |
| 563 | } |
| 564 | |
| 565 | /** |
Vidyashree Rama | 9f34bad | 2016-12-08 18:07:08 +0530 | [diff] [blame] | 566 | * Unit test case in which verifying xml string for more than one module |
| 567 | * object. |
| 568 | */ |
| 569 | @Test |
| 570 | public void proceessCodecHandlerForMultipleApp() { |
| 571 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 572 | DefaultYangSchemaRegistry schemaRegistry = testYangSchemaNodeProvider |
| 573 | .getDefaultYangSchemaRegistry(); |
| 574 | List<Object> yangModuleList = new ArrayList<>(); |
| 575 | |
| 576 | // Creating the object |
| 577 | Object object = CustomssupervisorOpParam.builder() |
| 578 | .supervisor("Customssupervisor").build(); |
| 579 | yangModuleList.add(object); |
| 580 | |
| 581 | // Creating the object |
| 582 | Supervisor supervisor1 = new DefaultSupervisor.SupervisorBuilder() |
| 583 | .name("abc1").departmentId("xyz1").build(); |
| 584 | Supervisor supervisor2 = new DefaultSupervisor.SupervisorBuilder() |
| 585 | .name("abc2").departmentId("xyz2").build(); |
| 586 | Supervisor supervisor3 = new DefaultSupervisor.SupervisorBuilder() |
| 587 | .name("abc3").departmentId("xyz3").build(); |
| 588 | Supervisor supervisor4 = new DefaultSupervisor.SupervisorBuilder() |
| 589 | .name("abc4").departmentId("xyz4").build(); |
| 590 | Supervisor supervisor5 = new DefaultSupervisor.SupervisorBuilder() |
| 591 | .name("abc5").departmentId("xyz5").build(); |
| 592 | |
| 593 | Object object1 = MaterialsupervisorOpParam.builder() |
| 594 | .addToSupervisor(supervisor1) |
| 595 | .addToSupervisor(supervisor2) |
| 596 | .addToSupervisor(supervisor3) |
| 597 | .addToSupervisor(supervisor4) |
| 598 | .addToSupervisor(supervisor5).build(); |
| 599 | yangModuleList.add(object1); |
| 600 | |
| 601 | // Get the xml string and compare |
| 602 | Map<String, String> tagAttr = new HashMap<String, String>(); |
| 603 | tagAttr.put("type", "subtree"); |
| 604 | |
| 605 | YangCodecRegistry.initializeDefaultCodec(); |
| 606 | DefaultYangCodecHandler codecHandler = |
| 607 | new DefaultYangCodecHandler(schemaRegistry); |
| 608 | String xml = codecHandler.encodeOperation("filter", "ydt.filter-type", |
| 609 | tagAttr, yangModuleList, |
| 610 | XML, null); |
| 611 | |
| 612 | assertEquals(AM_XML + "for multiple applications", |
| 613 | multipleAppxml(), xml); |
| 614 | } |
| 615 | |
| 616 | /** |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 617 | * Unit test case in which verifying xml string for module object with list. |
| 618 | */ |
| 619 | @Test |
| 620 | public void proceessCodecHandlerForList() { |
| 621 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 622 | DefaultYangSchemaRegistry schemaRegistry = |
| 623 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 624 | List<Object> yangModuleList = new ArrayList<>(); |
| 625 | |
| 626 | // Creating the object |
| 627 | Supervisor supervisor1 = new DefaultSupervisor.SupervisorBuilder() |
| 628 | .name("abc1").departmentId("xyz1").build(); |
| 629 | Supervisor supervisor2 = new DefaultSupervisor.SupervisorBuilder() |
| 630 | .name("abc2").departmentId("xyz2").build(); |
| 631 | Supervisor supervisor3 = new DefaultSupervisor.SupervisorBuilder() |
| 632 | .name("abc3").departmentId("xyz3").build(); |
| 633 | Supervisor supervisor4 = new DefaultSupervisor.SupervisorBuilder() |
| 634 | .name("abc4").departmentId("xyz4").build(); |
| 635 | Supervisor supervisor5 = new DefaultSupervisor.SupervisorBuilder() |
| 636 | .name("abc5").departmentId("xyz5").build(); |
| 637 | |
| 638 | Object object = MaterialsupervisorOpParam.builder() |
| 639 | .addToSupervisor(supervisor1) |
| 640 | .addToSupervisor(supervisor2) |
| 641 | .addToSupervisor(supervisor3) |
| 642 | .addToSupervisor(supervisor4) |
| 643 | .addToSupervisor(supervisor5).build(); |
| 644 | |
| 645 | yangModuleList.add(object); |
| 646 | |
| 647 | // Get the xml string and compare |
| 648 | Map<String, String> tagAttr = new HashMap<String, String>(); |
| 649 | tagAttr.put("type", "subtree"); |
| 650 | |
| 651 | YangCodecRegistry.initializeDefaultCodec(); |
| 652 | DefaultYangCodecHandler codecHandler = |
| 653 | new DefaultYangCodecHandler(schemaRegistry); |
| 654 | String xml = codecHandler.encodeOperation("filter", "ydt.filter-type", |
| 655 | tagAttr, yangModuleList, |
| 656 | XML, null); |
| 657 | assertEquals(AM_XML + "material-super: list info", materialXml(), xml); |
| 658 | } |
| 659 | |
| 660 | /** |
| 661 | * Unit test case in which verifying xml string for module object with |
| 662 | * empty container. |
| 663 | */ |
| 664 | @Test |
| 665 | public void proceessCodecHandlerForEmptyContainer() { |
| 666 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 667 | DefaultYangSchemaRegistry schemaRegistry = |
| 668 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 669 | List<Object> yangModuleList = new ArrayList<>(); |
| 670 | |
| 671 | // Creating the object |
| 672 | EmptyContainer emptyContainer = EmptyContainerOpParam.builder() |
| 673 | .emptyContainer(); |
| 674 | Object object = EmptyContainerOpParam.builder() |
| 675 | .emptyContainer(emptyContainer).build(); |
| 676 | |
| 677 | yangModuleList.add(object); |
| 678 | |
| 679 | // Get the xml string and compare |
| 680 | Map<String, String> tagAttr = new HashMap<String, String>(); |
| 681 | tagAttr.put("type", "subtree"); |
| 682 | |
| 683 | YangCodecRegistry.initializeDefaultCodec(); |
| 684 | DefaultYangCodecHandler codecHandler = |
| 685 | new DefaultYangCodecHandler(schemaRegistry); |
| 686 | String xml = codecHandler.encodeOperation("filter", "ydt.filter-type", |
| 687 | tagAttr, yangModuleList, |
| 688 | XML, null); |
| 689 | assertEquals(AM_XML + "empty-contain: container is not empty", |
| 690 | containerEmptyXml(), xml); |
| 691 | } |
| 692 | |
| 693 | /** |
| 694 | * Unit test case in which verifying xml string for module object with list |
| 695 | * inside list. |
| 696 | */ |
| 697 | @Test |
| 698 | public void proceessCodecHandlerForListInsideList() { |
| 699 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 700 | DefaultYangSchemaRegistry schemaRegistry = |
| 701 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 702 | List<Object> yangModuleList = new ArrayList<>(); |
| 703 | |
| 704 | // Creating the object |
| 705 | PathId pathId = new PathId(123); |
| 706 | Origin origin = new DefaultOrigin.OriginBuilder().value(pathId) |
| 707 | .build(); |
| 708 | MultiExitDisc multiExitDisc = new DefaultMultiExitDisc |
| 709 | .MultiExitDiscBuilder().med(456).build(); |
| 710 | LocalPref localPref = new DefaultLocalPref.LocalPrefBuilder() |
| 711 | .pref(23).build(); |
| 712 | Metric metric = new Metric(456); |
| 713 | AigpTlv aigpTlv = new DefaultAigpTlv.AigpTlvBuilder().metric(metric) |
| 714 | .build(); |
| 715 | Aigp aigp = new DefaultAigp.AigpBuilder().aigpTlv(aigpTlv).build(); |
| 716 | |
| 717 | UnrecognizedAttributes unrecognizedAttributes1 = |
| 718 | new DefaultUnrecognizedAttributes |
| 719 | .UnrecognizedAttributesBuilder() |
| 720 | .partial(false).transitive(false).type((short) 1) |
| 721 | .value("ABC".getBytes()).build(); |
| 722 | |
| 723 | UnrecognizedAttributes unrecognizedAttributes2 = |
| 724 | new DefaultUnrecognizedAttributes |
| 725 | .UnrecognizedAttributesBuilder() |
| 726 | .partial(true).transitive(true).type((short) 2) |
| 727 | .value("ABC".getBytes()) |
| 728 | .build(); |
| 729 | |
| 730 | UnrecognizedAttributes unrecognizedAttributes3 = |
| 731 | new DefaultUnrecognizedAttributes |
| 732 | .UnrecognizedAttributesBuilder() |
| 733 | .partial(true).transitive(false).type((short) 3) |
| 734 | .value("ABC".getBytes()) |
| 735 | .build(); |
| 736 | |
| 737 | UnrecognizedAttributes unrecognizedAttributes4 = |
| 738 | new DefaultUnrecognizedAttributes |
| 739 | .UnrecognizedAttributesBuilder() |
| 740 | .partial(false).transitive(true).type((short) 4) |
| 741 | .value("ABC".getBytes()).build(); |
| 742 | |
| 743 | AsNum asNum1 = new AsNum(11); |
| 744 | As4BytesCapability as4BytesCapability1 = |
| 745 | new DefaultAs4BytesCapability.As4BytesCapabilityBuilder() |
| 746 | .asNumber(asNum1).build(); |
| 747 | Cparameters cparameters1 = new DefaultCparameters.CparametersBuilder() |
| 748 | .as4BytesCapability(as4BytesCapability1) |
| 749 | .build(); |
| 750 | OptionalCapabilities optionalCapabilities1 = |
| 751 | new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder() |
| 752 | .cParameters(cparameters1).build(); |
| 753 | |
| 754 | AsNum asNum2 = new AsNum(22); |
| 755 | As4BytesCapability as4BytesCapability2 = |
| 756 | new DefaultAs4BytesCapability.As4BytesCapabilityBuilder() |
| 757 | .asNumber(asNum2).build(); |
| 758 | Cparameters cparameters2 = new DefaultCparameters.CparametersBuilder() |
| 759 | .as4BytesCapability(as4BytesCapability2) |
| 760 | .build(); |
| 761 | OptionalCapabilities optionalCapabilities2 = |
| 762 | new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder() |
| 763 | .cParameters(cparameters2).build(); |
| 764 | |
| 765 | AsNum asNum3 = new AsNum(33); |
| 766 | As4BytesCapability as4BytesCapability3 = |
| 767 | new DefaultAs4BytesCapability.As4BytesCapabilityBuilder() |
| 768 | .asNumber(asNum3).build(); |
| 769 | Cparameters cparameters3 = new DefaultCparameters.CparametersBuilder() |
| 770 | .as4BytesCapability(as4BytesCapability3) |
| 771 | .build(); |
| 772 | OptionalCapabilities optionalCapabilities3 = |
| 773 | new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder() |
| 774 | .cParameters(cparameters3).build(); |
| 775 | |
| 776 | BgpParameters bgpParameters1 = |
| 777 | new DefaultBgpParameters.BgpParametersBuilder() |
| 778 | .addToOptionalCapabilities(optionalCapabilities1) |
| 779 | .addToOptionalCapabilities(optionalCapabilities2) |
| 780 | .addToOptionalCapabilities(optionalCapabilities3) |
| 781 | .build(); |
| 782 | |
| 783 | AsNum asNum4 = new AsNum(11); |
| 784 | As4BytesCapability as4BytesCapability4 = new DefaultAs4BytesCapability |
| 785 | .As4BytesCapabilityBuilder() |
| 786 | .asNumber(asNum4).build(); |
| 787 | Cparameters cparameters4 = new DefaultCparameters.CparametersBuilder() |
| 788 | .as4BytesCapability(as4BytesCapability4) |
| 789 | .build(); |
| 790 | OptionalCapabilities optionalCapabilities4 = |
| 791 | new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder() |
| 792 | .cParameters(cparameters4).build(); |
| 793 | |
| 794 | AsNum asNum5 = new AsNum(22); |
| 795 | As4BytesCapability as4BytesCapability5 = |
| 796 | new DefaultAs4BytesCapability.As4BytesCapabilityBuilder() |
| 797 | .asNumber(asNum5).build(); |
| 798 | Cparameters cparameters5 = |
| 799 | new DefaultCparameters.CparametersBuilder() |
| 800 | .as4BytesCapability(as4BytesCapability5) |
| 801 | .build(); |
| 802 | OptionalCapabilities optionalCapabilities5 = |
| 803 | new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder() |
| 804 | .cParameters(cparameters5).build(); |
| 805 | |
| 806 | AsNum asNum6 = new AsNum(33); |
| 807 | As4BytesCapability as4BytesCapability6 = |
| 808 | new DefaultAs4BytesCapability.As4BytesCapabilityBuilder() |
| 809 | .asNumber(asNum6).build(); |
| 810 | Cparameters cparameters6 = |
| 811 | new DefaultCparameters.CparametersBuilder() |
| 812 | .as4BytesCapability(as4BytesCapability6) |
| 813 | .build(); |
| 814 | OptionalCapabilities optionalCapabilities6 = |
| 815 | new DefaultOptionalCapabilities.OptionalCapabilitiesBuilder() |
| 816 | .cParameters(cparameters6).build(); |
| 817 | |
| 818 | BgpParameters bgpParameters2 = |
| 819 | new DefaultBgpParameters.BgpParametersBuilder() |
| 820 | .addToOptionalCapabilities(optionalCapabilities4) |
| 821 | .addToOptionalCapabilities(optionalCapabilities5) |
| 822 | .addToOptionalCapabilities(optionalCapabilities6) |
| 823 | .build(); |
| 824 | |
| 825 | Attributes attributes = new DefaultAttributes.AttributesBuilder() |
| 826 | .origin(origin) |
| 827 | .multiExitDisc(multiExitDisc) |
| 828 | .localPref(localPref) |
| 829 | .aigp(aigp) |
| 830 | .addToUnrecognizedAttributes(unrecognizedAttributes1) |
| 831 | .addToUnrecognizedAttributes(unrecognizedAttributes2) |
| 832 | .addToUnrecognizedAttributes(unrecognizedAttributes3) |
| 833 | .addToUnrecognizedAttributes(unrecognizedAttributes4) |
| 834 | .addToBgpParameters(bgpParameters1) |
| 835 | .addToBgpParameters(bgpParameters2).build(); |
| 836 | Object object = CombinedOpParam.builder().attributes(attributes) |
| 837 | .build(); |
| 838 | |
| 839 | yangModuleList.add(object); |
| 840 | |
| 841 | // Get the xml string and compare |
| 842 | Map<String, String> tagAttr = new HashMap<String, String>(); |
| 843 | tagAttr.put("type", "subtree"); |
| 844 | |
| 845 | YangCodecRegistry.initializeDefaultCodec(); |
| 846 | DefaultYangCodecHandler codecHandler = |
| 847 | new DefaultYangCodecHandler(schemaRegistry); |
| 848 | String xml = codecHandler.encodeOperation("filter", "ydt.filter-type", |
| 849 | tagAttr, yangModuleList, |
| 850 | XML, null); |
| 851 | assertEquals(AM_XML + "combined: list info", listTestXml(), xml); |
| 852 | } |
| 853 | |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 854 | // TODO negative scenario will be handled later |
| 855 | /** |
| 856 | * Unit test case in which verifying xml string for module object with |
| 857 | * container. |
| 858 | */ |
| 859 | @Test |
| 860 | public void proceessCodecHandlerForContainer() { |
| 861 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 862 | DefaultYangSchemaRegistry schemaRegistry = |
| 863 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 864 | List<Object> yangModuleList = new ArrayList<>(); |
| 865 | |
| 866 | // Creating the object |
| 867 | YchPurchasingSupervisor supervisor = |
| 868 | new DefaultYchPurchasingSupervisor |
| 869 | .YchPurchasingSupervisorBuilder() |
| 870 | .ychPurchasingSpecialist("purchasingSpecialist") |
| 871 | .ychPurchasingSupport("support") |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 872 | .ychIsManager(DefaultYchIsManager.builder().build()) |
Sean Condon | b0720e7 | 2017-01-10 12:29:02 +0000 | [diff] [blame] | 873 | .yangYchPurchasingSupervisorOpType(OnosYangOpType.CREATE).build(); |
| 874 | Object object = YchPurchasingsupervisorOpParam.builder() |
| 875 | .ychPurchasingSupervisor(supervisor).build(); |
| 876 | yangModuleList.add(object); |
| 877 | |
| 878 | YangCodecRegistry.initializeDefaultCodec(); |
| 879 | DefaultYangCodecHandler codecHandler = |
| 880 | new DefaultYangCodecHandler(schemaRegistry); |
| 881 | String xml = codecHandler.encodeOperation("config", "urn:ietf:params:xml:ns:netconf:base:1.0", |
| 882 | null, yangModuleList, |
| 883 | XML, null); |
| 884 | assertEquals(AM_XML + "puchas-super: container info", purchaseXml(), |
| 885 | xml); |
| 886 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 887 | |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 888 | // /** |
| 889 | // * Unit test case in which verifying xml string for module object with |
| 890 | // * leaf list. |
| 891 | // */ |
| 892 | // @Test |
| 893 | // public void proceessCodecHandlerForLeafList() { |
| 894 | // testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 895 | // DefaultYangSchemaRegistry schemaRegistry = |
| 896 | // testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 897 | // List<Object> yangModuleList = new ArrayList<>(); |
| 898 | // |
| 899 | // // Creating the object |
| 900 | // EmployeeidOpParam.EmployeeidBuilder employeeidBuilder = |
| 901 | // EmployeeidOpParam.builder(); |
| 902 | // employeeidBuilder.addToEmployeeid("Employ1"); |
| 903 | // employeeidBuilder.addToEmployeeid("Employ2"); |
| 904 | // employeeidBuilder.addToEmployeeid("Employ3"); |
| 905 | // employeeidBuilder.addToEmployeeid("Employ4"); |
| 906 | // employeeidBuilder.addToEmployeeid("Employ5"); |
| 907 | // |
| 908 | // Object object = employeeidBuilder.build(); |
| 909 | // yangModuleList.add(object); |
| 910 | // |
| 911 | // // Get the xml string and compare |
| 912 | // YangCodecRegistry.initializeDefaultCodec(); |
| 913 | // DefaultYangCodecHandler codecHandler = |
| 914 | // new DefaultYangCodecHandler(schemaRegistry); |
| 915 | // String xml = codecHandler.encodeOperation("config", "ydt.root", null, |
| 916 | // yangModuleList, XML, null); |
| 917 | // assertEquals(AM_XML + "employ-id: leaf-list info", emplyIdXml(), xml); |
| 918 | // WarehousesupervisorOpParam.WarehousesupervisorBuilder warehsebldr = |
| 919 | // WarehousesupervisorOpParam.builder(); |
| 920 | // warehsebldr.addToSupervisor("supervisor1"); |
| 921 | // warehsebldr.addToSupervisor("supervisor2"); |
| 922 | // warehsebldr.addToSupervisor("supervisor3"); |
| 923 | // warehsebldr.addToSupervisor("supervisor4"); |
| 924 | // warehsebldr.addToSupervisor("supervisor5"); |
| 925 | // |
| 926 | // object = warehsebldr.build(); |
| 927 | // yangModuleList.clear(); |
| 928 | // yangModuleList.add(object); |
| 929 | // |
| 930 | // |
| 931 | // // Get the xml string and compare |
| 932 | // xml = codecHandler.encodeOperation("config", "ydt.root", null, |
| 933 | // yangModuleList, XML, null); |
| 934 | // |
| 935 | // assertEquals(AM_XML + "warehouse-super: leaf-list info", wareHseXml(), |
| 936 | // xml); |
| 937 | // } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 938 | |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 939 | // /** |
| 940 | // * Unit test case in which verifying xml string for multiple module object. |
| 941 | // */ |
| 942 | // @Test |
| 943 | // public void proceessCodecHandlerForMultipleModule() { |
| 944 | // testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 945 | // DefaultYangSchemaRegistry schemaRegistry = |
| 946 | // testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 947 | // |
| 948 | // List<Object> yangModuleList = new ArrayList<>(); |
| 949 | // YangCodecRegistry.initializeDefaultCodec(); |
| 950 | // DefaultYangCodecHandler codecHandler = |
| 951 | // new DefaultYangCodecHandler(schemaRegistry); |
| 952 | // |
| 953 | // // Creating the object for customssupervisor module |
| 954 | // Object object = CustomssupervisorOpParam.builder() |
| 955 | // .supervisor("Customssupervisor").build(); |
| 956 | // yangModuleList.add(object); |
| 957 | // |
| 958 | // // Creating the object for merchandisersupervisor module |
| 959 | // object = MerchandisersupervisorOpParam.builder() |
| 960 | // .supervisor("Merchandisersupervisor").build(); |
| 961 | // yangModuleList.add(object); |
| 962 | // |
| 963 | // // Creating the object for materialsupervisor module |
| 964 | // Supervisor supervisor1 = new DefaultSupervisor.SupervisorBuilder() |
| 965 | // .name("abc1").departmentId("xyz1").build(); |
| 966 | // Supervisor supervisor2 = new DefaultSupervisor.SupervisorBuilder() |
| 967 | // .name("abc2").departmentId("xyz2").build(); |
| 968 | // Supervisor supervisor3 = new DefaultSupervisor.SupervisorBuilder() |
| 969 | // .name("abc3").departmentId("xyz3").build(); |
| 970 | // Supervisor supervisor4 = new DefaultSupervisor.SupervisorBuilder() |
| 971 | // .name("abc4").departmentId("xyz4").build(); |
| 972 | // Supervisor supervisor5 = new DefaultSupervisor.SupervisorBuilder() |
| 973 | // .name("abc5").departmentId("xyz5").build(); |
| 974 | // |
| 975 | // object = MaterialsupervisorOpParam.builder() |
| 976 | // .addToSupervisor(supervisor1) |
| 977 | // .addToSupervisor(supervisor2) |
| 978 | // .addToSupervisor(supervisor3) |
| 979 | // .addToSupervisor(supervisor4) |
| 980 | // .addToSupervisor(supervisor5).build(); |
| 981 | // |
| 982 | // yangModuleList.add(object); |
| 983 | // |
| 984 | // // Creating the object for YchPurchasingsupervisor module |
| 985 | // YchPurchasingSupervisor purSupervisor = |
| 986 | // new DefaultYchPurchasingSupervisor |
| 987 | // .YchPurchasingSupervisorBuilder() |
| 988 | // .ychPurchasingSpecialist("purchasingSpecialist") |
| 989 | // .ychPurchasingSupport("support").build(); |
| 990 | // object = YchPurchasingsupervisorOpParam.builder() |
| 991 | // .ychPurchasingSupervisor(purSupervisor).build(); |
| 992 | // yangModuleList.add(object); |
| 993 | // |
| 994 | // // Creating the object for warehousesupervisor module |
| 995 | // WarehousesupervisorOpParam.WarehousesupervisorBuilder warehsebldr = |
| 996 | // WarehousesupervisorOpParam.builder(); |
| 997 | // warehsebldr.addToSupervisor("supervisor1"); |
| 998 | // warehsebldr.addToSupervisor("supervisor2"); |
| 999 | // warehsebldr.addToSupervisor("supervisor3"); |
| 1000 | // warehsebldr.addToSupervisor("supervisor4"); |
| 1001 | // warehsebldr.addToSupervisor("supervisor5"); |
| 1002 | // |
| 1003 | // object = warehsebldr.build(); |
| 1004 | // yangModuleList.add(object); |
| 1005 | // |
| 1006 | // // Creating the object for tradingsupervisor module |
| 1007 | // object = TradingsupervisorOpParam.builder() |
| 1008 | // .supervisor("Tradingsupervisor").build(); |
| 1009 | // yangModuleList.add(object); |
| 1010 | // |
| 1011 | // List<String> employeeid = EmployeeidOpParam.builder().employeeid(); |
| 1012 | // if (employeeid == null) { |
| 1013 | // employeeid = new ArrayList<>(); |
| 1014 | // } |
| 1015 | // employeeid.add("Employ1"); |
| 1016 | // employeeid.add("Employ2"); |
| 1017 | // employeeid.add("Employ3"); |
| 1018 | // employeeid.add("Employ4"); |
| 1019 | // employeeid.add("Employ5"); |
| 1020 | // |
| 1021 | // // Creating the object for employeeid module |
| 1022 | // object = EmployeeidOpParam.builder().employeeid(employeeid).build(); |
| 1023 | // yangModuleList.add(object); |
| 1024 | // |
| 1025 | // // Get the xml string and compare |
| 1026 | // String xml = codecHandler.encodeOperation("config", "ydt.root", null, |
| 1027 | // yangModuleList, XML, null); |
| 1028 | // assertEquals(AM_XML + "multiple: module info", multiModuleXml(), xml); |
| 1029 | // } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1030 | |
| 1031 | /** |
| 1032 | * Unit test case in which verifying object for xml string with config as |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1033 | * root name and multiple module. |
| 1034 | */ |
| 1035 | @Test |
| 1036 | public void proceessCodecDecodeFunctionForListInsideList() { |
| 1037 | String path = "src/test/resources/ychTestResourceFiles/combinedrootname.xml"; |
| 1038 | StringBuilder sb = new StringBuilder(); |
| 1039 | String sCurrentLine; |
| 1040 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1041 | DefaultYangSchemaRegistry schemaRegistry = |
| 1042 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1043 | |
| 1044 | YangCodecRegistry.initializeDefaultCodec(); |
| 1045 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1046 | new DefaultYangCodecHandler(schemaRegistry); |
| 1047 | |
| 1048 | try (BufferedReader br = new BufferedReader(new FileReader(path))) { |
| 1049 | |
| 1050 | while ((sCurrentLine = br.readLine()) != null) { |
| 1051 | sb.append(sCurrentLine); |
| 1052 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1053 | } catch (IOException e) { |
| 1054 | e.printStackTrace(); |
| 1055 | } |
| 1056 | |
| 1057 | // TODO YOB and YTB need to do some changes for binary |
| 1058 | // Verify the received object list |
| 1059 | /*objectList = defaultYangCodecHandler.decode(sb.toString(), |
| 1060 | XML_ENCODING, |
| 1061 | EDIT_CONFIG_REQUEST); |
| 1062 | Iterator<Object> iterator = objectList.iterator(); |
| 1063 | while (iterator.hasNext()) { |
| 1064 | Object object = iterator.next(); |
| 1065 | if (object.getClass().getSimpleName().equals("CombinedOpParam")) { |
| 1066 | CombinedOpParam combinedOpParam = (CombinedOpParam) object; |
| 1067 | |
| 1068 | PathId pathId = new PathId(123); |
| 1069 | Origin origin = new DefaultOrigin.OriginBuilder() |
| 1070 | .value(pathId).build(); |
| 1071 | assertTrue(combinedOpParam.attributes().origin() |
| 1072 | .equals(origin)); |
| 1073 | |
| 1074 | MultiExitDisc multiExitDisc = new DefaultMultiExitDisc |
| 1075 | .MultiExitDiscBuilder().med(456).build(); |
| 1076 | assertTrue(combinedOpParam.attributes().multiExitDisc() |
| 1077 | .equals(multiExitDisc)); |
| 1078 | |
| 1079 | LocalPref localPref = new DefaultLocalPref.LocalPrefBuilder() |
| 1080 | .pref(23).build(); |
| 1081 | assertTrue(combinedOpParam.attributes().localPref() |
| 1082 | .equals(localPref)); |
| 1083 | |
| 1084 | Metric metric = new Metric(456); |
| 1085 | AigpTlv aigpTlv = new DefaultAigpTlv.AigpTlvBuilder() |
| 1086 | .metric(metric).build(); |
| 1087 | Aigp aigp = new DefaultAigp.AigpBuilder().aigpTlv(aigpTlv) |
| 1088 | .build(); |
| 1089 | assertTrue(combinedOpParam.attributes().aigp().equals(aigp)); |
| 1090 | |
| 1091 | UnrecognizedAttributes unrecognizedAttributes1 = |
| 1092 | new DefaultUnrecognizedAttributes |
| 1093 | .UnrecognizedAttributesBuilder() |
| 1094 | .partial(false).transitive(false).type((short) 1) |
| 1095 | .value("ABC".getBytes()).build(); |
| 1096 | |
| 1097 | UnrecognizedAttributes unrecognizedAttributes2 = |
| 1098 | new DefaultUnrecognizedAttributes |
| 1099 | .UnrecognizedAttributesBuilder() |
| 1100 | .partial(true).transitive(true).type((short) 2) |
| 1101 | .value("BCA".getBytes()).build(); |
| 1102 | |
| 1103 | UnrecognizedAttributes unrecognizedAttributes3 = |
| 1104 | new DefaultUnrecognizedAttributes |
| 1105 | .UnrecognizedAttributesBuilder() |
| 1106 | .partial(true).transitive(false).type((short) 3) |
| 1107 | .value("CAB".getBytes()).build(); |
| 1108 | |
| 1109 | UnrecognizedAttributes unrecognizedAttributes4 = |
| 1110 | new DefaultUnrecognizedAttributes |
| 1111 | .UnrecognizedAttributesBuilder() |
| 1112 | .partial(false).transitive(true).type((short) 4) |
| 1113 | .value("111".getBytes()).build(); |
| 1114 | |
| 1115 | AsNum asNum1 = new AsNum(11); |
| 1116 | As4BytesCapability as4BytesCapability1 = |
| 1117 | new DefaultAs4BytesCapability |
| 1118 | .As4BytesCapabilityBuilder() |
| 1119 | .asNumber(asNum1).build(); |
| 1120 | Cparameters cparameters1 = new DefaultCparameters |
| 1121 | .CparametersBuilder() |
| 1122 | .as4BytesCapability(as4BytesCapability1) |
| 1123 | .build(); |
| 1124 | OptionalCapabilities optionalCapabilities1 = |
| 1125 | new DefaultOptionalCapabilities |
| 1126 | .OptionalCapabilitiesBuilder() |
| 1127 | .cParameters(cparameters1).build(); |
| 1128 | |
| 1129 | AsNum asNum2 = new AsNum(22); |
| 1130 | As4BytesCapability as4BytesCapability2 = |
| 1131 | new DefaultAs4BytesCapability |
| 1132 | .As4BytesCapabilityBuilder() |
| 1133 | .asNumber(asNum2).build(); |
| 1134 | Cparameters cparameters2 = new DefaultCparameters |
| 1135 | .CparametersBuilder() |
| 1136 | .as4BytesCapability(as4BytesCapability2) |
| 1137 | .build(); |
| 1138 | OptionalCapabilities optionalCapabilities2 = |
| 1139 | new DefaultOptionalCapabilities |
| 1140 | .OptionalCapabilitiesBuilder() |
| 1141 | .cParameters(cparameters2).build(); |
| 1142 | |
| 1143 | AsNum asNum3 = new AsNum(33); |
| 1144 | As4BytesCapability as4BytesCapability3 = |
| 1145 | new DefaultAs4BytesCapability |
| 1146 | .As4BytesCapabilityBuilder() |
| 1147 | .asNumber(asNum3).build(); |
| 1148 | Cparameters cparameters3 = |
| 1149 | new DefaultCparameters.CparametersBuilder() |
| 1150 | .as4BytesCapability(as4BytesCapability3) |
| 1151 | .build(); |
| 1152 | OptionalCapabilities optionalCapabilities3 = |
| 1153 | new DefaultOptionalCapabilities |
| 1154 | .OptionalCapabilitiesBuilder() |
| 1155 | .cParameters(cparameters3).build(); |
| 1156 | |
| 1157 | BgpParameters bgpParameters1 = |
| 1158 | new DefaultBgpParameters.BgpParametersBuilder() |
| 1159 | .addToOptionalCapabilities(optionalCapabilities1) |
| 1160 | .addToOptionalCapabilities(optionalCapabilities2) |
| 1161 | .addToOptionalCapabilities(optionalCapabilities3) |
| 1162 | .build(); |
| 1163 | |
| 1164 | AsNum asNum4 = new AsNum(11); |
| 1165 | As4BytesCapability as4BytesCapability4 = |
| 1166 | new DefaultAs4BytesCapability |
| 1167 | .As4BytesCapabilityBuilder() |
| 1168 | .asNumber(asNum4).build(); |
| 1169 | Cparameters cparameters4 = |
| 1170 | new DefaultCparameters.CparametersBuilder() |
| 1171 | .as4BytesCapability(as4BytesCapability4) |
| 1172 | .build(); |
| 1173 | OptionalCapabilities optionalCapabilities4 = |
| 1174 | new DefaultOptionalCapabilities |
| 1175 | .OptionalCapabilitiesBuilder() |
| 1176 | .cParameters(cparameters4).build(); |
| 1177 | |
| 1178 | AsNum asNum5 = new AsNum(22); |
| 1179 | As4BytesCapability as4BytesCapability5 = |
| 1180 | new DefaultAs4BytesCapability |
| 1181 | .As4BytesCapabilityBuilder() |
| 1182 | .asNumber(asNum5).build(); |
| 1183 | Cparameters cparameters5 = |
| 1184 | new DefaultCparameters.CparametersBuilder() |
| 1185 | .as4BytesCapability(as4BytesCapability5) |
| 1186 | .build(); |
| 1187 | OptionalCapabilities optionalCapabilities5 = |
| 1188 | new DefaultOptionalCapabilities |
| 1189 | .OptionalCapabilitiesBuilder() |
| 1190 | .cParameters(cparameters5).build(); |
| 1191 | |
| 1192 | AsNum asNum6 = new AsNum(33); |
| 1193 | As4BytesCapability as4BytesCapability6 = |
| 1194 | new DefaultAs4BytesCapability |
| 1195 | .As4BytesCapabilityBuilder() |
| 1196 | .asNumber(asNum6).build(); |
| 1197 | Cparameters cparameters6 = |
| 1198 | new DefaultCparameters.CparametersBuilder() |
| 1199 | .as4BytesCapability(as4BytesCapability6) |
| 1200 | .build(); |
| 1201 | OptionalCapabilities optionalCapabilities6 = |
| 1202 | new DefaultOptionalCapabilities |
| 1203 | .OptionalCapabilitiesBuilder() |
| 1204 | .cParameters(cparameters6).build(); |
| 1205 | |
| 1206 | BgpParameters bgpParameters2 = |
| 1207 | new DefaultBgpParameters.BgpParametersBuilder() |
| 1208 | .addToOptionalCapabilities(optionalCapabilities4) |
| 1209 | .addToOptionalCapabilities(optionalCapabilities5) |
| 1210 | .addToOptionalCapabilities(optionalCapabilities6) |
| 1211 | .build(); |
| 1212 | |
| 1213 | Attributes attributes = |
| 1214 | new DefaultAttributes.AttributesBuilder() |
| 1215 | .origin(origin) |
| 1216 | .multiExitDisc(multiExitDisc) |
| 1217 | .localPref(localPref) |
| 1218 | .aigp(aigp) |
| 1219 | .addToUnrecognizedAttributes(unrecognizedAttributes1) |
| 1220 | .addToUnrecognizedAttributes(unrecognizedAttributes2) |
| 1221 | .addToUnrecognizedAttributes(unrecognizedAttributes3) |
| 1222 | .addToUnrecognizedAttributes(unrecognizedAttributes4) |
| 1223 | .addToBgpParameters(bgpParameters1) |
| 1224 | .addToBgpParameters(bgpParameters2).build(); |
| 1225 | } else { |
| 1226 | assertTrue(false); |
| 1227 | } |
| 1228 | }*/ |
| 1229 | } |
| 1230 | |
sonu gupta | eff184b | 2016-11-24 12:43:49 +0530 | [diff] [blame] | 1231 | // /** |
| 1232 | // * Unit test case in which verifying object for xml string with config as root name and |
| 1233 | // * operation type. |
| 1234 | // */ |
| 1235 | // @Test |
| 1236 | // public void proceessCodecDecodeFunctionForOperTypeTest() { |
| 1237 | // String path = "src/test/resources/ychTestResourceFiles/configrootnameOperationType.xml"; |
| 1238 | // testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1239 | // DefaultYangSchemaRegistry schemaRegistry = |
| 1240 | // testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1241 | // |
| 1242 | // YangCodecRegistry.initializeDefaultCodec(); |
| 1243 | // DefaultYangCodecHandler defaultYangCodecHandler = |
| 1244 | // new DefaultYangCodecHandler(schemaRegistry); |
| 1245 | // |
| 1246 | // StringBuilder sb = new StringBuilder(); |
| 1247 | // String sCurrentLine; |
| 1248 | // |
| 1249 | // try (BufferedReader br = new BufferedReader(new FileReader(path))) { |
| 1250 | // |
| 1251 | // while ((sCurrentLine = br.readLine()) != null) { |
| 1252 | // sb.append(sCurrentLine); |
| 1253 | // } |
| 1254 | // |
| 1255 | // } catch (IOException e) { |
| 1256 | // e.printStackTrace(); |
| 1257 | // } |
| 1258 | // |
| 1259 | // // Verify the received object list |
| 1260 | // List<Object> objectList = |
| 1261 | // defaultYangCodecHandler.decode(sb.toString(), |
| 1262 | // XML, EDIT_CONFIG_REQUEST); |
| 1263 | // Iterator<Object> iterator = objectList.iterator(); |
| 1264 | // while (iterator.hasNext()) { |
| 1265 | // Object object = iterator.next(); |
| 1266 | // if (object.getClass().getSimpleName() |
| 1267 | // .equals(LOGISTIC_MOD)) { |
| 1268 | // LogisticsManagerOpParam logistics = |
| 1269 | // (LogisticsManagerOpParam) object; |
| 1270 | // DefaultPurchasingSupervisor purchasingSupervisor = |
| 1271 | // (DefaultPurchasingSupervisor) logistics |
| 1272 | // .purchasingSupervisor(); |
| 1273 | // |
| 1274 | // assertEquals(AM_OBJ + "purchase-super: operation type", DELETE, |
| 1275 | // purchasingSupervisor.yangPurchasingSupervisorOpType()); |
| 1276 | // assertEquals(AM_OBJ + "customs-super: leaf value", "abc", |
| 1277 | // logistics.customsSupervisor()); |
| 1278 | // assertEquals(AM_OBJ + "purchase-spec: leaf value", "bcd", |
| 1279 | // logistics.purchasingSupervisor() |
| 1280 | // .purchasingSpecialist()); |
| 1281 | // assertEquals(AM_OBJ + "purchase-support: leaf value", |
| 1282 | // "cde", logistics.purchasingSupervisor() |
| 1283 | // .support()); |
| 1284 | // |
| 1285 | // } else if (object.getClass().getSimpleName() |
| 1286 | // .equals(MERCHA_MOD)) { |
| 1287 | // MerchandisersupervisorOpParam merchandisersupervisorOpParam = |
| 1288 | // (MerchandisersupervisorOpParam) object; |
| 1289 | // assertEquals(AM_OBJ + "merchandiser-super: leaf value", |
| 1290 | // "abc", merchandisersupervisorOpParam.supervisor()); |
| 1291 | // } else { |
| 1292 | // assertEquals(AM_OBJ, LOGISTIC_MOD, object |
| 1293 | // .getClass().getSimpleName()); |
| 1294 | // assertEquals(AM_OBJ, MERCHA_MOD, object |
| 1295 | // .getClass().getSimpleName()); |
| 1296 | // } |
| 1297 | // } |
| 1298 | // } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1299 | |
| 1300 | /** |
| 1301 | * Validate the leaf value for purchasing specialist. |
| 1302 | * |
| 1303 | * @param objectList object list |
| 1304 | */ |
| 1305 | private void processPurchasingSpecObj(List<Object> objectList) { |
| 1306 | Iterator<Object> iterator = objectList.iterator(); |
| 1307 | while (iterator.hasNext()) { |
| 1308 | Object object = iterator.next(); |
Jon Hall | a3fcf67 | 2017-03-28 16:53:22 -0700 | [diff] [blame] | 1309 | if ("LogisticsManagerOpParam".equals(object.getClass().getSimpleName())) { |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1310 | LogisticsManagerOpParam logisticsManagerOpParam = |
| 1311 | (LogisticsManagerOpParam) object; |
| 1312 | assertEquals(AM_OBJ + "purchasing-spec: leaf value", "bcd", |
| 1313 | logisticsManagerOpParam.purchasingSupervisor() |
| 1314 | .purchasingSpecialist()); |
| 1315 | } else { |
| 1316 | assertEquals(AM_OBJ, "LogisticsManagerOpParam", object |
| 1317 | .getClass().getSimpleName()); |
| 1318 | } |
| 1319 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1320 | } |
| 1321 | |
| 1322 | /** |
| 1323 | * Validate the leaf value for merchandiser supervisor. |
| 1324 | * |
| 1325 | * @param objectList object list |
| 1326 | */ |
| 1327 | private void processMerchandiserObj(List<Object> objectList) { |
| 1328 | Iterator<Object> iterator = objectList.iterator(); |
| 1329 | while (iterator.hasNext()) { |
| 1330 | Object object = iterator.next(); |
| 1331 | if (object.getClass().getSimpleName() |
| 1332 | .equals(MERCHA_MOD)) { |
| 1333 | MerchandisersupervisorOpParam merchandisersupervisorOpParam = |
| 1334 | (MerchandisersupervisorOpParam) object; |
| 1335 | assertEquals(AM_OBJ + "merchandiser-super: leaf value", "abc", |
| 1336 | merchandisersupervisorOpParam.supervisor()); |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1337 | } else { |
| 1338 | assertEquals(AM_OBJ, MERCHA_MOD, object |
| 1339 | .getClass().getSimpleName()); |
| 1340 | } |
| 1341 | } |
| 1342 | } |
| 1343 | |
| 1344 | /** |
| 1345 | * Unit test case in which verifying object for xml string with get and |
| 1346 | * filter as root name. |
| 1347 | */ |
| 1348 | @Test |
| 1349 | public void proceessCodecDecodeFunctionForGet() { |
| 1350 | String path = "src/test/resources/ychTestResourceFiles/getrootname.xml"; |
| 1351 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1352 | DefaultYangSchemaRegistry schemaRegistry = |
| 1353 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1354 | |
| 1355 | YangCodecRegistry.initializeDefaultCodec(); |
| 1356 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1357 | new DefaultYangCodecHandler(schemaRegistry); |
| 1358 | |
| 1359 | StringBuilder sb = new StringBuilder(); |
| 1360 | String sCurrentLine; |
| 1361 | |
| 1362 | try (BufferedReader br = new BufferedReader(new FileReader(path))) { |
| 1363 | |
| 1364 | while ((sCurrentLine = br.readLine()) != null) { |
| 1365 | sb.append(sCurrentLine); |
| 1366 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1367 | } catch (IOException e) { |
| 1368 | e.printStackTrace(); |
| 1369 | } |
| 1370 | |
| 1371 | // Verify the received object list |
| 1372 | List<Object> objectList = |
| 1373 | defaultYangCodecHandler.decode(sb.toString(), |
| 1374 | XML, QUERY_REQUEST); |
| 1375 | processPurchasingSpecObj(objectList); |
| 1376 | } |
| 1377 | |
| 1378 | /** |
| 1379 | * Unit test case in which verifying object for xml string with get-config |
| 1380 | * and filter as root name. |
| 1381 | */ |
| 1382 | @Test |
| 1383 | public void proceessCodecDecodeFunctionForGetConfig() { |
| 1384 | String path = "src/test/resources/ychTestResourceFiles/getconfigrootname.xml"; |
| 1385 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1386 | DefaultYangSchemaRegistry schemaRegistry = |
| 1387 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1388 | |
| 1389 | YangCodecRegistry.initializeDefaultCodec(); |
| 1390 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1391 | new DefaultYangCodecHandler(schemaRegistry); |
| 1392 | |
| 1393 | StringBuilder sb = new StringBuilder(); |
| 1394 | String sCurrentLine; |
| 1395 | |
| 1396 | try (BufferedReader br = new BufferedReader(new FileReader(path))) { |
| 1397 | |
| 1398 | while ((sCurrentLine = br.readLine()) != null) { |
| 1399 | sb.append(sCurrentLine); |
| 1400 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1401 | } catch (IOException e) { |
| 1402 | e.printStackTrace(); |
| 1403 | } |
| 1404 | |
| 1405 | // Verify the received object list |
| 1406 | List<Object> objectList = defaultYangCodecHandler.decode( |
| 1407 | sb.toString(), |
| 1408 | XML, QUERY_CONFIG_REQUEST); |
| 1409 | processMerchandiserObj(objectList); |
| 1410 | } |
| 1411 | |
| 1412 | /** |
| 1413 | * Unit test case in which verifying object for xml string with data as |
| 1414 | * root name. |
| 1415 | */ |
| 1416 | @Test |
| 1417 | public void proceessCodecDecodeFunctionForGetData() { |
| 1418 | String path = "src/test/resources/ychTestResourceFiles/getReply.xml"; |
| 1419 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1420 | DefaultYangSchemaRegistry schemaRegistry = |
| 1421 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1422 | |
| 1423 | YangCodecRegistry.initializeDefaultCodec(); |
| 1424 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1425 | new DefaultYangCodecHandler(schemaRegistry); |
| 1426 | |
| 1427 | StringBuilder sb = new StringBuilder(); |
| 1428 | String sCurrentLine; |
| 1429 | |
| 1430 | try (BufferedReader br = new BufferedReader(new FileReader(path))) { |
| 1431 | |
| 1432 | while ((sCurrentLine = br.readLine()) != null) { |
| 1433 | sb.append(sCurrentLine); |
| 1434 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1435 | } catch (IOException e) { |
| 1436 | e.printStackTrace(); |
| 1437 | } |
| 1438 | |
| 1439 | // Verify the received object list |
| 1440 | List<Object> objectList = defaultYangCodecHandler.decode( |
| 1441 | sb.toString(), |
| 1442 | XML, QUERY_CONFIG_REQUEST); |
| 1443 | processPurchasingSpecObj(objectList); |
| 1444 | } |
| 1445 | |
| 1446 | /** |
| 1447 | * Unit test case in which verifying object for xml string with rpc-reply |
| 1448 | * and data as root name . |
| 1449 | */ |
| 1450 | @Test |
| 1451 | public void proceessCodecDecodeFunctionForGetConfigData() { |
| 1452 | String path = "src/test/resources/ychTestResourceFiles/getconfigReply.xml"; |
| 1453 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1454 | DefaultYangSchemaRegistry schemaRegistry = |
| 1455 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1456 | |
| 1457 | YangCodecRegistry.initializeDefaultCodec(); |
| 1458 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1459 | new DefaultYangCodecHandler(schemaRegistry); |
| 1460 | |
| 1461 | StringBuilder sb = new StringBuilder(); |
| 1462 | String sCurrentLine; |
| 1463 | |
| 1464 | try (BufferedReader br = new BufferedReader(new FileReader(path))) { |
| 1465 | |
| 1466 | while ((sCurrentLine = br.readLine()) != null) { |
| 1467 | sb.append(sCurrentLine); |
| 1468 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1469 | } catch (IOException e) { |
| 1470 | e.printStackTrace(); |
| 1471 | } |
| 1472 | |
| 1473 | // Verify the received object list |
| 1474 | List<Object> objectList = defaultYangCodecHandler.decode(sb.toString(), |
| 1475 | XML, null); |
| 1476 | processMerchandiserObj(objectList); |
| 1477 | } |
Sean Condon | fe6ceba | 2017-02-26 16:40:03 +0000 | [diff] [blame] | 1478 | |
| 1479 | @Test |
| 1480 | public void proceessCodecDecodeFunctionForPresenceContainer() { |
| 1481 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1482 | DefaultYangSchemaRegistry schemaRegistry = |
| 1483 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1484 | |
| 1485 | YangCodecRegistry.initializeDefaultCodec(); |
| 1486 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1487 | new DefaultYangCodecHandler(schemaRegistry); |
| 1488 | |
| 1489 | // Verify the received object list |
| 1490 | List<Object> objectList = defaultYangCodecHandler.decode(purchaseXml(), |
| 1491 | XML, null); |
| 1492 | assertNotNull(objectList); |
| 1493 | Iterator<Object> iterator = objectList.iterator(); |
| 1494 | while (iterator.hasNext()) { |
| 1495 | Object object = iterator.next(); |
| 1496 | if (object.getClass().getSimpleName().equals(PURCH_MOD)) { |
| 1497 | YchPurchasingsupervisorOpParam purchasingsupervisorOpParam = |
| 1498 | (YchPurchasingsupervisorOpParam) object; |
| 1499 | assertEquals(AM_OBJ + "purchasing-specialist: leaf value", "purchasingSpecialist", |
| 1500 | purchasingsupervisorOpParam.ychPurchasingSupervisor().ychPurchasingSpecialist()); |
| 1501 | assertEquals(AM_OBJ + "purchasing-support: leaf value", "support", |
| 1502 | purchasingsupervisorOpParam.ychPurchasingSupervisor().ychPurchasingSupport()); |
| 1503 | assertNotNull(AM_OBJ + "purchasing-manager: leaf value", |
| 1504 | purchasingsupervisorOpParam.ychPurchasingSupervisor().ychIsManager()); |
| 1505 | } else { |
| 1506 | assertEquals(AM_OBJ, PURCH_MOD, object.getClass().getSimpleName()); |
| 1507 | } |
| 1508 | } |
| 1509 | } |
| 1510 | |
| 1511 | @Test |
| 1512 | public void proceessCodecDecodeFunctionForSelectionNode() { |
| 1513 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1514 | DefaultYangSchemaRegistry schemaRegistry = |
| 1515 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1516 | |
| 1517 | YangCodecRegistry.initializeDefaultCodec(); |
| 1518 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1519 | new DefaultYangCodecHandler(schemaRegistry); |
| 1520 | |
| 1521 | // Verify the received object list |
| 1522 | List<Object> objectList = defaultYangCodecHandler.decode( |
| 1523 | purchaseXmlEmptySelectionNode(), XML, null); |
| 1524 | assertNotNull(objectList); |
| 1525 | Iterator<Object> iterator = objectList.iterator(); |
| 1526 | while (iterator.hasNext()) { |
| 1527 | Object object = iterator.next(); |
| 1528 | if (object.getClass().getSimpleName().equals(PURCH_MOD)) { |
| 1529 | YchPurchasingsupervisorOpParam purchasingsupervisorOpParam = |
| 1530 | (YchPurchasingsupervisorOpParam) object; |
| 1531 | assertNull(AM_OBJ + "purchasing-specialist: leaf value not empty", |
| 1532 | purchasingsupervisorOpParam. |
| 1533 | ychPurchasingSupervisor().ychPurchasingSpecialist()); |
| 1534 | } else { |
| 1535 | assertEquals(AM_OBJ, PURCH_MOD, object.getClass().getSimpleName()); |
| 1536 | } |
| 1537 | } |
| 1538 | } |
| 1539 | |
| 1540 | @Test |
| 1541 | public void proceessCodecDecodeFunctionForBitmaskContainer() { |
| 1542 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1543 | DefaultYangSchemaRegistry schemaRegistry = |
| 1544 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1545 | |
| 1546 | YangCodecRegistry.initializeDefaultCodec(); |
| 1547 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1548 | new DefaultYangCodecHandler(schemaRegistry); |
| 1549 | |
| 1550 | BitSet purchaseOptions = new BitSet(4); |
| 1551 | purchaseOptions.set(1); //option1 |
| 1552 | purchaseOptions.set(3); //option3 |
| 1553 | |
| 1554 | // Verify the received object list |
| 1555 | List<Object> objectList = defaultYangCodecHandler.decode( |
| 1556 | purchaseXmlOptions(purchaseOptions), XML, null); |
| 1557 | assertNotNull(objectList); |
| 1558 | Iterator<Object> iterator = objectList.iterator(); |
| 1559 | while (iterator.hasNext()) { |
| 1560 | Object object = iterator.next(); |
| 1561 | if (object.getClass().getSimpleName().equals(PURCH_MOD)) { |
| 1562 | YchPurchasingsupervisorOpParam purchasingsupervisorOpParam = |
| 1563 | (YchPurchasingsupervisorOpParam) object; |
| 1564 | assertEquals(AM_OBJ + "purchasing-support: leaf value", "support", |
| 1565 | purchasingsupervisorOpParam.ychPurchasingSupervisor().ychPurchasingSupport()); |
| 1566 | assertEquals(AM_OBJ + "ych-puchasing-options: leaf value", |
| 1567 | purchaseOptions, |
| 1568 | purchasingsupervisorOpParam.ychPurchasingSupervisor().ychPurchasingOptions()); |
| 1569 | } else { |
| 1570 | assertEquals(AM_OBJ, PURCH_MOD, object.getClass().getSimpleName()); |
| 1571 | } |
| 1572 | } |
| 1573 | } |
| 1574 | |
| 1575 | @Test |
| 1576 | public void proceessCodecDecodeFunctionForEmptyBitmask() { |
| 1577 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 1578 | DefaultYangSchemaRegistry schemaRegistry = |
| 1579 | testYangSchemaNodeProvider.getDefaultYangSchemaRegistry(); |
| 1580 | |
| 1581 | YangCodecRegistry.initializeDefaultCodec(); |
| 1582 | DefaultYangCodecHandler defaultYangCodecHandler = |
| 1583 | new DefaultYangCodecHandler(schemaRegistry); |
| 1584 | |
| 1585 | // Verify the received object list |
| 1586 | List<Object> objectList = defaultYangCodecHandler.decode( |
| 1587 | purchaseXmlOptions(null), XML, null); |
| 1588 | assertNotNull(objectList); |
| 1589 | Iterator<Object> iterator = objectList.iterator(); |
| 1590 | while (iterator.hasNext()) { |
| 1591 | Object object = iterator.next(); |
| 1592 | if (object.getClass().getSimpleName().equals(PURCH_MOD)) { |
| 1593 | YchPurchasingsupervisorOpParam purchasingsupervisorOpParam = |
| 1594 | (YchPurchasingsupervisorOpParam) object; |
| 1595 | assertEquals(AM_OBJ + "purchasing-support: leaf value", "support", |
| 1596 | purchasingsupervisorOpParam.ychPurchasingSupervisor().ychPurchasingSupport()); |
| 1597 | assertNull(AM_OBJ + "ych-puchasing-options: leaf value empty", |
| 1598 | purchasingsupervisorOpParam.ychPurchasingSupervisor().ychPurchasingOptions()); |
| 1599 | } else { |
| 1600 | assertEquals(AM_OBJ, PURCH_MOD, object.getClass().getSimpleName()); |
| 1601 | } |
| 1602 | } |
| 1603 | } |
Shankara-Huawei | d5823ab | 2016-11-22 10:14:52 +0530 | [diff] [blame] | 1604 | } |