LocalhostFileService implements GridFileService { @Override public void put(File localFile, String remoteFile) throws IOException { Path remote = getLocalhostFilePath(remoteFile); Path localFileAbsolutePath = Paths.get(localFile.getAbsolutePath()); logger.debug("put called: " + localFileAbsolutePath + " to localhost as " + remote); if (!Files.exists(remote.getParent())) Files.createDirectories(remote.getParent(), getFolderFilePerms()); Files.copy(localFileAbsolutePath, remote, StandardCopyOption.REPLACE_EXISTING); logger.debug(localFileAbsolutePath + " copied to " + remote); } LocalhostFileService(GridTransportConnection transportConnection); void setUserDirIsRoot(boolean isRoot); @Override void put(File localFile, String remoteFile); @Override void get(String remoteFile, File localFile); @Override boolean exists(String remoteFile); @Override void touch(String remoteFile); @Override void mkdir(String remoteDir); @Override void delete(String remoteFile); @Override void move(String origin, String destination); @Override void copy(String origin, String destination); @Override URI remoteFileRepresentationToLocalURI(String file); Path getLocalhostFilePath(String path);  }
@Test(groups = "unit-tests") public void testPut() throws IOException{ Path localPath = testPath.resolve("bar.txt"); Path remotePath = testPath.resolve("baz.txt"); localPath = Files.createFile(localPath); File localFile = localPath.toFile(); lfs.put(localFile, testFolder + "/baz.txt"); Assert.assertTrue(Files.exists(remotePath)); Files.delete(localPath); Files.delete(remotePath); }