-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
130 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ jobs: | |
- name: build | ||
run: | | ||
chmod +x gradlew | ||
./gradlew build -x test -x openapi3 | ||
./gradlew build -x openapi3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/server/bbo_gak/domain/recruit/dao/RecruitScheduleRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.server.bbo_gak.domain.recruit.dao; | ||
|
||
import com.server.bbo_gak.domain.recruit.entity.RecruitSchedule; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface RecruitScheduleRepository extends JpaRepository<RecruitSchedule, Long> { | ||
|
||
List<RecruitSchedule> findAllByDeadLineBetween(LocalDate now, LocalDate nowPlusOneDay); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/test/java/com/server/bbo_gak/domain/notification/service/NotificationSchedulerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.server.bbo_gak.domain.notification.service; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import com.server.bbo_gak.domain.notification.dao.NotificationRepository; | ||
import com.server.bbo_gak.domain.notification.entity.Notification; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.jdbc.Sql; | ||
|
||
@SpringBootTest | ||
@ActiveProfiles("test") | ||
@Sql("/notification-test-data.sql") | ||
public class NotificationSchedulerTest { | ||
|
||
@Autowired | ||
private NotificationScheduler notificationScheduler; | ||
|
||
@Autowired | ||
private NotificationRepository notificationRepository; | ||
|
||
@Test | ||
public void 자정알림생성_성공() { | ||
|
||
// when: 스케줄러 실행 | ||
notificationScheduler.executeAtMidnight(); | ||
|
||
// then: Notification이 잘 생성되었는지 검증 | ||
List<Notification> notifications = notificationRepository.findAll(); | ||
assertEquals(1, notifications.size()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
delete | ||
from notification; | ||
|
||
delete | ||
from recruit_schedule; | ||
|
||
delete | ||
from recruit; | ||
|
||
delete | ||
from recruit_season; | ||
|
||
delete | ||
from users; | ||
|
||
|
||
INSERT INTO users (deleted, created_at, update_at, user_id, dtype, email, login_id, name, password, role) | ||
VALUES (false, '2024-07-24 21:27:20.000000', '2024-07-24 21:27:21.000000', 1, '1', null, 'test', 'test', 'test', | ||
'USER'); | ||
|
||
-- 다음으로 recruit_season 테이블에 데이터를 삽입합니다. | ||
INSERT INTO recruit_season (recruit_season_id, name, user_id) | ||
VALUES (1, '2024 상반기', 1); | ||
INSERT INTO recruit_season (recruit_season_id, name, user_id) | ||
VALUES (2, '2024 하반기', 1); | ||
|
||
INSERT INTO recruit (recruit_id, title, site_url, recruit_status, recruit_season_id, user_id, created_at, update_at, | ||
deleted) | ||
VALUES (1, 'Title for one day left', 'http://example.com/1', 'DOCUMENT_PASSED', 1, 1, CURRENT_TIMESTAMP, | ||
CURRENT_TIMESTAMP, false), | ||
(2, 'Title for more than one day left', 'http://example.com/2', 'PREPARATION_IN_PROGRESS', 2, 1, | ||
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, false); | ||
|
||
-- RecruitSchedule 테이블에 데이터 삽입 | ||
INSERT INTO recruit_schedule (recruit_schedule_id, recruit_id, recruit_schedule_stage, dead_line) | ||
VALUES (1, 1, 'FIRST_INTERVIEW', CURRENT_DATE + 1), -- 하루 남은 스케줄 | ||
(2, 2, 'CLOSING_DOCUMENT', CURRENT_DATE + 2); -- 하루 이상 남은 스케줄 |