Skip to content
Merged
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 @@ -25,7 +25,7 @@ public class LoadFlowRestClient {

public LoadFlowRestClient(
RestClient.Builder restClientBuilder,
@Value("${gridsuite.services.load-flow-server.base-uri:http://load-flow-server/}") String loadFlowServerBaseUri) {
@Value("${gridsuite.services.loadflow-server.base-uri:http://loadflow-server/}") String loadFlowServerBaseUri) {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Preserve backward compatibility for the renamed property key.

On Line 28, the key rename is breaking for environments still using gridsuite.services.load-flow-server.base-uri; they will silently fall back to the default URL. Please support both keys during migration (downstream impact: add/adjust tests for legacy-key binding).

Proposed backward-compatible binding
-        `@Value`("${gridsuite.services.loadflow-server.base-uri:http://loadflow-server/}") String loadFlowServerBaseUri) {
+        `@Value`("${gridsuite.services.loadflow-server.base-uri:${gridsuite.services.load-flow-server.base-uri:http://loadflow-server/}}")
+        String loadFlowServerBaseUri) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/clients/LoadFlowRestClient.java`
at line 28, The constructor parameter loadFlowServerBaseUri in
LoadFlowRestClient currently binds only to
gridsuite.services.loadflow-server.base-uri which breaks environments using the
old key gridsuite.services.load-flow-server.base-uri; update the `@Value` binding
on the constructor (or the property resolution logic used by LoadFlowRestClient)
to read from the new key first and fall back to the legacy key, and then to the
default "http://loadflow-server/" if neither is set, ensuring both
gridsuite.services.loadflow-server.base-uri and
gridsuite.services.load-flow-server.base-uri are supported; also update/add
unit/integration tests to assert that legacy-key binding still resolves
correctly.

this.restClient = restClientBuilder
.baseUrl(loadFlowServerBaseUri + "/" + LOADFLOW_API_VERSION)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ gridsuite:
base-uri: http://localhost:5007
filter-server:
base-uri: http://localhost:5027
load-flow-server:
loadflow-server:
base-uri: http://localhost:5008
actions-server:
base-uri: http://localhost:5022
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void getParameters() throws JsonProcessingException {

server.expect(MockRestRequestMatchers.method(HttpMethod.GET))
.andExpect(MockRestRequestMatchers.requestTo(
"http://load-flow-server/v1/parameters/" + PARAMETERS_UUID))
"http://loadflow-server/v1/parameters/" + PARAMETERS_UUID))
.andRespond(MockRestResponseCreators.withSuccess()
.contentType(MediaType.APPLICATION_JSON)
.body(objectMapper.writeValueAsString(expectedParameters)));
Expand All @@ -69,7 +69,7 @@ void getParameters() throws JsonProcessingException {
void getParametersNotFound() {
server.expect(MockRestRequestMatchers.method(HttpMethod.GET))
.andExpect(MockRestRequestMatchers.requestTo(
"http://load-flow-server/v1/parameters/" + PARAMETERS_ERROR_UUID))
"http://loadflow-server/v1/parameters/" + PARAMETERS_ERROR_UUID))
.andRespond(MockRestResponseCreators.withServerError());

assertThatThrownBy(() -> loadFlowRestClient.getParameters(PARAMETERS_ERROR_UUID))
Expand Down
Loading