Skip to content

Conversation

@souissimai
Copy link
Contributor

PR Summary

SOUISSI Maissa (Externe) and others added 2 commits January 29, 2026 14:05
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
@Mathieu-Deharbe Mathieu-Deharbe self-requested a review January 30, 2026 11:22
"\"sensitivityInjectionsSet\":[],\"sensitivityInjection\":[],\"sensitivityHVDC\":[],\"sensitivityPST\":[],\"sensitivityNodes\":[]}";
public static final String SENSITIVITY_ANALYSIS_UPDATED_PARAMETERS_JSON = "{\"flowFlowSensitivityValueThreshold\":90.0,\"angleFlowSensitivityValueThreshold\":0.6,\"flowVoltageSensitivityValueThreshold\":0.1,\"sensitivityInjectionsSet\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"injections\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"distributionType\":\"PROPORTIONAL\",\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityInjection\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"injections\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityHVDC\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"sensitivityType\":\"DELTA_MW\",\"hvdcs\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityPST\":[{\"monitoredBranches\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"sensitivityType\":\"DELTA_MW\",\"psts\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}],\"sensitivityNodes\":[{\"monitoredVoltageLevels\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da321\",\"containerName\":\"identifiable1\"}],\"equipmentsInVoltageRegulation\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da322\",\"containerName\":\"identifiable2\"}],\"contingencies\":[{\"containerId\":\"cf399ef3-7f14-4884-8c82-1c90300da323\",\"containerName\":\"identifiable3\"}],\"activated\":true}]}";

private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "{\"lowVoltageAbsoluteThreshold\":30.0,\"lowVoltageProportionalThreshold\":0.4,\"highVoltageAbsoluteThreshold\":0.0,\"highVoltageProportionalThreshold\":0.0,\"flowProportionalThreshold\":0.1}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a copy pasted security analysis parameters json, not a sensitivity analysis parameters json.

It looks like this data is useless and could just be

Suggested change
private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "{\"lowVoltageAbsoluteThreshold\":30.0,\"lowVoltageProportionalThreshold\":0.4,\"highVoltageAbsoluteThreshold\":0.0,\"highVoltageProportionalThreshold\":0.0,\"flowProportionalThreshold\":0.1}";
private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "dummy sensitivity analysis parameters";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private static final String SENSITIVITY_ANALYSIS_PROFILE_PARAMETERS_JSON = "{\"flowFlowSensitivityValueThreshold\":30.0,\"voltageVoltageSensitivityValueThreshold\":0.4,\"flowVoltageSensitivityValueThreshold\":0.0,\"angleFlowSensitivityValueThreshold\":0.0}";

I updated it

souissimai and others added 2 commits February 2, 2026 10:48
fix
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
Copy link
Contributor

@Mathieu-Deharbe Mathieu-Deharbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the length of time. I took quite some time to understand the new system well. And so I brought back quite a few extra small things. Do with it what you want.

Comment on lines +591 to +595
// Verify message sent to frontend
Message<byte[]> message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION);
assertEquals(studyUuid, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID));
assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID));
String updateType = (String) message.getHeaders().get(HEADER_UPDATE_TYPE);
assertEquals(NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_FAILED, updateType);
assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like this could be replaced by a call to checkMessagesReceived.

Comment on lines 598 to +601
message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION);
assertEquals(studyUuid, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID));
assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID));
updateType = (String) message.getHeaders().get(HEADER_UPDATE_TYPE);
assertEquals(NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType);
assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_FAILED, updateType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too looks like it could be replaced by a call to checkMessagesReceived.

Comment on lines 631 to 634
message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION);
assertEquals(studyUuid2, message.getHeaders().get(NotificationService.HEADER_STUDY_UUID));
assertEquals(studyUuid2, message.getHeaders().get(HEADER_STUDY_UUID));
updateType = (String) message.getHeaders().get(HEADER_UPDATE_TYPE);
assertEquals(NotificationService.UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType);

assertTrue(TestUtils.getRequestsDone(1, server).stream().anyMatch(r -> r.matches("/v1/networks/" + NETWORK_UUID_3_STRING + "/run-and-save.*?receiver=.*nodeUuid.*")));
}

private StudyEntity insertDummyStudy(UUID networkUuid, UUID caseUuid, UUID sensitivityAnalysisParametersUuid) {
StudyEntity studyEntity = TestUtils.createDummyStudy(networkUuid, "netId", caseUuid, "", "", null, UUID.randomUUID(), null, null, sensitivityAnalysisParametersUuid, null, null);
var study = studyRepository.save(studyEntity);
networkModificationTreeService.createRoot(studyEntity);
return study;
}
assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, updateType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too looks like it could be replaced by a call to checkMessagesReceived.

Comment on lines 650 to 652
Message<byte[]> message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION);
assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID));
assertEquals(UPDATE_TYPE_SENSITIVITY_ANALYSIS_STATUS, message.getHeaders().get(HEADER_UPDATE_TYPE));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too looks like it could be replaced by a call to checkMessagesReceived.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment on lines 654 to 656
message = output.receive(TIMEOUT, STUDY_UPDATE_DESTINATION);
assertEquals(studyUuid, message.getHeaders().get(HEADER_STUDY_UUID));
assertEquals(UPDATE_TYPE_COMPUTATION_PARAMETERS, message.getHeaders().get(HEADER_UPDATE_TYPE));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too looks like it could be replaced by a call to checkMessagesReceived.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

// run-and-save called
wireMockServer.verify(postRequestedFor(
urlPathMatching("/v1/networks/" + NETWORK_UUID_STRING + "/run-and-save.*"))
.withQueryParam("reportType", equalTo("SensitivityAnalysis"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is longer. Do as you wish.

Suggested change
.withQueryParam("reportType", equalTo("SensitivityAnalysis"))
.withQueryParam("reportType", equalTo(SENSITIVITY_ANALYSIS.reportKey))

souissimai and others added 2 commits February 3, 2026 14:29
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@souissimai souissimai merged commit 46931e9 into main Feb 3, 2026
3 checks passed
@souissimai souissimai deleted the TU_sensitivity branch February 3, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants