You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by mi...@apache.org on 2004/12/13 22:57:07 UTC

cvs commit: maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon MockWagon.java

michal      2004/12/13 13:57:07

  Modified:    wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication
                        AuthenticationInfo.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon/events
                        TransferEvent.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon/observers
                        ChecksumObserver.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon/repository
                        Repository.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon
                        AbstractWagon.java StreamWagon.java
               wagon-provider-api/src/test/java/org/apache/maven/wagon/events
                        MockSessionListener.java TransferEventTest.java
               wagon-provider-api/src/test/java/org/apache/maven/wagon
                        MockWagon.java
  Added:       wagon-provider-api/src/main/java/org/apache/maven/wagon/resource
                        Resource.java
               wagon-provider-api/src/main/java/org/apache/maven/wagon
                        InputData.java OutputData.java
  Log:
  refactring which adds to wagon a minimal ammount of metadata which is needed to make it useful for m1. API changes are small and should not in any way affect m2.
  
  Revision  Changes    Path
  1.4       +24 -2     maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationInfo.java
  
  Index: AuthenticationInfo.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/authentication/AuthenticationInfo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AuthenticationInfo.java	3 Jul 2004 15:15:30 -0000	1.3
  +++ AuthenticationInfo.java	13 Dec 2004 21:57:07 -0000	1.4
  @@ -25,6 +25,8 @@
    *
    * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
    * @version $Id$
  + *
  + * @todo michal: I added fileMode,directoryMode as it was uses in test classes. I am not sure why we need them.
    */
   public class AuthenticationInfo implements Serializable
   {
  @@ -44,7 +46,11 @@
       /** The absolute path to private key file */
       private String privateKey;
   
  -    
  +    private String directoryMode;
  +
  +    private String fileMode;
  +
  +
       /**
        * Get the passphrase of the private key file. The passphrase is used only
        * when host/protocol supports authentication via exchange of
  @@ -149,4 +155,20 @@
           this.userName = userName;
       }
   
  +
  +    public String getDirectoryMode() {
  +        return directoryMode;
  +    }
  +
  +    public void setDirectoryMode(String directoryMode) {
  +        this.directoryMode = directoryMode;
  +    }
  +
  +    public String getFileMode() {
  +        return fileMode;
  +    }
  +
  +    public void setFileMode(String fileMode) {
  +        this.fileMode = fileMode;
  +    }
   }
  
  
  
  1.8       +7 -6      maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java
  
  Index: TransferEvent.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/events/TransferEvent.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TransferEvent.java	7 Dec 2004 11:41:35 -0000	1.7
  +++ TransferEvent.java	13 Dec 2004 21:57:07 -0000	1.8
  @@ -18,6 +18,7 @@
    */
   
   import org.apache.maven.wagon.Wagon;
  +import org.apache.maven.wagon.resource.Resource;
   
   import java.io.File;
   
  @@ -49,7 +50,7 @@
       /** Indicates PUT transfer (to the repository)*/
       public final static int REQUEST_PUT = 6;
   
  -    private String resource;
  +    private Resource resource;
   
       private int eventType;
       
  @@ -62,7 +63,7 @@
   
       public TransferEvent(
               final Wagon wagon,
  -            final String resource,
  +            final Resource resource,
               final int eventType,
               final int requestType )
       {
  @@ -78,7 +79,7 @@
   
       public TransferEvent(
               final Wagon wagon,
  -            final String resource,
  +            final Resource resource,
               final Exception exception )
       {
           super( wagon );
  @@ -96,7 +97,7 @@
       /**
        * @return Returns the resource.
        */
  -    public String getResource()
  +    public Resource getResource()
       {
           return resource;
       }
  @@ -189,7 +190,7 @@
       /**
        * @param resource The resource to set.
        */
  -    public void setResource( final String resource )
  +    public void setResource( final Resource resource )
       {
           this.resource = resource;
       }
  
  
  
  1.6       +2 -2      maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java
  
  Index: ChecksumObserver.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChecksumObserver.java	7 Dec 2004 11:41:35 -0000	1.5
  +++ ChecksumObserver.java	13 Dec 2004 21:57:07 -0000	1.6
  @@ -141,7 +141,7 @@
           {
               int type = transferEvent.getRequestType();
                                       
  -            String resource = transferEvent.getResource();
  +            String resource = transferEvent.getResource().getName();
               
               String extension = ( String ) algorithmExtensionMap.get( algorithm );
               
  
  
  
  1.7       +1 -3      maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java
  
  Index: Repository.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/repository/Repository.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Repository.java	10 Aug 2004 20:35:51 -0000	1.6
  +++ Repository.java	13 Dec 2004 21:57:07 -0000	1.7
  @@ -47,8 +47,6 @@
   
       private String protocol;
   
  -    private String layout;
  -
       private String url;
   
       private ProxyInfo proxyInfo;
  
  
  
  1.1                  maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/resource/Resource.java
  
  Index: Resource.java
  ===================================================================
  package org.apache.maven.wagon.resource;
  
  import org.apache.maven.wagon.WagonConstants;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  
  /**
   * Describes resources which can be downloaded from the repository
   * or uploaded to repository.
   * <p/>
   * This class contains minimal set of informations, which
   * are needed to reuse wagon in maven 1.
   *
   * @author <a href="michal@codehaus.org">Michal Maczka</a>
   * @version $Id: Resource.java,v 1.1 2004/12/13 21:57:07 michal Exp $
   */
  
  public class Resource
   {
      private String name;
  
      private long lastModified;
  
      private int contentLength = WagonConstants.UNKNOWN_LENGTH;
  
      public String getName()
      {
          return name;
      }
  
      public void setName( String name )
      {
          this.name = name;
      }
  
      /**
       *  Returns the value of the last-modified header field.
       *  The result is the number of milliseconds since January 1, 1970 GMT.
       * 
       *  @return the date the resource  was last modified, or WagonConstants.UNKNOWN_LENGTH
       * if not known.
       */
      public long getLastModified()
      {
          return lastModified;
      }
  
      public void setLastModified( long lastModified )
      {
          this.lastModified = lastModified;
      }
  
      public int getContentLength()
      {
          return contentLength;
      }
  
      public void setContentLength( int contentLength )
      {
          this.contentLength = contentLength;
      }
  }
  
  
  
  1.11      +18 -16    maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
  
  Index: AbstractWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractWagon.java	7 Dec 2004 11:41:35 -0000	1.10
  +++ AbstractWagon.java	13 Dec 2004 21:57:07 -0000	1.11
  @@ -20,6 +20,7 @@
   import org.apache.maven.wagon.authentication.AuthenticationException;
   import org.apache.maven.wagon.events.*;
   import org.apache.maven.wagon.repository.Repository;
  +import org.apache.maven.wagon.resource.Resource;
   
   import java.io.File;
   import java.io.FileInputStream;
  @@ -39,7 +40,7 @@
   {
       private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
   
  -    protected Repository source;
  +    protected Repository repository;
   
       protected SessionEventSupport sessionEventSupport = new SessionEventSupport();
   
  @@ -51,22 +52,22 @@
   
       public Repository getRepository()
       {
  -        return source;
  +        return repository;
       }
   
       // ----------------------------------------------------------------------
       // Connection
       // ----------------------------------------------------------------------
   
  -    public void connect( Repository source ) throws 
  +    public void connect( Repository repository ) throws
         ConnectionException, AuthenticationException
       {
  -        if ( source == null )
  +        if ( repository == null )
           {
               throw new IllegalStateException( "The repository specified cannot be null." );
           }
   
  -        this.source = source;
  +        this.repository = repository;
   
           fireSessionOpening();
   
  @@ -109,7 +110,7 @@
       // Stream i/o
       // ----------------------------------------------------------------------
   
  -    protected void getTransfer( String resource, File destination, InputStream input )
  +    protected void getTransfer( Resource resource, File destination, InputStream input )
           throws TransferFailedException
       {
           fireGetStarted( resource, destination );
  @@ -134,7 +135,7 @@
                   }
               }
   
  -            String msg = "GET request of: " + resource + " from " + source.getName() + "failed";
  +            String msg = "GET request of: " + resource + " from " + repository.getName() + "failed";
   
               throw new TransferFailedException( msg, e );
   
  @@ -150,7 +151,7 @@
           fireGetCompleted( resource, destination );
       }
   
  -    protected void putTransfer(String resource, File source, OutputStream output, boolean closeOutput )
  +    protected void putTransfer( Resource resource, File source, OutputStream output, boolean closeOutput )
           throws TransferFailedException
       {
           firePutStarted( resource, source );
  @@ -165,6 +166,7 @@
           try
           {
               input = new FileInputStream( source );
  +
               transfer( resource, input, output, TransferEvent.REQUEST_PUT );
           }
           catch ( IOException e )
  @@ -187,12 +189,12 @@
           firePutCompleted( resource, source );
       }
   
  -    protected void transfer( String resource, InputStream input, OutputStream output, int requestType )
  +    protected void transfer( Resource resource, InputStream input, OutputStream output, int requestType )
           throws IOException
       {
           byte[] buffer = new byte[ DEFAULT_BUFFER_SIZE ];
   
  -        TransferEvent transferEvent = new TransferEvent( this, resource, TransferEvent.TRANSFER_PROGRESS, requestType );
  +        TransferEvent transferEvent = new TransferEvent( this, resource , TransferEvent.TRANSFER_PROGRESS, requestType );
   
           while ( true )                                               
           {
  @@ -248,7 +250,7 @@
           transferEventSupport.fireTransferProgress( transferEvent, buffer, n );
       }
   
  -    protected void fireGetCompleted( String resource, File localFile )
  +    protected void fireGetCompleted( Resource resource, File localFile )
       {
           long timestamp = System.currentTimeMillis();
   
  @@ -262,7 +264,7 @@
           transferEventSupport.fireTransferCompleted( transferEvent );
       }
   
  -    protected void fireGetStarted( String resource, File localFile )
  +    protected void fireGetStarted( Resource resource, File localFile )
       {
           long timestamp = System.currentTimeMillis();
   
  @@ -276,7 +278,7 @@
           transferEventSupport.fireTransferStarted( transferEvent );
       }
   
  -    protected void firePutCompleted( String resource, File localFile )
  +    protected void firePutCompleted( Resource resource, File localFile )
       {
           long timestamp = System.currentTimeMillis();
   
  @@ -290,7 +292,7 @@
           transferEventSupport.fireTransferCompleted( transferEvent );
       }
   
  -    protected void firePutStarted( String resource, File localFile )
  +    protected void firePutStarted( Resource resource, File localFile )
       {
           long timestamp = System.currentTimeMillis();
   
  @@ -434,7 +436,7 @@
           sessionEventSupport.removeSessionListener( listener );
       }
   
  -    protected void fireTransferError( String resource, Exception e )
  +    protected void fireTransferError( Resource resource, Exception e )
       {
           TransferEvent transferEvent = new TransferEvent( this, resource, e );
   
  
  
  
  1.12      +16 -7     maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/StreamWagon.java
  
  Index: StreamWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/StreamWagon.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- StreamWagon.java	7 Dec 2004 11:41:36 -0000	1.11
  +++ StreamWagon.java	13 Dec 2004 21:57:07 -0000	1.12
  @@ -23,7 +23,12 @@
   import java.io.*;
   
   
  -
  +/**
  + * Base class for wagon which provide stream based API.
  + * 
  + * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
  + * @version $Id$
  + */
   public abstract class StreamWagon
       extends AbstractWagon
   {
  @@ -31,10 +36,10 @@
       //
       // ----------------------------------------------------------------------
   
  -    public abstract InputStream getInputStream( String resource )
  +    public abstract InputData getInputData( String resource )
           throws TransferFailedException, ResourceDoesNotExistException;
   
  -    public abstract OutputStream getOutputStream( String resource )
  +    public abstract OutputData getOutputData( String resource )
           throws TransferFailedException;
   
       public abstract void openConnection()
  @@ -50,27 +55,31 @@
       public void get( String resource, File destination )
           throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
       {
  -        InputStream is = getInputStream( resource );
  +        InputData inputData = getInputData( resource );
  +
  +        InputStream is = inputData.getInputStream();
   
           if ( is == null )
           {
               throw new TransferFailedException( getRepository().getUrl() + " - Could not open input stream for resource: '" + resource+ "'" );
           }
   
  -        getTransfer( resource, destination, is );
  +        getTransfer( inputData.getResource(), destination, is );
       }
   
       // source doesn't exist exception
       public void put( File source, String resource )
           throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
       {
  -        OutputStream os = getOutputStream( resource );
  +        OutputData outputData = getOutputData( resource );
  +
  +        OutputStream os = outputData.getOutputStream( );
   
           if ( os == null )
           {
               throw new TransferFailedException( getRepository().getUrl() + " - Could not open output stream for resource: '" + resource+ "'" );
           }
   
  -        putTransfer( resource, source, os, true );
  +        putTransfer( outputData.getResource(), source, os, true );
       }
   }
  
  
  
  1.1                  maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/InputData.java
  
  Index: InputData.java
  ===================================================================
  package org.apache.maven.wagon;
  
  import org.apache.maven.wagon.resource.Resource;
  
  import java.io.InputStream;
  
  /**
   * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
   * @version $Id: InputData.java,v 1.1 2004/12/13 21:57:07 michal Exp $
   */
  public class InputData
  {
     private InputStream inputStream;
  
     private Resource  resource;
  
      public InputStream getInputStream()
      {
          return inputStream;
      }
  
      public void setInputStream( InputStream inputStream )
      {
          this.inputStream = inputStream;
      }
  
      public Resource getResource() {
          return resource;
      }
  
      public void setResource( Resource resource )
      {
          this.resource = resource;
      }
  
  }
  
  
  
  1.1                  maven-wagon/wagon-provider-api/src/main/java/org/apache/maven/wagon/OutputData.java
  
  Index: OutputData.java
  ===================================================================
  package org.apache.maven.wagon;
  
  import org.apache.maven.wagon.resource.Resource;
  
  import java.io.InputStream;
  import java.io.OutputStream;
  
  /**
   * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
   * @version $Id: OutputData.java,v 1.1 2004/12/13 21:57:07 michal Exp $
   */
  public class OutputData 
  {
     private OutputStream outputStream;
      
     private Resource  resource;
  
      public OutputStream getOutputStream()
      {
          return outputStream;
      }
  
      public void setOutputStream( OutputStream outputStream )
      {
          this.outputStream = outputStream;
      }
  
      public Resource getResource()
      {
          return resource;
      }
  
      public void setResource( Resource resource )
      {
          this.resource = resource;
      }
  }
  
  
  
  1.3       +29 -3     maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockSessionListener.java
  
  Index: MockSessionListener.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/MockSessionListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MockSessionListener.java	3 Jun 2004 18:27:00 -0000	1.2
  +++ MockSessionListener.java	13 Dec 2004 21:57:07 -0000	1.3
  @@ -25,15 +25,25 @@
   {
   
       private boolean connectionOpenningCalled = false;
  +
       private boolean debugCalled = false;
  +
       private boolean connectionLoggedOffCalled = false;
  +
       private boolean connectionLoggedInCalled = false;
  +
       private boolean connectionRefusedCalled = false;
  +
       private boolean connectionDisconnectedCalled = false;
  +
       private boolean connectionDisconnectingCalled = false;
  +
       private boolean connectionOpenedCalled = false;
  +
       private SessionEvent sessionEvent;
  +
       private String message;
  +
       private boolean connectionErrorCalled;
   
       public boolean isSessionDisconnectedCalled()
  @@ -79,71 +89,87 @@
       public void reset()
       {
           connectionOpenningCalled = false;
  +
           debugCalled = false;
  +
           connectionLoggedOffCalled = false;
  +
           connectionLoggedInCalled = false;
  +
           connectionRefusedCalled = false;
  +
           connectionDisconnectedCalled = false;
  +
           connectionDisconnectingCalled = false;
  +
           connectionOpenedCalled = false;
  +
           sessionEvent = null;
  +
           message = null;
       }
   
       public void sessionOpening( final SessionEvent connectionEvent )
       {
           connectionOpenningCalled = true;
  +
           this.sessionEvent = connectionEvent;
       }
   
       public void sessionOpened( final SessionEvent connectionEvent )
       {
           connectionOpenedCalled = true;
  +
           this.sessionEvent = connectionEvent;
   
       }
   
       public void sessionDisconnecting( final SessionEvent connectionEvent )
       {
  -
           connectionDisconnectingCalled = true;
  +
           this.sessionEvent = connectionEvent;
       }
   
       public void sessionDisconnected( final SessionEvent connectionEvent )
       {
  -
           connectionDisconnectedCalled = true;
  +
           this.sessionEvent = connectionEvent;
       }
   
       public void sessionConnectionRefused( final SessionEvent connectionEvent )
       {
           connectionRefusedCalled = true;
  +
           this.sessionEvent = connectionEvent;
       }
   
       public void sessionLoggedIn( final SessionEvent connectionEvent )
       {
           connectionLoggedInCalled = true;
  +
           this.sessionEvent = connectionEvent;
       }
   
       public void sessionLoggedOff( final SessionEvent connectionEvent )
       {
           connectionLoggedOffCalled = true;
  +
           this.sessionEvent = connectionEvent;
       }
   
       public void sessionError( final SessionEvent connectionEvent )
       {
           connectionErrorCalled = true;
  +
           this.sessionEvent = connectionEvent;
       }
   
       public void debug( final String message )
       {
           debugCalled = true;
  +
           this.message = message;
       }
   
  
  
  
  1.5       +32 -21    maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
  
  Index: TransferEventTest.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TransferEventTest.java	10 Aug 2004 20:35:52 -0000	1.4
  +++ TransferEventTest.java	13 Dec 2004 21:57:07 -0000	1.5
  @@ -22,6 +22,7 @@
   import org.apache.maven.wagon.repository.Repository;
   import org.apache.maven.wagon.Wagon;
   import org.apache.maven.wagon.MockWagon;
  +import org.apache.maven.wagon.resource.Resource;
   
   /**
    * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  @@ -30,34 +31,32 @@
   public class TransferEventTest extends TestCase
   {
   
  -    /*
  -	 * @see TestCase#setUp()
  -	 */
  -    protected void setUp() throws Exception
  +    public TransferEventTest( final String name )
       {
  -        super.setUp();
  +        super( name );
       }
   
  -    /**
  -     * Constructor for TransferEventTest.
  -     * 
  -     * @param arg0 
  +    /*
  +     * @see TestCase#setUp()
        */
  -    public TransferEventTest( final String arg0 )
  +    protected void setUp() throws Exception
       {
  -        super( arg0 );
  +        super.setUp();
       }
   
  +
  +
       /*
  -	 * Class to test for void TransferEvent(Wagon, Repository, String, int,
  -	 * int)
  -	 */
  +     * Class to test for void TransferEvent(Wagon, Repository, String, int,
  +     * int)
  +    */
       public void testTransferEventProperties()
       {
   
           final Wagon wagon = new MockWagon();
   
           final Repository repo = new Repository();
  +
           try
           {
               wagon.connect( repo );
  @@ -70,29 +69,38 @@
   
           final Exception exception = new AuthenticationException( "dummy" );
   
  +        Resource resource = new Resource();
  +
  +        resource.setName( "mm" );
  +
           TransferEvent event =
                   new TransferEvent(
                           wagon,
  -                        "mm",
  +                        resource,
                           TransferEvent.TRANSFER_COMPLETED,
                           TransferEvent.REQUEST_GET );
   
           assertEquals( wagon, event.getWagon() );
   
           assertEquals( repo, event.getWagon().getRepository() );
  -        assertEquals( "mm", event.getResource() );
  +        
  +        assertEquals( "mm", event.getResource().getName() );
   
           assertEquals( TransferEvent.TRANSFER_COMPLETED, event.getEventType() );
   
           assertEquals( TransferEvent.REQUEST_GET, event.getRequestType() );
   
  -        event = new TransferEvent( wagon,  "mm", exception );
  +        Resource res = new Resource();
  +
  +        res.setName( "mm" );
  +
  +        event = new TransferEvent( wagon,  res, exception );
   
           assertEquals( wagon, event.getWagon() );
   
           assertEquals( repo, event.getWagon().getRepository() );
   
  -        assertEquals( "mm", event.getResource() );
  +        assertEquals( "mm", event.getResource().getName() );
   
           assertEquals( TransferEvent.TRANSFER_ERROR, event.getEventType() );
   
  @@ -104,9 +112,11 @@
   
           assertEquals( null, event.getResource() );
   
  -        event.setResource( "/foo/baa" );
  +        res.setName(  "/foo/baa" );
  +
  +        event.setResource( res );
   
  -        assertEquals( "/foo/baa", event.getResource() );
  +        assertEquals( "/foo/baa", event.getResource().getName() );
   
           event.setException( null );
   
  @@ -162,6 +172,7 @@
           }
           catch ( IllegalArgumentException e )
           {
  +            //we expect to be here
           }
   
   
  
  
  
  1.6       +42 -15    maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockWagon.java
  
  Index: MockWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-provider-api/src/test/java/org/apache/maven/wagon/MockWagon.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MockWagon.java	10 Aug 2004 20:35:53 -0000	1.5
  +++ MockWagon.java	13 Dec 2004 21:57:07 -0000	1.6
  @@ -17,6 +17,8 @@
    * ====================================================================
    */
   
  +import org.apache.maven.wagon.resource.Resource;
  +
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
   import java.io.InputStream;
  @@ -42,40 +44,65 @@
   
   
   
  -    public InputStream getInputStream( String resource )
  +    public InputData getInputData( String resource )
           throws TransferFailedException
       {
  +
  +        InputData inputData = new InputData();
  +
  +        Resource res = new Resource();
  +
  +        res.setName( resource );
  +
  +        inputData.setResource( res );
  +
  +        InputStream is;
  +
           if ( errorInputStream )
           {
  -            MockInputStream is = new MockInputStream();
   
  -            is.setForcedError( true );
   
  -            return is;
  -        }
  +            MockInputStream mockInputStream = new MockInputStream();
   
  -        byte[] buffer = new byte[1024 * 4 * 5];
  +            mockInputStream.setForcedError( true );
   
  -        ByteArrayInputStream is = new ByteArrayInputStream( buffer );
  +            is = mockInputStream;
   
  -        return is;
  +        }
  +        else
  +        {
  +           byte[] buffer = new byte[1024 * 4 * 5];
  +
  +           is = new ByteArrayInputStream( buffer );
  +        }
  +
  +        inputData.setInputStream( is );
  +        
  +        return inputData;
       }
   
  -    public OutputStream getOutputStream( String resource )
  +    public OutputData getOutputData( String resource )
           throws TransferFailedException
       {
  +        OutputData outputData = new OutputData();
  +
  +        OutputStream os;
           if ( errorInputStream )
           {
  -            MockOutputStream os = new MockOutputStream();
  +            MockOutputStream mockOutputStream = new MockOutputStream();
   
  -            os.setForcedError( true );
  +            mockOutputStream.setForcedError( true );
   
  -            return os;
  +            os = mockOutputStream;
  +        }
  +        else
  +        {
  +            os = new ByteArrayOutputStream();
           }
   
  -        ByteArrayOutputStream os = new ByteArrayOutputStream();
  +        outputData.setOutputStream( os );
   
  -        return os;
  +        return outputData;
       }
   
       public void openConnection()
  
  
  

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