-
Notifications
You must be signed in to change notification settings - Fork 2
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
Root network deletion #643
Conversation
Signed-off-by: LE SAULNIER Kevin <[email protected]>
…to prevent circular dependencies Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
… creation request -> deletion Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: LE SAULNIER Kevin <[email protected]>
src/main/java/org/gridsuite/study/server/RestResponseEntityExceptionHandler.java
Outdated
Show resolved
Hide resolved
.reportUuid(this.reportUuid) | ||
.build(); | ||
|
||
if (this.rootNetworkNodeInfos != null) { |
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.
Need to initialize with empty list et remove test
private List<RootNetworkNodeInfoEntity> rootNetworkNodeInfos = new ArrayList<>();
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've tried to do it but it's breaking tests, causing NPE when calling "addRootNetworkNodeInfo"
@@ -292,7 +295,8 @@ public RootNetworkCreationRequestInfos createRootNetwork(UUID studyUuid, UUID ca | |||
try { | |||
networkConversionService.persistNetwork(caseUuid, studyUuid, rootNetworkUuid, null, userId, importReportUuid, caseFormat, importParameters, CaseImportAction.ROOT_NETWORK_CREATION); | |||
} catch (Exception e) { | |||
//TODO: implement rootNetworkService.deleteRootNetworkIfNotCreationInProgress(rootNetworkCreationRequestEntity.getId(), userId); | |||
//TODO: don't throw another error if deletion fails ? | |||
rootNetworkService.delete(rootNetworkUuid); |
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.
deleteCreationRequest
?
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.
good point, I'll add a test for this case, a failing creation should not stay in database
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.
fixed
I even removed the previous delete
it would not have done anything since no rootNetworkEntity will be in database if the http call fails
@@ -283,6 +279,13 @@ public BasicStudyInfos createStudy(UUID caseUuid, String userId, UUID studyUuid, | |||
} | |||
|
|||
@Transactional | |||
public void deleteRootNetwork(UUID studyUuid, UUID rootNetworkUuid, String userId) { | |||
assertIsStudyExist(studyUuid); | |||
rootNetworkService.assertIsRootNetworkInStudy(rootNetworkUuid, studyUuid); |
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.
Need assertIsRootNetworkInStudy
?
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 make the same assertion when deleting network modifications, but not when deleting nodes
but why do we need "studyUuid" in endpoint if we don't even use it ?
src/main/java/org/gridsuite/study/server/service/RootNetworkService.java
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
void testDeleteRootNetwork() throws Exception { |
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.
No need to test remote services with wiremock ?
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 think there is no remote service called here, all services supposed to make http calls to remote services are mocked and tested with Mockito
src/main/java/org/gridsuite/study/server/service/RootNetworkService.java
Show resolved
Hide resolved
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Signed-off-by: Slimane AMAR <[email protected]>
Signed-off-by: Slimane AMAR <[email protected]>
d16d334
to
ab18b2e
Compare
Quality Gate passedIssues Measures |
Signed-off-by: LE SAULNIER Kevin <[email protected]> Co-authored-by: Slimane AMAR <[email protected]>
No description provided.