33
33
import org .gridsuite .study .server .dto .modification .NetworkModificationsResult ;
34
34
import org .gridsuite .study .server .dto .voltageinit .parameters .*;
35
35
import org .gridsuite .study .server .networkmodificationtree .dto .*;
36
- import org .gridsuite .study .server .networkmodificationtree .entities .NetworkModificationNodeInfoEntity ;
37
- import org .gridsuite .study .server .networkmodificationtree .entities .NodeEntity ;
38
- import org .gridsuite .study .server .networkmodificationtree .entities .NodeType ;
39
- import org .gridsuite .study .server .networkmodificationtree .entities .RootNetworkNodeInfoEntity ;
40
- import org .gridsuite .study .server .networkmodificationtree .entities .RootNodeInfoEntity ;
36
+ import org .gridsuite .study .server .networkmodificationtree .entities .*;
41
37
import org .gridsuite .study .server .notification .NotificationService ;
42
38
import org .gridsuite .study .server .notification .dto .AlertLevel ;
43
39
import org .gridsuite .study .server .notification .dto .NetworkImpactsInfos ;
94
90
import static org .hamcrest .MatcherAssert .assertThat ;
95
91
import static org .junit .jupiter .api .Assertions .*;
96
92
import static org .mockito .ArgumentMatchers .any ;
93
+ import static org .mockito .ArgumentMatchers .anyBoolean ;
97
94
import static org .mockito .Mockito .doAnswer ;
98
95
import static org .mockito .Mockito .when ;
99
96
import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .*;
@@ -320,7 +317,7 @@ public MockResponse dispatch(RecordedRequest request) {
320
317
.setHeader (HEADER_VOLTAGE_LEVEL_LIMITS_OUT_OF_NOMINAL_VOLTAGE_RANGE , Boolean .TRUE )
321
318
.build (), voltageInitResultDestination );
322
319
return new MockResponse (200 , Headers .of (HttpHeaders .CONTENT_TYPE , MediaType .APPLICATION_JSON_VALUE ), voltageInitResultUuidStr2 );
323
- } else if (path .matches ("/v1/networks/" + NETWORK_UUID_STRING + "/run-and-save\\ ?receiver=.*&reportUuid=.*&reporterId=.*&variantId=" + VARIANT_ID_2 )) {
320
+ } else if (path .matches ("/v1/networks/" + NETWORK_UUID_STRING + "/run-and-save\\ ?receiver=.*&reportUuid=.*&reporterId=.*&variantId=" + VARIANT_ID_2 + ".*" )) {
324
321
input .send (MessageBuilder .withPayload ("" )
325
322
.setHeader ("resultUuid" , VOLTAGE_INIT_RESULT_UUID )
326
323
.setHeader ("receiver" , "%7B%22nodeUuid%22%3A%22" + request .getPath ().split ("%" )[5 ].substring (4 ) + "%22%2C%20%22rootNetworkUuid%22%3A%20%22" + request .getPath ().split ("%" )[11 ].substring (4 ) + "%22%2C%20%22userId%22%3A%22userId%22%7D" )
@@ -570,6 +567,7 @@ void testVoltageInit(final MockWebServer server) throws Exception {
570
567
571
568
//run a voltage init analysis
572
569
mockMvc .perform (put ("/v1/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/voltage-init/run" , studyNameUserIdUuid , firstRootNetworkUuid , modificationNode3Uuid )
570
+ .param ("debug" , "true" )
573
571
.header ("userId" , "userId" ))
574
572
.andExpect (status ().isOk ());
575
573
@@ -582,7 +580,7 @@ void testVoltageInit(final MockWebServer server) throws Exception {
582
580
583
581
checkUpdateModelStatusMessagesReceived (studyNameUserIdUuid , firstRootNetworkUuid , NotificationService .UPDATE_TYPE_VOLTAGE_INIT_STATUS );
584
582
585
- assertTrue (TestUtils .getRequestsDone (1 , server ).stream ().anyMatch (r -> r .matches ("/v1/networks/" + NETWORK_UUID_STRING + "/run-and-save\\ ?receiver=.*&reportUuid=.*&reporterId=.*&variantId=" + VARIANT_ID_2 )));
583
+ assertTrue (TestUtils .getRequestsDone (1 , server ).stream ().anyMatch (r -> r .matches ("/v1/networks/" + NETWORK_UUID_STRING + "/run-and-save\\ ?receiver=.*&reportUuid=.*&reporterId=.*&variantId=" + VARIANT_ID_2 + "&debug=true" )));
586
584
587
585
// get voltage init result
588
586
mockMvc .perform (get ("/v1/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/voltage-init/result" , studyNameUserIdUuid , firstRootNetworkUuid , modificationNode3Uuid )).andExpectAll (
@@ -944,8 +942,8 @@ void testNotResetedUuidResultWhenVoltageInitFailed() throws Exception {
944
942
.setHeader ("resultUuid" , VOLTAGE_INIT_ERROR_RESULT_UUID )
945
943
.build (), voltageInitFailedDestination );
946
944
return resultUuid ;
947
- }).when (mockStudyService ).runVoltageInit (any (), any (), any (), any ());
948
- mockStudyService .runVoltageInit (studyEntity .getId (), modificationNode .getId (), rootNetworkUuid , "" );
945
+ }).when (mockStudyService ).runVoltageInit (any (), any (), any (), any (), anyBoolean () );
946
+ mockStudyService .runVoltageInit (studyEntity .getId (), modificationNode .getId (), rootNetworkUuid , "" , false );
949
947
950
948
// Test doesn't reset uuid result in the database
951
949
assertEquals (VOLTAGE_INIT_ERROR_RESULT_UUID , rootNetworkNodeInfoService .getComputationResultUuid (modificationNode .getId (), rootNetworkUuid , VOLTAGE_INITIALIZATION ).toString ());
0 commit comments