Author: brianf
Date: Mon Apr 2 18:57:27 2007
New Revision: 524997
URL: http://svn.apache.org/viewvc?view=rev&rev=524997
Log:
refactored to handle the expressionEvaluator
Added:
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforcerExpressionEvaluator.java
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockPathTranslator.java
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockProject.java
Modified:
maven/plugins/trunk/maven-enforcer-plugin/pom.xml
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DefaultEnforcementRuleHelper.java
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DisplayInfoMojo.java
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforceMojo.java
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/RequireMavenVersion.java
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/EnforcerTestUtils.java
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestDefaultEnforcementRuleHelper.java
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestMavenVersion.java
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireJavaVersion.java
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireOS.java
Modified: maven/plugins/trunk/maven-enforcer-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/pom.xml?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
--- maven/plugins/trunk/maven-enforcer-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-enforcer-plugin/pom.xml Mon Apr 2 18:57:27 2007
@@ -32,64 +32,13 @@
<version>1.0-alpha-1-SNAPSHOT</version>
<issueManagement>
<system>JIRA</system>
- <url>http://jira.codehaus.org/browse/MNG</url>
+ <url>http://jira.codehaus.org/browse/MENFORCER</url>
</issueManagement>
- <mailingLists>
- <!-- duplication from maven-plugins pom - temporary until they
inherit properly
- -->
- <mailingList>
- <name>Maven User List</name>
- <subscribe>[EMAIL PROTECTED]</subscribe>
- <unsubscribe>[EMAIL PROTECTED]</unsubscribe>
- <post>[email protected]</post>
-
<archive>http://mail-archives.apache.org/mod_mbox/maven-users</archive>
- <otherArchives>
-
<otherArchive>http://www.mail-archive.com/[email protected]/</otherArchive>
-
<otherArchive>http://www.nabble.com/Maven---Users-f178.html</otherArchive>
- </otherArchives>
- </mailingList>
- <mailingList>
- <name>Maven Developer List</name>
- <subscribe>[EMAIL PROTECTED]</subscribe>
- <unsubscribe>[EMAIL PROTECTED]</unsubscribe>
- <post>[email protected]</post>
-
<archive>http://mail-archives.apache.org/mod_mbox/maven-dev</archive>
- </mailingList>
- <mailingList>
- <name>Maven Commits List</name>
- <subscribe>[EMAIL PROTECTED]</subscribe>
- <unsubscribe>[EMAIL PROTECTED]</unsubscribe>
- <post>[email protected]</post>
-
<archive>http://mail-archives.apache.org/mod_mbox/maven-dev</archive>
- </mailingList>
- <!-- duplication from maven-parent pom - temporary until they
inherit properly -->
- <mailingList>
- <name>Maven Announcements List</name>
- <post>[email protected]</post>
- <subscribe>[EMAIL PROTECTED]</subscribe>
- <unsubscribe>[EMAIL PROTECTED]</unsubscribe>
-
<archive>http://mail-archives.apache.org/mod_mbox/maven-announce/</archive>
- </mailingList>
- <mailingList>
- <name>Maven Issues List</name>
- <post>[email protected]</post>
- <subscribe>[EMAIL PROTECTED]</subscribe>
- <unsubscribe>[EMAIL PROTECTED]</unsubscribe>
-
<archive>http://mail-archives.apache.org/mod_mbox/maven-issues/</archive>
- </mailingList>
- <mailingList>
- <name>Maven Notifications List</name>
- <post>[email protected]</post>
- <subscribe>[EMAIL PROTECTED]</subscribe>
- <unsubscribe>[EMAIL PROTECTED]</unsubscribe>
-
<archive>http://mail-archives.apache.org/mod_mbox/maven-notifications/</archive>
- </mailingList>
- </mailingLists>
<developers>
<developer>
- <id>brianfox</id>
+ <id>brianf</id>
<name>Brian Fox</name>
- <email>[EMAIL PROTECTED]</email>
+ <email>[EMAIL PROTECTED]</email>
<roles>
<role>Lead Developer</role>
</roles>
@@ -119,17 +68,6 @@
</plugin>
</plugins>
<resources>
- <!-- Include the apache process LICENSE and NOTICE
files.-->
- <!--uncomment for release. Commented out for now to
enable eclipse-plugin to work-->
- <!--<resource>
- <targetPath>META-INF</targetPath>
- <filtering>false</filtering>
- <directory>${basedir}</directory>
- <includes>
- <include>LICENSE</include>
- <include>NOTICE</include>
- </includes>
- </resource>-->
<!-- Include super-pom defined main/resources
Removing this section will break the build.
Since we have defined a new build/resources
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DefaultEnforcementRuleHelper.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DefaultEnforcementRuleHelper.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DefaultEnforcementRuleHelper.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DefaultEnforcementRuleHelper.java
Mon Apr 2 18:57:27 2007
@@ -19,11 +19,15 @@
* under the License.
*/
+import java.io.File;
+
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/**
@@ -32,17 +36,21 @@
* like the log.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
- * @version $Id$
+ * @version $Id: DefaultEnforcementRuleHelper.java 523141 2007-03-28 02:11:47Z
+ * brianf $
*/
public class DefaultEnforcementRuleHelper
implements EnforcerRuleHelper
{
Log log;
+ ExpressionEvaluator evaluator;
+
MavenSession session;
- public DefaultEnforcementRuleHelper( MavenSession session, Log log )
+ public DefaultEnforcementRuleHelper( MavenSession session,
ExpressionEvaluator evaluator, Log log )
{
+ this.evaluator = evaluator;
this.log = log;
this.session = session;
}
@@ -52,26 +60,36 @@
return log;
}
- public MavenSession getSession()
- {
- return session;
- }
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#alignToBaseDirectory(java.io.File)
+ */
+ public File alignToBaseDirectory( File theFile )
+ {
+ return evaluator.alignToBaseDirectory( theFile );
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator#evaluate(java.lang.String)
+ */
+ public Object evaluate( String theExpression )
+ throws ExpressionEvaluationException
+ {
+ return evaluator.evaluate( theExpression );
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper#getRuntimeInformation()
+ */
public Object getComponent( Class clazz )
throws ComponentLookupException
{
return session.lookup( clazz.getName() );
}
- public MavenProject getProject()
- throws ComponentLookupException
- {
- return (MavenProject) getComponent( MavenProject.class );
- }
-
- public RuntimeInformation getRuntimeInformation()
- throws ComponentLookupException
- {
- return (RuntimeInformation) getComponent( RuntimeInformation.class );
- }
}
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DisplayInfoMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DisplayInfoMojo.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DisplayInfoMojo.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/DisplayInfoMojo.java
Mon Apr 2 18:57:27 2007
@@ -24,6 +24,10 @@
import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.path.PathTranslator;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/**
@@ -36,16 +40,32 @@
public class DisplayInfoMojo
extends AbstractMojo
{
+
/**
- * Maven Session.
+ * Path Translator needed by the ExpressionEvaluator
+ *
+ * @component role="org.apache.maven.project.path.PathTranslator"
+ */
+ protected PathTranslator translator;
+
+ /**
+ * The MavenSession
*
* @parameter expression="${session}"
- * @required
- * @readonly
*/
protected MavenSession session;
/**
+ * POM
+ *
+ * @parameter expression="${project}"
+ * @readonly
+ * @required
+ */
+ protected MavenProject project;
+
+
+ /**
* Entry point to the mojo
*/
public void execute()
@@ -53,8 +73,9 @@
{
try
{
- DefaultEnforcementRuleHelper helper = new
DefaultEnforcementRuleHelper( session, getLog() );
- RuntimeInformation rti = helper.getRuntimeInformation();
+ EnforcerExpressionEvaluator evaluator = new
EnforcerExpressionEvaluator( session, translator, project );
+ DefaultEnforcementRuleHelper helper = new
DefaultEnforcementRuleHelper( session, evaluator, getLog() );
+ RuntimeInformation rti = (RuntimeInformation) helper.getComponent(
RuntimeInformation.class );
getLog().info( "Maven Version: " + rti.getApplicationVersion() );
RequireJavaVersion java = new RequireJavaVersion();
getLog().info(
@@ -66,7 +87,7 @@
}
catch ( ComponentLookupException e )
{
- getLog().warn( "Unable to retreive component." +
e.getLocalizedMessage() );
+ getLog().warn( "Unable to Lookup component: " +
e.getLocalizedMessage() );
}
}
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforceMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforceMojo.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforceMojo.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforceMojo.java
Mon Apr 2 18:57:27 2007
@@ -20,19 +20,18 @@
*/
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.shared.enforcer.rule.api.EnforcerRule;
import org.apache.maven.shared.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
/**
* This goal executes the defined enforcer-rules once per module.
@@ -45,16 +44,31 @@
public class EnforceMojo
extends AbstractMojo
{
+
/**
- * Runtime information containing Maven Version.
+ * Path Translator needed by the ExpressionEvaluator
+ *
+ * @component role="org.apache.maven.project.path.PathTranslator"
+ */
+ protected PathTranslator translator;
+
+ /**
+ * The MavenSession
*
* @parameter expression="${session}"
- * @required
- * @readonly
*/
protected MavenSession session;
/**
+ * POM
+ *
+ * @parameter expression="${project}"
+ * @readonly
+ * @required
+ */
+ protected MavenProject project;
+
+ /**
* Flag to fail the build if a version check fails.
*
* @parameter expression="${enforcer.fail}" default-value="true"
@@ -77,6 +91,7 @@
/**
* List of objects that implement the EnforcerRule interface to execute.
+ *
* @parameter
* @required
*/
@@ -90,6 +105,8 @@
{
Log log = this.getLog();
+ EnforcerExpressionEvaluator evaluator = new
EnforcerExpressionEvaluator( session, translator, project );
+
// the entire execution can be easily skipped
if ( !skip )
{
@@ -102,7 +119,7 @@
String currentRule = "Unknown";
// create my helper
- EnforcerRuleHelper helper = new DefaultEnforcementRuleHelper(
session, log );
+ EnforcerRuleHelper helper = new DefaultEnforcementRuleHelper(
session, evaluator, log );
// if we are only warning, then disable failFast
if ( !fail )
@@ -110,7 +127,7 @@
failFast = false;
}
- // go through each rule unless
+ // go through each rul
for ( int i = 0; i < rules.length; i++ )
{
@@ -137,7 +154,7 @@
}
else
{
- list.add( "Rule "+i+": "+currentRule+" failed
with message: " + e.getMessage());
+ list.add( "Rule " + i + ": " + currentRule + "
failed with message: " + e.getMessage() );
}
}
}
@@ -205,23 +222,6 @@
}
/**
- * @return the session
- */
- public MavenSession getSession()
- {
- return this.session;
- }
-
- /**
- * @param theSession
- * the session to set
- */
- public void setSession( MavenSession theSession )
- {
- this.session = theSession;
- }
-
- /**
* @return the skip
*/
public boolean isSkip()
@@ -247,11 +247,11 @@
}
/**
- * @param theFailFast the failFast to set
+ * @param theFailFast
+ * the failFast to set
*/
public void setFailFast( boolean theFailFast )
{
this.failFast = theFailFast;
}
-
}
Added:
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforcerExpressionEvaluator.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforcerExpressionEvaluator.java?view=auto&rev=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforcerExpressionEvaluator.java
(added)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/EnforcerExpressionEvaluator.java
Mon Apr 2 18:57:27 2007
@@ -0,0 +1,32 @@
+package org.apache.maven.plugin.enforcer;
+
+import java.util.Properties;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.path.PathTranslator;
+
+/**
+ * @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
+ * This class wraps the PluginParameterExpressionEvaluator because it can't be
accessed directly in 2.0.x so we muct
+ * create a new one.
+ */
+public class EnforcerExpressionEvaluator
+ extends PluginParameterExpressionEvaluator
+{
+
+ /**
+ * @param theContext
+ * @param theMojoExecution
+ * @param thePathTranslator
+ * @param theProject
+ */
+ public EnforcerExpressionEvaluator( MavenSession theContext,
PathTranslator thePathTranslator, MavenProject theProject )
+ {
+ super( theContext, new MojoExecution(new MojoDescriptor()),
thePathTranslator, null, theProject, theContext.getExecutionProperties() );
+ }
+
+}
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/RequireMavenVersion.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/RequireMavenVersion.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/RequireMavenVersion.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugin/enforcer/RequireMavenVersion.java
Mon Apr 2 18:57:27 2007
@@ -24,6 +24,7 @@
import org.apache.maven.shared.enforcer.rule.api.EnforcerRule;
import org.apache.maven.shared.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/**
@@ -42,14 +43,15 @@
{
try
{
- RuntimeInformation rti = helper.getRuntimeInformation();
+ RuntimeInformation rti = (RuntimeInformation) helper.getComponent(
RuntimeInformation.class);
ArtifactVersion detectedMavenVersion = rti.getApplicationVersion();
helper.getLog().debug( "Detected Maven Version: " +
detectedMavenVersion );
enforceVersion( helper.getLog(), "Maven", this.version,
detectedMavenVersion );
}
catch ( ComponentLookupException e )
{
- throw new EnforcerRuleException( "Unable to lookup the component:
RuntimeInformation", e );
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
}
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/EnforcerTestUtils.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/EnforcerTestUtils.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/EnforcerTestUtils.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/EnforcerTestUtils.java
Mon Apr 2 18:57:27 2007
@@ -22,6 +22,9 @@
import java.util.Date;
import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+import org.apache.maven.shared.enforcer.rule.api.EnforcerRuleHelper;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
@@ -32,5 +35,12 @@
public static MavenSession getMavenSession()
{
return new MavenSession( new MockPlexusContainer(), null, null, null,
null, null, null, null, new Date() );
+ }
+
+ public static EnforcerRuleHelper getHelper()
+ {
+ MavenSession session = getMavenSession();
+ ExpressionEvaluator eval = new EnforcerExpressionEvaluator(session,new
MockPathTranslator(), new MockProject());
+ return new DefaultEnforcementRuleHelper(session,eval,new
SystemStreamLog());
}
}
Added:
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockPathTranslator.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockPathTranslator.java?view=auto&rev=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockPathTranslator.java
(added)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockPathTranslator.java
Mon Apr 2 18:57:27 2007
@@ -0,0 +1,58 @@
+package org.apache.maven.plugin.enforcer;
+
+import java.io.File;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.project.path.PathTranslator;
+
+/**
+ * @author <a href="mailto:[EMAIL PROTECTED]">Brian Fox</a>
+ *
+ */
+public class MockPathTranslator
+ implements PathTranslator
+{
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.apache.maven.project.path.PathTranslator#alignToBaseDirectory(org.apache.maven.model.Model,
+ * java.io.File)
+ */
+ public void alignToBaseDirectory( Model theModel, File theBasedir )
+ {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.apache.maven.project.path.PathTranslator#alignToBaseDirectory(java.lang.String,
+ * java.io.File)
+ */
+ public String alignToBaseDirectory( String thePath, File theBasedir )
+ {
+ return theBasedir.getAbsolutePath();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.apache.maven.project.path.PathTranslator#unalignFromBaseDirectory(org.apache.maven.model.Model,
+ * java.io.File)
+ */
+ public void unalignFromBaseDirectory( Model theModel, File theBasedir )
+ {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.apache.maven.project.path.PathTranslator#unalignFromBaseDirectory(java.lang.String,
+ * java.io.File)
+ */
+ public String unalignFromBaseDirectory( String theDirectory, File
theBasedir )
+ {
+ return theBasedir.getAbsolutePath();
+ }
+
+}
Added:
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockProject.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockProject.java?view=auto&rev=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockProject.java
(added)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/MockProject.java
Mon Apr 2 18:57:27 2007
@@ -0,0 +1,1037 @@
+package org.apache.maven.plugin.enforcer;
+
+/*
+ * 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.DefaultArtifact;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.VersionRange;
+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 maven project, going to take a lot of work to make it
+ * useful as a stub though
+ */
+public class MockProject
+ extends MavenProject
+{
+ private String groupId;
+
+ private String artifactId;
+
+ private String name;
+
+ private Model model;
+
+ private MavenProject parent;
+
+ private List dependencies;
+
+ 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 DependencyManagement dependencyManagement;
+
+ 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 Set artifacts;
+
+ public MockProject()
+ {
+ super( (Model) null );
+ }
+
+ // kinda dangerous...
+ public MockProject( Model model )
+ {
+ // super(model);
+ super( (Model) null );
+ }
+
+ // kinda dangerous...
+ public MockProject( MavenProject project )
+ {
+ // super(project);
+ super( (Model) null );
+ }
+
+ public String getModulePathAdjustment( MavenProject mavenProject )
+ throws IOException
+ {
+ return "";
+ }
+
+ public Artifact getArtifact()
+ {
+ return null;
+ }
+
+ public void setArtifact( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+ public Model getModel()
+ {
+ return model;
+ }
+
+ public MavenProject getParent()
+ {
+ return parent;
+ }
+
+ public void setParent( MavenProject mavenProject )
+ {
+ this.parent = mavenProject;
+ }
+
+ public void setRemoteArtifactRepositories( List list )
+ {
+
+ }
+
+ public List getRemoteArtifactRepositories()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public boolean hasParent()
+ {
+ if ( parent != null )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+ public void setFile( File file )
+ {
+ this.file = file;
+ }
+
+ public File getBasedir()
+ {
+ return new File( PlexusTestCase.getBasedir() );
+ }
+
+ public void setDependencies( List list )
+ {
+ dependencies = list;
+ }
+
+ public List getDependencies()
+ {
+ if ( dependencies == null )
+ {
+ dependencies = Collections.EMPTY_LIST;
+ }
+ return dependencies;
+ }
+
+ public void setDependencyManagement( DependencyManagement depMgt )
+ {
+ this.dependencyManagement = depMgt;
+ }
+
+ public DependencyManagement getDependencyManagement()
+ {
+ if ( dependencyManagement == null )
+ {
+ dependencyManagement = new DependencyManagement();
+ }
+
+ return dependencyManagement;
+ }
+
+ public void addCompileSourceRoot( String string )
+ {
+ if ( compileSourceRoots == null )
+ {
+ compileSourceRoots = Collections.singletonList( string );
+ }
+ else
+ {
+ compileSourceRoots.add( string );
+ }
+ }
+
+ public void addScriptSourceRoot( String string )
+ {
+ if ( scriptSourceRoots == null )
+ {
+ scriptSourceRoots = Collections.singletonList( string );
+ }
+ else
+ {
+ scriptSourceRoots.add( string );
+ }
+ }
+
+ public void addTestCompileSourceRoot( String string )
+ {
+ if ( testCompileSourceRoots == null )
+ {
+ testCompileSourceRoots = Collections.singletonList( string );
+ }
+ else
+ {
+ testCompileSourceRoots.add( string );
+ }
+ }
+
+ public List getCompileSourceRoots()
+ {
+ return compileSourceRoots;
+ }
+
+ public List getScriptSourceRoots()
+ {
+ return scriptSourceRoots;
+ }
+
+ public List getTestCompileSourceRoots()
+ {
+ return testCompileSourceRoots;
+ }
+
+ public List getCompileClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return compileSourceRoots;
+ }
+
+ public void setCompileArtifacts( List compileArtifacts )
+ {
+ this.compileArtifacts = compileArtifacts;
+ }
+
+ public List getCompileArtifacts()
+ {
+ return compileArtifacts;
+ }
+
+ public List getCompileDependencies()
+ {
+ return compileDependencies;
+ }
+
+ public List getTestClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return testClasspathElements;
+ }
+
+ public List getTestArtifacts()
+ {
+ return testArtifacts;
+ }
+
+ public List getTestDependencies()
+ {
+ return testDependencies;
+ }
+
+ public List getRuntimeClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return runtimeClasspathElements;
+ }
+
+ public List getRuntimeArtifacts()
+ {
+ return runtimeArtifacts;
+ }
+
+ public List getRuntimeDependencies()
+ {
+ return runtimeDependencies;
+ }
+
+ public List getSystemClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ return systemClasspathElements;
+ }
+
+ public List getSystemArtifacts()
+ {
+ return systemArtifacts;
+ }
+
+ public void setRuntimeClasspathElements( List runtimeClasspathElements )
+ {
+ this.runtimeClasspathElements = runtimeClasspathElements;
+ }
+
+ public void setAttachedArtifacts( List attachedArtifacts )
+ {
+ this.attachedArtifacts = attachedArtifacts;
+ }
+
+ public void setCompileSourceRoots( List compileSourceRoots )
+ {
+ this.compileSourceRoots = compileSourceRoots;
+ }
+
+ public void setTestCompileSourceRoots( List testCompileSourceRoots )
+ {
+ this.testCompileSourceRoots = testCompileSourceRoots;
+ }
+
+ public void setScriptSourceRoots( List scriptSourceRoots )
+ {
+ this.scriptSourceRoots = scriptSourceRoots;
+ }
+
+ public void setArtifactMap( Map artifactMap )
+ {
+ // this.artifactMap = artifactMap;
+ }
+
+ public void setPluginArtifactMap( Map pluginArtifactMap )
+ {
+ // this.pluginArtifactMap = pluginArtifactMap;
+ }
+
+ public void setReportArtifactMap( Map reportArtifactMap )
+ {
+ // this.reportArtifactMap = reportArtifactMap;
+ }
+
+ public void setExtensionArtifactMap( Map extensionArtifactMap )
+ {
+ // this.extensionArtifactMap = extensionArtifactMap;
+ }
+
+ public void setProjectReferences( Map projectReferences )
+ {
+ // this.projectReferences = projectReferences;
+ }
+
+ public void setBuildOverlay( Build buildOverlay )
+ {
+ // this.buildOverlay = buildOverlay;
+ }
+
+ public void setCompileDependencies( List compileDependencies )
+ {
+ this.compileDependencies = compileDependencies;
+ }
+
+ public void setSystemDependencies( List systemDependencies )
+ {
+ this.systemDependencies = systemDependencies;
+ }
+
+ public void setTestClasspathElements( List testClasspathElements )
+ {
+ this.testClasspathElements = testClasspathElements;
+ }
+
+ public void setTestDependencies( List testDependencies )
+ {
+ this.testDependencies = testDependencies;
+ }
+
+ public void setSystemClasspathElements( List systemClasspathElements )
+ {
+ this.systemClasspathElements = systemClasspathElements;
+ }
+
+ public void setSystemArtifacts( List systemArtifacts )
+ {
+ this.systemArtifacts = systemArtifacts;
+ }
+
+ public void setTestArtifacts( List testArtifacts )
+ {
+ this.testArtifacts = testArtifacts;
+ }
+
+ public void setRuntimeArtifacts( List runtimeArtifacts )
+ {
+ this.runtimeArtifacts = runtimeArtifacts;
+ }
+
+ public void setRuntimeDependencies( List runtimeDependencies )
+ {
+ this.runtimeDependencies = runtimeDependencies;
+ }
+
+ public void setModel( Model model )
+ {
+ this.model = model;
+ }
+
+ public List getSystemDependencies()
+ {
+ return systemDependencies;
+ }
+
+ public void setModelVersion( String string )
+ {
+ this.modelVersion = string;
+ }
+
+ public String getModelVersion()
+ {
+ return modelVersion;
+ }
+
+ public String getId()
+ {
+ return "";
+ }
+
+ public void setGroupId( String string )
+ {
+ this.groupId = string;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setArtifactId( String string )
+ {
+ this.artifactId = string;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public void setName( String string )
+ {
+ this.name = string;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setVersion( String string )
+ {
+ this.version = string;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public String getPackaging()
+ {
+ return packaging;
+ }
+
+ public void setPackaging( String string )
+ {
+ this.packaging = string;
+ }
+
+ public void setInceptionYear( String string )
+ {
+ this.inceptionYear = string;
+ }
+
+ public String getInceptionYear()
+ {
+ return inceptionYear;
+ }
+
+ public void setUrl( String string )
+ {
+ this.url = string;
+ }
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public Prerequisites getPrerequisites()
+ {
+ return null;
+ }
+
+ public void setIssueManagement( IssueManagement issueManagement )
+ {
+
+ }
+
+ public CiManagement getCiManagement()
+ {
+ return null;
+ }
+
+ public void setCiManagement( CiManagement ciManagement )
+ {
+
+ }
+
+ public IssueManagement getIssueManagement()
+ {
+ return null;
+ }
+
+ public void setDistributionManagement( DistributionManagement
distributionManagement )
+ {
+
+ }
+
+ public DistributionManagement getDistributionManagement()
+ {
+ return null;
+ }
+
+ public void setDescription( String string )
+ {
+ this.description = string;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setOrganization( Organization organization )
+ {
+
+ }
+
+ public Organization getOrganization()
+ {
+ return null;
+ }
+
+ public void setScm( Scm scm )
+ {
+
+ }
+
+ public Scm getScm()
+ {
+ return null;
+ }
+
+ public void setMailingLists( List list )
+ {
+
+ }
+
+ public List getMailingLists()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public void addMailingList( MailingList mailingList )
+ {
+
+ }
+
+ public void setDevelopers( List list )
+ {
+
+ }
+
+ public List getDevelopers()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public void addDeveloper( Developer developer )
+ {
+
+ }
+
+ public void setContributors( List list )
+ {
+
+ }
+
+ public List getContributors()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public void addContributor( Contributor contributor )
+ {
+
+ }
+
+ public void setBuild( Build build )
+ {
+
+ }
+
+ public Build getBuild()
+ {
+ return null;
+ }
+
+ public List getResources()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public List getTestResources()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public void addResource( Resource resource )
+ {
+
+ }
+
+ public void addTestResource( Resource resource )
+ {
+
+ }
+
+ public void setReporting( Reporting reporting )
+ {
+
+ }
+
+ public Reporting getReporting()
+ {
+ return null;
+ }
+
+ public void setLicenses( List list )
+ {
+
+ }
+
+ public List getLicenses()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public void addLicense( License license )
+ {
+
+ }
+
+ public void setArtifacts( Set set )
+ {
+ this.artifacts = set;
+ }
+
+ public Set getArtifacts()
+ {
+ if ( artifacts == null )
+ {
+ return Collections.EMPTY_SET;
+ }
+ else
+ {
+ return artifacts;
+ }
+ }
+
+ public Map getArtifactMap()
+ {
+ return Collections.singletonMap( "", "" );
+ }
+
+ public void setPluginArtifacts( Set set )
+ {
+
+ }
+
+ public Set getPluginArtifacts()
+ {
+ return Collections.singleton( "" );
+ }
+
+ public Map getPluginArtifactMap()
+ {
+ return Collections.singletonMap( "", "" );
+ }
+
+ public void setReportArtifacts( Set set )
+ {
+
+ }
+
+ public Set getReportArtifacts()
+ {
+ return Collections.singleton( "" );
+ }
+
+ public Map getReportArtifactMap()
+ {
+ return Collections.singletonMap( "", "" );
+ }
+
+ public void setExtensionArtifacts( Set set )
+ {
+
+ }
+
+ public Set getExtensionArtifacts()
+ {
+ return Collections.singleton( "" );
+ }
+
+ public Map getExtensionArtifactMap()
+ {
+ return Collections.singletonMap( "", "" );
+ }
+
+ public void setParentArtifact( Artifact artifact )
+ {
+
+ }
+
+ public Artifact getParentArtifact()
+ {
+ return null;
+ }
+
+ public List getRepositories()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public List getReportPlugins()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public List getBuildPlugins()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public List getModules()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public PluginManagement getPluginManagement()
+ {
+ return null;
+ }
+
+ public void addPlugin( Plugin plugin )
+ {
+
+ }
+
+ public void injectPluginManagementInfo( Plugin plugin )
+ {
+
+ }
+
+ public List getCollectedProjects()
+ {
+ return collectedProjects;
+ }
+
+ public void setCollectedProjects( List list )
+ {
+ this.collectedProjects = list;
+ }
+
+ public void setPluginArtifactRepositories( List list )
+ {
+ this.pluginArtifactRepositories = list;
+ }
+
+ public List getPluginArtifactRepositories()
+ {
+ return pluginArtifactRepositories;
+ }
+
+ public ArtifactRepository getDistributionManagementArtifactRepository()
+ {
+ return null;
+ }
+
+ public List getPluginRepositories()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public void setActiveProfiles( List list )
+ {
+ activeProfiles = list;
+ }
+
+ public List getActiveProfiles()
+ {
+ return activeProfiles;
+ }
+
+ public void addAttachedArtifact( Artifact theArtifact )
+ {
+ if ( attachedArtifacts == null )
+ {
+ this.attachedArtifacts = Collections.singletonList( theArtifact );
+ }
+ else
+ {
+ attachedArtifacts.add( theArtifact );
+ }
+ }
+
+ public List getAttachedArtifacts()
+ {
+ return attachedArtifacts;
+ }
+
+ public Xpp3Dom getGoalConfiguration( String string, String string1, String
string2, String string3 )
+ {
+ return null;
+ }
+
+ public Xpp3Dom getReportConfiguration( String string, String string1,
String string2 )
+ {
+ return null;
+ }
+
+ public MavenProject getExecutionProject()
+ {
+ return null;
+ }
+
+ public void setExecutionProject( MavenProject mavenProject )
+ {
+
+ }
+
+ public void writeModel( Writer writer )
+ throws IOException
+ {
+
+ }
+
+ public void writeOriginalModel( Writer writer )
+ throws IOException
+ {
+
+ }
+
+ public Set getDependencyArtifacts()
+ {
+ return dependencyArtifacts;
+ }
+
+ public void setDependencyArtifacts( Set set )
+ {
+ this.dependencyArtifacts = set;
+ }
+
+ public void setReleaseArtifactRepository( ArtifactRepository
artifactRepository )
+ {
+ // this.releaseArtifactRepository = artifactRepository;
+ }
+
+ public void setSnapshotArtifactRepository( ArtifactRepository
artifactRepository )
+ {
+ // this.snapshotArtifactRepository = artifactRepository;
+ }
+
+ public void setOriginalModel( Model model )
+ {
+ this.originalModel = model;
+ }
+
+ public Model getOriginalModel()
+ {
+ return originalModel;
+ }
+
+ public List getBuildExtensions()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public Set createArtifacts( ArtifactFactory artifactFactory, String
string, ArtifactFilter artifactFilter )
+ throws InvalidDependencyVersionException
+ {
+ return Collections.EMPTY_SET;
+ }
+
+ public void addProjectReference( MavenProject mavenProject )
+ {
+
+ }
+
+ public void attachArtifact( String string, String string1, File theFile )
+ {
+
+ }
+
+ public Properties getProperties()
+ {
+ return new Properties();
+ }
+
+ public List getFilters()
+ {
+ return Collections.singletonList( "" );
+ }
+
+ public Map getProjectReferences()
+ {
+ return Collections.singletonMap( "", "" );
+ }
+
+ public boolean isExecutionRoot()
+ {
+ return executionRoot;
+ }
+
+ public void setExecutionRoot( boolean b )
+ {
+ this.executionRoot = b;
+ }
+
+ public String getDefaultGoal()
+ {
+ return defaultGoal;
+ }
+
+ public Artifact replaceWithActiveArtifact( Artifact theArtifact )
+ {
+ return null;
+ }
+}
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestDefaultEnforcementRuleHelper.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestDefaultEnforcementRuleHelper.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestDefaultEnforcementRuleHelper.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestDefaultEnforcementRuleHelper.java
Mon Apr 2 18:57:27 2007
@@ -21,8 +21,10 @@
import junit.framework.TestCase;
+import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugin.logging.SystemStreamLog;
+import
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/**
@@ -31,16 +33,15 @@
*/
public class TestDefaultEnforcementRuleHelper extends TestCase
{
- public void testHelper() throws ComponentLookupException
+ public void testHelper() throws ComponentLookupException,
ExpressionEvaluationException
{
Log log = new SystemStreamLog();
- DefaultEnforcementRuleHelper helper = new
DefaultEnforcementRuleHelper(EnforcerTestUtils.getMavenSession(),log);
+ DefaultEnforcementRuleHelper helper = (DefaultEnforcementRuleHelper)
EnforcerTestUtils.getHelper();
- assertSame( log, helper.getLog() );
-
- assertNotNull( helper.getSession());
- assertNotNull(helper.getProject());
- assertNotNull( helper.getRuntimeInformation() );
+ assertNotNull( helper.getLog() );
+ assertNotNull( helper.evaluate( "${session}" ));
+ assertNotNull(helper.evaluate( "${project}" ));
+ assertNotNull( helper.getComponent( RuntimeInformation.class ) );
}
}
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestMavenVersion.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestMavenVersion.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestMavenVersion.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestMavenVersion.java
Mon Apr 2 18:57:27 2007
@@ -40,8 +40,7 @@
RequireMavenVersion rule = new RequireMavenVersion();
rule.setVersion( "2.0.5" );
- EnforcerRuleHelper helper = new DefaultEnforcementRuleHelper(
EnforcerTestUtils.getMavenSession(),
- new
SystemStreamLog() );
+ EnforcerRuleHelper helper = EnforcerTestUtils.getHelper();
// test the singular version
rule.execute( helper );
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireJavaVersion.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireJavaVersion.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireJavaVersion.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireJavaVersion.java
Mon Apr 2 18:57:27 2007
@@ -60,8 +60,7 @@
RequireJavaVersion rule = new RequireJavaVersion();
rule.setVersion( thisVersion );
- EnforcerRuleHelper helper = new DefaultEnforcementRuleHelper(
EnforcerTestUtils.getMavenSession(),
- new
SystemStreamLog() );
+ EnforcerRuleHelper helper = EnforcerTestUtils.getHelper();
// test the singular version
rule.execute( helper );
Modified:
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireOS.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireOS.java?view=diff&rev=524997&r1=524996&r2=524997
==============================================================================
---
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireOS.java
(original)
+++
maven/plugins/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugin/enforcer/TestRequireOS.java
Mon Apr 2 18:57:27 2007
@@ -74,7 +74,7 @@
rule.setFamily( "junk" );
try
{
- rule.execute( new DefaultEnforcementRuleHelper(
EnforcerTestUtils.getMavenSession(), log ) );
+ rule.execute( EnforcerTestUtils.getHelper() );
fail( "Expected MojoExecution Exception becuase of invalid family
type" );
}
catch ( EnforcerRuleException e )