SshTasks { public static SshFetchTaskFactory newSshFetchTaskFactory(SshMachineLocation machine, String remoteFile) { return newSshFetchTaskFactory(machine, true, remoteFile); }  static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, String ...commands); static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, final boolean useMachineConfig, String ...commands); static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, List<String> commands); static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, final boolean useMachineConfig, List<String> commands); static SshPutTaskFactory newSshPutTaskFactory(SshMachineLocation machine, String remoteFile); static SshPutTaskFactory newSshPutTaskFactory(SshMachineLocation machine, final boolean useMachineConfig, String remoteFile); static SshFetchTaskFactory newSshFetchTaskFactory(SshMachineLocation machine, String remoteFile); static SshFetchTaskFactory newSshFetchTaskFactory(SshMachineLocation machine, final boolean useMachineConfig, String remoteFile); static ProcessTaskFactory<Boolean> dontRequireTtyForSudo(SshMachineLocation machine, final boolean failIfCantSudo); static ProcessTaskFactory<Boolean> dontRequireTtyForSudo(SshMachineLocation machine, OnFailingTask onFailingTaskRequested); static Function<ProcessTaskWrapper<?>, String> returningStdoutLoggingInfo(final Logger logger, final boolean requireZero); static TaskFactory<?> installFromUrl(final SshMachineLocation location, final String url, final String destPath); static TaskFactory<?> installFromUrl(final Map<String, ?> props, final SshMachineLocation location, final String url, final String destPath); static TaskFactory<?> installFromUrl(final ResourceUtils utils, final Map<String, ?> props, final SshMachineLocation location, final String url, final String destPath);  }
@Test(groups="Integration") public void testSshFetch() throws IOException { String fn = Urls.mergePaths(tempDir.getPath(), "f2"); FileUtils.write(new File(fn), "hello fetched world"); SshFetchTaskFactory tf = SshTasks.newSshFetchTaskFactory(host, fn); SshFetchTaskWrapper t = tf.newTask(); mgmt.getExecutionManager().submit(t); t.block(); Assert.assertTrue(t.isDone()); Assert.assertEquals(t.get(), "hello fetched world"); Assert.assertEquals(t.getBytes(), "hello fetched world".getBytes()); }