first pass at IT fix since enums introduction
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1337599 13f79535-47bb-0310-9956-ffa450edef68master
parent
360a9d2e8e
commit
c95ea5dd89
|
|
@ -21,6 +21,7 @@ package org.apache.maven.plugin.coreit;
|
||||||
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugins.annotations.Component;
|
import org.apache.maven.plugins.annotations.Component;
|
||||||
|
import org.apache.maven.plugins.annotations.DependencyScope;
|
||||||
import org.apache.maven.plugins.annotations.Execute;
|
import org.apache.maven.plugins.annotations.Execute;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
@ -33,7 +34,7 @@ import org.apache.maven.tools.plugin.annotations.FooMojo;
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
* @deprecated Don't use!
|
* @deprecated Don't use!
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "first", requiresDependencyResolution = "test", defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
@Mojo( name = "first", requiresDependencyResolution = DependencyScope.TEST, defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
||||||
public class FirstMojo
|
public class FirstMojo
|
||||||
extends FooMojo
|
extends FooMojo
|
||||||
{
|
{
|
||||||
|
|
@ -51,11 +52,11 @@ public class FirstMojo
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
if (bar == null)
|
if ( bar == null )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "bar == null" );
|
throw new MojoExecutionException( "bar == null" );
|
||||||
}
|
}
|
||||||
if (beer == null)
|
if ( beer == null )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "beer == null" );
|
throw new MojoExecutionException( "beer == null" );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public abstract class AbstractFirstMojo
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Component(role = "org.apache.maven.artifact.metadata.ArtifactMetadataSource", roleHint = "maven")
|
@Component( role = "org.apache.maven.artifact.metadata.ArtifactMetadataSource", roleHint = "maven" )
|
||||||
protected ArtifactMetadataSource artifactMetadataSource;
|
protected ArtifactMetadataSource artifactMetadataSource;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ import java.io.IOException;
|
||||||
* Touches a test file.
|
* Touches a test file.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "it0014")
|
@Mojo( name = "it0014" )
|
||||||
public class CoreIt0014Mojo
|
public class CoreIt0014Mojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
||||||
@Parameter(expression ="${project.build.directory}", required = true)
|
@Parameter( expression = "${project.build.directory}", required = true )
|
||||||
private String outputDirectory;
|
private String outputDirectory;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package org.apache.maven.plugin.coreit;
|
||||||
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugins.annotations.Component;
|
import org.apache.maven.plugins.annotations.Component;
|
||||||
|
import org.apache.maven.plugins.annotations.DependencyScope;
|
||||||
import org.apache.maven.plugins.annotations.Execute;
|
import org.apache.maven.plugins.annotations.Execute;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
@ -33,7 +34,7 @@ import org.apache.maven.plugins.AbstractFirstMojo;
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
* @deprecated Don't use!
|
* @deprecated Don't use!
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "first", requiresDependencyResolution = "test", defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
@Mojo( name = "first", requiresDependencyResolution = DependencyScope.TEST, defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
||||||
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
||||||
public class FirstMojo
|
public class FirstMojo
|
||||||
extends AbstractFirstMojo
|
extends AbstractFirstMojo
|
||||||
|
|
@ -46,17 +47,17 @@ public class FirstMojo
|
||||||
@Parameter( alias = "alias" )
|
@Parameter( alias = "alias" )
|
||||||
private String aliasedParam;
|
private String aliasedParam;
|
||||||
|
|
||||||
@Component( role = "org.apache.maven.project.MavenProjectHelper")
|
@Component( role = "org.apache.maven.project.MavenProjectHelper" )
|
||||||
private Object projectHelper;
|
private Object projectHelper;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
if (basedir == null)
|
if ( basedir == null )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "basedir == null" );
|
throw new MojoExecutionException( "basedir == null" );
|
||||||
}
|
}
|
||||||
if (touchFile == null)
|
if ( touchFile == null )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "touchFile == null" );
|
throw new MojoExecutionException( "touchFile == null" );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,14 @@ package org.apache.maven.plugin.coreit;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugins.annotations.DependencyScope;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing special.
|
* Does nothing special.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "second",requiresDependencyCollection = "compile", threadSafe = true)
|
@Mojo( name = "second", requiresDependencyCollection = DependencyScope.COMPILE, threadSafe = true )
|
||||||
public class SecondMojo
|
public class SecondMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ import java.io.IOException;
|
||||||
* Touches a test file.
|
* Touches a test file.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "it0014")
|
@Mojo( name = "it0014" )
|
||||||
public class CoreIt0014Mojo
|
public class CoreIt0014Mojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
||||||
@Parameter(expression ="${project.build.directory}", required = true)
|
@Parameter( expression = "${project.build.directory}", required = true )
|
||||||
private String outputDirectory;
|
private String outputDirectory;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package org.apache.maven.plugin.coreit;
|
||||||
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugins.annotations.Component;
|
import org.apache.maven.plugins.annotations.Component;
|
||||||
|
import org.apache.maven.plugins.annotations.DependencyScope;
|
||||||
import org.apache.maven.plugins.annotations.Execute;
|
import org.apache.maven.plugins.annotations.Execute;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
@ -32,7 +33,7 @@ import org.apache.maven.plugins.annotations.Parameter;
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
* @deprecated Don't use!
|
* @deprecated Don't use!
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "first", requiresDependencyResolution = "test", defaultPhase = LifecyclePhase.INTEGRATION_TEST)
|
@Mojo( name = "first", requiresDependencyResolution = DependencyScope.TEST, defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
||||||
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
||||||
public class FirstMojo
|
public class FirstMojo
|
||||||
extends AbstractFirstMojo
|
extends AbstractFirstMojo
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,14 @@ package org.apache.maven.plugin.coreit;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugins.annotations.DependencyScope;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing special.
|
* Does nothing special.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "second",requiresDependencyCollection = "compile", threadSafe = true)
|
@Mojo( name = "second", requiresDependencyCollection = DependencyScope.COMPILE, threadSafe = true )
|
||||||
public class SecondMojo
|
public class SecondMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ assert newHelpClass.exists()
|
||||||
|
|
||||||
def pluginDescriptor = new XmlParser().parse( descriptorFile );
|
def pluginDescriptor = new XmlParser().parse( descriptorFile );
|
||||||
|
|
||||||
def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first"}[0]
|
def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0]
|
||||||
|
|
||||||
assert mojo.goal.text() == 'first'
|
assert mojo.goal.text() == 'first'
|
||||||
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
|
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ import java.io.IOException;
|
||||||
* Touches a test file.
|
* Touches a test file.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "it0014")
|
@Mojo( name = "it0014" )
|
||||||
public class CoreIt0014Mojo
|
public class CoreIt0014Mojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
||||||
@Parameter(expression ="${project.build.directory}", required = true)
|
@Parameter( expression = "${project.build.directory}", required = true )
|
||||||
private String outputDirectory;
|
private String outputDirectory;
|
||||||
|
|
||||||
public void execute()
|
public void execute()
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ package org.apache.maven.plugin.coreit;
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugins.annotations.Component;
|
import org.apache.maven.plugins.annotations.Component;
|
||||||
|
import org.apache.maven.plugins.annotations.DependencyScope;
|
||||||
import org.apache.maven.plugins.annotations.Execute;
|
import org.apache.maven.plugins.annotations.Execute;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
@ -35,7 +36,7 @@ import java.io.File;
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
* @deprecated Don't use!
|
* @deprecated Don't use!
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "first", requiresDependencyResolution = "test", defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
@Mojo( name = "first", requiresDependencyResolution = DependencyScope.TEST, defaultPhase = LifecyclePhase.INTEGRATION_TEST )
|
||||||
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
|
||||||
public class FirstMojo
|
public class FirstMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,14 @@ package org.apache.maven.plugin.coreit;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugins.annotations.DependencyScope;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing special.
|
* Does nothing special.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "second",requiresDependencyCollection = "compile", threadSafe = true)
|
@Mojo( name = "second", requiresDependencyCollection = DependencyScope.COMPILE, threadSafe = true )
|
||||||
public class SecondMojo
|
public class SecondMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ assert descriptorFile.isFile()
|
||||||
|
|
||||||
def pluginDescriptor = new XmlParser().parse( descriptorFile );
|
def pluginDescriptor = new XmlParser().parse( descriptorFile );
|
||||||
|
|
||||||
def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first"}[0]
|
def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0]
|
||||||
|
|
||||||
assert mojo.goal.text() == 'first'
|
assert mojo.goal.text() == 'first'
|
||||||
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
|
assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
|
||||||
|
|
@ -40,7 +40,7 @@ assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
|
||||||
|
|
||||||
assert mojo.parameters.parameter.size() == 3
|
assert mojo.parameters.parameter.size() == 3
|
||||||
|
|
||||||
def parameter = mojo.parameters.parameter.findAll{ it.name.text() == "aliasedParam"}[0]
|
def parameter = mojo.parameters.parameter.findAll{ it.name.text() == "aliasedParam" }[0]
|
||||||
|
|
||||||
assert parameter.name.text() == 'aliasedParam'
|
assert parameter.name.text() == 'aliasedParam'
|
||||||
assert parameter.alias.text() == 'alias'
|
assert parameter.alias.text() == 'alias'
|
||||||
|
|
@ -50,7 +50,7 @@ assert parameter.required.text() == 'false'
|
||||||
assert parameter.editable.text() == 'true'
|
assert parameter.editable.text() == 'true'
|
||||||
assert parameter.description.text() == ''
|
assert parameter.description.text() == ''
|
||||||
|
|
||||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile"}[0]
|
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile" }[0]
|
||||||
|
|
||||||
assert parameter.name.text() == 'touchFile'
|
assert parameter.name.text() == 'touchFile'
|
||||||
assert parameter.alias.isEmpty()
|
assert parameter.alias.isEmpty()
|
||||||
|
|
@ -60,7 +60,7 @@ assert parameter.required.text() == 'true'
|
||||||
assert parameter.editable.text() == 'true'
|
assert parameter.editable.text() == 'true'
|
||||||
assert parameter.description.text() == ''
|
assert parameter.description.text() == ''
|
||||||
|
|
||||||
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "basedir"}[0]
|
parameter = mojo.parameters.parameter.findAll{ it.name.text() == "basedir" }[0]
|
||||||
|
|
||||||
assert parameter.name.text() == 'basedir'
|
assert parameter.name.text() == 'basedir'
|
||||||
assert parameter.alias.isEmpty()
|
assert parameter.alias.isEmpty()
|
||||||
|
|
@ -70,7 +70,7 @@ assert parameter.required.text() == 'false'
|
||||||
assert parameter.editable.text() == 'false'
|
assert parameter.editable.text() == 'false'
|
||||||
assert parameter.description.text() == 'Project directory.'
|
assert parameter.description.text() == 'Project directory.'
|
||||||
|
|
||||||
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second"}[0]
|
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second" }[0]
|
||||||
|
|
||||||
assert mojo.requiresDependencyCollection.text() == 'compile'
|
assert mojo.requiresDependencyCollection.text() == 'compile'
|
||||||
assert mojo.threadSafe.text() == 'true'
|
assert mojo.threadSafe.text() == 'true'
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,9 @@ public class MojoAnnotationContent
|
||||||
return requiresDependencyResolution;
|
return requiresDependencyResolution;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requiresDependencyResolution( DependencyScope requiresDependencyResolution )
|
public void requiresDependencyResolution( String requiresDependencyResolution )
|
||||||
{
|
{
|
||||||
this.requiresDependencyResolution = requiresDependencyResolution;
|
this.requiresDependencyResolution = DependencyScope.valueOf( requiresDependencyResolution );
|
||||||
}
|
}
|
||||||
|
|
||||||
public DependencyScope requiresDependencyCollection()
|
public DependencyScope requiresDependencyCollection()
|
||||||
|
|
@ -92,9 +92,9 @@ public class MojoAnnotationContent
|
||||||
return requiresDependencyCollection;
|
return requiresDependencyCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void requiresDependencyCollection( DependencyScope requiresDependencyCollection )
|
public void requiresDependencyCollection( String requiresDependencyCollection )
|
||||||
{
|
{
|
||||||
this.requiresDependencyCollection = requiresDependencyCollection;
|
this.requiresDependencyCollection = DependencyScope.valueOf( requiresDependencyCollection );
|
||||||
}
|
}
|
||||||
|
|
||||||
public InstanciationStrategy instantiationStrategy()
|
public InstanciationStrategy instantiationStrategy()
|
||||||
|
|
@ -102,9 +102,9 @@ public class MojoAnnotationContent
|
||||||
return instantiationStrategy;
|
return instantiationStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void instantiationStrategy( InstanciationStrategy instantiationStrategy )
|
public void instantiationStrategy( String instantiationStrategy )
|
||||||
{
|
{
|
||||||
this.instantiationStrategy = instantiationStrategy;
|
this.instantiationStrategy = InstanciationStrategy.valueOf( instantiationStrategy );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String executionStrategy()
|
public String executionStrategy()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue