maven-wagon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Lundberg <denn...@apache.org>
Subject Re: svn commit: r1127124 - in /maven/wagon/trunk: ./ wagon-provider-test/ wagon-provider-test/src/main/java/org/apache/maven/wagon/ wagon-providers/wagon-ftp/ wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/ wagon-providers/wag...
Date Tue, 24 May 2011 20:23:35 GMT
On 2011-05-24 18:11, struberg@apache.org wrote:
> Author: struberg
> Date: Tue May 24 16:11:30 2011
> New Revision: 1127124
> 
> URL: http://svn.apache.org/viewvc?rev=1127124&view=rev
> Log:
> WAGON-331 upgrade to java5, junit-4.8.2 and MINA ftpserver
> 
> This code needs review, please! 2 wagon-ftp tests got commented out
> due to WAGON-329 which need to be fixed first
> 
> Modified:
>     maven/wagon/trunk/pom.xml
>     maven/wagon/trunk/wagon-provider-test/pom.xml
>     maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/StreamingWagonTestCase.java
>     maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
>     maven/wagon/trunk/wagon-providers/wagon-ftp/pom.xml
>     maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
>     maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
>     maven/wagon/trunk/wagon-providers/wagon-http-lightweight/pom.xml
>     maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
>     maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
> 
> Modified: maven/wagon/trunk/pom.xml
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/pom.xml?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/pom.xml (original)
> +++ maven/wagon/trunk/pom.xml Tue May 24 16:11:30 2011
> @@ -242,7 +242,7 @@ under the License.
>        <dependency>
>          <groupId>junit</groupId>
>          <artifactId>junit</artifactId>
> -        <version>3.8.1</version>
> +        <version>4.8.2</version>
>        </dependency>
>        <dependency>
>          <groupId>org.codehaus.plexus</groupId>
> @@ -266,13 +266,13 @@ under the License.
>        <dependency>
>          <groupId>org.codehaus.plexus</groupId>
>          <artifactId>plexus-container-default</artifactId>
> -        <version>1.0-alpha-9</version>
> +        <version>1.5.5</version>

Can we upgrade this? I thought that we were locked on 1.0-alpha-9 due to
it being a core dependency.

>          <scope>test</scope>
>        </dependency>
>        <dependency>
>          <groupId>org.codehaus.plexus</groupId>
>          <artifactId>plexus-utils</artifactId>
> -        <version>1.4.2</version>
> +        <version>2.0.7</version>
>        </dependency>
>      </dependencies>
>    </dependencyManagement>
> @@ -303,6 +303,16 @@ under the License.
>      </pluginManagement>
>      <plugins>
>        <plugin>
> +        <groupId>org.apache.maven.plugins</groupId>
> +        <artifactId>maven-compiler-plugin</artifactId>
> +        <version>2.3.2</version>
> +        <configuration>
> +          <source>1.5</source>
> +          <target>1.5</target>
> +          <encoding>${project.build.sourceEncoding}</encoding>
> +        </configuration>
> +      </plugin>
> +      <plugin>
>          <groupId>org.codehaus.plexus</groupId>
>          <artifactId>plexus-maven-plugin</artifactId>
>          <executions>
> 
> Modified: maven/wagon/trunk/wagon-provider-test/pom.xml
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/pom.xml?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-provider-test/pom.xml (original)
> +++ maven/wagon/trunk/wagon-provider-test/pom.xml Tue May 24 16:11:30 2011
> @@ -48,7 +48,7 @@ under the License.
>      <dependency>
>        <groupId>easymock</groupId>
>        <artifactId>easymock</artifactId>
> -      <version>1.2_Java1.3</version>
> +      <version>1.2_Java1.5</version>
>      </dependency>
>      <dependency>
>        <groupId>org.mortbay.jetty</groupId>
> 
> Modified: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/StreamingWagonTestCase.java
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/StreamingWagonTestCase.java?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/StreamingWagonTestCase.java
(original)
> +++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/StreamingWagonTestCase.java
Tue May 24 16:11:30 2011
> @@ -27,6 +27,8 @@ import java.io.InputStream;
>  import java.io.OutputStream;
>  import java.security.NoSuchAlgorithmException;
>  import java.text.SimpleDateFormat;
> +import java.util.logging.Level;
> +import java.util.logging.Logger;

Hmm, java.util.logging isn't really my favorite logging framework. It's
only used for tests though, but perhaps we can discuss a strategy for
logging in test cases. I don't know how we normally handle it...

