Package test.feed

Source Code of test.feed.TestPersonalFeedService

package test.feed;

import java.util.ArrayList;
import java.util.Date;
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.feed.model.FeedResult;
import com.skyline.feed.service.PersonalFeedService;
import com.skyline.feed.type.FeedType;

public class TestPersonalFeedService {

  private static PersonalFeedService personalFeedService;

  @BeforeClass
  public static void init() {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("config/context/applicationContext.xml");
    personalFeedService = (PersonalFeedService) ctx.getBean("personalFeedService");
  }

  //@Test
  public void testInsert() {
    for(int i=0;i<10000;i++){
    personalFeedService.addFeed(Long.valueOf(i), "这一个文章的标题", "这是一个文章的内容", Long.valueOf(i), "providerNickname", "providerPortrait",
        Long.valueOf(i), FeedType.ARTICLE);
    }
  }

  @Test
  public void testQuery(){
    FeedResult result=personalFeedService.getFeeds(Long.valueOf(6), 0, 0);
    System.out.println(result.getCurrent());
    System.out.println(result.getLevel());
    List<DBObject> datas=result.getData();
    for(DBObject data:datas){
      System.out.println(data);
    }
  }
 
  //@Test
  public void testQueryBath(){
    List<Long> ownerIds=new ArrayList<Long>();
    for(long i=0;i<200;i++){
      ownerIds.add(i);
    }
    long lastQueryTime=System.currentTimeMillis()-50000;
    List<DBObject> objs=personalFeedService.getFeeds(ownerIds, 0, lastQueryTime);
    System.out.println(objs.size());
    for(DBObject obj:objs){
      //System.out.println(obj);
    }
  }
}
TOP

Related Classes of test.feed.TestPersonalFeedService

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.