Skip to content

Commit

Permalink
Merge pull request #692 from woowacourse/develop
Browse files Browse the repository at this point in the history
release 1.0.0
  • Loading branch information
gracefulBrown authored Feb 4, 2022
2 parents f796555 + bd923e8 commit 30652ed
Show file tree
Hide file tree
Showing 319 changed files with 16,462 additions and 63,826 deletions.
15 changes: 9 additions & 6 deletions .ebextensions/custom_logs.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
files:
"/opt/elasticbeanstalk/tasks/taillogs.d/cloud-init.conf" :
mode: "000755"
owner: root
group: root
content: |
/var/app/current/logs/performance/performance.log
"/etc/awslogs/config/mycustom.conf" :
mode: "060606"
owner: root
group: root
content: |
[/var/app/current/logs/performance/performance.log]
log_group_name = `{"Fn::Join":["/", ["/aws/elasticbeanstalk", { "Ref":"AWSEBEnvironmentName" }, "/var/app/current/logs/performance/performance.log"]]}`
log_stream_name = {instance_id}
file =/var/app/current/logs/performance/performance.log*
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# git clone 시 생성되는 gradle project파일
.gradle
.project
.settings

# Mac
.DS_Store
13 changes: 11 additions & 2 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

// open csv
implementation 'com.opencsv:opencsv:5.5.2'

// log
implementation 'net.rakugakibox.spring.boot:logback-access-spring-boot-starter:2.7.1'
implementation "com.github.maricn:logback-slack-appender:1.4.0"