>  import org.apache.maven.wagon.authentication.AuthenticationException;
>  import org.apache.maven.wagon.authorization.AuthorizationException;
> @@ -42,6 +44,8 @@ import org.codehaus.plexus.util.IOUtil;
>  public abstract class StreamingWagonTestCase
>      extends WagonTestCase
>  {
> +    private static Logger logger = Logger.getLogger( StreamingWagonTestCase.class.getName()
);
> +
>      public void testStreamingWagon()
>          throws Exception
>      {
> @@ -257,6 +261,10 @@ public abstract class StreamingWagonTest
>              stream = new FileInputStream( sourceFile );
>              wagon.putFromStream( stream, resource, sourceFile.length(), sourceFile.lastModified()
);
>          }
> +        catch( Exception e )
> +        {
> +            logger.log( Level.SEVERE, "error while putting resources to the FTP Server",
e );
> +        }
>          finally
>          {
>              IOUtil.close( stream );
> @@ -289,6 +297,10 @@ public abstract class StreamingWagonTest
>              stream = new FileOutputStream( destFile );
>              wagon.getToStream( this.resource, stream );
>          }
> +        catch( Exception e )
> +        {
> +            logger.log( Level.SEVERE, "error while reading resources from the FTP Server",
e );
> +        }
>          finally
>          {
>              IOUtil.close( stream );
> 
> Modified: maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
(original)
> +++ maven/wagon/trunk/wagon-provider-test/src/main/java/org/apache/maven/wagon/WagonTestCase.java
Tue May 24 16:11:30 2011
> @@ -24,7 +24,6 @@ import java.io.IOException;
>  import java.security.NoSuchAlgorithmException;
>  import java.text.SimpleDateFormat;
>  import java.util.ArrayList;
> -import java.util.Collections;
>  import java.util.Iterator;
>  import java.util.List;
>  
> @@ -980,8 +979,9 @@ public abstract class WagonTestCase
>          resource = new Resource( this.resource );
>          resource.setContentLength( getExpectedContentLengthOnGet( expectedSize ) );
>          resource.setLastModified( getExpectedLastModifiedOnGet( testRepository, resource
) );
> -        mockTransferListener.transferStarted( createTransferEvent( wagon, resource,
TransferEvent.TRANSFER_STARTED,
> -                                                                   TransferEvent.REQUEST_GET,
destFile ) );
> +        TransferEvent te = createTransferEvent( wagon, resource, TransferEvent.TRANSFER_STARTED,
> +                                                                   TransferEvent.REQUEST_GET,
null );
> +        mockTransferListener.transferStarted( te );
>          mockTransferListener.transferProgress( new TransferEvent( wagon, resource, TransferEvent.TRANSFER_PROGRESS,
>                                                                    TransferEvent.REQUEST_GET
), new byte[] {}, 0 );
>          ProgressArgumentMatcher progressArgumentMatcher = new ProgressArgumentMatcher();
> 
> Modified: maven/wagon/trunk/wagon-providers/wagon-ftp/pom.xml
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ftp/pom.xml?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-providers/wagon-ftp/pom.xml (original)
> +++ maven/wagon/trunk/wagon-providers/wagon-ftp/pom.xml Tue May 24 16:11:30 2011
> @@ -39,17 +39,18 @@ under the License.
>        <artifactId>commons-net</artifactId>
>        <version>2.0</version>
>      </dependency>
> +
>      <dependency>
> -      <groupId>org.codehaus.plexus</groupId>
> -      <artifactId>plexus-ftpd</artifactId>
> -      <version>1.0-alpha-1</version>
> +      <groupId>org.apache.ftpserver</groupId>
> +      <artifactId>ftpserver-core</artifactId>
> +      <version>1.0.5</version>
> +      <scope>test</scope>
> +    </dependency>
> +    <dependency>
> +      <groupId>org.slf4j</groupId>
> +      <artifactId>slf4j-jdk14</artifactId>
> +      <version>1.5.2</version>
>        <scope>test</scope>
> -      <exclusions>
> -        <exclusion>
> -          <groupId>plexus</groupId>
> -          <artifactId>plexus-container-default</artifactId>
> -        </exclusion>
> -      </exclusions>
>      </dependency>
>    </dependencies>
>    <build>
> 
> Modified: maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
(original)
> +++ maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/java/org/apache/maven/wagon/providers/ftp/FtpWagonTest.java
Tue May 24 16:11:30 2011
> @@ -20,16 +20,23 @@ package org.apache.maven.wagon.providers
>   */
>  
>  import java.io.File;
> +import java.util.ArrayList;
> +import java.util.List;
>  
> -import org.apache.ftpserver.interfaces.FtpServerInterface;
> -import org.apache.maven.wagon.FileTestUtils;
> +import org.apache.ftpserver.FtpServer;
> +import org.apache.ftpserver.FtpServerFactory;
> +import org.apache.ftpserver.ftplet.Authority;
> +import org.apache.ftpserver.ftplet.UserManager;
> +import org.apache.ftpserver.listener.ListenerFactory;
> +import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
> +import org.apache.ftpserver.usermanager.impl.BaseUser;
> +import org.apache.ftpserver.usermanager.impl.WritePermission;
>  import org.apache.maven.wagon.StreamingWagonTestCase;
>  import org.apache.maven.wagon.Wagon;
>  import org.apache.maven.wagon.authentication.AuthenticationException;
>  import org.apache.maven.wagon.authentication.AuthenticationInfo;
>  import org.apache.maven.wagon.repository.Repository;
>  import org.apache.maven.wagon.resource.Resource;
> -import org.codehaus.plexus.util.FileUtils;
>  
>  /**
>   * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
> @@ -38,7 +45,28 @@ import org.codehaus.plexus.util.FileUtil
>  public class FtpWagonTest
>      extends StreamingWagonTestCase
>  {
> -    private FtpServerInterface server;
> +    static private FtpServer server;
> +
> +
> +    /**
> +     * TODO: fix WAGON-329
> +     * @throws Exception
> +     */
> +    @Override
> +    public void testWagonPutDirectoryDeepDestination() throws Exception
> +    {
> +      //X TODO temporarily disabled
> +    }
> +
> +    /**
> +     * TODO: fix WAGON-329
> +     * @throws Exception
> +     */
> +    @Override
> +    public void testWagonResourceExists() throws Exception
> +    {
> +      //X TODO temporarily disabled
> +    }
>  
>      protected String getProtocol()
>      {
> @@ -48,7 +76,49 @@ public class FtpWagonTest
>      protected void setupWagonTestingFixtures()
>          throws Exception
>      {
> -        server = (FtpServerInterface) lookup( FtpServerInterface.ROLE );
> +        File ftpHomeDir = new File( "target/test-output/local-repository/" );
> +        if ( !ftpHomeDir.exists() )
> +        {
> +            ftpHomeDir.mkdirs();
> +            //X TODO proper cleanup FileUtils.deleteDirectory( ftpHomeDir );
> +        }
> +
> +        if (server == null)
> +        {
> +            FtpServerFactory serverFactory = new FtpServerFactory();
> +
> +            ListenerFactory factory = new ListenerFactory();
> +
> +            // set the port of the listener
> +            factory.setPort(10023);
> +
> +            // replace the default listener
> +            serverFactory.addListener("default", factory.createListener());
> +
> +            PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
> +            UserManager um = userManagerFactory.createUserManager();
> +
> +            BaseUser user = new BaseUser();
> +            user.setName("admin");
> +            user.setPassword("admin");
> +
> +            List<Authority> authorities = new ArrayList<Authority>();
> +            authorities.add( new WritePermission() );
> +
> +            user.setAuthorities( authorities );
> +
> +            user.setHomeDirectory( ftpHomeDir.getAbsolutePath() );
> +
> +
> +            um.save(user);
> +
> +            serverFactory.setUserManager( um );
> +
> +            server = serverFactory.createServer();
> +
> +            // start the server
> +            server.start();
> +        }
>      }
>  
>      protected void createDirectory( Wagon wagon, String resourceToCreate, String dirName
)
> @@ -62,7 +132,8 @@ public class FtpWagonTest
>      protected void tearDownWagonTestingFixtures()
>          throws Exception
>      {
> -        release( server );
> +        server.stop();
> +        server = null;
>      }
>  
>      protected String getTestRepositoryUrl()
> 
> Modified: maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
(original)
> +++ maven/wagon/trunk/wagon-providers/wagon-ftp/src/test/resources/org/apache/maven/wagon/providers/ftp/FtpWagonTest.xml
Tue May 24 16:11:30 2011
> @@ -18,121 +18,4 @@
>    -->
>  
>  <plexus>
> -  <lifecycle-handler-manager implementation="org.codehaus.plexus.lifecycle.DefaultLifecycleHandlerManager">
> -    <default-lifecycle-handler-id>avalon</default-lifecycle-handler-id>
> -    <lifecycle-handlers>
> -      <lifecycle-handler implementation="org.codehaus.plexus.personality.avalon.AvalonLifecycleHandler">
> -        <id>avalon</id>
> -        <name>Avalon Lifecycle Handler</name>
> -        <begin-segment>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.LogEnablePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ContextualizePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ServicePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ComposePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ConfigurePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.InitializePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.StartPhase"/>
> -        </begin-segment>
> -        <suspend-segment>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.SuspendPhase"/>
> -        </suspend-segment>
> -        <resume-segment>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ResumePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.RecontextualizePhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.ReconfigurePhase"/>
> -        </resume-segment>
> -        <end-segment>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.StopPhase"/>
> -          <phase implementation="org.codehaus.plexus.personality.avalon.lifecycle.phase.DisposePhase"/>
> -        </end-segment>
> -      </lifecycle-handler>
> -    </lifecycle-handlers>
> -  </lifecycle-handler-manager>
> -
> -  <components>
> -    <component>
> -      <role>org.apache.avalon.cornerstone.services.threads.ThreadManager</role>
> -      <implementation>org.apache.avalon.cornerstone.blocks.threads.DefaultThreadManager</implementation>
> -      <configuration>
> -        <thread-group>
> -          <name>default</name>
> -          <!-- normal priority = 5, max-priority = 10 -->
> -          <priority>5</priority>
> -          <!-- are threads deamon threads ? -->
> -          <is-daemon>false</is-daemon>
> -          <max-threads>40</max-threads>
> -          <!-- these are ignored at the moment but will be fixed in later revisions
-->
> -          <min-threads>20</min-threads>
> -          <min-spare-threads>20</min-spare-threads>
> -        </thread-group>
> -      </configuration>
> -    </component>
> -
> -    <component>
> -      <role>org.apache.avalon.cornerstone.services.connection.ConnectionManager</role>
> -      <implementation>org.apache.avalon.cornerstone.blocks.connection.DefaultConnectionManager</implementation>
> -      <!--
> -      <requirements>
> -        <requirement>
> -          <role>org.apache.avalon.cornerstone.services.threads.ThreadManager</role>
> -        </requirement>
> -      </requirements>
> -      -->
> -    </component>
> -
> -    <component>
> -      <role>org.apache.avalon.cornerstone.services.sockets.SocketManager</role>
> -      <implementation>org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketManager</implementation>
> -      <configuration>
> -        <server-sockets>
> -          <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultServerSocketFactory"/>
> -        </server-sockets>
> -        <client-sockets>
> -          <factory name="plain" class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory"/>
> -        </client-sockets>
> -      </configuration>
> -    </component>
> -
> -    <component>
> -      <role>org.apache.ftpserver.usermanager.UserManagerInterface</role>
> -      <implementation>org.apache.ftpserver.usermanager.PropertiesUserManager</implementation>
> -      <configuration>
> -        <base-directory>${basedir}/target/test-output/</base-directory>
> -      </configuration>
> -    </component>
> -    <component>
> -      <role>org.apache.ftpserver.ip.IpRestrictorInterface</role>
> -      <implementation>org.apache.ftpserver.ip.FileIpRestrictor</implementation>
> -      <configuration>
> -        <base-directory>${basedir}/target/test-output/local-repository</base-directory>
> -      </configuration>
> -    </component>
> -    <component>
> -      <role>org.apache.ftpserver.interfaces.FtpServerInterface</role>
> -      <implementation>org.apache.ftpserver.FtpServerImpl</implementation>
> -      <!--
> -      <requirements>
> -        <requirement>
> -          <role>org.apache.avalon.cornerstone.services.sockets.SocketManager</role>
> -        </requirement>
> -        <requirement>
> -          <role>org.apache.avalon.cornerstone.services.connection.ConnectionManager</role>
> -        </requirement>
> -        <requirement>
> -          <role>org.apache.ftpserver.ip.IpRestrictorInterface</role>
> -        </requirement>
> -        <requirement>
> -          <role>org.apache.ftpserver.usermanager.UserManagerInterface</role>
> -        </requirement>
> -      </requirements>
> -      -->
> -      <configuration>
> -        <server-host>localhost</server-host>
> -        <self-host>localhost</self-host>
> -        <remote-admin-allowed>false</remote-admin-allowed>
> -        <ftp-port>10023</ftp-port>
> -        <default-user-root>${basedir}/target/test-output/local-repository</default-user-root>
> -      </configuration>
> -    </component>
> -  </components>
>  </plexus>
> 
> Modified: maven/wagon/trunk/wagon-providers/wagon-http-lightweight/pom.xml
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-lightweight/pom.xml?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-providers/wagon-http-lightweight/pom.xml (original)
> +++ maven/wagon/trunk/wagon-providers/wagon-http-lightweight/pom.xml Tue May 24 16:11:30
2011
> @@ -49,5 +49,13 @@ under the License.
>          </exclusion>
>        </exclusions>
>      </dependency>
> +
> +    <!-- used fo the TCK -->
> +    <dependency>
> +      <groupId>org.apache.maven.wagon</groupId>
> +      <artifactId>wagon-tck-http</artifactId>
> +      <version>${project.version}</version>
> +      <scope>test</scope>
> +    </dependency>
>    </dependencies>
>  </project>
> 
> Modified: maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
(original)
> +++ maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
Tue May 24 16:11:30 2011
> @@ -65,6 +65,8 @@ public class LightweightHttpWagon
>  
>      private HttpURLConnection putConnection;
>  
> +    public static final int MAX_REDIRECTS = 5;
> +
>      /**
>       * Whether to use any proxy cache or not.
>       * 
> @@ -101,6 +103,7 @@ public class LightweightHttpWagon
>          Resource resource = inputData.getResource();
>          try
>          {
> +            int redirectCount = 0;
>              URL url = new URL( buildUrl( resource.getName() ) );
>              HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
>              urlConnection.setRequestProperty( "Accept-Encoding", "gzip" );
> 
> Modified: maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
> URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java?rev=1127124&r1=1127123&r2=1127124&view=diff
> ==============================================================================
> --- maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
(original)
> +++ maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/LightweightHttpWagonTest.java
Tue May 24 16:11:30 2011
> @@ -19,6 +19,7 @@ package org.apache.maven.wagon.providers
>   * under the License.
>   */
>  
> +import java.io.File;
>  import java.util.Properties;
>  
>  import org.apache.maven.wagon.StreamingWagon;
> @@ -26,6 +27,7 @@ import org.apache.maven.wagon.Wagon;
>  import org.apache.maven.wagon.http.HttpWagonTestCase;
>  import org.apache.maven.wagon.proxy.ProxyInfo;
>  import org.apache.maven.wagon.repository.Repository;
> +import org.codehaus.plexus.util.FileUtils;
>  
>  /**
>   * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
> @@ -136,4 +138,41 @@ public class LightweightHttpWagonTest
>              System.getProperties().remove( "http.nonProxyHosts" );
>          }
>      }
> +
> +    /**
> +     * This unit test will verify the behaviour of WAGON-314.
> +     * Handling a HTTP redirect (301) properly
> +     *
> +     * It is disabled by default because it needs an online connection to maven.central
> +     */
> +    public void disabledtestHttpRedirect() throws Exception
> +    {
> +        Repository repository = new Repository( "apache.releases",
> +                                        "https://repository.apache.org/service/local/repositories/releases/content/"
);
> +
> +        Wagon wagon = getWagon();
> +
> +        wagon.connect( repository );
> +
> +        File destinationDir = new File( "./target/" );
> +        assertTrue( destinationDir.exists() );
> +
> +        File downloadedFile = new File( destinationDir, "downloadedFile.pom" );
> +
> +        if ( downloadedFile.exists() )
> +        {
> +            downloadedFile.delete();
> +            assertFalse( downloadedFile.exists() );
> +        }
> +
> +        wagon.get( "org/apache/maven/maven-parent/19/maven-parent-19.pom", downloadedFile
);
> +
> +        assertTrue( downloadedFile.exists() );
> +
> +        String artifactContent = FileUtils.fileRead( downloadedFile, "UTF-8" );
> +        assertNotNull( artifactContent );
> +        assertTrue( artifactContent.contains( "<artifactId>maven-parent</artifactId>"
) );
> +
> +        wagon.disconnect();
> +    }
>  }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wagon-commits-unsubscribe@maven.apache.org
> For additional commands, e-mail: wagon-commits-help@maven.apache.org
> 
> 


-- 
Dennis Lundberg

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


Mime
View raw message