}
}
@Test
public void testMultiReader() throws IOException {
MultiReader reader = new MultiReader(fs, conf, "manyMaps");
IntWritable key = new IntWritable();
BytesWritable value = new BytesWritable();
for (int i = 0; i < 1000; i++) {
if (i == 10)
continue;
assertTrue(reader.next(key, value));
assertEquals(i, key.get());
}
assertEquals(value.compareTo(new BytesWritable("someValue".getBytes())), 0);
assertFalse(reader.next(key, value));
key.set(500);
assertTrue(reader.seek(key));
scan(reader, 500);
key.set(10);
assertFalse(reader.seek(key));
scan(reader, 10);
key.set(1000);
assertFalse(reader.seek(key));
assertFalse(reader.next(key, value));
key.set(-1);
assertFalse(reader.seek(key));
key.set(0);
assertTrue(reader.next(key, value));
assertEquals(0, key.get());
reader.close();
fs.delete(new Path("manyMaps/even"), true);
reader = new MultiReader(fs, conf, "manyMaps");
key.set(501);
assertTrue(reader.seek(key));
scanOdd(reader, 501);
key.set(1000);
assertFalse(reader.seek(key));
assertFalse(reader.next(key, value));
key.set(-1);
assertFalse(reader.seek(key));
key.set(1);
assertTrue(reader.next(key, value));
assertEquals(1, key.get());
reader.close();
}