Package test.feed

Source Code of test.feed.TestSubscribedFeedService

package test.feed;

import java.util.ArrayList;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.mongodb.DBObject;
import com.skyline.base.type.IdolType;
import com.skyline.common.bean.Page;
import com.skyline.feed.model.FeedResult;
import com.skyline.feed.service.SubscribedFeedService;
import com.skyline.user.model.Fan;
import com.skyline.user.service.AttentionService;

public class TestSubscribedFeedService {
  private static SubscribedFeedService subscribedFeedService;
  static AttentionService attentionservice=null;

  @BeforeClass
  public static void init() {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("config/context/applicationContext.xml");
    subscribedFeedService = (SubscribedFeedService) ctx.getBean("subscribedFeedService");
    attentionservice = (AttentionService) ctx.getBean("attentionService");
  }

  @Test
  public void test() {
    long t1=System.currentTimeMillis();
    List<Long> idolIds = new ArrayList<Long>();
    List<Fan> list = attentionservice.queryAttentionByType(Long.valueOf(5), IdolType.USER);
   
    for (Fan fan:list) {
      System.out.println(fan.getIdolId());
      idolIds.add(fan.getIdolId());
    }
   
    Long ownerId = Long.valueOf(5);
    Integer current = 0;
    Integer level = 0;
    FeedResult result = subscribedFeedService.getFeeds(idolIds, ownerId, current, level);
    long t2=System.currentTimeMillis();
    System.out.println("耗时"+(t2-t1));
    System.out.println("current:"+result.getCurrent());
    System.out.println("level:"+result.getLevel());
    List<DBObject> datas=result.getData();
    for(DBObject data:datas){
      System.out.println(data);
    }
  }
}
TOP

Related Classes of test.feed.TestSubscribedFeedService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.