shikeying
2024-01-19 54ea586ece304ef2569a345c9b26b2a9b9702c8a
walker-scheduler/src/test/java/com/walker/scheduler/TestScheduler.java
@@ -1,11 +1,39 @@
package com.walker.scheduler;
import com.walker.infrastructure.utils.DateUtils;
import com.walker.infrastructure.utils.WaitConsoleInput;
import com.walker.scheduler.impl.ForeverScheduler;
import org.junit.Test;
public class TestScheduler {
    @Test
    public void testEveryDayOnce(){
        EveryDayScheduler scheduler = new EveryDayScheduler(1, "机构信息同步");
        Option option = new Option();
//        option.setPeriodType(Option.PeriodType.DAY);
//        option.setTimeType(Option.TimeType.EXACTLY);
//        int[] yearMonthDay = DateUtils.getCurrentYearMonthDay();
//        // 设置每天凌晨3点执行
//        int settingHour = 3;
//        option.setExactlyTime(yearMonthDay[0], yearMonthDay[1], yearMonthDay[2], settingHour);
//        scheduler.setOption(option);
//        scheduler.start();
//        System.out.println("初始启动,option=" + scheduler.getOption());
        option.setPeriodType(Option.PeriodType.MONTH);
        option.setTimeType(Option.TimeType.EXACTLY);
        int[] yearMonthDay = DateUtils.getCurrentYearMonthDay();
        // 设置每天凌晨3点执行
        int settingHour = 3;
        option.setExactlyTime(yearMonthDay[0], yearMonthDay[1], 19, settingHour);
        scheduler.setOption(option);
        scheduler.start();
        System.out.println("初始启动,option=" + scheduler.getOption());
        WaitConsoleInput.waitInput();
    }
//    @Test
    public void testRunIdSchedulers(){
        this.createIdScheduler(2, 5000).start();