Skip to content

Commit

Permalink
refactor: 락 설정 시 예외 발생하도록 변경 (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwonsheep authored Dec 11, 2024
1 parent d784b44 commit 205de23
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public Object handleDistributedLock(ProceedingJoinPoint joinPoint,
long timeout = loginUserIdDistributedLock.timeout();
Long userId = getUserIdFromArgs(joinPoint);

lockProvider.acquireLock(key, timeout, userId);
boolean lockCheck = lockProvider.acquireLock(key, timeout, userId);
if (!lockCheck) {
throw new LockException("락 설정 실패 : " + key);
}

try {
return joinPoint.proceed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ void setUp(
) {
// save test user
user = userRepository.save(
User.builder()
User
.builder()
.email("[email protected]")
.nickname("test")
.password("test")
Expand All @@ -87,9 +88,12 @@ void setUp(
general = folderRepository.save(Folder.createEmptyGeneralFolder(user, root, "React.js"));

// save tag
tag1 = tagRepository.save(Tag.builder().user(user).name("tag1").colorNumber(1).build());
tag2 = tagRepository.save(Tag.builder().user(user).name("tag2").colorNumber(1).build());
tag3 = tagRepository.save(Tag.builder().user(user).name("tag3").colorNumber(1).build());
tag1 = tagRepository.save(Tag
.builder().user(user).name("tag1").colorNumber(1).build());
tag2 = tagRepository.save(Tag
.builder().user(user).name("tag2").colorNumber(1).build());
tag3 = tagRepository.save(Tag
.builder().user(user).name("tag3").colorNumber(1).build());
}

@AfterEach
Expand Down Expand Up @@ -167,9 +171,10 @@ void folder_list_in_pick_list_test() {
PickCommand.ReadList readListCommand = pickApiMapper.toReadListCommand(user.getId(), folderIdList);

// when
List<PickResult.FolderPickList> folderPickList = pickService.getFolderListChildPickList(readListCommand);
List<PickResult.FolderPickWithViewCountList> folderPickList = pickService.getFolderListChildPickList(
readListCommand);

for (PickResult.FolderPickList list : folderPickList) {
for (PickResult.FolderPickWithViewCountList list : folderPickList) {
log.info("list: {} ", list.toString());
}

Expand Down Expand Up @@ -293,7 +298,7 @@ void update_data_with_null_test() {
// then
assertThat(updatePick.title()).isNotEqualTo(savePick.title()).isEqualTo(newTitle); // changed
assertThat(updatePick.tagIdOrderedList()).isNotEqualTo(savePick.tagIdOrderedList())
.isEqualTo(newTagOrder); // changed
.isEqualTo(newTagOrder); // changed
}
}

Expand Down

0 comments on commit 205de23

Please sign in to comment.