コード例 #1
0
ファイル: TestHashStore.java プロジェクト: jkreps/valencia
 @Test
 public void testGc() throws IOException {
   // TODO: need to ensure the gc happens before the assertion
   int numRecords = this.store.config().segmentSize();
   List<Record> records = StoreTestUtils.randomRecords(numRecords);
   // write all the records a few times to incur some garbage
   for (int i = 0; i < 5; i++) putAll(records);
   for (Record record : records)
     assertEquals("Found record does not match put record.", record, this.store.get(record.key()));
 }
コード例 #2
0
ファイル: TestHashStore.java プロジェクト: jkreps/valencia
 @Test
 public void testIndexExpansion() throws IOException {
   int numRecords = 3 * this.store.config().indexInitialCapacity();
   List<Record> records = StoreTestUtils.randomRecords(numRecords);
   for (int i = 0; i < numRecords; i++) {
     assertEquals(i, this.store.count());
     assertNull(this.store.put(records.get(i)));
     assertNotNull(this.store.get(records.get(i).key()));
   }
   for (Record record : records) {
     assertEquals("Found record does not match put record.", record, this.store.get(record.key()));
   }
 }
コード例 #3
0
ファイル: TestHashStore.java プロジェクト: jkreps/valencia
 private void putAll(List<Record> records) throws IOException {
   for (Record r : records) {
     this.store.put(r);
     assertEquals("Any record we put should be readable.", r, this.store.get(r.key()));
   }
 }