use of org.apache.ignite.igfs.mapreduce.records.IgfsStringDelimiterRecordResolver in project ignite by apache.
the class IgfsTaskSelfTest method testTask.
/**
* Test task.
*
* @throws Exception If failed.
*/
@SuppressWarnings("ConstantConditions")
public void testTask() throws Exception {
String arg = DICTIONARY[new Random(System.currentTimeMillis()).nextInt(DICTIONARY.length)];
generateFile(TOTAL_WORDS);
Long genLen = igfs.info(FILE).length();
IgniteBiTuple<Long, Integer> taskRes = igfs.execute(new Task(), new IgfsStringDelimiterRecordResolver(" "), Collections.singleton(FILE), arg);
assert F.eq(genLen, taskRes.getKey());
assert F.eq(TOTAL_WORDS, taskRes.getValue());
}
use of org.apache.ignite.igfs.mapreduce.records.IgfsStringDelimiterRecordResolver in project ignite by apache.
the class IgfsStringDelimiterRecordResolverSelfTest method assertSplitNull.
/**
* Check the split resolution resulted in {@code null}.
*
* @param suggestedStart Suggested start.
* @param suggestedLen Suggested length.
* @param data File data.
* @param delims Delimiters.
* @throws Exception If failed.
*/
public void assertSplitNull(long suggestedStart, long suggestedLen, byte[] data, String... delims) throws Exception {
write(data);
IgfsStringDelimiterRecordResolver rslvr = resolver(delims);
IgfsFileRange split;
try (IgfsInputStream is = read()) {
split = rslvr.resolveRecords(igfs, is, split(suggestedStart, suggestedLen));
}
assert split == null : "Split is not null.";
}
Aggregations