[MNG-4191] separate plugin and artifact repositories

o Updated test setup

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@786791 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-06-20 10:32:11 +00:00
parent 34580df645
commit 93f90df0de
2 changed files with 13 additions and 5 deletions

View File

@ -89,6 +89,7 @@ public abstract class AbstractCoreMavenComponentTestCase
.setPluginGroups( Arrays.asList( new String[] { "org.apache.maven.plugins" } ) ) .setPluginGroups( Arrays.asList( new String[] { "org.apache.maven.plugins" } ) )
.setLocalRepository( getLocalRepository() ) .setLocalRepository( getLocalRepository() )
.setRemoteRepositories( getRemoteRepositories() ) .setRemoteRepositories( getRemoteRepositories() )
.setPluginArtifactRepositories( getPluginArtifactRepositories() )
.setGoals( Arrays.asList( new String[] { "package" } ) ) .setGoals( Arrays.asList( new String[] { "package" } ) )
.setProperties( new Properties() ); .setProperties( new Properties() );
@ -112,6 +113,7 @@ public abstract class AbstractCoreMavenComponentTestCase
ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest() ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest()
.setLocalRepository( request.getLocalRepository() ) .setLocalRepository( request.getLocalRepository() )
.setRemoteRepositories( request.getRemoteRepositories() ) .setRemoteRepositories( request.getRemoteRepositories() )
.setPluginArtifactRepositories( request.getPluginArtifactRepositories() )
.setExecutionProperties( executionProperties ); .setExecutionProperties( executionProperties );
MavenProject project = null; MavenProject project = null;
@ -141,6 +143,12 @@ public abstract class AbstractCoreMavenComponentTestCase
protected List<ArtifactRepository> getRemoteRepositories() protected List<ArtifactRepository> getRemoteRepositories()
throws InvalidRepositoryException throws InvalidRepositoryException
{
return Arrays.asList( repositorySystem.createDefaultRemoteRepository() );
}
protected List<ArtifactRepository> getPluginArtifactRepositories()
throws InvalidRepositoryException
{ {
Repository itRepo = new Repository(); Repository itRepo = new Repository();
itRepo.setId( "maven.it" ); itRepo.setId( "maven.it" );

View File

@ -127,7 +127,7 @@ public class PluginManagerTest
plugin.setVersion( "2.4.2" ); plugin.setVersion( "2.4.2" );
// The project has already been fully interpolated so getting the raw mojoDescriptor is not going to have the processes configuration. // The project has already been fully interpolated so getting the raw mojoDescriptor is not going to have the processes configuration.
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), session.getCurrentProject().getRemoteArtifactRepositories() ); MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, session.getLocalRepository(), session.getCurrentProject().getPluginArtifactRepositories() );
assertPluginDescriptor( mojoDescriptor, "org.apache.maven.plugins", "maven-surefire-plugin", "2.4.2" ); assertPluginDescriptor( mojoDescriptor, "org.apache.maven.plugins", "maven-surefire-plugin", "2.4.2" );
System.out.println( session.getCurrentProject().getBuild().getPluginsAsMap() ); System.out.println( session.getCurrentProject().getBuild().getPluginsAsMap() );
@ -207,7 +207,7 @@ public class PluginManagerTest
// we need to pass this through as is so it doesn't get parsed again. // we need to pass this through as is so it doesn't get parsed again.
Artifact pluginArtifact = new ProjectArtifact( pluginProject ); Artifact pluginArtifact = new ProjectArtifact( pluginProject );
Set<Artifact> artifacts = pluginManager.getPluginArtifacts( pluginArtifact, plugin, getLocalRepository(), getRemoteRepositories() ); Set<Artifact> artifacts = pluginManager.getPluginArtifacts( pluginArtifact, plugin, getLocalRepository(), getPluginArtifactRepositories() );
System.out.println( artifacts ); System.out.println( artifacts );
*/ */
@ -220,12 +220,12 @@ public class PluginManagerTest
ArtifactResolutionRequest request = new ArtifactResolutionRequest() ArtifactResolutionRequest request = new ArtifactResolutionRequest()
.setArtifact( pluginArtifact ) .setArtifact( pluginArtifact )
.setLocalRepository( getLocalRepository() ) .setLocalRepository( getLocalRepository() )
.setRemoteRepostories( getRemoteRepositories() ); .setRemoteRepostories( getPluginArtifactRepositories() );
ArtifactResolutionResult result = repositorySystem.resolve( request ); ArtifactResolutionResult result = repositorySystem.resolve( request );
*/ */
List<Artifact> artifacts = pluginManager.getPluginArtifacts( pluginArtifact, plugin, getLocalRepository(), getRemoteRepositories() ); List<Artifact> artifacts = pluginManager.getPluginArtifacts( pluginArtifact, plugin, getLocalRepository(), getPluginArtifactRepositories() );
assertEquals( 4, artifacts.size() ); assertEquals( 4, artifacts.size() );
for ( Artifact a : artifacts ) for ( Artifact a : artifacts )