o adding components to test wagons

o add method to view supported protocols
o add a note to the test to show the lifecycle plan is getting some repeated elements


git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@773926 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-05-12 15:08:53 +00:00
parent e6fa6d26b4
commit dd1725b131
15 changed files with 62 additions and 13 deletions

View File

@ -65,7 +65,7 @@ END SNIPPET: ant-bootstrap -->
<property name="maven.assembly" location="apache-maven/target/${maven.home.basename.expected}-bin.zip"/>
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
<property name="maven.debug" value="-e"/>
<property name="maven.test.skip" value="false"/> <!-- TODO: Change this default back to false once we're done -->
<property name="maven.test.skip" value="true"/> <!-- TODO: Change this default back to false once we're done -->
<property name="surefire.useFile" value="true"/>
<echo>maven.home = ${maven.home.effective}</echo>
<echo>maven.repo.local = ${maven.repo.local}</echo>

View File

@ -43,7 +43,10 @@
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http-lightweight</artifactId>
</dependency>
<dependency>
<groupId>easymock</groupId>

View File

@ -23,6 +23,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
@ -817,4 +818,9 @@ public class DefaultWagonManager
{
return httpUserAgent;
}
public Set<String> getSupportProtocols()
{
return wagons.keySet();
}
}

View File

@ -21,6 +21,8 @@ package org.apache.maven.artifact.manager;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
@ -85,4 +87,6 @@ public interface WagonManager
void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository remoteRepository, File file, String checksumPolicyWarn )
throws TransferFailedException, ResourceDoesNotExistException;
Set<String> getSupportProtocols();
}

View File

@ -155,6 +155,8 @@ public class DefaultArtifactResolver
boolean resolved = false;
boolean destinationExists = destination.exists();
// There are three conditions in which we'll go after the artifact here:
// 1. the force flag is set.
// 2. the artifact's file doesn't exist (this would be true for release or snapshot artifacts)

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
@ -75,7 +76,8 @@ public class DefaultWagonManagerTest
public void testAvailableProtocols()
throws Exception
{
wagonManager.getWagon( "file" );
Set<String> protocols = wagonManager.getSupportProtocols();
System.out.println( protocols );
}
public void testUnnecessaryRepositoryLookup() throws Exception {
@ -284,9 +286,7 @@ public class DefaultWagonManagerTest
{
assertWagon( "a" );
assertWagon( "b1" );
assertWagon( "b2" );
assertWagon( "b" );
assertWagon( "c" );

View File

@ -31,10 +31,13 @@ import org.apache.maven.wagon.OutputData;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.StreamWagon;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.authorization.AuthorizationException;
import org.apache.maven.wagon.resource.Resource;
import org.codehaus.plexus.component.annotations.Component;
@Component(role=Wagon.class,hint="string")
public class StringWagon
extends StreamWagon
{

View File

@ -1,5 +1,8 @@
package org.apache.maven.artifact.manager;
import org.apache.maven.wagon.Wagon;
import org.codehaus.plexus.component.annotations.Component;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -26,6 +29,7 @@ package org.apache.maven.artifact.manager;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
@Component(role=Wagon.class,hint="a")
public class WagonA
extends WagonMock
{

View File

@ -1,5 +1,8 @@
package org.apache.maven.artifact.manager;
import org.apache.maven.wagon.Wagon;
import org.codehaus.plexus.component.annotations.Component;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -26,6 +29,7 @@ package org.apache.maven.artifact.manager;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
@Component(role=Wagon.class,hint="b")
public class WagonB
extends WagonMock
{

View File

@ -1,5 +1,8 @@
package org.apache.maven.artifact.manager;
import org.apache.maven.wagon.Wagon;
import org.codehaus.plexus.component.annotations.Component;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -26,6 +29,7 @@ package org.apache.maven.artifact.manager;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
* @version $Id$
*/
@Component(role=Wagon.class,hint="c")
public class WagonC
extends WagonMock
{

View File

@ -428,7 +428,6 @@ public class DefaultLifecycleExecutor
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
MojoDescriptor getMojoDescriptor( String task, MavenProject project, ArtifactRepository localRepository )
//MojoDescriptor getMojoDescriptor( String groupId, String artifactId, String version, String goal, MavenProject project, ArtifactRepository localRepository )
throws LifecycleExecutionException
{
String goal;
@ -495,7 +494,7 @@ public class DefaultLifecycleExecutor
String message = "Invalid task '" + task + "': you must specify a valid lifecycle phase, or" + " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
throw new LifecycleExecutionException( message );
}
for ( Plugin buildPlugin : project.getBuildPlugins() )
{
if ( buildPlugin.getKey().equals( plugin.getKey() ) )
@ -511,7 +510,7 @@ public class DefaultLifecycleExecutor
MojoDescriptor mojoDescriptor;
try
{
{
mojoDescriptor = pluginManager.getMojoDescriptor( plugin, goal, project, localRepository );
}
catch ( PluginLoaderException e )

View File

@ -40,7 +40,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
@ -51,7 +50,6 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
import org.apache.maven.project.DuplicateArtifactAttachmentException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.realm.ClassRealm;

View File

@ -43,7 +43,7 @@ public class DefaultProjectBuilderConfiguration
private MavenProject topProject;
private boolean processPlugins = false;
private boolean processPlugins = true;
public DefaultProjectBuilderConfiguration()
{

View File

@ -61,6 +61,28 @@ public class LifecycleExecutorTest
// surefire:test
// jar:jar
// resources:resources
// resources:resources
// compiler:compile
// compiler:compile
// plexus-component-metadata:generate-metadata
// resources:testResources
// resources:testResources
// compiler:testCompile
// compiler:testCompile
// plexus-component-metadata:generate-test-metadata
// surefire:test
// surefire:test
// jar:jar
// jar:jar
/*
for( MojoExecution e : lifecyclePlan )
{
System.out.println( e.getMojoDescriptor().getFullGoalName() );
}
*/
assertEquals( "resources:resources", lifecyclePlan.get( 0 ).getMojoDescriptor().getFullGoalName() );
assertEquals( "compiler:compile", lifecyclePlan.get( 1 ).getMojoDescriptor().getFullGoalName() );
assertEquals( "plexus-component-metadata:generate-metadata", lifecyclePlan.get( 2 ).getMojoDescriptor().getFullGoalName() );

View File

@ -54,7 +54,7 @@ public class PluginManagerTest
assertNotNull( mojoDescriptor );
assertEquals( "generate-metadata", mojoDescriptor.getGoal() );
assertNotNull( mojoDescriptor.getRealm() );
mojoDescriptor.getRealm().display();
//mojoDescriptor.getRealm().display();
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
assertNotNull( pluginDescriptor );