mirror of
https://github.com/apache/maven.git
synced 2025-02-21 17:40:48 +00:00
[MNG-4729] Mirrors and servers not accessed properly by plugin on a build
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@965102 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b1e147f59d
commit
107698949a
@ -82,6 +82,7 @@ public static Test suite()
|
||||
// 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 );
|
||||
|
@ -75,6 +75,11 @@ else if ( line.startsWith( "[WARNING] While downloading org.apache.maven.its.mng
|
||||
{
|
||||
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 );
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
63
its/core-it-suite/src/test/resources/mng-4729/pom.xml
Normal file
63
its/core-it-suite/src/test/resources/mng-4729/pom.xml
Normal file
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
Loading…
x
Reference in New Issue
Block a user