mirror of https://github.com/apache/maven.git
[MNG-4413] [regression] Repositories discovered in dependency POMs are not subject to mirroring
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@830382 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6595e9fa66
commit
4f5292e80b
|
@ -85,6 +85,7 @@ public class IntegrationTestSuite
|
|||
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||
|
||||
suite.addTestSuite( MavenITmng4413MirroringOfDependencyRepoTest.class );
|
||||
suite.addTestSuite( MavenITmng4412OfflineModeInPluginTest.class );
|
||||
suite.addTestSuite( MavenITmng4411VersionInfoTest.class );
|
||||
suite.addTestSuite( MavenITmng4410UsageHelpTest.class );
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
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.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-4413">MNG-4413</a>.
|
||||
*
|
||||
* @author Benjamin Bentmann
|
||||
*/
|
||||
public class MavenITmng4413MirroringOfDependencyRepoTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
|
||||
public MavenITmng4413MirroringOfDependencyRepoTest()
|
||||
{
|
||||
super( ALL_MAVEN_VERSIONS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that repositories contributed by dependency POMs during transitive dependency resolution are subject to
|
||||
* mirror and authentication configuration.
|
||||
*/
|
||||
public void testit()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4413" );
|
||||
|
||||
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( new File( testDir, "repo-a" ).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.mng4413" );
|
||||
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();
|
||||
|
||||
verifier.assertArtifactPresent( "org.apache.maven.its.mng4413", "a", "0.1", "jar" );
|
||||
}
|
||||
finally
|
||||
{
|
||||
server.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?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.mng4413</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<version>0.1</version>
|
||||
|
||||
<name>Maven Integration Test :: MNG-4413</name>
|
||||
<description>
|
||||
Test that repositories contributed by dependency POMs during transitive dependency resolution are subject to
|
||||
mirror and authentication configuration.
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<!-- the repository declared in the POM of this dependency needs to be mirrored and equipped with auth -->
|
||||
<groupId>org.apache.maven.its.mng4413</groupId>
|
||||
<artifactId>b</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<projectArtifacts>target/artifacts.txt</projectArtifacts>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
Binary file not shown.
|
@ -0,0 +1,38 @@
|
|||
<?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.mng4413</groupId>
|
||||
<artifactId>a</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: MNG-4413</name>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
Binary file not shown.
|
@ -0,0 +1,60 @@
|
|||
<?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.mng4413</groupId>
|
||||
<artifactId>b</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Maven Integration Test :: MNG-4413</name>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>file:///${basedir}/repo</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven-core-it-repo-a</id>
|
||||
<name>Repository hosing a, must be mirrored</name>
|
||||
<url>http://bad.host/maven2/</url>
|
||||
<releases>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its.mng4413</groupId>
|
||||
<artifactId>a</artifactId>
|
||||
<version>0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,62 @@
|
|||
<?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>it-mirror</id>
|
||||
<mirrorOf>maven-core-it-repo-a</mirrorOf>
|
||||
<url>http://localhost:@port@/</url>
|
||||
</mirror>
|
||||
<mirror>
|
||||
<id>central-mirror</id>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<url>@baseurl@/target/null</url>
|
||||
</mirror>
|
||||
</mirrors>
|
||||
<servers>
|
||||
<server>
|
||||
<id>it-mirror</id>
|
||||
<username>testuser</username>
|
||||
<password>testtest</password>
|
||||
</server>
|
||||
</servers>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>maven-core-it-repo</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven-core-it</id>
|
||||
<url>@baseurl@/repo-b</url>
|
||||
<releases>
|
||||
<checksumPolicy>ignore</checksumPolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
<activeProfiles>
|
||||
<activeProfile>maven-core-it-repo</activeProfile>
|
||||
</activeProfiles>
|
||||
</settings>
|
Loading…
Reference in New Issue