You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2008/07/27 18:24:10 UTC
svn commit: r680140 - in
/maven/core-integration-testing/trunk/core-integration-tests/src/test:
java/org/apache/maven/integrationtests/
resources/mng-3599-useHttpProxyForWebDAV/
Author: brett
Date: Sun Jul 27 09:24:10 2008
New Revision: 680140
URL: http://svn.apache.org/viewvc?rev=680140&view=rev
Log:
add a test for the regression in the wagon upgrade, and a test that new issue MNG-3599 is working once fixed
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3599useHttpProxyForWebDAV.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/settings.xml.template
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3599useHttpProxyForWebDAV.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3599useHttpProxyForWebDAV.java?rev=680140&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3599useHttpProxyForWebDAV.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3599useHttpProxyForWebDAV.java Sun Jul 27 09:24:10 2008
@@ -0,0 +1,118 @@
+package org.apache.maven.integrationtests;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.FileUtils;
+import org.apache.maven.it.util.StringUtils;
+import org.apache.maven.it.util.ResourceExtractor;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.AbstractHandler;
+
+public class MavenITmng3599useHttpProxyForWebDAV
+ extends AbstractMavenIntegrationTestCase
+{
+ private Server server;
+
+ private int port;
+
+ public void setUp()
+ throws Exception
+ {
+ Handler handler = new AbstractHandler()
+ {
+ public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
+ throws IOException, ServletException
+ {
+ response.setContentType( "text/plain" );
+
+ if ( request.getHeader( "Proxy-Connection" ) != null )
+ {
+ response.setStatus( HttpServletResponse.SC_OK );
+ response.getWriter().println( "some content" );
+ }
+ else
+ {
+ response.setStatus( HttpServletResponse.SC_NOT_FOUND );
+ }
+
+ ( (Request) request ).setHandled( true );
+ }
+ };
+
+ server = new Server( 0 );
+ server.setHandler( handler );
+ server.start();
+
+ port = server.getConnectors()[0].getLocalPort();
+ }
+
+ protected void tearDown()
+ throws Exception
+ {
+ super.tearDown();
+
+ server.stop();
+ }
+
+ /**
+ * Test that HTTP proxy is used for HTTP and for WebDAV.
+ */
+ public void testmng3599useHttpProxyForWebDAV()
+ throws Exception
+ {
+ // TODO: create settings file
+
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3599-useHttpProxyForWebDAV" );
+ String settings = FileUtils.fileRead( new File( testDir, "settings.xml.template" ) );
+ settings = StringUtils.replace( settings, "@port@", Integer.valueOf( port ).toString() );
+ String newSettings = StringUtils.replace( settings, "@protocol@", "http" );
+ FileUtils.fileWrite( new File( testDir, "settings.xml" ).getAbsolutePath(), newSettings );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+
+ List cliOptions = new ArrayList();
+ cliOptions.add( "--settings" );
+ cliOptions.add( "settings.xml" );
+ verifier.setCliOptions( cliOptions );
+
+ verifier.deleteArtifact( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
+ verifier.executeGoal( "compile" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier.assertArtifactPresent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
+ verifier.assertArtifactContents( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar", "some content\n" );
+
+ // Doesn't work until 2.0.10+
+ // TODO: reinstate for 2.1 when WebDAV works
+ if ( matchesVersionRange( "(2.0.9,2.1-ALPHA-1-SNAPSHOT)" ) )
+ {
+ newSettings = StringUtils.replace( settings, "@protocol@", "dav" );
+ FileUtils.fileWrite( new File( testDir, "settings.xml" ).getAbsolutePath(), newSettings );
+
+ verifier.deleteArtifact( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
+ verifier.executeGoal( "compile" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ verifier.assertArtifactPresent( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar" );
+ verifier.assertArtifactContents( "org.apache.maven.its.mng3599", "test-dependency", "1.0", "jar", "some content\n" );
+ }
+ else
+ {
+ System.out.print( " [skipping DAV test for < 2.0.10 / 2.1 alpha]" );
+ }
+ }
+}
+
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3599useHttpProxyForWebDAV.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/pom.xml?rev=680140&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/pom.xml Sun Jul 27 09:24:10 2008
@@ -0,0 +1,23 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng3599</groupId>
+ <artifactId>test</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>test-dependency</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>1.0-beta-3</version>
+ </extension>
+ </extensions>
+ </build>
+</project>
+
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/settings.xml.template
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/settings.xml.template?rev=680140&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/settings.xml.template (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3599-useHttpProxyForWebDAV/settings.xml.template Sun Jul 27 09:24:10 2008
@@ -0,0 +1,18 @@
+<settings>
+ <mirrors>
+ <mirror>
+ <id>test-mirror</id>
+ <url>@protocol@://www.example.com/</url>
+ <mirrorOf>*</mirrorOf>
+ </mirror>
+ </mirrors>
+ <proxies>
+ <proxy>
+ <id>http-proxy</id>
+ <protocol>http</protocol>
+ <host>localhost</host>
+ <port>@port@</port>
+ </proxy>
+ </proxies>
+</settings>
+