Exemplo n.º 1
0
 @BeforeClass
 public void beforeClass() {
   Mapper m = new SortUsagesPart.SorterMap();
   Reducer c = new SortUsagesPart.SorterCombine();
   Reducer r = new SortUsagesPart.SorterReduce();
   mapReduceDriver = new MapReduceDriver(m, r).withCombiner(c);
   Configuration conf = mapReduceDriver.getConfiguration();
   conf.set("NB_OF_RECORDS", RESULT_RECORDS);
   conf.set("RESULT_DATE", TEST_DATE);
 }
Exemplo n.º 2
0
 @Test
 public void testVisitPageMR() throws Exception {
   // 添加模拟数据
   generateVisitData();
   mrPageVisitor.getConfiguration().set("custom.period", "month");
   // 开始计算
   List<Pair<PageVisitKey, PageVisitOutputValue>> results = mrPageVisitor.run(true);
   for (int i = 0; i < results.size(); i++) {
     Pair<PageVisitKey, PageVisitOutputValue> pair = results.get(i);
     System.out.println(
         "Key:" + pair.getFirst().toString() + ", Value:" + pair.getSecond().toString());
   }
 }