-
Notifications
You must be signed in to change notification settings - Fork 0
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
Move directory #162
Move directory #162
Conversation
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
notifyDirectoryHasChanged(oldDirectory.getId(), userId, element.getName()); | ||
|
||
} | ||
|
||
private void validateElementForMove(DirectoryElementEntity element, UUID newDirectoryUuid, String userId) { | ||
if (element.getType().equals(DIRECTORY)) { | ||
throw new DirectoryException(IS_DIRECTORY); | ||
if (Objects.equals(element.getType(), DIRECTORY) && element.getParentId() == 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.
element.getType can be null? why using Objects.equals
@@ -586,9 +586,29 @@ public void testMoveDirectory() throws Exception { | |||
.header("userId", "Doe") | |||
.contentType(MediaType.APPLICATION_JSON) | |||
.content(objectMapper.writeValueAsString(List.of(directory21UUID)))) | |||
.andExpect(status().isForbidden()); | |||
.andExpect(status().isOk()); |
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.
add rootdirectory case? forbidden
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Just need a test to move a root directory |
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Remove Sonar issue ! |
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
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 tests and code look good overall. However, there is an issue with moving the directory to the same location, as we still receive a notification on the front end.
if (element.getParentId() == newDirectoryUuid) { // Same directory ? | ||
return; | ||
} |
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.
small bug here , '==' does not work on uuids
if (element.getParentId() == newDirectoryUuid) { // Same directory ? | |
return; | |
} | |
if (element.getParentId().equals(newDirectoryUuid)) { // Same directory ? | |
return; | |
} |
may be we need a small unit test for this case also ?
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, i used Objects.equals(element.getParentId(), newDirectoryUuid) because parentId could be null
Signed-off-by: Seddik Yengui <seddik.yengui@rte-france.com>
Quality Gate passedIssues Measures |
No description provided.