writer.write(null, tuple);
}
writer.close(null);
int size = (int) tFile.length();
FileSplit split = new FileSplit(basicTFile, 0, size, null);
TFileRecordReader reader = new TFileRecordReader();
reader.initialize(split,
HadoopShims.createTaskAttemptContext(
conf,
HadoopShims.createTaskAttemptID("jt", 1, true, 1, 1)));
float progress = 0, lastprogress = 0;
int curval = 0, prevval = -1;
while (reader.nextKeyValue()) {
Tuple t = (Tuple) reader.getCurrentValue();
curval = Integer.valueOf((String) t.get(0));
assertEquals("Unexpected Value", curval, prevval + 1);
prevval = curval;
progress = reader.getProgress();
if( progress != lastprogress ) {
System.err.println("progress: " + progress);
}
assertTrue("Progress is not positive", progress > 0);
assertTrue("Progress is not increasing",
progress >= lastprogress);
lastprogress = progress;
}
assertEquals("Last value does not match",
curval, LOOP_SIZE );
reader.close();
} finally {
tFile.delete();
}
}
}