Exemplo n.º 1
0
  @Test
  public void testSanity() throws Exception {
    File segmentDir = tempFolder.newFolder();
    createTestIndex(segmentDir);

    QueryableIndex qi = null;
    try {
      qi = IndexIO.loadIndex(segmentDir);
      StorageAdapter sa = new QueryableIndexStorageAdapter(qi);
      WindowedStorageAdapter wsa = new WindowedStorageAdapter(sa, sa.getInterval());
      IngestSegmentFirehose firehose =
          new IngestSegmentFirehose(
              ImmutableList.of(wsa, wsa),
              ImmutableList.of("host"),
              ImmutableList.of("visited_sum", "unique_hosts"),
              null,
              QueryGranularity.NONE);

      int count = 0;
      while (firehose.hasMore()) {
        firehose.nextRow();
        count++;
      }
      Assert.assertEquals(18, count);
    } finally {
      if (qi != null) {
        qi.close();
      }
    }
  }
 @AfterClass
 public static void cleanup() throws Exception {
   queryableIndex.close();
   incrementalIndex.close();
   FileUtils.deleteDirectory(persistedSegmentDir);
 }