refactor: move modificationUuids from ProcessConfig to ModifyingProcessConfig interface#43
refactor: move modificationUuids from ProcessConfig to ModifyingProcessConfig interface#43
Conversation
📝 WalkthroughWalkthroughIntroduces a new interface Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java (1)
27-27: Redundant explicit import ofMockito.The static wildcard import on line 35 (
import static org.mockito.Mockito.*) already covers all static methods. You can replaceMockito.mock(ProcessConfig.class)on line 89 with justmock(ProcessConfig.class)and drop this import.Proposed fix
-import org.mockito.Mockito;And on line 89:
- ProcessConfig processConfigMock = Mockito.mock(ProcessConfig.class); + ProcessConfig processConfigMock = mock(ProcessConfig.class);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java` at line 27, Remove the redundant explicit import of org.mockito.Mockito and use the existing static import of org.mockito.Mockito.*; replace usages like Mockito.mock(ProcessConfig.class) in ApplyModificationsStepTest (e.g., the call creating the ProcessConfig mock) with the shorter mock(ProcessConfig.class) so the static import is used consistently and the explicit import can be deleted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java`:
- Line 27: Remove the redundant explicit import of org.mockito.Mockito and use
the existing static import of org.mockito.Mockito.*; replace usages like
Mockito.mock(ProcessConfig.class) in ApplyModificationsStepTest (e.g., the call
creating the ProcessConfig mock) with the shorter mock(ProcessConfig.class) so
the static import is used consistently and the explicit import can be deleted.
…ssConfig interface Moved modificationUuids from ProcessConfig to ModifyingProcessConfig interface in order to make the ProcessConfig interface more generic. It is required for further developments related to SnapshotRefinerServer's connection to monitor-server Signed-off-by: Kamil MARUT <kamil.marut@rte-france.com>
22145fd to
9a1cc12
Compare
| @@ -0,0 +1,14 @@ | |||
| package org.gridsuite.monitor.commons; | |||
| */ | ||
| @Component | ||
| public class ApplyModificationsStep<C extends ProcessConfig> extends AbstractProcessStep<C> { | ||
| public class ApplyModificationsStep<C extends ModifyingProcessConfig> extends AbstractProcessStep<C> { |
There was a problem hiding this comment.
I pushed a change here to avoid the instanceof 169bcd9
There was a problem hiding this comment.
Let me know what you think
.../org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java`:
- Around line 85-95: Rename the test method to reflect the actual behavior under
test: change the method name
executeDoesNothingWhenConfigNotModifyingProcessConfig to
executeDoesNothingWhenModificationUuidsEmpty in ApplyModificationsStepTest;
ensure the test still creates a ModifyingProcessConfig mock, stubs
stepContext.getConfig(), calls applyModificationsStep.execute(stepContext), and
verifies no interactions with networkModificationService,
networkModificationRestService, and filterService, and update any references
(e.g., test runner or IDE-run configurations) to the new method name so the test
suite remains discoverable; this aligns the name with the guard in
ApplyModificationsStep.execute() that checks modificationUuids().
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStep.javamonitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
- monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStep.java
| @Test | ||
| void executeDoesNothingWhenConfigNotModifyingProcessConfig() { | ||
| ModifyingProcessConfig processConfigMock = mock(ModifyingProcessConfig.class); | ||
| when(stepContext.getConfig()).thenReturn(processConfigMock); | ||
|
|
||
| applyModificationsStep.execute(stepContext); | ||
|
|
||
| verifyNoInteractions(networkModificationService); | ||
| verifyNoInteractions(networkModificationRestService); | ||
| verifyNoInteractions(filterService); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
fd -e java "ApplyModificationsStep.java" --exec cat -n {} \;Repository: gridsuite/monitor-core
Length of output: 3106
Test name is misleading — rename to reflect actual behavior.
The test exercises the "does nothing" path, which is guarded by empty modificationUuids() (line 47 of ApplyModificationsStep.execute()), not by the config type. Rename from executeDoesNothingWhenConfigNotModifyingProcessConfig to executeDoesNothingWhenModificationUuidsEmpty to accurately describe what the test verifies.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java`
around lines 85 - 95, Rename the test method to reflect the actual behavior
under test: change the method name
executeDoesNothingWhenConfigNotModifyingProcessConfig to
executeDoesNothingWhenModificationUuidsEmpty in ApplyModificationsStepTest;
ensure the test still creates a ModifyingProcessConfig mock, stubs
stepContext.getConfig(), calls applyModificationsStep.execute(stepContext), and
verifies no interactions with networkModificationService,
networkModificationRestService, and filterService, and update any references
(e.g., test runner or IDE-run configurations) to the new method name so the test
suite remains discoverable; this aligns the name with the guard in
ApplyModificationsStep.execute() that checks modificationUuids().
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!



PR Summary
Moved modificationUuids from ProcessConfig to ModifyingProcessConfig interface in order to make the ProcessConfig interface more generic. It is required for further developments related to SnapshotRefinerServer's connection to monitor-server