You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2012/05/19 20:54:34 UTC
svn commit: r1340540 - in
/mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd: ScpTest.java
SftpTest.java
Author: gnodet
Date: Sat May 19 18:54:34 2012
New Revision: 1340540
URL: http://svn.apache.org/viewvc?rev=1340540&view=rev
Log:
[SSHD-158] Test failures on Windows
Modified:
mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/ScpTest.java
mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java
Modified: mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/ScpTest.java
URL: http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/ScpTest.java?rev=1340540&r1=1340539&r2=1340540&view=diff
==============================================================================
--- mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/ScpTest.java (original)
+++ mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/ScpTest.java Sat May 19 18:54:34 2012
@@ -128,28 +128,31 @@ public class ScpTest {
String data = "0123456789\n";
- File root = new File("target/scp");
- File target = new File("target/scp/out.txt");
+ String unixDir = "target/scp";
+ String fileName = "out.txt";
+ String unixPath = unixDir + File.separator + fileName;
+ File root = new File(unixDir);
+ File target = new File(unixPath);
root.mkdirs();
assertTrue(root.exists());
target.delete();
assertFalse(target.exists());
- sendFile("target/scp/out.txt", "out.txt", data);
+ sendFile(unixPath, "out.txt", data);
assertFileLength(target, data.length(), 5000);
target.delete();
assertFalse(target.exists());
- sendFile("target/scp", "out.txt", data);
+ sendFile(unixDir, "out.txt", data);
assertFileLength(target, data.length(), 5000);
sendFileError("target", "scp", "0123456789\n");
- readFileError("target/scp");
+ readFileError(unixDir);
- assertEquals(data, readFile("target/scp/out.txt"));
+ assertEquals(data, readFile(unixPath));
- assertEquals(data, readDir("target/scp"));
+ assertEquals(data, readDir(unixDir));
target.delete();
root.delete();
@@ -167,8 +170,13 @@ public class ScpTest {
final SCPClient scp_client = new SCPClient(conn);
final Properties props = new Properties();
props.setProperty("test", "test-passed");
+ File f = new File("target/scp/gan");
scp_client.put(toBytes(props, ""), "test.properties", "target/scp/gan");
+ assertTrue(f.exists());
scp_client.put(toBytes(props, ""), "test2.properties", "target/scp/gan");
+ assertTrue(f.exists());
+ f.delete();
+ conn.close();
}
private byte[] toBytes(final Properties properties, final String comments) {
Modified: mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java
URL: http://svn.apache.org/viewvc/mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java?rev=1340540&r1=1340539&r2=1340540&view=diff
==============================================================================
--- mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java (original)
+++ mina/sshd/trunk/sshd-core/src/test/java/org/apache/sshd/SftpTest.java Sat May 19 18:54:34 2012
@@ -147,24 +147,25 @@ public class SftpTest {
@Test
public void testReadWriteWithOffset() throws Exception {
File root = new File("target/scp");
- File target = new File("target/scp/out.txt");
+ String unixPath = "target/scp/out.txt";
+ File target = new File(unixPath);
root.mkdirs();
assertTrue(root.exists());
ChannelSftp c = (ChannelSftp) session.openChannel("sftp");
c.connect();
- c.put(new ByteArrayInputStream("0123456789".getBytes()), target.getPath());
+ c.put(new ByteArrayInputStream("0123456789".getBytes()), unixPath);
assertTrue(target.exists());
- assertEquals("0123456789", readFile("target/scp/out.txt"));
+ assertEquals("0123456789", readFile(unixPath));
- OutputStream os = c.put(target.getPath(), null, ChannelSftp.APPEND, -5);
+ OutputStream os = c.put(unixPath, null, ChannelSftp.APPEND, -5);
os.write("a".getBytes());
os.close();
c.disconnect();
assertTrue(target.exists());
- assertEquals("01234a", readFile("target/scp/out.txt"));
+ assertEquals("01234a", readFile(unixPath));
target.delete();
assertFalse(target.exists());