[ 
https://issues.apache.org/jira/browse/SSHD-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guillaume Nodet resolved SSHD-158.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.7.0
         Assignee: Guillaume Nodet

Thx for the patch.  Let me know if you still have issue.
                
> Latest HEAD does not build on Windows
> -------------------------------------
>
>                 Key: SSHD-158
>                 URL: https://issues.apache.org/jira/browse/SSHD-158
>             Project: MINA SSHD
>          Issue Type: Improvement
>    Affects Versions: 0.7.0
>            Reporter: Georg Weber
>            Assignee: Guillaume Nodet
>            Priority: Trivial
>             Fix For: 0.7.0
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> The tests do not pass on the latest version when run on Windows. The problem 
> is, that the operating system paths are used for scp and sftp. The 
> backslashes (on Windows) do not work with scp and sftp. Fix: Use slashes 
> instead of forward slashes. Attached You can find a patch.
> Index: src/test/java/org/apache/sshd/SftpTest.java
> ===================================================================
> --- src/test/java/org/apache/sshd/SftpTest.java       (revision 1238412)
> +++ src/test/java/org/apache/sshd/SftpTest.java       (working copy)
> @@ -147,24 +147,25 @@
>      @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"));
>  
> -        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());
> Index: src/test/java/org/apache/sshd/ScpTest.java
> ===================================================================
> --- src/test/java/org/apache/sshd/ScpTest.java        (revision 1238412)
> +++ src/test/java/org/apache/sshd/ScpTest.java        (working copy)
> @@ -128,28 +128,31 @@
>  
>          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 + "/" + 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, fileName, data);
>          assertFileLength(target, data.length(), 5000);
>  
>          target.delete();
>          assertFalse(target.exists());
> -        sendFile("target/scp", "out.txt", data);
> +        sendFile(unixDir, fileName, 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 @@
>          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) {

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to