Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixing the injection of parameters into Mojos. This fix should enable

any project using the Apache version of maven-plugin-testing-harness to
replace it by this version without any code changes.
- Bumped up all of the maven and plexus dependencies from an alpha
version to the latest release version.
- Fixed the AbstractMojoTestCase class to properly extract the plugin
configuration (parameters, default-values and expressions) and pass it
on to the Maven expression evaluator.
- The groupId was changed in order to avoid any conflicts (and
confusion) with future Apache releases.
  • Loading branch information...
commit c711fb0c8e9b03fe886a5db5b888478f1b4dc70a 1 parent 3527cca
Gianluca Righetto authored
2  .gitignore
@@ -2,6 +2,6 @@
2 2 .project
3 3 .settings/
4 4 target/
5   -build/
  5 +build
6 6 *~
7 7 *.swp
49 pom.xml
... ... @@ -1,78 +1,59 @@
1 1 <?xml version="1.0" encoding="UTF-8"?>
2   -
3   -<!--
4   -Licensed to the Apache Software Foundation (ASF) under one
5   -or more contributor license agreements. See the NOTICE file
6   -distributed with this work for additional information
7   -regarding copyright ownership. The ASF licenses this file
8   -to you under the Apache License, Version 2.0 (the
9   -"License"); you may not use this file except in compliance
10   -with the License. You may obtain a copy of the License at
11   -
12   - http://www.apache.org/licenses/LICENSE-2.0
13   -
14   -Unless required by applicable law or agreed to in writing,
15   -software distributed under the License is distributed on an
16   -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   -KIND, either express or implied. See the License for the
18   -specific language governing permissions and limitations
19   -under the License.
20   --->
21   -
22   -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  2 +<!-- 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. -->
  3 +<project
  4 + xmlns="http://maven.apache.org/POM/4.0.0"
  5 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23 7 <modelVersion>4.0.0</modelVersion>
24   -
25   - <parent>
26   - <groupId>org.apache.maven.plugin-testing</groupId>
27   - <artifactId>maven-plugin-testing</artifactId>
28   - <version>2.0-alpha-1</version>
29   - </parent>
30   -
  8 + <groupId>com.menttis.maven.plugin-testing</groupId>
31 9 <artifactId>maven-plugin-testing-harness</artifactId>
  10 + <version>2.0.1</version>
32 11 <name>Maven Plugin Testing Mechanism</name>
33 12 <description>The Maven Plugin Testing Harness provides mechanisms to manage tests on Mojo.</description>
34   -
35 13 <scm>
36 14 <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.0-alpha-1</connection>
37 15 <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.0-alpha-1</developerConnection>
38 16 <url>http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-2.0-alpha-1</url>
39 17 </scm>
40   -
41 18 <dependencies>
42 19 <!-- maven -->
43 20 <dependency>
44 21 <groupId>org.apache.maven</groupId>
45 22 <artifactId>maven-core</artifactId>
  23 + <version>3.0.4</version>
46 24 </dependency>
47 25 <dependency>
48 26 <groupId>org.apache.maven</groupId>
49 27 <artifactId>maven-compat</artifactId>
  28 + <version>3.0.4</version>
50 29 </dependency>
51 30 <dependency>
52 31 <groupId>org.apache.maven</groupId>
53 32 <artifactId>maven-model</artifactId>
  33 + <version>3.0.4</version>
54 34 </dependency>
55 35 <dependency>
56 36 <groupId>org.apache.maven</groupId>
57 37 <artifactId>maven-plugin-api</artifactId>
  38 + <version>3.0.4</version>
58 39 </dependency>
59   -
60 40 <!-- plexus -->
61 41 <dependency>
62 42 <groupId>org.codehaus.plexus</groupId>
63 43 <artifactId>plexus-utils</artifactId>
  44 + <version>2.0.7</version>
64 45 </dependency>
65 46 <dependency>
66 47 <groupId>org.codehaus.plexus</groupId>
67 48 <artifactId>plexus-archiver</artifactId>
68   - <version>1.0-alpha-7</version>
  49 + <version>2.1.1</version>
69 50 </dependency>
70 51 </dependencies>
71   -
72 52 <build>
73 53 <plugins>
74 54 <plugin>
75 55 <artifactId>maven-source-plugin</artifactId>
  56 + <version>2.1.2</version>
