admin
2021-03-06 7804263c6061aef813f0db27cb3046f746572606
src/test/java/com/hxh/spring/test/ClearVideo.java
@@ -4,6 +4,8 @@
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.orm.hibernate4.HibernateCallback;
import com.yeshi.buwan.dao.VideoInfoDao;
@@ -13,26 +15,36 @@
import com.yeshi.buwan.iqiyi.entity.VideoIqiyi;
import com.yeshi.buwan.service.imp.ClearService;
import com.yeshi.buwan.util.BeanUtil;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import javax.annotation.Resource;
/**
 * 清除时间比较久远的小视频数据
 * 
 * @author Administrator
 *
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring.xml"})
@WebAppConfiguration
public class ClearVideo {
   public static void main(String[] args) {
    @Resource
    public ClearService clearService;
    @Test
    public void main() {
      // ClearService clearService = BeanUtil.getBean(ClearService.class);
      // for (int i = 0; i < 1000; i++) {
      // clearService.clearDependVideo();
      // }
      ClearService clearService = BeanUtil.getBean(ClearService.class);
      for (int i = 0; i < 300; i++) {
         long[] typeIds = new long[] { 299,242,216,249,290,219 };
         for (long id : typeIds) {
            clearService.clearVideos(new long[] { id }, "2019-01-20");
                clearService.clearVideos(new long[]{id}, "2021-02-01");
         }
      }
      // }
@@ -139,4 +151,9 @@
   }
    @Test
    public void clearDepend(){
        clearService.clearDependVideo();
    }
}