Skip to content

Conversation

@khouadrired
Copy link

@khouadrired khouadrired commented Feb 6, 2026

based on the PR : #30

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

This PR reorganizes services into internal, external.adapter, external.client, and messaging packages, renames many Service classes to RestClient variants, updates constructors/fields and tests to use the new types, and introduces a new CaseRestClient; some internal execution/status update flows were simplified.

Changes

Cohort / File(s) Summary
Internal services & execution
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/internal/ProcessExecutionService.java, monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/internal/StepExecutionService.java
Moved to internal package; ProcessExecutionService status update flow simplified; StepExecutionService now uses ReportRestClient (field/constructor updates) and SPDX headers added.
Messaging services
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/messaging/ConsumerService.java, monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/messaging/NotificationService.java
Moved to messaging package; imports adjusted (ConsumerService imports ProcessExecutionService); SPDX headers added.
External adapter services
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/adapter/FilterService.java, monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/adapter/NetworkConversionService.java, monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/adapter/NetworkModificationService.java
Moved to external.adapter; adapter classes now depend on RestClient types (constructor/field changes) and received license/header updates.
External REST clients (production)
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClient.java (new), .../FilterRestClient.java, .../NetworkModificationRestClient.java, .../ReportRestClient.java, .../SecurityAnalysisRestClient.java
Service classes renamed to *RestClient, moved to external.client, constructors/class names aligned, SPDX headers added; new CaseRestClient provides getCaseDataSource(UUID).
Process & step classes
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/core/AbstractProcess.java, .../processes/commons/steps/ApplyModificationsStep.java, .../processes/commons/steps/LoadNetworkStep.java, .../processes/securityanalysis/SecurityAnalysisProcess.java, .../securityanalysis/steps/SecurityAnalysisRunComputationStep.java
Import paths updated to new packages; steps and processes updated to accept RestClient variants where applicable (constructor/field/type changes).
Tests — internal & messaging
src/test/.../core/ProcessTest.java, .../services/internal/ProcessExecutionServiceTest.java, .../services/internal/StepExecutionServiceTest.java, .../services/messaging/ConsumerServiceTest.java, .../services/messaging/NotificationServiceTest.java
Test packages moved/updated to reflect new production package structure; mocks and injected types changed to RestClient/internal variants; test setups simplified where ProcessExecutionService behavior changed.
Tests — external adapters & clients
src/test/.../services/external/adapter/FilterServiceTest.java, .../NetworkConversionServiceTest.java, .../NetworkModificationServiceTest.java, src/test/.../services/external/client/CaseRestClientTest.java (new), .../FilterRestClientTest.java, .../NetworkModificationRestClientTest.java, .../ReportRestClientTest.java, .../SecurityAnalysisRestClientTest.java
Test classes renamed/moved to match RestClient naming and packages; NetworkConversionServiceTest refactored to Mockito-based tests; new CaseRestClientTest added; request/verification calls updated to RestClient methods.
Step tests
src/test/.../processes/commons/steps/ApplyModificationsStepTest.java, .../LoadNetworkStepTest.java, .../securityanalysis/SecurityAnalysisProcessTest.java, .../securityanalysis/steps/SecurityAnalysisRunComputationStepTest.java
Imports and test wiring updated to use RestClient and external.adapter types; verifications switched to RestClient mocks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • klesaulnier
  • antoinebhs

Poem

🐰 I hopped through packages, tidy and bright,

