-
Notifications
You must be signed in to change notification settings - Fork 33
SMHE-2342 Job Clear Alarm Register overschrijft Alarm Registers allee… #1701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
…n wanneer status groter is dan nul
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a performance optimization for the Clear Alarm Register command executor by adding a check to avoid unnecessary clearing operations when no alarms are present. The optimization reads the alarm registers first to determine if any alarms exist before proceeding with the clearing process.
Key changes:
- Added early return logic to skip clearing operations when no alarms are present
- Enhanced test coverage with mock implementations for the new read functionality
- Updated simulator test data to provide more realistic alarm values
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
ClearAlarmRegisterCommandExecutor.java | Added dependency injection for ReadAlarmRegisterCommandExecutor and implemented alarmsArePresent() check |
ClearAlarmRegisterCommandExecutorTest.java | Updated constructor calls and added comprehensive mocking for the new read alarm functionality |
SimulatedAlarmObjectSteps.java | Refactored alarm values from single constant to multiple register-specific values |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
this.readAlarmRegisterCommandExecutor.execute(conn, device, null, null); | ||
|
||
return !alarmRegisterResponse.getAlarmTypes().isEmpty(); | ||
} catch (final ProtocolAdapterException e) { |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The catch block silently returns false without logging the exception. This could mask important errors and make debugging difficult. Consider logging the exception or providing more specific error handling.
} catch (final ProtocolAdapterException e) { | |
} catch (final ProtocolAdapterException e) { | |
log.error("Exception occurred while reading alarm register in alarmsArePresent", e); |
Copilot uses AI. Check for mistakes.
when(this.readAlarmRegisterCommandExecutor.execute( | ||
this.connectionManager, dlmsDevice, null, null)) | ||
.thenReturn(new AlarmRegisterResponseDto(this.getAlarmRegister1())); |
Copilot
AI
Oct 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repeated pattern of mocking readAlarmRegisterCommandExecutor.execute() with null parameters appears in multiple test methods. Consider extracting this into a helper method to reduce code duplication and improve maintainability.
Copilot uses AI. Check for mistakes.
|
…n wanneer status groter is dan nul