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 2010/07/17 18:21:26 UTC

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

Author: bentmann
Date: Sat Jul 17 16:21:25 2010
New Revision: 965102

URL: http://svn.apache.org/viewvc?rev=965102&view=rev
Log:
[MNG-4729] Mirrors and servers not accessed properly by plugin on a build

o Added IT

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/pom.xml   (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/a/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/a/0.1/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/a/0.1/a-0.1.pom
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/p/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/p/0.1/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/p/0.1/p-0.1.pom
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/settings-template.xml   (with props)
Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.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=965102&r1=965101&r2=965102&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 Sat Jul 17 16:21:25 2010
@@ -82,6 +82,7 @@ public class IntegrationTestSuite
         // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
         // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
 
+        suite.addTestSuite( MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.class );
         suite.addTestSuite( MavenITmng4721OptionalPluginDependencyTest.class );
         suite.addTestSuite( MavenITmng4720DependencyManagementExclusionMergeTest.class );
         suite.addTestSuite( MavenITmng4696MavenProjectDependencyArtifactsTest.class );

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java?rev=965102&r1=965101&r2=965102&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java (original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4275RelocationWarningTest.java Sat Jul 17 16:21:25 2010
@@ -75,6 +75,11 @@ public class MavenITmng4275RelocationWar
             {
                 foundWarning = true;
             }
+            else if ( line.matches( "\\[WARNING\\].* org.apache.maven.its.mng4275:relocation:jar:1 .* org.apache.maven.its.mng4275:relocated:jar:1.*" ) )
+            {
+                foundWarning = true;
+                break;
+            }
         }
         
         assertTrue( "Relocation warning should haven been logged.", foundWarning );

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java?rev=965102&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest.java Sat Jul 17 16:21:25 2010
@@ -0,0 +1,115 @@
+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.io.IOException;
+import java.io.PrintWriter;
+import java.util.Properties;
+
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerList;
+import org.mortbay.jetty.handler.ResourceHandler;
+import org.mortbay.jetty.security.Constraint;
+import org.mortbay.jetty.security.ConstraintMapping;
+import org.mortbay.jetty.security.HashUserRealm;
+import org.mortbay.jetty.security.SecurityHandler;
+
+/**
+ * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4729">MNG-4729</a>.
+ * 
+ * @author Benjamin Bentmann
+ */
+public class MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4729MirrorProxyAuthUsedByProjectBuilderTest()
+    {
+        super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" );
+    }
+
+    /**
+     * Test that the 2.x project builder obeys the network settings (mirror, proxy, auth) when building remote POMs
+     * and discovering additional repositories.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4729" );
+
+        Constraint constraint = new Constraint();
+        constraint.setName( Constraint.__BASIC_AUTH );
+        constraint.setRoles( new String[] { "user" } );
+        constraint.setAuthenticate( true );
+
+        ConstraintMapping constraintMapping = new ConstraintMapping();
+        constraintMapping.setConstraint( constraint );
+        constraintMapping.setPathSpec( "/*" );
+
+        HashUserRealm userRealm = new HashUserRealm( "TestRealm" );
+        userRealm.put( "testuser", "testtest" );
+        userRealm.addUserToRole( "testuser", "user" );
+
+        SecurityHandler securityHandler = new SecurityHandler();
+        securityHandler.setUserRealm( userRealm );
+        securityHandler.setConstraintMappings( new ConstraintMapping[] { constraintMapping } );
+
+        ResourceHandler repoHandler = new ResourceHandler();
+        repoHandler.setResourceBase( testDir.getAbsolutePath() );
+
+        HandlerList handlerList = new HandlerList();
+        handlerList.addHandler( securityHandler );
+        handlerList.addHandler( repoHandler );
+        handlerList.addHandler( new DefaultHandler() );
+
+        Server server = new Server( 0 );
+        server.setHandler( handlerList );
+        server.start();
+
+        try
+        {
+            Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+            verifier.setAutoclean( false );
+            verifier.deleteDirectory( "target" );
+            verifier.deleteArtifacts( "org.apache.maven.its.mng4729" );
+            Properties filterProps = verifier.newDefaultFilterProperties();
+            filterProps.setProperty( "@port@", Integer.toString( server.getConnectors()[0].getLocalPort() ) );
+            verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
+            verifier.getCliOptions().add( "-s" );
+            verifier.getCliOptions().add( "settings.xml" );
+            verifier.executeGoal( "validate" );
+            verifier.verifyErrorFreeLog();
+            verifier.resetStreams();
+
+            Properties props = verifier.loadProperties( "target/pom.properties" );
+            assertEquals( "PASSED", props.get( "org.apache.maven.its.mng4729:a:jar:0.1.project.name" ) );
+        }
+        finally
+        {
+            server.stop();
+        }
+    }
+
+}

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/pom.xml?rev=965102&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/pom.xml Sat Jul 17 16:21:25 2010
@@ -0,0 +1,63 @@
+<?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.mng4729</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4729</name>
+  <description>
+    Test that the 2.x project builder obeys the network settings (mirror, proxy, auth) when building remote POMs
+    and discovering additional repositories.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-artifact</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>build-pom</goal>
+            </goals>
+            <configuration>
+              <dependencies>
+                <dependency>
+                  <groupId>org.apache.maven.its.mng4729</groupId>
+                  <artifactId>a</artifactId>
+                  <version>0.1</version>
+                </dependency>
+              </dependencies>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

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

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

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/a/0.1/a-0.1.pom
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/a/0.1/a-0.1.pom?rev=965102&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/a/0.1/a-0.1.pom (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-a/org/apache/maven/its/mng4729/a/0.1/a-0.1.pom Sat Jul 17 16:21:25 2010
@@ -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>
+
+  <parent>
+    <groupId>org.apache.maven.its.mng4729</groupId>
+    <artifactId>p</artifactId>
+    <version>0.1</version>
+  </parent>
+
+  <groupId>org.apache.maven.its.mng4729</groupId>
+  <artifactId>a</artifactId>
+  <version>0.1</version>
+  <packaging>pom</packaging>
+
+  <name>PASSED</name>
+
+  <repositories>
+    <!-- needs to be mirrored, proxied, authed to actually resolve the parent -->
+    <repository>
+      <id>maven-core-it-repo-b</id>
+      <url>@baseurl@/null</url>
+      <releases>
+        <checksumPolicy>ignore</checksumPolicy>
+      </releases>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+</project>

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/p/0.1/p-0.1.pom
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/p/0.1/p-0.1.pom?rev=965102&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/p/0.1/p-0.1.pom (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/repo-b/org/apache/maven/its/mng4729/p/0.1/p-0.1.pom Sat Jul 17 16:21:25 2010
@@ -0,0 +1,32 @@
+<?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.mng4729</groupId>
+  <artifactId>p</artifactId>
+  <version>0.1</version>
+  <packaging>pom</packaging>
+
+  <name>NAME</name>
+  <description>DESC</description>
+</project>

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/settings-template.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/settings-template.xml?rev=965102&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/settings-template.xml (added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4729/settings-template.xml Sat Jul 17 16:21:25 2010
@@ -0,0 +1,96 @@
+<?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>
+    <!-- if the mirror is not applied, Maven would try downloading from the wrong directory -->
+    <mirror>
+      <id>it-mirror-a</id>
+      <mirrorOf>maven-core-it-repo-a</mirrorOf>
+      <url>http://mng4729.bad.host/repo-a</url>
+    </mirror>
+    <mirror>
+      <id>it-mirror-b</id>
+      <mirrorOf>maven-core-it-repo-b</mirrorOf>
+      <url>http://mng4729.bad.host/repo-b</url>
+    </mirror>
+    <mirror>
+      <id>central-mirror</id>
+      <mirrorOf>central</mirrorOf>
+      <url>@baseurl@/target/null</url>
+    </mirror>
+  </mirrors>
+  <proxies>
+    <!-- if the proxy is not applied, Maven would try downloading from the wrong host&port -->
+    <proxy>
+      <active>true</active>
+      <protocol>http</protocol>
+      <host>localhost</host>
+      <port>@port@</port>
+      <username>proxyuser</username>
+      <password>proxypass</password>
+    </proxy>
+  </proxies>
+  <servers>
+    <server>
+      <id>it-mirror-a</id>
+      <username>testuser</username>
+      <password>testtest</password>
+    </server>
+    <server>
+      <id>it-mirror-b</id>
+      <username>testuser</username>
+      <password>testtest</password>
+    </server>
+  </servers>
+  <profiles>
+    <profile>
+      <id>maven-core-it-repo</id>
+      <repositories>
+        <repository>
+          <id>maven-core-it-repo-a</id>
+          <url>@baseurl@/null</url>
+          <releases>
+            <checksumPolicy>ignore</checksumPolicy>
+          </releases>
+          <snapshots>
+            <enabled>false</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>maven-core-it-repo-a</id>
+          <url>@baseurl@/null</url>
+          <releases>
+            <checksumPolicy>ignore</checksumPolicy>
+          </releases>
+          <snapshots>
+            <enabled>false</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>maven-core-it-repo</activeProfile>
+  </activeProfiles>
+</settings>

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

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