RestClients settled where Services took flight.
Case client arrived with a cheerful spin,
Tests updated — now let the builds begin! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: a refactoring of the monitor worker server services structure, reorganizing classes into external/adapter and external/client packages.
Description check ✅ Passed The description references a related PR (monitor-core PR #30) that provides context for this refactoring, which is meaningfully related to the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch GRD-3891-refactor-monitor-worker-server-services-structure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/NetworkModificationServiceTest.java (1)

44-45: ⚠️ Potential issue | 🟠 Major

@Mock annotation may not initialize without MockitoExtension.

The filterService mock is declared with @Mock but this test class uses @RestClientTest without @ExtendWith(MockitoExtension.class). The @Mock annotation requires Mockito initialization to work. Since filterService is passed to applyModifications and used in verify calls, this mock may be null at runtime causing test failures.

Consider adding @ExtendWith(MockitoExtension.class) or initializing mocks manually in a @BeforeEach method.

🐛 Proposed fix
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
...
+@ExtendWith(MockitoExtension.class)
 `@RestClientTest`(NetworkModificationService.class)
 class NetworkModificationServiceTest {

Or alternatively, initialize mocks manually:

+import org.junit.jupiter.api.BeforeEach;
+import org.mockito.MockitoAnnotations;
...
+    `@BeforeEach`
+    void setUp() {
+        MockitoAnnotations.openMocks(this);
+    }
🤖 Fix all issues with AI agents
In
`@monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClient.java`:
- Around line 25-27: The property key used in the CaseRestClient constructor is
inconsistent: replace the
'@Value("${powsybl.services.case-server.base-uri:http://case-server/}")' usage
with the gridsuite prefix to match other clients; update the CaseRestClient
constructor parameter annotation to
'@Value("${gridsuite.services.case-server.base-uri:http://case-server/}")'
(keeping the same default) so the RestTemplateBuilder.rootUri(...) receives the
correctly named property (refer to the CaseRestClient constructor and the
caseServerBaseUri parameter).
🧹 Nitpick comments (3)
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClientTest.java (1)

27-34: Test coverage is minimal and assertion is partially redundant.

The test only verifies that getCaseDataSource returns a non-null object. The isInstanceOf(CaseDataSourceClient.class) check is redundant since the method's return type already guarantees this at compile time. Consider enhancing this test to verify the actual behavior, such as using MockRestServiceServer to validate that the returned CaseDataSourceClient makes correct HTTP calls when used.

♻️ Suggested simplified assertion
-        assertThat(result).isNotNull().isInstanceOf(CaseDataSourceClient.class);
+        assertThat(result).isNotNull();
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/SecurityAnalysisRestClient.java (2)

35-40: Consider removing @Setter on securityAnalysisServerBaseUri or documenting its purpose.

The @Setter annotation on securityAnalysisServerBaseUri allows external mutation of this field after construction, which is unusual for an immutable service bean. If this is intended for testing purposes, consider using constructor injection with test-specific configuration instead, or add a comment explaining the rationale.


42-47: Inconsistent RestTemplate configuration compared to CaseRestClient.

CaseRestClient configures the RestTemplate with rootUri() at construction time, while this class builds a plain RestTemplate and manually concatenates the base URI in getSecurityAnalysisServerBaseUri(). Consider aligning the approach for consistency and to leverage Spring's URI template handling.

♻️ Suggested refactor to use rootUri
-    public SecurityAnalysisRestClient(
-        RestTemplateBuilder restTemplateBuilder,
-        `@Value`("${gridsuite.services.security-analysis-server.base-uri:http://security-analysis-server/}") String securityAnalysisServerBaseUri) {
-        this.securityAnalysisServerBaseUri = securityAnalysisServerBaseUri;
-        this.restTemplate = restTemplateBuilder.build();
+    public SecurityAnalysisRestClient(
+        RestTemplateBuilder restTemplateBuilder,
+        `@Value`("${gridsuite.services.security-analysis-server.base-uri:http://security-analysis-server/}") String securityAnalysisServerBaseUri) {
+        this.securityAnalysisServerBaseUri = securityAnalysisServerBaseUri;
+        this.restTemplate = restTemplateBuilder.rootUri(securityAnalysisServerBaseUri).build();
     }

Comment on lines +25 to +27
public CaseRestClient(@Value("${powsybl.services.case-server.base-uri:http://case-server/}") String caseServerBaseUri,
RestTemplateBuilder restTemplateBuilder) {
this.caseServerRest = restTemplateBuilder.rootUri(caseServerBaseUri).build();
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for all `@Value` annotations with service base-uri properties
rg -n '@Value.*services.*base-uri' --type java -A 1

Repository: gridsuite/monitor-core

Length of output: 3236


Use gridsuite.services.case-server.base-uri instead of powsybl.services.case-server.base-uri.

All other REST clients in the codebase use the gridsuite.services.*.base-uri property prefix (SecurityAnalysisRestClient, ReportRestClient, NetworkModificationRestClient, FilterRestClient). Align this property to the same convention for consistency.

🤖 Prompt for AI Agents
In
`@monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClient.java`
around lines 25 - 27, The property key used in the CaseRestClient constructor is
inconsistent: replace the
'@Value("${powsybl.services.case-server.base-uri:http://case-server/}")' usage
with the gridsuite prefix to match other clients; update the CaseRestClient
constructor parameter annotation to
'@Value("${gridsuite.services.case-server.base-uri:http://case-server/}")'
(keeping the same default) so the RestTemplateBuilder.rootUri(...) receives the
correctly named property (refer to the CaseRestClient constructor and the
caseServerBaseUri parameter).

@khouadrired khouadrired force-pushed the GRD-3891-refactor-monitor-worker-server-services-structure branch from d154977 to 90b7085 Compare February 6, 2026 15:18
@khouadrired khouadrired force-pushed the GRD-3891-refactor-monitor-worker-server-services-structure branch from 90b7085 to 9b47571 Compare February 9, 2026 13:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/external/adapter/NetworkModificationServiceTest.java (1)

37-46: ⚠️ Potential issue | 🟡 Minor

Pre-existing bug: @Mock fields are never initialized.

@RestClientTest loads a Spring context but does not activate Mockito annotation processing. The @Mock-annotated filterService and network fields will remain null throughout both tests. The tests happen to pass because null is a valid argument for mock interactions, but assertions like verify(…).check(network) are silently verifying check(null) rather than check(<mock>).

Consider adding @ExtendWith(MockitoExtension.class) to actually initialize the mocks, or just use local mock(…) calls (as already done for reportNode) to keep things explicit.

Proposed fix
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+
 `@RestClientTest`(NetworkModificationService.class)
+@ExtendWith(MockitoExtension.class)
 class NetworkModificationServiceTest {
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/internal/ProcessExecutionService.java (1)

71-79: ⚠️ Potential issue | 🔴 Critical

Compilation error: ProcessExecutionStatusUpdate has no 3-argument constructor.

The pipeline failure confirms this. ProcessExecutionStatusUpdate (via Lombok @AllArgsConstructor) expects four arguments: (ProcessStatus, String, Instant startedAt, Instant completedAt). The current code passes only three.

Additionally, the RUNNING status should set startedAt and the terminal statuses (COMPLETED/FAILED) should set completedAt.

🐛 Proposed fix
     private void updateExecutionStatus(UUID executionId, String envName, ProcessStatus status) {
         ProcessExecutionStatusUpdate processExecutionStatusUpdate = new ProcessExecutionStatusUpdate(
             status,
             envName,
-            status == ProcessStatus.COMPLETED || status == ProcessStatus.FAILED ? Instant.now() : null
+            status == ProcessStatus.RUNNING ? Instant.now() : null,
+            status == ProcessStatus.COMPLETED || status == ProcessStatus.FAILED ? Instant.now() : null
         );
 
         notificationService.updateExecutionStatus(executionId, processExecutionStatusUpdate);
     }

Alternatively, using the builder for clarity:

ProcessExecutionStatusUpdate.builder()
    .status(status)
    .executionEnvName(envName)
    .startedAt(status == ProcessStatus.RUNNING ? Instant.now() : null)
    .completedAt(status == ProcessStatus.COMPLETED || status == ProcessStatus.FAILED ? Instant.now() : null)
    .build();
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/NetworkModificationRestClient.java (1)

40-53: ⚠️ Potential issue | 🔴 Critical

Test expectations do not match production code's API request pattern.

The getModifications method constructs a single bulk request with uuids as query parameters:

/v1/network-composite-modifications/network-modifications?uuids=<uuid1>&uuids=<uuid2>&onlyMetadata=false

However, the test in NetworkModificationRestClientTest.java (lines 65-76) sets up expectations for separate per-UUID requests:

/v1/network-composite-modification/<uuid>/network-modifications?onlyMetadata=false

When getModifications(Arrays.asList({uuid1, uuid2})) is called at line 78, the production code makes one bulk request, but MockRestServiceServer.verify() at line 53 expects two separate requests. The test will fail because:

  • Endpoint path differs: network-composite-modifications (plural) vs network-composite-modification (singular)
  • Request pattern differs: query-param-based bulk vs path-segment-based per-UUID

Update the test expectations to match the production code's bulk request approach, or refactor the production code to iterate per-UUID if that's the intended API contract.

🤖 Fix all issues with AI agents
In
`@monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClient.java`:
- Around line 1-6: The file CaseRestClient is missing the SPDX license
identifier in its header; update the file header in CaseRestClient.java to
include the SPDX-License-Identifier: MPL-2.0 comment (matching the other
new/modified files such as NetworkModificationRestClient and FilterRestClient)
so the top-of-file license block includes the SPDX line immediately after the
copyright/license text.

In
`@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/external/client/NetworkModificationRestClientTest.java`:
- Around line 56-80: The test stubs per-UUID endpoints but production
NetworkModificationRestClient.getModifications issues a single bulk call; update
NetworkModificationRestClientTest.getModifications to expect one GET to the bulk
URL used by the client
("/v1/network-composite-modifications/network-modifications?uuids=<comma-separated-UUIDs>&onlyMetadata=false")
instead of per-UUID MockRestRequestMatchers.requestTo entries, and return the
combined JSON array for that single request so the MockRestServiceServer matches
the actual call.
🧹 Nitpick comments (5)
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/securityanalysis/steps/SecurityAnalysisRunComputationStep.java (1)

43-47: Pre-existing FIXME comments on parameter and contingency handling.

Two FIXME comments indicate that parameter retrieval (line 43) and contingency fetching (line 46) are placeholder implementations. The current code hardcodes LineContingency for every contingency ID, which won't be correct for other contingency types. These are out of scope for this refactor but worth tracking.

Would you like me to open an issue to track resolving these FIXMEs?

monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/internal/StepExecutionService.java (1)

61-68: Pre-existing: sendReport failure marks step as FAILED despite successful execution.

If reportRestClient.sendReport() on line 63 throws (e.g., network error to the report server), the catch block marks the step as FAILED even though step.execute(context) completed successfully. This is pre-existing behavior, but worth considering whether sendReport failures should be handled separately (e.g., logged/retried) rather than failing the entire step.

monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/internal/ProcessExecutionServiceTest.java (2)

76-85: Consider verifying startedAt is set for the RUNNING status update.

Once the constructor bug in ProcessExecutionService is fixed (to pass startedAt for RUNNING), this test should also assert that startedAt != null for the RUNNING update and startedAt == null for the COMPLETED update to fully validate the timestamp contract.

♻️ Proposed enhancement
         inOrder.verify(notificationService).updateExecutionStatus(eq(executionId), argThat(update ->
                 update.getStatus() == ProcessStatus.RUNNING &&
                         update.getExecutionEnvName().equals(EXECUTION_ENV_NAME) &&
-                        update.getCompletedAt() == null
+                        update.getStartedAt() != null &&
+                        update.getCompletedAt() == null
         ));
         inOrder.verify(notificationService).updateExecutionStatus(eq(executionId), argThat(update ->
                 update.getStatus() == ProcessStatus.COMPLETED &&
                         update.getExecutionEnvName().equals(EXECUTION_ENV_NAME) &&
+                        update.getStartedAt() == null &&
                         update.getCompletedAt() != null
         ));

27-28: Minor: mixed assertion styles (assertThrows vs assertThatThrownBy).

Line 97 uses JUnit's assertThrows while Line 116 uses AssertJ's assertThatThrownBy. Consider picking one style for consistency. assertThatThrownBy is generally preferred when already using AssertJ, as it allows fluent chaining of message/cause assertions.

Also applies to: 97-97, 116-116

monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/external/adapter/NetworkConversionServiceTest.java (1)

91-102: Consider verifying getCaseDataSource is still called in the error path.

The happy-path test verifies caseRestClient.getCaseDataSource(caseUuid) (Line 81), but this verification is missing in the error-path test. Adding it would confirm the full call chain before the exception.

Suggested addition
             assertThatThrownBy(() -> networkConversionService.createNetwork(caseUuid, reportNode))
                     .isInstanceOf(PowsyblException.class)
                     .hasMessage("No importer found");
+            verify(caseRestClient).getCaseDataSource(caseUuid);
         }

Comment on lines +1 to +6
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Missing SPDX license identifier.

Other files modified or added in this PR include SPDX-License-Identifier: MPL-2.0 in the license header (e.g., NetworkModificationRestClient.java line 6, FilterRestClient.java line 6). This new file omits it.

Proposed fix
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ * SPDX-License-Identifier: MPL-2.0
  */
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
🤖 Prompt for AI Agents
In
`@monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClient.java`
around lines 1 - 6, The file CaseRestClient is missing the SPDX license
identifier in its header; update the file header in CaseRestClient.java to
include the SPDX-License-Identifier: MPL-2.0 comment (matching the other
new/modified files such as NetworkModificationRestClient and FilterRestClient)
so the top-of-file license block includes the SPDX line immediately after the
copyright/license text.

Comment on lines 56 to 80
@Test
void getModifications() {
UUID[] modificationUuids = {MODIFICATION_1_UUID, MODIFICATION_2_UUID};

ModificationInfos modificationInfos1 = LoadModificationInfos.builder().equipmentId("load1").q0(new AttributeModification<>(300., OperationType.SET)).build();
ModificationInfos modificationInfos2 = LoadModificationInfos.builder().equipmentId("load2").q0(new AttributeModification<>(null, OperationType.UNSET)).build();

List<ModificationInfos> modificationInfos = List.of(modificationInfos1, modificationInfos2);
ModificationInfos[] modificationsArray = modificationInfos.toArray(ModificationInfos[]::new);
ModificationInfos[] modificationInfos = {modificationInfos1, modificationInfos2};

try {
server.expect(MockRestRequestMatchers.method(HttpMethod.GET))
.andExpect(MockRestRequestMatchers.requestTo("http://network-modification-server/v1/network-composite-modifications/network-modifications?uuids=" + MODIFICATION_1_UUID + "&uuids=" + MODIFICATION_2_UUID + "&onlyMetadata=false"))
.andRespond(MockRestResponseCreators.withSuccess()
.contentType(MediaType.APPLICATION_JSON)
.body(objectMapper.writeValueAsString(modificationsArray)));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
for (int i = 0; i < modificationUuids.length; i++) {
ModificationInfos[] modificationsArray = {modificationInfos[i]};
try {
server.expect(MockRestRequestMatchers.method(HttpMethod.GET))
.andExpect(MockRestRequestMatchers.requestTo("http://network-modification-server/v1/network-composite-modification/" + modificationUuids[i] + "/network-modifications?onlyMetadata=false"))
.andRespond(MockRestResponseCreators.withSuccess()
.contentType(MediaType.APPLICATION_JSON)
.body(objectMapper.writeValueAsString(modificationsArray)));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}

List<ModificationInfos> resultListModifications = networkModificationRestService.getModifications(List.of(MODIFICATION_1_UUID, MODIFICATION_2_UUID));
assertThat(resultListModifications).usingRecursiveComparison().isEqualTo(modificationInfos);
List<ModificationInfos> resultListModifications = networkModificationRestClient.getModifications(Arrays.asList(modificationUuids));
assertThat(resultListModifications).usingRecursiveComparison().isEqualTo(Arrays.asList(modificationInfos));
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Test URL expectations don't match the production getModifications implementation.

The test stubs per-UUID requests at path /v1/network-composite-modification/{uuid}/network-modifications?onlyMetadata=false (line 69), but the production code in NetworkModificationRestClient.getModifications constructs a single bulk request to /v1/network-composite-modifications/network-modifications?uuids=...&onlyMetadata=false.

This test will fail at runtime because MockRestServiceServer will never see requests matching these per-UUID stubs. This is the same root-cause issue flagged in NetworkModificationRestClient.java — the endpoint pattern must be reconciled between the two files.

🤖 Prompt for AI Agents
In
`@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/external/client/NetworkModificationRestClientTest.java`
around lines 56 - 80, The test stubs per-UUID endpoints but production
NetworkModificationRestClient.getModifications issues a single bulk call; update
NetworkModificationRestClientTest.getModifications to expect one GET to the bulk
URL used by the client
("/v1/network-composite-modifications/network-modifications?uuids=<comma-separated-UUIDs>&onlyMetadata=false")
instead of per-UUID MockRestRequestMatchers.requestTo entries, and return the
combined JSON array for that single request so the MockRestServiceServer matches
the actual call.

@khouadrired khouadrired closed this Feb 9, 2026
@khouadrired khouadrired deleted the GRD-3891-refactor-monitor-worker-server-services-structure branch February 9, 2026 13:30
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