@Test
public void executeBackwardsCompatibleSequence() throws Exception {
writeFiles(true, false, false);
Crush crush = new Crush();
ToolRunner.run(job, crush, new String [] {
"in", "out", "2"
});
/*
* Crushed files.
*/
verifyOutput(homeDir + "/in/dir/subdir", "crushed_file-*-*-*", Format.SEQUENCE, Format.SEQUENCE, defaultCodec, "file20", "file21", "file22", "file23", "file24");
verifyOutput(homeDir + "/in/dir/subdir/subsubdir", "crushed_file-*-*-*", Format.SEQUENCE, Format.SEQUENCE, defaultCodec, "file30", "file31", "file32", "file33", "file34");
verifyOutput(homeDir + "/in/dir/subdir/other", "crushed_file-*-*-*", Format.SEQUENCE, Format.SEQUENCE, defaultCodec, "file40", "file41", "file42", "file43");
verifyOutput(homeDir + "/in/dir/other", "crushed_file-*-*-*", Format.SEQUENCE, Format.SEQUENCE, defaultCodec, "file50", "file51", "file52", "file53", "file54", "file55");
verifyOutput(homeDir + "/in", "crushed_file-*-*-*", Format.SEQUENCE, Format.SEQUENCE, defaultCodec, "file70", "file71", "file72");
/*
* Skipped files should be copied to the output.
*/
verifyOutput(homeDir + "/in/dir/skipped", "file80", Format.SEQUENCE, Format.SEQUENCE, defaultCodec, "file80");
/*
* Crush input files should be moved to the clone dir.
*/
for (String file : new String[] { "file20", "file21", "file22", "file23", "file24" }) {
verifyOutput(homeDir + "/out" + homeDir + "/in/dir/subdir", file, Format.SEQUENCE, Format.SEQUENCE, defaultCodec, file);
}
for (String file : new String[] { "file30", "file31", "file32", "file33", "file34" }) {
verifyOutput(homeDir + "/out" + homeDir + "/in/dir/subdir/subsubdir", file, Format.SEQUENCE, Format.SEQUENCE, defaultCodec, file);
}
for (String file : new String[] { "file40", "file41", "file42", "file43" }) {
verifyOutput(homeDir + "/out" + homeDir + "/in/dir/subdir/other", file, Format.SEQUENCE, Format.SEQUENCE, defaultCodec, file);
}
for (String file : new String[] { "file50", "file51", "file52", "file53", "file54", "file55" }) {
verifyOutput(homeDir + "/out" + homeDir + "/in/dir/other", file, Format.SEQUENCE, Format.SEQUENCE, defaultCodec, file);
}
for (String file : new String[] { "file70", "file71", "file72" }) {
verifyOutput(homeDir + "/out" + homeDir + "/in", file, Format.SEQUENCE, Format.SEQUENCE, defaultCodec, file);
}
Counters jobCounters = crush.getJobCounters();
assertThat(jobCounters.getCounter(MapperCounter.DIRS_FOUND), equalTo( 7L));
assertThat(jobCounters.getCounter(MapperCounter.DIRS_ELIGIBLE), equalTo( 5L));
assertThat(jobCounters.getCounter(MapperCounter.DIRS_SKIPPED), equalTo( 2L));
assertThat(jobCounters.getCounter(MapperCounter.FILES_FOUND), equalTo(24L));