HDFS-2856: another refactor to prepare for more tests.