Skip to content

Commit

Permalink
remove: 스케줄러 로그파일들 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
youngreal committed Feb 22, 2024
1 parent 35d39a3 commit 793219e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.example.inflearn.domain.post.domain.PopularPost;
import com.example.inflearn.infra.repository.post.PopularPostRepository;
import com.example.inflearn.infra.repository.post.PostRepository;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -45,20 +44,10 @@ public class PostSchedulerServiceTest {
@Scheduled(fixedDelay = 15000)
@Transactional
public void updatePopularPosts() {
log.info("1번 스케줄러 시작시간 ={}", LocalDateTime.now());
log.info("1번 스케줄러 시작");
// 7일간 좋아요 많은 5개 DB에서 가져오기
Map<Long, Long> newPopularPosts = postQueryService.updatePopularPostsForSchedulerTest();
for (Entry<Long, Long> entry : newPopularPosts.entrySet()) {
log.info("new PopularPosts Key = {}", entry.getKey());
log.info("new PopularPosts Value= {}", entry.getValue());
}
Map<Long, Long> beforePopularPosts = getBeforePopularPostMap();
for (Entry<Long, Long> entry : beforePopularPosts.entrySet()) {
log.info("before PopularPosts Key = {}", entry.getKey());
log.info("before PopularPosts Value= {}", entry.getValue());
}

// 새롭게 맵을 만들지않고 두 Map을 add하게되면 서로의 Map의 변화에 서로 영향을 받기때문에 UnsupportedOperationException발생
updatePosts(sortEntriesByValue(beforePopularPosts, newPopularPosts));
}

Expand Down Expand Up @@ -95,6 +84,7 @@ private void updatePosts(List<Entry<Long, Long>> entries) {
}

private List<Entry<Long, Long>> sortEntriesByValue(Map<Long,Long> beforePopularPosts, Map<Long, Long> newPopularPosts) {
// 새롭게 맵을 만들지않고 두 Map을 add하게되면 서로의 Map의 변화에 서로 영향을 받기때문에 UnsupportedOperationException발생
Map<Long, Long> addMap = new HashMap<>();
addMap.putAll(beforePopularPosts);
addMap.putAll(newPopularPosts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,6 @@ void setup() {
.andDo(print());
}

@Test
void 포스트_검색_실패_검색어_길이가_2보다_작음() throws Exception {
//when & then
mockMvc.perform(get("/posts/search?page=1&size=20&searchWord=자"))
.andExpect(status().isBadRequest())
.andDo(print());
}

@Test
void 포스트_해시태그_검색_성공_해시태그_검색어_입력() throws Exception {
//given
Expand Down Expand Up @@ -405,14 +397,6 @@ void setup() {
.andDo(print());
}

@Test
void 포스트_해시태그_검색_실패_검색어_길이가_2보다_작음() throws Exception {
//when & then
mockMvc.perform(get("/posts/search-hashtag?page=1&size=20&searchWord=자"))
.andExpect(status().isBadRequest())
.andDo(print());
}

@Test
void 게시글_좋아요_성공() throws Exception {
//given
Expand Down

0 comments on commit 793219e

Please sign in to comment.