package com.hxh.spring.test;
|
|
import java.util.List;
|
|
import org.junit.Test;
|
|
import com.yeshi.buwan.dao.VideoInfoDao;
|
import com.yeshi.buwan.service.imp.StatisticsService;
|
import com.yeshi.buwan.util.BeanUtil;
|
import com.yeshi.buwan.util.news.SouGouParser;
|
import org.junit.runner.RunWith;
|
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
|
import javax.annotation.Resource;
|
|
@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试
|
@ContextConfiguration(locations = {"classpath:spring.xml"})
|
@WebAppConfiguration
|
public class StatisticTest {
|
// @Test
|
public void updateSouGou() {// SouGouParser
|
SouGouParser souGouParser = (SouGouParser) BeanUtil.getBean("souGouParser");
|
souGouParser.startParse();
|
}
|
|
// @Test
|
public void refreshWatchCount() {
|
StatisticsService statisticsService = (StatisticsService) BeanUtil.getBean("statisticsService");
|
VideoInfoDao videoInfoDao = (VideoInfoDao) BeanUtil.getBean("videoInfoDao");
|
for (int p = 2; p < 10; p++) {
|
System.out.println("页码:" + p);
|
List list = videoInfoDao.sqlList("select id from wk_video_video", (p - 1) * 10000, 10000, null);
|
for (int j = 0; j < list.size(); j++) {
|
statisticsService.refreshWatchCount(list.get(j) + "");
|
statisticsService.refreshVideoCommentCount(list.get(j) + "");
|
// statisticsService.refreshVideoDetailCount(list.get(j) + "");
|
}
|
}
|
}
|
|
// @Test
|
public void refreshCommentCount() {
|
|
}
|
|
|
@Resource
|
private StatisticsService statisticsService;
|
|
@Test
|
public void playStatistics() {
|
statisticsService.categoryPlayStatistic();
|
}
|
|
}
|