-
Notifications
You must be signed in to change notification settings - Fork 0
Move parameters from study-server #81
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
Conversation
|
e12fd7d
to
8147f0c
Compare
828480e
to
3ac7d11
Compare
src/main/java/org/gridsuite/shortcircuit/server/ParametersController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/converter/UuidHttpConverter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/ParametersController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/dto/ShortCircuitParametersInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/dto/ShortCircuitParametersInfos.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/shortcircuit/server/dto/ShortCircuitParametersInfosTest.java
Show resolved
Hide resolved
src/test/java/org/gridsuite/shortcircuit/server/dto/ShortCircuitParametersInfosTest.java
Show resolved
Hide resolved
src/test/java/org/gridsuite/shortcircuit/server/service/AnalysisParametersTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/gridsuite/shortcircuit/server/service/ShortCircuitServiceTest.java
Outdated
Show resolved
Hide resolved
|
||
@ExtendWith({ MockitoExtension.class }) | ||
@Slf4j | ||
class ShortCircuitWorkerServiceTest implements WithAssertions { |
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.
Can you extract that in another PR ?
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.
done in #581, but can't really "move" out of this PR as the worker-service-test use the wrong name that I need
4805ebf
to
c470c99
Compare
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.
Can you reduce a bit the unitary testing and add more integrated tests instead ? From the parameters controller endpoints to the DB for example.
src/main/java/org/gridsuite/shortcircuit/server/dto/ShortCircuitPredefinedConfiguration.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/ShortCircuitController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/ShortCircuitParametersController.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/entities/AnalysisParametersEntity.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/entities/AnalysisParametersEntity.java
Outdated
Show resolved
Hide resolved
void testUpdate2() { | ||
AnalysisParametersEntity entity1 = new AnalysisParametersEntity(); | ||
AnalysisParametersEntity entity2 = new AnalysisParametersEntity( | ||
ShortCircuitConstants.DEFAULT_WITH_LIMIT_VIOLATIONS, |
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.
Why don't you use these ShortCircuitConstants in the definition of default values in the entity ?
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.
Because their the defaults of PowSyBl, not the GridSuite ones.
And I use this fact to create differences in this test.
src/test/java/org/gridsuite/shortcircuit/server/service/ShortCircuitServiceTest.java
Show resolved
Hide resolved
verify(pEntity).getPredefinedParameters(); | ||
verify(pEntity).isWithLimitViolations(); | ||
verify(pEntity).isWithVoltageResult(); | ||
verify(pEntity).isWithFortescueResult(); | ||
verify(pEntity).isWithFeederResult(); | ||
verify(pEntity).getStudyType(); | ||
verify(pEntity).getMinVoltageDropProportionalThreshold(); | ||
verify(pEntity).isWithLoads(); | ||
verify(pEntity).isWithShuntCompensators(); | ||
verify(pEntity).isWithVscConverterStations(); | ||
verify(pEntity).isWithNeutralPosition(); | ||
verify(pEntity, atLeastOnce()).getInitialVoltageProfileMode(); |
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.
Not sure this is really necessary
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.
It's not an important check, but necessary to pass verifyNoMoreInteractions()
.
return CompletableFuture.completedFuture(this.result); | ||
} | ||
@Test | ||
void testUpdateExistingParameters() { |
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.
In the end what do you want to test ? There are too many checks here, it feels like not all of them bring value
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.
I added comments to explain, and I de-duplicate some code.
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.
You created a lot of test code for just few lines of code in ShortCircuitService, that's a bit of overtesting here
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.
I just tested all cases possibles:
- get+delete+update+reset * existing+non-existing in db
- create + create default
I don't think there is more than these cases that can happen?
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.
I said you overtested this
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.
You mean too much test cases or too much checks in a test?
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.
we don't have the same results as before, the "withFortescueResult" should be set to true only in case of "One bus" analysis
src/main/java/org/gridsuite/shortcircuit/server/service/ShortCircuitService.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/shortcircuit/server/service/ShortCircuitService.java
Outdated
Show resolved
Hide resolved
@Getter | ||
@Setter | ||
@Entity | ||
@Table(name = "shortcircuit_parameters") |
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.
@Table(name = "shortcircuit_parameters") | |
@Table(name = "short_circuit_parameters") |
in order for the data migration script to work, the parameters table must have the same name as the one defined in study-server
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.
Problem fixed in gridsuite/deployment#417
|
Need PR #96 to have correct diff.