You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2017/01/11 09:50:23 UTC
maven-integration-testing git commit: [MNG-3599] The upgrade of Wagon
to 2.10 breaks the test using older versions of wagon
Repository: maven-integration-testing
Updated Branches:
refs/heads/mng-3599 [created] c530dd828
[MNG-3599] The upgrade of Wagon to 2.10 breaks the test using older versions of wagon
Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/c530dd82
Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/c530dd82
Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/c530dd82
Branch: refs/heads/mng-3599
Commit: c530dd828e010d0fb0d401d655c2cf7ebab5b760
Parents: f31241a
Author: Stephen Connolly <st...@gmail.com>
Authored: Wed Jan 11 09:50:08 2017 +0000
Committer: Stephen Connolly <st...@gmail.com>
Committed: Wed Jan 11 09:50:08 2017 +0000
----------------------------------------------------------------------
...enITmng3599useHttpProxyForWebDAVMk2Test.java | 212 +++++++++++++++++++
...MavenITmng3599useHttpProxyForWebDAVTest.java | 4 +-
.../test/resources/bootstrap/group-7/pom.xml | 50 +++++
.../src/test/resources/bootstrap/pom.xml | 1 +
.../src/test/resources/mng-3599-mk2/pom.xml | 23 ++
.../mng-3599-mk2/settings-template.xml | 18 ++
6 files changed, 306 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c530dd82/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java
new file mode 100644
index 0000000..d77a78f
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVMk2Test.java
@@ -0,0 +1,212 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.maven.it.util.ResourceExtractor;
+import org.apache.maven.shared.utils.StringUtils;
+import org.apache.maven.shared.utils.io.FileUtils;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Request;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.AbstractHandler;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3599">MNG-3599</a>.
+ *
+ * @author Brett Porter
+ * @author John Casey
+ * @version $Id$
+ */
+public class MavenITmng3599useHttpProxyForWebDAVMk2Test
+ extends AbstractMavenIntegrationTestCase
+{
+ private static final String LS = System.getProperty( "line.separator" );
+
+ private Server server;
+
+ private int port;
+
+ private static final String content = "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
+ " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" +
+ " <modelVersion>4.0.0</modelVersion>\n" +
+ " <groupId>org.apache.maven.its.mng3599</groupId>\n" +
+ " <artifactId>test</artifactId>\n" +
+ " <version>1.0-SNAPSHOT</version>\n" +
+ " <name>MNG-3599</name>\n" +
+ "</project>";
+
+ public MavenITmng3599useHttpProxyForWebDAVMk2Test()
+ {
+ super( "[3.3.9)" );
+ }
+
+ public void setUp()
+ throws Exception
+ {
+ Handler handler = new AbstractHandler()
+ {
+ public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
+ throws IOException, ServletException
+ {
+ System.out.println( "Got request for URL: '" + request.getRequestURL() + "'" );
+ System.out.flush();
+
+ response.setContentType( "text/plain" );
+
+ System.out.println( "Checking for 'Proxy-Connection' header..." );
+ if ( request.getHeader( "Proxy-Connection" ) != null )
+ {
+ response.setStatus( HttpServletResponse.SC_OK );
+ response.getWriter().println( content );
+
+ System.out.println( "Proxy-Connection found." );
+ }
+ /*
+ * 2008-09-29 Oleg: "Proxy-Connection" is not part of http spec, but an extended header, and
+ * as such cannot be expected from all the clients.
+ * Changing the code to test for more generalized case: local proxy receives a request with
+ * correct server url and resource uri
+ */
+ else if(
+ request.getRequestURI().startsWith( "/org/apache/maven/its/mng3599/test-dependency" )
+ && request.getRequestURL().toString().startsWith( "http://www.example.com" )
+ )
+ {
+ response.setStatus( HttpServletResponse.SC_OK );
+ response.getWriter().println( content );
+
+ System.out.println( "Correct proxied request 'http://www.example.com' for resource '/org/apache/maven/its/mng3599/test-dependency' found." );
+ }
+ else
+ {
+ response.setStatus( HttpServletResponse.SC_BAD_REQUEST );
+
+ System.out.println( "Proxy-Connection 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();
+
+ if ( server != null )
+ {
+ server.stop();
+ server = null;
+ }
+ }
+
+ public void testitUseHttpProxyForHttp()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3599-mk2" );
+
+ /*
+ * NOTE: Make sure the WebDAV extension required by the test project has been pulled down into the local
+ * repo before the actual test installs Jetty as a mirror for everything. Otherwise, we will get garbage
+ * for the JAR/POM of the extension and its dependencies when run against a vanilla repo.
+ */
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ String settings = FileUtils.fileRead( new File( testDir, "settings-template.xml" ) );
+ settings = StringUtils.replace( settings, "@port@", Integer.toString( port ) );
+ String newSettings = StringUtils.replace( settings, "@protocol@", "http" );
+
+ FileUtils.fileWrite( new File( testDir, "settings.xml" ).getAbsolutePath(), newSettings );
+
+ verifier = newVerifier( testDir.getAbsolutePath() );
+
+ verifier.addCliOption( "--settings" );
+ verifier.addCliOption( "settings.xml" );
+ verifier.addCliOption( "-X" );
+
+ verifier.deleteArtifacts( "org.apache.maven.its.mng3599" );
+
+ verifier.setLogFileName( "logHttp.txt" );
+ 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",
+ content + LS );
+ }
+
+ /**
+ * Test that HTTP proxy is used for HTTP and for WebDAV.
+ */
+ public void testitUseHttpProxyForWebDAV()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3599-mk2" );
+
+ /*
+ * NOTE: Make sure the WebDAV extension required by the test project has been pulled down into the local
+ * repo before the actual test installs Jetty as a mirror for everything. Otherwise, we will get garbage
+ * for the JAR/POM of the extension and its dependencies when run against a vanilla repo.
+ */
+ Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+ verifier.executeGoal( "validate" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ String settings = FileUtils.fileRead( new File( testDir, "settings-template.xml" ) );
+ settings = StringUtils.replace( settings, "@port@", Integer.toString( port ) );
+ String newSettings = StringUtils.replace( settings, "@protocol@", "dav" );
+
+ FileUtils.fileWrite( new File( testDir, "settings.xml" ).getAbsolutePath(), newSettings );
+
+ verifier = newVerifier( testDir.getAbsolutePath() );
+
+ verifier.addCliOption( "--settings" );
+ verifier.addCliOption( "settings.xml" );
+ verifier.addCliOption( "-X" );
+
+ verifier.deleteArtifacts( "org.apache.maven.its.mng3599" );
+
+ verifier.setLogFileName( "logDAV.txt" );
+ 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",
+ content + LS );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c530dd82/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVTest.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVTest.java
index a3aa6e4..4c1c114 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3599useHttpProxyForWebDAVTest.java
@@ -61,7 +61,7 @@ public class MavenITmng3599useHttpProxyForWebDAVTest
public MavenITmng3599useHttpProxyForWebDAVTest()
{
- super( "(2.0.9,)" );
+ super( "(2.0.9,3.3.9)" );
}
public void setUp()
@@ -176,7 +176,7 @@ public class MavenITmng3599useHttpProxyForWebDAVTest
public void testitUseHttpProxyForWebDAV()
throws Exception
{
- requiresMavenVersion( "[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,)" );
+ requiresMavenVersion( "[2.1.0-M1,3.0-alpha-1),[3.0-beta-3,3.3.9)" );
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3599" );
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c530dd82/core-it-suite/src/test/resources/bootstrap/group-7/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/bootstrap/group-7/pom.xml b/core-it-suite/src/test/resources/bootstrap/group-7/pom.xml
new file mode 100644
index 0000000..b7902bc
--- /dev/null
+++ b/core-it-suite/src/test/resources/bootstrap/group-7/pom.xml
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.bootstrap</groupId>
+ <artifactId>maven-it-boostrap</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <groupId>org.apache.maven.its.bootstrap</groupId>
+ <artifactId>group-7</artifactId>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+
+ <name>Maven Integration Test :: Boostrap :: Group-7</name>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <!-- MNG-3599 Mk2 -->
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-webdav-jackrabbit</artifactId>
+ <version>2.10</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c530dd82/core-it-suite/src/test/resources/bootstrap/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/bootstrap/pom.xml b/core-it-suite/src/test/resources/bootstrap/pom.xml
index ed2d96e..e7aa995 100644
--- a/core-it-suite/src/test/resources/bootstrap/pom.xml
+++ b/core-it-suite/src/test/resources/bootstrap/pom.xml
@@ -43,6 +43,7 @@ under the License.
<module>group-4</module>
<module>group-5</module>
<module>group-6</module>
+ <module>group-7</module>
</modules>
<properties>
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c530dd82/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml b/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml
new file mode 100644
index 0000000..6937339
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-3599-mk2/pom.xml
@@ -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>2.10</version>
+ </extension>
+ </extensions>
+ </build>
+</project>
+
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c530dd82/core-it-suite/src/test/resources/mng-3599-mk2/settings-template.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-3599-mk2/settings-template.xml b/core-it-suite/src/test/resources/mng-3599-mk2/settings-template.xml
new file mode 100644
index 0000000..809db8f
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-3599-mk2/settings-template.xml
@@ -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>127.0.0.1</host>
+ <port>@port@</port>
+ </proxy>
+ </proxies>
+</settings>
+