コード例 #1
0
  /** 测试方式基本功能,只有cityId、pageNo、pageSize */
  @SuppressWarnings("unchecked")
  @Test
  @Ignore
  public void testXinWenSearch() {
    XinWenSearchCondition searchCondition = new XinWenSearchCondition();
    searchCondition.setCityId(1);
    searchCondition.setPageNo(1);
    searchCondition.setPageSize(10);

    Map<String, Object> ret = xinWenSearchService.xinWenSearch(searchCondition);

    assertNotNull(ret);

    int total = 0;

    Object totalObj = ret.get("total");
    if (null != totalObj) {
      total = (Integer) totalObj;
    }

    assertTrue(total > 0);

    List<EsNews> news = null;

    Object dataObj = ret.get("data");
    if (null != dataObj) {
      news = (List<EsNews>) ret.get("data");
    }

    assertNotNull(news);
  }
コード例 #2
0
  /** 测试“更多”类别,城市为威海,pageNo=1, pageSize=30; */
  @SuppressWarnings("unchecked")
  @Test
  @Ignore
  public void testXinWenSearchMore() {
    XinWenSearchCondition searchCondition = new XinWenSearchCondition();
    searchCondition.setCityId(40);
    searchCondition.setPageNo(1);
    searchCondition.setPageSize(30);

    List<XinWenQueryData> queryDatas = new ArrayList<XinWenQueryData>();
    queryDatas.add(new XinWenQueryData(XinWenSearchService.SearchType.MORE, 451));

    searchCondition.setQueryDatas(queryDatas);

    Map<String, Object> ret = xinWenSearchService.xinWenSearch(searchCondition);

    assertNotNull(ret);

    int total = 0;

    Object totalObj = ret.get("total");
    if (null != totalObj) {
      total = (Integer) totalObj;
    }

    assertTrue(total > 0);

    System.out.println("total:" + total);

    List<EsNews> news = null;

    Object dataObj = ret.get("data");
    if (null != dataObj) {
      news = (List<EsNews>) ret.get("data");
    }

    assertNotNull(news);

    printEsNewsForTest(news);
  }