diff --git a/backend/pium/src/main/java/com/official/pium/admin/service/AdminService.java b/backend/pium/src/main/java/com/official/pium/admin/service/AdminService.java index bb45bbcc..04344955 100644 --- a/backend/pium/src/main/java/com/official/pium/admin/service/AdminService.java +++ b/backend/pium/src/main/java/com/official/pium/admin/service/AdminService.java @@ -1,7 +1,7 @@ package com.official.pium.admin.service; -import com.official.pium.admin.mapper.AdminMapper; import com.official.pium.admin.domain.Admin; +import com.official.pium.admin.mapper.AdminMapper; import com.official.pium.admin.service.dto.AdminLoginRequest; import jakarta.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Value; diff --git a/backend/pium/src/main/java/com/official/pium/admin/service/RegistrationService.java b/backend/pium/src/main/java/com/official/pium/admin/service/RegistrationService.java index f7705b2a..2a1b5030 100644 --- a/backend/pium/src/main/java/com/official/pium/admin/service/RegistrationService.java +++ b/backend/pium/src/main/java/com/official/pium/admin/service/RegistrationService.java @@ -1,14 +1,14 @@ package com.official.pium.admin.service; +import com.official.pium.admin.domain.Admin; import com.official.pium.admin.domain.Registration; -import com.official.pium.admin.service.dto.RegistrationRequest; -import com.official.pium.admin.service.dto.RegistrationResponse; import com.official.pium.admin.mapper.RegistrationMapper; import com.official.pium.admin.repository.RegistrationRepository; -import com.official.pium.admin.domain.Admin; +import com.official.pium.admin.service.dto.RegistrationRequest; +import com.official.pium.admin.service.dto.RegistrationResponse; +import com.official.pium.common.dto.DataResponse; import com.official.pium.common.exception.AuthorizationException; import com.official.pium.common.util.PhotoManager; -import com.official.pium.common.dto.DataResponse; import java.util.List; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; diff --git a/backend/pium/src/main/java/com/official/pium/admin/service/TestService.java b/backend/pium/src/main/java/com/official/pium/admin/service/TestService.java index 0a3b2856..e42cd300 100644 --- a/backend/pium/src/main/java/com/official/pium/admin/service/TestService.java +++ b/backend/pium/src/main/java/com/official/pium/admin/service/TestService.java @@ -1,6 +1,9 @@ package com.official.pium.admin.service; +import com.official.pium.petPlant.domain.PetPlant; +import com.official.pium.petPlant.event.notification.NotificationEvent; import com.official.pium.petPlant.repository.PetPlantRepository; +import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.context.ApplicationEventPublisher; @@ -16,63 +19,49 @@ public class TestService { private final PetPlantRepository petPlantRepository; private final ApplicationEventPublisher publisher; -// public void sendWaterNotificationTest() { -// List petPlants = petPlantRepository.findAllByMemberId(7L); -// List events = petPlants.stream() -// .map(plant -> NotificationEvent.builder() -// .title(plant.getNickname()) -// .body("(테스트 중) 물을 줄 시간이에요!") -// .deviceToken(plant.getMember().getDeviceToken()) -// .build() -// ).toList(); -// log.info("동기 알림 테스트 시작. Thread: " + Thread.currentThread().getId() + " " + Thread.currentThread().getName()); -// publisher.publishEvent(NotificationEvents.from(events)); -// log.info("동기 알림 테스트 종료. Thread: " + Thread.currentThread().getId() + " " + Thread.currentThread().getName()); -// } + public void sendWaterNotificationAsyncRampTest() { + List petPlants = petPlantRepository.findAllByMemberId(7L); + List events = petPlants.stream() + .map(plant -> NotificationEvent.builder() + .title(plant.getNickname()) + .body("(테스트 중) 물을 줄 시간이에요!") + .deviceToken(plant.getMember().getDeviceToken()) + .build() + ).toList(); -// public void sendWaterNotificationAsyncRampTest() { -// List petPlants = petPlantRepository.findAllByMemberId(7L); -// List events = petPlants.stream() -// .map(plant -> NotificationEvent.builder() -// .title(plant.getNickname()) -// .body("(테스트 중) 물을 줄 시간이에요!") -// .deviceToken(plant.getMember().getDeviceToken()) -// .build() -// ).toList(); + for (int i = 0; i < 100; i++) { + PetPlant petPlant = petPlants.get(i); + NotificationEvent event = NotificationEvent.builder() + .title(petPlant.getNickname()) + .body("물줘") + .deviceToken(petPlant.getMember().getDeviceToken()) + .build(); + publisher.publishEvent(event); + } -// for (int i = 0; i < 100; i++) { -// PetPlant petPlant = petPlants.get(i); -// NotificationEvent event = NotificationEvent.builder() -// .title(petPlant.getNickname()) -// .body("물줘") -// .deviceToken(petPlant.getMember().getDeviceToken()) -// .build(); -// publisher.publishEvent(event); -// } + log.info("비동기 테스트 램프업 시작"); + for (int i = 0; i < 100; i++) { + NotificationEvent notificationEvent = events.get(i); + publisher.publishEvent(notificationEvent); + } + } -// log.info("비동기 테스트 램프업 시작"); -// for (int i = 0; i < 100; i++) { -// NotificationEvent notificationEvent = events.get(i); -// publisher.publishEvent(notificationEvent); -// } -// } + public void sendWaterNotificationAsyncTest() { + List petPlants = petPlantRepository.findAllByMemberId(7L); + List events = petPlants.stream() + .map(plant -> NotificationEvent.builder() + .title(plant.getNickname()) + .body("(테스트 중) 물을 줄 시간이에요!") + .deviceToken(plant.getMember().getDeviceToken()) + .build() + ).toList(); -// public void sendWaterNotificationAsyncTest() { -// List petPlants = petPlantRepository.findAllByMemberId(7L); -// List events = petPlants.stream() -// .map(plant -> NotificationEvent.builder() -// .title(plant.getNickname()) -// .body("(테스트 중) 물을 줄 시간이에요!") -// .deviceToken(plant.getMember().getDeviceToken()) -// .build() -// ).toList(); -// -// int i = 1; -// log.info("비동기 알림 테스트 시작. Thread: " + Thread.currentThread().getId() + " " + Thread.currentThread().getName()); -// for (NotificationEvent event : events) { -// log.info(i++ + "번째 알림 이벤트"); -// publisher.publishEvent(event); -// } -// log.info("비동기 알림 테스트 종료. Thread: " + Thread.currentThread().getId() + " " + Thread.currentThread().getName()); -// } + int i = 1; + log.info("비동기 알림 테스트 시작. Thread: " + Thread.currentThread().getId() + " " + Thread.currentThread().getName()); + for (NotificationEvent event : events) { + log.info(i++ + "번째 알림 이벤트"); + publisher.publishEvent(event); + } + log.info("비동기 알림 테스트 종료. Thread: " + Thread.currentThread().getId() + " " + Thread.currentThread().getName()); + } } diff --git a/backend/pium/src/main/java/com/official/pium/admin/ui/RegistrationController.java b/backend/pium/src/main/java/com/official/pium/admin/ui/RegistrationController.java index f464d0bb..79d19948 100644 --- a/backend/pium/src/main/java/com/official/pium/admin/ui/RegistrationController.java +++ b/backend/pium/src/main/java/com/official/pium/admin/ui/RegistrationController.java @@ -1,11 +1,11 @@ package com.official.pium.admin.ui; +import com.official.pium.admin.domain.Admin; +import com.official.pium.admin.service.RegistrationService; import com.official.pium.admin.service.dto.RegistrationRequest; import com.official.pium.admin.service.dto.RegistrationResponse; -import com.official.pium.admin.service.RegistrationService; -import com.official.pium.admin.domain.Admin; -import com.official.pium.member.ui.Auth; import com.official.pium.common.dto.DataResponse; +import com.official.pium.member.ui.Auth; import jakarta.validation.constraints.Positive; import java.net.URI; import java.util.List; diff --git a/backend/pium/src/main/java/com/official/pium/common/ui/MemberArgumentResolver.java b/backend/pium/src/main/java/com/official/pium/common/ui/MemberArgumentResolver.java index 9e6c0f4d..a0c5003b 100644 --- a/backend/pium/src/main/java/com/official/pium/common/ui/MemberArgumentResolver.java +++ b/backend/pium/src/main/java/com/official/pium/common/ui/MemberArgumentResolver.java @@ -1,9 +1,9 @@ package com.official.pium.common.ui; -import com.official.pium.member.ui.Auth; -import com.official.pium.member.domain.Member; import com.official.pium.common.exception.AuthenticationException; +import com.official.pium.member.domain.Member; import com.official.pium.member.repository.MemberRepository; +import com.official.pium.member.ui.Auth; import com.official.pium.sessionGroup.application.SessionGroupService; import lombok.RequiredArgsConstructor; import org.springframework.core.MethodParameter; diff --git a/backend/pium/src/main/java/com/official/pium/common/util/PhotoLocalManager.java b/backend/pium/src/main/java/com/official/pium/common/util/PhotoLocalManager.java index 2e3d403f..c4539865 100644 --- a/backend/pium/src/main/java/com/official/pium/common/util/PhotoLocalManager.java +++ b/backend/pium/src/main/java/com/official/pium/common/util/PhotoLocalManager.java @@ -1,12 +1,11 @@ package com.official.pium.common.util; +import java.io.File; +import java.io.IOException; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; -import java.io.File; -import java.io.IOException; - @Component public class PhotoLocalManager implements PhotoManager { diff --git a/backend/pium/src/main/java/com/official/pium/config/AsyncConfig.java b/backend/pium/src/main/java/com/official/pium/config/AsyncConfig.java index 3518b7b7..d03994e5 100644 --- a/backend/pium/src/main/java/com/official/pium/config/AsyncConfig.java +++ b/backend/pium/src/main/java/com/official/pium/config/AsyncConfig.java @@ -1,21 +1,30 @@ package com.official.pium.config; -import java.util.concurrent.Executor; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.AsyncConfigurer; +import org.springframework.core.task.TaskExecutor; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Configuration @EnableAsync -public class AsyncConfig implements AsyncConfigurer { +public class AsyncConfig { - @Override - public Executor getAsyncExecutor() { + @Bean("notificationAsyncExecutor") + public TaskExecutor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(40); executor.setThreadNamePrefix("2024-Pium-Thread: "); executor.initialize(); return executor; } + + @Bean("notificationCallBackExecutor") + public TaskExecutor getCallBackExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(10); + executor.setThreadNamePrefix("2024-Pium-Call-Back-Thread: "); + executor.initialize(); + return executor; + } } diff --git a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/DictionaryPlantService.java b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/DictionaryPlantService.java index 3f3c701c..95a14120 100644 --- a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/DictionaryPlantService.java +++ b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/DictionaryPlantService.java @@ -1,13 +1,13 @@ package com.official.pium.dictionaryPlant.application; -import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.dictionaryPlant.repository.DictionaryPlantRepository; -import com.official.pium.petPlant.repository.PetPlantRepository; import com.official.pium.common.dto.DataResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantCreateRequest; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantSearchResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantUpdateRequest; +import com.official.pium.dictionaryPlant.domain.DictionaryPlant; +import com.official.pium.dictionaryPlant.repository.DictionaryPlantRepository; +import com.official.pium.petPlant.repository.PetPlantRepository; import java.util.List; import java.util.NoSuchElementException; import lombok.RequiredArgsConstructor; diff --git a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantCreateRequest.java b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantCreateRequest.java index 7a5a3146..e730f48b 100644 --- a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantCreateRequest.java +++ b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantCreateRequest.java @@ -1,11 +1,11 @@ package com.official.pium.dictionaryPlant.application.dto; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.petPlant.domain.vo.WaterCycle; import com.official.pium.dictionaryPlant.domain.vo.CareDetail; import com.official.pium.dictionaryPlant.domain.vo.Classification; import com.official.pium.dictionaryPlant.domain.vo.Property; import com.official.pium.petPlant.domain.vo.Temperature; +import com.official.pium.petPlant.domain.vo.WaterCycle; import jakarta.validation.constraints.NotNull; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantUpdateRequest.java b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantUpdateRequest.java index 14f81a9d..b71ac794 100644 --- a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantUpdateRequest.java +++ b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/application/dto/DictionaryPlantUpdateRequest.java @@ -1,10 +1,10 @@ package com.official.pium.dictionaryPlant.application.dto; -import com.official.pium.petPlant.domain.vo.WaterCycle; import com.official.pium.dictionaryPlant.domain.vo.CareDetail; import com.official.pium.dictionaryPlant.domain.vo.Classification; import com.official.pium.dictionaryPlant.domain.vo.Property; import com.official.pium.petPlant.domain.vo.Temperature; +import com.official.pium.petPlant.domain.vo.WaterCycle; import jakarta.validation.constraints.NotNull; import lombok.AccessLevel; import lombok.AllArgsConstructor; diff --git a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/ui/DictionaryPlantController.java b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/ui/DictionaryPlantController.java index e32bd33e..feb98307 100644 --- a/backend/pium/src/main/java/com/official/pium/dictionaryPlant/ui/DictionaryPlantController.java +++ b/backend/pium/src/main/java/com/official/pium/dictionaryPlant/ui/DictionaryPlantController.java @@ -3,8 +3,8 @@ import com.official.pium.admin.domain.Admin; import com.official.pium.admin.ui.AdminAuth; -import com.official.pium.dictionaryPlant.application.DictionaryPlantService; import com.official.pium.common.dto.DataResponse; +import com.official.pium.dictionaryPlant.application.DictionaryPlantService; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantCreateRequest; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantSearchResponse; diff --git a/backend/pium/src/main/java/com/official/pium/garden/application/GardenService.java b/backend/pium/src/main/java/com/official/pium/garden/application/GardenService.java index 2c8be118..677a692d 100644 --- a/backend/pium/src/main/java/com/official/pium/garden/application/GardenService.java +++ b/backend/pium/src/main/java/com/official/pium/garden/application/GardenService.java @@ -1,13 +1,13 @@ package com.official.pium.garden.application; +import com.official.pium.garden.application.dto.GardenCreateRequest; +import com.official.pium.garden.application.dto.GardenResponse; import com.official.pium.garden.domain.Garden; -import com.official.pium.member.domain.Member; -import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.garden.domain.vo.GardenPlantState; import com.official.pium.garden.repository.GardenRepository; +import com.official.pium.member.domain.Member; +import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.petPlant.repository.PetPlantRepository; -import com.official.pium.garden.application.dto.GardenCreateRequest; -import com.official.pium.garden.application.dto.GardenResponse; import java.time.LocalDate; import java.util.List; import java.util.NoSuchElementException; diff --git a/backend/pium/src/main/java/com/official/pium/garden/application/dto/GardenCreateRequest.java b/backend/pium/src/main/java/com/official/pium/garden/application/dto/GardenCreateRequest.java index c5555b39..aaf37f20 100644 --- a/backend/pium/src/main/java/com/official/pium/garden/application/dto/GardenCreateRequest.java +++ b/backend/pium/src/main/java/com/official/pium/garden/application/dto/GardenCreateRequest.java @@ -1,8 +1,8 @@ package com.official.pium.garden.application.dto; import com.official.pium.garden.domain.Garden; -import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.garden.domain.vo.GardenPlantState; +import com.official.pium.petPlant.domain.PetPlant; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; diff --git a/backend/pium/src/main/java/com/official/pium/garden/domain/Garden.java b/backend/pium/src/main/java/com/official/pium/garden/domain/Garden.java index 46f6cc05..ddb6eda7 100644 --- a/backend/pium/src/main/java/com/official/pium/garden/domain/Garden.java +++ b/backend/pium/src/main/java/com/official/pium/garden/domain/Garden.java @@ -2,8 +2,8 @@ import com.official.pium.common.domain.BaseEntity; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.member.domain.Member; import com.official.pium.garden.domain.vo.GardenPlantState; +import com.official.pium.member.domain.Member; import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; diff --git a/backend/pium/src/main/java/com/official/pium/garden/ui/GardenController.java b/backend/pium/src/main/java/com/official/pium/garden/ui/GardenController.java index 3d482c4a..2edd8eaa 100644 --- a/backend/pium/src/main/java/com/official/pium/garden/ui/GardenController.java +++ b/backend/pium/src/main/java/com/official/pium/garden/ui/GardenController.java @@ -1,10 +1,10 @@ package com.official.pium.garden.ui; -import com.official.pium.member.ui.Auth; -import com.official.pium.member.domain.Member; import com.official.pium.garden.application.GardenService; import com.official.pium.garden.application.dto.GardenCreateRequest; import com.official.pium.garden.application.dto.GardenResponse; +import com.official.pium.member.domain.Member; +import com.official.pium.member.ui.Auth; import jakarta.validation.Valid; import java.util.List; import lombok.RequiredArgsConstructor; diff --git a/backend/pium/src/main/java/com/official/pium/history/application/HistoryEventListener.java b/backend/pium/src/main/java/com/official/pium/history/application/HistoryEventListener.java index 8cba332f..20be57fd 100644 --- a/backend/pium/src/main/java/com/official/pium/history/application/HistoryEventListener.java +++ b/backend/pium/src/main/java/com/official/pium/history/application/HistoryEventListener.java @@ -1,15 +1,15 @@ package com.official.pium.history.application; -import com.official.pium.petPlant.event.history.HistoryEvent; -import com.official.pium.petPlant.event.history.HistoryEvents; -import com.official.pium.petPlant.event.history.LastWaterDateEvent; import com.official.pium.history.domain.History; import com.official.pium.history.domain.HistoryCategory; -import com.official.pium.history.domain.vo.HistoryContent; import com.official.pium.history.domain.HistoryType; -import com.official.pium.petPlant.domain.PetPlant; +import com.official.pium.history.domain.vo.HistoryContent; import com.official.pium.history.repository.HistoryCategoryRepository; import com.official.pium.history.repository.HistoryRepository; +import com.official.pium.petPlant.domain.PetPlant; +import com.official.pium.petPlant.event.history.HistoryEvent; +import com.official.pium.petPlant.event.history.HistoryEvents; +import com.official.pium.petPlant.event.history.LastWaterDateEvent; import com.official.pium.petPlant.repository.PetPlantRepository; import java.util.List; import java.util.NoSuchElementException; diff --git a/backend/pium/src/main/java/com/official/pium/history/application/HistoryService.java b/backend/pium/src/main/java/com/official/pium/history/application/HistoryService.java index ec13be99..9b88cfa8 100644 --- a/backend/pium/src/main/java/com/official/pium/history/application/HistoryService.java +++ b/backend/pium/src/main/java/com/official/pium/history/application/HistoryService.java @@ -1,12 +1,12 @@ package com.official.pium.history.application; +import com.official.pium.history.application.dto.HistoryResponse; import com.official.pium.history.domain.History; import com.official.pium.history.domain.HistoryType; +import com.official.pium.history.repository.HistoryRepository; import com.official.pium.member.domain.Member; import com.official.pium.petPlant.domain.PetPlant; -import com.official.pium.history.repository.HistoryRepository; import com.official.pium.petPlant.repository.PetPlantRepository; -import com.official.pium.history.application.dto.HistoryResponse; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; diff --git a/backend/pium/src/main/java/com/official/pium/history/domain/History.java b/backend/pium/src/main/java/com/official/pium/history/domain/History.java index 93d3e0c4..6dd4af67 100644 --- a/backend/pium/src/main/java/com/official/pium/history/domain/History.java +++ b/backend/pium/src/main/java/com/official/pium/history/domain/History.java @@ -1,8 +1,8 @@ package com.official.pium.history.domain; import com.official.pium.common.domain.BaseEntity; -import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.history.domain.vo.HistoryContent; +import com.official.pium.petPlant.domain.PetPlant; import jakarta.persistence.Column; import jakarta.persistence.Embedded; import jakarta.persistence.Entity; diff --git a/backend/pium/src/main/java/com/official/pium/history/ui/HistoryController.java b/backend/pium/src/main/java/com/official/pium/history/ui/HistoryController.java index 184116d7..4fe82164 100644 --- a/backend/pium/src/main/java/com/official/pium/history/ui/HistoryController.java +++ b/backend/pium/src/main/java/com/official/pium/history/ui/HistoryController.java @@ -2,10 +2,10 @@ import static org.springframework.data.domain.Sort.Direction.DESC; -import com.official.pium.member.ui.Auth; -import com.official.pium.member.domain.Member; import com.official.pium.history.application.HistoryService; import com.official.pium.history.application.dto.HistoryResponse; +import com.official.pium.member.domain.Member; +import com.official.pium.member.ui.Auth; import jakarta.validation.constraints.Positive; import java.util.List; import lombok.RequiredArgsConstructor; diff --git a/backend/pium/src/main/java/com/official/pium/member/application/AuthService.java b/backend/pium/src/main/java/com/official/pium/member/application/AuthService.java index 4cad7b7e..8853837c 100644 --- a/backend/pium/src/main/java/com/official/pium/member/application/AuthService.java +++ b/backend/pium/src/main/java/com/official/pium/member/application/AuthService.java @@ -1,10 +1,10 @@ package com.official.pium.member.application; -import com.official.pium.member.domain.Member; -import com.official.pium.member.repository.MemberRepository; import com.official.pium.member.application.dto.KaKaoAccessTokenResponse; import com.official.pium.member.application.dto.KakaoMemberResponse; import com.official.pium.member.application.dto.OAuthProvider; +import com.official.pium.member.domain.Member; +import com.official.pium.member.repository.MemberRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/backend/pium/src/main/java/com/official/pium/member/ui/AuthController.java b/backend/pium/src/main/java/com/official/pium/member/ui/AuthController.java index 01a03be7..00e51323 100644 --- a/backend/pium/src/main/java/com/official/pium/member/ui/AuthController.java +++ b/backend/pium/src/main/java/com/official/pium/member/ui/AuthController.java @@ -1,7 +1,7 @@ package com.official.pium.member.ui; -import com.official.pium.member.domain.Member; import com.official.pium.member.application.AuthService; +import com.official.pium.member.domain.Member; import com.official.pium.sessionGroup.application.SessionGroupService; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpSession; diff --git a/backend/pium/src/main/java/com/official/pium/notification/application/NotificationEventListener.java b/backend/pium/src/main/java/com/official/pium/notification/application/NotificationEventListener.java index ffbd5c56..8e59b582 100644 --- a/backend/pium/src/main/java/com/official/pium/notification/application/NotificationEventListener.java +++ b/backend/pium/src/main/java/com/official/pium/notification/application/NotificationEventListener.java @@ -15,7 +15,7 @@ public class NotificationEventListener { private final NotificationService notificationService; @EventListener - @Async + @Async("notificationAsyncExecutor") public void handleNotificationEvent(NotificationEvent event) { log.info("비동기 알림 START, Thread: " + Thread.currentThread().getId() + " " + Thread.currentThread().getName()); notificationService.sendNotification(event.getDeviceToken(), event.getTitle(), event.getBody()); diff --git a/backend/pium/src/main/java/com/official/pium/notification/fcm/application/FcmMessageSender.java b/backend/pium/src/main/java/com/official/pium/notification/fcm/application/FcmMessageSender.java index eba7f6dc..be811bdf 100644 --- a/backend/pium/src/main/java/com/official/pium/notification/fcm/application/FcmMessageSender.java +++ b/backend/pium/src/main/java/com/official/pium/notification/fcm/application/FcmMessageSender.java @@ -1,35 +1,56 @@ package com.official.pium.notification.fcm.application; +import com.google.api.core.ApiFuture; import com.google.auth.oauth2.GoogleCredentials; import com.google.firebase.FirebaseApp; import com.google.firebase.FirebaseOptions; import com.google.firebase.messaging.FirebaseMessaging; +import com.google.firebase.messaging.FirebaseMessagingException; import com.google.firebase.messaging.Message; +import com.google.firebase.messaging.MessagingErrorCode; import com.google.firebase.messaging.Notification; import com.official.pium.notification.application.MessageSendManager; +import com.official.pium.notification.fcm.config.CustomThreadManager; import jakarta.annotation.PostConstruct; import java.io.FileNotFoundException; import java.io.IOException; import java.util.concurrent.ExecutionException; -import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Component; +/** + * FCM reference docs URL: https://firebase.google.com/docs/cloud-messaging?hl=ko + * + * @author kim0914 + */ @Slf4j @Component -@RequiredArgsConstructor public class FcmMessageSender implements MessageSendManager { - @Value("${fcm.json.path}") - private String FCM_JSON_PATH; + private static final int MAX_RETRY_COUNT = 3; + private static final int[] LOOP_BACK_TIMES = new int[]{1000, 2000, 4000}; + + private final String fcmJsonPath; + private final TaskExecutor callBackTaskExecutor; + + public FcmMessageSender( + @Qualifier("notificationCallBackExecutor") TaskExecutor callBackTaskExecutor, + @Value("${fcm.json.path}") String fcmJsonPath + ) { + this.callBackTaskExecutor = callBackTaskExecutor; + this.fcmJsonPath = fcmJsonPath; + } @PostConstruct public void initialize() { try { - ClassPathResource resource = new ClassPathResource(FCM_JSON_PATH); + ClassPathResource resource = new ClassPathResource(fcmJsonPath); FirebaseOptions options = FirebaseOptions.builder() + .setThreadManager(new CustomThreadManager()) .setCredentials(GoogleCredentials.fromStream(resource.getInputStream())) .build(); @@ -52,13 +73,71 @@ public void sendMessageTo(String targetToken, String title, String body) { .setToken(targetToken) .setNotification(notification) .build(); + + ApiFuture apiFuture = FirebaseMessaging.getInstance().sendAsync(message); + + Runnable task = () -> extractAndLogResult(apiFuture, message); + apiFuture.addListener(task, callBackTaskExecutor); + } + + private void extractAndLogResult(ApiFuture apiFuture, Message message) { try { - String response = FirebaseMessaging.getInstance().sendAsync(message).get(); + String response = apiFuture.get(); log.info("알림 전송 성공 : " + response); + log.info("현재 스레드 NAME: " + Thread.currentThread().getName()); } catch (InterruptedException e) { log.error("FCM 알림 스레드에서 문제가 발생했습니다.", e); } catch (ExecutionException e) { - log.error("FCM 알림 전송에 실패했습니다.", e); + log.error("알림 전송 실패"); + if (e.getCause() instanceof FirebaseMessagingException exception) { + MessagingErrorCode errorCode = exception.getMessagingErrorCode(); + if (isRetryErrorCode(errorCode)) { + retryWithInThreeTimes(message); + } + } + } + } + + private void retryWithInThreeTimes(Message message) { + int count = 0; + while (count < MAX_RETRY_COUNT) { + log.info(count + 1 + "번째 재시도 입니다."); + try { + Thread.sleep(LOOP_BACK_TIMES[count]); + } catch (InterruptedException e) { + log.error("Thread Sleep Error"); + throw new RuntimeException(e); + } + boolean isRetrySuccess = retry(message); + if (isRetrySuccess) { + break; + } + count++; + } + + if (count == MAX_RETRY_COUNT) { + log.info("알림 재전송에 실패했습니다."); + } + } + + private boolean retry(Message message) { + try { + String response = FirebaseMessaging.getInstance().sendAsync(message).get(); + log.info("알림 재시도 성공 " + response); + } catch (Exception e) { + if (e.getCause() instanceof FirebaseMessagingException exception) { + MessagingErrorCode errorCode = exception.getMessagingErrorCode(); + if (isRetryErrorCode(errorCode)) { + log.info("알림 재시도 실패... 다시 시도합니다."); + return false; + } + } } + return true; + } + + private boolean isRetryErrorCode(MessagingErrorCode errorCode) { + return MessagingErrorCode.UNREGISTERED.equals(errorCode) || + MessagingErrorCode.UNAVAILABLE.equals(errorCode); } } diff --git a/backend/pium/src/main/java/com/official/pium/notification/fcm/config/CustomThreadManager.java b/backend/pium/src/main/java/com/official/pium/notification/fcm/config/CustomThreadManager.java new file mode 100644 index 00000000..4d3a161b --- /dev/null +++ b/backend/pium/src/main/java/com/official/pium/notification/fcm/config/CustomThreadManager.java @@ -0,0 +1,25 @@ +package com.official.pium.notification.fcm.config; + +import com.google.firebase.FirebaseApp; +import com.google.firebase.ThreadManager; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; + +public class CustomThreadManager extends ThreadManager { + + @Override + protected ExecutorService getExecutor(FirebaseApp firebaseApp) { + return Executors.newFixedThreadPool(40); + } + + @Override + protected void releaseExecutor(FirebaseApp firebaseApp, ExecutorService executorService) { + executorService.shutdownNow(); + } + + @Override + protected ThreadFactory getThreadFactory() { + return Executors.defaultThreadFactory(); + } +} diff --git a/backend/pium/src/main/java/com/official/pium/petPlant/application/PetPlantService.java b/backend/pium/src/main/java/com/official/pium/petPlant/application/PetPlantService.java index 7e7904c8..2b8656b4 100644 --- a/backend/pium/src/main/java/com/official/pium/petPlant/application/PetPlantService.java +++ b/backend/pium/src/main/java/com/official/pium/petPlant/application/PetPlantService.java @@ -1,22 +1,22 @@ package com.official.pium.petPlant.application; +import com.official.pium.common.dto.DataResponse; +import com.official.pium.common.util.PhotoManager; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; +import com.official.pium.dictionaryPlant.repository.DictionaryPlantRepository; import com.official.pium.history.domain.History; import com.official.pium.history.domain.HistoryType; +import com.official.pium.history.repository.HistoryRepository; import com.official.pium.member.domain.Member; +import com.official.pium.petPlant.application.dto.PetPlantCreateRequest; +import com.official.pium.petPlant.application.dto.PetPlantResponse; +import com.official.pium.petPlant.application.dto.PetPlantUpdateRequest; +import com.official.pium.petPlant.application.dto.SinglePetPlantResponse; import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.petPlant.event.history.HistoryEvent; import com.official.pium.petPlant.event.history.HistoryEvents; import com.official.pium.petPlant.event.history.PetPlantHistory; -import com.official.pium.dictionaryPlant.repository.DictionaryPlantRepository; -import com.official.pium.history.repository.HistoryRepository; import com.official.pium.petPlant.repository.PetPlantRepository; -import com.official.pium.common.util.PhotoManager; -import com.official.pium.common.dto.DataResponse; -import com.official.pium.petPlant.application.dto.PetPlantCreateRequest; -import com.official.pium.petPlant.application.dto.PetPlantResponse; -import com.official.pium.petPlant.application.dto.PetPlantUpdateRequest; -import com.official.pium.petPlant.application.dto.SinglePetPlantResponse; import java.time.LocalDate; import java.util.List; import java.util.NoSuchElementException; diff --git a/backend/pium/src/main/java/com/official/pium/petPlant/application/ReminderService.java b/backend/pium/src/main/java/com/official/pium/petPlant/application/ReminderService.java index aa3da94a..d8150a7e 100644 --- a/backend/pium/src/main/java/com/official/pium/petPlant/application/ReminderService.java +++ b/backend/pium/src/main/java/com/official/pium/petPlant/application/ReminderService.java @@ -88,11 +88,11 @@ public void sendWaterNotification() { } private void sendNotification(PetPlant petPlant) { - NotificationEvent.builder() + NotificationEvent event = NotificationEvent.builder() .title(petPlant.getNickname()) .body("물을 줄 시간이에요!") .deviceToken(petPlant.getMember().getDeviceToken()) .build(); - publisher.publishEvent(petPlant); + publisher.publishEvent(event); } } diff --git a/backend/pium/src/main/java/com/official/pium/petPlant/ui/PetPlantController.java b/backend/pium/src/main/java/com/official/pium/petPlant/ui/PetPlantController.java index 15be268e..abadedbc 100644 --- a/backend/pium/src/main/java/com/official/pium/petPlant/ui/PetPlantController.java +++ b/backend/pium/src/main/java/com/official/pium/petPlant/ui/PetPlantController.java @@ -1,9 +1,9 @@ package com.official.pium.petPlant.ui; -import com.official.pium.member.ui.Auth; +import com.official.pium.common.dto.DataResponse; import com.official.pium.member.domain.Member; +import com.official.pium.member.ui.Auth; import com.official.pium.petPlant.application.PetPlantService; -import com.official.pium.common.dto.DataResponse; import com.official.pium.petPlant.application.dto.PetPlantCreateRequest; import com.official.pium.petPlant.application.dto.PetPlantResponse; import com.official.pium.petPlant.application.dto.PetPlantUpdateRequest; @@ -36,8 +36,8 @@ public class PetPlantController { @GetMapping("/{id}") public ResponseEntity read( - @PathVariable @Positive(message = "반려 식물 ID는 1이상의 값이어야 합니다.") Long id, - @Auth Member member + @PathVariable @Positive(message = "반려 식물 ID는 1이상의 값이어야 합니다.") Long id, + @Auth Member member ) { PetPlantResponse petPlantResponse = petPlantService.read(id, member); return ResponseEntity.ok(petPlantResponse); @@ -45,9 +45,9 @@ public ResponseEntity read( @PostMapping(consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity create( - @RequestPart(name = "request") @Valid PetPlantCreateRequest request, - @RequestPart(name = "image", required = false) MultipartFile multipartFile, - @Auth Member member + @RequestPart(name = "request") @Valid PetPlantCreateRequest request, + @RequestPart(name = "image", required = false) MultipartFile multipartFile, + @Auth Member member ) { PetPlantResponse petPlantResponse = petPlantService.create(request, multipartFile, member); return ResponseEntity.created(URI.create("/pet-plants/" + petPlantResponse.getId())).build(); @@ -61,10 +61,10 @@ public ResponseEntity>> readAll(@Auth @PatchMapping(path = "/{id}", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE, MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity update( - @PathVariable @Positive(message = "반려 식물 ID는 1이상의 값이어야 합니다.") Long id, - @RequestPart(name = "request") @Valid PetPlantUpdateRequest petPlantUpdateRequest, - @RequestPart(name = "image", required = false) MultipartFile multipartFile, - @Auth Member member + @PathVariable @Positive(message = "반려 식물 ID는 1이상의 값이어야 합니다.") Long id, + @RequestPart(name = "request") @Valid PetPlantUpdateRequest petPlantUpdateRequest, + @RequestPart(name = "image", required = false) MultipartFile multipartFile, + @Auth Member member ) { petPlantService.update(id, petPlantUpdateRequest, multipartFile, member); return ResponseEntity.ok().build(); @@ -72,8 +72,8 @@ public ResponseEntity update( @DeleteMapping("/{id}") public ResponseEntity delete( - @PathVariable @Positive(message = "반려 식물 ID는 1이상의 값이어야 합니다.") Long id, - @Auth Member member + @PathVariable @Positive(message = "반려 식물 ID는 1이상의 값이어야 합니다.") Long id, + @Auth Member member ) { petPlantService.delete(id, member); return ResponseEntity.noContent().build(); diff --git a/backend/pium/src/main/java/com/official/pium/petPlant/ui/ReminderController.java b/backend/pium/src/main/java/com/official/pium/petPlant/ui/ReminderController.java index 698a708a..a90f6d74 100644 --- a/backend/pium/src/main/java/com/official/pium/petPlant/ui/ReminderController.java +++ b/backend/pium/src/main/java/com/official/pium/petPlant/ui/ReminderController.java @@ -1,9 +1,9 @@ package com.official.pium.petPlant.ui; -import com.official.pium.member.ui.Auth; +import com.official.pium.common.dto.DataResponse; import com.official.pium.member.domain.Member; +import com.official.pium.member.ui.Auth; import com.official.pium.petPlant.application.ReminderService; -import com.official.pium.common.dto.DataResponse; import com.official.pium.petPlant.application.dto.ReminderCreateRequest; import com.official.pium.petPlant.application.dto.ReminderResponse; import com.official.pium.petPlant.application.dto.ReminderUpdateRequest; diff --git a/backend/pium/src/main/java/com/official/pium/sessionGroup/application/SessionGroupService.java b/backend/pium/src/main/java/com/official/pium/sessionGroup/application/SessionGroupService.java index 8e4646e6..b55547b3 100644 --- a/backend/pium/src/main/java/com/official/pium/sessionGroup/application/SessionGroupService.java +++ b/backend/pium/src/main/java/com/official/pium/sessionGroup/application/SessionGroupService.java @@ -1,7 +1,7 @@ package com.official.pium.sessionGroup.application; -import com.official.pium.sessionGroup.domain.SessionGroup; import com.official.pium.common.exception.AuthenticationException; +import com.official.pium.sessionGroup.domain.SessionGroup; import com.official.pium.sessionGroup.repository.SessionGroupRepository; import java.time.Clock; import java.time.LocalDateTime; diff --git a/backend/pium/src/test/java/com/official/pium/UITest.java b/backend/pium/src/test/java/com/official/pium/UITest.java index 8ea1046e..c64771c4 100644 --- a/backend/pium/src/test/java/com/official/pium/UITest.java +++ b/backend/pium/src/test/java/com/official/pium/UITest.java @@ -5,8 +5,8 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.BDDMockito.given; -import com.official.pium.config.WebMvcConfigure; import com.official.pium.admin.domain.Admin; +import com.official.pium.config.WebMvcConfigure; import com.official.pium.member.domain.Member; import com.official.pium.member.repository.MemberRepository; import com.official.pium.sessionGroup.application.SessionGroupService; diff --git a/backend/pium/src/test/java/com/official/pium/acceptance/GardenApiTest.java b/backend/pium/src/test/java/com/official/pium/acceptance/GardenApiTest.java index d676513f..f1e3fe83 100644 --- a/backend/pium/src/test/java/com/official/pium/acceptance/GardenApiTest.java +++ b/backend/pium/src/test/java/com/official/pium/acceptance/GardenApiTest.java @@ -5,10 +5,10 @@ import com.official.pium.AcceptanceTest; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.member.domain.Member; import com.official.pium.fixture.GardenFixture; import com.official.pium.garden.application.dto.GardenCreateRequest; import com.official.pium.garden.application.dto.SingleGardenResponse; +import com.official.pium.member.domain.Member; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.ExtractableResponse; diff --git a/backend/pium/src/test/java/com/official/pium/acceptance/HistoryApiTest.java b/backend/pium/src/test/java/com/official/pium/acceptance/HistoryApiTest.java index e400bc91..beea6e6f 100644 --- a/backend/pium/src/test/java/com/official/pium/acceptance/HistoryApiTest.java +++ b/backend/pium/src/test/java/com/official/pium/acceptance/HistoryApiTest.java @@ -8,10 +8,10 @@ import com.official.pium.AcceptanceTest; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.petPlant.application.dto.PetPlantCreateRequest; import com.official.pium.petPlant.application.dto.PetPlantUpdateRequest; import com.official.pium.petPlant.application.dto.ReminderCreateRequest; +import com.official.pium.petPlant.domain.PetPlant; import io.restassured.RestAssured; import io.restassured.builder.MultiPartSpecBuilder; import io.restassured.http.ContentType; diff --git a/backend/pium/src/test/java/com/official/pium/acceptance/PetPlantApiTest.java b/backend/pium/src/test/java/com/official/pium/acceptance/PetPlantApiTest.java index c2fed7dd..d4e79f31 100644 --- a/backend/pium/src/test/java/com/official/pium/acceptance/PetPlantApiTest.java +++ b/backend/pium/src/test/java/com/official/pium/acceptance/PetPlantApiTest.java @@ -8,11 +8,11 @@ import com.official.pium.AcceptanceTest; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; import com.official.pium.member.domain.Member; -import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.petPlant.application.dto.PetPlantCreateRequest; import com.official.pium.petPlant.application.dto.PetPlantResponse; import com.official.pium.petPlant.application.dto.PetPlantUpdateRequest; import com.official.pium.petPlant.application.dto.ReminderCreateRequest; +import com.official.pium.petPlant.domain.PetPlant; import io.restassured.RestAssured; import io.restassured.builder.MultiPartSpecBuilder; import io.restassured.http.ContentType; diff --git a/backend/pium/src/test/java/com/official/pium/acceptance/ReminderApiTest.java b/backend/pium/src/test/java/com/official/pium/acceptance/ReminderApiTest.java index cd8face3..29b57449 100644 --- a/backend/pium/src/test/java/com/official/pium/acceptance/ReminderApiTest.java +++ b/backend/pium/src/test/java/com/official/pium/acceptance/ReminderApiTest.java @@ -8,10 +8,10 @@ import com.official.pium.AcceptanceTest; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.petPlant.domain.PetPlant; import com.official.pium.petPlant.application.dto.PetPlantCreateRequest; import com.official.pium.petPlant.application.dto.ReminderCreateRequest; import com.official.pium.petPlant.application.dto.ReminderUpdateRequest; +import com.official.pium.petPlant.domain.PetPlant; import io.restassured.RestAssured; import io.restassured.builder.MultiPartSpecBuilder; import io.restassured.http.ContentType; diff --git a/backend/pium/src/test/java/com/official/pium/admin/controller/RegistrationControllerTest.java b/backend/pium/src/test/java/com/official/pium/admin/controller/RegistrationControllerTest.java index 4b5b9285..9be1b457 100644 --- a/backend/pium/src/test/java/com/official/pium/admin/controller/RegistrationControllerTest.java +++ b/backend/pium/src/test/java/com/official/pium/admin/controller/RegistrationControllerTest.java @@ -12,13 +12,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.official.pium.UITest; +import com.official.pium.admin.domain.Admin; +import com.official.pium.admin.service.RegistrationService; import com.official.pium.admin.service.dto.RegistrationRequest; import com.official.pium.admin.service.dto.RegistrationResponse; -import com.official.pium.admin.service.RegistrationService; -import com.official.pium.admin.domain.Admin; import com.official.pium.admin.ui.RegistrationController; -import com.official.pium.fixture.FileFixture; import com.official.pium.common.dto.DataResponse; +import com.official.pium.fixture.FileFixture; import java.nio.charset.StandardCharsets; import java.util.List; import org.junit.jupiter.api.DisplayNameGeneration; diff --git a/backend/pium/src/test/java/com/official/pium/admin/service/RegistrationServiceTest.java b/backend/pium/src/test/java/com/official/pium/admin/service/RegistrationServiceTest.java index 9604bafa..6f9fc120 100644 --- a/backend/pium/src/test/java/com/official/pium/admin/service/RegistrationServiceTest.java +++ b/backend/pium/src/test/java/com/official/pium/admin/service/RegistrationServiceTest.java @@ -6,11 +6,11 @@ import com.amazonaws.services.s3.AmazonS3; import com.official.pium.IntegrationTest; +import com.official.pium.admin.domain.Admin; import com.official.pium.admin.domain.Registration; +import com.official.pium.admin.repository.RegistrationRepository; import com.official.pium.admin.service.dto.RegistrationRequest; import com.official.pium.admin.service.dto.RegistrationResponse; -import com.official.pium.admin.repository.RegistrationRepository; -import com.official.pium.admin.domain.Admin; import com.official.pium.common.exception.AuthorizationException; import com.official.pium.fixture.FileFixture; import java.util.List; diff --git a/backend/pium/src/test/java/com/official/pium/config/ImageCleaner.java b/backend/pium/src/test/java/com/official/pium/config/ImageCleaner.java index c2a753ef..54ed3323 100644 --- a/backend/pium/src/test/java/com/official/pium/config/ImageCleaner.java +++ b/backend/pium/src/test/java/com/official/pium/config/ImageCleaner.java @@ -1,8 +1,7 @@ package com.official.pium.config; -import org.springframework.stereotype.Component; - import java.io.File; +import org.springframework.stereotype.Component; @Component public class ImageCleaner { diff --git a/backend/pium/src/test/java/com/official/pium/fixture/DictionaryPlantFixture.java b/backend/pium/src/test/java/com/official/pium/fixture/DictionaryPlantFixture.java index 8530b51f..ee80791b 100644 --- a/backend/pium/src/test/java/com/official/pium/fixture/DictionaryPlantFixture.java +++ b/backend/pium/src/test/java/com/official/pium/fixture/DictionaryPlantFixture.java @@ -1,17 +1,17 @@ package com.official.pium.fixture; -import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.petPlant.domain.vo.WaterCycle; -import com.official.pium.dictionaryPlant.domain.vo.CareDetail; -import com.official.pium.dictionaryPlant.domain.vo.Classification; -import com.official.pium.dictionaryPlant.domain.vo.Property; -import com.official.pium.petPlant.domain.vo.Temperature; import com.official.pium.common.dto.DataResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantCreateRequest; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantResponse.WaterCycleResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantSearchResponse; import com.official.pium.dictionaryPlant.application.dto.DictionaryPlantUpdateRequest; +import com.official.pium.dictionaryPlant.domain.DictionaryPlant; +import com.official.pium.dictionaryPlant.domain.vo.CareDetail; +import com.official.pium.dictionaryPlant.domain.vo.Classification; +import com.official.pium.dictionaryPlant.domain.vo.Property; +import com.official.pium.petPlant.domain.vo.Temperature; +import com.official.pium.petPlant.domain.vo.WaterCycle; import java.util.List; @SuppressWarnings("NonAsciiCharacters") diff --git a/backend/pium/src/test/java/com/official/pium/fixture/FileFixture.java b/backend/pium/src/test/java/com/official/pium/fixture/FileFixture.java index 5d414fed..7cbdbfa8 100644 --- a/backend/pium/src/test/java/com/official/pium/fixture/FileFixture.java +++ b/backend/pium/src/test/java/com/official/pium/fixture/FileFixture.java @@ -1,13 +1,12 @@ package com.official.pium.fixture; -import org.springframework.http.MediaType; -import org.springframework.mock.web.MockMultipartFile; -import org.springframework.web.multipart.MultipartFile; - -import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; +import javax.imageio.ImageIO; +import org.springframework.http.MediaType; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.web.multipart.MultipartFile; public class FileFixture { diff --git a/backend/pium/src/test/java/com/official/pium/fixture/HistoryFixture.java b/backend/pium/src/test/java/com/official/pium/fixture/HistoryFixture.java index 938fa5e2..6e0e30cf 100644 --- a/backend/pium/src/test/java/com/official/pium/fixture/HistoryFixture.java +++ b/backend/pium/src/test/java/com/official/pium/fixture/HistoryFixture.java @@ -1,9 +1,9 @@ package com.official.pium.fixture; -import com.official.pium.history.domain.HistoryType; import com.official.pium.history.application.dto.HistoryResponse; import com.official.pium.history.application.dto.SingleHistoryResponse; import com.official.pium.history.application.dto.SingleHistoryResponse.Content; +import com.official.pium.history.domain.HistoryType; import java.time.LocalDate; import java.util.List; diff --git a/backend/pium/src/test/java/com/official/pium/support/DictionaryPlantSupport.java b/backend/pium/src/test/java/com/official/pium/support/DictionaryPlantSupport.java index 4ac736b5..181bcb6c 100644 --- a/backend/pium/src/test/java/com/official/pium/support/DictionaryPlantSupport.java +++ b/backend/pium/src/test/java/com/official/pium/support/DictionaryPlantSupport.java @@ -1,12 +1,12 @@ package com.official.pium.support; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.petPlant.domain.vo.WaterCycle; import com.official.pium.dictionaryPlant.domain.vo.CareDetail; import com.official.pium.dictionaryPlant.domain.vo.Classification; import com.official.pium.dictionaryPlant.domain.vo.Property; -import com.official.pium.petPlant.domain.vo.Temperature; import com.official.pium.dictionaryPlant.repository.DictionaryPlantRepository; +import com.official.pium.petPlant.domain.vo.Temperature; +import com.official.pium.petPlant.domain.vo.WaterCycle; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/backend/pium/src/test/java/com/official/pium/support/GardenSupport.java b/backend/pium/src/test/java/com/official/pium/support/GardenSupport.java index 34eb5ced..ebee84e0 100644 --- a/backend/pium/src/test/java/com/official/pium/support/GardenSupport.java +++ b/backend/pium/src/test/java/com/official/pium/support/GardenSupport.java @@ -1,13 +1,13 @@ package com.official.pium.support; import com.official.pium.dictionaryPlant.domain.DictionaryPlant; -import com.official.pium.garden.domain.Garden; -import com.official.pium.member.domain.Member; -import com.official.pium.garden.domain.vo.GardenPlantState; +import com.official.pium.dictionaryPlant.repository.DictionaryPlantRepository; import com.official.pium.fixture.DictionaryPlantFixture; import com.official.pium.fixture.MemberFixture; -import com.official.pium.dictionaryPlant.repository.DictionaryPlantRepository; +import com.official.pium.garden.domain.Garden; +import com.official.pium.garden.domain.vo.GardenPlantState; import com.official.pium.garden.repository.GardenRepository; +import com.official.pium.member.domain.Member; import com.official.pium.member.repository.MemberRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/backend/pium/src/test/java/com/official/pium/support/HistorySupport.java b/backend/pium/src/test/java/com/official/pium/support/HistorySupport.java index 932e933d..4ac0e5cf 100644 --- a/backend/pium/src/test/java/com/official/pium/support/HistorySupport.java +++ b/backend/pium/src/test/java/com/official/pium/support/HistorySupport.java @@ -2,10 +2,10 @@ import com.official.pium.history.domain.History; import com.official.pium.history.domain.HistoryCategory; -import com.official.pium.history.domain.vo.HistoryContent; import com.official.pium.history.domain.HistoryType; -import com.official.pium.petPlant.domain.PetPlant; +import com.official.pium.history.domain.vo.HistoryContent; import com.official.pium.history.repository.HistoryRepository; +import com.official.pium.petPlant.domain.PetPlant; import java.time.LocalDate; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/backend/pium/src/test/java/com/official/pium/util/PhotoManagerTest.java b/backend/pium/src/test/java/com/official/pium/util/PhotoManagerTest.java index 2e9c30a6..c1e15f4e 100644 --- a/backend/pium/src/test/java/com/official/pium/util/PhotoManagerTest.java +++ b/backend/pium/src/test/java/com/official/pium/util/PhotoManagerTest.java @@ -1,5 +1,7 @@ package com.official.pium.util; +import static org.assertj.core.api.Assertions.assertThat; + import com.official.pium.IntegrationTest; import com.official.pium.common.util.PhotoManager; import com.official.pium.config.ImageCleanerExtension; @@ -11,8 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.multipart.MultipartFile; -import static org.assertj.core.api.Assertions.assertThat; - @ExtendWith(ImageCleanerExtension.class) @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @SuppressWarnings("NonAsciiCharacters")