I think there are ways to start HDFS from Java: http://grepalex.com/2012/10/20/hadoop-unit-testing-with-minimrcluster/ (not sure if this helps: http://stackoverflow.com/questions/19816565/unit-testing-hadoop-hdfs-writings-with-minidfscluster)