76 57 <configuration>
77 58 <attach>true</attach>
78 59 </configuration>
@@ -86,4 +67,4 @@ under the License.
86 67 </plugin>
87 68 </plugins>
88 69 </build>
89   -</project>
  70 +</project>
287 src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java
@@ -22,18 +22,39 @@
22 22 import java.io.BufferedReader;
23 23 import java.io.File;
24 24 import java.io.FileInputStream;
  25 +import java.io.IOException;
25 26 import java.io.InputStream;
26 27 import java.io.Reader;
27 28 import java.lang.reflect.AccessibleObject;
28 29 import java.lang.reflect.Field;
  30 +import java.util.ArrayList;
  31 +import java.util.Arrays;
29 32 import java.util.HashMap;
  33 +import java.util.List;
30 34 import java.util.Map;
31 35
  36 +import org.apache.maven.DefaultMaven;
  37 +import org.apache.maven.Maven;
  38 +import org.apache.maven.execution.DefaultMavenExecutionRequest;
  39 +import org.apache.maven.execution.DefaultMavenExecutionResult;
  40 +import org.apache.maven.execution.MavenExecutionRequest;
  41 +import org.apache.maven.execution.MavenExecutionRequestPopulationException;
  42 +import org.apache.maven.execution.MavenExecutionRequestPopulator;
  43 +import org.apache.maven.execution.MavenExecutionResult;
  44 +import org.apache.maven.execution.MavenSession;
32 45 import org.apache.maven.monitor.logging.DefaultLog;
33 46 import org.apache.maven.plugin.Mojo;
  47 +import org.apache.maven.plugin.MojoExecution;
  48 +import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
34 49 import org.apache.maven.plugin.descriptor.PluginDescriptor;
35 50 import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
36 51 import org.apache.maven.plugin.logging.Log;
  52 +import org.apache.maven.project.MavenProject;
  53 +import org.apache.maven.project.ProjectBuilder;
  54 +import org.apache.maven.project.ProjectBuildingException;
  55 +import org.apache.maven.project.ProjectBuildingRequest;
  56 +import org.apache.maven.project.ProjectBuildingResult;
  57 +import org.apache.maven.settings.building.SettingsBuildingException;
37 58 import org.codehaus.plexus.ContainerConfiguration;
38 59 import org.codehaus.plexus.DefaultContainerConfiguration;
39 60 import org.codehaus.plexus.DefaultPlexusContainer;
@@ -44,6 +65,7 @@
44 65 import org.codehaus.plexus.component.configurator.ComponentConfigurator;
45 66 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
46 67 import org.codehaus.plexus.component.repository.ComponentDescriptor;
  68 +import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
47 69 import org.codehaus.plexus.configuration.PlexusConfiguration;
48 70 import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
49 71 import org.codehaus.plexus.logging.LoggerManager;
@@ -53,17 +75,17 @@
53 75 import org.codehaus.plexus.util.xml.XmlStreamReader;
54 76 import org.codehaus.plexus.util.xml.Xpp3Dom;
55 77 import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
  78 +import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
  79 +import org.sonatype.aether.util.DefaultRepositorySystemSession;
56 80
57 81 /**
58   - * 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
59   - * as the role hint for the mojo lookup.
60   - * TODO: standardize the execution of the mojo and looking at the results, but could simply have a template method
61   - * for verifying the state of the mojo post execution
62   - * TODO: need a way to look at the state of the mojo without adding getters, this could be where we finally specify
63   - * the expressions which extract values from the mojo.
64   - * TODO: create a standard directory structure for picking up POMs to make this even easier, we really just need a testing
65   - * descriptor and make this entirely declarative!
66   - *
  82 + * 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
  83 + * role hint for the mojo lookup. TODO: standardize the execution of the mojo and looking at the results, but could
  84 + * simply have a template method for verifying the state of the mojo post execution TODO: need a way to look at the
  85 + * state of the mojo without adding getters, this could be where we finally specify the expressions which extract values
  86 + * from the mojo. TODO: create a standard directory structure for picking up POMs to make this even easier, we really
  87 + * just need a testing descriptor and make this entirely declarative!
  88 + *
67 89 * @author jesse
68 90 * @version $Id: AbstractMojoTestCase.java 805786 2009-08-19 13:04:24Z bentmann $
69 91 */
@@ -73,29 +95,24 @@
73 95 private ComponentConfigurator configurator;
74 96
75 97 private PlexusContainer container;
76   -
  98 +
  99 + private PluginDescriptor descriptor;
  100 +
