| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.domain.Config; |
| | | import com.yeshi.buwan.service.imp.ConfigService; |
| | | import com.yeshi.buwan.util.BeanUtil; |
| | | import com.yeshi.buwan.job.AdJob; |
| | | import org.json.JSONObject; |
| | | import org.junit.Test; |
| | | 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 java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) |
| | | @ContextConfiguration(locations = {"classpath:spring.xml"}) |
| | | @WebAppConfiguration |
| | | public class ConfigTest { |
| | | |
| | | @Resource |
| | | private AdJob adJob; |
| | | |
| | | @Test |
| | | public void test1() { |
| | | ConfigService configService = BeanUtil.getBean(ConfigService.class); |
| | | List<Config> configList = configService.getConfig(44L, 1); |
| | | } |
| | | |
| | | @Test |
| | | public void test2(){ |
| | | String resourceName = "爱奇艺"; |
| | | if (resourceName.indexOf("爱奇艺") > -1 || resourceName.indexOf("搜狐") > -1 || resourceName.indexOf("腾讯") > -1 || resourceName.indexOf("乐视") > -1 || resourceName.indexOf("AcFun") > -1 || resourceName.indexOf("风行") > -1) { |
| | | System.out.println(resourceName); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("appId", "10409568"); |
| | | jsonObject.put("detailSystemId", "44"); |
| | | try { |
| | | adJob.openHWAd(jsonObject.toString()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |