Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1383,10 +1383,6 @@ public void invalidateNodeTree(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUu
invalidateNodeInfos.setNetworkUuid(rootNetworkService.getNetworkUuid(rootNetworkUuid));
deleteInvalidationInfos(invalidateNodeInfos, skipDeleteVariants);

if (!isRootNode(nodeUuid)) {
emitAllComputationStatusChanged(studyUuid, nodeUuid, rootNetworkUuid, invalidateTreeParameters.computationsInvalidationMode());
}

if (startTime.get() != null) {
LOGGER.trace("unbuild node '{}' of study '{}' : {} seconds", nodeUuid, studyUuid,
TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startTime.get()));
Expand All @@ -1402,7 +1398,6 @@ public void invalidateNode(UUID studyUuid, UUID nodeUuid, UUID rootNetworkUuid)
invalidateNodeInfos.setNetworkUuid(rootNetworkService.getNetworkUuid(rootNetworkUuid));

deleteInvalidationInfos(invalidateNodeInfos);
emitAllComputationStatusChanged(studyUuid, nodeUuid, rootNetworkUuid, InvalidateNodeTreeParameters.ComputationsInvalidationMode.ALL);

if (startTime.get() != null) {
LOGGER.trace("unbuild node '{}' of study '{}' : {} seconds", nodeUuid, studyUuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ void unbuildNode() {
assertNodeBuildStatus(node3Uuid, BuildStatus.NOT_BUILT);
assertNodeBuildStatus(node4Uuid, BuildStatus.BUILT);
checkUpdateBuildStateMessageReceived(studyUuid, List.of(node1Uuid));
checkUpdateStatusMessagesReceived(studyUuid, node1Uuid, output);
checkElementUpdatedMessageSent(studyUuid, USER_ID_HEADER);
Mockito.verify(networkService).deleteVariants(NETWORK_UUID, List.of(VARIANT_1));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void testCutAndPasteNodeWithoutModification() throws Exception {
UUID stubDeleteReportsId = wireMockServer.stubFor(WireMock.delete(WireMock.urlPathEqualTo("/v1/reports"))
.willReturn(WireMock.ok())).getId();

cutAndPasteNode(study1Uuid, emptyNode, node1.getId(), InsertMode.BEFORE, 1, userId);
cutAndPasteNode(study1Uuid, emptyNode, node1.getId(), InsertMode.BEFORE, 1, userId, false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that the computation-status notification is absent.

Line 274 disables the assertion, and Lines 459-461 only skip checkComputationStatusMessageReceived(). They do not verify that all_computation_status was not emitted. A regression that still publishes the obsolete notification would leave it queued while this test passes.

When checkComputationStatus is false, assert that no computation-status notification is received before the helper returns.

Also applies to: 459-461

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/test/java/org/gridsuite/study/server/studycontroller/NodeControllerTest.java`
at line 274, Update the test paths around cutAndPasteNode and
checkComputationStatusMessageReceived so that when checkComputationStatus is
false they explicitly assert no all_computation_status notification is received
before returning, rather than merely skipping the positive assertion. Preserve
the existing positive verification when checkComputationStatus is true.


wireMockStubs.verifyDeleteReports(stubDeleteReportsId, 1);

Expand Down Expand Up @@ -413,8 +413,13 @@ void testCutAndPasteSubtree() throws Exception {
.header(USER_ID_HEADER, "userId")).andExpect(status().isNotFound());
}

@SuppressWarnings("checkstyle:LambdaBodyLength")
private void cutAndPasteNode(UUID studyUuid, NetworkModificationNode nodeToCopy, UUID referenceNodeUuid, InsertMode insertMode, int childCount, String userId) throws Exception {
cutAndPasteNode(studyUuid, nodeToCopy, referenceNodeUuid, insertMode, childCount, userId, true);
}

@SuppressWarnings("checkstyle:LambdaBodyLength")
private void cutAndPasteNode(UUID studyUuid, NetworkModificationNode nodeToCopy, UUID referenceNodeUuid,
InsertMode insertMode, int childCount, String userId, boolean checkComputationStatus) throws Exception {
UUID stubUuid = wireMockStubs.stubNetworkModificationCountGet(nodeToCopy.getModificationGroupUuid().toString(),
EMPTY_MODIFICATION_GROUP_UUID.equals(nodeToCopy.getModificationGroupUuid()) ? 0 : 1);
boolean wasBuilt = rootNetworkNodeInfoService.getRootNetworkNodeInfo(nodeToCopy.getId(), studyTestUtils.getOneRootNetworkUuid(studyUuid)).get().getNodeBuildStatus().toDto().isBuilt();
Expand Down Expand Up @@ -449,7 +454,9 @@ private void cutAndPasteNode(UUID studyUuid, NetworkModificationNode nodeToCopy,
if (wasBuilt) {
assertNotNull(TestUtils.receiveStudyUpdate(output, studyUpdateDestination));
}
checkComputationStatusMessageReceived();
if (checkComputationStatus) {
checkComputationStatusMessageReceived();
}

if (!nodeHasModifications) {
return;
Expand Down
Loading