77 101 /*
78   - * for the harness I think we have decided against going the route of using the maven project builder.
79   - * instead I think we are going to try and make an instance of the localrespository and assign that
80   - * to either the project stub or into the mojo directly with injection...not sure yet though.
  102 + * for the harness I think we have decided against going the route of using the maven project builder. instead I
  103 + * think we are going to try and make an instance of the localrespository and assign that to either the project stub
  104 + * or into the mojo directly with injection...not sure yet though.
81 105 */
82   - //private MavenProjectBuilder projectBuilder;
  106 + // private MavenProjectBuilder projectBuilder;
83 107
84 108 protected void setUp()
85 109 throws Exception
86 110 {
87 111 configurator = getContainer().lookup( ComponentConfigurator.class, "basic" );
88 112
89   - InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() );
90   -
91   - XmlStreamReader reader = ReaderFactory.newXmlReader( is );
  113 + descriptor = new PluginDescriptorBuilder().build( getPluginReader() );
92 114
93   - InterpolationFilterReader interpolationFilterReader =
94   - new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() );
95   -
96   - PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader );
97   -
98   - for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() )
  115 + for ( ComponentDescriptor<?> desc : descriptor.getComponents() )
99 116 {
100 117 getContainer().addComponentDescriptor( desc );
101 118 }
@@ -107,6 +124,17 @@ protected InputStream getPublicDescriptorStream()
107 124 return new FileInputStream( new File( getPluginDescriptorPath() ) );
108 125 }
109 126
  127 + protected InterpolationFilterReader getPluginReader()
  128 + throws IOException
  129 + {
  130 + InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() );
  131 +
  132 + XmlStreamReader reader = ReaderFactory.newXmlReader( is );
  133 +
  134 + return new InterpolationFilterReader( new BufferedReader( reader ),
  135 + getContainer().getContext().getContextData() );
  136 + }
  137 +
110 138 protected String getPluginDescriptorPath()
111 139 {
112 140 return getBasedir() + "/target/classes/META-INF/maven/plugin.xml";
@@ -131,9 +159,9 @@ protected void setupContainer()
131 159 {
132 160 e.printStackTrace();
133 161 fail( "Failed to create plexus container." );
134   - }
  162 + }
135 163 }
136   -
  164 +
137 165 protected PlexusContainer getContainer()
138 166 {
139 167 if ( container == null )
@@ -142,11 +170,11 @@ protected PlexusContainer getContainer()
142 170 }
143 171
144 172 return container;
145   - }
146   -
  173 + }
  174 +
147 175 /**
148 176 * Lookup the mojo leveraging the subproject pom
149   - *
  177 + *
150 178 * @param goal
151 179 * @param pluginPom
152 180 * @return a Mojo instance
@@ -160,7 +188,7 @@ protected Mojo lookupMojo( String goal, String pluginPom )
160 188
161 189 /**
162 190 * Lookup an empty mojo
163   - *
  191 + *
164 192 * @param goal
165 193 * @param pluginPom
166 194 * @return a Mojo instance
@@ -174,7 +202,7 @@ protected Mojo lookupEmptyMojo( String goal, String pluginPom )
174 202
175 203 /**
176 204 * Lookup the mojo leveraging the actual subprojects pom
177   - *
  205 + *
178 206 * @param goal
179 207 * @param pom
180 208 * @return a Mojo instance
@@ -195,12 +223,14 @@ protected Mojo lookupMojo( String goal, File pom )
195 223
196 224 PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom );
197 225
198   - return lookupMojo( groupId, artifactId, version, goal, pluginConfiguration );
  226 + PlexusConfiguration parametersConfiguration = extractParameterConfiguration( goal );
  227 +
  228 + return lookupMojo( groupId, artifactId, version, pluginPom, goal, pluginConfiguration, parametersConfiguration );
199 229 }
200 230
201 231 /**
202 232 * Lookup the mojo leveraging the actual subprojects pom
203   - *
  233 + *
204 234 * @param goal
205 235 * @param pom
206 236 * @return a Mojo instance
@@ -222,28 +252,21 @@ protected Mojo lookupEmptyMojo( String goal, File pom )
222 252 return lookupMojo( groupId, artifactId, version, goal, null );
223 253 }
224 254
225   - /*
226   - protected Mojo lookupMojo( String groupId, String artifactId, String version, String goal, File pom )
227   - throws Exception
228   - {
229   - PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom );
230   -
231   - return lookupMojo( groupId, artifactId, version, goal, pluginConfiguration );
232   - }
233   - */
234 255 /**
235 256 * lookup the mojo while we have all of the relavent information
236   - *
  257 + *
237 258 * @param groupId
238 259 * @param artifactId
239 260 * @param version
  261 + * @param pom
240 262 * @param goal
241 263 * @param pluginConfiguration
  264 + * @param parametersConfiguration
242 265 * @return a Mojo instance
243 266 * @throws Exception
244 267 */
245   - protected Mojo lookupMojo( String groupId, String artifactId, String version, String goal,
246   - PlexusConfiguration pluginConfiguration )
  268 + protected Mojo lookupMojo( String groupId, String artifactId, String version, File pom, String goal,
  269 + PlexusConfiguration pluginConfiguration, PlexusConfiguration parametersConfiguration )
