From ae17d153fcd3246603f21c3a1f7dd2b59bd3c7db Mon Sep 17 00:00:00 2001 From: 0-wook Date: Fri, 16 Feb 2024 18:20:27 +0900 Subject: [PATCH 1/5] test --- .../src/main/java/kr/co/automl/HelloController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin-server/src/main/java/kr/co/automl/HelloController.java b/app/admin-server/src/main/java/kr/co/automl/HelloController.java index 80a177c0..9a80f3c5 100644 --- a/app/admin-server/src/main/java/kr/co/automl/HelloController.java +++ b/app/admin-server/src/main/java/kr/co/automl/HelloController.java @@ -12,6 +12,6 @@ public class HelloController { @GetMapping public String hello() { - return "Hello, World!"; + return "Hello, WS-AutoML!"; } } From ae6be3f906bde742c0f61d8f955bf8be2df2d88c Mon Sep 17 00:00:00 2001 From: 0-wook Date: Fri, 16 Feb 2024 18:26:47 +0900 Subject: [PATCH 2/5] update --- .../src/main/java/kr/co/automl/HelloController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin-server/src/main/java/kr/co/automl/HelloController.java b/app/admin-server/src/main/java/kr/co/automl/HelloController.java index 9a80f3c5..80a177c0 100644 --- a/app/admin-server/src/main/java/kr/co/automl/HelloController.java +++ b/app/admin-server/src/main/java/kr/co/automl/HelloController.java @@ -12,6 +12,6 @@ public class HelloController { @GetMapping public String hello() { - return "Hello, WS-AutoML!"; + return "Hello, World!"; } } From a8b090da2ee8f3b3ee26088576dfdb8b293c7152 Mon Sep 17 00:00:00 2001 From: 0-wook Date: Mon, 19 Feb 2024 10:35:08 +0900 Subject: [PATCH 3/5] update --- .../config/web/LoginUserArgumentResolver.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/user-server/src/main/java/kr/co/automl/global/config/web/LoginUserArgumentResolver.java b/app/user-server/src/main/java/kr/co/automl/global/config/web/LoginUserArgumentResolver.java index ec48eb22..ff1a8197 100644 --- a/app/user-server/src/main/java/kr/co/automl/global/config/web/LoginUserArgumentResolver.java +++ b/app/user-server/src/main/java/kr/co/automl/global/config/web/LoginUserArgumentResolver.java @@ -1,7 +1,7 @@ package kr.co.automl.global.config.web; -import kr.co.automl.domain.user.dto.SessionUser; -import lombok.RequiredArgsConstructor; +import javax.servlet.http.HttpSession; + import org.springframework.core.MethodParameter; import org.springframework.stereotype.Component; import org.springframework.web.bind.support.WebDataBinderFactory; @@ -9,7 +9,8 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.ModelAndViewContainer; -import javax.servlet.http.HttpSession; +import kr.co.automl.domain.user.dto.SessionUser; +import lombok.RequiredArgsConstructor; @RequiredArgsConstructor @Component @@ -17,9 +18,8 @@ public class LoginUserArgumentResolver implements HandlerMethodArgumentResolver private final HttpSession httpSession; - /** - * 현재 파라미터를 resolver가 지원할지에 대해 판단 + * 현재 파라미터를 resolver가 지원할지에 대해 판단 */ @Override public boolean supportsParameter(MethodParameter parameter) { @@ -33,7 +33,8 @@ public boolean supportsParameter(MethodParameter parameter) { * 실제 바인딩할 객체 리턴 */ @Override - public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { + public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, WebDataBinderFactory binderFactory) { return httpSession.getAttribute("user"); } } From 86617e56193f1773df25425a0f0ba712d92a58e4 Mon Sep 17 00:00:00 2001 From: 0-wook Date: Mon, 19 Feb 2024 10:48:47 +0900 Subject: [PATCH 4/5] update --- .../kr/co/automl/HelloControllerTest.java | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java b/app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java index 0b20592a..611f1290 100644 --- a/app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java +++ b/app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java @@ -15,30 +15,23 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -@WebMvcTest( - controllers = HelloController.class, - excludeFilters = { - @ComponentScan.Filter( - type = FilterType.ASSIGNABLE_TYPE, - classes = SecurityConfig.class - ) - } -) +@WebMvcTest(controllers = HelloController.class, excludeFilters = { + @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = SecurityConfig.class) +}) @AutoConfigureMockMvc class HelloControllerTest { - @Autowired - private MockMvc mockMvc; + @Autowired + private MockMvc mockMvc; - @Test - @WithMockUser - void hello() throws Exception { - ResultActions action = mockMvc.perform( - get("/hello") - ); + @Test + @WithMockUser + void hello() throws Exception { + ResultActions action = mockMvc.perform( + get("/hello")); - action - .andExpect(status().isOk()) - .andExpect(content().string("Hello, World!")); - } + action + .andExpect(status().isOk()) + .andExpect(content().string("Hello, World!")); + } } From ca42a4a8288655fa529c61b49ee29e439513993e Mon Sep 17 00:00:00 2001 From: 0-wook Date: Mon, 19 Feb 2024 10:55:26 +0900 Subject: [PATCH 5/5] update --- .../kr/co/automl/HelloControllerTest.java | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java diff --git a/app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java b/app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java deleted file mode 100644 index 611f1290..00000000 --- a/app/admin-server/src/test/java/kr/co/automl/HelloControllerTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package kr.co.automl; - -import kr.co.automl.global.config.security.SecurityConfig; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.FilterType; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@WebMvcTest(controllers = HelloController.class, excludeFilters = { - @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = SecurityConfig.class) -}) -@AutoConfigureMockMvc -class HelloControllerTest { - - @Autowired - private MockMvc mockMvc; - - @Test - @WithMockUser - void hello() throws Exception { - ResultActions action = mockMvc.perform( - get("/hello")); - - action - .andExpect(status().isOk()) - .andExpect(content().string("Hello, World!")); - } -}