Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

배포 1.1 #74

Merged
merged 9 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:17-jdk-alpine
FROM openjdk:17-jdk
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# backend
배포 v 1.1 test
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ swaggerSources {
openapi3 {
servers = [
{ url = "http://localhost:8080" },
{ url = "http://13.209.253.204:8080" }
{ url = "http://13.125.194.230:8080" }
]
title = "API 문서"
description = "RestDocsWithSwagger Docs"
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/coffeemeet/server/common/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package coffeemeet.server.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import coffeemeet.server.auth.domain.AuthTokens;
Expand Down Expand Up @@ -67,8 +67,7 @@ void renewTest() throws Exception {
)
)
.andExpect(status().isOk())
.andExpect(jsonPath("$.accessToken").value(authTokens.accessToken()))
.andExpect(jsonPath("$.refreshToken").value(authTokens.refreshToken()));
.andExpect(content().string(objectMapper.writeValueAsString(authTokens)));
}

@DisplayName("사용자는 로그아웃 할 수 있다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.restdocs.RestDocumentationContextProvider;
import org.springframework.restdocs.RestDocumentationExtension;
Expand All @@ -21,7 +22,8 @@ public abstract class ControllerTestConfig {

protected static final String TOKEN = "Bearer header.payload.signature";

protected ObjectMapper objectMapper = new ObjectMapper();
@Autowired
protected ObjectMapper objectMapper;

protected MockMvc mockMvc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
import static org.springframework.restdocs.request.RequestDocumentation.queryParameters;
import static org.springframework.restdocs.request.RequestDocumentation.requestParts;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import coffeemeet.server.auth.domain.AuthTokens;
Expand Down Expand Up @@ -88,8 +88,8 @@ void signupTest() throws Exception {
)
))
.andExpect(status().isOk())
.andExpect(jsonPath("$.accessToken").value("accessToken"))
.andExpect(jsonPath("$.refreshToken").value("refreshToken"));
.andExpect(content().string(objectMapper.writeValueAsString(authTokens)));

}

@Test
Expand Down Expand Up @@ -121,8 +121,7 @@ void loginTest() throws Exception {
)
))
.andExpect(status().isOk())
.andExpect(jsonPath("$.accessToken").value("accessToken"))
.andExpect(jsonPath("$.refreshToken").value("refreshToken"));
.andExpect(content().string(objectMapper.writeValueAsString(authTokens)));
}

@Test
Expand Down Expand Up @@ -155,10 +154,7 @@ void findUserProfileTest() throws Exception {
)
)
.andExpect(status().isOk())
.andExpect(jsonPath("$.nickname").value(response.nickname()))
.andExpect(jsonPath("$.profileImageUrl").value(response.profileImageUrl()))
.andExpect(jsonPath("$.department").value(String.valueOf(response.department())))
.andExpect(jsonPath("$.interests[0]").value(response.interests().get(0).name()));
.andExpect(content().string(objectMapper.writeValueAsString(response)));
}

@Test
Expand Down Expand Up @@ -199,17 +195,7 @@ void findMyProfileTest() throws Exception {
)
)
)
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value(response.name()))
.andExpect(jsonPath("$.nickname").value(response.nickname()))
.andExpect(jsonPath("$.email").value(response.email()))
.andExpect(jsonPath("$.profileImageUrl").value(response.profileImageUrl()))
.andExpect(jsonPath("$.birthYear").value(response.birthYear()))
.andExpect(jsonPath("$.birthDay").value(response.birthDay()))
.andExpect(jsonPath("$.reportedCount").value(response.reportedCount()))
.andExpect(jsonPath("$.sanctionPeriod").value(String.valueOf(response.sanctionPeriod())))
.andExpect(jsonPath("$.department").value(String.valueOf(response.department())))
.andExpect(jsonPath("$.interests[0]").value(response.interests().get(0).name()));
.andExpect(content().string(objectMapper.writeValueAsString(response)));
}

@Test
Expand Down