247 270 throws Exception
248 271 {
249 272 validateContainerStatus();
@@ -253,25 +276,151 @@ protected Mojo lookupMojo( String groupId, String artifactId, String version, St
253 276 Mojo mojo = (Mojo) lookup( Mojo.ROLE, groupId + ":" + artifactId + ":" + version + ":" + goal );
254 277
255 278 LoggerManager loggerManager = (LoggerManager) getContainer().lookup( LoggerManager.class );
256   -
  279 +
257 280 Log mojoLogger = new DefaultLog( loggerManager.getLoggerForComponent( Mojo.ROLE ) );
258 281
259 282 mojo.setLog( mojoLogger );
260 283
261 284 if ( pluginConfiguration != null )
262 285 {
263   - /* requires v10 of plexus container for lookup on expression evaluator
264   - ExpressionEvaluator evaluator = (ExpressionEvaluator) getContainer().lookup( ExpressionEvaluator.ROLE,
265   - "stub-evaluator" );
  286 + /*
  287 + * requires v10 of plexus container for lookup on expression evaluator ExpressionEvaluator evaluator =
  288 + * (ExpressionEvaluator) getContainer().lookup( ExpressionEvaluator.ROLE, "stub-evaluator" );
266 289 */
267 290 ExpressionEvaluator evaluator = new ResolverExpressionEvaluatorStub();
268 291
269 292 configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() );
270 293 }
271 294
  295 + if ( parametersConfiguration != null )
  296 + {
  297 + MavenExecutionRequest request = getRequest( pom );
  298 +
  299 + MavenSession session = getSession( request );
  300 +
  301 + MojoExecution execution = getMojoExecution( goal );
  302 +
  303 + ProjectBuilder projectBuilder = getContainer().lookup( ProjectBuilder.class );
  304 +
  305 + session.setProjects( getProjectsForMavenReactor( projectBuilder, request ) );
  306 +
  307 + ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, execution );
  308 +
  309 + configurator.configureComponent( mojo, parametersConfiguration, expressionEvaluator,
  310 + descriptor.getClassRealm() );
  311 + }
  312 +
