1 package jtest.org.onap.ccsdk.sli.plugins.prop;
3 import java.util.HashMap;
4 import java.util.HashSet;
9 import static org.junit.Assert.assertEquals;
10 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
11 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
12 import org.onap.ccsdk.sli.plugins.prop.PropertiesNode;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
16 public class TestPropertiesNode {
18 private static final Logger log = LoggerFactory.getLogger(TestPropertiesNode.class);
21 public void testJSONFileParsing() throws SvcLogicException {
22 SvcLogicContext ctx = new SvcLogicContext();
24 Map<String, String> p = new HashMap<String, String>();
25 p.put("fileName", "src/test/resources/test.json");
26 p.put("contextPrefix", "test-json");
27 p.put("fileBasedParsing","true");
29 PropertiesNode rcn = new PropertiesNode();
30 rcn.readProperties(p, ctx);
32 assertEquals(ctx.getAttribute("test-json.message"),"The provisioned access " +
33 "bandwidth is at or exceeds 50% of the total server capacity.");
37 public void testJSONFileArrayParsing() throws SvcLogicException {
38 SvcLogicContext ctx = new SvcLogicContext();
40 Map<String, String> p = new HashMap<String, String>();
41 p.put("fileName", "src/test/resources/test.json");
42 p.put("contextPrefix", "test-json");
43 p.put("fileBasedParsing","true");
45 PropertiesNode rcn = new PropertiesNode();
46 rcn.readProperties(p, ctx);
48 assertEquals(ctx.getAttribute("test-json.equipment-data[0].max-server-speed"),"1600000");
49 assertEquals(ctx.getAttribute("test-json.resource-state.used"),"1605000");
50 assertEquals(ctx.getAttribute("test-json.resource-rule.service-model"),"DUMMY");
51 assertEquals(ctx.getAttribute("test-json.resource-rule.endpoint-position"),"VCE-Cust");
55 public void testJSONFileParsingPrefixCheck() throws SvcLogicException {
56 SvcLogicContext ctx = new SvcLogicContext();
58 Map<String, String> p = new HashMap<String, String>();
59 p.put("fileName", "src/test/resources/test.json");
60 p.put("contextPrefix", "");
61 p.put("fileBasedParsing","true");
63 PropertiesNode rcn = new PropertiesNode();
64 rcn.readProperties(p, ctx);
66 assertEquals(ctx.getAttribute("equipment-data[0].max-server-speed"),"1600000");
67 assertEquals(ctx.getAttribute("resource-state.used"),"1605000");
68 assertEquals(ctx.getAttribute("resource-rule.service-model"),"DUMMY");
69 assertEquals(ctx.getAttribute("resource-rule.endpoint-position"),"VCE-Cust");
70 assertEquals(ctx.getAttribute("resource-rule.hard-limit-expression"),"max-server-" +
71 "speed * number-primary-servers");
75 public void testJSONFileParsingNoPrefix() throws SvcLogicException {
76 SvcLogicContext ctx = new SvcLogicContext();
78 Map<String, String> p = new HashMap<String, String>();
79 p.put("fileName", "src/test/resources/test.json");
80 p.put("fileBasedParsing","true");
82 PropertiesNode rcn = new PropertiesNode();
83 rcn.readProperties(p, ctx);
85 assertEquals(ctx.getAttribute("equipment-data[0].max-server-speed"),"1600000");
86 assertEquals(ctx.getAttribute("resource-state.used"),"1605000");
87 assertEquals(ctx.getAttribute("resource-rule.service-model"),"DUMMY");
88 assertEquals(ctx.getAttribute("resource-rule.endpoint-position"),"VCE-Cust");
89 assertEquals(ctx.getAttribute("resource-rule.hard-limit-expression"),"max-server-" +
90 "speed * number-primary-servers");
94 public void testJSONFileParsingCtxCheck() throws SvcLogicException {
95 SvcLogicContext ctx = new SvcLogicContext();
96 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
98 Map<String, String> p = new HashMap<String, String>();
99 p.put("fileName", "src/test/resources/test.json");
100 p.put("fileBasedParsing","true");
102 PropertiesNode rcn = new PropertiesNode();
103 rcn.readProperties(p, ctx);
105 assertEquals(ctx.getAttribute("equipment-data[0].max-server-speed"),"1600000");
106 assertEquals(ctx.getAttribute("resource-state.used"),"1605000");
107 assertEquals(ctx.getAttribute("resource-rule.service-model"),"DUMMY");
108 assertEquals(ctx.getAttribute("resource-rule.endpoint-position"),"VCE-Cust");
109 assertEquals(ctx.getAttribute("resource-rule.hard-limit-expression"),"max-server-" +
110 "speed * number-primary-servers");
111 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
114 @Test(expected = SvcLogicException.class)
115 public void testToPropertiesInvalidJson() throws SvcLogicException {
116 SvcLogicContext ctx = new SvcLogicContext();
117 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
119 Map<String, String> p = new HashMap<String, String>();
120 p.put("fileName", "src/test/resources/test-invalid.json");
121 p.put("contextPrefix", "invalid");
122 p.put("fileBasedParsing","true");
124 PropertiesNode rcn = new PropertiesNode();
125 rcn.readProperties(p, ctx);
127 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
131 public void testTXTFileParsing() throws SvcLogicException {
132 SvcLogicContext ctx = new SvcLogicContext();
134 Map<String, String> p = new HashMap<String, String>();
135 p.put("fileName", "src/test/resources/test.txt");
136 p.put("contextPrefix", "test-txt");
137 p.put("fileBasedParsing","true");
139 PropertiesNode rcn = new PropertiesNode();
140 rcn.readProperties(p, ctx);
142 assertEquals(ctx.getAttribute("test-txt.service-data.service-information.service-type"),"AVPN");
143 assertEquals(ctx.getAttribute("test-txt.service-configuration-notification-input.response-code"),"0");
144 assertEquals(ctx.getAttribute("test-txt.operational-data.avpn-ip-port-information.port-" +
145 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
146 assertEquals(ctx.getAttribute("test-txt.service-data.avpn-ip-port-information.avpn-" +
147 "access-information.l1-customer-handoff"),"_1000BASELX");
148 assertEquals(ctx.getAttribute("test-txt.service-data.avpn-ip-port-information.avpn-" +
149 "access-information.vlan-tag-control"),"_1Q");
153 public void testTXTFileParsingPrefixCheck() throws SvcLogicException {
154 SvcLogicContext ctx = new SvcLogicContext();
156 Map<String, String> p = new HashMap<String, String>();
157 p.put("fileName", "src/test/resources/test.txt");
158 p.put("contextPrefix", "");
159 p.put("fileBasedParsing","true");
161 PropertiesNode rcn = new PropertiesNode();
162 rcn.readProperties(p, ctx);
164 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
165 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
166 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
167 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
168 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
169 "access-information.l1-customer-handoff"),"_1000BASELX");
170 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
171 "access-information.vlan-tag-control"),"_1Q");
175 public void testTXTFileParsingNoPrefix() throws SvcLogicException {
176 SvcLogicContext ctx = new SvcLogicContext();
178 Map<String, String> p = new HashMap<String, String>();
179 p.put("fileName", "src/test/resources/test.txt");
180 p.put("fileBasedParsing","true");
182 PropertiesNode rcn = new PropertiesNode();
183 rcn.readProperties(p, ctx);
185 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
186 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
187 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
188 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
189 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
190 "access-information.l1-customer-handoff"),"_1000BASELX");
191 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
192 "access-information.vlan-tag-control"),"_1Q");
196 public void testTXTFileParsingCtxCheck() throws SvcLogicException {
197 SvcLogicContext ctx = new SvcLogicContext();
198 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
200 Map<String, String> p = new HashMap<String, String>();
201 p.put("fileName", "src/test/resources/test.txt");
202 p.put("fileBasedParsing","true");
204 PropertiesNode rcn = new PropertiesNode();
205 rcn.readProperties(p, ctx);
207 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
208 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
209 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
210 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
211 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
212 "access-information.l1-customer-handoff"),"_1000BASELX");
213 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
214 "access-information.vlan-tag-control"),"_1Q");
215 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
218 @Test(expected = SvcLogicException.class)
219 public void testToPropertiesInvalidParam() throws SvcLogicException {
220 SvcLogicContext ctx = new SvcLogicContext();
221 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
223 Map<String, String> p = new HashMap<String, String>();
224 p.put("responsePrefix", "response");
225 p.put("skipSending", "true");
226 p.put("fileBasedParsing","true");
228 PropertiesNode rcn = new PropertiesNode();
229 rcn.readProperties(p, ctx);
231 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
234 @Test(expected = SvcLogicException.class)
235 public void testToPropertiesNoParam() throws SvcLogicException {
236 SvcLogicContext ctx = new SvcLogicContext();
237 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
239 Map<String, String> p = new HashMap<String, String>();
240 p.put("fileBasedParsing","true");
242 PropertiesNode rcn = new PropertiesNode();
243 rcn.readProperties(p, ctx);
245 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
248 @Test(expected = SvcLogicException.class)
249 public void testToPropertiesFilePathError() throws SvcLogicException {
250 SvcLogicContext ctx = new SvcLogicContext();
251 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
253 Map<String, String> p = new HashMap<String, String>();
254 p.put("fileName", "src/tests/resources/test.txt");
255 p.put("fileBasedParsing","true");
257 PropertiesNode rcn = new PropertiesNode();
258 rcn.readProperties(p, ctx);
260 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
264 public void testXMLFileParsing() throws SvcLogicException {
265 SvcLogicContext ctx = new SvcLogicContext();
267 Map<String, String> p = new HashMap<String, String>();
268 p.put("fileName", "src/test/resources/test.xml");
269 p.put("contextPrefix", "test-xml");
270 p.put("listName", "project.build");
271 p.put("fileBasedParsing","true");
273 PropertiesNode rcn = new PropertiesNode();
274 rcn.readProperties(p, ctx);
276 assertEquals(ctx.getAttribute("test-xml.project.modelVersion"),"4.0.0");
280 public void testXMLFileInnerParsing() throws SvcLogicException {
281 SvcLogicContext ctx = new SvcLogicContext();
283 Map<String, String> p = new HashMap<String, String>();
284 p.put("fileName", "src/test/resources/test.xml");
285 p.put("contextPrefix", "test-xml");
286 p.put("listName", "project.modelVersion");
287 p.put("fileBasedParsing","true");
289 PropertiesNode rcn = new PropertiesNode();
290 rcn.readProperties(p, ctx);
292 assertEquals(ctx.getAttribute("test-xml.project.properties.project.build.sourceEncoding"),"UTF-8");
293 assertEquals(ctx.getAttribute("test-xml.project.dependencies.dependency.scope"),"provided");
294 assertEquals(ctx.getAttribute("test-xml.project.build.pluginManagement.plugins.plugin.configuration" +
295 ".lifecycleMappingMetadata.pluginExecutions.pluginExecution." +
296 "pluginExecutionFilter.versionRange"),"[1.2.0.100,)");
297 assertEquals(ctx.getAttribute("test-xml.project.build.plugins.plugin.configuration." +
298 "instructions.Import-Package"),"*");
302 public void testXMLFileParsingPrefixCheck() throws SvcLogicException {
303 SvcLogicContext ctx = new SvcLogicContext();
305 Map<String, String> p = new HashMap<String, String>();
306 p.put("fileName", "src/test/resources/test.xml");
307 p.put("contextPrefix", "");
308 p.put("fileBasedParsing","true");
310 PropertiesNode rcn = new PropertiesNode();
311 rcn.readProperties(p, ctx);
313 assertEquals(ctx.getAttribute("project.properties.project.build.sourceEncoding"),"UTF-8");
314 assertEquals(ctx.getAttribute("project.dependencies.dependency.scope"),"provided");
315 assertEquals(ctx.getAttribute("project.build.pluginManagement.plugins.plugin.configuration" +
316 ".lifecycleMappingMetadata.pluginExecutions.pluginExecution." +
317 "pluginExecutionFilter.versionRange"),"[1.2.0.100,)");
318 assertEquals(ctx.getAttribute("project.build.plugins.plugin.configuration." +
319 "instructions.Import-Package"),"*");
323 public void testXMLFileParsingNoPrefix() throws SvcLogicException {
324 SvcLogicContext ctx = new SvcLogicContext();
326 Map<String, String> p = new HashMap<String, String>();
327 p.put("fileName", "src/test/resources/test.xml");
328 p.put("fileBasedParsing","true");
330 PropertiesNode rcn = new PropertiesNode();
331 rcn.readProperties(p, ctx);
333 assertEquals(ctx.getAttribute("project.properties.project.build.sourceEncoding"),"UTF-8");
334 assertEquals(ctx.getAttribute("project.dependencies.dependency.scope"),"provided");
335 assertEquals(ctx.getAttribute("project.build.pluginManagement.plugins.plugin.configuration" +
336 ".lifecycleMappingMetadata.pluginExecutions.pluginExecution." +
337 "pluginExecutionFilter.versionRange"),"[1.2.0.100,)");
338 assertEquals(ctx.getAttribute("project.build.plugins.plugin.configuration." +
339 "instructions.Import-Package"),"*");
343 public void testXMLFileParsingCtxCheck() throws SvcLogicException {
344 SvcLogicContext ctx = new SvcLogicContext();
345 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
347 Map<String, String> p = new HashMap<String, String>();
348 p.put("fileName", "src/test/resources/test.xml");
349 p.put("fileBasedParsing","true");
351 PropertiesNode rcn = new PropertiesNode();
352 rcn.readProperties(p, ctx);
354 assertEquals(ctx.getAttribute("project.properties.project.build.sourceEncoding"),"UTF-8");
355 assertEquals(ctx.getAttribute("project.dependencies.dependency.scope"),"provided");
356 assertEquals(ctx.getAttribute("project.build.pluginManagement.plugins.plugin.configuration" +
357 ".lifecycleMappingMetadata.pluginExecutions.pluginExecution." +
358 "pluginExecutionFilter.versionRange"),"[1.2.0.100,)");
359 assertEquals(ctx.getAttribute("project.build.plugins.plugin.configuration." +
360 "instructions.Import-Package"),"*");
361 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
364 @Test(expected = SvcLogicException.class)
365 public void testToPropertiesInvalidXML() throws SvcLogicException {
366 SvcLogicContext ctx = new SvcLogicContext();
367 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
369 Map<String, String> p = new HashMap<String, String>();
370 p.put("fileName", "src/test/resources/test-invalid.xml");
371 p.put("contextPrefix", "invalid");
372 p.put("fileBasedParsing","true");
374 PropertiesNode rcn = new PropertiesNode();
375 rcn.readProperties(p, ctx);
377 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
381 public void testXMLFileParsingListName() throws SvcLogicException {
382 SvcLogicContext ctx = new SvcLogicContext();
384 Map<String, String> p = new HashMap<String, String>();
385 p.put("fileName", "src/test/resources/test.xml");
386 p.put("contextPrefix", "test-xml-listName");
387 p.put("fileBasedParsing","true");
388 p.put("listName", "project.build.pluginManagement");
390 PropertiesNode rcn = new PropertiesNode();
391 rcn.readProperties(p, ctx);
393 assertEquals(ctx.getAttribute("test-xml-listName.project.build." +
394 "pluginManagement.plugins.plugin.version"),null);
395 assertEquals(ctx.getAttribute("test-xml-listName.project.build." +
396 "plugins.plugin.groupId"),"org.apache.felix");
400 public void testXMLFileParsingListNameAnother() throws SvcLogicException {
401 SvcLogicContext ctx = new SvcLogicContext();
403 Map<String, String> p = new HashMap<String, String>();
404 p.put("fileName", "src/test/resources/test.xml");
405 p.put("contextPrefix", "test-xml-listName");
406 p.put("fileBasedParsing","true");
407 p.put("listName", "project.modelVersion");
409 PropertiesNode rcn = new PropertiesNode();
410 rcn.readProperties(p, ctx);
412 assertEquals(ctx.getAttribute("test-xml-listName.project.modelVersion"),null);
413 assertEquals(ctx.getAttribute("test-xml-listName.project.build." +
414 "plugins.plugin.groupId"),"org.apache.felix");
418 public void testTXTFileParsingNotFileBased() throws SvcLogicException {
419 SvcLogicContext ctx = new SvcLogicContext();
421 Map<String, String> p = new HashMap<String, String>();
422 p.put("fileName", "src/test/resources/test.txt");
423 p.put("contextPrefix", "test-txt");
425 PropertiesNode rcn = new PropertiesNode();
426 rcn.readProperties(p, ctx);
428 assertEquals(ctx.getAttribute("test-txt.service-data.service-information.service-type"),"AVPN");
429 assertEquals(ctx.getAttribute("test-txt.service-configuration-notification-input.response-code"),"0");
430 assertEquals(ctx.getAttribute("test-txt.operational-data.avpn-ip-port-information.port-" +
431 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
432 assertEquals(ctx.getAttribute("test-txt.service-data.avpn-ip-port-information.avpn-" +
433 "access-information.l1-customer-handoff"),"_1000BASELX");
434 assertEquals(ctx.getAttribute("test-txt.service-data.avpn-ip-port-information.avpn-" +
435 "access-information.vlan-tag-control"),"_1Q");
439 public void testTXTFileParsingPrefixCheckNotFileBased() throws SvcLogicException {
440 SvcLogicContext ctx = new SvcLogicContext();
442 Map<String, String> p = new HashMap<String, String>();
443 p.put("fileName", "src/test/resources/test.txt");
444 p.put("contextPrefix", "");
446 PropertiesNode rcn = new PropertiesNode();
447 rcn.readProperties(p, ctx);
449 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
450 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
451 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
452 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
453 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
454 "access-information.l1-customer-handoff"),"_1000BASELX");
455 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
456 "access-information.vlan-tag-control"),"_1Q");
460 public void testTXTFileParsingNoPrefixNotFileBased() throws SvcLogicException {
461 SvcLogicContext ctx = new SvcLogicContext();
463 Map<String, String> p = new HashMap<String, String>();
464 p.put("fileName", "src/test/resources/test.txt");
466 PropertiesNode rcn = new PropertiesNode();
467 rcn.readProperties(p, ctx);
469 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
470 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
471 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
472 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
473 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
474 "access-information.l1-customer-handoff"),"_1000BASELX");
475 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
476 "access-information.vlan-tag-control"),"_1Q");
480 public void testTXTFileParsingCtxCheckNotFileBased() throws SvcLogicException {
481 SvcLogicContext ctx = new SvcLogicContext();
482 ctx.setAttribute("tmp.sdn-circuit-req-row_length", "1");
484 Map<String, String> p = new HashMap<String, String>();
485 p.put("fileName", "src/test/resources/test.txt");
487 PropertiesNode rcn = new PropertiesNode();
488 rcn.readProperties(p, ctx);
490 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
491 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
492 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
493 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
494 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
495 "access-information.l1-customer-handoff"),"_1000BASELX");
496 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
497 "access-information.vlan-tag-control"),"_1Q");
498 assertEquals(ctx.getAttribute("tmp.sdn-circuit-req-row_length"),"1");
502 public void testJSONFileArrayParsingNotFileBased() throws SvcLogicException {
503 SvcLogicContext ctx = new SvcLogicContext();
505 Map<String, String> p = new HashMap<String, String>();
506 p.put("fileName", "src/test/resources/test.json");
507 p.put("contextPrefix", "NotFileBased");
509 PropertiesNode rcn = new PropertiesNode();
510 rcn.readProperties(p, ctx);
512 assertEquals(ctx.getAttribute("NotFileBased.\"limit-value\""),"\"1920000\"");
513 assertEquals(ctx.getAttribute("NotFileBased.\"hard-limit-expression\""),"\"max-server-speed * number-primary-servers\",");
514 assertEquals(ctx.getAttribute("NotFileBased.\"test-inner-node\""),"\"Test-Value\"");
518 public void testXMLFileInnerParsingNotFileBased() throws SvcLogicException {
519 SvcLogicContext ctx = new SvcLogicContext();
521 Map<String, String> p = new HashMap<String, String>();
522 p.put("fileName", "src/test/resources/test.xml");
523 p.put("contextPrefix", "NotFileBased");
524 p.put("listName", "project.modelVersion");
526 PropertiesNode rcn = new PropertiesNode();
527 rcn.readProperties(p, ctx);
529 assertEquals(ctx.getAttribute("NotFileBased.<name>RESTAPI"),"Call Node - Provider</name>");
530 assertEquals(ctx.getAttribute("NotFileBased.<project"),
531 "xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
532 " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">");
533 assertEquals(ctx.getAttribute("NotFileBased.openECOMP"),"SDN-C");
534 assertEquals(ctx.getAttribute("NotFileBased.<ignore"),"/>");
538 public void testNoFileTypeNoPrefixNotFileBased() throws SvcLogicException {
539 SvcLogicContext ctx = new SvcLogicContext();
541 Map<String, String> p = new HashMap<String, String>();
542 p.put("fileName", "src/test/resources/test");
543 p.put("fileBasedParsing","true");
545 PropertiesNode rcn = new PropertiesNode();
546 rcn.readProperties(p, ctx);
548 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
549 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
550 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
551 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
552 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
553 "access-information.l1-customer-handoff"),"_1000BASELX");
554 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
555 "access-information.vlan-tag-control"),"_1Q");
558 @Test(expected = SvcLogicException.class)
559 public void testNoFileTypeParseReqError() throws SvcLogicException {
560 SvcLogicContext ctx = new SvcLogicContext();
562 Map<String, String> p = new HashMap<String, String>();
563 p.put("file Name", "src/test/resources/test");
564 p.put("fileBasedParsing","true");
566 PropertiesNode rcn = new PropertiesNode();
567 rcn.readProperties(p, ctx);
569 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
570 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
571 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
572 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
573 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
574 "access-information.l1-customer-handoff"),"_1000BASELX");
575 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
576 "access-information.vlan-tag-control"),"_1Q");
580 public void testNoFileTypeParseError() throws SvcLogicException {
581 SvcLogicContext ctx = new SvcLogicContext();
583 Map<String, String> p = new HashMap<String, String>();
584 p.put("fileName", "src/test/resources/test");
585 p.put("file Based % Parsing","true");
587 PropertiesNode rcn = new PropertiesNode();
588 rcn.readProperties(p, ctx);
590 assertEquals(ctx.getAttribute("service-data.service-information.service-type"),"AVPN");
591 assertEquals(ctx.getAttribute("service-configuration-notification-input.response-code"),"0");
592 assertEquals(ctx.getAttribute("operational-data.avpn-ip-port-information.port-" +
593 "level-cos.queueing.pe-per-class-queueing-behaviors.cos3-queueing"),"WRED");
594 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
595 "access-information.l1-customer-handoff"),"_1000BASELX");
596 assertEquals(ctx.getAttribute("service-data.avpn-ip-port-information.avpn-" +
597 "access-information.vlan-tag-control"),"_1Q");