Skip to content
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

Merged
merged 18 commits into from
Dec 12, 2024
Merged

Conversation

klesaulnier
Copy link
Contributor

No description provided.

LE SAULNIER Kevin added 12 commits November 29, 2024 14:14
…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]>
@SlimaneAmar SlimaneAmar self-requested a review December 9, 2024 13:03
.reportUuid(this.reportUuid)
.build();

if (this.rootNetworkNodeInfos != null) {
Copy link
Contributor

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<>();

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleteCreationRequest ?

Copy link
Contributor Author

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

Copy link
Contributor Author

@klesaulnier klesaulnier Dec 11, 2024

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need assertIsRootNetworkInStudy ?

Copy link
Contributor Author

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 ?

}

@Test
void testDeleteRootNetwork() throws Exception {
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

Signed-off-by: LE SAULNIER Kevin <[email protected]>
@klesaulnier klesaulnier merged commit 7e9ea57 into root-network-creation Dec 12, 2024
4 checks passed
@klesaulnier klesaulnier deleted the root-network-delete branch December 12, 2024 12:31
klesaulnier added a commit that referenced this pull request Dec 12, 2024
Signed-off-by: LE SAULNIER Kevin <[email protected]>
Co-authored-by: Slimane AMAR <[email protected]>
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.

2 participants