You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2018/06/25 18:19:39 UTC
[maven-plugin-testing] 01/01: [MPLUGINTESTING-55] - Upgrade parent
to 31 o Fixed checkstyle reported errors.
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch MPLUGINTESTING-55
in repository https://gitbox.apache.org/repos/asf/maven-plugin-testing.git
commit aaf55160dbc02f6e8f9cd1f9c5b4d1dfece8f769
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Mon Jun 25 20:19:18 2018 +0200
[MPLUGINTESTING-55] - Upgrade parent to 31
o Fixed checkstyle reported errors.
---
.../maven/plugin/testing/AbstractMojoTestCase.java | 120 ++++++++++-----------
.../maven/plugin/testing/ArtifactStubFactory.java | 17 ++-
.../maven/plugin/testing/MojoParameters.java | 4 +-
.../org/apache/maven/plugin/testing/MojoRule.java | 75 ++++++-------
.../testing/ResolverExpressionEvaluatorStub.java | 2 +-
.../org/apache/maven/plugin/testing/SilentLog.java | 6 +-
.../apache/maven/plugin/testing/WithoutMojo.java | 29 ++++-
.../maven/plugin/testing/stubs/ArtifactStub.java | 3 +-
.../plugin/testing/stubs/MavenProjectStub.java | 19 ++--
.../testing/stubs/StubArtifactCollector.java | 31 +++---
.../testing/stubs/StubArtifactRepository.java | 3 +-
.../plugin/testing/stubs/StubArtifactResolver.java | 83 +++++++++-----
.../plugin/testing/ArtifactStubFactoryTest.java | 16 +--
.../apache/maven/plugin/testing/MojoRuleTest.java | 37 +++----
.../maven/plugin/testing/MojoTestCaseTest.java | 29 ++---
.../plugin/testing/PluginArtifactFileTest.java | 2 +-
.../shared/tools/easymock/TestFileManager.java | 3 +-
pom.xml | 22 +---
18 files changed, 249 insertions(+), 252 deletions(-)
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
index 8b047a7..0ebfd0a 100644
--- 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
@@ -84,14 +84,12 @@ import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
import com.google.inject.Module;
/**
- * 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: standardize 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!
+ * 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: standardize 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$
@@ -135,13 +133,13 @@ public abstract class AbstractMojoTestCase
private PlexusContainer container;
private Map<String, MojoDescriptor> mojoDescriptors;
-
+
/*
- * 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.
+ * 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;
+ // private MavenProjectBuilder projectBuilder;
protected void setUp()
throws Exception
@@ -160,10 +158,9 @@ public abstract class AbstractMojoTestCase
PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader );
- Artifact artifact =
- lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(),
- pluginDescriptor.getArtifactId(),
- pluginDescriptor.getVersion(), ".jar" );
+ Artifact artifact = lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(),
+ pluginDescriptor.getArtifactId(),
+ pluginDescriptor.getVersion(), ".jar" );
artifact.setFile( getPluginArtifactFile() );
pluginDescriptor.setPluginArtifact( artifact );
@@ -230,7 +227,7 @@ public abstract class AbstractMojoTestCase
}
// fallback to test project basedir if couldn't resolve relative to META-INF/maven/plugin.xml
- if ( file == null || ! file.exists() )
+ if ( file == null || !file.exists() )
{
file = new File( getBasedir() );
}
@@ -267,7 +264,7 @@ public abstract class AbstractMojoTestCase
{
e.printStackTrace();
fail( "Failed to create plexus container." );
- }
+ }
}
/**
@@ -282,15 +279,18 @@ public abstract class AbstractMojoTestCase
{
ClassWorld classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() );
- ContainerConfiguration cc = new DefaultContainerConfiguration()
- .setClassWorld( classWorld )
- .setClassPathScanning( PlexusConstants.SCANNING_INDEX )
- .setAutoWiring( true )
- .setName( "maven" );
+ // @formatter:off
+ ContainerConfiguration cc = //
+ new DefaultContainerConfiguration() //
+ .setClassWorld( classWorld ) //
+ .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) //
+ .setAutoWiring( true ) //
+ .setName( "maven" );
+ // @formatter:on
return cc;
}
-
+
protected PlexusContainer getContainer()
{
if ( container == null )
@@ -299,8 +299,8 @@ public abstract class AbstractMojoTestCase
}
return container;
- }
-
+ }
+
/**
* Lookup the mojo leveraging the subproject pom
*
@@ -380,13 +380,9 @@ public abstract class AbstractMojoTestCase
}
/*
- 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 );
- }
+ * 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
@@ -410,16 +406,16 @@ public abstract class AbstractMojoTestCase
Mojo mojo = (Mojo) lookup( Mojo.ROLE, groupId + ":" + artifactId + ":" + version + ":" + goal );
LoggerManager loggerManager = (LoggerManager) getContainer().lookup( LoggerManager.class );
-
+
Log mojoLogger = new DefaultLog( loggerManager.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" );
+ /*
+ * requires v10 of plexus container for lookup on expression evaluator ExpressionEvaluator evaluator =
+ * (ExpressionEvaluator) getContainer().lookup( ExpressionEvaluator.ROLE, "stub-evaluator" );
*/
ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub();
@@ -430,7 +426,6 @@ public abstract class AbstractMojoTestCase
}
/**
- *
* @param project
* @param goal
* @return
@@ -444,7 +439,6 @@ public abstract class AbstractMojoTestCase
}
/**
- *
* @param session
* @param execution
* @return
@@ -478,16 +472,16 @@ public abstract class AbstractMojoTestCase
if ( mojoDescriptor.getComponentConfigurator() != null )
{
- configurator = getContainer().lookup( ComponentConfigurator.class, mojoDescriptor.getComponentConfigurator() );
- }
-
+ configurator =
+ getContainer().lookup( ComponentConfigurator.class, mojoDescriptor.getComponentConfigurator() );
+ }
+
configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
return mojo;
}
/**
- *
* @param project
* @return
* @since 2.0
@@ -504,7 +498,6 @@ public abstract class AbstractMojoTestCase
}
/**
- *
* @param goal
* @return
* @since 2.0
@@ -512,13 +505,15 @@ public abstract class AbstractMojoTestCase
protected MojoExecution newMojoExecution( String goal )
{
MojoDescriptor mojoDescriptor = mojoDescriptors.get( goal );
- assertNotNull(String.format("The MojoDescriptor for the goal %s cannot be null.", goal), mojoDescriptor );
+ assertNotNull( String.format( "The MojoDescriptor for the goal %s cannot be null.", goal ), mojoDescriptor );
MojoExecution execution = new MojoExecution( mojoDescriptor );
finalizeMojoConfiguration( execution );
return execution;
}
- // copy&paste from org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.finalizeMojoConfiguration(MojoExecution)
+ // copy&paste from
+ // org.apache.maven.lifecycle.internal
+ // .DefaultLifecycleExecutionPlanCalculator.finalizeMojoConfiguration(MojoExecution)
private void finalizeMojoConfiguration( MojoExecution mojoExecution )
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
@@ -529,7 +524,7 @@ public abstract class AbstractMojoTestCase
executionConfiguration = new Xpp3Dom( "configuration" );
}
- Xpp3Dom defaultConfiguration = MojoDescriptorCreator.convert( mojoDescriptor );;
+ Xpp3Dom defaultConfiguration = MojoDescriptorCreator.convert( mojoDescriptor );
Xpp3Dom finalConfiguration = new Xpp3Dom( "configuration" );
@@ -546,7 +541,8 @@ public abstract class AbstractMojoTestCase
Xpp3Dom parameterDefaults = defaultConfiguration.getChild( parameter.getName() );
- parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults, Boolean.TRUE );
+ parameterConfiguration =
+ Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults, Boolean.TRUE );
if ( parameterConfiguration != null )
{
@@ -675,9 +671,8 @@ public abstract class AbstractMojoTestCase
}
/**
- * Convenience 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.
+ * Convenience 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
@@ -695,9 +690,8 @@ public abstract class AbstractMojoTestCase
}
/**
- * Convenience 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.
+ * Convenience 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
@@ -709,9 +703,8 @@ public abstract class AbstractMojoTestCase
}
/**
- * Convenience 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.
+ * Convenience 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
@@ -760,9 +753,8 @@ public abstract class AbstractMojoTestCase
}
/**
- * sometimes the parent element might contain the correct value so generalize that access
- *
- * TODO find out where this is probably done elsewhere
+ * 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
@@ -798,9 +790,7 @@ public abstract class AbstractMojoTestCase
}
/**
- * We should make sure this is called in each method that makes use of the container,
- * otherwise we throw ugly NPE's
- *
+ * 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
@@ -814,5 +804,5 @@ public abstract class AbstractMojoTestCase
}
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
index 11889c5..e077679 100644
--- 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
@@ -242,8 +242,7 @@ public class ArtifactStubFactory
{
if ( workingDir == null )
{
- throw new IllegalArgumentException(
- "The workingDir must be set." );
+ throw new IllegalArgumentException( "The workingDir must be set." );
}
String fileName = getFormattedFileName( artifact, false );
@@ -344,7 +343,7 @@ public class ArtifactStubFactory
/**
* @return a default set of release and snapshot <code>DefaultArtifact</code>, i.e.:
- * <code>testGroupId:snapshot:jar:2.0-SNAPSHOT, testGroupId:release:jar:1.0</code>
+ * <code>testGroupId:snapshot:jar:2.0-SNAPSHOT, testGroupId:release:jar:1.0</code>
* @throws IOException if any
* @see #getReleaseArtifact()
* @see #getSnapshotArtifact()
@@ -360,7 +359,7 @@ public class ArtifactStubFactory
/**
* @return a default set of <code>DefaultArtifact</code>, i.e.:
- * <code>g:provided:jar:1.0, g:compile:jar:1.0, g:system:jar:1.0, g:test:jar:1.0, g:runtime:jar:1.0</code>
+ * <code>g:provided:jar:1.0, g:compile:jar:1.0, g:system:jar:1.0, g:test:jar:1.0, g:runtime:jar:1.0</code>
* @throws IOException if any
*/
public Set<Artifact> getScopedArtifacts()
@@ -377,7 +376,7 @@ public class ArtifactStubFactory
/**
* @return a set of <code>DefaultArtifact</code>, i.e.:
- * <code>g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:c:sources:1.0, g:e:rar:1.0</code>
+ * <code>g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:c:sources:1.0, g:e:rar:1.0</code>
* @throws IOException if any
*/
public Set<Artifact> getTypedArtifacts()
@@ -394,7 +393,7 @@ public class ArtifactStubFactory
/**
* @return a set of <code>DefaultArtifact</code>, i.e.:
- * <code>g:c:jar:three:1.0, g:b:jar:two:1.0, g:d:jar:four:1.0, g:a:jar:one:1.0</code>
+ * <code>g:c:jar:three:1.0, g:b:jar:two:1.0, g:d:jar:four:1.0, g:a:jar:one:1.0</code>
* @throws IOException if any
*/
public Set<Artifact> getClassifiedArtifacts()
@@ -410,7 +409,7 @@ public class ArtifactStubFactory
/**
* @return a set of <code>DefaultArtifact</code>, i.e.:
- * <code>g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:e:rar:1.0</code>
+ * <code>g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:e:rar:1.0</code>
* @throws IOException if any
*/
public Set<Artifact> getTypedArchiveArtifacts()
@@ -426,7 +425,7 @@ public class ArtifactStubFactory
/**
* @return a set of <code>DefaultArtifact</code>, i.e.:
- * <code>g:one:jar:a:1.0, g:two:jar:a:1.0, g:four:jar:a:1.0, g:three:jar:a:1.0</code>
+ * <code>g:one:jar:a:1.0, g:two:jar:a:1.0, g:four:jar:a:1.0, g:three:jar:a:1.0</code>
* @throws IOException if any
*/
public Set<Artifact> getArtifactArtifacts()
@@ -442,7 +441,7 @@ public class ArtifactStubFactory
/**
* @return a set of <code>DefaultArtifact</code>, i.e.:
- * <code>one:group-one:jar:a:1.0, three:group-three:jar:a:1.0, four:group-four:jar:a:1.0,
+ * <code>one:group-one:jar:a:1.0, three:group-three:jar:a:1.0, four:group-four:jar:a:1.0,
* two:group-two:jar:a:1.0</code>
* @throws IOException if any
*/
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java
index 7412bc4..2ac2e14 100644
--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java
@@ -1,7 +1,5 @@
package org.apache.maven.plugin.testing;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,6 +19,8 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
* under the License.
*/
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
/**
* Static helpers to create and manipulate mojo execution configuration parameters
*
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java
index 0f8e91e..e1e3e91 100644
--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java
@@ -48,10 +48,9 @@ import org.junit.runner.Description;
import org.junit.runners.model.Statement;
/**
- * {@link TestRule} for usage with Junit-4.10ff. This is just a wrapper for an embedded
- * {@link AbstractMojoTestCase}, so all <tt>protected</tt> methods of the TestCase are
- * exhibited as <tt>public</tt> in the rule. You may annotate single tests methods with
- * {@link WithoutMojo} to prevent the rule from firing.
+ * {@link TestRule} for usage with Junit-4.10ff. This is just a wrapper for an embedded {@link AbstractMojoTestCase}, so
+ * all <tt>protected</tt> methods of the TestCase are exhibited as <tt>public</tt> in the rule. You may annotate single
+ * tests methods with {@link WithoutMojo} to prevent the rule from firing.
*
* @author Mirko Friedenhagen
* @version $Id$
@@ -61,34 +60,37 @@ public class MojoRule
implements TestRule
{
private final AbstractMojoTestCase testCase;
-
- public MojoRule()
+
+ public MojoRule()
{
- this( new AbstractMojoTestCase() {} );
+ this( new AbstractMojoTestCase()
+ {
+ } );
}
- public MojoRule(AbstractMojoTestCase testCase)
+ public MojoRule( AbstractMojoTestCase testCase )
{
this.testCase = testCase;
}
/**
- * May be overridden in the implementation to do stuff <em>after</em> the embedded test case
- * is set up but <em>before</em> the current test is actually run.
+ * May be overridden in the implementation to do stuff <em>after</em> the embedded test case is set up but
+ * <em>before</em> the current test is actually run.
*
* @throws Throwable
*/
- protected void before() throws Throwable
+ protected void before()
+ throws Throwable
{
-
+
}
-
+
/**
* May be overridden in the implementation to do stuff after the current test was run.
*/
- protected void after()
+ protected void after()
{
-
+
}
public InputStream getPublicDescriptorStream()
@@ -116,12 +118,12 @@ public class MojoRule
{
return testCase.setupContainerConfiguration();
}
-
+
public PlexusContainer getContainer()
{
return testCase.getContainer();
- }
-
+ }
+
/**
* Lookup the mojo leveraging the subproject pom
*
@@ -179,7 +181,7 @@ public class MojoRule
}
public Mojo lookupMojo( String groupId, String artifactId, String version, String goal,
- PlexusConfiguration pluginConfiguration )
+ PlexusConfiguration pluginConfiguration )
throws Exception
{
return testCase.lookupMojo( groupId, artifactId, version, goal, pluginConfiguration );
@@ -232,9 +234,8 @@ public class MojoRule
}
/**
- * Convenience 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.
+ * Convenience 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
@@ -248,9 +249,8 @@ public class MojoRule
}
/**
- * Convenience 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.
+ * Convenience 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
@@ -262,9 +262,8 @@ public class MojoRule
}
/**
- * Convenience 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.
+ * Convenience 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
@@ -291,28 +290,30 @@ public class MojoRule
}
@Override
- public Statement apply(final Statement base, Description description) {
- if (description.getAnnotation(WithoutMojo.class) != null) // skip.
+ public Statement apply( final Statement base, Description description )
+ {
+ if ( description.getAnnotation( WithoutMojo.class ) != null ) // skip.
{
return base;
}
- return new Statement()
+ return new Statement()
{
@Override
- public void evaluate() throws Throwable
+ public void evaluate()
+ throws Throwable
{
testCase.setUp();
before();
- try
+ try
{
base.evaluate();
- }
- finally
+ }
+ finally
{
after();
}
- }
- };
+ }
+ };
}
/**
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
index 20bea3b..a6ecabd 100644
--- 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
@@ -85,7 +85,7 @@ public class ResolverExpressionEvaluatorStub
{
return PlexusTestCase.getBasedir();
}
- else if ( expression.startsWith( "basedir" )|| expression.startsWith( "project.basedir" ) )
+ else if ( expression.startsWith( "basedir" ) || expression.startsWith( "project.basedir" ) )
{
int pathSeparator = expression.indexOf( "/" );
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
index a5721fa..dbf4abe 100644
--- 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
@@ -23,8 +23,8 @@ 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.
+ * 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 <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id$
@@ -329,6 +329,6 @@ public class SilentLog
public void setThreshold( int threshold )
{
// TODO Auto-generated method stub
-
+
}
}
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/WithoutMojo.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/WithoutMojo.java
index ae7cd72..8c6bc62 100644
--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/WithoutMojo.java
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/WithoutMojo.java
@@ -1,5 +1,24 @@
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.lang.annotation.Documented;
import java.lang.annotation.Retention;
@@ -27,14 +46,14 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
/**
- *
* An annotation for test methods that do not require the {@link MojoRule} to create and tear down the instance.
*
* @author Mirko Friedenhagen
*/
-@Retention(RUNTIME)
+@Retention( RUNTIME )
@Documented
-@Target(METHOD)
-public @interface WithoutMojo {
-
+@Target( METHOD )
+public @interface WithoutMojo
+{
+
}
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
index ea73318..4d62a27 100644
--- 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
@@ -215,7 +215,8 @@ public class ArtifactStub
/**
* By default, do nothing.
*
- * @see org.apache.maven.artifact.Artifact#updateVersion(java.lang.String, org.apache.maven.artifact.repository.ArtifactRepository)
+ * @see org.apache.maven.artifact.Artifact#updateVersion(java.lang.String,
+ * org.apache.maven.artifact.repository.ArtifactRepository)
*/
public void updateVersion( String string, ArtifactRepository artifactRepository )
{
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
index f8d775f..2491240 100644
--- 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
@@ -64,8 +64,7 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
- * Very simple stub of <code>MavenProject</code> object, going to take a lot of work to make it
- * useful as a stub though.
+ * Very simple stub of <code>MavenProject</code> object, going to take a lot of work to make it useful as a stub though.
*
* @author jesse
* @version $Id$
@@ -184,8 +183,8 @@ public class MavenProjectStub
* Loads the model for this stub from the specified POM. For convenience, any checked exception caused by I/O or
* parser errors will be wrapped into an unchecked exception.
*
- * @param pomFile The path to the POM file to load, must not be <code>null</code>. If this path is relative, it
- * is resolved against the return value of {@link #getBasedir()}.
+ * @param pomFile The path to the POM file to load, must not be <code>null</code>. If this path is relative, it is
+ * resolved against the return value of {@link #getBasedir()}.
*/
protected void readModel( File pomFile )
{
@@ -1346,7 +1345,8 @@ public class MavenProjectStub
/**
* By default, return <code>null</code>.
*
- * @see org.apache.maven.project.MavenProject#getGoalConfiguration(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ * @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 )
{
@@ -1356,7 +1356,8 @@ public class MavenProjectStub
/**
* By default, return <code>null</code>.
*
- * @see org.apache.maven.project.MavenProject#getReportConfiguration(java.lang.String, java.lang.String, java.lang.String)
+ * @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 )
{
@@ -1454,9 +1455,11 @@ public class MavenProjectStub
/**
* By default, return <code>Collections.EMPTY_SET</code>.
*
- * @see org.apache.maven.project.MavenProject#createArtifacts(org.apache.maven.artifact.factory.ArtifactFactory, java.lang.String, org.apache.maven.artifact.resolver.filter.ArtifactFilter)
+ * @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<Artifact> createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter )
+ public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String string,
+ ArtifactFilter artifactFilter )
{
return Collections.<Artifact>emptySet();
}
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
index be7e156..3cbe73f 100644
--- 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
@@ -26,7 +26,6 @@ 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.repository.RepositoryRequest;
import org.apache.maven.artifact.resolver.ArtifactCollector;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
@@ -50,39 +49,35 @@ public class StubArtifactCollector
super();
}
- public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
- Map managedVersions, ArtifactResolutionRequest repositoryRequest,
- ArtifactMetadataSource source, ArtifactFilter filter,
- List<ResolutionListener> listeners,
+ public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions,
+ ArtifactResolutionRequest repositoryRequest, ArtifactMetadataSource source,
+ ArtifactFilter filter, List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers )
{
return new ArtifactResolutionResult();
}
- public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
- Map managedVersions, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories,
- ArtifactMetadataSource source, ArtifactFilter filter,
- List<ResolutionListener> listeners,
+ public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions,
+ ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source,
+ ArtifactFilter filter, List<ResolutionListener> listeners,
List<ConflictResolver> conflictResolvers )
{
return new ArtifactResolutionResult();
}
- public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
- Map managedVersions, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories,
- ArtifactMetadataSource source, ArtifactFilter filter,
- List<ResolutionListener> listeners )
+ public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions,
+ ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source,
+ ArtifactFilter filter, List<ResolutionListener> listeners )
{
return new ArtifactResolutionResult();
}
public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories,
- ArtifactMetadataSource source, ArtifactFilter filter,
- List<ResolutionListener> listeners )
+ List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source,
+ ArtifactFilter filter, List<ResolutionListener> listeners )
throws ArtifactResolutionException
{
return new ArtifactResolutionResult();
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
index 9a435b7..b1b8b07 100644
--- 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
@@ -70,7 +70,8 @@ public class StubArtifactRepository
/**
* @return the filename of this metadata on the local repository.
- * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfLocalRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata, org.apache.maven.artifact.repository.ArtifactRepository)
+ * @see org.apache.maven.artifact.repository.ArtifactRepository#pathOfLocalRepositoryMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata,
+ * org.apache.maven.artifact.repository.ArtifactRepository)
*/
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
{
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
index cc02ec0..fd44766 100644
--- 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
@@ -60,7 +60,7 @@ public class StubArtifactResolver
* @param throwArtifactNotFoundException
*/
public StubArtifactResolver( ArtifactStubFactory factory, boolean throwArtifactResolutionException,
- boolean throwArtifactNotFoundException )
+ boolean throwArtifactNotFoundException )
{
this.throwArtifactNotFoundException = throwArtifactNotFoundException;
this.throwArtifactResolutionException = throwArtifactResolutionException;
@@ -70,9 +70,11 @@ public class StubArtifactResolver
/**
* Creates dummy file and sets it in the artifact to simulate resolution
*
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolve(org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository)
+ * @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<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
+ public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
+ ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException
{
if ( !this.throwArtifactNotFoundException && !this.throwArtifactResolutionException )
@@ -102,11 +104,14 @@ public class StubArtifactResolver
/**
* @return <code>null</code>.
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource)
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set,
+ * org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository,
+ * org.apache.maven.artifact.metadata.ArtifactMetadataSource)
*/
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
- List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
- ArtifactMetadataSource source )
+ List<ArtifactRepository> remoteRepositories,
+ ArtifactRepository localRepository,
+ ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException
{
return null;
@@ -114,11 +119,15 @@ public class StubArtifactResolver
/**
* @return <code>null</code>.
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource, java.util.List)
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set,
+ * org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository,
+ * org.apache.maven.artifact.metadata.ArtifactMetadataSource, java.util.List)
*/
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
- List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
- ArtifactMetadataSource source, List<ResolutionListener> listeners )
+ List<ArtifactRepository> remoteRepositories,
+ ArtifactRepository localRepository,
+ ArtifactMetadataSource source,
+ List<ResolutionListener> listeners )
throws ArtifactResolutionException, ArtifactNotFoundException
{
return null;
@@ -126,11 +135,15 @@ public class StubArtifactResolver
/**
* @return <code>null</code>.
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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)
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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)
*/
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
- ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
- ArtifactMetadataSource source, ArtifactFilter filter )
+ ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories,
+ ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException
{
return null;
@@ -138,11 +151,14 @@ public class StubArtifactResolver
/**
* @return <code>null</code>.
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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)
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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)
*/
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
- Map managedVersions, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source )
+ Map managedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories,
+ ArtifactMetadataSource source )
throws ArtifactResolutionException, ArtifactNotFoundException
{
return null;
@@ -150,12 +166,15 @@ public class StubArtifactResolver
/**
* @return <code>null</code>.
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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)
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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)
*/
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
- Map managedVersions, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source,
- ArtifactFilter filter )
+ Map managedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories,
+ ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException, ArtifactNotFoundException
{
return null;
@@ -163,12 +182,16 @@ public class StubArtifactResolver
/**
* @return <code>null</code>.
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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)
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(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 resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
- Map managedVersions, ArtifactRepository localRepository,
- List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source,
- ArtifactFilter filter, List<ResolutionListener> listeners )
+ Map managedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories,
+ ArtifactMetadataSource source, ArtifactFilter filter,
+ List<ResolutionListener> listeners )
throws ArtifactResolutionException, ArtifactNotFoundException
{
return null;
@@ -177,22 +200,24 @@ public class StubArtifactResolver
/**
* By default, do nothing.
*
- * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveAlways(org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository)
+ * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveAlways(org.apache.maven.artifact.Artifact,
+ * java.util.List, org.apache.maven.artifact.repository.ArtifactRepository)
*/
- public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository )
+ public void resolveAlways( Artifact artifact, List<ArtifactRepository> remoteRepositories,
+ ArtifactRepository localRepository )
throws ArtifactResolutionException, ArtifactNotFoundException
{
// nop
}
- public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories, ArtifactRepository localRepository,
- TransferListener downloadMonitor )
+ public void resolve( Artifact artifact, List<ArtifactRepository> remoteRepositories,
+ ArtifactRepository localRepository, TransferListener downloadMonitor )
throws ArtifactResolutionException, ArtifactNotFoundException
{
// TODO Auto-generated method stub
-
+
}
-
+
public ArtifactResolutionResult collect( ArtifactResolutionRequest request )
{
return null;
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java
index 75d7836..c0e8135 100644
--- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java
@@ -26,18 +26,20 @@ import junit.framework.TestCase;
public class ArtifactStubFactoryTest
extends TestCase
{
- public void testVersionChecks() throws IOException
+ public void testVersionChecks()
+ throws IOException
{
ArtifactStubFactory factory = new ArtifactStubFactory();
- assertTrue(factory.getReleaseArtifact().isRelease());
- assertFalse(factory.getReleaseArtifact().isSnapshot());
- assertTrue(factory.getSnapshotArtifact().isSnapshot());
- assertFalse(factory.getSnapshotArtifact().isRelease());
+ assertTrue( factory.getReleaseArtifact().isRelease() );
+ assertFalse( factory.getReleaseArtifact().isSnapshot() );
+ assertTrue( factory.getSnapshotArtifact().isSnapshot() );
+ assertFalse( factory.getSnapshotArtifact().isRelease() );
}
- public void testCreateFiles() throws IOException
+ public void testCreateFiles()
+ throws IOException
{
ArtifactStubFactory factory = new ArtifactStubFactory();
- assertFalse(factory.isCreateFiles());
+ assertFalse( factory.isCreateFiles() );
}
}
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java
index 0e976fd..5294d61 100644
--- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java
@@ -36,20 +36,22 @@ import org.junit.Test;
* @version $Id$
*/
public class MojoRuleTest
-
+
{
private boolean beforeWasCalled = false;
@Rule
- public MojoRule rule = new MojoRule() {
+ public MojoRule rule = new MojoRule()
+ {
@Override
- protected void before() throws Throwable
+ protected void before()
+ throws Throwable
{
beforeWasCalled = true;
- }
+ }
};
-
+
private String pom;
private Xpp3Dom pomDom;
@@ -62,20 +64,9 @@ public class MojoRuleTest
throws Exception
{
- pom =
- "<project>" +
- "<build>" +
- "<plugins>" +
- "<plugin>" +
- "<artifactId>maven-simple-plugin</artifactId>" +
- "<configuration>" +
- "<keyOne>valueOne</keyOne>" +
- "<keyTwo>valueTwo</keyTwo>" +
- "</configuration>" +
- "</plugin>" +
- "</plugins>" +
- "</build>" +
- "</project>";
+ pom = "<project>" + "<build>" + "<plugins>" + "<plugin>" + "<artifactId>maven-simple-plugin</artifactId>"
+ + "<configuration>" + "<keyOne>valueOne</keyOne>" + "<keyTwo>valueTwo</keyTwo>" + "</configuration>"
+ + "</plugin>" + "</plugins>" + "</build>" + "</project>";
pomDom = Xpp3DomBuilder.build( new StringReader( pom ) );
@@ -129,10 +120,10 @@ public class MojoRuleTest
/**
* @throws Exception if any
*/
- @Test
- public void testVariableAccessWithoutGetter2()
+ @Test
+ public void testVariableAccessWithoutGetter2()
throws Exception
- {
+ {
SimpleMojo mojo = new SimpleMojo();
mojo = (SimpleMojo) rule.configureMojo( mojo, pluginConfiguration );
@@ -169,7 +160,7 @@ public class MojoRuleTest
assertFalse( "before executed although WithMojo annotation was added", beforeWasCalled );
}
- @Test
+ @Test
public void testWithRuleWrapper()
throws Exception
{
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
index edd0236..cc95cc3 100644
--- 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
@@ -45,20 +45,9 @@ public class MojoTestCaseTest
{
super.setUp();
- pom =
- "<project>" +
- "<build>" +
- "<plugins>" +
- "<plugin>" +
- "<artifactId>maven-simple-plugin</artifactId>" +
- "<configuration>" +
- "<keyOne>valueOne</keyOne>" +
- "<keyTwo>valueTwo</keyTwo>" +
- "</configuration>" +
- "</plugin>" +
- "</plugins>" +
- "</build>" +
- "</project>";
+ pom = "<project>" + "<build>" + "<plugins>" + "<plugin>" + "<artifactId>maven-simple-plugin</artifactId>"
+ + "<configuration>" + "<keyOne>valueOne</keyOne>" + "<keyTwo>valueTwo</keyTwo>" + "</configuration>"
+ + "</plugin>" + "</plugins>" + "</build>" + "</project>";
pomDom = Xpp3DomBuilder.build( new StringReader( pom ) );
@@ -101,15 +90,15 @@ public class MojoTestCaseTest
mojo = (SimpleMojo) configureMojo( mojo, pluginConfiguration );
- assertEquals( "valueOne", (String)getVariableValueFromObject( mojo, "keyOne" ) );
+ assertEquals( "valueOne", (String) getVariableValueFromObject( mojo, "keyOne" ) );
- assertEquals( "valueTwo", (String)getVariableValueFromObject( mojo, "keyTwo" ) );
+ assertEquals( "valueTwo", (String) getVariableValueFromObject( mojo, "keyTwo" ) );
}
/**
* @throws Exception if any
*/
- public void testVariableAccessWithoutGetter2()
+ public void testVariableAccessWithoutGetter2()
throws Exception
{
SimpleMojo mojo = new SimpleMojo();
@@ -118,9 +107,9 @@ public class MojoTestCaseTest
Map<String, Object> map = getVariablesAndValuesFromObject( mojo );
- assertEquals( "valueOne", (String)map.get( "keyOne" ) );
+ assertEquals( "valueOne", (String) map.get( "keyOne" ) );
- assertEquals( "valueTwo", (String)map.get( "keyTwo" ) );
+ assertEquals( "valueTwo", (String) map.get( "keyTwo" ) );
}
/**
@@ -135,7 +124,7 @@ public class MojoTestCaseTest
setVariableValueToObject( mojo, "keyOne", "myValueOne" );
- assertEquals( "myValueOne", (String)getVariableValueFromObject( mojo, "keyOne" ) );
+ assertEquals( "myValueOne", (String) getVariableValueFromObject( mojo, "keyOne" ) );
}
diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java
index c4f32be..3f0cd31 100644
--- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java
+++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java
@@ -28,7 +28,7 @@ public class PluginArtifactFileTest
extends AbstractMojoTestCase
{
private static final String FS = System.getProperty( "file.separator" );
-
+
public void testArtifact()
throws Exception
{
diff --git a/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java b/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java
index 461f079..60010c2 100644
--- a/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java
+++ b/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java
@@ -105,6 +105,7 @@ public class TestFileManager
warnAboutCleanup = true;
}
+ private static final long WAIT_20MS = 20L;
/**
* @return a temp dir
*/
@@ -112,7 +113,7 @@ public class TestFileManager
{
try
{
- Thread.sleep( 20 );
+ Thread.sleep( WAIT_20MS );
}
catch ( InterruptedException e )
{
diff --git a/pom.xml b/pom.xml
index 6ff3578..4c5702d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@ under the License.
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.apache.maven</groupId>
- <version>24</version>
+ <version>31</version>
<relativePath>../pom/maven/pom.xml</relativePath>
</parent>
@@ -243,26 +243,6 @@ under the License.
</plugins>
</pluginManagement>
<plugins>
- <plugin><!-- TODO remove when upgrading to maven-parent 25 -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-bytecode-version</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <enforceBytecodeVersion>
- <maxJdkVersion>${maven.compiler.target}</maxJdkVersion>
- </enforceBytecodeVersion>
- </rules>
- <fail>true</fail>
- </configuration>
- </execution>
- </executions>
- </plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<inherited>false</inherited>