// jwt
implementation 'io.jsonwebtoken:jjwt:0.9.1'
Expand Down Expand Up @@ -80,6 +83,12 @@ dependencies {
//flyway
implementation 'org.flywaydb:flyway-core:6.4.2'

// webclient
implementation 'org.springframework.boot:spring-boot-starter-webflux'

// prometheus
implementation 'io.micrometer:micrometer-registry-prometheus'

runtimeOnly 'com.h2database:h2'
runtimeOnly 'mysql:mysql-connector-java'
}
Expand Down Expand Up @@ -136,4 +145,4 @@ sonarqube {
property "sonar.organization", "woowacourse"
property "sonar.host.url", "https://sonarcloud.io"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ public void invokeHttpPutWithToken(String path, Object data) {
response.then().log().all();
}

public void invokeHttpPostWithToken(String path) {
request = RestAssured
.given().log().all()
.auth().oauth2(accessToken);
response = request.post(path);
response.then().log().all();
}

public void invokeHttpPostWithToken(String path, Object data) {
request = RestAssured
.given().log().all()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import wooteco.prolog.common.exception.ExceptionDto;
import wooteco.prolog.fixtures.AbilityAcceptanceFixture;
import wooteco.prolog.fixtures.GithubResponses;
import wooteco.prolog.member.application.dto.MemberResponse;
import wooteco.prolog.report.application.dto.ability.AbilityCreateRequest;
import wooteco.prolog.report.application.dto.ability.AbilityResponse;
import wooteco.prolog.report.application.dto.ability.AbilityUpdateRequest;
import wooteco.prolog.report.application.dto.ability.DefaultAbilityCreateRequest;
import wooteco.prolog.report.exception.AbilityNotFoundException;

public class AbilityStepDefinitions extends AcceptanceSteps {
Expand Down Expand Up @@ -46,10 +46,7 @@ public class AbilityStepDefinitions extends AcceptanceSteps {
@When("{string}의 역량 목록을 조회하면")
public void 의역량목록을조회하면(String member) {
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpGetWithToken(String.format("/members/%s", username));

Long memberId = context.response.as(MemberResponse.class).getId();
context.invokeHttpGetWithToken(String.format("/members/%d/abilities", memberId));
context.invokeHttpGetWithToken(String.format("/members/%s/abilities", username));
}

@Then("역량 목록을 받는다.")
Expand Down Expand Up @@ -113,6 +110,7 @@ public class AbilityStepDefinitions extends AcceptanceSteps {
Long abilityId = getAbilityIdByName(abilityName);

context.invokeHttpDeleteWithToken("/abilities/" + abilityId);
assertThat(context.response.statusCode()).isEqualTo(HttpStatus.OK.value());
}

@Then("{string} 역량이 포함되지 않은 목록을 받는다.")
Expand Down Expand Up @@ -170,6 +168,35 @@ public class AbilityStepDefinitions extends AcceptanceSteps {
assertThat(response.getColor()).isNotEqualTo(color);
}

@Then("비어있는 역량 목록을 받는다.")
public void 비어있는역량목록을받는다() {
List<AbilityResponse> responses = context.response.jsonPath()
.getList(".", AbilityResponse.class);

assertThat(responses).isEmpty();
}

@And("{string} 과정으로 기본 역량을 등록하고")
@When("{string} 과정으로 기본 역량을 등록하면")
public void 과정으로기본역량을등록하고(String template) {
context.invokeHttpPostWithToken("/abilities/template/" + template);
}

@Then("기본 역량 조회 실패 관련 예외가 발생한다.")
public void 기본역량조회실패관련예외가발생한다() {
ExceptionDto exceptionDto = context.response.as(ExceptionDto.class);

assertThat(context.response.statusCode()).isEqualTo(HttpStatus.BAD_REQUEST.value());
assertThat(exceptionDto.getCode()).isEqualTo(BadRequestCode.DEFAULT_ABILITY_NOT_FOUND.getCode());
assertThat(exceptionDto.getMessage()).isEqualTo(BadRequestCode.DEFAULT_ABILITY_NOT_FOUND.getMessage());
}

@And("관리자가 기본 역량 {string}을 {string} 과정으로 추가하고")
public void 관리자가기본역량을과정으로추가하고(String defaultAbility, String template) {
DefaultAbilityCreateRequest request = new DefaultAbilityCreateRequest(defaultAbility, "defaultAbility 입니다.", "#color", template);
context.invokeHttpPostWithToken("/abilities/default", request);
}

private Long getAbilityIdByName(String abilityName) {
context.invokeHttpGetWithToken("/abilities");
List<AbilityResponse> responses = context.response.jsonPath().getList(".", AbilityResponse.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import java.util.List;
import java.util.Optional;
import wooteco.prolog.AcceptanceSteps;
import wooteco.prolog.fixtures.GithubResponses;
import wooteco.prolog.member.application.dto.MemberResponse;
import wooteco.prolog.member.application.dto.MemberScrapRequest;
import wooteco.prolog.member.application.dto.MemberUpdateRequest;
import wooteco.prolog.studylog.application.dto.StudylogResponse;
import wooteco.prolog.studylog.application.dto.StudylogsResponse;

public class MemberStepDefinitions extends AcceptanceSteps {
Expand Down Expand Up @@ -51,30 +54,35 @@ public class MemberStepDefinitions extends AcceptanceSteps {
}

@When("{string}의 닉네임이 {int}번 스터디로그를 스크랩하면")
public void studylog를스크랩하먼(String member, int studylogId){
public void studylog를스크랩하면(String member, int studylogId){
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpPostWithToken("/members/" + username + "/scrap", new MemberScrapRequest((long)studylogId));
assertThat(context.response.statusCode()).isEqualTo(200);
assertThat(context.response.statusCode()).isEqualTo(201);
}

@When("{string}의 닉네임이 {int}번 스터디로그를 스크랩 취소하면")
public void studylog를스크랩취소하먼(String member, int studylogId){
public void studylog를스크랩취소하면(String member, int studylogId){
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpDeleteWithToken("/members/" + username + "/scrap", new MemberScrapRequest((long)studylogId));
assertThat(context.response.statusCode()).isEqualTo(200);
assertThat(context.response.statusCode()).isEqualTo(204);
}

@Then("{string}의 닉네임이 스크랩한 스터디로그를 볼 수 있다")
public void 스크랩한studylog를볼수있다(String member){
@Then("{string}의 닉네임이 스크랩한 {int}번 스터디로그를 볼 수 있다")
public void 스크랩한studylog를볼수있다(String member, int studylogId){
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpGetWithToken("/members/" + username + "/scrap");
assertThat(context.response.as(StudylogsResponse.class).getTotalSize()).isNotZero();
assertThat(checkIfScrap(studylogId)).isTrue();
}

@Then("{string}의 닉네임이 스크랩한 스터디로그를 볼 수 없다")
public void 스크랩한studylog를볼수없다(String member) {
@Then("{string}의 닉네임이 스크랩한 {int}번 스터디로그를 볼 수 없다")
public void 스크랩한studylog를볼수없다(String member, int studylogId) {
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpGetWithToken("/members/" + username + "/scrap");
assertThat(context.response.as(StudylogsResponse.class).getTotalSize()).isZero();
assertThat(checkIfScrap(studylogId)).isFalse();
}

private boolean checkIfScrap(int studylogId) {
return context.response.as(StudylogsResponse.class).getData().stream()
.anyMatch(studylog -> studylog.getId() == studylogId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import wooteco.prolog.AcceptanceSteps;
import wooteco.prolog.fixtures.GithubResponses;
import wooteco.prolog.member.application.dto.MemberResponse;
import wooteco.prolog.member.application.dto.ProfileIntroRequest;
import wooteco.prolog.member.application.dto.ProfileIntroResponse;
import wooteco.prolog.studylog.application.dto.StudylogsResponse;

public class ProfileStepDefinitions extends AcceptanceSteps {
Expand All @@ -17,11 +19,40 @@ public class ProfileStepDefinitions extends AcceptanceSteps {
context.invokeHttpGet("/members/" + username + "/profile");
}

@Then("멤버 프로필이 조회된다")
public void 멤버프로필이조회된다() {
MemberResponse member = context.response.as(MemberResponse.class);
@When("{string}의 멤버 프로필 인트로를 조회하면")
public void 멤버프로필인트로를조회하면(String member) {
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpGet("/members/" + username + "/profile-intro");
}

@When("{string}의 멤버 프로필 인트로를 수정하(면/고)")
public void 멤버프로필인트로를수정하면(String member) {
ProfileIntroRequest updateRequest = new ProfileIntroRequest("안녕하세요 :)");
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpPutWithToken("/members/" + username + "/profile-intro", updateRequest);
}

@Then("{string}의 멤버 프로필이 조회된다")
public void 멤버프로필이조회된다(String member) {
String memberName = context.response.as(MemberResponse.class).getNickname();

assertThat(memberName).isEqualTo(member);
}

@Then("{string}의 멤버 프로필 인트로가 조회된다")
public void 멤버프로필인트로가조회된다(String member) {
String text = context.response.as(ProfileIntroResponse.class).getText();

assertThat(text).isNotNull();
}

@Then("{string}의 멤버 프로필 인트로가 수정된다")
public void 멤버프로필인트로가수정된다(String member) {
String username = GithubResponses.findByName(member).getLogin();
context.invokeHttpGet("/members/" + username + "/profile-intro");
String text = context.response.as(ProfileIntroResponse.class).getText();

assertThat(member.getImageUrl()).isNotNull();
assertThat(text).isNotNull();
}

@When("{string}의 프로필 스터디로그를 조회하면")
Expand All @@ -30,10 +61,14 @@ public class ProfileStepDefinitions extends AcceptanceSteps {
context.invokeHttpGet("/members/" + username + "/posts");
}

@Then("프로필 스터디로그가 조회된다")
public void 프로필스터디로그가조회된다() {
StudylogsResponse studylogs = context.response.as(StudylogsResponse.class);
@Then("{string}의 프로필 스터디로그가 조회된다")
public void 프로필스터디로그가조회된다(String member) {
String author = context.response.as(StudylogsResponse.class)
.getData()
.get(0)
.getAuthor()
.getNickname();

assertThat(studylogs.getData()).isNotEmpty();
assertThat(author).isEqualTo(member);
}
}
Loading

0 comments on commit 30652ed

Please sign in to comment.