Esempio n. 1
0
 @Test
 public void seek() throws Exception {
   assertThat(reader.seek(new IntWritable(496)), is(true));
   assertThat(reader.next(key, value), is(true));
   assertThat(((IntWritable) key).get(), is(497));
   assertThat(((Text) value).toString(), is("Three, four, shut the door"));
 }
Esempio n. 2
0
  @Before
  public void setUp() throws IOException {
    MapFileDemo.main(new String[] {MAP_URI});

    Configuration conf = new Configuration();
    fs = FileSystem.get(URI.create(MAP_URI), conf);

    reader = new MapFile.Reader(fs, MAP_URI, conf);
    key = (WritableComparable<?>) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
    value = (Writable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
  }
Esempio n. 3
0
 @Test
 public void get() throws Exception {
   // vv MapFileSeekTest
   Text value = new Text();
   reader.get(new IntWritable(496), value);
   assertThat(value.toString(), is("One, two, buckle my shoe"));
   // ^^ MapFileSeekTest
 }