Coverage Report - org.apache.maven.wagon.providers.ssh.AbstractEmbeddedScpWagonTest
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractEmbeddedScpWagonTest
0 %
0/19
0 %
0/2
1,125
 
 1  
 package org.apache.maven.wagon.providers.ssh;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.wagon.StreamingWagonTestCase;
 23  
 import org.apache.maven.wagon.authentication.AuthenticationInfo;
 24  
 import org.apache.maven.wagon.repository.Repository;
 25  
 import org.apache.maven.wagon.resource.Resource;
 26  
 
 27  
 import java.io.File;
 28  
 import java.util.Arrays;
 29  
 
 30  
 /**
 31  
  * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
 32  
  * @version $Id: AbstractEmbeddedScpWagonTest.java 1174085 2011-09-22 12:12:35Z olamy $
 33  
  */
 34  0
 public abstract class AbstractEmbeddedScpWagonTest
 35  
     extends StreamingWagonTestCase
 36  
 {
 37  
 
 38  
     SshServerEmbedded sshServerEmbedded;
 39  
 
 40  
     @Override
 41  
     protected void setUp()
 42  
         throws Exception
 43  
     {
 44  0
         super.setUp();
 45  
 
 46  0
         String sshKeyResource = "ssh-keys/id_rsa";
 47  
 
 48  0
         sshServerEmbedded = new SshServerEmbedded( getProtocol(), Arrays.asList( sshKeyResource ), false );
 49  
 
 50  0
         sshServerEmbedded.start();
 51  0
         System.out.println( "sshd on port " + sshServerEmbedded.getPort() );
 52  0
     }
 53  
 
 54  
     @Override
 55  
     protected void tearDownWagonTestingFixtures()
 56  
         throws Exception
 57  
     {
 58  
 
 59  0
         for ( TestPasswordAuthenticator.PasswordAuthenticatorRequest passwordAuthenticatorRequest : sshServerEmbedded.passwordAuthenticator.passwordAuthenticatorRequests )
 60  
         {
 61  0
             assertEquals( TestData.getUserName(), passwordAuthenticatorRequest.username );
 62  0
             assertEquals( TestData.getUserPassword(), passwordAuthenticatorRequest.password );
 63  
         }
 64  0
         sshServerEmbedded.stop();
 65  0
     }
 66  
 
 67  
     protected abstract String getProtocol();
 68  
 
 69  
     @Override
 70  
     protected int getTestRepositoryPort()
 71  
     {
 72  0
         return sshServerEmbedded.getPort();
 73  
     }
 74  
 
 75  
 
 76  
     public String getTestRepositoryUrl()
 77  
     {
 78  0
         return TestData.getTestRepositoryUrl( sshServerEmbedded.getPort() );
 79  
     }
 80  
 
 81  
     protected AuthenticationInfo getAuthInfo()
 82  
     {
 83  0
         AuthenticationInfo authInfo = super.getAuthInfo();
 84  
 
 85  0
         authInfo.setUserName( TestData.getUserName() );
 86  0
         authInfo.setPassword( TestData.getUserPassword() );
 87  
 
 88  0
         return authInfo;
 89  
     }
 90  
 
 91  
     protected long getExpectedLastModifiedOnGet( Repository repository, Resource resource )
 92  
     {
 93  0
         return new File( repository.getBasedir(), resource.getName() ).lastModified();
 94  
     }
 95  
 
 96  
 
 97  
     @Override
 98  
     protected abstract boolean supportsGetIfNewer();
 99  
 
 100  
 }