diff --git a/Api/src/main/java/allchive/server/api/archiving/service/DeleteArchivingUseCase.java b/Api/src/main/java/allchive/server/api/archiving/service/DeleteArchivingUseCase.java index e7b7639e..2e5c631f 100644 --- a/Api/src/main/java/allchive/server/api/archiving/service/DeleteArchivingUseCase.java +++ b/Api/src/main/java/allchive/server/api/archiving/service/DeleteArchivingUseCase.java @@ -22,7 +22,9 @@ public class DeleteArchivingUseCase { private final RecycleDomainService recycleDomainService; @Transactional - @DistributedLock(lockType = DistributedLockType.ARCHIVING, identifier ={"archivingId"}) + @DistributedLock( + lockType = DistributedLockType.ARCHIVING, + identifier = {"archivingId"}) public void execute(Long archivingId) { Long userId = SecurityUtil.getCurrentUserId(); validateExecution(archivingId, userId); diff --git a/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingPinUseCase.java b/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingPinUseCase.java index 559f271c..9ee2df45 100644 --- a/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingPinUseCase.java +++ b/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingPinUseCase.java @@ -1,7 +1,6 @@ package allchive.server.api.archiving.service; -import allchive.server.api.config.security.SecurityUtil; import allchive.server.core.annotation.UseCase; import allchive.server.domain.common.aop.distributedLock.DistributedLock; import allchive.server.domain.common.enums.DistributedLockType; @@ -17,7 +16,9 @@ public class UpdateArchivingPinUseCase { private final ArchivingDomainService archivingDomainService; @Transactional - @DistributedLock(lockType = DistributedLockType.ARCHIVING_PIN, identifier ={"archivingId", "userId"}) + @DistributedLock( + lockType = DistributedLockType.ARCHIVING_PIN, + identifier = {"archivingId", "userId"}) public void execute(Long archivingId, Boolean cancel, Long userId) { validateExecution(archivingId, userId, cancel); archivingDomainService.updatePin(archivingId, userId, !cancel); diff --git a/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingScrapUseCase.java b/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingScrapUseCase.java index 2bc8e35e..59a9422e 100644 --- a/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingScrapUseCase.java +++ b/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingScrapUseCase.java @@ -3,7 +3,6 @@ import static allchive.server.core.consts.AllchiveConst.MINUS_ONE; import static allchive.server.core.consts.AllchiveConst.PLUS_ONE; -import allchive.server.api.config.security.SecurityUtil; import allchive.server.core.annotation.UseCase; import allchive.server.domain.common.aop.distributedLock.DistributedLock; import allchive.server.domain.common.enums.DistributedLockType; @@ -27,7 +26,9 @@ public class UpdateArchivingScrapUseCase { private final ScrapValidator scrapValidator; @Transactional - @DistributedLock(lockType = DistributedLockType.ARCHIVING_SCRAP, identifier ={"archivingId", "userId"}) + @DistributedLock( + lockType = DistributedLockType.ARCHIVING_SCRAP, + identifier = {"archivingId", "userId"}) public void execute(Long archivingId, Boolean cancel, Long userId) { validateExecution(archivingId, userId, cancel); User user = userAdaptor.findById(userId); diff --git a/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingUseCase.java b/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingUseCase.java index f9dc59ea..54f908c3 100644 --- a/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingUseCase.java +++ b/Api/src/main/java/allchive/server/api/archiving/service/UpdateArchivingUseCase.java @@ -5,15 +5,14 @@ import allchive.server.api.common.util.UrlUtil; import allchive.server.api.config.security.SecurityUtil; import allchive.server.core.annotation.UseCase; -import allchive.server.domain.common.aop.distributedLock.DistributedLock; -import allchive.server.domain.common.enums.DistributedLockType; import allchive.server.core.event.Event; import allchive.server.core.event.events.s3.S3ImageDeleteEvent; +import allchive.server.domain.common.aop.distributedLock.DistributedLock; +import allchive.server.domain.common.enums.DistributedLockType; import allchive.server.domain.domains.archiving.adaptor.ArchivingAdaptor; import allchive.server.domain.domains.archiving.domain.Archiving; import allchive.server.domain.domains.archiving.service.ArchivingDomainService; import allchive.server.domain.domains.archiving.validator.ArchivingValidator; -import allchive.server.infrastructure.s3.service.S3DeleteObjectService; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.transaction.annotation.Transactional; @@ -26,7 +25,9 @@ public class UpdateArchivingUseCase { private final ArchivingValidator archivingValidator; @Transactional - @DistributedLock(lockType = DistributedLockType.ARCHIVING, identifier ={"archivingId"}) + @DistributedLock( + lockType = DistributedLockType.ARCHIVING, + identifier = {"archivingId"}) public void execute(Long archivingId, UpdateArchivingRequest request) { validateExecution(archivingId); Archiving archiving = archivingAdaptor.findById(archivingId); diff --git a/Api/src/main/java/allchive/server/api/auth/service/WithdrawUserUseCase.java b/Api/src/main/java/allchive/server/api/auth/service/WithdrawUserUseCase.java index 01aa6dcb..ae6b4780 100644 --- a/Api/src/main/java/allchive/server/api/auth/service/WithdrawUserUseCase.java +++ b/Api/src/main/java/allchive/server/api/auth/service/WithdrawUserUseCase.java @@ -49,7 +49,9 @@ public class WithdrawUserUseCase { private final ArchivingDomainService archivingDomainService; @Transactional - @DistributedLock(lockType = DistributedLockType.USER, identifier ={"userId"}) + @DistributedLock( + lockType = DistributedLockType.USER, + identifier = {"userId"}) public void execute(String appleAccessToken, String referer, Long userId) { User user = userAdaptor.findById(userId); // oauth쪽 탈퇴 diff --git a/Api/src/main/java/allchive/server/api/block/service/DeleteBlockUseCase.java b/Api/src/main/java/allchive/server/api/block/service/DeleteBlockUseCase.java index 18825e7c..a8d741ed 100644 --- a/Api/src/main/java/allchive/server/api/block/service/DeleteBlockUseCase.java +++ b/Api/src/main/java/allchive/server/api/block/service/DeleteBlockUseCase.java @@ -23,7 +23,9 @@ public class DeleteBlockUseCase { private final UserAdaptor userAdaptor; @Transactional - @DistributedLock(lockType = DistributedLockType.BLOCK, identifier ={"fromUserId, toUserId"}) + @DistributedLock( + lockType = DistributedLockType.BLOCK, + identifier = {"fromUserId, toUserId"}) public BlockResponse execute(BlockRequest request, Long fromUserId, Long toUserId) { Long userId = SecurityUtil.getCurrentUserId(); validateExecution(userId, request); diff --git a/Api/src/main/java/allchive/server/api/content/model/dto/request/UpdateContentRequest.java b/Api/src/main/java/allchive/server/api/content/model/dto/request/UpdateContentRequest.java index 9d29def3..41eec628 100644 --- a/Api/src/main/java/allchive/server/api/content/model/dto/request/UpdateContentRequest.java +++ b/Api/src/main/java/allchive/server/api/content/model/dto/request/UpdateContentRequest.java @@ -5,6 +5,7 @@ import allchive.server.domain.domains.content.domain.enums.ContentType; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; +import javax.validation.constraints.Positive; import lombok.Getter; @Getter @@ -13,6 +14,7 @@ public class UpdateContentRequest { @ValidEnum(target = ContentType.class) private ContentType contentType; + @Positive @Schema(defaultValue = "0", description = "아카이빙 고유번호") private Long archivingId; diff --git a/Api/src/main/java/allchive/server/api/content/service/DeleteContentUseCase.java b/Api/src/main/java/allchive/server/api/content/service/DeleteContentUseCase.java index 7330621c..0675ccf5 100644 --- a/Api/src/main/java/allchive/server/api/content/service/DeleteContentUseCase.java +++ b/Api/src/main/java/allchive/server/api/content/service/DeleteContentUseCase.java @@ -29,7 +29,9 @@ public class DeleteContentUseCase { private final ArchivingAsyncDomainService archivingAsyncDomainService; @Transactional - @DistributedLock(lockType = DistributedLockType.CONTENT, identifier ={"contentId"}) + @DistributedLock( + lockType = DistributedLockType.CONTENT, + identifier = {"contentId"}) public void execute(Long contentId) { Long userId = SecurityUtil.getCurrentUserId(); validateExecution(contentId, userId); diff --git a/Api/src/main/java/allchive/server/api/content/service/UpdateContentUseCase.java b/Api/src/main/java/allchive/server/api/content/service/UpdateContentUseCase.java index 87e0e087..1637ddf5 100644 --- a/Api/src/main/java/allchive/server/api/content/service/UpdateContentUseCase.java +++ b/Api/src/main/java/allchive/server/api/content/service/UpdateContentUseCase.java @@ -44,7 +44,9 @@ public class UpdateContentUseCase { private final ArchivingAsyncDomainService archivingAsyncDomainService; @Transactional - @DistributedLock(lockType = DistributedLockType.CONTENT, identifier ={"contentId"}) + @DistributedLock( + lockType = DistributedLockType.CONTENT, + identifier = {"contentId"}) public void execute(Long contentId, UpdateContentRequest request) { validateExecution(contentId, request); regenerateContentTagGroup(contentId, request.getTagIds()); diff --git a/Api/src/main/java/allchive/server/api/recycle/controller/RecycleController.java b/Api/src/main/java/allchive/server/api/recycle/controller/RecycleController.java index 0648fe10..54b59b8e 100644 --- a/Api/src/main/java/allchive/server/api/recycle/controller/RecycleController.java +++ b/Api/src/main/java/allchive/server/api/recycle/controller/RecycleController.java @@ -14,9 +14,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; -import java.util.List; -import java.util.stream.Collectors; - @RestController @RequestMapping("/recycles") @RequiredArgsConstructor diff --git a/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java b/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java index aca1b168..96baf050 100644 --- a/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java +++ b/Api/src/main/java/allchive/server/api/recycle/service/ClearDeletedObjectUseCase.java @@ -1,7 +1,6 @@ package allchive.server.api.recycle.service; -import allchive.server.api.config.security.SecurityUtil; import allchive.server.api.recycle.model.dto.request.ClearDeletedObjectRequest; import allchive.server.core.annotation.UseCase; import allchive.server.core.event.Event; @@ -46,7 +45,9 @@ public class ClearDeletedObjectUseCase { private final ArchivingAdaptor archivingAdaptor; @Transactional - @DistributedLock(lockType = DistributedLockType.RECYCLE, identifier ={"userId"}) + @DistributedLock( + lockType = DistributedLockType.RECYCLE, + identifier = {"userId"}) public void execute(ClearDeletedObjectRequest request, Long userId) { validateExecution(userId, request); List contents = contentAdaptor.findAllByArchivingIds(request.getArchivingIds()); diff --git a/Api/src/main/java/allchive/server/api/recycle/service/RestoreDeletedObjectUseCase.java b/Api/src/main/java/allchive/server/api/recycle/service/RestoreDeletedObjectUseCase.java index d0b3d756..bbe1f22b 100644 --- a/Api/src/main/java/allchive/server/api/recycle/service/RestoreDeletedObjectUseCase.java +++ b/Api/src/main/java/allchive/server/api/recycle/service/RestoreDeletedObjectUseCase.java @@ -2,7 +2,6 @@ import static allchive.server.core.consts.AllchiveConst.PLUS_ONE; -import allchive.server.api.config.security.SecurityUtil; import allchive.server.api.recycle.model.dto.request.RestoreDeletedObjectRequest; import allchive.server.core.annotation.UseCase; import allchive.server.domain.common.aop.distributedLock.DistributedLock; @@ -30,7 +29,9 @@ public class RestoreDeletedObjectUseCase { private final ContentAdaptor contentAdaptor; @Transactional - @DistributedLock(lockType = DistributedLockType.RECYCLE, identifier ={"userId"}) + @DistributedLock( + lockType = DistributedLockType.RECYCLE, + identifier = {"userId"}) public void execute(RestoreDeletedObjectRequest request, Long userId) { validateExecution(request, userId); archivingDomainService.restoreByIdIn(request.getArchivingIds()); diff --git a/Api/src/main/java/allchive/server/api/tag/service/DeleteTagUseCase.java b/Api/src/main/java/allchive/server/api/tag/service/DeleteTagUseCase.java index 9d4c3122..78500ed7 100644 --- a/Api/src/main/java/allchive/server/api/tag/service/DeleteTagUseCase.java +++ b/Api/src/main/java/allchive/server/api/tag/service/DeleteTagUseCase.java @@ -22,7 +22,9 @@ public class DeleteTagUseCase { private final TagDomainService tagDomainService; @Transactional - @DistributedLock(lockType = DistributedLockType.TAG, identifier ={"tagId"}) + @DistributedLock( + lockType = DistributedLockType.TAG, + identifier = {"tagId"}) public void execute(Long tagId) { validateExecution(tagId); Tag tag = tagAdaptor.findById(tagId); diff --git a/Api/src/main/java/allchive/server/api/tag/service/UpdateTagUseCase.java b/Api/src/main/java/allchive/server/api/tag/service/UpdateTagUseCase.java index 7073e093..853ca5bc 100644 --- a/Api/src/main/java/allchive/server/api/tag/service/UpdateTagUseCase.java +++ b/Api/src/main/java/allchive/server/api/tag/service/UpdateTagUseCase.java @@ -18,7 +18,9 @@ public class UpdateTagUseCase { private final TagDomainService tagDomainService; @Transactional - @DistributedLock(lockType = DistributedLockType.TAG, identifier ={"tagId"}) + @DistributedLock( + lockType = DistributedLockType.TAG, + identifier = {"tagId"}) public void execute(Long tagId, UpdateTagRequest request) { validateExecution(tagId); tagDomainService.updateTag(tagId, request.getName()); diff --git a/Api/src/main/java/allchive/server/api/user/service/UpdateUserInfoUseCase.java b/Api/src/main/java/allchive/server/api/user/service/UpdateUserInfoUseCase.java index d78f0a4d..2a536f0a 100644 --- a/Api/src/main/java/allchive/server/api/user/service/UpdateUserInfoUseCase.java +++ b/Api/src/main/java/allchive/server/api/user/service/UpdateUserInfoUseCase.java @@ -2,7 +2,6 @@ import allchive.server.api.common.util.UrlUtil; -import allchive.server.api.config.security.SecurityUtil; import allchive.server.api.user.model.dto.request.UpdateUserInfoRequest; import allchive.server.core.annotation.UseCase; import allchive.server.core.event.Event; @@ -27,7 +26,9 @@ public class UpdateUserInfoUseCase { private final S3DeleteObjectService s3DeleteObjectService; @Transactional - @DistributedLock(lockType = DistributedLockType.USER, identifier ={"userId"}) + @DistributedLock( + lockType = DistributedLockType.USER, + identifier = {"userId"}) public void execute(UpdateUserInfoRequest request, Long userId) { validateExecution(userId); eliminateOldImage(userId, request.getImgUrl()); diff --git a/Core/src/main/java/allchive/server/core/CoreApplication.java b/Core/src/main/java/allchive/server/core/CoreApplication.java index 624109a2..4672b662 100644 --- a/Core/src/main/java/allchive/server/core/CoreApplication.java +++ b/Core/src/main/java/allchive/server/core/CoreApplication.java @@ -1,7 +1,7 @@ package allchive.server.core; + import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class CoreApplication { -} +public class CoreApplication {} diff --git a/Domain/src/main/java/allchive/server/domain/DomainApplication.java b/Domain/src/main/java/allchive/server/domain/DomainApplication.java index c187b4fc..9c763251 100644 --- a/Domain/src/main/java/allchive/server/domain/DomainApplication.java +++ b/Domain/src/main/java/allchive/server/domain/DomainApplication.java @@ -1,7 +1,7 @@ package allchive.server.domain; + import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class DomainApplication { -} +public class DomainApplication {} diff --git a/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLock.java b/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLock.java index cadd209c..5ca1fce4 100644 --- a/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLock.java +++ b/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLock.java @@ -2,7 +2,6 @@ import allchive.server.domain.common.enums.DistributedLockType; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLockAop.java b/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLockAop.java index 486997ca..fc521f28 100644 --- a/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLockAop.java +++ b/Domain/src/main/java/allchive/server/domain/common/aop/distributedLock/DistributedLockAop.java @@ -11,7 +11,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.Signature; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; @@ -38,10 +37,15 @@ public Object lock(final ProceedingJoinPoint joinPoint) throws Throwable { private String getKey(ProceedingJoinPoint joinPoint, DistributedLock distributedLock) { MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); String[] methodParameterNames = methodSignature.getParameterNames(); - return REDISSON_LOCK_PREFIX + distributedLock.lockType().getLockName() + "-" + createDynamicKey(methodParameterNames, joinPoint.getArgs(), distributedLock.identifier()); + return REDISSON_LOCK_PREFIX + + distributedLock.lockType().getLockName() + + "-" + + createDynamicKey( + methodParameterNames, joinPoint.getArgs(), distributedLock.identifier()); } - private String createDynamicKey(String[] methodParameterNames, Object[] methodArgs, String[] identifiers) { + private String createDynamicKey( + String[] methodParameterNames, Object[] methodArgs, String[] identifiers) { List resultList = new ArrayList<>(); for (String identifier : identifiers) { int indexOfKey = Arrays.asList(methodParameterNames).indexOf(identifier); diff --git a/Domain/src/main/java/allchive/server/domain/common/enums/DistributedLockType.java b/Domain/src/main/java/allchive/server/domain/common/enums/DistributedLockType.java index 61ce065e..8f2f897c 100644 --- a/Domain/src/main/java/allchive/server/domain/common/enums/DistributedLockType.java +++ b/Domain/src/main/java/allchive/server/domain/common/enums/DistributedLockType.java @@ -1,5 +1,6 @@ package allchive.server.domain.common.enums; + import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/Domain/src/main/java/allchive/server/domain/domains/archiving/repository/ArchivingCustomRepositoryImpl.java b/Domain/src/main/java/allchive/server/domain/domains/archiving/repository/ArchivingCustomRepositoryImpl.java index 7b576ea3..58a1bb47 100644 --- a/Domain/src/main/java/allchive/server/domain/domains/archiving/repository/ArchivingCustomRepositoryImpl.java +++ b/Domain/src/main/java/allchive/server/domain/domains/archiving/repository/ArchivingCustomRepositoryImpl.java @@ -20,6 +20,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; +import org.springframework.data.domain.Sort; @RequiredArgsConstructor public class ArchivingCustomRepositoryImpl implements ArchivingCustomRepository { @@ -31,6 +32,7 @@ public Slice querySliceArchivingExceptBlock( List blockList, Category category, Pageable pageable) { + List sorting = createdAtAndscrapCntDescPriority(pageable.getSort()); List archivings = queryFactory .select(archiving) @@ -40,7 +42,7 @@ public Slice querySliceArchivingExceptBlock( publicStatusTrue(), categoryEq(category), deleteStatusFalse()) - .orderBy(scrabListDesc(archivingIdList), scrapCntDesc(), createdAtDesc()) + .orderBy(scrabListDesc(archivingIdList), sorting.get(0), sorting.get(1)) .offset(pageable.getOffset()) .limit(pageable.getPageSize() + PLUS_ONE) .fetch(); @@ -68,6 +70,7 @@ public Slice querySliceArchivingByIdInExceptBlockList( List blockList, Category category, Pageable pageable) { + List sorting = createdAtAndscrapCntDescPriority(pageable.getSort()); List archivings = queryFactory .select(archiving) @@ -78,7 +81,7 @@ public Slice querySliceArchivingByIdInExceptBlockList( userIdNotIn(blockList), categoryEq(category), deleteStatusFalse()) - .orderBy(scrapCntDesc(), createdAtDesc()) + .orderBy(sorting.get(0), sorting.get(1)) .offset(pageable.getOffset()) .limit(pageable.getPageSize() + PLUS_ONE) .fetch(); @@ -212,6 +215,13 @@ private OrderSpecifier scrapCntDesc() { return archiving.scrapCnt.desc(); } + private List createdAtAndscrapCntDescPriority(Sort sort) { + if (sort.equals(Sort.by("popular"))) { + return List.of(archiving.scrapCnt.desc(), archiving.createdAt.desc()); + } + return List.of(archiving.createdAt.desc(), archiving.scrapCnt.desc()); + } + private OrderSpecifier createdAtDesc() { return archiving.createdAt.desc(); } diff --git a/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingAsyncDomainService.java b/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingAsyncDomainService.java index 4e10fc06..389874cd 100644 --- a/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingAsyncDomainService.java +++ b/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingAsyncDomainService.java @@ -14,7 +14,9 @@ public class ArchivingAsyncDomainService { private final ArchivingDomainService archivingDomainService; @Async(value = "archivingContentCntTaskExecutor") - @DistributedLock(lockType = DistributedLockType.ARCHIVING, identifier ={"archivingId"}) + @DistributedLock( + lockType = DistributedLockType.ARCHIVING, + identifier = {"archivingId"}) public void updateContentCnt(Long archivingId, ContentType contentType, int i) { archivingDomainService.updateContentCnt(archivingId, contentType, i); } diff --git a/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingDomainService.java b/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingDomainService.java index 22d6fef5..9ab09793 100644 --- a/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingDomainService.java +++ b/Domain/src/main/java/allchive/server/domain/domains/archiving/service/ArchivingDomainService.java @@ -1,7 +1,5 @@ package allchive.server.domain.domains.archiving.service; -import static allchive.server.core.consts.AllchiveConst.MINUS_ONE; -import static allchive.server.core.consts.AllchiveConst.PLUS_ONE; import allchive.server.core.annotation.DomainService; import allchive.server.domain.domains.archiving.adaptor.ArchivingAdaptor; diff --git a/Domain/src/main/java/allchive/server/domain/domains/recycle/repository/RecycleCustomRepositoryImpl.java b/Domain/src/main/java/allchive/server/domain/domains/recycle/repository/RecycleCustomRepositoryImpl.java index edc9c44f..cc243f1b 100644 --- a/Domain/src/main/java/allchive/server/domain/domains/recycle/repository/RecycleCustomRepositoryImpl.java +++ b/Domain/src/main/java/allchive/server/domain/domains/recycle/repository/RecycleCustomRepositoryImpl.java @@ -24,12 +24,10 @@ public List queryRecycleByUserIdAndArchivingIdInOrUserIdAndContentIdIn( .fetch(); } - private BooleanExpression userIdEq( - Long userId) { + private BooleanExpression userIdEq(Long userId) { return recycle.userId.eq(userId); } - private BooleanExpression archivingIdInOrContentIdIn( List archivingIdList, List contentIdList) { return recycle.archivingId.in(archivingIdList).or(recycle.contentId.in(contentIdList)); diff --git a/Domain/src/test/java/allchive/server/domain/CalculateCurrentExecutionSupporter.java b/Domain/src/test/java/allchive/server/domain/CalculateCurrentExecutionSupporter.java index 0e1a4c22..fce01668 100644 --- a/Domain/src/test/java/allchive/server/domain/CalculateCurrentExecutionSupporter.java +++ b/Domain/src/test/java/allchive/server/domain/CalculateCurrentExecutionSupporter.java @@ -1,12 +1,12 @@ package allchive.server.domain; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.function.Executable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.function.Executable; @Slf4j public class CalculateCurrentExecutionSupporter { @@ -33,4 +33,3 @@ public static void execute(Executable executable, AtomicLong successCount) latch.await(); } } - diff --git a/Domain/src/test/java/allchive/server/domain/DomainIntegrateSpringBootTest.java b/Domain/src/test/java/allchive/server/domain/DomainIntegrateSpringBootTest.java index bfc90513..52c5007e 100644 --- a/Domain/src/test/java/allchive/server/domain/DomainIntegrateSpringBootTest.java +++ b/Domain/src/test/java/allchive/server/domain/DomainIntegrateSpringBootTest.java @@ -1,11 +1,10 @@ package allchive.server.domain; +import java.lang.annotation.*; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; -import java.lang.annotation.*; - /** 도메인 모듈의 통합테스트의 편의성을 위해서 만든 어노테이션 -이찬진 */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/Domain/src/test/java/allchive/server/domain/common/aop/DistributedLockAopTest.java b/Domain/src/test/java/allchive/server/domain/common/aop/DistributedLockAopTest.java index 9b28e12c..b1533d7d 100644 --- a/Domain/src/test/java/allchive/server/domain/common/aop/DistributedLockAopTest.java +++ b/Domain/src/test/java/allchive/server/domain/common/aop/DistributedLockAopTest.java @@ -1,11 +1,13 @@ package allchive.server.domain.common.aop; +import static org.assertj.core.api.Assertions.assertThat; import allchive.server.domain.CalculateCurrentExecutionSupporter; import allchive.server.domain.common.aop.distributedLock.DistributedLock; import allchive.server.domain.common.aop.distributedLock.DistributedLockAop; import allchive.server.domain.common.enums.DistributedLockType; import allchive.server.infrastructure.redis.lock.LockManager; +import java.util.concurrent.atomic.AtomicLong; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -16,16 +18,11 @@ import org.springframework.stereotype.Service; import org.springframework.test.context.junit.jupiter.SpringExtension; -import java.util.concurrent.atomic.AtomicLong; - -import static org.assertj.core.api.Assertions.assertThat; - @Slf4j @SpringBootTest @ExtendWith(SpringExtension.class) public class DistributedLockAopTest { - @MockBean - LockManager lockManager; + @MockBean LockManager lockManager; DistributedLockAop distributedLockAop; private final RedissonService redissonService; @@ -44,9 +41,7 @@ public void beforeEach() { void 분산락_적용_동시성_테스트() throws InterruptedException { AtomicLong successCount = new AtomicLong(); CalculateCurrentExecutionSupporter.execute( - () -> redissonService.testWithLock(1), - successCount - ); + () -> redissonService.testWithLock(1), successCount); assertThat(redissonService.apply).isEqualTo((int) successCount.get()); } @@ -54,9 +49,7 @@ public void beforeEach() { void 분산락_미적용_동시성_테스트() throws InterruptedException { AtomicLong successCount = new AtomicLong(); CalculateCurrentExecutionSupporter.execute( - () -> redissonService.testWithoutLock(1), - successCount - ); + () -> redissonService.testWithoutLock(1), successCount); assertThat(redissonService.apply).isNotEqualTo((int) successCount.get()); } } @@ -74,6 +67,3 @@ void testWithoutLock(int id) { apply++; } } - - - diff --git a/Infrastructure/src/main/java/allchive/server/infrastructure/InfrastructureApplication.java b/Infrastructure/src/main/java/allchive/server/infrastructure/InfrastructureApplication.java index 35e23ec0..b84be9e0 100644 --- a/Infrastructure/src/main/java/allchive/server/infrastructure/InfrastructureApplication.java +++ b/Infrastructure/src/main/java/allchive/server/infrastructure/InfrastructureApplication.java @@ -1,7 +1,7 @@ package allchive.server.infrastructure; + import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class InfrastructureApplication { -} +public class InfrastructureApplication {}