Skip to content

Conversation

@antoinebhs
Copy link
Contributor

PR Summary

@antoinebhs antoinebhs changed the title Split network conversion service Split NetworkConversionService Jan 27, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

NetworkConversionService was moved to a new package and now depends on a new CaseRestClient wrapper instead of constructing/holding a RestTemplate; tests were updated to mock or verify the new client, and a unit test for CaseRestClient was added.

Changes

Cohort / File(s) Summary
Service relocation & usage update
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/commons/steps/LoadNetworkStep.java, monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/adapter/NetworkConversionService.java
NetworkConversionService package changed to services.external.adapter. Constructor signature changed to accept CaseRestClient; internal RestTemplate usage removed/replaced with CaseRestClient. Import paths updated in caller (LoadNetworkStep).
New REST client wrapper
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClient.java
New Spring component CaseRestClient that configures a RestTemplate (via RestTemplateBuilder) and exposes getCaseDataSource(UUID) returning a CaseDataSourceClient.
Tests: adapt & add
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/LoadNetworkStepTest.java, monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/external/adapter/NetworkConversionServiceTest.java, monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/external/client/CaseRestClientTest.java
Import paths updated for LoadNetworkStepTest. NetworkConversionServiceTest refactored to Mockito-based tests with @Mock CaseRestClient/CaseDataSourceClient and @InjectMocks for NetworkConversionService; expectations/verifications changed to assert caseRestClient.getCaseDataSource(...) usage. New CaseRestClientTest added to assert getCaseDataSource returns a client.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Caller as LoadNetworkStep
participant Adapter as NetworkConversionService
participant Client as CaseRestClient
participant DataSrc as CaseDataSourceClient
participant Importer as Importer/ComputationManager

Caller->>Adapter: createNetwork(caseUuid, ...)
Adapter->>Client: getCaseDataSource(caseUuid)
Client->>DataSrc: construct/use RestTemplate-backed client
Adapter->>DataSrc: provide CaseDataSourceClient to importer
Adapter->>Importer: Importer.find(...) / importer.importData(...)
Importer->>Adapter: result / throw exception

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I found a client, snug and neat,
Wrapped Rest away, now light on feet.
Hopped from package to adapter lane,
CaseRest guides the data train.
A tiny hop, a cleaner beat.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
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.
Description check ❓ Inconclusive The PR description is empty, containing only a template placeholder with no actual content about the changes. Add a meaningful description explaining what was split, why, and the architectural benefits (e.g., separation of concerns, dependency injection improvements).
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Split NetworkConversionService' accurately describes the main refactoring: extracting NetworkConversionService responsibilities into separate components (CaseRestClient and the adapter pattern), which is clearly reflected across the changeset.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@antoinebhs antoinebhs force-pushed the separate-conversion-client branch from 5d6bff2 to 0594399 Compare January 27, 2026 15:59
@sonarqubecloud
Copy link

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.

1 participant