Skip to content

Commit

Permalink
Merge pull request #69 from solid-connection/main
Browse files Browse the repository at this point in the history
[RELEASE] 모니터링 환경 구축
  • Loading branch information
leesewon00 authored Aug 23, 2024
2 parents ce1026e + 16821b9 commit 50fde8e
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 91 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ dependencies {//todo: 안쓰는 의존성이나 deprecated된 의존성 제거
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
testImplementation "org.mockito:mockito-core:3.3.3"
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'

compileOnly 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'org.projectlombok:lombok'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
"/file/profile/pre",
"/auth/kakao", "/auth/sign-up", "/auth/reissue",
"/university/detail/**", "/university/search/**", "/university/recommends",
"/swagger-ui/**", "/v3/api-docs/**"
"/swagger-ui/**", "/v3/api-docs/**",
"/actuator/**"
)
.permitAll()
.anyRequest().authenticated())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class UniversityInfoForApply {
@Column(length = 50, nullable = false)
private String term;

@Column(nullable = false, length = 100)
private String koreanName;

@Column
private Integer studentCapacity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public static UniversityDetailResponse of(
University university,
UniversityInfoForApply universityInfoForApply) {
return new UniversityDetailResponse(
university.getId(),
universityInfoForApply.getId(),
universityInfoForApply.getTerm(),
university.getKoreanName(),
universityInfoForApply.getKoreanName(),
university.getEnglishName(),
university.getFormatName(),
university.getRegion().getKoreanName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static UniversityInfoForApplyPreviewResponse from(UniversityInfoForApply
return new UniversityInfoForApplyPreviewResponse(
universityInfoForApply.getId(),
universityInfoForApply.getTerm(),
universityInfoForApply.getUniversity().getKoreanName(),
universityInfoForApply.getKoreanName(),
universityInfoForApply.getUniversity().getRegion().getKoreanName(),
universityInfoForApply.getUniversity().getCountry().getKoreanName(),
universityInfoForApply.getUniversity().getLogoImageUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface UniversityInfoForApplyRepository extends JpaRepository<Universi

Optional<UniversityInfoForApply> findByIdAndTerm(Long id, String term);

Optional<UniversityInfoForApply> findByUniversity_KoreanNameAndTerm(String koreanName, String term);
Optional<UniversityInfoForApply> findByKoreanNameAndTerm(String koreanName, String term);

@Query("SELECT c FROM UniversityInfoForApply c WHERE c.university IN :universities AND c.term = :term")
List<UniversityInfoForApply> findByUniversitiesAndTerm(@Param("universities") List<University> universities, @Param("term") String term);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class GeneralRecommendUniversities {
public void init() {
int i = 0;
while (recommendUniversities.size() < RECOMMEND_UNIVERSITY_NUM && i < candidates.size()) {
universityInfoForApplyRepository.findByUniversity_KoreanNameAndTerm(candidates.get(i), term)
universityInfoForApplyRepository.findByKoreanNameAndTerm(candidates.get(i), term)
.ifPresent(recommendUniversities::add);
i++;
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ view:
count:
scheduling:
delay: 3000

management:
endpoints:
web:
exposure:
include: prometheus
97 changes: 45 additions & 52 deletions src/main/resources/data.sql

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static UniversityInfoForApply createUniversityForApply(
return new UniversityInfoForApply(
null,
term,
"koreanName",
1,
TuitionFeeType.HOME_UNIVERSITY_PAYMENT,
SemesterAvailableForDispatch.ONE_SEMESTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ abstract class UniversityDataSetUpEndToEndTest {
public static Country 오스트리아;
public static Country 일본;

public static University 영미권_미국_괌대학_A;
public static University 영미권_미국_괌대학_B;
public static University 영미권_미국_괌대학;
public static University 영미권_미국_네바다주립대학_라스베이거스;
public static University 영미권_캐나다_메모리얼대학_세인트존스_A;
public static University 영미권_캐나다_메모리얼대학_세인트존스;
public static University 유럽_덴마크_서던덴마크대학교;
public static University 유럽_덴마크_코펜하겐IT대학;
public static University 유럽_오스트리아_그라츠대학;
Expand Down Expand Up @@ -97,8 +96,8 @@ public void setUpBasicData() {
오스트리아 = countryRepository.save(new Country("AT", "오스트리아", 유럽));
일본 = countryRepository.save(new Country("JP", "일본", 아시아));

영미권_미국_괌대학_A = universityRepository.save(new University(
null, "괌대학(A형)", "University of Guam", "university_of_guam",
영미권_미국_괌대학 = universityRepository.save(new University(
null, "괌대학", "University of Guam", "university_of_guam",
"https://www.uog.edu/admissions/international-students",
"https://www.uog.edu/admissions/course-schedule",
"https://www.uog.edu/life-at-uog/residence-halls/",
Expand All @@ -107,18 +106,8 @@ public void setUpBasicData() {
null, 미국, 영미권
));

영미권_미국_괌대학_B = universityRepository.save(new University(
null, "괌대학(B형)", "University of Guam", "university_of_guam",
"https://www.uog.edu/admissions/international-students",
"https://www.uog.edu/admissions/course-schedule/",
"https://www.uog.edu/life-at-uog/residence-halls/",
"https://solid-connection.s3.ap-northeast-2.amazonaws.com/original/university_of_guam/logo.png",
"https://solid-connection.s3.ap-northeast-2.amazonaws.com/original/university_of_guam/1.png",
null, 미국, 영미권
));

영미권_미국_네바다주립대학_라스베이거스 = universityRepository.save(new University(
null, "네바다주립대학 라스베이거스(B형)", "University of Nevada, Las Vegas", "university_of_nevada_las_vegas",
null, "네바다주립대학 라스베이거스", "University of Nevada, Las Vegas", "university_of_nevada_las_vegas",
"https://www.unlv.edu/engineering/eip",
"https://www.unlv.edu/engineering/academic-programs",
"https://www.unlv.edu/housing",
Expand All @@ -127,8 +116,8 @@ public void setUpBasicData() {
null, 미국, 영미권
));

영미권_캐나다_메모리얼대학_세인트존스_A = universityRepository.save(new University(
null, "메모리얼 대학 세인트존스(A형)", "Memorial University of Newfoundland St. John's", "memorial_university_of_newfoundland_st_johns",
영미권_캐나다_메모리얼대학_세인트존스 = universityRepository.save(new University(
null, "메모리얼 대학 세인트존스", "Memorial University of Newfoundland St. John's", "memorial_university_of_newfoundland_st_johns",
"https://mun.ca/goabroad/visiting-students-inbound/",
"https://www.unlv.edu/engineering/academic-programs",
"https://www.mun.ca/residences/",
Expand Down Expand Up @@ -194,79 +183,79 @@ public void setUpBasicData() {
));

괌대학_A_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "괌대학(A형)", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 영미권_미국_괌대학_A
new HashSet<>(), 영미권_미국_괌대학
));

괌대학_B_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "괌대학(B형)", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 영미권_미국_괌대학_B
new HashSet<>(), 영미권_미국_괌대학
));

네바다주립대학_라스베이거스_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "네바다주립대학 라스베이거스(B형)", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 영미권_미국_네바다주립대학_라스베이거스
));

메모리얼대학_세인트존스_A_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "메모리얼 대학 세인트존스(A형)", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 영미권_캐나다_메모리얼대학_세인트존스_A
new HashSet<>(), 영미권_캐나다_메모리얼대학_세인트존스
));

서던덴마크대학교_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "서던덴마크대학교", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 유럽_덴마크_서던덴마크대학교
));

코펜하겐IT대학_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "코펜하겐 IT대학", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 유럽_덴마크_코펜하겐IT대학
));

그라츠대학_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "그라츠 대학", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 유럽_오스트리아_그라츠대학
));

그라츠공과대학_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "그라츠공과대학", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 유럽_오스트리아_그라츠공과대학
));

린츠_카톨릭대학_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "린츠 카톨릭 대학교", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
new HashSet<>(), 유럽_오스트리아_린츠_카톨릭대학
));

메이지대학_지원_정보 = universityInfoForApplyRepository.save(new UniversityInfoForApply(
null, term, 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
null, term, "메이지대학", 1, HOME_UNIVERSITY_PAYMENT, ONE_SEMESTER,
"1", "detailsForLanguage", "gpaRequirement",
"gpaRequirementCriteria", "detailsForApply", "detailsForMajor",
"detailsForAccommodation", "detailsForEnglishCourse", "details",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void setUpUserAndToken() {
// response - 응답
Assertions.assertAll(
() -> assertThat(response.id()).isEqualTo(메이지대학_지원_정보.getId()),
() -> assertThat(response.koreanName()).isEqualTo(아시아_일본_메이지대학.getKoreanName()),
() -> assertThat(response.koreanName()).isEqualTo(메이지대학_지원_정보.getKoreanName()),
() -> assertThat(response.englishName()).isEqualTo(아시아_일본_메이지대학.getEnglishName()),
() -> assertThat(response.region()).isEqualTo(아시아_일본_메이지대학.getRegion().getKoreanName()),
() -> assertThat(response.country()).isEqualTo(아시아_일본_메이지대학.getCountry().getKoreanName()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void setUpUserAndToken() {
void 좋아요를_한_대학을_조회한다() {
// setUp - 대학교 좋아요 저장
UniversityInfoForApply differentTermUniversityInfoForApply =
createUniversityForApply(term + " 추가 지원", 영미권_미국_괌대학_A, null);
createUniversityForApply(term + " 추가 지원", 영미권_미국_괌대학, null);
universityInfoForApplyRepository.save(differentTermUniversityInfoForApply);
likedUniversityRepository.saveAll(Set.of(
createLikedUniversity(siteUser, 괌대학_A_지원_정보),
Expand Down

0 comments on commit 50fde8e

Please sign in to comment.