From 81db7b3b070c003e6f5f0d1c757ab30b6f42c944 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 10 十月 2020 18:49:41 +0800
Subject: [PATCH] 百度内容联盟

---
 src/test/java/com/hxh/spring/test/AcfunTest.java |   75 +++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 32 deletions(-)

diff --git a/src/test/java/com/hxh/spring/test/AcfunTest.java b/src/test/java/com/hxh/spring/test/AcfunTest.java
index 16798e0..d224b43 100644
--- a/src/test/java/com/hxh/spring/test/AcfunTest.java
+++ b/src/test/java/com/hxh/spring/test/AcfunTest.java
@@ -6,46 +6,57 @@
 import java.io.InputStreamReader;
 
 import com.yeshi.buwan.domain.AcFunTemporary;
-import com.yeshi.buwan.job.VideoUpdateJob;
+import com.yeshi.buwan.job.JuHeVideoUpdateJob;
 import com.yeshi.buwan.service.imp.AcFunTemporaryService;
 import com.yeshi.buwan.util.BeanUtil;
 import com.yeshi.buwan.util.StringUtil;
+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 AcfunTest {
 
-	@org.junit.Test
-	public void test1() {
-		VideoUpdateJob videoUpdateJob = BeanUtil.getBean(VideoUpdateJob.class);
-		videoUpdateJob.updateAcFun();
-	}
+    @Resource
+    private JuHeVideoUpdateJob juHeVideoUpdateJob;
 
-	@org.junit.Test
-	public void test2() {
-		 AcFunTemporaryService acFunTemporaryService =
-		 BeanUtil.getBean(AcFunTemporaryService.class);
-		InputStreamReader isr = null;
-		try {
-			isr = new InputStreamReader(
-					new FileInputStream(new File("C:/Users/Administrator/Desktop/鍔ㄦ�佸垎绫�/myprint.log")), "UTF-8");
+    @org.junit.Test
+    public void test1() {
+        juHeVideoUpdateJob.updateAcFun();
+    }
 
-			BufferedReader br = new BufferedReader(isr);
-			String lineTxt = null;
-			while ((lineTxt = br.readLine()) != null) {
-				if (!StringUtil.isNullOrEmpty(lineTxt)) {
-					StringBuffer buffer = new StringBuffer(lineTxt);
-					int p = buffer.indexOf("[INFO]");
-					AcFunTemporary act = new AcFunTemporary();
-					act.setJson(buffer.substring(p + 6).trim());
-					act.setIsConsume(false);
-					act.setErrorCount(0);
-					acFunTemporaryService.save(act);
-				}
-			}
-			br.close();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
+    @org.junit.Test
+    public void test2() {
+        AcFunTemporaryService acFunTemporaryService =
+                BeanUtil.getBean(AcFunTemporaryService.class);
+        InputStreamReader isr = null;
+        try {
+            isr = new InputStreamReader(
+                    new FileInputStream(new File("C:/Users/Administrator/Desktop/鍔ㄦ�佸垎绫�/myprint.log")), "UTF-8");
 
-	}
+            BufferedReader br = new BufferedReader(isr);
+            String lineTxt = null;
+            while ((lineTxt = br.readLine()) != null) {
+                if (!StringUtil.isNullOrEmpty(lineTxt)) {
+                    StringBuffer buffer = new StringBuffer(lineTxt);
+                    int p = buffer.indexOf("[INFO]");
+                    AcFunTemporary act = new AcFunTemporary();
+                    act.setJson(buffer.substring(p + 6).trim());
+                    act.setIsConsume(false);
+                    act.setErrorCount(0);
+                    acFunTemporaryService.save(act);
+                }
+            }
+            br.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
 
 }

--
Gitblit v1.8.0