// write the data to a file
Path dataPath = Utils.writeDataToTestFile(sData);
// prepare a data converter
Dataset dataset = DataLoader.generateDataset(descriptor, sData);
DataConverter converter = new DataConverter(dataset);
Job job = new Job();
job.setInputFormatClass(TextInputFormat.class);
FileInputFormat.setInputPaths(job, dataPath);
setMaxSplitSize(job.getConfiguration(), dataPath, NUM_MAPS);
// retrieve the splits
TextInputFormat input = new TextInputFormat();
List<InputSplit> splits = input.getSplits(job);
assertEquals(NUM_MAPS, splits.size());
InputSplit[] sorted = new InputSplit[NUM_MAPS];
splits.toArray(sorted);
Builder.sortSplits(sorted);
List<Integer> keys = new ArrayList<Integer>();
List<Step0Output> values = new ArrayList<Step0Output>();
int[] expectedIds = new int[NUM_MAPS];
TaskAttemptContext context = new TaskAttemptContext(job.getConfiguration(),
new TaskAttemptID());
for (int p = 0; p < NUM_MAPS; p++) {
InputSplit split = sorted[p];
RecordReader<LongWritable, Text> reader = input.createRecordReader(split,
context);
reader.initialize(split, context);
Long firstKey = null;
int size = 0;
while (reader.nextKeyValue()) {
LongWritable key = reader.getCurrentKey();
Text value = reader.getCurrentValue();
if (firstKey == null) {
firstKey = key.get();
expectedIds[p] = converter.convert(0, value.toString()).getLabel();
}
size++;
}