Package org.apache.sshd.client

Examples of org.apache.sshd.client.ScpClient.download()


        }
        new File(root, "remote").mkdirs();
        scp.upload("target/scp/local/out.txt", "target/scp/remote/out.txt");
        assertFileLength(new File("target/scp/remote/out.txt"), data.length(), 5000);

        scp.download("target/scp/remote/out.txt", "target/scp/local/out2.txt");
        assertFileLength(new File("target/scp/local/out2.txt"), data.length(), 5000);

        session.close(false).await();
        client.stop();
    }
View Full Code Here


        scp.upload(new String[] { "target/scp/local/out1.txt", "target/scp/local/out2.txt" }, "target/scp/remote/dir");
        assertFileLength(new File("target/scp/remote/dir/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/remote/dir/out2.txt"), data.length(), 5000);

        try {
            scp.download(new String[] { "target/scp/remote/dir/out1.txt", "target/scp/remote/dir/out2.txt" }, "target/scp/local/out1.txt");
            fail("Expected IOException");
        } catch (IOException e) {
            // Ok
        }
        try {
View Full Code Here

            fail("Expected IOException");
        } catch (IOException e) {
            // Ok
        }
        try {
            scp.download(new String[] { "target/scp/remote/dir/out1.txt", "target/scp/remote/dir/out2.txt" }, "target/scp/local/dir");
            fail("Expected IOException");
        } catch (IOException e) {
            // Ok
        }
        new File(root, "local/dir").mkdirs();
View Full Code Here

            fail("Expected IOException");
        } catch (IOException e) {
            // Ok
        }
        new File(root, "local/dir").mkdirs();
        scp.download(new String[] { "target/scp/remote/dir/out1.txt", "target/scp/remote/dir/out2.txt" }, "target/scp/local/dir");
        assertFileLength(new File("target/scp/local/dir/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/local/dir/out2.txt"), data.length(), 5000);

        session.close(false).await();
        client.stop();
View Full Code Here

        scp.upload("target/scp/local/dir", "target/scp/remote/", ScpClient.Option.Recursive);
        assertFileLength(new File("target/scp/remote/dir/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/remote/dir/out2.txt"), data.length(), 5000);

        Utils.deleteRecursive(new File("target/scp/local/dir"));
        scp.download("target/scp/remote/dir", "target/scp/local", ScpClient.Option.Recursive);
        assertFileLength(new File("target/scp/local/dir/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/local/dir/out2.txt"), data.length(), 5000);

        session.close(false).await();
        client.stop();
View Full Code Here

        assertFileLength(new File("target/scp/remote/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/remote/out2.txt"), data.length(), 5000);

        new File("target/scp/local/out1.txt").delete();
        new File("target/scp/local/out2.txt").delete();
        scp.download("target/scp/remote/*", "target/scp/local");
        assertFileLength(new File("target/scp/local/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/local/out2.txt"), data.length(), 5000);

        session.close(false).await();
        client.stop();
View Full Code Here

        assertFileLength(new File("target/scp/remote/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/remote/dir/out2.txt"), data.length(), 5000);

        Utils.deleteRecursive(new File("target/scp/local/out1.txt"));
        Utils.deleteRecursive(new File("target/scp/local/dir"));
        scp.download("target/scp/remote/*", "target/scp/local");
        assertFileLength(new File("target/scp/local/out1.txt"), data.length(), 5000);
        assertFalse(new File("target/scp/local/dir/out2.txt").exists());

        Utils.deleteRecursive(new File("target/scp/local/out1.txt"));
        scp.download("target/scp/remote/*", "target/scp/local", ScpClient.Option.Recursive);
View Full Code Here

        scp.download("target/scp/remote/*", "target/scp/local");
        assertFileLength(new File("target/scp/local/out1.txt"), data.length(), 5000);
        assertFalse(new File("target/scp/local/dir/out2.txt").exists());

        Utils.deleteRecursive(new File("target/scp/local/out1.txt"));
        scp.download("target/scp/remote/*", "target/scp/local", ScpClient.Option.Recursive);
        assertFileLength(new File("target/scp/local/out1.txt"), data.length(), 5000);
        assertFileLength(new File("target/scp/local/dir/out2.txt"), data.length(), 5000);

        session.close(false).await();
        client.stop();
View Full Code Here

        assertFileLength(new File("target/scp/remote/dir/out2.txt"), data.length(), 5000);
        assertEquals(lastMod, new File("target/scp/remote/dir/out2.txt").lastModified());

        Utils.deleteRecursive(new File("target/scp/local"));
        new File("target/scp/local").mkdirs();
        scp.download("target/scp/remote/*", "target/scp/local", ScpClient.Option.Recursive, ScpClient.Option.PreserveAttributes);
        assertFileLength(new File("target/scp/local/out1.txt"), data.length(), 5000);
        assertEquals(lastMod, new File("target/scp/local/out1.txt").lastModified());
        assertFileLength(new File("target/scp/local/dir/out2.txt"), data.length(), 5000);
        assertEquals(lastMod, new File("target/scp/local/dir/out2.txt").lastModified());

View Full Code Here

        }
        new File(root, "remote").mkdirs();
        scp.upload("target/scp/local/out.txt", "target/scp/remote/out.txt");
        assertFileLength(new File("target/scp/remote/out.txt"), data.length(), 5000);

        scp.download("target/scp/remote/out.txt", "target/scp/local/out2.txt");
        assertFileLength(new File("target/scp/local/out2.txt"), data.length(), 5000);

        session.close(false).await();
        client.stop();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.