maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r745719 - in /maven/wagon/trunk/wagon-providers/wagon-ssh-external/src: main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java
Date Thu, 19 Feb 2009 04:22:26 GMT
Author: brett
Date: Thu Feb 19 04:22:25 2009
New Revision: 745719

URL: http://svn.apache.org/viewvc?rev=745719&view=rev
Log:
[WAGON-243] wagon-ssh-external does not always detect usage of PSCP

Modified:
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java?rev=745719&r1=745718&r2=745719&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
Thu Feb 19 04:22:25 2009
@@ -151,7 +151,7 @@
     public Streams executeCommand( String command, boolean ignoreFailures )
         throws CommandExecutionException
     {
-        boolean putty = sshExecutable.indexOf( "plink" ) >= 0;
+        boolean putty = isPuTTY();
 
         File privateKey;
         try
@@ -216,6 +216,11 @@
         }
     }
 
+    protected boolean isPuTTY()
+    {
+        return sshExecutable.toLowerCase().indexOf( "plink" ) >= 0;
+    }
+
     private Commandline createBaseCommandLine( boolean putty, String executable, File privateKey
)
     {
         Commandline cl = new Commandline();
@@ -252,7 +257,7 @@
     private void executeScpCommand( Resource resource, File localFile, boolean put )
         throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
     {
-        boolean putty = scpExecutable.indexOf( "pscp" ) >= 0;
+        boolean putty = isPuTTYSCP();
 
         File privateKey;
         try
@@ -329,6 +334,11 @@
         }
     }
 
+    boolean isPuTTYSCP()
+    {
+        return scpExecutable.toLowerCase().indexOf( "pscp" ) >= 0;
+    }
+
     private String normalizeResource( Resource resource )
     {
         return StringUtils.replace( resource.getName(), "\\", "/" );

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java?rev=745719&r1=745718&r2=745719&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh-external/src/test/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagonTest.java
Thu Feb 19 04:22:25 2009
@@ -79,5 +79,31 @@
 
         return authInfo;
     }
+    
+    public void testIsPuTTY() throws Exception
+    {
+        ScpExternalWagon wagon = (ScpExternalWagon) getWagon();
 
+        wagon.setSshExecutable( "c:\\program files\\PuTTY\\plink.exe" );
+        assertTrue( wagon.isPuTTY() );
+        wagon.setSshExecutable( "plink" );
+        assertTrue( wagon.isPuTTY() );
+        wagon.setSshExecutable( "PLINK" );
+        assertTrue( wagon.isPuTTY() );
+        wagon.setSshExecutable( "PlInK" );
+        assertTrue( wagon.isPuTTY() );
+        wagon.setSshExecutable( "ssh" );
+        assertFalse( wagon.isPuTTY() );
+
+        wagon.setScpExecutable( "c:\\program files\\PuTTY\\pscp.exe" );
+        assertTrue( wagon.isPuTTYSCP() );
+        wagon.setScpExecutable( "pscp" );
+        assertTrue( wagon.isPuTTYSCP() );
+        wagon.setScpExecutable( "PSCP" );
+        assertTrue( wagon.isPuTTYSCP() );
+        wagon.setScpExecutable( "PsCp" );
+        assertTrue( wagon.isPuTTYSCP() );
+        wagon.setScpExecutable( "scp" );
+        assertFalse( wagon.isPuTTYSCP() );
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-commits-help@maven.apache.org


Mime
View raw message