// 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, numMaps);
// retrieve the splits
TextInputFormat input = new TextInputFormat();
List<InputSplit> splits = input.getSplits(job);
assertEquals(numMaps, splits.size());
InputSplit[] sorted = new InputSplit[numMaps];
splits.toArray(sorted);
Builder.sortSplits(sorted);
List<Integer> keys = new ArrayList<Integer>();
List<Step0Output> values = new ArrayList<Step0Output>();
int[] expectedIds = new int[numMaps];
TaskAttemptContext context = new TaskAttemptContext(job.getConfiguration(),
new TaskAttemptID());
for (int p = 0; p < numMaps; 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()).label;
}
size++;
}