272 313 return mojo;
273 314 }
274 315
  316 + /*
  317 + * Method for backward-compatibility in case anyone is using this method directly
  318 + */
  319 + protected Mojo lookupMojo( String groupId, String artifactId, String version, String goal,
  320 + PlexusConfiguration pluginConfiguration )
  321 + throws Exception
  322 + {
  323 + return lookupMojo( groupId, artifactId, version, null, goal, pluginConfiguration, null );
  324 + }
  325 +
  326 + protected MavenExecutionRequest getRequest( File pom )
  327 + throws MavenExecutionRequestPopulationException, ComponentLookupException
  328 + {
  329 + DefaultMavenExecutionRequest request = new DefaultMavenExecutionRequest();
  330 +
  331 + MavenExecutionRequestPopulator populator = getContainer().lookup( MavenExecutionRequestPopulator.class );
  332 +
  333 + populator.populateDefaults( request );
  334 +
  335 + request.setPom( pom );
  336 +
  337 + request.setSystemProperties( System.getProperties() );
  338 +
  339 + return request;
  340 + }
  341 +
  342 + protected MavenSession getSession( MavenExecutionRequest request )
  343 + throws ComponentLookupException, MavenExecutionRequestPopulationException, SettingsBuildingException
  344 + {
  345 + DefaultMaven maven = (DefaultMaven) getContainer().lookup( Maven.class );
  346 +
  347 + MavenExecutionResult result = new DefaultMavenExecutionResult();
  348 +
  349 + DefaultRepositorySystemSession repoSession =
  350 + (DefaultRepositorySystemSession) maven.newRepositorySession( request );
  351 +
  352 + MavenSession session = new MavenSession( container, repoSession, request, result );
  353 +
  354 + return session;
  355 + }
  356 +
  357 + protected MojoExecution getMojoExecution( String goal )
  358 + {
  359 + return new MojoExecution( descriptor.getMojo( goal ), "default-cli", MojoExecution.Source.CLI );
  360 + }
  361 +
  362 + /**
  363 + * Return a list of projects based on the provided POM. This way project properties can be properly injected as mojo
  364 + * parameters.
  365 + *
  366 + * @param projectBuilder
  367 + * @param request
  368 + * @return
  369 + * @throws ProjectBuildingException
  370 + */
  371 + private List<MavenProject> getProjectsForMavenReactor( ProjectBuilder projectBuilder, MavenExecutionRequest request )
  372 + throws ProjectBuildingException
  373 + {
  374 + List<MavenProject> projects = new ArrayList<MavenProject>();
  375 +
  376 + // If no POM was provided, there's no way to extract project properties, so just return an empty list.
  377 + if ( request.getPom() == null )
  378 + return projects;
  379 +
  380 + List<File> files = Arrays.asList( request.getPom().getAbsoluteFile() );
  381 +
  382 + ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest();
  383 +
  384 + List<ProjectBuildingResult> results =
  385 + projectBuilder.build( files, request.isRecursive(), projectBuildingRequest );
  386 +
  387 + for ( ProjectBuildingResult result : results )
  388 + {
  389 + projects.add( result.getProject() );
  390 + }
  391 +
  392 + return projects;
  393 + }
  394 +
  395 + /**
  396 + * Extract the parameters configuration from the specified Mojo
  397 + *
  398 + * @param mojo Specifies the mojo/goal where the parameters will be extracted from
  399 + * @return A plexus configuration object that can be passed on to an expression evaluator
  400 + * @throws XmlPullParserException
  401 + * @throws IOException
  402 + */
  403 + protected PlexusConfiguration extractParameterConfiguration( String mojo )
  404 + throws XmlPullParserException, IOException
  405 + {
  406 + PlexusConfiguration parameterConfigurations = null;
  407 + PlexusConfiguration c = new XmlPlexusConfiguration( Xpp3DomBuilder.build( getPluginReader() ) );
  408 + PlexusConfiguration mojos = c.getChild( "mojos" );
  409 + if ( mojos != null )
  410 + {
  411 + PlexusConfiguration[] mojosChildren = mojos.getChildren( "mojo" );
  412 + for ( PlexusConfiguration mojoConfig : mojosChildren )
  413 + {
  414 + if ( mojoConfig.getChild( "build" ) != null
  415 + && mojoConfig.getChild( "build" ).getValue().equalsIgnoreCase( mojo ) )
  416 + {
  417 + parameterConfigurations = mojoConfig.getChild( "configuration" );
  418 + }
  419 + }
  420 + }
  421 + return parameterConfigurations;
  422 + }
  423 +
