001package org.apache.maven.wagon.providers.ssh.jsch; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.maven.wagon.Wagon; 023import org.apache.maven.wagon.authentication.AuthenticationInfo; 024import org.apache.maven.wagon.providers.ssh.AbstractEmbeddedScpWagonWithKeyTest; 025import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostEntry; 026import org.apache.maven.wagon.providers.ssh.knownhost.KnownHostsProvider; 027 028import java.io.File; 029import java.io.IOException; 030 031/** 032 * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> 033 * 034 */ 035public class EmbeddedScpWagonWithKeyTest 036 extends AbstractEmbeddedScpWagonWithKeyTest 037{ 038 039 040 @Override 041 protected Wagon getWagon() 042 throws Exception 043 { 044 ScpWagon scpWagon = (ScpWagon) super.getWagon(); 045 scpWagon.setInteractive( false ); 046 scpWagon.setKnownHostsProvider( new KnownHostsProvider() 047 { 048 public void storeKnownHosts( String contents ) 049 throws IOException 050 { 051 052 } 053 054 public void addKnownHost( KnownHostEntry knownHost ) 055 throws IOException 056 { 057 } 058 059 public void setHostKeyChecking( String hostKeyChecking ) 060 { 061 } 062 063 public String getHostKeyChecking() 064 { 065 return "no"; 066 } 067 068 public String getContents() 069 { 070 return null; 071 } 072 } ); 073 return scpWagon; 074 } 075 076 077 protected String getProtocol() 078 { 079 return "scp"; 080 } 081 082 083 protected AuthenticationInfo getAuthInfo() 084 { 085 AuthenticationInfo authInfo = super.getAuthInfo(); 086 // user : guest/guest123 - passphrase : toto01 087 authInfo.setUserName( "guest" ); 088 //authInfo.setPassword( TestData.getUserPassword() ); 089 authInfo.setPrivateKey( new File( "src/test/ssh-keys/id_rsa" ).getPath() ); 090 091 return authInfo; 092 } 093 094 095}