package activity;

import com.red.circle.OtherServiceApplication;
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
import com.red.circle.other.app.manager.activity.award.CpRankingRewardManager;
import com.red.circle.other.app.scheduler.cp.CpRankingRewardTask;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * CP排行榜奖励测试类.
 */
@Slf4j
@SpringBootTest(classes = OtherServiceApplication.class)
@RunWith(SpringRunner.class)
public class CpRankingRewardTest {

  @Autowired
  private CpRankingRewardManager cpRankingRewardManager;
  @Autowired
  private CpRankingRewardTask cpRankingRewardTask;

  /**
   * 测试发送上周周榜前三奖励
   */
  @Test
  public void testSendLastWeekTopReward() {
    log.info("========== 开始测试发送上周周榜前三奖励 ==========");
    
    try {
      SysOriginPlatformEnum platform = SysOriginPlatformEnum.LIKEI;
      
      cpRankingRewardManager.sendLastWeekTopReward(platform);
      
      log.info("========== 上周周榜前三奖励发送测试完成 ==========");
    } catch (Exception e) {
      log.error("========== 上周周榜前三奖励发送测试异常 ==========", e);
    }
  }

  /**
   * 测试发送上赛季前三奖励
   */
  @Test
  public void testSendLastSeasonTopReward() {
    log.info("========== 开始测试发送上赛季前三奖励 ==========");
    
    try {
      SysOriginPlatformEnum platform = SysOriginPlatformEnum.LIKEI;

      cpRankingRewardTask.sendSeasonRankingReward();
      
      log.info("========== 上赛季前三奖励发送测试完成 ==========");
    } catch (Exception e) {
      log.error("========== 上赛季前三奖励发送测试异常 ==========", e);
    }
  }
}
