diff --git a/maven-plugin-testing-harness/pom.xml b/maven-plugin-testing-harness/pom.xml
new file mode 100644
index 0000000..2cd6243
--- /dev/null
+++ b/maven-plugin-testing-harness/pom.xml
@@ -0,0 +1,95 @@
+
+
+
+ 4.0.0
+
+ org.apache.maven
+ maven-plugin-tools
+ 2.4-SNAPSHOT
+
+ maven-plugin-testing-harness
+ Maven Plugin Testing Mechanism
+
+
+ org.apache.maven
+ maven-project
+ 2.0
+
+
+ org.apache.maven
+ maven-core
+ 2.0
+
+
+ junit
+ junit
+ 3.8.1
+
+
+ org.codehaus.plexus
+ plexus-utils
+ 1.4.2
+
+
+ org.codehaus.plexus
+ plexus-archiver
+ 1.0-alpha-7
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ http://java.sun.com/j2se/1.4.2/docs/api/
+ http://maven.apache.org/ref/current/maven-project/apidocs/
+ http://maven.apache.org/ref/current/maven-plugin-api/apidocs/
+ http://maven.apache.org/ref/current/maven-artifact/apidocs/
+ http://plexus.codehaus.org/plexus-utils/apidocs/
+ http://www.junit.org/junit/javadoc/
+
+
+
+
+
+
+
+
+ maven-source-plugin
+
+ true
+
+
+
+
+ jar
+
+
+
+
+
+
+
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
new file mode 100644
index 0000000..9e616be
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
@@ -0,0 +1,456 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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.monitor.logging.DefaultLog;
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.component.configurator.ComponentConfigurator;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+import org.codehaus.plexus.util.ReflectionUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+import java.util.Map;
+import java.util.HashMap;
+import java.lang.reflect.Field;
+import java.lang.reflect.AccessibleObject;
+
+/**
+ * TODO: add a way to use the plugin POM for the lookup so that the user doesn't have to provide the a:g:v:goal
+ * as the role hint for the mojo lookup.
+ * TODO: standarize the execution of the mojo and looking at the results, but could simply have a template method
+ * for verifying the state of the mojo post execution
+ * TODO: need a way to look at the state of the mojo without adding getters, this could be where we finally specify
+ * the expressions which extract values from the mojo.
+ * TODO: create a standard directory structure for picking up POMs to make this even easier, we really just need a testing
+ * descriptor and make this entirely declarative!
+ *
+ * @author jesse
+ * @version $Id$
+ */
+public abstract class AbstractMojoTestCase
+ extends PlexusTestCase
+{
+ private ComponentConfigurator configurator;
+
+ /*
+ * for the harness I think we have decided against going the route of using the maven project builder.
+ * instead I think we are going to try and make an instance of the localrespository and assign that
+ * to either the project stub or into the mojo directly with injection...not sure yet though.
+ */
+ //private MavenProjectBuilder projectBuilder;
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ configurator = (ComponentConfigurator) getContainer().lookup( ComponentConfigurator.ROLE, "basic" );
+
+ //projectBuilder = (MavenProjectBuilder) getContainer().lookup( MavenProjectBuilder.ROLE );
+ }
+
+ /**
+ * Lookup the mojo leveraging the subproject pom
+ *
+ * @param goal
+ * @param pluginPom
+ * @return a Mojo instance
+ * @throws Exception
+ */
+ protected Mojo lookupMojo( String goal, String pluginPom )
+ throws Exception
+ {
+ return lookupMojo( goal, new File( pluginPom ) );
+ }
+
+ /**
+ * Lookup an empty mojo
+ *
+ * @param goal
+ * @param pluginPom
+ * @return a Mojo instance
+ * @throws Exception
+ */
+ protected Mojo lookupEmptyMojo( String goal, String pluginPom )
+ throws Exception
+ {
+ return lookupEmptyMojo( goal, new File( pluginPom ) );
+ }
+
+ /**
+ * Lookup the mojo leveraging the actual subprojects pom
+ *
+ * @param goal
+ * @param pom
+ * @return a Mojo instance
+ * @throws Exception
+ */
+ protected Mojo lookupMojo( String goal, File pom )
+ throws Exception
+ {
+ File pluginPom = new File( getBasedir(), "pom.xml" );
+
+ Xpp3Dom pluginPomDom = Xpp3DomBuilder.build( new FileReader( pluginPom ) );
+
+ String artifactId = pluginPomDom.getChild( "artifactId" ).getValue();
+
+ String groupId = resolveFromRootThenParent( pluginPomDom, "groupId" );
+
+ String version = resolveFromRootThenParent( pluginPomDom, "version" );
+
+ PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom );
+
+ return lookupMojo( groupId, artifactId, version, goal, pluginConfiguration );
+ }
+
+ /**
+ * Lookup the mojo leveraging the actual subprojects pom
+ *
+ * @param goal
+ * @param pom
+ * @return a Mojo instance
+ * @throws Exception
+ */
+ protected Mojo lookupEmptyMojo( String goal, File pom )
+ throws Exception
+ {
+ File pluginPom = new File( getBasedir(), "pom.xml" );
+
+ Xpp3Dom pluginPomDom = Xpp3DomBuilder.build( new FileReader( pluginPom ) );
+
+ String artifactId = pluginPomDom.getChild( "artifactId" ).getValue();
+
+ String groupId = resolveFromRootThenParent( pluginPomDom, "groupId" );
+
+ String version = resolveFromRootThenParent( pluginPomDom, "version" );
+
+ return lookupMojo( groupId, artifactId, version, goal, null );
+ }
+
+ /*
+ protected Mojo lookupMojo( String groupId, String artifactId, String version, String goal, File pom )
+ throws Exception
+ {
+ PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom );
+
+ return lookupMojo( groupId, artifactId, version, goal, pluginConfiguration );
+ }
+ */
+ /**
+ * lookup the mojo while we have all of the relavent information
+ *
+ * @param groupId
+ * @param artifactId
+ * @param version
+ * @param goal
+ * @param pluginConfiguration
+ * @return a Mojo instance
+ * @throws Exception
+ */
+ protected Mojo lookupMojo( String groupId, String artifactId, String version, String goal,
+ PlexusConfiguration pluginConfiguration )
+ throws Exception
+ {
+ validateContainerStatus();
+
+ // pluginkey = groupId : artifactId : version : goal
+
+ Mojo mojo = (Mojo) lookup( Mojo.ROLE, groupId + ":" + artifactId + ":" + version + ":" + goal );
+
+ Log mojoLogger = new DefaultLog( container.getLoggerManager().getLoggerForComponent( Mojo.ROLE ) );
+
+ mojo.setLog( mojoLogger );
+
+ if ( pluginConfiguration != null )
+ {
+ /* requires v10 of plexus container for lookup on expression evaluator
+ ExpressionEvaluator evaluator = (ExpressionEvaluator) getContainer().lookup( ExpressionEvaluator.ROLE, "stub-evaluator" );
+ */
+ ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub();
+
+ configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
+ }
+
+ return mojo;
+ }
+
+ /**
+ * @param artifactId
+ * @param pom
+ * @return the plexus configuration
+ * @throws Exception
+ */
+ protected PlexusConfiguration extractPluginConfiguration( String artifactId, File pom )
+ throws Exception
+ {
+ Reader reader = new FileReader( pom );
+
+ Xpp3Dom pomDom = Xpp3DomBuilder.build( reader );
+
+ return extractPluginConfiguration( artifactId, pomDom );
+ }
+
+ /**
+ * @param artifactId
+ * @param pomDom
+ * @return the plexus configuration
+ * @throws Exception
+ */
+ protected PlexusConfiguration extractPluginConfiguration( String artifactId, Xpp3Dom pomDom )
+ throws Exception
+ {
+ Xpp3Dom pluginConfigurationElement = null;
+
+ Xpp3Dom buildElement = pomDom.getChild( "build" );
+ if ( buildElement != null )
+ {
+ Xpp3Dom pluginsRootElement = buildElement.getChild( "plugins" );
+
+ if ( pluginsRootElement != null )
+ {
+ Xpp3Dom[] pluginElements = pluginsRootElement.getChildren();
+
+ for ( int i = 0; i < pluginElements.length; i++ )
+ {
+ Xpp3Dom pluginElement = pluginElements[i];
+
+ String pluginElementArtifactId = pluginElement.getChild( "artifactId" ).getValue();
+
+ if ( pluginElementArtifactId.equals( artifactId ) )
+ {
+ pluginConfigurationElement = pluginElement.getChild( "configuration" );
+
+ break;
+ }
+ }
+ }
+ }
+
+ if ( pluginConfigurationElement == null )
+ {
+ throw new ConfigurationException( "Cannot find a configuration element for a plugin with an artifactId of "
+ + artifactId + "." );
+ }
+
+ return new XmlPlexusConfiguration( pluginConfigurationElement );
+ }
+
+ /**
+ * Configure the mojo
+ *
+ * @param mojo
+ * @param artifactId
+ * @param pom
+ * @return a Mojo instance
+ * @throws Exception
+ */
+ protected Mojo configureMojo( Mojo mojo, String artifactId, File pom )
+ throws Exception
+ {
+ validateContainerStatus();
+
+ PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom );
+
+ ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub();
+
+ configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
+
+ return mojo;
+ }
+
+ /**
+ * Configure the mojo with the given plexus configuration
+ *
+ * @param mojo
+ * @param pluginConfiguration
+ * @return a Mojo instance
+ * @throws Exception
+ */
+ protected Mojo configureMojo( Mojo mojo, PlexusConfiguration pluginConfiguration )
+ throws Exception
+ {
+ validateContainerStatus();
+
+ ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub();
+
+ configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
+
+ return mojo;
+ }
+
+ /**
+ * convience method to obtain the value of a variable on a mojo that might not have a getter.
+ *
+ * NOTE: the caller is responsible for casting to to what the desired type is.
+ *
+ * @param object
+ * @param variable
+ * @return object value of variable
+ * @throws IllegalArgumentException
+ */
+ protected Object getVariableValueFromObject( Object object, String variable )
+ throws IllegalAccessException
+ {
+ Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( variable, object.getClass() );
+
+ field.setAccessible( true );
+
+ return field.get( object );
+ }
+
+ /**
+ * convience method to obtain all variables and values from the mojo (including its superclasses)
+ *
+ * Note: the values in the map are of type Object so the caller is responsible for casting to desired types.
+ *
+ * @param object
+ * @return map of variable names and values
+ */
+ protected Map getVariablesAndValuesFromObject( Object object )
+ throws IllegalAccessException
+ {
+ return getVariablesAndValuesFromObject( object.getClass(), object );
+ }
+
+ /**
+ * convience method to obtain all variables and values from the mojo (including its superclasses)
+ *
+ * Note: the values in the map are of type Object so the caller is responsible for casting to desired types.
+ *
+ * @param clazz
+ * @param object
+ * @return map of variable names and values
+ */
+ protected Map getVariablesAndValuesFromObject( Class clazz, Object object )
+ throws IllegalAccessException
+ {
+ Map map = new HashMap();
+
+ Field[] fields = clazz.getDeclaredFields();
+
+ AccessibleObject.setAccessible( fields, true );
+
+ for ( int i = 0; i < fields.length; ++i )
+ {
+ Field field = fields[i];
+
+ map.put( field.getName(), field.get( object ) );
+
+ }
+
+ Class superclass = clazz.getSuperclass();
+
+ if ( !Object.class.equals( superclass ) )
+ {
+ map.putAll( getVariablesAndValuesFromObject( superclass, object ) );
+ }
+
+ return map;
+ }
+
+ /**
+ * convience method to set values to variables in objects that don't have setters
+ * @param object
+ * @param variable
+ * @param value
+ * @throws IllegalAccessException
+ */
+ protected void setVariableValueToObject( Object object, String variable, Object value )
+ throws IllegalAccessException
+ {
+ Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( variable, object.getClass() );
+
+ field.setAccessible( true );
+
+ field.set( object, value );
+ }
+
+ /**
+ * sometimes the parent element might contain the correct value so generalize that access
+ *
+ * TODO find out where this is probably done elsewhere
+ *
+ * @param pluginPomDom
+ * @param element
+ * @return
+ * @throws Exception
+ */
+ private String resolveFromRootThenParent( Xpp3Dom pluginPomDom, String element )
+ throws Exception
+ {
+ Xpp3Dom elementDom = pluginPomDom.getChild( element );
+
+ // parent might have the group Id so resolve it
+ if ( elementDom == null )
+ {
+ Xpp3Dom pluginParentDom = pluginPomDom.getChild( "parent" );
+
+ if ( pluginParentDom != null )
+ {
+ elementDom = pluginParentDom.getChild( element );
+
+ if ( elementDom == null )
+ {
+ throw new Exception( "unable to determine " + element );
+ }
+ else
+ {
+ return elementDom.getValue();
+ }
+ }
+ else
+ {
+ throw new Exception( "unable to determine " + element );
+ }
+ }
+ else
+ {
+ return elementDom.getValue();
+ }
+ }
+
+ /**
+ * We should make sure this is called in each method that makes use of the container,
+ * otherwise we throw ugly NPE's
+ *
+ * crops up when the subclassing code defines the setUp method but doesn't call super.setUp()
+ *
+ * @throws Exception
+ */
+ private void validateContainerStatus()
+ throws Exception
+ {
+ if ( container != null )
+ {
+ return;
+ }
+ else
+ {
+ throw new Exception( "container is null, make sure super.setUp() is called" );
+ }
+ }
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java
new file mode 100644
index 0000000..39e24e1
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java
@@ -0,0 +1,435 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.plugin.testing.stubs.DefaultArtifactHandlerStub;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import org.codehaus.plexus.archiver.war.WarArchiver;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.ReflectionUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * This class creates artifacts to be used for testing purposes. It can optionally create actual
+ * files on the local disk for things like copying. It can create these files as archives with named
+ * files inside to be used for testing things like unpack.
+ *
+ * Also provided are some utility methods to quickly get a set of artifacts distinguished by various things like
+ * group,artifact,type,scope, etc
+ *
+ * It was originally developed for the dependency plugin, but can be useful in other plugins that
+ * need to simulate artifacts for unit tests.
+ * @author Brian Fox
+ *
+ */
+public class ArtifactStubFactory
+{
+ File workingDir;
+
+ boolean createFiles;
+
+ File srcFile;
+
+ boolean createUnpackableFile;
+
+ ArchiverManager archiverManager;
+
+ /**
+ * Default constructor. This should be used only if real files aren't needed...just the artifact objects
+ *
+ */
+ public ArtifactStubFactory()
+ {
+ this.workingDir = null;
+ this.createFiles = false;
+ }
+
+ /**
+ * This constructor is to be used if files are needed and to set a working dir
+ * @param workingDir
+ * @param createFiles
+ */
+ public ArtifactStubFactory( File workingDir, boolean createFiles )
+ {
+ this.workingDir = new File( workingDir, "localTestRepo" );
+ this.createFiles = createFiles;
+ }
+
+ /**
+ * If set, the file will be created as a zip/jar/war with a file inside that can be
+ * checked to exist after unpacking.
+ * @param archiverManager
+ */
+ public void setUnpackableFile( ArchiverManager archiverManager )
+ {
+ this.createUnpackableFile = true;
+ this.archiverManager = archiverManager;
+ }
+
+ public Artifact createArtifact( String groupId, String artifactId, String version )
+ throws IOException
+ {
+ return createArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, "jar", "" );
+ }
+
+ public Artifact createArtifact( String groupId, String artifactId, String version, String scope )
+ throws IOException
+ {
+ return createArtifact( groupId, artifactId, version, scope, "jar", "" );
+ }
+
+ public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
+ String classifier )
+ throws IOException
+ {
+ VersionRange vr = VersionRange.createFromVersion( version );
+ return createArtifact( groupId, artifactId, vr, scope, type, classifier, false );
+ }
+
+ public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope,
+ String type, String classifier, boolean optional )
+ throws IOException
+ {
+ ArtifactHandler ah = new DefaultArtifactHandlerStub( type, classifier );
+
+ Artifact artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier, ah,
+ optional );
+ if ( createFiles )
+ {
+ setArtifactFile( artifact );
+ }
+ return artifact;
+ }
+
+ /*
+ * Creates a file that can be copied or unpacked based on the passed in
+ * artifact
+ */
+ public void setArtifactFile( Artifact artifact )
+ throws IOException
+ {
+ if (this.workingDir == null )
+ {
+ throw new IllegalArgumentException("The workingDir must be set if createFiles is true.");
+ }
+
+ String fileName = getFormattedFileName( artifact, false );
+
+ File theFile = new File( this.workingDir, fileName );
+ theFile.getParentFile().mkdirs();
+
+ if ( srcFile == null )
+ {
+ theFile.createNewFile();
+ }
+ else if ( createUnpackableFile )
+ {
+ try
+ {
+ createUnpackableFile( artifact, theFile );
+ }
+ catch ( NoSuchArchiverException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch ( ArchiverException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch ( IOException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ FileUtils.copyFile( srcFile, theFile );
+ }
+
+ artifact.setFile( theFile );
+ }
+
+ static public String getUnpackableFileName( Artifact artifact )
+ {
+ return "" + artifact.getGroupId() + "-" + artifact.getArtifactId() + "-" + artifact.getVersion() + "-"
+ + artifact.getClassifier() + "-" + artifact.getType() + ".txt";
+ }
+
+ public void createUnpackableFile( Artifact artifact, File destFile )
+ throws NoSuchArchiverException, ArchiverException, IOException
+ {
+ Archiver archiver = archiverManager.getArchiver( destFile );
+
+ archiver.setDestFile( destFile );
+ archiver.addFile( srcFile, getUnpackableFileName( artifact ) );
+
+ try
+ {
+ setVariableValueToObject( archiver, "logger", new SilentLog() );
+ }
+ catch ( IllegalAccessException e )
+ {
+ System.out.println( "Unable to override logger with silent log." );
+ e.printStackTrace();
+ }
+ if ( archiver instanceof WarArchiver )
+ {
+ WarArchiver war = (WarArchiver) archiver;
+ // the use of this is counter-intuitive:
+ // http://jira.codehaus.org/browse/PLX-286
+ war.setIgnoreWebxml( false );
+ }
+ archiver.createArchive();
+ }
+
+ public Artifact getReleaseArtifact()
+ throws IOException
+ {
+ return createArtifact( "testGroupId", "release", "1.0" );
+ }
+
+ public Artifact getSnapshotArtifact()
+ throws IOException
+ {
+ return createArtifact( "testGroupId", "snapshot", "2.0-SNAPSHOT" );
+ }
+
+ public Set getReleaseAndSnapshotArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.add( getReleaseArtifact() );
+ set.add( getSnapshotArtifact() );
+ return set;
+ }
+
+ public Set getScopedArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.add( createArtifact( "g", "compile", "1.0", Artifact.SCOPE_COMPILE ) );
+ set.add( createArtifact( "g", "provided", "1.0", Artifact.SCOPE_PROVIDED ) );
+ set.add( createArtifact( "g", "test", "1.0", Artifact.SCOPE_TEST ) );
+ set.add( createArtifact( "g", "runtime", "1.0", Artifact.SCOPE_RUNTIME ) );
+ set.add( createArtifact( "g", "system", "1.0", Artifact.SCOPE_SYSTEM ) );
+ return set;
+ }
+
+ public Set getTypedArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) );
+ set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
+ set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "sources", null ) );
+ set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) );
+ set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) );
+ return set;
+ }
+
+ public Set getClassifiedArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "jar", "one" ) );
+ set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", "two" ) );
+ set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "jar", "three" ) );
+ set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "jar", "four" ) );
+ return set;
+ }
+
+ public Set getTypedArchiveArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) );
+ set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) );
+ set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) );
+ set.add( createArtifact( "g", "e", "1.0", Artifact.SCOPE_COMPILE, "rar", null ) );
+ return set;
+ }
+
+ public Set getArtifactArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.add( createArtifact( "g", "one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ set.add( createArtifact( "g", "two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ set.add( createArtifact( "g", "three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ set.add( createArtifact( "g", "four", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ return set;
+ }
+
+ public Set getGroupIdArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.add( createArtifact( "one", "group-one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ set.add( createArtifact( "two", "group-two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ set.add( createArtifact( "three", "group-three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ set.add( createArtifact( "four", "group-four", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) );
+ return set;
+ }
+
+ public Set getMixedArtifacts()
+ throws IOException
+ {
+ Set set = new HashSet();
+ set.addAll( getTypedArtifacts() );
+ set.addAll( getScopedArtifacts() );
+ set.addAll( getReleaseAndSnapshotArtifacts() );
+ return set;
+ }
+
+ /**
+ * @return Returns the createFiles.
+ */
+ public boolean isCreateFiles()
+ {
+ return this.createFiles;
+ }
+
+ /**
+ * @param createFiles
+ * The createFiles to set.
+ */
+ public void setCreateFiles( boolean createFiles )
+ {
+ this.createFiles = createFiles;
+ }
+
+ /**
+ * @return Returns the workingDir.
+ */
+ public File getWorkingDir()
+ {
+ return this.workingDir;
+ }
+
+ /**
+ * @param workingDir
+ * The workingDir to set.
+ */
+ public void setWorkingDir( File workingDir )
+ {
+ this.workingDir = workingDir;
+ }
+
+ /**
+ * @return Returns the srcFile.
+ */
+ public File getSrcFile()
+ {
+ return this.srcFile;
+ }
+
+ /**
+ * @param srcFile
+ * The srcFile to set.
+ */
+ public void setSrcFile( File srcFile )
+ {
+ this.srcFile = srcFile;
+ }
+
+ /**
+ * convience method to set values to variables in objects that don't have
+ * setters
+ *
+ * @param object
+ * @param variable
+ * @param value
+ * @throws IllegalAccessException
+ */
+ public static void setVariableValueToObject( Object object, String variable, Object value )
+ throws IllegalAccessException
+ {
+ Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( variable, object.getClass() );
+
+ field.setAccessible( true );
+
+ field.set( object, value );
+ }
+
+ /**
+ * Builds the file name. If removeVersion is set, then the file name must be
+ * reconstructed from the artifactId, Classifier (if used) and Type.
+ * Otherwise, this method returns the artifact file name.
+ *
+ * @param artifact
+ * File to be formatted.
+ * @param removeVersion
+ * Specifies if the version should be removed from the file name.
+ * @return Formatted file name in the format
+ * artifactId-[version]-[classifier].[type]
+ */
+ public static String getFormattedFileName( Artifact artifact, boolean removeVersion )
+ {
+ String destFileName = null;
+
+ // if there is a file and we aren't stripping the version, just get the
+ // name directly
+ if ( artifact.getFile() != null && !removeVersion )
+ {
+ destFileName = artifact.getFile().getName();
+ }
+ else
+ // if offline
+ {
+ String versionString = null;
+ if ( !removeVersion )
+ {
+ versionString = "-" + artifact.getVersion();
+ }
+ else
+ {
+ versionString = "";
+ }
+
+ String classifierString = "";
+
+ if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
+ {
+ classifierString = "-" + artifact.getClassifier();
+ }
+
+ destFileName = artifact.getArtifactId() + versionString + classifierString + "."
+ + artifact.getArtifactHandler().getExtension();
+ }
+ return destFileName;
+ }
+
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ConfigurationException.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ConfigurationException.java
new file mode 100644
index 0000000..0f84d4e
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ConfigurationException.java
@@ -0,0 +1,44 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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.
+ */
+
+/**
+ * ConfigurationException
+ *
+ * @author jesse
+ * @version $Id$
+ */
+public class ConfigurationException extends Exception
+{
+ public ConfigurationException( String message )
+ {
+ super(message);
+ }
+
+ public ConfigurationException( Throwable cause )
+ {
+ super(cause);
+ }
+
+ public ConfigurationException( String message, Throwable cause )
+ {
+ super(message, cause);
+ }
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java
new file mode 100644
index 0000000..3cd741e
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java
@@ -0,0 +1,140 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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 java.io.File;
+
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
+import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+
+/**
+ * Stub for {@link ExpressionEvaluator}
+ *
+ * @author jesse
+ * @version $Id$
+ */
+public class ResolverExpressionEvaluatorStub
+ implements ExpressionEvaluator
+{
+ /**
+ * @see org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#evaluate(java.lang.String)
+ */
+ public Object evaluate( String expr )
+ throws ExpressionEvaluationException
+ {
+
+ Object value = null;
+
+ if ( expr == null )
+ {
+ return null;
+ }
+
+ String expression = stripTokens( expr );
+
+ if ( expression.equals( expr ) )
+ {
+ int index = expr.indexOf( "${" );
+ if ( index >= 0 )
+ {
+ int lastIndex = expr.indexOf( "}", index );
+ if ( lastIndex >= 0 )
+ {
+ String retVal = expr.substring( 0, index );
+
+ if ( index > 0 && expr.charAt( index - 1 ) == '$' )
+ {
+ retVal += expr.substring( index + 1, lastIndex + 1 );
+ }
+ else
+ {
+ retVal += evaluate( expr.substring( index, lastIndex + 1 ) );
+ }
+
+ retVal += evaluate( expr.substring( lastIndex + 1 ) );
+ return retVal;
+ }
+ }
+
+ // Was not an expression
+ if ( expression.indexOf( "$$" ) > -1 )
+ {
+ return expression.replaceAll( "\\$\\$", "\\$" );
+ }
+ }
+
+ if ( "basedir".equals( expression ) )
+ {
+ return PlexusTestCase.getBasedir();
+ }
+ else if ( expression.startsWith( "basedir" ) )
+ {
+ int pathSeparator = expression.indexOf( "/" );
+
+ if ( pathSeparator > 0 )
+ {
+ value = PlexusTestCase.getBasedir() + expression.substring( pathSeparator );
+ }
+ else
+ {
+ System.out.println( "Got expression '" + expression + "' that was not recognised" );
+ }
+ return value;
+ }
+ else if ( "localRepository".equals( expression ) )
+ {
+ File localRepo = new File( PlexusTestCase.getBasedir(), "target/local-repo" );
+ return new DefaultArtifactRepository( "localRepository", "file://" + localRepo.getAbsolutePath(),
+ new DefaultRepositoryLayout() );
+ }
+ else
+ {
+ return expr;
+ }
+ }
+
+ private String stripTokens( String expr )
+ {
+ if ( expr.startsWith( "${" ) && expr.indexOf( "}" ) == expr.length() - 1 )
+ {
+ expr = expr.substring( 2, expr.length() - 1 );
+ }
+
+ return expr;
+ }
+
+ /**
+ * @see org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#alignToBaseDirectory(java.io.File)
+ */
+ public File alignToBaseDirectory( File file )
+ {
+ if ( file.getAbsolutePath().startsWith( PlexusTestCase.getBasedir() ) )
+ {
+ return file;
+ }
+ else
+ {
+ return new File( PlexusTestCase.getBasedir() + File.pathSeparator + file.getPath() );
+ }
+ }
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/SilentLog.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/SilentLog.java
new file mode 100644
index 0000000..94b8583
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/SilentLog.java
@@ -0,0 +1,195 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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.plugin.logging.Log;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * This logger implements both types of logs currently in use. It can be injected where needed
+ * to turn off logs during testing where they aren't desired.
+ * @author Brian Fox
+ * @version $Id: SilentLog.java 546355 2007-06-12 02:00:02Z brianf $
+ */
+public class SilentLog
+ implements Log, Logger
+{
+
+ public boolean isDebugEnabled()
+ {
+ return false;
+ }
+
+ public void debug( CharSequence content )
+ {
+ }
+
+ public void debug( CharSequence content, Throwable error )
+ {
+ }
+
+ public void debug( Throwable error )
+ {
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return false;
+ }
+
+ public void info( CharSequence content )
+ {
+ }
+
+ public void info( CharSequence content, Throwable error )
+ {
+ }
+
+ public void info( Throwable error )
+ {
+ }
+
+ public boolean isWarnEnabled()
+ {
+ return false;
+ }
+
+ public void warn( CharSequence content )
+ {
+ }
+
+ public void warn( CharSequence content, Throwable error )
+ {
+ }
+
+ public void warn( Throwable error )
+ {
+ }
+
+ public boolean isErrorEnabled()
+ {
+ return false;
+ }
+
+ public void error( CharSequence content )
+ {
+ }
+
+ public void error( CharSequence content, Throwable error )
+ {
+ }
+
+ public void error( Throwable error )
+ {
+ }
+
+ public void debug( String message )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void debug( String message, Throwable throwable )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void info( String message )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void info( String message, Throwable throwable )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void warn( String message )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void warn( String message, Throwable throwable )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void error( String message )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void error( String message, Throwable throwable )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void fatalError( String message )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void fatalError( String message, Throwable throwable )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isFatalErrorEnabled()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Logger getChildLogger( String name )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getThreshold()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.codehaus.plexus.logging.Logger#setThreshold(int)
+ */
+ public void setThreshold( int theThreshold )
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java
new file mode 100644
index 0000000..d939dd6
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java
@@ -0,0 +1,550 @@
+package org.apache.maven.plugin.testing.stubs;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Stub class for {@link Artifact} testing.
+ *
+ * @author jesse
+ * @version $Id$
+ */
+public class ArtifactStub
+ implements Artifact
+{
+ private String groupId;
+
+ private String artifactId;
+
+ private String version;
+
+ private String scope;
+
+ private String type;
+
+ private String classifier;
+
+ private File file;
+
+ private ArtifactRepository artifactRepository;
+
+ /**
+ * By default, return 0
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo( Object object )
+ {
+ return 0;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#getGroupId()
+ */
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#getVersion()
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#setVersion(java.lang.String)
+ */
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#getScope()
+ */
+ public String getScope()
+ {
+ return scope;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#getType()
+ */
+ public String getType()
+ {
+ return type;
+ }
+
+ /**
+ * Set a new type
+ *
+ * @param type
+ */
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#getClassifier()
+ */
+ public String getClassifier()
+ {
+ return classifier;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#hasClassifier()
+ */
+ public boolean hasClassifier()
+ {
+ return classifier != null;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#getFile()
+ */
+ public File getFile()
+ {
+ return file;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#setFile(java.io.File)
+ */
+ public void setFile( File file )
+ {
+ this.file = file;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getBaseVersion()
+ */
+ public String getBaseVersion()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setBaseVersion(java.lang.String)
+ */
+ public void setBaseVersion( String string )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getId()
+ */
+ public String getId()
+ {
+ return null;
+ }
+
+ /**
+ * By default, return groupId:artifactId:type:classifier.
+ *
+ * @see org.apache.maven.artifact.Artifact#getDependencyConflictId()
+ */
+ public String getDependencyConflictId()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append( getGroupId() );
+ buffer.append( ":" ).append( getArtifactId() );
+ buffer.append( ":" ).append( getType() );
+ buffer.append( ":" ).append( getClassifier() );
+
+ return buffer.toString();
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#addMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata)
+ */
+ public void addMetadata( ArtifactMetadata artifactMetadata )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getMetadataList()
+ */
+ public Collection getMetadataList()
+ {
+ return null;
+ }
+
+ /**
+ * Set a new artifact repository
+ *
+ * @see org.apache.maven.artifact.Artifact#setRepository(org.apache.maven.artifact.repository.ArtifactRepository)
+ */
+ public void setRepository( ArtifactRepository artifactRepository )
+ {
+ this.artifactRepository = artifactRepository;
+ }
+
+ /**
+ * Returns repository for artifact
+ *
+ * @see org.apache.maven.artifact.Artifact#getRepository()
+ */
+ public ArtifactRepository getRepository()
+ {
+ return artifactRepository;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#updateVersion(java.lang.String, org.apache.maven.artifact.repository.ArtifactRepository)
+ */
+ public void updateVersion( String string, ArtifactRepository artifactRepository )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getDownloadUrl()
+ */
+ public String getDownloadUrl()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setDownloadUrl(java.lang.String)
+ */
+ public void setDownloadUrl( String string )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getDependencyFilter()
+ */
+ public ArtifactFilter getDependencyFilter()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setDependencyFilter(org.apache.maven.artifact.resolver.filter.ArtifactFilter)
+ */
+ public void setDependencyFilter( ArtifactFilter artifactFilter )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getArtifactHandler()
+ */
+ public ArtifactHandler getArtifactHandler()
+ {
+ return null;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getDependencyTrail()
+ */
+ public List getDependencyTrail()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setDependencyTrail(java.util.List)
+ */
+ public void setDependencyTrail( List list )
+ {
+ // nop
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#setScope(java.lang.String)
+ */
+ public void setScope( String scope )
+ {
+ this.scope = scope;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getVersionRange()
+ */
+ public VersionRange getVersionRange()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setVersionRange(org.apache.maven.artifact.versioning.VersionRange)
+ */
+ public void setVersionRange( VersionRange versionRange )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#selectVersion(java.lang.String)
+ */
+ public void selectVersion( String string )
+ {
+ // nop
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#setGroupId(java.lang.String)
+ */
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ /**
+ * @see org.apache.maven.artifact.Artifact#setArtifactId(java.lang.String)
+ */
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ /**
+ * By default, return false.
+ *
+ * @see org.apache.maven.artifact.Artifact#isSnapshot()
+ */
+ public boolean isSnapshot()
+ {
+ return false;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setResolved(boolean)
+ */
+ public void setResolved( boolean b )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return false.
+ *
+ * @see org.apache.maven.artifact.Artifact#isResolved()
+ */
+ public boolean isResolved()
+ {
+ return false;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setResolvedVersion(java.lang.String)
+ */
+ public void setResolvedVersion( String string )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setArtifactHandler(org.apache.maven.artifact.handler.ArtifactHandler)
+ */
+ public void setArtifactHandler( ArtifactHandler artifactHandler )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return false.
+ *
+ * @see org.apache.maven.artifact.Artifact#isRelease()
+ */
+ public boolean isRelease()
+ {
+ return false;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setRelease(boolean)
+ */
+ public void setRelease( boolean b )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getAvailableVersions()
+ */
+ public List getAvailableVersions()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.artifact.Artifact#setAvailableVersions(java.util.List)
+ */
+ public void setAvailableVersions( List list )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return false.
+ *
+ * @see org.apache.maven.artifact.Artifact#isOptional()
+ */
+ public boolean isOptional()
+ {
+ return false;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @param b
+ */
+ public void setOptional( boolean b )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.artifact.Artifact#getSelectedVersion()
+ */
+ public ArtifactVersion getSelectedVersion()
+ throws OverConstrainedVersionException
+ {
+ return null;
+ }
+
+ /**
+ * By default, return false.
+ *
+ * @see org.apache.maven.artifact.Artifact#isSelectedVersionKnown()
+ */
+ public boolean isSelectedVersionKnown()
+ throws OverConstrainedVersionException
+ {
+ return false;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ if ( getGroupId() != null )
+ {
+ sb.append( getGroupId() );
+ sb.append( ":" );
+ }
+ appendArtifactTypeClassifierString( sb );
+ if ( version != null )
+ {
+ sb.append( ":" );
+ sb.append( getVersion() );
+ }
+ if ( scope != null )
+ {
+ sb.append( ":" );
+ sb.append( scope );
+ }
+ return sb.toString();
+ }
+
+ private void appendArtifactTypeClassifierString( StringBuffer sb )
+ {
+ sb.append( getArtifactId() );
+ sb.append( ":" );
+ sb.append( getType() );
+ if ( hasClassifier() )
+ {
+ sb.append( ":" );
+ sb.append( getClassifier() );
+ }
+ }
+
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/DefaultArtifactHandlerStub.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/DefaultArtifactHandlerStub.java
new file mode 100644
index 0000000..f2a5f0c
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/DefaultArtifactHandlerStub.java
@@ -0,0 +1,192 @@
+package org.apache.maven.plugin.testing.stubs;
+
+/*
+ * 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.artifact.handler.ArtifactHandler;
+
+/**
+ * minimal artifact handler used by the stub factory to create unpackable archives.
+ * @author Brian Fox
+ *
+ */
+public class DefaultArtifactHandlerStub
+ implements ArtifactHandler
+{
+ private String extension;
+
+ private String type;
+
+ private String classifier;
+
+ private String directory;
+
+ private String packaging;
+
+ private boolean includesDependencies;
+
+ private String language;
+
+ private boolean addedToClasspath;
+
+ public DefaultArtifactHandlerStub( String t, String c )
+ {
+ type = t;
+ classifier = c;
+ if ( t.equals( "test-jar" ) )
+ {
+ extension = "jar";
+ }
+
+ }
+
+ public DefaultArtifactHandlerStub( String type )
+ {
+ this.type = type;
+ }
+
+ public String getExtension()
+ {
+ if ( extension == null )
+ {
+ extension = type;
+ }
+ return extension;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getClassifier()
+ {
+ return classifier;
+ }
+
+ public String getDirectory()
+ {
+ if ( directory == null )
+ {
+ directory = getPackaging() + "s";
+ }
+ return directory;
+ }
+
+ public String getPackaging()
+ {
+ if ( packaging == null )
+ {
+ packaging = type;
+ }
+ return packaging;
+ }
+
+ public boolean isIncludesDependencies()
+ {
+ return includesDependencies;
+ }
+
+ public String getLanguage()
+ {
+ if ( language == null )
+ {
+ language = "none";
+ }
+
+ return language;
+ }
+
+ public boolean isAddedToClasspath()
+ {
+ return addedToClasspath;
+ }
+
+ /**
+ * @param theAddedToClasspath
+ * The addedToClasspath to set.
+ */
+ public void setAddedToClasspath( boolean theAddedToClasspath )
+ {
+ this.addedToClasspath = theAddedToClasspath;
+ }
+
+ /**
+ * @param theClassifier
+ * The classifier to set.
+ */
+ public void setClassifier( String theClassifier )
+ {
+ this.classifier = theClassifier;
+ }
+
+ /**
+ * @param theDirectory
+ * The directory to set.
+ */
+ public void setDirectory( String theDirectory )
+ {
+ this.directory = theDirectory;
+ }
+
+ /**
+ * @param theExtension
+ * The extension to set.
+ */
+ public void setExtension( String theExtension )
+ {
+ this.extension = theExtension;
+ }
+
+ /**
+ * @param theIncludesDependencies
+ * The includesDependencies to set.
+ */
+ public void setIncludesDependencies( boolean theIncludesDependencies )
+ {
+ this.includesDependencies = theIncludesDependencies;
+ }
+
+ /**
+ * @param theLanguage
+ * The language to set.
+ */
+ public void setLanguage( String theLanguage )
+ {
+ this.language = theLanguage;
+ }
+
+ /**
+ * @param thePackaging
+ * The packaging to set.
+ */
+ public void setPackaging( String thePackaging )
+ {
+ this.packaging = thePackaging;
+ }
+
+ /**
+ * @param theType
+ * The type to set.
+ */
+ public void setType( String theType )
+ {
+ this.type = theType;
+ }
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java
new file mode 100644
index 0000000..be9d9a9
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java
@@ -0,0 +1,1634 @@
+package org.apache.maven.plugin.testing.stubs;
+
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Developer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.License;
+import org.apache.maven.model.MailingList;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Organization;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.Prerequisites;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.Scm;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Very simple stub of MavenProject object, going to take a lot of work to make it
+ * useful as a stub though.
+ *
+ * @author jesse
+ * @version $Id$
+ */
+public class MavenProjectStub
+ extends MavenProject
+{
+ private String groupId;
+
+ private String artifactId;
+
+ private String name;
+
+ private Model model;
+
+ private MavenProject parent;
+
+ private File file;
+
+ private List collectedProjects;
+
+ private List attachedArtifacts;
+
+ private List compileSourceRoots;
+
+ private List testCompileSourceRoots;
+
+ private List scriptSourceRoots;
+
+ private List pluginArtifactRepositories;
+
+ private ArtifactRepository releaseArtifactRepository;
+
+ private ArtifactRepository snapshotArtifactRepository;
+
+ private List activeProfiles;
+
+ private Set dependencyArtifacts;
+
+ private Artifact artifact;
+
+ private Map artifactMap;
+
+ private Model originalModel;
+
+ private Map pluginArtifactMap;
+
+ private Map reportArtifactMap;
+
+ private Map extensionArtifactMap;
+
+ private Map projectReferences;
+
+ private Build buildOverlay;
+
+ private boolean executionRoot;
+
+ private List compileArtifacts;
+
+ private List compileDependencies;
+
+ private List systemDependencies;
+
+ private List testClasspathElements;
+
+ private List testDependencies;
+
+ private List systemClasspathElements;
+
+ private List systemArtifacts;
+
+ private List testArtifacts;
+
+ private List runtimeArtifacts;
+
+ private List runtimeDependencies;
+
+ private List runtimeClasspathElements;
+
+ private String modelVersion;
+
+ private String packaging;
+
+ private String inceptionYear;
+
+ private String url;
+
+ private String description;
+
+ private String version;
+
+ private String defaultGoal;
+
+ private List licenses;
+
+ /**
+ * Default constructor
+ */
+ public MavenProjectStub()
+ {
+ this( (Model) new Model() );
+ }
+
+ // kinda dangerous...
+ public MavenProjectStub( Model model )
+ {
+ // super(model);
+ super( (Model) null );
+ this.model = model;
+ }
+
+ // kinda dangerous...
+ public MavenProjectStub( MavenProject project )
+ {
+ //super(project);
+ super( (Model) null );
+ }
+
+ /**
+ * @param mavenProject
+ * @return an empty String
+ * @throws IOException if any
+ */
+ public String getModulePathAdjustment( MavenProject mavenProject )
+ throws IOException
+ {
+ return "";
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getArtifact()
+ */
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setArtifact(org.apache.maven.artifact.Artifact)
+ */
+ public void setArtifact( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getModel()
+ */
+ public Model getModel()
+ {
+ return model;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getParent()
+ */
+ public MavenProject getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setParent(org.apache.maven.project.MavenProject)
+ */
+ public void setParent( MavenProject mavenProject )
+ {
+ this.parent = mavenProject;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setRemoteArtifactRepositories(java.util.List)
+ */
+ public void setRemoteArtifactRepositories( List list )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getRemoteArtifactRepositories()
+ */
+ public List getRemoteArtifactRepositories()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#hasParent()
+ */
+ public boolean hasParent()
+ {
+ if ( parent != null )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getFile()
+ */
+ public File getFile()
+ {
+ return file;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setFile(java.io.File)
+ */
+ public void setFile( File file )
+ {
+ this.file = file;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getBasedir()
+ */
+ public File getBasedir()
+ {
+ return new File( PlexusTestCase.getBasedir() );
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setDependencies(java.util.List)
+ */
+ public void setDependencies( List list )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getDependencies()
+ */
+ public List getDependencies()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getDependencyManagement()
+ */
+ public DependencyManagement getDependencyManagement()
+ {
+ return null;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#addCompileSourceRoot(java.lang.String)
+ */
+ public void addCompileSourceRoot( String string )
+ {
+ if ( compileSourceRoots == null )
+ {
+ compileSourceRoots = Collections.singletonList( string );
+ }
+ else
+ {
+ compileSourceRoots.add( string );
+ }
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#addScriptSourceRoot(java.lang.String)
+ */
+ public void addScriptSourceRoot( String string )
+ {
+ if ( scriptSourceRoots == null )
+ {
+ scriptSourceRoots = Collections.singletonList( string );
+ }
+ else
+ {
+ scriptSourceRoots.add( string );
+ }
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#addTestCompileSourceRoot(java.lang.String)
+ */
+ public void addTestCompileSourceRoot( String string )
+ {
+ if ( testCompileSourceRoots == null )
+ {
+ testCompileSourceRoots = Collections.singletonList( string );
+ }
+ else
+ {
+ testCompileSourceRoots.add( string );
+ }
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getCompileSourceRoots()
+ */
+ public List getCompileSourceRoots()
+ {
+ return compileSourceRoots;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getScriptSourceRoots()
+ */
+ public List getScriptSourceRoots()
+ {
+ return scriptSourceRoots;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getTestCompileSourceRoots()
+ */
+ public List getTestCompileSourceRoots()
+ {
+ return testCompileSourceRoots;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getCompileClasspathElements()
+ */
+ public List getCompileClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return compileSourceRoots;
+ }
+
+ /**
+ * @param compileArtifacts
+ */
+ public void setCompileArtifacts( List compileArtifacts )
+ {
+ this.compileArtifacts = compileArtifacts;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getCompileArtifacts()
+ */
+ public List getCompileArtifacts()
+ {
+ return compileArtifacts;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getCompileDependencies()
+ */
+ public List getCompileDependencies()
+ {
+ return compileDependencies;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getTestClasspathElements()
+ */
+ public List getTestClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return testClasspathElements;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getTestArtifacts()
+ */
+ public List getTestArtifacts()
+ {
+ return testArtifacts;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getTestDependencies()
+ */
+ public List getTestDependencies()
+ {
+ return testDependencies;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getRuntimeClasspathElements()
+ */
+ public List getRuntimeClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return runtimeClasspathElements;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getRuntimeArtifacts()
+ */
+ public List getRuntimeArtifacts()
+ {
+ return runtimeArtifacts;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getRuntimeDependencies()
+ */
+ public List getRuntimeDependencies()
+ {
+ return runtimeDependencies;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getSystemClasspathElements()
+ */
+ public List getSystemClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return systemClasspathElements;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getSystemArtifacts()
+ */
+ public List getSystemArtifacts()
+ {
+ return systemArtifacts;
+ }
+
+ /**
+ * @param runtimeClasspathElements
+ */
+ public void setRuntimeClasspathElements( List runtimeClasspathElements )
+ {
+ this.runtimeClasspathElements = runtimeClasspathElements;
+ }
+
+ /**
+ * @param attachedArtifacts
+ */
+ public void setAttachedArtifacts( List attachedArtifacts )
+ {
+ this.attachedArtifacts = attachedArtifacts;
+ }
+
+ /**
+ * @param compileSourceRoots
+ */
+ public void setCompileSourceRoots( List compileSourceRoots )
+ {
+ this.compileSourceRoots = compileSourceRoots;
+ }
+
+ /**
+ * @param testCompileSourceRoots
+ */
+ public void setTestCompileSourceRoots( List testCompileSourceRoots )
+ {
+ this.testCompileSourceRoots = testCompileSourceRoots;
+ }
+
+ /**
+ * @param scriptSourceRoots
+ */
+ public void setScriptSourceRoots( List scriptSourceRoots )
+ {
+ this.scriptSourceRoots = scriptSourceRoots;
+ }
+
+ /**
+ * @param artifactMap
+ */
+ public void setArtifactMap( Map artifactMap )
+ {
+ this.artifactMap = artifactMap;
+ }
+
+ /**
+ * @param pluginArtifactMap
+ */
+ public void setPluginArtifactMap( Map pluginArtifactMap )
+ {
+ this.pluginArtifactMap = pluginArtifactMap;
+ }
+
+ /**
+ * @param reportArtifactMap
+ */
+ public void setReportArtifactMap( Map reportArtifactMap )
+ {
+ this.reportArtifactMap = reportArtifactMap;
+ }
+
+ /**
+ * @param extensionArtifactMap
+ */
+ public void setExtensionArtifactMap( Map extensionArtifactMap )
+ {
+ this.extensionArtifactMap = extensionArtifactMap;
+ }
+
+ /**
+ * @param projectReferences
+ */
+ public void setProjectReferences( Map projectReferences )
+ {
+ this.projectReferences = projectReferences;
+ }
+
+ /**
+ * @param buildOverlay
+ */
+ public void setBuildOverlay( Build buildOverlay )
+ {
+ this.buildOverlay = buildOverlay;
+ }
+
+ /**
+ * @param compileDependencies
+ */
+ public void setCompileDependencies( List compileDependencies )
+ {
+ this.compileDependencies = compileDependencies;
+ }
+
+ /**
+ * @param systemDependencies
+ */
+ public void setSystemDependencies( List systemDependencies )
+ {
+ this.systemDependencies = systemDependencies;
+ }
+
+ /**
+ * @param testClasspathElements
+ */
+ public void setTestClasspathElements( List testClasspathElements )
+ {
+ this.testClasspathElements = testClasspathElements;
+ }
+
+ /**
+ * @param testDependencies
+ */
+ public void setTestDependencies( List testDependencies )
+ {
+ this.testDependencies = testDependencies;
+ }
+
+ /**
+ * @param systemClasspathElements
+ */
+ public void setSystemClasspathElements( List systemClasspathElements )
+ {
+ this.systemClasspathElements = systemClasspathElements;
+ }
+
+ /**
+ * @param systemArtifacts
+ */
+ public void setSystemArtifacts( List systemArtifacts )
+ {
+ this.systemArtifacts = systemArtifacts;
+ }
+
+ /**
+ * @param testArtifacts
+ */
+ public void setTestArtifacts( List testArtifacts )
+ {
+ this.testArtifacts = testArtifacts;
+ }
+
+ /**
+ * @param runtimeArtifacts
+ */
+ public void setRuntimeArtifacts( List runtimeArtifacts )
+ {
+ this.runtimeArtifacts = runtimeArtifacts;
+ }
+
+ /**
+ * @param runtimeDependencies
+ */
+ public void setRuntimeDependencies( List runtimeDependencies )
+ {
+ this.runtimeDependencies = runtimeDependencies;
+ }
+
+ /**
+ * @param model
+ */
+ public void setModel( Model model )
+ {
+ this.model = model;
+ }
+
+ public List getSystemDependencies()
+ {
+ return systemDependencies;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setModelVersion(java.lang.String)
+ */
+ public void setModelVersion( String string )
+ {
+ this.modelVersion = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getModelVersion()
+ */
+ public String getModelVersion()
+ {
+ return modelVersion;
+ }
+
+ /**
+ * By default, return an empty String.
+ *
+ * @see org.apache.maven.project.MavenProject#getId()
+ */
+ public String getId()
+ {
+ return "";
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setGroupId(java.lang.String)
+ */
+ public void setGroupId( String string )
+ {
+ this.groupId = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getGroupId()
+ */
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setArtifactId(java.lang.String)
+ */
+ public void setArtifactId( String string )
+ {
+ this.artifactId = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getArtifactId()
+ */
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setName(java.lang.String)
+ */
+ public void setName( String string )
+ {
+ this.name = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setVersion(java.lang.String)
+ */
+ public void setVersion( String string )
+ {
+ this.version = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getVersion()
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getPackaging()
+ */
+ public String getPackaging()
+ {
+ return packaging;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setPackaging(java.lang.String)
+ */
+ public void setPackaging( String string )
+ {
+ this.packaging = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setInceptionYear(java.lang.String)
+ */
+ public void setInceptionYear( String string )
+ {
+ this.inceptionYear = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getInceptionYear()
+ */
+ public String getInceptionYear()
+ {
+ return inceptionYear;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setUrl(java.lang.String)
+ */
+ public void setUrl( String string )
+ {
+ this.url = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getUrl()
+ */
+ public String getUrl()
+ {
+ return url;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getPrerequisites()
+ */
+ public Prerequisites getPrerequisites()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setIssueManagement(org.apache.maven.model.IssueManagement)
+ */
+ public void setIssueManagement( IssueManagement issueManagement )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getCiManagement()
+ */
+ public CiManagement getCiManagement()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setCiManagement(org.apache.maven.model.CiManagement)
+ */
+ public void setCiManagement( CiManagement ciManagement )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getIssueManagement()
+ */
+ public IssueManagement getIssueManagement()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setDistributionManagement(org.apache.maven.model.DistributionManagement)
+ */
+ public void setDistributionManagement( DistributionManagement distributionManagement )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getDistributionManagement()
+ */
+ public DistributionManagement getDistributionManagement()
+ {
+ return null;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setDescription(java.lang.String)
+ */
+ public void setDescription( String string )
+ {
+ this.description = string;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getDescription()
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setOrganization(org.apache.maven.model.Organization)
+ */
+ public void setOrganization( Organization organization )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getOrganization()
+ */
+ public Organization getOrganization()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setScm(org.apache.maven.model.Scm)
+ */
+ public void setScm( Scm scm )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getScm()
+ */
+ public Scm getScm()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setMailingLists(java.util.List)
+ */
+ public void setMailingLists( List list )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getMailingLists()
+ */
+ public List getMailingLists()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addMailingList(org.apache.maven.model.MailingList)
+ */
+ public void addMailingList( MailingList mailingList )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setDevelopers(java.util.List)
+ */
+ public void setDevelopers( List list )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getDevelopers()
+ */
+ public List getDevelopers()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addDeveloper(org.apache.maven.model.Developer)
+ */
+ public void addDeveloper( Developer developer )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setContributors(java.util.List)
+ */
+ public void setContributors( List list )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getContributors()
+ */
+ public List getContributors()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addContributor(org.apache.maven.model.Contributor)
+ */
+ public void addContributor( Contributor contributor )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setBuild(org.apache.maven.model.Build)
+ */
+ public void setBuild( Build build )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getBuild()
+ */
+ public Build getBuild()
+ {
+ return null;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getResources()
+ */
+ public List getResources()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getTestResources()
+ */
+ public List getTestResources()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addResource(org.apache.maven.model.Resource)
+ */
+ public void addResource( Resource resource )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addTestResource(org.apache.maven.model.Resource)
+ */
+ public void addTestResource( Resource resource )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setReporting(org.apache.maven.model.Reporting)
+ */
+ public void setReporting( Reporting reporting )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getReporting()
+ */
+ public Reporting getReporting()
+ {
+ return null;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setLicenses(java.util.List)
+ */
+ public void setLicenses( List licenses )
+ {
+ this.licenses = licenses;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getLicenses()
+ */
+ public List getLicenses()
+ {
+ return licenses;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addLicense(org.apache.maven.model.License)
+ */
+ public void addLicense( License license )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setArtifacts(java.util.Set)
+ */
+ public void setArtifacts( Set set )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_SET.
+ *
+ * @see org.apache.maven.project.MavenProject#getArtifacts()
+ */
+ public Set getArtifacts()
+ {
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_MAP.
+ *
+ * @see org.apache.maven.project.MavenProject#getArtifactMap()
+ */
+ public Map getArtifactMap()
+ {
+ return Collections.EMPTY_MAP;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setPluginArtifacts(java.util.Set)
+ */
+ public void setPluginArtifacts( Set set )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_SET.
+ *
+ * @see org.apache.maven.project.MavenProject#getPluginArtifacts()
+ */
+ public Set getPluginArtifacts()
+ {
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_MAP.
+ *
+ * @see org.apache.maven.project.MavenProject#getPluginArtifactMap()
+ */
+ public Map getPluginArtifactMap()
+ {
+ return Collections.EMPTY_MAP;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setReportArtifacts(java.util.Set)
+ */
+ public void setReportArtifacts( Set set )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_SET.
+ *
+ * @see org.apache.maven.project.MavenProject#getReportArtifacts()
+ */
+ public Set getReportArtifacts()
+ {
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_MAP.
+ *
+ * @see org.apache.maven.project.MavenProject#getReportArtifactMap()
+ */
+ public Map getReportArtifactMap()
+ {
+ return Collections.EMPTY_MAP;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setExtensionArtifacts(java.util.Set)
+ */
+ public void setExtensionArtifacts( Set set )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return Collections.EMPTY_SET.
+ *
+ * @see org.apache.maven.project.MavenProject#getExtensionArtifacts()
+ */
+ public Set getExtensionArtifacts()
+ {
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_MAP.
+ *
+ * @see org.apache.maven.project.MavenProject#getExtensionArtifactMap()
+ */
+ public Map getExtensionArtifactMap()
+ {
+ return Collections.EMPTY_MAP;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setParentArtifact(org.apache.maven.artifact.Artifact)
+ */
+ public void setParentArtifact( Artifact artifact )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getParentArtifact()
+ */
+ public Artifact getParentArtifact()
+ {
+ return null;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getRepositories()
+ */
+ public List getRepositories()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getReportPlugins()
+ */
+ public List getReportPlugins()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getBuildPlugins()
+ */
+ public List getBuildPlugins()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getModules()
+ */
+ public List getModules()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getPluginManagement()
+ */
+ public PluginManagement getPluginManagement()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addPlugin(org.apache.maven.model.Plugin)
+ */
+ public void addPlugin( Plugin plugin )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @param plugin
+ */
+ public void injectPluginManagementInfo( Plugin plugin )
+ {
+ // nop
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getCollectedProjects()
+ */
+ public List getCollectedProjects()
+ {
+ return collectedProjects;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setCollectedProjects(java.util.List)
+ */
+ public void setCollectedProjects( List list )
+ {
+ this.collectedProjects = list;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setPluginArtifactRepositories(java.util.List)
+ */
+ public void setPluginArtifactRepositories( List list )
+ {
+ this.pluginArtifactRepositories = list;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getPluginArtifactRepositories()
+ */
+ public List getPluginArtifactRepositories()
+ {
+ return pluginArtifactRepositories;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getDistributionManagementArtifactRepository()
+ */
+ public ArtifactRepository getDistributionManagementArtifactRepository()
+ {
+ return null;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getPluginRepositories()
+ */
+ public List getPluginRepositories()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setActiveProfiles(java.util.List)
+ */
+ public void setActiveProfiles( List list )
+ {
+ activeProfiles = list;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getActiveProfiles()
+ */
+ public List getActiveProfiles()
+ {
+ return activeProfiles;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact)
+ */
+ public void addAttachedArtifact( Artifact artifact )
+ {
+ if ( attachedArtifacts == null )
+ {
+ this.attachedArtifacts = Collections.singletonList( artifact );
+ }
+ else
+ {
+ attachedArtifacts.add( artifact );
+ }
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getAttachedArtifacts()
+ */
+ public List getAttachedArtifacts()
+ {
+ return attachedArtifacts;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getGoalConfiguration(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public Xpp3Dom getGoalConfiguration( String string, String string1, String string2, String string3 )
+ {
+ return null;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getReportConfiguration(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public Xpp3Dom getReportConfiguration( String string, String string1, String string2 )
+ {
+ return null;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#getExecutionProject()
+ */
+ public MavenProject getExecutionProject()
+ {
+ return null;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#setExecutionProject(org.apache.maven.project.MavenProject)
+ */
+ public void setExecutionProject( MavenProject mavenProject )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#writeModel(java.io.Writer)
+ */
+ public void writeModel( Writer writer )
+ throws IOException
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#writeOriginalModel(java.io.Writer)
+ */
+ public void writeOriginalModel( Writer writer )
+ throws IOException
+ {
+ // nop
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getDependencyArtifacts()
+ */
+ public Set getDependencyArtifacts()
+ {
+ return dependencyArtifacts;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setDependencyArtifacts(java.util.Set)
+ */
+ public void setDependencyArtifacts( Set set )
+ {
+ this.dependencyArtifacts = set;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setReleaseArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository)
+ */
+ public void setReleaseArtifactRepository( ArtifactRepository artifactRepository )
+ {
+ this.releaseArtifactRepository = artifactRepository;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setSnapshotArtifactRepository(org.apache.maven.artifact.repository.ArtifactRepository)
+ */
+ public void setSnapshotArtifactRepository( ArtifactRepository artifactRepository )
+ {
+ this.snapshotArtifactRepository = artifactRepository;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setOriginalModel(org.apache.maven.model.Model)
+ */
+ public void setOriginalModel( Model model )
+ {
+ this.originalModel = model;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getOriginalModel()
+ */
+ public Model getOriginalModel()
+ {
+ return originalModel;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getBuildExtensions()
+ */
+ public List getBuildExtensions()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_SET.
+ *
+ * @see org.apache.maven.project.MavenProject#createArtifacts(org.apache.maven.artifact.factory.ArtifactFactory, java.lang.String, org.apache.maven.artifact.resolver.filter.ArtifactFilter)
+ */
+ public Set createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter )
+ throws InvalidDependencyVersionException
+ {
+ return Collections.EMPTY_SET;
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#addProjectReference(org.apache.maven.project.MavenProject)
+ */
+ public void addProjectReference( MavenProject mavenProject )
+ {
+ // nop
+ }
+
+ /**
+ * By default, do nothing.
+ *
+ * @see org.apache.maven.project.MavenProject#attachArtifact(java.lang.String, java.lang.String, java.io.File)
+ */
+ public void attachArtifact( String string, String string1, File file )
+ {
+ // nop
+ }
+
+ /**
+ * By default, return a new instance of Properties.
+ *
+ * @see org.apache.maven.project.MavenProject#getProperties()
+ */
+ public Properties getProperties()
+ {
+ return new Properties();
+ }
+
+ /**
+ * By default, return Collections.EMPTY_LIST.
+ *
+ * @see org.apache.maven.project.MavenProject#getFilters()
+ */
+ public List getFilters()
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * By default, return Collections.EMPTY_MAP.
+ *
+ * @see org.apache.maven.project.MavenProject#getProjectReferences()
+ */
+ public Map getProjectReferences()
+ {
+ return Collections.EMPTY_MAP;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#isExecutionRoot()
+ */
+ public boolean isExecutionRoot()
+ {
+ return executionRoot;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#setExecutionRoot(boolean)
+ */
+ public void setExecutionRoot( boolean b )
+ {
+ this.executionRoot = b;
+ }
+
+ /**
+ * @see org.apache.maven.project.MavenProject#getDefaultGoal()
+ */
+ public String getDefaultGoal()
+ {
+ return defaultGoal;
+ }
+
+ /**
+ * By default, return null.
+ *
+ * @see org.apache.maven.project.MavenProject#replaceWithActiveArtifact(org.apache.maven.artifact.Artifact)
+ */
+ public Artifact replaceWithActiveArtifact( Artifact artifact )
+ {
+ return null;
+ }
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java
new file mode 100644
index 0000000..e6deeef
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java
@@ -0,0 +1,113 @@
+package org.apache.maven.plugin.testing.stubs;
+
+/*
+ * 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 java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactCollector;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ResolutionNode;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
+/**
+ *
+ * @author Brian Fox
+ *
+ */
+public class StubArtifactCollector
+ implements ArtifactCollector
+{
+
+ /**
+ *
+ */
+ public StubArtifactCollector()
+ {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.maven.artifact.resolver.ArtifactCollector#collect(java.util.Set,
+ * org.apache.maven.artifact.Artifact,
+ * org.apache.maven.artifact.repository.ArtifactRepository,
+ * java.util.List,
+ * org.apache.maven.artifact.metadata.ArtifactMetadataSource,
+ * org.apache.maven.artifact.resolver.filter.ArtifactFilter,
+ * java.util.List)
+ */
+ public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact,
+ ArtifactRepository theLocalRepository, List theRemoteRepositories,
+ ArtifactMetadataSource theSource, ArtifactFilter theFilter,
+ List theListeners )
+ throws ArtifactResolutionException
+ {
+ Set nodes = new HashSet();
+ ArtifactResolutionResult arr = new ArtifactResolutionResult();
+
+ Iterator iter = theArtifacts.iterator();
+ while ( iter.hasNext() )
+ {
+ nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) );
+ }
+ arr.setArtifactResolutionNodes( nodes );
+ return arr;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.maven.artifact.resolver.ArtifactCollector#collect(java.util.Set,
+ * org.apache.maven.artifact.Artifact, java.util.Map,
+ * org.apache.maven.artifact.repository.ArtifactRepository,
+ * java.util.List,
+ * org.apache.maven.artifact.metadata.ArtifactMetadataSource,
+ * org.apache.maven.artifact.resolver.filter.ArtifactFilter,
+ * java.util.List)
+ */
+ public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact, Map theManagedVersions,
+ ArtifactRepository theLocalRepository, List theRemoteRepositories,
+ ArtifactMetadataSource theSource, ArtifactFilter theFilter,
+ List theListeners )
+ throws ArtifactResolutionException
+ {
+ Set nodes = new HashSet();
+ ArtifactResolutionResult arr = new ArtifactResolutionResult();
+
+ Iterator iter = theArtifacts.iterator();
+ while ( iter.hasNext() )
+ {
+ nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) );
+ }
+ arr.setArtifactResolutionNodes( nodes );
+ return arr;
+ }
+
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java
new file mode 100644
index 0000000..b5ea8fb
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java
@@ -0,0 +1,124 @@
+package org.apache.maven.plugin.testing.stubs;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+
+/**
+ *
+ * @author Brian Fox
+ *
+ */
+public class StubArtifactRepository
+ implements ArtifactRepository
+{
+ String baseDir = null;
+
+ public StubArtifactRepository( String dir )
+ {
+ baseDir = dir;
+ }
+
+ public String pathOf( Artifact artifact )
+ {
+ return artifact.getId();
+ }
+
+ public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+ {
+ return metadata.getLocalFilename( repository );
+ }
+
+ public String getUrl()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getBasedir()
+ {
+ return baseDir;
+ }
+
+ public String getProtocol()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getId()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactRepositoryPolicy getSnapshots()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactRepositoryPolicy getReleases()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactRepositoryLayout getLayout()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getKey()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isUniqueVersion()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setBlacklisted( boolean blackListed )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isBlacklisted()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java
new file mode 100644
index 0000000..641d091
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java
@@ -0,0 +1,162 @@
+package org.apache.maven.plugin.testing.stubs;
+
+/*
+ * 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 java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+
+/**
+ * Stub resolver. The constructor allows the specification of the exception to throw so that handling can be tested too.
+ * @author Brian Fox
+ *
+ */
+public class StubArtifactResolver
+ implements ArtifactResolver
+{
+
+ boolean throwArtifactResolutionException;
+
+ boolean throwArtifactNotFoundException;
+
+ ArtifactStubFactory factory;
+
+ public StubArtifactResolver( ArtifactStubFactory factory, boolean throwArtifactResolutionException,
+ boolean throwArtifactNotFoundException )
+ {
+ this.throwArtifactNotFoundException = throwArtifactNotFoundException;
+ this.throwArtifactResolutionException = throwArtifactResolutionException;
+ this.factory = factory;
+ }
+
+ /*
+ * Creates dummy file and sets it in the artifact to simulate resolution
+ * (non-Javadoc)
+ *
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolve(org.apache.maven.artifact.Artifact,
+ * java.util.List,
+ * org.apache.maven.artifact.repository.ArtifactRepository)
+ */
+ public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ if ( !this.throwArtifactNotFoundException && !this.throwArtifactResolutionException )
+ {
+ try
+ {
+ if ( factory != null )
+ {
+ factory.setArtifactFile( artifact );
+ }
+ }
+ catch ( IOException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ if ( throwArtifactResolutionException )
+ {
+ throw new ArtifactResolutionException( "Catch!", artifact );
+ }
+ else
+ {
+ throw new ArtifactNotFoundException( "Catch!", artifact );
+ }
+ }
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
+ List remoteRepositories, ArtifactRepository localRepository,
+ ArtifactMetadataSource source )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
+ List remoteRepositories, ArtifactRepository localRepository,
+ ArtifactMetadataSource source, List listeners )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
+ ArtifactRepository localRepository, List remoteRepositories,
+ ArtifactMetadataSource source, ArtifactFilter filter )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
+ Map managedVersions, ArtifactRepository localRepository,
+ List remoteRepositories, ArtifactMetadataSource source )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
+ Map managedVersions, ArtifactRepository localRepository,
+ List remoteRepositories, ArtifactMetadataSource source,
+ ArtifactFilter filter )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact,
+ Map managedVersions, ArtifactRepository localRepository,
+ List remoteRepositories, ArtifactMetadataSource source,
+ ArtifactFilter filter, List listeners )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/maven-plugin-testing-harness/src/main/resources/META-INF/plexus/components.xml b/maven-plugin-testing-harness/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000..915d02a
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+ org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator
+ stub-evaluator
+ org.apache.maven.plugin.testing.StubResolverExpressionEvaluator
+
+
+ org.codehaus.plexus.PlexusContainer
+ container
+
+
+
+
+ org.apache.maven.artifact.Artifact
+ stub
+ org.apache.maven.plugin.testing.stubs.StubArtifact
+
+
+
\ No newline at end of file
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorMojo.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorMojo.java
new file mode 100644
index 0000000..a884f07
--- /dev/null
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorMojo.java
@@ -0,0 +1,63 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author Edwin Punzalan
+ * @version $Id$
+ */
+public class ExpressionEvaluatorMojo
+ extends AbstractMojo
+{
+ private String basedir;
+
+ private ArtifactRepository localRepository;
+
+ private String workdir;
+
+ public void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( StringUtils.isEmpty( basedir ) )
+ {
+ throw new MojoExecutionException( "basedir was not injected." );
+ }
+
+ if ( localRepository == null )
+ {
+ throw new MojoExecutionException( "localRepository was not injected." );
+ }
+
+ if ( StringUtils.isEmpty( workdir ) )
+ {
+ throw new MojoExecutionException( "workdir was not injected." );
+ }
+ else if ( !workdir.startsWith( basedir ) )
+ {
+ throw new MojoExecutionException( "workdir does not start with basedir." );
+ }
+ }
+}
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java
new file mode 100644
index 0000000..51d2b94
--- /dev/null
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java
@@ -0,0 +1,83 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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.plugin.MojoExecutionException;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+
+import java.io.StringReader;
+
+/**
+ * @author Edwin Punzalan
+ * @version $Id$
+ */
+public class ExpressionEvaluatorTest
+ extends AbstractMojoTestCase
+{
+ private Xpp3Dom pomDom;
+
+ private PlexusConfiguration pluginConfiguration;
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ StringBuffer pom = new StringBuffer();
+
+ pom.append( "" ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( " maven-test-mojo" ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( " ${basedir}" ).append( "\n" );
+ pom.append( " ${basedir}/workDirectory" ).append( "\n" );
+ pom.append( " ${localRepository}" ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( " " ).append( "\n" );
+ pom.append( "" ).append( "\n" );
+
+ pomDom = Xpp3DomBuilder.build( new StringReader( pom.toString() ) );
+
+ pluginConfiguration = extractPluginConfiguration( "maven-test-mojo", pomDom );
+ }
+
+ public void testInjection()
+ throws Exception
+ {
+ ExpressionEvaluatorMojo mojo = new ExpressionEvaluatorMojo();
+
+ mojo = (ExpressionEvaluatorMojo) configureMojo( mojo, pluginConfiguration );
+
+ try
+ {
+ mojo.execute();
+ }
+ catch ( MojoExecutionException e )
+ {
+ fail( e.getMessage() );
+ }
+ }
+}
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java
new file mode 100644
index 0000000..84c8835
--- /dev/null
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java
@@ -0,0 +1,128 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+
+import java.io.StringReader;
+import java.util.Map;
+
+/**
+ * @author Jason van Zyl
+ * @version $Id$
+ */
+public class MojoTestCaseTest
+ extends AbstractMojoTestCase
+{
+ private String pom;
+
+ private Xpp3Dom pomDom;
+
+ private PlexusConfiguration pluginConfiguration;
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ pom =
+ "" +
+ "" +
+ "" +
+ "" +
+ "maven-simple-plugin" +
+ "" +
+ "valueOne" +
+ "valueTwo" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "";
+
+ pomDom = Xpp3DomBuilder.build( new StringReader( pom ) );
+
+ pluginConfiguration = extractPluginConfiguration( "maven-simple-plugin", pomDom );
+ }
+
+ public void testPluginConfigurationExtraction()
+ throws Exception
+ {
+ assertEquals( "valueOne", pluginConfiguration.getChild( "keyOne" ).getValue() );
+
+ assertEquals( "valueTwo", pluginConfiguration.getChild( "keyTwo" ).getValue() );
+ }
+
+ public void testMojoConfiguration()
+ throws Exception
+ {
+ SimpleMojo mojo = new SimpleMojo();
+
+ mojo = (SimpleMojo) configureMojo( mojo, pluginConfiguration );
+
+ assertEquals( "valueOne", mojo.getKeyOne() );
+
+ assertEquals( "valueTwo", mojo.getKeyTwo() );
+ }
+
+ public void testVariableAccessWithoutGetter()
+ throws Exception
+ {
+ SimpleMojo mojo = new SimpleMojo();
+
+ mojo = (SimpleMojo) configureMojo( mojo, pluginConfiguration );
+
+ assertEquals( "valueOne", (String)getVariableValueFromObject( mojo, "keyOne" ) );
+
+ assertEquals( "valueTwo", (String)getVariableValueFromObject( mojo, "keyTwo" ) );
+ }
+
+
+ public void testVariableAccessWithoutGetter2()
+ throws Exception
+ {
+ SimpleMojo mojo = new SimpleMojo();
+
+ mojo = (SimpleMojo) configureMojo( mojo, pluginConfiguration );
+
+ Map map = getVariablesAndValuesFromObject( mojo );
+
+ assertEquals( "valueOne", (String)map.get( "keyOne" ) );
+
+ assertEquals( "valueTwo", (String)map.get( "keyTwo" ) );
+ }
+
+
+ public void testSettingMojoVariables()
+ throws Exception
+ {
+ SimpleMojo mojo = new SimpleMojo();
+
+ mojo = (SimpleMojo) configureMojo( mojo, pluginConfiguration );
+
+ setVariableValueToObject( mojo, "keyOne", "myValueOne" );
+
+ assertEquals( "myValueOne", (String)getVariableValueFromObject( mojo, "keyOne" ) );
+
+ }
+
+}
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/SimpleMojo.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/SimpleMojo.java
new file mode 100644
index 0000000..4a101ec
--- /dev/null
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/SimpleMojo.java
@@ -0,0 +1,50 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @author Jason van Zyl
+ * @version $Id$
+ */
+public class SimpleMojo
+ extends AbstractMojo
+{
+ private String keyOne;
+
+ private String keyTwo;
+
+ public String getKeyOne()
+ {
+ return keyOne;
+ }
+
+ public String getKeyTwo()
+ {
+ return keyTwo;
+ }
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ }
+}
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/TestSilentLog.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/TestSilentLog.java
new file mode 100644
index 0000000..1e28b41
--- /dev/null
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/TestSilentLog.java
@@ -0,0 +1,81 @@
+package org.apache.maven.plugin.testing;
+
+/*
+ * 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 junit.framework.TestCase;
+
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.logging.Logger;
+
+public class TestSilentLog
+ extends TestCase
+{
+
+ public void testLog()
+ {
+ Log log = new SilentLog();
+ String text = new String( "Text" );
+ Throwable e = new RuntimeException();
+ log.debug( text );
+ log.debug( text, e );
+ log.debug( e );
+ log.info( text );
+ log.info( text, e );
+ log.info( e );
+ log.warn( text );
+ log.warn( text, e );
+ log.warn( e );
+ log.error( text );
+ log.error( text, e );
+ log.error( e );
+ log.isDebugEnabled();
+ log.isErrorEnabled();
+ log.isWarnEnabled();
+ log.isInfoEnabled();
+ }
+
+ public void testLogger()
+ {
+ Logger log = new SilentLog();
+ String text = new String( "Text" );
+ Throwable e = new RuntimeException();
+
+ log.debug( text );
+ log.debug( text, e );
+ log.error( text );
+ log.error( text, e );
+ log.warn( text );
+ log.warn( text, e );
+ log.info( text );
+ log.info( text, e );
+
+ log.fatalError( text );
+ log.fatalError( text, e );
+ log.getChildLogger( text );
+ log.getName();
+ log.getThreshold();
+ log.isDebugEnabled();
+ log.isErrorEnabled();
+ log.isFatalErrorEnabled();
+ log.isInfoEnabled();
+ log.isWarnEnabled();
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index 5b829c6..0393634 100644
--- a/pom.xml
+++ b/pom.xml
@@ -112,6 +112,7 @@
maven-plugin-tools-beanshell
maven-plugin-tools-model
maven-plugin-tools-ant
+ maven-plugin-testing-harness