|
5 | 5 | package org.lfenergy.compas.sct.commons;
|
6 | 6 |
|
7 | 7 | import org.assertj.core.api.SoftAssertions;
|
8 |
| -import org.assertj.core.groups.Tuple; |
9 | 8 | import org.junit.jupiter.api.BeforeEach;
|
10 | 9 | import org.junit.jupiter.api.Tag;
|
11 | 10 | import org.junit.jupiter.api.Test;
|
@@ -327,111 +326,6 @@ void manageBindingForLDEPF_when_extRefMatchFlowKindInternalOrExternal_should_upd
|
327 | 326 | assertExtRefIsBoundAccordingTOLDEPF(extRefBindExternally, analogueChannel10WithBayExternalBayScope);
|
328 | 327 | }
|
329 | 328 |
|
330 |
| - @Test |
331 |
| - void manageBindingForLDEPF_when_DOI_Mod_and_DAI_stVal_notExists_should_precede() { |
332 |
| - // Given |
333 |
| - SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ldepf/scd_ldepf_withoutModStValInLN0.xml"); |
334 |
| - // When |
335 |
| - TChannel channel = new TChannel(); |
336 |
| - channel.setBayScope(TCBScopeType.BAY_INTERNAL); |
337 |
| - channel.setChannelType(TChannelType.DIGITAL); |
338 |
| - channel.setChannelNum("1"); |
339 |
| - channel.setChannelShortLabel("MR.PX1"); |
340 |
| - channel.setChannelLevMod(TChannelLevMod.POSITIVE_OR_RISING); |
341 |
| - channel.setChannelLevModQ(TChannelLevMod.OTHER); |
342 |
| - channel.setIEDType("BCU"); |
343 |
| - channel.setIEDRedundancy(TIEDredundancy.NONE); |
344 |
| - channel.setIEDSystemVersionInstance("1"); |
345 |
| - channel.setLDInst("LDPX"); |
346 |
| - channel.setLNClass("PTRC"); |
347 |
| - channel.setLNInst("0"); |
348 |
| - channel.setDOName("Str"); |
349 |
| - channel.setDOInst("0"); |
350 |
| - channel.setDAName("general"); |
351 |
| - |
352 |
| - EPF epf = new EPF(); |
353 |
| - Channels channels = new Channels(); |
354 |
| - channels.getChannel().add(channel); |
355 |
| - epf.setChannels(channels); |
356 |
| - List<SclReportItem> sclReportItems = extRefEditorService.manageBindingForLDEPF(scd, epf); |
357 |
| - // Then |
358 |
| - assertThat(sclReportItems).isEmpty(); |
359 |
| - TExtRef extRef1 = findExtRef(scd, "IED_NAME1", "LDEPF", "DYN_LDEPF_DIGITAL CHANNEL 1_1_BOOLEAN_1_general_1"); |
360 |
| - assertThat(extRef1.getIedName()).isEqualTo("IED_NAME1"); |
361 |
| - TExtRef extRef2 = findExtRef(scd, "IED_NAME2", "LDEPF", "DYN_LDEPF_DIGITAL CHANNEL 1_1_BOOLEAN_1_general_1"); |
362 |
| - assertThat(extRef2.getIedName()).isEqualTo("IED_NAME2"); |
363 |
| - TExtRef extRef3 = findExtRef(scd, "IED_NAME3", "LDEPF", "DYN_LDEPF_DIGITAL CHANNEL 1_1_BOOLEAN_1_general_1"); |
364 |
| - assertThat(extRef3.getIedName()).isEqualTo("IED_NAME1"); |
365 |
| - |
366 |
| - assertExtRefIsBoundAccordingTOLDEPF(extRef1, channel); |
367 |
| - assertExtRefIsBoundAccordingTOLDEPF(extRef2, channel); |
368 |
| - assertExtRefIsBoundAccordingTOLDEPF(extRef3, channel); |
369 |
| - } |
370 |
| - |
371 |
| - @Test |
372 |
| - void manageBindingForLDEPF_when_LDEPF_NotActive_should_precede() { |
373 |
| - //Given |
374 |
| - SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ldepf/scd_with_inactive_ldevice_ldepf.xml"); |
375 |
| - TChannel channel = new TChannel(); |
376 |
| - channel.setBayScope(TCBScopeType.BAY_INTERNAL); |
377 |
| - channel.setChannelType(TChannelType.DIGITAL); |
378 |
| - channel.setChannelNum("1"); |
379 |
| - channel.setChannelShortLabel("MR.PX1"); |
380 |
| - channel.setChannelLevMod(TChannelLevMod.POSITIVE_OR_RISING); |
381 |
| - channel.setChannelLevModQ(TChannelLevMod.OTHER); |
382 |
| - channel.setIEDType("BCU"); |
383 |
| - channel.setIEDRedundancy(TIEDredundancy.NONE); |
384 |
| - channel.setIEDSystemVersionInstance("1"); |
385 |
| - channel.setLDInst("LDPX"); |
386 |
| - channel.setLNClass("PTRC"); |
387 |
| - channel.setLNInst("0"); |
388 |
| - channel.setDOName("Str"); |
389 |
| - channel.setDOInst("0"); |
390 |
| - channel.setDAName("general"); |
391 |
| - |
392 |
| - EPF epf = new EPF(); |
393 |
| - Channels channels = new Channels(); |
394 |
| - channels.getChannel().add(channel); |
395 |
| - epf.setChannels(channels); |
396 |
| - // When |
397 |
| - List<SclReportItem> sclReportItems = extRefEditorService.manageBindingForLDEPF(scd, epf); |
398 |
| - // Then |
399 |
| - assertThat(sclReportItems).isEmpty(); |
400 |
| - TExtRef extRef1 = findExtRef(scd, "IED_NAME1", "LDEPF", "DYN_LDEPF_DIGITAL CHANNEL 1_1_BOOLEAN_1_general_1"); |
401 |
| - assertThat(extRef1.getIedName()).isEqualTo("IED_NAME1"); |
402 |
| - TExtRef extRef2 = findExtRef(scd, "IED_NAME2", "LDEPF", "DYN_LDEPF_DIGITAL CHANNEL 1_1_BOOLEAN_1_general_1"); |
403 |
| - assertThat(extRef2.getIedName()).isEqualTo("IED_NAME2"); |
404 |
| - TExtRef extRef3 = findExtRef(scd, "IED_NAME3", "LDEPF", "DYN_LDEPF_DIGITAL CHANNEL 1_1_BOOLEAN_1_general_1"); |
405 |
| - assertThat(extRef3.getIedName()).isEqualTo("IED_NAME1"); |
406 |
| - |
407 |
| - assertExtRefIsBoundAccordingTOLDEPF(extRef1, channel); |
408 |
| - assertExtRefIsBoundAccordingTOLDEPF(extRef2, channel); |
409 |
| - assertExtRefIsBoundAccordingTOLDEPF(extRef3, channel); |
410 |
| - } |
411 |
| - |
412 |
| - @Test |
413 |
| - void manageBindingForLDEPF_when_DO_Mod_and_DA_stVal_NotFoundInDataTypeTemplate_should_return_error() { |
414 |
| - // Given |
415 |
| - SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ldepf/scd_ldepf_withoutModStValInDataTypeTemplate.xml"); |
416 |
| - // When |
417 |
| - EPF epf = new EPF(); |
418 |
| - epf.setChannels(new Channels()); |
419 |
| - List<SclReportItem> sclReportItems = extRefEditorService.manageBindingForLDEPF(scd, epf); |
420 |
| - // Then |
421 |
| - assertThat(sclReportItems).hasSize(3); |
422 |
| - assertThat(sclReportItems) |
423 |
| - .extracting(SclReportItem::message, SclReportItem::xpath) |
424 |
| - .containsExactly( |
425 |
| - Tuple.tuple("DO@name=Mod/DA@name=stVal not found in DataTypeTemplate", |
426 |
| - "SCL/IED[@name=\"IED_NAME1\"]/AccessPoint/Server/LDevice[@inst=\"LDEPF\"]"), |
427 |
| - Tuple.tuple("DO@name=Mod/DA@name=stVal not found in DataTypeTemplate", |
428 |
| - "SCL/IED[@name=\"IED_NAME2\"]/AccessPoint/Server/LDevice[@inst=\"LDEPF\"]"), |
429 |
| - Tuple.tuple("DO@name=Mod/DA@name=stVal not found in DataTypeTemplate", |
430 |
| - "SCL/IED[@name=\"IED_NAME3\"]/AccessPoint/Server/LDevice[@inst=\"LDEPF\"]") |
431 |
| - ); |
432 |
| - } |
433 |
| - |
434 |
| - |
435 | 329 | private void assertExtRefIsBoundAccordingTOLDEPF(TExtRef extRef, TChannel setting) {
|
436 | 330 | assertThat(extRef.getLdInst()).isEqualTo(setting.getLDInst());
|
437 | 331 | assertThat(extRef.getLnClass()).contains(setting.getLNClass());
|
@@ -844,4 +738,38 @@ void manageBindingForLDEPF_should_not_update_dai_setVal_when_channelLevMod_or_ch
|
844 | 738 | });
|
845 | 739 | }
|
846 | 740 |
|
| 741 | + @Test() |
| 742 | + void manageBindingForLDEPF_should_not_been_configured_when_ldepf_ln0_is_off() { |
| 743 | + //Given |
| 744 | + SCL scd = SclTestMarshaller.getSCLFromFile("/scd-ldepf/scd_ldepf_processing_when_status_ln0_off.xml"); |
| 745 | + TChannel digitalChannel = new TChannel(); |
| 746 | + digitalChannel.setBayScope(TCBScopeType.BAY_INTERNAL); |
| 747 | + digitalChannel.setChannelType(TChannelType.DIGITAL); |
| 748 | + digitalChannel.setChannelNum("1"); |
| 749 | + digitalChannel.setChannelShortLabel("MR.PX1"); |
| 750 | + digitalChannel.setChannelLevMod(TChannelLevMod.POSITIVE_OR_RISING); |
| 751 | + digitalChannel.setChannelLevModQ(TChannelLevMod.OTHER); |
| 752 | + digitalChannel.setIEDType("BCU"); |
| 753 | + digitalChannel.setIEDRedundancy(TIEDredundancy.NONE); |
| 754 | + digitalChannel.setIEDSystemVersionInstance("1"); |
| 755 | + digitalChannel.setLDInst("LDPX"); |
| 756 | + digitalChannel.setLNClass("PTRC"); |
| 757 | + digitalChannel.setLNInst("0"); |
| 758 | + digitalChannel.setDOName("Str"); |
| 759 | + digitalChannel.setDOInst("0"); |
| 760 | + digitalChannel.setDAName("general"); |
| 761 | + EPF epf = new EPF(); |
| 762 | + Channels channels = new Channels(); |
| 763 | + channels.getChannel().add(digitalChannel); |
| 764 | + epf.setChannels(channels); |
| 765 | + // When |
| 766 | + List<SclReportItem> sclReportItems = extRefEditorService.manageBindingForLDEPF(scd, epf); |
| 767 | + // Then |
| 768 | + assertThat(sclReportItems).isEmpty(); |
| 769 | + assertThat(scd) |
| 770 | + .usingRecursiveComparison() |
| 771 | + .isEqualTo(SclTestMarshaller.getSCLFromFile("/scd-ldepf/scd_ldepf_processing_when_status_ln0_off.xml")); |
| 772 | + } |
| 773 | + |
| 774 | + |
847 | 775 | }
|
0 commit comments