1 package org.apache.maven.wagon.providers.ssh.jsch;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.wagon.Wagon;
23 import org.apache.maven.wagon.authentication.AuthenticationInfo;
24 import org.apache.maven.wagon.providers.ssh.AbstractEmbeddedScpWagonWithKeyTest;
25 import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostEntry;
26 import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider;
27
28 import java.io.File;
29 import java.io.IOException;
30
31
32
33
34
35 public class EmbeddedScpWagonWithKeyTest
36 extends AbstractEmbeddedScpWagonWithKeyTest
37 {
38
39
40 @Override
41 protected Wagon getWagon()
42 throws Exception
43 {
44 ScpWagon scpWagon = (ScpWagon) super.getWagon();
45 scpWagon.setInteractive( false );
46 scpWagon.setKnownHostsProvider( new KnownHostsProvider()
47 {
48 public void storeKnownHosts( String contents )
49 throws IOException
50 {
51
52 }
53
54 public void addKnownHost( KnownHostEntry knownHost )
55 throws IOException
56 {
57 }
58
59 public void setHostKeyChecking( String hostKeyChecking )
60 {
61 }
62
63 public String getHostKeyChecking()
64 {
65 return "no";
66 }
67
68 public String getContents()
69 {
70 return null;
71 }
72 } );
73 return scpWagon;
74 }
75
76
77 protected String getProtocol()
78 {
79 return "scp";
80 }
81
82
83 protected AuthenticationInfo getAuthInfo()
84 {
85 AuthenticationInfo authInfo = super.getAuthInfo();
86
87 authInfo.setUserName( "guest" );
88
89 authInfo.setPrivateKey( new File( "src/test/ssh-keys/id_rsa" ).getPath() );
90
91 return authInfo;
92 }
93
94
95 }