package com.bailuntec.mapper;

import com.bailuntec.utils.SessionUtil;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.executor.ShardingContexts;
import org.junit.jupiter.api.Test;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.HashMap;

/**
 * <p>
 *
 * </p>
 *
 * @author robbendev
 * @since 2020/8/11 5:00 下午
 */
class DcBaseStockMapperTest {

    @Test
    void countIncrement() {
    }

    @Test
    void increment() {
        DcBaseStockMapper dcBaseStockMapper = SessionUtil.getSession().getMapper(DcBaseStockMapper.class);

        ShardingContexts shardingContexts = new ShardingContexts("1", "jobName", 8, "INCREMENT", new HashMap<>(), 1);

        LocalDateTime v1 = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusHours(3);
        LocalDateTime v2 = LocalDateTime.of(LocalDate.now(), LocalTime.MIN).minusDays(7);

        dcBaseStockMapper.increment(new ShardingContext(shardingContexts, 1), v1, v2, 0, 100);
    }
}
