From dece27b97015e072af979a7e6ae18f77947c6eab Mon Sep 17 00:00:00 2001 From: "Kim, Joo Hyuk" <61615301+JooHyukKim@users.noreply.github.com> Date: Fri, 4 Mar 2022 13:55:51 +0900 Subject: [PATCH 1/4] Refactor : controller --- .../HealthCheckController.java | 2 +- .../{relay => controller}/RelayController.java | 12 +++++++----- .../relay/HealthCheckControllerTest.java | 1 + .../inbobwetrust/relay/RelayControllerTest.java | 14 +++++++++----- 4 files changed, 18 insertions(+), 11 deletions(-) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => controller}/HealthCheckController.java (94%) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => controller}/RelayController.java (81%) diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/HealthCheckController.java b/delivery-relay-service/src/main/java/com/inbobwetrust/controller/HealthCheckController.java similarity index 94% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/HealthCheckController.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/controller/HealthCheckController.java index 068ec50b..013715f5 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/HealthCheckController.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/controller/HealthCheckController.java @@ -1,4 +1,4 @@ -package com.inbobwetrust.relay; +package com.inbobwetrust.controller; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/RelayController.java b/delivery-relay-service/src/main/java/com/inbobwetrust/controller/RelayController.java similarity index 81% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/RelayController.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/controller/RelayController.java index e14bb9e7..0b1be2e5 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/RelayController.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/controller/RelayController.java @@ -1,14 +1,16 @@ -package com.inbobwetrust.relay; +package com.inbobwetrust.controller; -import com.inbobwetrust.relay.domain.Delivery; -import com.inbobwetrust.relay.domain.ReceiverType; -import com.inbobwetrust.relay.domain.RelayRequest; -import javax.validation.Valid; +import com.inbobwetrust.domain.Delivery; +import com.inbobwetrust.domain.ReceiverType; +import com.inbobwetrust.domain.RelayRequest; +import com.inbobwetrust.repository.RelayRepository; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import reactor.core.publisher.Mono; +import javax.validation.Valid; + @RestController @RequiredArgsConstructor @RequestMapping(value = "/relay/v1") diff --git a/delivery-relay-service/src/test/java/com/inbobwetrust/relay/HealthCheckControllerTest.java b/delivery-relay-service/src/test/java/com/inbobwetrust/relay/HealthCheckControllerTest.java index 10e7ed76..efca8fa5 100644 --- a/delivery-relay-service/src/test/java/com/inbobwetrust/relay/HealthCheckControllerTest.java +++ b/delivery-relay-service/src/test/java/com/inbobwetrust/relay/HealthCheckControllerTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; +import com.inbobwetrust.controller.HealthCheckController; import groovy.util.logging.Slf4j; import java.util.Objects; import org.junit.jupiter.api.DisplayName; diff --git a/delivery-relay-service/src/test/java/com/inbobwetrust/relay/RelayControllerTest.java b/delivery-relay-service/src/test/java/com/inbobwetrust/relay/RelayControllerTest.java index b076edb7..f9dff04f 100644 --- a/delivery-relay-service/src/test/java/com/inbobwetrust/relay/RelayControllerTest.java +++ b/delivery-relay-service/src/test/java/com/inbobwetrust/relay/RelayControllerTest.java @@ -3,12 +3,15 @@ import static org.mockito.Mockito.any; import static org.mockito.Mockito.when; -import com.inbobwetrust.relay.domain.Delivery; -import com.inbobwetrust.relay.domain.DeliveryStatus; -import com.inbobwetrust.relay.domain.ReceiverType; -import com.inbobwetrust.relay.domain.RelayRequest; +import com.inbobwetrust.controller.RelayController; +import com.inbobwetrust.domain.Delivery; +import com.inbobwetrust.domain.DeliveryStatus; +import com.inbobwetrust.domain.ReceiverType; +import com.inbobwetrust.domain.RelayRequest; import java.time.LocalDateTime; import java.util.stream.Stream; + +import com.inbobwetrust.repository.RelayRepository; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; @@ -30,7 +33,8 @@ class RelayControllerTest { @Autowired WebTestClient testClient; - @MockBean RelayRepository relayRepository; + @MockBean + RelayRepository relayRepository; private final String BASE_URL = "/relay/v1"; From 034086e856f3b2c5da9122d293bd59e7746c7866 Mon Sep 17 00:00:00 2001 From: "Kim, Joo Hyuk" <61615301+JooHyukKim@users.noreply.github.com> Date: Fri, 4 Mar 2022 13:56:21 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Refactor=20:=20=EB=8F=84=EB=A9=94=EC=9D=B8?= =?UTF-8?q?=20=EB=A0=88=EC=9D=B4=EC=96=B4=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/inbobwetrust/{relay => }/domain/Delivery.java | 2 +- .../com/inbobwetrust/{relay => }/domain/DeliveryStatus.java | 2 +- .../java/com/inbobwetrust/{relay => }/domain/ReceiverType.java | 2 +- .../java/com/inbobwetrust/{relay => }/domain/RelayRequest.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => }/domain/Delivery.java (97%) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => }/domain/DeliveryStatus.java (92%) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => }/domain/ReceiverType.java (55%) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => }/domain/RelayRequest.java (93%) diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/Delivery.java b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/Delivery.java similarity index 97% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/Delivery.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/domain/Delivery.java index e3a3c85c..7173699c 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/Delivery.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/Delivery.java @@ -1,4 +1,4 @@ -package com.inbobwetrust.relay.domain; +package com.inbobwetrust.domain; import com.fasterxml.jackson.annotation.JsonFormat; import java.time.LocalDateTime; diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/DeliveryStatus.java b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/DeliveryStatus.java similarity index 92% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/DeliveryStatus.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/domain/DeliveryStatus.java index da6ca998..0982e0ad 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/DeliveryStatus.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/DeliveryStatus.java @@ -1,4 +1,4 @@ -package com.inbobwetrust.relay.domain; +package com.inbobwetrust.domain; public enum DeliveryStatus { DECLINED("접수", "접수"), diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/ReceiverType.java b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/ReceiverType.java similarity index 55% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/ReceiverType.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/domain/ReceiverType.java index b38e7685..247f6827 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/ReceiverType.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/ReceiverType.java @@ -1,4 +1,4 @@ -package com.inbobwetrust.relay.domain; +package com.inbobwetrust.domain; public enum ReceiverType { SHOP, diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/RelayRequest.java b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/RelayRequest.java similarity index 93% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/RelayRequest.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/domain/RelayRequest.java index 8423d2d9..c0fb4d63 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/domain/RelayRequest.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/domain/RelayRequest.java @@ -1,4 +1,4 @@ -package com.inbobwetrust.relay.domain; +package com.inbobwetrust.domain; import lombok.Data; import org.springframework.data.annotation.Id; From 1121c1a6771532aae5fb33d15573b7f9941e9017 Mon Sep 17 00:00:00 2001 From: "Kim, Joo Hyuk" <61615301+JooHyukKim@users.noreply.github.com> Date: Fri, 4 Mar 2022 13:56:36 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Refactor=20:=20exception=20handler=20advice?= =?UTF-8?q?=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{relay => exception}/ExceptionHandlerAdvice.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => exception}/ExceptionHandlerAdvice.java (96%) diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/ExceptionHandlerAdvice.java b/delivery-relay-service/src/main/java/com/inbobwetrust/exception/ExceptionHandlerAdvice.java similarity index 96% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/ExceptionHandlerAdvice.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/exception/ExceptionHandlerAdvice.java index f1b13c67..637d87a8 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/ExceptionHandlerAdvice.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/exception/ExceptionHandlerAdvice.java @@ -1,6 +1,5 @@ -package com.inbobwetrust.relay; +package com.inbobwetrust.exception; -import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; import org.springframework.context.support.DefaultMessageSourceResolvable; import org.springframework.http.HttpStatus; @@ -9,6 +8,8 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.support.WebExchangeBindException; +import java.util.stream.Collectors; + @ControllerAdvice @Slf4j public class ExceptionHandlerAdvice { From 1f614f640e30539b10d7582993688c47c2cf3f82 Mon Sep 17 00:00:00 2001 From: "Kim, Joo Hyuk" <61615301+JooHyukKim@users.noreply.github.com> Date: Fri, 4 Mar 2022 13:56:44 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Fea=20t:=20repository=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=96=B4=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inbobwetrust/{relay => repository}/RelayRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename delivery-relay-service/src/main/java/com/inbobwetrust/{relay => repository}/RelayRepository.java (66%) diff --git a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/RelayRepository.java b/delivery-relay-service/src/main/java/com/inbobwetrust/repository/RelayRepository.java similarity index 66% rename from delivery-relay-service/src/main/java/com/inbobwetrust/relay/RelayRepository.java rename to delivery-relay-service/src/main/java/com/inbobwetrust/repository/RelayRepository.java index d0732094..44c6f8c1 100644 --- a/delivery-relay-service/src/main/java/com/inbobwetrust/relay/RelayRepository.java +++ b/delivery-relay-service/src/main/java/com/inbobwetrust/repository/RelayRepository.java @@ -1,6 +1,6 @@ -package com.inbobwetrust.relay; +package com.inbobwetrust.repository; -import com.inbobwetrust.relay.domain.RelayRequest; +import com.inbobwetrust.domain.RelayRequest; import org.springframework.data.repository.reactive.ReactiveCrudRepository; public interface RelayRepository extends ReactiveCrudRepository {}