3333import org .gridsuite .study .server .dto .modification .NetworkModificationsResult ;
3434import org .gridsuite .study .server .dto .voltageinit .parameters .*;
3535import 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 .*;
4137import org .gridsuite .study .server .notification .NotificationService ;
4238import org .gridsuite .study .server .notification .dto .AlertLevel ;
4339import org .gridsuite .study .server .notification .dto .NetworkImpactsInfos ;
9490import static org .hamcrest .MatcherAssert .assertThat ;
9591import static org .junit .jupiter .api .Assertions .*;
9692import static org .mockito .ArgumentMatchers .any ;
93+ import static org .mockito .ArgumentMatchers .anyBoolean ;
9794import static org .mockito .Mockito .doAnswer ;
9895import static org .mockito .Mockito .when ;
9996import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .*;
@@ -320,7 +317,7 @@ public MockResponse dispatch(RecordedRequest request) {
320317 .setHeader (HEADER_VOLTAGE_LEVEL_LIMITS_OUT_OF_NOMINAL_VOLTAGE_RANGE , Boolean .TRUE )
321318 .build (), voltageInitResultDestination );
322319 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 + ".*" )) {
324321 input .send (MessageBuilder .withPayload ("" )
325322 .setHeader ("resultUuid" , VOLTAGE_INIT_RESULT_UUID )
326323 .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 {
570567
571568 //run a voltage init analysis
572569 mockMvc .perform (put ("/v1/studies/{studyUuid}/root-networks/{rootNetworkUuid}/nodes/{nodeUuid}/voltage-init/run" , studyNameUserIdUuid , firstRootNetworkUuid , modificationNode3Uuid )
570+ .param ("debug" , "true" )
573571 .header ("userId" , "userId" ))
574572 .andExpect (status ().isOk ());
575573
@@ -582,7 +580,7 @@ void testVoltageInit(final MockWebServer server) throws Exception {
582580
583581 checkUpdateModelStatusMessagesReceived (studyNameUserIdUuid , firstRootNetworkUuid , NotificationService .UPDATE_TYPE_VOLTAGE_INIT_STATUS );
584582
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" )));
586584
587585 // get voltage init result
588586 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 {
944942 .setHeader ("resultUuid" , VOLTAGE_INIT_ERROR_RESULT_UUID )
945943 .build (), voltageInitFailedDestination );
946944 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 );
949947
950948 // Test doesn't reset uuid result in the database
951949 assertEquals (VOLTAGE_INIT_ERROR_RESULT_UUID , rootNetworkNodeInfoService .getComputationResultUuid (modificationNode .getId (), rootNetworkUuid , VOLTAGE_INITIALIZATION ).toString ());
0 commit comments