You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2011/10/09 19:58:28 UTC

svn commit: r1180673 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-4991/ resources/mng-4991/repo/ resources/mng-4991/repo/org/ resources/mng-4991/repo/org/apache/ resources/mng-4991/repo/org/...

Author: bentmann
Date: Sun Oct  9 17:58:27 2011
New Revision: 1180673

URL: http://svn.apache.org/viewvc?rev=1180673&view=rev
Log:
[MNG-4991] LegacyRepositorySystem#injectProxy(repositories, proxies) doesn't evaluate non-proxy hosts

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.jar   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.pom
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/0.1/   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/0.1/parent-0.1.pom
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/settings-template.xml   (with props)
Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=1180673&r1=1180672&r2=1180673&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Sun Oct  9 17:58:27 2011
@@ -90,6 +90,7 @@ public class IntegrationTestSuite
         suite.addTestSuite( MavenITmng5009AggregationCycleTest.class );
         suite.addTestSuite( MavenITmng5000ChildPathAwareUrlInheritanceTest.class );
         suite.addTestSuite( MavenITmng4992MapStylePropertiesParamConfigTest.class );
+        suite.addTestSuite( MavenITmng4991NonProxyHostsTest.class );
         suite.addTestSuite( MavenITmng4987TimestampBasedSnapshotSelectionTest.class );
         suite.addTestSuite( MavenITmng4975ProfileInjectedPluginExecutionOrderTest.class );
         suite.addTestSuite( MavenITmng4973ExtensionVisibleToPluginInReactorTest.class );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java?rev=1180673&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java Sun Oct  9 17:58:27 2011
@@ -0,0 +1,104 @@
+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 org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.util.List;
+import java.util.Properties;
+
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerList;
+import org.mortbay.jetty.handler.ResourceHandler;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4991">MNG-4991</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4991NonProxyHostsTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4991NonProxyHostsTest()
+    {
+        super( "[2.0.3,3.0-alpha-1),[3.0.3,)" );
+    }
+
+    /**
+     * Verify that the nonProxyHosts settings is respected.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4991" );
+
+        ResourceHandler resourceHandler = new ResourceHandler();
+        resourceHandler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() );
+
+        HandlerList handlers = new HandlerList();
+        handlers.setHandlers( new Handler[] { resourceHandler, new DefaultHandler() } );
+
+        Server server = new Server( 0 );
+        server.setHandler( handlers );
+        server.start();
+
+        /*
+         * NOTE: To guard against automatic fallback to direct connection when the proxy is unreachable, we set up
+         * a dummy proxy as trap to catch the erroneous proxy usage in all cases.
+         */
+        Server proxy = new Server( 0 );
+        proxy.setHandler( new DefaultHandler() );
+        proxy.start();
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        try
+        {
+            verifier.setAutoclean( false );
+            verifier.deleteDirectory( "target" );
+            verifier.deleteArtifacts( "org.apache.maven.its.mng4991" );
+            Properties filterProps = verifier.newDefaultFilterProperties();
+            filterProps.setProperty( "@port@", Integer.toString( server.getConnectors()[0].getLocalPort() ) );
+            filterProps.setProperty( "@proxyPort@", Integer.toString( proxy.getConnectors()[0].getLocalPort() ) );
+            filterProps.setProperty( "@localhost@", InetAddress.getLocalHost().getCanonicalHostName() );
+            verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
+            verifier.getCliOptions().add( "-s" );
+            verifier.getCliOptions().add( "settings.xml" );
+            verifier.executeGoal( "validate" );
+            verifier.verifyErrorFreeLog();
+        }
+        finally
+        {
+            verifier.resetStreams();
+            server.stop();
+            proxy.stop();
+        }
+
+        List compile = verifier.loadLines( "target/compile.txt", "UTF-8" );
+
+        assertTrue( compile.toString(), compile.contains( "dep-0.1.jar" ) );
+    }
+
+}

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4991NonProxyHostsTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/pom.xml?rev=1180673&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/pom.xml Sun Oct  9 17:58:27 2011
@@ -0,0 +1,72 @@
+<?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.mng4991</groupId>
+    <artifactId>parent</artifactId>
+    <version>0.1</version>
+  </parent>
+
+  <groupId>org.apache.maven.its.mng4991</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4991</name>
+  <description>
+    Verify that the nonProxyHosts settings is respected.
+  </description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.its.mng4991</groupId>
+      <artifactId>dep</artifactId>
+      <version>0.1</version>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-dependency-resolution</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <compileClassPath>target/compile.txt</compileClassPath>
+          <significantPathLevels>1</significantPathLevels>
+        </configuration>
+        <executions>
+          <execution>
+            <id>resolve</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>compile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.jar
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.jar?rev=1180673&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.pom
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.pom?rev=1180673&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.pom (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/dep/0.1/dep-0.1.pom Sun Oct  9 17:58:27 2011
@@ -0,0 +1,36 @@
+<?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>
+
+  <groupId>org.apache.maven.its.mng4991</groupId>
+  <artifactId>dep</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/repo</url>
+    </repository>
+  </distributionManagement>
+</project>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/0.1/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/0.1/parent-0.1.pom
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/0.1/parent-0.1.pom?rev=1180673&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/0.1/parent-0.1.pom (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/repo/org/apache/maven/its/mng4991/parent/0.1/parent-0.1.pom Sun Oct  9 17:58:27 2011
@@ -0,0 +1,51 @@
+<?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>
+
+  <groupId>org.apache.maven.its.mng4991</groupId>
+  <artifactId>parent</artifactId>
+  <version>0.1</version>
+  <packaging>pom</packaging>
+
+  <repositories>
+    <repository>
+      <id>central</id>
+      <url>http://repo1.maven.org/maven2</url>
+      <releases>
+        <enabled>true</enabled>
+        <checksumPolicy>ignore</checksumPolicy>
+      </releases>
+      <snapshots>
+        <enabled>true</enabled>
+        <checksumPolicy>ignore</checksumPolicy>
+      </snapshots>
+    </repository>
+  </repositories>
+
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/repo</url>
+    </repository>
+  </distributionManagement>
+</project>

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/settings-template.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/settings-template.xml?rev=1180673&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/settings-template.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/settings-template.xml Sun Oct  9 17:58:27 2011
@@ -0,0 +1,49 @@
+<?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.
+-->
+
+<settings>
+  <mirrors>
+    <mirror>
+      <id>central</id>
+      <!-- NOTE: We need to try and use the proper host name/ip as Java generally ignores proxies for "localhost" -->
+      <url>http://@localhost@:@port@/</url>
+      <mirrorOf>central</mirrorOf>
+    </mirror>
+  </mirrors>
+  <proxies>
+    <proxy>
+      <active>true</active>
+      <protocol>http</protocol>
+      <host>localhost</host>
+      <port>@proxyPort@</port>
+      <nonProxyHosts>@localhost@</nonProxyHosts>
+    </proxy>
+  </proxies>
+  <profiles>
+    <profile>
+      <id>it-defaults</id>
+      <!-- disable central override and use built-in values -->
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>it-defaults</activeProfile>
+  </activeProfiles>
+</settings>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/settings-template.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4991/settings-template.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision