maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-wagon/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh ScpWagonTest.java
Date Tue, 07 Dec 2004 12:27:52 GMT
brett       2004/12/07 04:27:52

  Modified:    wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file
                        FileWagon.java
               wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http
                        HttpWagon.java PutInputStream.java
               wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh
                        ScpWagon.java
               wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh
                        ScpWagonTest.java
  Log:
  provider changes to match API
  
  Revision  Changes    Path
  1.2       +3 -3      maven-wagon/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
  
  Index: FileWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileWagon.java	10 Aug 2004 18:12:43 -0000	1.1
  +++ FileWagon.java	7 Dec 2004 12:27:52 -0000	1.2
  @@ -47,7 +47,7 @@
   
           if ( !f.exists() )
           {
  -            throw new ResourceDoesNotExistException( "File: "  + f + " does not exists"
);
  +            throw new ResourceDoesNotExistException( "File: "  + f + " does not exist"
);
           }
   
           try
  @@ -92,4 +92,4 @@
       public void closeConnection()
       {
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.2       +2 -25     maven-wagon/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
  
  Index: HttpWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpWagon.java	10 Aug 2004 17:49:16 -0000	1.1
  +++ HttpWagon.java	7 Dec 2004 12:27:52 -0000	1.2
  @@ -120,7 +120,6 @@
   
           try
           {
  -
               InputStream is = new PutInputStream( source, resource, this, getTransferEventSupport()
 );
   
               putMethod.setRequestBody( is );
  @@ -261,33 +260,13 @@
                                                      + statusCode );
           }
   
  -        OutputStream os = null;
  -
           InputStream is = null;
   
  -        File dir = destination.getParentFile();
  -
  -        if ( dir != null   && !dir.exists() )
  -        {
  -
  -            if ( ! dir.mkdirs() )
  -            {
  -                String msg = "Some of the required local directories do not exist and could
not be created. " +
  -                		"Requested local path:  "  + destination.getAbsolutePath();
  -
  -                throw new TransferFailedException( msg );
  -            }
  -
  -        }
  -
  -
           try
           {
  -            os = new LazyFileOutputStream( destination );
  -
               is = getMethod.getResponseBodyAsStream();
   
  -            getTransfer( resource, destination, is, os);
  +            getTransfer( resource, destination, is );
           }
           catch ( Exception e )
           {
  @@ -311,8 +290,6 @@
           finally
           {
               shutdownStream( is );
  -
  -            shutdownStream( os );
           }
   
           getMethod.releaseConnection();
  
  
  
  1.2       +2 -4      maven-wagon/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java
  
  Index: PutInputStream.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/PutInputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PutInputStream.java	10 Aug 2004 17:49:16 -0000	1.1
  +++ PutInputStream.java	7 Dec 2004 12:27:52 -0000	1.2
  @@ -74,9 +74,7 @@
   
           event.setTimestamp( System.currentTimeMillis() );
   
  -        event.setData( b, retValue );
  -
  -        eventSupport.fireTransferProgress( event );
  +        eventSupport.fireTransferProgress( event, b, retValue );
   
           return retValue;
       }
  
  
  
  1.4       +17 -31    maven-wagon/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
  
  Index: ScpWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ScpWagon.java	6 Dec 2004 10:55:58 -0000	1.3
  +++ ScpWagon.java	7 Dec 2004 12:27:52 -0000	1.4
  @@ -72,7 +72,7 @@
       {
           try
           {
  -            AuthenticationInfo authInfo = getRepository().getAuthenticationInfo();
  +            final AuthenticationInfo authInfo = getRepository().getAuthenticationInfo();
   
               if ( authInfo == null )
               {
  @@ -271,7 +271,7 @@
   
               if ( checkAck( in ) != 0 )
               {
  -                throw  new TransferFailedException( "ACK check failed" );
  +                throw new TransferFailedException( "ACK check failed" );
               }
   
               // send "C0644 filesize filename", where filename should not include '/'
  @@ -287,18 +287,10 @@
   
               if ( checkAck( in ) != 0 )
               {
  -                String msg = "Error occured while deploying '"
  -                        + resource + "' to remote repository '"
  -                        + getRepository().getUrl()
  -                        + "' - Wrong ACK ";
  -
  -                throw new TransferFailedException( msg );
  +                throw new TransferFailedException( "ACK check failed" );
               }
   
  -            // send a content of lfile
  -            FileInputStream fis = new FileInputStream( source );
  -
  -            putTransfer( resource, source, fis, out, false );
  +            putTransfer( resource, source, out, false );
   
               byte[] buf = new byte[ 1024 ];
   
  @@ -311,12 +303,7 @@
   
               if ( checkAck( in ) != 0 )
               {
  -                String msg = "Error occured while deploying '"
  -                        + resource + "' to remote repository '"
  -                        + getRepository().getUrl()
  -                        + "' - Wrong ACK ";
  -
  -                throw new TransferFailedException( msg );
  +                throw new TransferFailedException( "ACK check failed" );
               }
           }
           catch ( Exception e )
  @@ -356,6 +343,8 @@
   
           InputStream in = null;
   
  +        createParentDirectories( destination );
  +
           LazyFileOutputStream outputStream = new LazyFileOutputStream( destination );
   
           String basedir = getRepository().getBasedir();
  @@ -388,6 +377,7 @@
   
               while ( true )
               {
  +                // TODO: is this really an ACK, or just an in.read()? If the latter, change
checkAck method to not return a value, but throw an exception on non-zero result
                   int c = checkAck( in );
   
                   if ( c != 'C' )
  @@ -443,9 +433,7 @@
   
                           outputStream.write( buf, 0, len );
   
  -                        transferEvent.setData( buf, len );
  -
  -                        fireTransferProgress( transferEvent );
  +                        fireTransferProgress( transferEvent, buf, len );
   
                           filesize -= len;
   
  @@ -481,13 +469,7 @@
   
                   if ( checkAck( in ) != 0 )
                   {
  -                    String msg = "Error occured while deploying '"
  -                            + resource + "' to remote repository '"
  -                            + getRepository().getUrl()
  -                            + "' - Wrong ACK ";
  -
  -                    throw new TransferFailedException( msg );
  -
  +                    throw new TransferFailedException( "Wrong ACK" );
                   }
                   else
                   {
  @@ -538,7 +520,8 @@
   // ----------------------------------------------------------------------
   // JSch user info
   // ----------------------------------------------------------------------
  -    public class WagonUserInfo
  +// TODO: are the prompt values really right? Is there an alternative to UserInfo?
  +    public static class WagonUserInfo
               implements UserInfo
       {
           AuthenticationInfo authInfo;
  @@ -575,7 +558,8 @@
   
           public void showMessage( String message )
           {
  -            System.out.println( message );
  +            // TODO: is this really debug?
  +            //fireTransferDebug( message );
           }
       }
   
  @@ -608,11 +592,13 @@
   
               if ( b == 1 )
               {
  +                // TODO: log (throw exception?)
                   // error
                   System.out.print( sb.toString() );
               }
               if ( b == 2 )
               {
  +                // TODO: throw exception
                   // fatal error
                   System.out.print( sb.toString() );
               }
  
  
  
  1.4       +3 -1      maven-wagon/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java
  
  Index: ScpWagonTest.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ScpWagonTest.java	26 Oct 2004 18:52:30 -0000	1.3
  +++ ScpWagonTest.java	7 Dec 2004 12:27:52 -0000	1.4
  @@ -62,6 +62,8 @@
               authInfo.setPassphrase( "" );
           }
   
  +        // TODO: set file mode, directory file mode
  +
           authInfo.setGroup( userName );
   
           return authInfo;
  
  
  

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


Mime
View raw message