275 424 /**
276 425 * @param artifactId
277 426 * @param pom
@@ -341,7 +490,7 @@ protected PlexusConfiguration extractPluginConfiguration( String artifactId, Xpp
341 490
342 491 /**
343 492 * Configure the mojo
344   - *
  493 + *
345 494 * @param mojo
346 495 * @param artifactId
347 496 * @param pom
@@ -364,7 +513,7 @@ protected Mojo configureMojo( Mojo mojo, String artifactId, File pom )
364 513
365 514 /**
366 515 * Configure the mojo with the given plexus configuration
367   - *
  516 + *
368 517 * @param mojo
369 518 * @param pluginConfiguration
370 519 * @return a Mojo instance
@@ -383,10 +532,9 @@ protected Mojo configureMojo( Mojo mojo, PlexusConfiguration pluginConfiguration
383 532 }
384 533
385 534 /**
386   - * Convenience method to obtain the value of a variable on a mojo that might not have a getter.
387   - *
388   - * NOTE: the caller is responsible for casting to to what the desired type is.
389   - *
  535 + * Convenience method to obtain the value of a variable on a mojo that might not have a getter. NOTE: the caller is
  536 + * responsible for casting to to what the desired type is.
  537 + *
390 538 * @param object
391 539 * @param variable
392 540 * @return object value of variable
@@ -403,10 +551,9 @@ protected Object getVariableValueFromObject( Object object, String variable )
403 551 }
404 552
405 553 /**
406   - * Convenience method to obtain all variables and values from the mojo (including its superclasses)
407   - *
408   - * Note: the values in the map are of type Object so the caller is responsible for casting to desired types.
409   - *
  554 + * Convenience method to obtain all variables and values from the mojo (including its superclasses) Note: the values
  555 + * in the map are of type Object so the caller is responsible for casting to desired types.
  556 + *
410 557 * @param object
411 558 * @return map of variable names and values
412 559 */
@@ -417,10 +564,9 @@ protected Map getVariablesAndValuesFromObject( Object object )
417 564 }
418 565
419 566 /**
420   - * Convenience method to obtain all variables and values from the mojo (including its superclasses)
421   - *
422   - * Note: the values in the map are of type Object so the caller is responsible for casting to desired types.
423   - *
  567 + * Convenience method to obtain all variables and values from the mojo (including its superclasses) Note: the values
  568 + * in the map are of type Object so the caller is responsible for casting to desired types.
  569 + *
424 570 * @param clazz
425 571 * @param object
426 572 * @return map of variable names and values
@@ -454,7 +600,7 @@ protected Map getVariablesAndValuesFromObject( Class clazz, Object object )
454 600
455 601 /**
456 602 * Convenience method to set values to variables in objects that don't have setters
457   - *
  603 + *
458 604 * @param object
459 605 * @param variable
460 606 * @param value
@@ -471,10 +617,9 @@ protected void setVariableValueToObject( Object object, String variable, Object
471 617 }
472 618
473 619 /**
474   - * sometimes the parent element might contain the correct value so generalize that access
475   - *
476   - * TODO find out where this is probably done elsewhere
477   - *
  620 + * sometimes the parent element might contain the correct value so generalize that access TODO find out where this
  621 + * is probably done elsewhere
  622 + *
478 623 * @param pluginPomDom
479 624 * @param element
480 625 * @return
@@ -509,11 +654,9 @@ private String resolveFromRootThenParent( Xpp3Dom pluginPomDom, String element )
509 654 }
510 655
511 656 /**
512   - * We should make sure this is called in each method that makes use of the container,
513   - * otherwise we throw ugly NPE's
514   - *
  657 + * We should make sure this is called in each method that makes use of the container, otherwise we throw ugly NPE's
515 658 * crops up when the subclassing code defines the setUp method but doesn't call super.setUp()
516   - *
  659 + *
517 660 * @throws Exception
518 661 */
519 662 private void validateContainerStatus()
@@ -526,4 +669,4 @@ private void validateContainerStatus()
526 669
527 670 throw new Exception( "container is null, make sure super.setUp() is called" );
528 671 }
529   -}
  672 +}
18 src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java
@@ -232,4 +232,22 @@ public void setUrl( String url )
232 232 return Collections.emptyList();
233 233 }
234 234
  235 + public List<ArtifactRepository> getMirroredRepositories()
  236 + {
  237 + // TODO Auto-generated method stub
  238 + return null;
  239 + }
  240 +
  241 + public boolean isProjectAware()
  242 + {
  243 + // TODO Auto-generated method stub
  244 + return false;
  245 + }
  246 +
  247 + public void setMirroredRepositories( List<ArtifactRepository> arg0 )
  248 + {
  249 + // TODO Auto-generated method stub
  250 +
  251 + }
  252 +
235 253 }

0 comments on commit c711fb0

Please sign in to comment.
Something went wrong with that request. Please try again.