Author: struberg Date: Mon Jun 6 20:18:37 2011 New Revision: 1132746 URL: http://svn.apache.org/viewvc?rev=1132746&view=rev Log: WAGON-330 enable TCK for wagon-http.
This also improves the redirect test and a fix for 'broken' DNS which redirects requests to an unknown host to a search URL even if you use test URLs as specified in http://tools.ietf.org/rfc/rfc2606.txt Added: maven/wagon/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/TckTest.java - copied unchanged from r1130514, maven/wagon/trunk/wagon-providers/wagon-http-lightweight/src/test/java/org/apache/maven/wagon/providers/http/TckTest.java maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/ maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/plexus/ maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/plexus/components.xml (with props) Modified: maven/wagon/trunk/wagon-providers/wagon-http/pom.xml maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/GetWagonTests.java maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/RedirectionServlet.java Modified: maven/wagon/trunk/wagon-providers/wagon-http/pom.xml URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/pom.xml?rev=1132746&r1=1132745&r2=1132746&view=diff ============================================================================== --- maven/wagon/trunk/wagon-providers/wagon-http/pom.xml (original) +++ maven/wagon/trunk/wagon-providers/wagon-http/pom.xml Mon Jun 6 20:18:37 2011 @@ -39,8 +39,17 @@ under the License. <artifactId>wagon-http-shared4</artifactId> <version>2.0-SNAPSHOT</version> </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> - <!-- I believe we can shade this in Maven itself + + <!-- I believe we can shade this in Maven itself <build> <plugins> <plugin> Added: maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/plexus/components.xml URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/plexus/components.xml?rev=1132746&view=auto ============================================================================== --- maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/plexus/components.xml (added) +++ maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/plexus/components.xml Mon Jun 6 20:18:37 2011 @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> +<component-set> + <components> + <component> + <role>org.apache.maven.wagon.tck.http.WagonTestCaseConfigurator</role> + <implementation>org.apache.maven.wagon.tck.http.WagonTestCaseConfigurator</implementation> + <configuration> + <wagonHint>http</wagonHint> + <useCaseConfigs> + <highLatencyLowTimeout> + <unsupported/> + </highLatencyLowTimeout> + <inifiniteLatencyTimeout> + <unsupported/> + </inifiniteLatencyTimeout> + </useCaseConfigs> + </configuration> + </component> + </components> +</component-set> Propchange: maven/wagon/trunk/wagon-providers/wagon-http/src/test/resources/META-INF/plexus/components.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/GetWagonTests.java URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/GetWagonTests.java?rev=1132746&r1=1132745&r2=1132746&view=diff ============================================================================== --- maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/GetWagonTests.java (original) +++ maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/GetWagonTests.java Mon Jun 6 20:18:37 2011 @@ -192,7 +192,10 @@ public class GetWagonTests throws ConnectionException, AuthenticationException, ComponentConfigurationException, IOException, ResourceDoesNotExistException, AuthorizationException { - if ( !initTest( "http://dummy-host.invalid", null, null ) ) + // we use a invalid localhost URL since some Internet Service Providers lately + // use funny 'search-DNS' which don't handle explicitly marked testing DNS properly. + // According to RFC-2606 .test, .invalid TLDs etc should work, but in practice it doesn't :( + if ( !initTest( "http://localhost:65520", null, null ) ) { return; } @@ -239,8 +242,7 @@ public class GetWagonTests String myPath = "moved.txt"; String targetPath = "/base.txt"; - getServerFixture().addServlet( - "/" + myPath, + getServerFixture().addServlet( "/" + myPath + "/*", new RedirectionServlet( HttpServletResponse.SC_MOVED_PERMANENTLY, myPath, targetPath, 6 ) ); @@ -255,8 +257,7 @@ public class GetWagonTests String myPath = "moved.txt"; String targetPath = "/base.txt"; - getServerFixture().addServlet( - "/" + myPath, + getServerFixture().addServlet( "/" + myPath + "/*", new RedirectionServlet( HttpServletResponse.SC_MOVED_TEMPORARILY, myPath, targetPath, 6 ) ); Modified: maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/RedirectionServlet.java URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/RedirectionServlet.java?rev=1132746&r1=1132745&r2=1132746&view=diff ============================================================================== --- maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/RedirectionServlet.java (original) +++ maven/wagon/trunk/wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/fixture/RedirectionServlet.java Mon Jun 6 20:18:37 2011 @@ -19,12 +19,11 @@ package org.apache.maven.wagon.tck.http. * under the License. */ -import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; public class RedirectionServlet extends HttpServlet @@ -82,7 +81,7 @@ public class RedirectionServlet else if ( redirectCount <= maxRedirects ) { resp.setStatus( code ); - resp.setHeader( "Location", myPath ); + resp.setHeader( "Location", myPath + "/" + redirectCount ); } else {