ShmackUtils { public static String determineScriptDir() { if (scriptDir == null){ try { String workingDir = runOnLocalhost("/bin/pwd").getStandardOutput(); int idx = workingDir.indexOf("/04_implementation"); if (idx > 0) { scriptDir = workingDir.substring(0, idx) + "/04_implementation/scripts/"; } else { scriptDir = ""; } } catch (IOException e) { e.printStackTrace(); scriptDir = ""; } } return scriptDir; }  static String determineScriptDir(); static void syncFolderToMasterAndSlave(File localSrcDir, File targetDirectory); static void syncFolderToMasterAndSlave(File localSrcDir, File targetDirectory, int slaveIndex); static void syncFolderFromSlave(File remoteSrcDir, File localTargetDir); static void syncFolderFromSlave(File remoteSrcDir, File localTargetDir, int slaveIndex); static void syncFolderToMaster(File localSrcDir, File targetDirectory); static void syncFolderFromMaster(File remoteSrcDir, File localTargetDir); static ExecuteResult syncFolderToHdfs(File localSrcDir, File hdfsTargetDirectory); static ExecuteResult syncFolderFromHdfs(File hdfsSrcDirectory, File localTargetDir); static String deleteInHdfs(File hdfsFileOrFolderToDelete); static String getHdfsURL(File hdfsTargetDirectory); static ExecuteResult runOnMaster(String executable, String... arguments); static ExecuteResult runOnMaster(ExecExceptionHandling exceptionHandling, String executable,
			String... arguments); static ExecuteResult runOnLocalhost(String executable, String... arguments); static ExecuteResult runOnLocalhost(ExecExceptionHandling exceptionHandling, String executable,
			String... arguments); static ExecuteResult runOnLocalhost(ExecExceptionHandling exceptionHandling, CommandLine cmdLineOnLocalhost); static void copyToHdfs(File localSrcFile, File hdfsTargetFile); static void copyFromHdfs(File hdfsSrcFile, File localTargetFile); static void writeStringToHdfs(File targetFile, String fileContent); static String readStringFromHdfs(File srcFile); static byte[] readByteArrayFromHdfs(File srcFile);  }
@Test public void canFindScripts() { File fileInScriptDir = new File(ShmackUtils.determineScriptDir() + "shmack_env"); assertTrue("File " + fileInScriptDir + "must exist", fileInScriptDir.exists()); }