}
}
@Test
public void testDistributeFiles() throws IOException, KeeperException, InterruptedException, OrbZKFailure {
OrbConfiguration orbConf = new OrbConfiguration(true);
orbConf.setOrbClusterName("TestOrbCluster");
orbConf.setOrbZooKeeperQuorum("localhost:21810");
orbConf.set("fs.default.name", "hdfs://localhost:" + cluster.getNameNodePort());
orbConf.addFileToDistribute("src/test/resources/distributeTest1.txt");
orbConf.addFileToDistribute("src/test/resources/distributeTest2.txt");
orbConf.addFileToDistribute("src/test/resources/HelloWorld.jar");
runJob(orbConf);
FileSystem fs = cluster.getFileSystem();
//Files were copied from local to HDFS
assertTrue(fs.exists(new Path("/DistributeFiles/distributeTest1.txt")));
assertTrue(fs.exists(new Path("/DistributeFiles/distributeTest2.txt")));
assertTrue(fs.exists(new Path("/DistributeFiles/HelloWorld.jar")));
// Check Paths are set in orbConfiguration
Path[] localFiles = orbConf.getHDFSdistributedFiles();
for (Path path : localFiles) {
System.out.println(path.toString());
}
assertEquals(3, localFiles.length);
List<String> jobList = ZK.getChildren("/GoldenOrb/" + orbConf.getOrbClusterName() + "/JobQueue", false);
for (String jobName : jobList) {
OrbConfiguration compareOrbConf = (OrbConfiguration) ZookeeperUtils
.getNodeWritable(ZK, "/GoldenOrb/" + orbConf.getOrbClusterName() + "/JobQueue/" + jobName,
OrbConfiguration.class, orbConf);
assertEquals(compareOrbConf.getHDFSdistributedFiles(), orbConf.getHDFSdistributedFiles());
}
}