1 package org.apache.maven.wagon.providers.ssh;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.codehaus.plexus.util.FileUtils;
23
24 import java.io.File;
25 import java.io.IOException;
26
27
28
29
30
31 public class TestData
32 {
33 public static String getTempDirectory()
34 {
35 return System.getProperty( "java.io.tmpdir", "/tmp" );
36 }
37
38 public static String getTestRepositoryUrl()
39 {
40 return "scp://" + getHostname() + getTempDirectory() + "/wagon-ssh-test/" + getUserName();
41 }
42
43 public static String getUserName()
44 {
45 return System.getProperty( "test.user", System.getProperty( "user.name" ) );
46 }
47
48 public static File getPrivateKey()
49 {
50 return new File( System.getProperty( "user.home" ), "/.ssh/id_dsa" );
51 }
52
53 public static String getHostname()
54 {
55 return System.getProperty( "test.host", "localhost" );
56 }
57
58 public static String getHostKey()
59 {
60 try
61 {
62 return FileUtils.fileRead( "/etc/ssh_host_rsa_key.pub" ).substring( "ssh-rsa".length() ).trim();
63 }
64 catch ( IOException e )
65 {
66 return null;
67 }
68 }
69 }