You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2007/12/28 17:16:11 UTC
svn commit: r607279 [2/2] - in /maven/enforcer/trunk/maven-enforcer-plugin:
./ src/it/ src/main/java/org/apache/maven/plugins/enforcer/
src/main/java/org/apache/maven/plugins/enforcer/util/ src/site/
src/site/apt/ src/site/fml/ src/test/java/org/apache...
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java Fri Dec 28 08:16:09 2007
@@ -1,376 +1,376 @@
-package org.apache.maven.plugins.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.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.apache.maven.enforcer.rule.api.EnforcerRule;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
-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.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.ContextException;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
-
-/**
- * This goal executes the defined enforcer-rules once per
- * module.
- *
- * @requiresDependencyResolution test
- * @goal enforce
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @phase validate
- * @version $Id: EnforceMojo.java 571676 2007-09-01
- * 03:28:56Z brianf $
- */
-public class EnforceMojo
- extends AbstractMojo
- implements Contextualizable
-{
-
- /**
- * Path Translator needed by the ExpressionEvaluator
- *
- * @component role="org.apache.maven.project.path.PathTranslator"
- */
- protected PathTranslator translator;
-
- /**
- * The MavenSession
- *
- * @parameter expression="${session}"
- */
- 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"
- */
- protected boolean fail = true;
-
- /**
- * Flag to easily skip all checks
- *
- * @parameter expression="${enforcer.skip}"
- * default-value="false"
- */
- protected boolean skip = false;
-
- /**
- * Fail on the first rule that doesn't pass
- *
- * @parameter expression="${enforcer.failFast}"
- * default-value="false"
- */
- protected boolean failFast = false;
-
- /**
- * Array of objects that implement the EnforcerRule
- * interface to execute.
- *
- * @parameter
- * @required
- */
- private EnforcerRule[] rules;
-
- /**
- * Use this flag to disable rule result caching. This will cause
- * all rules to execute on each project even if the rule indicates it can
- * safely be cached.
- * @parameter expression="${enforcer.ignoreCache}"
- * default-value="false"
- */
- protected boolean ignoreCache = false;
-
- /**
- * This is a static variable used to persist the cached results across plugin invocations.
- */
- protected static Hashtable cache = new Hashtable();
-
-
- // set by the contextualize method. Only way to get the
- // plugin's container in 2.0.x
- protected PlexusContainer container;
-
- public void contextualize ( Context context )
- throws ContextException
- {
- container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
- }
-
- /**
- * Entry point to the mojo
- */
- public void execute ()
- throws MojoExecutionException
- {
- Log log = this.getLog();
-
- EnforcerExpressionEvaluator evaluator = new EnforcerExpressionEvaluator( session, translator, project );
-
- // the entire execution can be easily skipped
- if ( !skip )
- {
- // list to store exceptions
- ArrayList list = new ArrayList();
-
- // make sure the rules exist
- if ( rules != null && rules.length > 0 )
- {
- String currentRule = "Unknown";
-
- // create my helper
- EnforcerRuleHelper helper = new DefaultEnforcementRuleHelper( session, evaluator, log, container );
-
- // if we are only warning, then disable
- // failFast
- if ( !fail )
- {
- failFast = false;
- }
-
- // go through each rule
- for ( int i = 0; i < rules.length; i++ )
- {
-
- // prevent against empty rules
- EnforcerRule rule = rules[i];
- if ( rule != null )
- {
- // store the current rule for
- // logging purposes
- currentRule = rule.getClass().getName();
- log.debug( "Executing rule: " + currentRule );
- try
- {
- if ( ignoreCache || shouldExecute( rule ) )
- {
- // execute the rule
- rules[i].execute( helper );
- }
- }
- catch ( EnforcerRuleException e )
- {
- // i can throw an exception
- // because failfast will be
- // false if fail is false.
- if ( failFast )
- {
- throw new MojoExecutionException( currentRule + " failed with message:\n"
- + e.getMessage(), e );
- }
- else
- {
- list.add( "Rule " + i + ": " + currentRule + " failed with message:\n" + e.getMessage() );
- }
- }
- }
- }
-
- // if we found anything
- if ( !list.isEmpty() )
- {
- Iterator iter = list.iterator();
- while ( iter.hasNext() )
- {
- String failure = (String) iter.next();
- log.warn( failure );
- }
- if ( fail )
- {
- throw new MojoExecutionException(
- "Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed." );
- }
- }
- }
- else
- {
- throw new MojoExecutionException(
- "No rules are configured. Use the skip flag if you want to disable execution." );
- }
- }
- else
- {
- log.info( "Skipping Rule Enforcement." );
- }
- }
-
- /**
- * This method determines if a rule should execute based
- * on the cache
- *
- * @param rule
- * @return
- */
- protected boolean shouldExecute ( EnforcerRule rule )
- {
- if ( rule.isCacheable() )
- {
- Log log = this.getLog();
- log.debug( "Rule " + rule.getClass().getName() + " is cacheable." );
- String key = rule.getClass().getName() + " " + rule.getCacheId();
- if ( EnforceMojo.cache.containsKey( key ) )
- {
- log.debug( "Key " + key + " was found in the cache" );
- if ( rule.isResultValid( (EnforcerRule) cache.get( key ) ) )
- {
- log.info( "The cached results are still valid. Skipping the rule: "+rule.getClass().getName() );
- return false;
- }
- }
-
- //add it to the cache of executed rules
- EnforceMojo.cache.put( key, rule );
- }
- return true;
- }
-
- /**
- * @return the fail
- */
- public boolean isFail ()
- {
- return this.fail;
- }
-
- /**
- * @param theFail the fail to set
- */
- public void setFail ( boolean theFail )
- {
- this.fail = theFail;
- }
-
- /**
- * @return the rules
- */
- public EnforcerRule[] getRules ()
- {
- return this.rules;
- }
-
- /**
- * @param theRules the rules to set
- */
- public void setRules ( EnforcerRule[] theRules )
- {
- this.rules = theRules;
- }
-
- /**
- * @return the skip
- */
- public boolean isSkip ()
- {
- return this.skip;
- }
-
- /**
- * @param theSkip the skip to set
- */
- public void setSkip ( boolean theSkip )
- {
- this.skip = theSkip;
- }
-
- /**
- * @return the failFast
- */
- public boolean isFailFast ()
- {
- return this.failFast;
- }
-
- /**
- * @param theFailFast the failFast to set
- */
- public void setFailFast ( boolean theFailFast )
- {
- this.failFast = theFailFast;
- }
-
- /**
- * @return the project
- */
- public MavenProject getProject ()
- {
- return this.project;
- }
-
- /**
- * @param theProject the project to set
- */
- public void setProject ( MavenProject theProject )
- {
- this.project = theProject;
- }
-
- /**
- * @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 translator
- */
- public PathTranslator getTranslator ()
- {
- return this.translator;
- }
-
- /**
- * @param theTranslator the translator to set
- */
- public void setTranslator ( PathTranslator theTranslator )
- {
- this.translator = theTranslator;
- }
-}
+package org.apache.maven.plugins.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.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+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.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+
+/**
+ * This goal executes the defined enforcer-rules once per
+ * module.
+ *
+ * @requiresDependencyResolution test
+ * @goal enforce
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @phase validate
+ * @version $Id: EnforceMojo.java 571676 2007-09-01
+ * 03:28:56Z brianf $
+ */
+public class EnforceMojo
+ extends AbstractMojo
+ implements Contextualizable
+{
+
+ /**
+ * Path Translator needed by the ExpressionEvaluator
+ *
+ * @component role="org.apache.maven.project.path.PathTranslator"
+ */
+ protected PathTranslator translator;
+
+ /**
+ * The MavenSession
+ *
+ * @parameter expression="${session}"
+ */
+ 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"
+ */
+ protected boolean fail = true;
+
+ /**
+ * Flag to easily skip all checks
+ *
+ * @parameter expression="${enforcer.skip}"
+ * default-value="false"
+ */
+ protected boolean skip = false;
+
+ /**
+ * Fail on the first rule that doesn't pass
+ *
+ * @parameter expression="${enforcer.failFast}"
+ * default-value="false"
+ */
+ protected boolean failFast = false;
+
+ /**
+ * Array of objects that implement the EnforcerRule
+ * interface to execute.
+ *
+ * @parameter
+ * @required
+ */
+ private EnforcerRule[] rules;
+
+ /**
+ * Use this flag to disable rule result caching. This will cause
+ * all rules to execute on each project even if the rule indicates it can
+ * safely be cached.
+ * @parameter expression="${enforcer.ignoreCache}"
+ * default-value="false"
+ */
+ protected boolean ignoreCache = false;
+
+ /**
+ * This is a static variable used to persist the cached results across plugin invocations.
+ */
+ protected static Hashtable cache = new Hashtable();
+
+
+ // set by the contextualize method. Only way to get the
+ // plugin's container in 2.0.x
+ protected PlexusContainer container;
+
+ public void contextualize ( Context context )
+ throws ContextException
+ {
+ container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+ }
+
+ /**
+ * Entry point to the mojo
+ */
+ public void execute ()
+ throws MojoExecutionException
+ {
+ Log log = this.getLog();
+
+ EnforcerExpressionEvaluator evaluator = new EnforcerExpressionEvaluator( session, translator, project );
+
+ // the entire execution can be easily skipped
+ if ( !skip )
+ {
+ // list to store exceptions
+ ArrayList list = new ArrayList();
+
+ // make sure the rules exist
+ if ( rules != null && rules.length > 0 )
+ {
+ String currentRule = "Unknown";
+
+ // create my helper
+ EnforcerRuleHelper helper = new DefaultEnforcementRuleHelper( session, evaluator, log, container );
+
+ // if we are only warning, then disable
+ // failFast
+ if ( !fail )
+ {
+ failFast = false;
+ }
+
+ // go through each rule
+ for ( int i = 0; i < rules.length; i++ )
+ {
+
+ // prevent against empty rules
+ EnforcerRule rule = rules[i];
+ if ( rule != null )
+ {
+ // store the current rule for
+ // logging purposes
+ currentRule = rule.getClass().getName();
+ log.debug( "Executing rule: " + currentRule );
+ try
+ {
+ if ( ignoreCache || shouldExecute( rule ) )
+ {
+ // execute the rule
+ rules[i].execute( helper );
+ }
+ }
+ catch ( EnforcerRuleException e )
+ {
+ // i can throw an exception
+ // because failfast will be
+ // false if fail is false.
+ if ( failFast )
+ {
+ throw new MojoExecutionException( currentRule + " failed with message:\n"
+ + e.getMessage(), e );
+ }
+ else
+ {
+ list.add( "Rule " + i + ": " + currentRule + " failed with message:\n" + e.getMessage() );
+ }
+ }
+ }
+ }
+
+ // if we found anything
+ if ( !list.isEmpty() )
+ {
+ Iterator iter = list.iterator();
+ while ( iter.hasNext() )
+ {
+ String failure = (String) iter.next();
+ log.warn( failure );
+ }
+ if ( fail )
+ {
+ throw new MojoExecutionException(
+ "Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed." );
+ }
+ }
+ }
+ else
+ {
+ throw new MojoExecutionException(
+ "No rules are configured. Use the skip flag if you want to disable execution." );
+ }
+ }
+ else
+ {
+ log.info( "Skipping Rule Enforcement." );
+ }
+ }
+
+ /**
+ * This method determines if a rule should execute based
+ * on the cache
+ *
+ * @param rule
+ * @return
+ */
+ protected boolean shouldExecute ( EnforcerRule rule )
+ {
+ if ( rule.isCacheable() )
+ {
+ Log log = this.getLog();
+ log.debug( "Rule " + rule.getClass().getName() + " is cacheable." );
+ String key = rule.getClass().getName() + " " + rule.getCacheId();
+ if ( EnforceMojo.cache.containsKey( key ) )
+ {
+ log.debug( "Key " + key + " was found in the cache" );
+ if ( rule.isResultValid( (EnforcerRule) cache.get( key ) ) )
+ {
+ log.info( "The cached results are still valid. Skipping the rule: "+rule.getClass().getName() );
+ return false;
+ }
+ }
+
+ //add it to the cache of executed rules
+ EnforceMojo.cache.put( key, rule );
+ }
+ return true;
+ }
+
+ /**
+ * @return the fail
+ */
+ public boolean isFail ()
+ {
+ return this.fail;
+ }
+
+ /**
+ * @param theFail the fail to set
+ */
+ public void setFail ( boolean theFail )
+ {
+ this.fail = theFail;
+ }
+
+ /**
+ * @return the rules
+ */
+ public EnforcerRule[] getRules ()
+ {
+ return this.rules;
+ }
+
+ /**
+ * @param theRules the rules to set
+ */
+ public void setRules ( EnforcerRule[] theRules )
+ {
+ this.rules = theRules;
+ }
+
+ /**
+ * @return the skip
+ */
+ public boolean isSkip ()
+ {
+ return this.skip;
+ }
+
+ /**
+ * @param theSkip the skip to set
+ */
+ public void setSkip ( boolean theSkip )
+ {
+ this.skip = theSkip;
+ }
+
+ /**
+ * @return the failFast
+ */
+ public boolean isFailFast ()
+ {
+ return this.failFast;
+ }
+
+ /**
+ * @param theFailFast the failFast to set
+ */
+ public void setFailFast ( boolean theFailFast )
+ {
+ this.failFast = theFailFast;
+ }
+
+ /**
+ * @return the project
+ */
+ public MavenProject getProject ()
+ {
+ return this.project;
+ }
+
+ /**
+ * @param theProject the project to set
+ */
+ public void setProject ( MavenProject theProject )
+ {
+ this.project = theProject;
+ }
+
+ /**
+ * @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 translator
+ */
+ public PathTranslator getTranslator ()
+ {
+ return this.translator;
+ }
+
+ /**
+ * @param theTranslator the translator to set
+ */
+ public void setTranslator ( PathTranslator theTranslator )
+ {
+ this.translator = theTranslator;
+ }
+}
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceOnceMojo.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceOnceMojo.java?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceOnceMojo.java (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceOnceMojo.java Fri Dec 28 08:16:09 2007
@@ -1,43 +1,43 @@
-package org.apache.maven.plugins.enforcer;
-
-import org.apache.maven.plugin.MojoExecutionException;
-
-/*
- * 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.
- */
-
-/**
- * This goal executes the defined enforcer-rules once per build.
- *
- * @deprecated
- * @goal enforce-once
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- * @phase validate
- * @requiresDependencyResolution test
- * @version $Id$
- */
-public class EnforceOnceMojo
- extends EnforceMojo
-{
- public void execute()
- throws MojoExecutionException
- {
- this.getLog().warn( "enforcer:enforce-once is deprecated. Use enforcer:enforce instead. See MENFORCER-11/MENFORCER-12 for more information." );
- super.execute();
- }
-}
+package org.apache.maven.plugins.enforcer;
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+/*
+ * 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.
+ */
+
+/**
+ * This goal executes the defined enforcer-rules once per build.
+ *
+ * @deprecated
+ * @goal enforce-once
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ * @phase validate
+ * @requiresDependencyResolution test
+ * @version $Id$
+ */
+public class EnforceOnceMojo
+ extends EnforceMojo
+{
+ public void execute()
+ throws MojoExecutionException
+ {
+ this.getLog().warn( "enforcer:enforce-once is deprecated. Use enforcer:enforce instead. See MENFORCER-11/MENFORCER-12 for more information." );
+ super.execute();
+ }
+}
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceOnceMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceOnceMojo.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author URL Id
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/util/EnforcerUtils.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/util/EnforcerUtils.java?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/util/EnforcerUtils.java (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/util/EnforcerUtils.java Fri Dec 28 08:16:09 2007
@@ -1,11 +1,11 @@
-package org.apache.maven.plugins.enforcer.util;
-
-
-/**
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- *
- */
-public class EnforcerUtils
-{
-
-}
+package org.apache.maven.plugins.enforcer.util;
+
+
+/**
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ *
+ */
+public class EnforcerUtils
+{
+
+}
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/util/EnforcerUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/util/EnforcerUtils.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author URL Id
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/index.apt?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/index.apt (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/index.apt Fri Dec 28 08:16:09 2007
@@ -1,45 +1,45 @@
-~~ 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.
-
- ------
- Introduction
- ------
- Brian Fox
- ------
- Mar 2007
- ------
-
-Maven Enforcer Plugin - The Loving Iron Fist of Maven\x99
-
- The Enforcer plugin provides goals to control certain environmental constraints such as Maven Version, JDK version, and OS family.
-
-* Goals Overview
-
- The Enforcer plugin has two goals:
-
- *{{{enforce-mojo.html}enforcer:enforce}} executes rules for each project in a multi-project build.
-
- *{{{enforce-once-mojo.html}enforcer:enforce-once}} executes rules once per build.
-
- *{{{display-info-mojo.html}enforcer:display-info}} display the current information as detected by the standard rules.
-
-* Usage
-
- Instructions on how to use the enforcer plugin can be found {{{usage.html}here}}.
-
-
-
+~~ 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.
+
+ ------
+ Introduction
+ ------
+ Brian Fox
+ ------
+ Mar 2007
+ ------
+
+Maven Enforcer Plugin - The Loving Iron Fist of Maven\x99
+
+ The Enforcer plugin provides goals to control certain environmental constraints such as Maven Version, JDK version, and OS family.
+
+* Goals Overview
+
+ The Enforcer plugin has two goals:
+
+ *{{{enforce-mojo.html}enforcer:enforce}} executes rules for each project in a multi-project build.
+
+ *{{{enforce-once-mojo.html}enforcer:enforce-once}} executes rules once per build.
+
+ *{{{display-info-mojo.html}enforcer:display-info}} display the current information as detected by the standard rules.
+
+* Usage
+
+ Instructions on how to use the enforcer plugin can be found {{{usage.html}here}}.
+
+
+
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/index.apt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/usage.apt
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/usage.apt?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/usage.apt (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/usage.apt Fri Dec 28 08:16:09 2007
@@ -1,112 +1,112 @@
-~~ 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.
-
- ------
- Usage
- ------
- Brian Fox
- ------
- Mar 2007
- ------
-
-Usage
-
- Brief examples on how to use the enforcer goals.
-
-* Generic Plugin configuration information
-
- See the following links for information about including and configuring plugins in your project:
-
- *{{{http://maven.apache.org/guides/mini/guide-configuring-plugins.html}Configuring Plugins}}
-
- *{{{http://maven.apache.org/guides/plugin/guide-java-plugin-development.html}Plugin Development}}
-
- *{{{http://maven.apache.org/guides/introduction/introduction-to-plugin-prefix-mapping.html}Plugin Prefix}}
-
- []
-
-* The <<<enforcer:enforce>>> and <<<enforcer:enforce-once>>> mojos
-
- These goals are meant to be bound to a lifecycle phase and configured in your
- <<<pom.xml>>>. The enforcers execute the configured rules to check for certain constraints.
- The available standard rules are described {{{rules/index.html}here}}. Besides the rules to execute, these goals support three options:
-
- * {{{enforce-mojo.html#skip}skip}} - a quick way to skip checks via a profile or using -Denforcer.skip=true from the command line.
-
- * {{{enforce-mojo.html#fail}fail}} - if the goal should fail the build when a rule fails. The default is true. If false, the errors will be logged as warnings.
-
- * {{{enforce-mojo.html#failFast}failFast}} - if the goal should stop checking after the first failure. The default is false.
-
- []
-
- Each rule to be executed should be added to the rules element along with the specific configuration for that rule.
-
- The <<<enforce>>> goal executes against each project in a multi-project build. The <<<enforce-once>>> goal executes
- just once per build. This is most effective for the standard rules because the Maven, Java and OS versions will not change between projects in the same build.
-
-
- Sample Plugin Configuration:
-
-+---+
-<project>
- [...]
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <executions>
- <execution>
- <id>enforce-versions</id>
- <goals>
- <goal>enforce</goal>
- </goals>
- <configuration>
- <rules>
- <requireMavenVersion>
- <version>2.0.6</version>
- </requireMavenVersion>
- <requireJavaVersion>
- <version>1.5</version>
- </requireJavaVersion>
- <requireOS>
- <family>unix</family>
- </requireOS>
- </rules>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- [...]
-</project>
-+---+
-
-* The <<<enforcer:display-info>>> mojo
-
- This goal is used to determine the current information as detected by the standard rules:
-
-+---+
- mvn enforcer:display-info
- ...
- [enforcer:display-info]
- Maven Version: 2.0.6
- JDK Version: 1.5.0_11 normalized as: 1.5.0-11
- OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
-+---+
+~~ 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.
+
+ ------
+ Usage
+ ------
+ Brian Fox
+ ------
+ Mar 2007
+ ------
+
+Usage
+
+ Brief examples on how to use the enforcer goals.
+
+* Generic Plugin configuration information
+
+ See the following links for information about including and configuring plugins in your project:
+
+ *{{{http://maven.apache.org/guides/mini/guide-configuring-plugins.html}Configuring Plugins}}
+
+ *{{{http://maven.apache.org/guides/plugin/guide-java-plugin-development.html}Plugin Development}}
+
+ *{{{http://maven.apache.org/guides/introduction/introduction-to-plugin-prefix-mapping.html}Plugin Prefix}}
+
+ []
+
+* The <<<enforcer:enforce>>> and <<<enforcer:enforce-once>>> mojos
+
+ These goals are meant to be bound to a lifecycle phase and configured in your
+ <<<pom.xml>>>. The enforcers execute the configured rules to check for certain constraints.
+ The available standard rules are described {{{rules/index.html}here}}. Besides the rules to execute, these goals support three options:
+
+ * {{{enforce-mojo.html#skip}skip}} - a quick way to skip checks via a profile or using -Denforcer.skip=true from the command line.
+
+ * {{{enforce-mojo.html#fail}fail}} - if the goal should fail the build when a rule fails. The default is true. If false, the errors will be logged as warnings.
+
+ * {{{enforce-mojo.html#failFast}failFast}} - if the goal should stop checking after the first failure. The default is false.
+
+ []
+
+ Each rule to be executed should be added to the rules element along with the specific configuration for that rule.
+
+ The <<<enforce>>> goal executes against each project in a multi-project build. The <<<enforce-once>>> goal executes
+ just once per build. This is most effective for the standard rules because the Maven, Java and OS versions will not change between projects in the same build.
+
+
+ Sample Plugin Configuration:
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-versions</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireMavenVersion>
+ <version>2.0.6</version>
+ </requireMavenVersion>
+ <requireJavaVersion>
+ <version>1.5</version>
+ </requireJavaVersion>
+ <requireOS>
+ <family>unix</family>
+ </requireOS>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
+
+* The <<<enforcer:display-info>>> mojo
+
+ This goal is used to determine the current information as detected by the standard rules:
+
++---+
+ mvn enforcer:display-info
+ ...
+ [enforcer:display-info]
+ Maven Version: 2.0.6
+ JDK Version: 1.5.0_11 normalized as: 1.5.0-11
+ OS Info: Arch: x86 Family: windows Name: windows xp Version: 5.1
++---+
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/site/apt/usage.apt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/site/fml/faq.fml?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/site/fml/faq.fml (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/site/fml/faq.fml Fri Dec 28 08:16:09 2007
@@ -1,35 +1,35 @@
-<?xml version="1.0"?>
-<!--
- * 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.
- *
--->
-<faqs id="FAQ" title="Frequently Asked Questions">
- <part id="General">
- <faq id="question">
- <question>Why can't I just use the prerequisites tag in the pom?</question>
- <answer>
- <p>
- The prerequisites tag was designed to be used by tools like plugins. It will work for regular projects, but it isn't
- inherited to their children. If it is set in a parent reactor, then Maven will do the check. However if one of the
- children are built, the check is not performed. The enforcer plugin is designed to allow centralized control over the build environment from
- a single "super-pom", and to allow greater flexibility in version specification by supporting ranges.
- </p>
- </answer>
- </faq>
- </part>
-</faqs>
+<?xml version="1.0"?>
+<!--
+ * 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.
+ *
+-->
+<faqs id="FAQ" title="Frequently Asked Questions">
+ <part id="General">
+ <faq id="question">
+ <question>Why can't I just use the prerequisites tag in the pom?</question>
+ <answer>
+ <p>
+ The prerequisites tag was designed to be used by tools like plugins. It will work for regular projects, but it isn't
+ inherited to their children. If it is set in a parent reactor, then Maven will do the check. However if one of the
+ children are built, the check is not performed. The enforcer plugin is designed to allow centralized control over the build environment from
+ a single "super-pom", and to allow greater flexibility in version specification by supporting ranges.
+ </p>
+ </answer>
+ </faq>
+ </part>
+</faqs>
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/site/fml/faq.fml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/site/site.xml?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/site/site.xml (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/site/site.xml Fri Dec 28 08:16:09 2007
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- * 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.
- *
--->
-
-<project>
- <body>
- <menu name="Overview">
- <item name="Introduction" href="index.html"/>
- <item name="Goals" href="plugin-info.html"/>
- <item name="Usage" href="usage.html"/>
- <item name="FAQ" href="faq.html"/>
- <item name="Standard Rules" href="rules/index.html"/>
- </menu>
- <menu name="Custom Rules">
- <item name="Writing a custom rule" href="http://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html"/>
- </menu>
- <menu name="Resources">
- <item name="Maven 2.0.x Version Range Syntax" href="http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges" />
- </menu>
- </body>
-</project>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * 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.
+ *
+-->
+
+<project>
+ <body>
+ <menu name="Overview">
+ <item name="Introduction" href="index.html"/>
+ <item name="Goals" href="plugin-info.html"/>
+ <item name="Usage" href="usage.html"/>
+ <item name="FAQ" href="faq.html"/>
+ <item name="Standard Rules" href="rules/index.html"/>
+ </menu>
+ <menu name="Custom Rules">
+ <item name="Writing a custom rule" href="http://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html"/>
+ </menu>
+ <menu name="Resources">
+ <item name="Maven 2.0.x Version Range Syntax" href="http://docs.codehaus.org/display/MAVEN/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges" />
+ </menu>
+ </body>
+</project>
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/MockEnforcerRule.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/MockEnforcerRule.java?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/MockEnforcerRule.java (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/MockEnforcerRule.java Fri Dec 28 08:16:09 2007
@@ -1,139 +1,139 @@
-package org.apache.maven.plugins.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 org.apache.maven.enforcer.rule.api.EnforcerRule;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
-import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
-
-/**
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- *
- */
-public class MockEnforcerRule
- implements EnforcerRule
-{
-
- public boolean failRule = false;
-
- public String cacheId="";
-
- public boolean isCacheable = false;
-
- public boolean isResultValid = false;
-
- public boolean executed = false;
-
- public MockEnforcerRule( boolean fail )
- {
- this.failRule = fail;
- }
-
- public MockEnforcerRule( boolean fail, String cacheId, boolean isCacheable, boolean isResultValid )
- {
- this.failRule = fail;
- this.isCacheable = isCacheable;
- this.isResultValid= isResultValid;
- this.cacheId = cacheId;
- }
- public void execute( EnforcerRuleHelper helper )
- throws EnforcerRuleException
- {
- executed = true;
- if ( isFailRule() )
- {
- throw new EnforcerRuleException( " this condition is not allowed." );
- }
- }
-
- /**
- * @return the failRule
- */
- public boolean isFailRule()
- {
- return this.failRule;
- }
-
- /**
- * @param theFailRule
- * the failRule to set
- */
- public void setFailRule( boolean theFailRule )
- {
- this.failRule = theFailRule;
- }
-
- /**
- * @return the isResultValid
- */
- public boolean isResultValid ()
- {
- return this.isResultValid;
- }
-
- /**
- * @param theIsResultValid the isResultValid to set
- */
- public void setResultValid ( boolean theIsResultValid )
- {
- this.isResultValid = theIsResultValid;
- }
-
- /**
- * @param theCacheId the cacheId to set
- */
- public void setCacheId ( String theCacheId )
- {
- this.cacheId = theCacheId;
- }
-
- /**
- * @param theIsCacheable the isCacheable to set
- */
- public void setCacheable ( boolean theIsCacheable )
- {
- this.isCacheable = theIsCacheable;
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
- */
- public String getCacheId ()
- {
- return cacheId;
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
- */
- public boolean isCacheable ()
- {
- return isCacheable;
- }
-
- /* (non-Javadoc)
- * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
- */
- public boolean isResultValid ( EnforcerRule theCachedRule )
- {
- return isResultValid;
- }
-
-}
+package org.apache.maven.plugins.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 org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+
+/**
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ *
+ */
+public class MockEnforcerRule
+ implements EnforcerRule
+{
+
+ public boolean failRule = false;
+
+ public String cacheId="";
+
+ public boolean isCacheable = false;
+
+ public boolean isResultValid = false;
+
+ public boolean executed = false;
+
+ public MockEnforcerRule( boolean fail )
+ {
+ this.failRule = fail;
+ }
+
+ public MockEnforcerRule( boolean fail, String cacheId, boolean isCacheable, boolean isResultValid )
+ {
+ this.failRule = fail;
+ this.isCacheable = isCacheable;
+ this.isResultValid= isResultValid;
+ this.cacheId = cacheId;
+ }
+ public void execute( EnforcerRuleHelper helper )
+ throws EnforcerRuleException
+ {
+ executed = true;
+ if ( isFailRule() )
+ {
+ throw new EnforcerRuleException( " this condition is not allowed." );
+ }
+ }
+
+ /**
+ * @return the failRule
+ */
+ public boolean isFailRule()
+ {
+ return this.failRule;
+ }
+
+ /**
+ * @param theFailRule
+ * the failRule to set
+ */
+ public void setFailRule( boolean theFailRule )
+ {
+ this.failRule = theFailRule;
+ }
+
+ /**
+ * @return the isResultValid
+ */
+ public boolean isResultValid ()
+ {
+ return this.isResultValid;
+ }
+
+ /**
+ * @param theIsResultValid the isResultValid to set
+ */
+ public void setResultValid ( boolean theIsResultValid )
+ {
+ this.isResultValid = theIsResultValid;
+ }
+
+ /**
+ * @param theCacheId the cacheId to set
+ */
+ public void setCacheId ( String theCacheId )
+ {
+ this.cacheId = theCacheId;
+ }
+
+ /**
+ * @param theIsCacheable the isCacheable to set
+ */
+ public void setCacheable ( boolean theIsCacheable )
+ {
+ this.isCacheable = theIsCacheable;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
+ */
+ public String getCacheId ()
+ {
+ return cacheId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
+ */
+ public boolean isCacheable ()
+ {
+ return isCacheable;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
+ */
+ public boolean isResultValid ( EnforcerRule theCachedRule )
+ {
+ return isResultValid;
+ }
+
+}
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/MockEnforcerRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/MockEnforcerRule.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author URL Id
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestDefaultEnforcementRuleHelper.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestDefaultEnforcementRuleHelper.java?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestDefaultEnforcementRuleHelper.java (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestDefaultEnforcementRuleHelper.java Fri Dec 28 08:16:09 2007
@@ -1,46 +1,46 @@
-package org.apache.maven.plugins.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 junit.framework.TestCase;
-
-import org.apache.maven.execution.RuntimeInformation;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-
-/**
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- *
- */
-public class TestDefaultEnforcementRuleHelper
- extends TestCase
-{
- public void testHelper()
- throws ComponentLookupException, ExpressionEvaluationException
- {
- DefaultEnforcementRuleHelper helper = (DefaultEnforcementRuleHelper) EnforcerTestUtils.getHelper();
-
- assertNotNull( helper.getLog() );
- assertNotNull( helper.evaluate( "${session}" ) );
- assertNotNull( helper.evaluate( "${project}" ) );
- assertNotNull( helper.getComponent( RuntimeInformation.class ) );
-
- }
-}
+package org.apache.maven.plugins.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 junit.framework.TestCase;
+
+import org.apache.maven.execution.RuntimeInformation;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+/**
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ *
+ */
+public class TestDefaultEnforcementRuleHelper
+ extends TestCase
+{
+ public void testHelper()
+ throws ComponentLookupException, ExpressionEvaluationException
+ {
+ DefaultEnforcementRuleHelper helper = (DefaultEnforcementRuleHelper) EnforcerTestUtils.getHelper();
+
+ assertNotNull( helper.getLog() );
+ assertNotNull( helper.evaluate( "${session}" ) );
+ assertNotNull( helper.evaluate( "${project}" ) );
+ assertNotNull( helper.getComponent( RuntimeInformation.class ) );
+
+ }
+}
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestDefaultEnforcementRuleHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestDefaultEnforcementRuleHelper.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author URL Id
Modified: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java?rev=607279&r1=607278&r2=607279&view=diff
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java (original)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java Fri Dec 28 08:16:09 2007
@@ -1,238 +1,238 @@
-package org.apache.maven.plugins.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 junit.framework.TestCase;
-
-import org.apache.maven.enforcer.rule.api.EnforcerRule;
-import org.apache.maven.plugin.MojoExecutionException;
-
-/**
- * Exhaustively check the enforcer mojo.
- *
- * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- *
- */
-public class TestEnforceMojo
- extends TestCase
-{
-
- public void testEnforceMojo ()
- throws MojoExecutionException
- {
- EnforceMojo mojo = new EnforceMojo();
- mojo.setFail( false );
- mojo.setSession( EnforcerTestUtils.getMavenSession() );
- mojo.setProject( new MockProject() );
-
- try
- {
- mojo.execute();
- fail( "Expected a Mojo Execution Exception." );
- }
- catch ( MojoExecutionException e )
- {
- System.out.println( "Caught Expected Exception:" + e.getLocalizedMessage() );
- }
-
- EnforcerRule[] rules = new EnforcerRule[10];
- rules[0] = new MockEnforcerRule( true );
- rules[1] = new MockEnforcerRule( true );
- mojo.setRules( rules );
-
- mojo.execute();
-
- try
- {
- mojo.setFailFast( false );
- mojo.setFail( true );
- mojo.execute();
- fail( "Expected a Mojo Execution Exception." );
- }
- catch ( MojoExecutionException e )
- {
- System.out.println( "Caught Expected Exception:" + e.getLocalizedMessage() );
- }
-
- try
- {
- mojo.setFailFast( true );
- mojo.setFail( true );
- mojo.execute();
- fail( "Expected a Mojo Execution Exception." );
- }
- catch ( MojoExecutionException e )
- {
- System.out.println( "Caught Expected Exception:" + e.getLocalizedMessage() );
- }
-
- ( (MockEnforcerRule) rules[0] ).setFailRule( false );
- ( (MockEnforcerRule) rules[1] ).setFailRule( false );
- mojo.execute();
-
- }
-
- public void testCaching () throws MojoExecutionException
- {
- EnforceMojo mojo = new EnforceMojo();
- mojo.setFail( true );
- mojo.setSession( EnforcerTestUtils.getMavenSession() );
- mojo.setProject( new MockProject() );
-
- MockEnforcerRule[] rules = new MockEnforcerRule[10];
-
- //check that basic caching works.
- rules[0] = new MockEnforcerRule( false, "", true, true );
- rules[1] = new MockEnforcerRule( false, "", true, true );
- mojo.setRules( rules );
-
- EnforceMojo.cache.clear();
- mojo.execute();
-
- assertTrue( "Expected this rule to be executed.",rules[0].executed );
- assertFalse( "Expected this rule not to be executed.",rules[1].executed);
-
- //check that skip caching works.
- rules[0] = new MockEnforcerRule( false, "", true, true );
- rules[1] = new MockEnforcerRule( false, "", true, true );
- mojo.setRules( rules );
-
- EnforceMojo.cache.clear();
- mojo.ignoreCache = true;
- mojo.execute();
-
- assertTrue( "Expected this rule to be executed.",rules[0].executed );
- assertTrue( "Expected this rule to be executed.",rules[1].executed );
-
- mojo.ignoreCache = false;
-
- //check that different ids are compared.
- rules[0] = new MockEnforcerRule( false, "1", true, true );
- rules[1] = new MockEnforcerRule( false, "2", true, true );
- rules[2] = new MockEnforcerRule( false, "2", true, true );
- mojo.setRules( rules );
-
- EnforceMojo.cache.clear();
- mojo.execute();
-
- assertTrue( "Expected this rule to be executed.",rules[0].executed );
- assertTrue( "Expected this rule to be executed.",rules[1].executed);
- assertFalse( "Expected this rule not to be executed.",rules[2].executed);
-
- //check that future overrides are working
- rules[0] = new MockEnforcerRule( false, "1", true, true );
- rules[1] = new MockEnforcerRule( false, "1", false, true );
- rules[2] = null;
- mojo.setRules( rules );
-
- EnforceMojo.cache.clear();
- mojo.execute();
-
- assertTrue( "Expected this rule to be executed.",rules[0].executed );
- assertTrue( "Expected this rule to be executed.",rules[1].executed);
-
- //check that future isResultValid is used
- rules[0] = new MockEnforcerRule( false, "1", true, true );
- rules[1] = new MockEnforcerRule( false, "1", true, false );
- rules[2] = null;
- mojo.setRules( rules );
-
- EnforceMojo.cache.clear();
- mojo.execute();
-
- assertTrue( "Expected this rule to be executed.",rules[0].executed );
- assertTrue( "Expected this rule to be executed.",rules[1].executed);
-
- }
-
- public void testCachePersistence1() throws MojoExecutionException
- {
- EnforceMojo mojo = new EnforceMojo();
- mojo.setFail( true );
- mojo.setSession( EnforcerTestUtils.getMavenSession() );
- mojo.setProject( new MockProject() );
-
- MockEnforcerRule[] rules = new MockEnforcerRule[10];
-
- //check that basic caching works.
- rules[0] = new MockEnforcerRule( false, "", true, true );
- rules[1] = new MockEnforcerRule( false, "", true, true );
- mojo.setRules( rules );
-
- EnforceMojo.cache.clear();
- mojo.execute();
-
- assertTrue( "Expected this rule to be executed.",rules[0].executed );
- assertFalse( "Expected this rule not to be executed.",rules[1].executed);
-
- }
-
- public void testCachePersistence2() throws MojoExecutionException
- {
- EnforceMojo mojo = new EnforceMojo();
- mojo.setFail( true );
- mojo.setSession( EnforcerTestUtils.getMavenSession() );
- mojo.setProject( new MockProject() );
-
- MockEnforcerRule[] rules = new MockEnforcerRule[10];
-
- //check that basic caching works.
- rules[0] = new MockEnforcerRule( false, "", true, true );
- rules[1] = new MockEnforcerRule( false, "", true, true );
- mojo.setRules( rules );
-
- mojo.execute();
-
- assertFalse( "Expected this rule not to be executed.",rules[0].executed);
- assertFalse( "Expected this rule not to be executed.",rules[1].executed);
-
- }
-
- public void testCachePersistence3() throws MojoExecutionException
- {
- System.gc();
-
- try
- {
- Thread.sleep( 1000 );
- }
- catch ( InterruptedException e )
- {
- }
-
- EnforceMojo mojo = new EnforceMojo();
- mojo.setFail( true );
- mojo.setSession( EnforcerTestUtils.getMavenSession() );
- mojo.setProject( new MockProject() );
-
- MockEnforcerRule[] rules = new MockEnforcerRule[10];
-
- //check that basic caching works.
- rules[0] = new MockEnforcerRule( false, "", true, true );
- rules[1] = new MockEnforcerRule( false, "", true, true );
- mojo.setRules( rules );
-
- mojo.execute();
-
- assertFalse( "Expected this rule not to be executed.",rules[0].executed);
- assertFalse( "Expected this rule not to be executed.",rules[1].executed);
-
- }
-}
+package org.apache.maven.plugins.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 junit.framework.TestCase;
+
+import org.apache.maven.enforcer.rule.api.EnforcerRule;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Exhaustively check the enforcer mojo.
+ *
+ * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
+ *
+ */
+public class TestEnforceMojo
+ extends TestCase
+{
+
+ public void testEnforceMojo ()
+ throws MojoExecutionException
+ {
+ EnforceMojo mojo = new EnforceMojo();
+ mojo.setFail( false );
+ mojo.setSession( EnforcerTestUtils.getMavenSession() );
+ mojo.setProject( new MockProject() );
+
+ try
+ {
+ mojo.execute();
+ fail( "Expected a Mojo Execution Exception." );
+ }
+ catch ( MojoExecutionException e )
+ {
+ System.out.println( "Caught Expected Exception:" + e.getLocalizedMessage() );
+ }
+
+ EnforcerRule[] rules = new EnforcerRule[10];
+ rules[0] = new MockEnforcerRule( true );
+ rules[1] = new MockEnforcerRule( true );
+ mojo.setRules( rules );
+
+ mojo.execute();
+
+ try
+ {
+ mojo.setFailFast( false );
+ mojo.setFail( true );
+ mojo.execute();
+ fail( "Expected a Mojo Execution Exception." );
+ }
+ catch ( MojoExecutionException e )
+ {
+ System.out.println( "Caught Expected Exception:" + e.getLocalizedMessage() );
+ }
+
+ try
+ {
+ mojo.setFailFast( true );
+ mojo.setFail( true );
+ mojo.execute();
+ fail( "Expected a Mojo Execution Exception." );
+ }
+ catch ( MojoExecutionException e )
+ {
+ System.out.println( "Caught Expected Exception:" + e.getLocalizedMessage() );
+ }
+
+ ( (MockEnforcerRule) rules[0] ).setFailRule( false );
+ ( (MockEnforcerRule) rules[1] ).setFailRule( false );
+ mojo.execute();
+
+ }
+
+ public void testCaching () throws MojoExecutionException
+ {
+ EnforceMojo mojo = new EnforceMojo();
+ mojo.setFail( true );
+ mojo.setSession( EnforcerTestUtils.getMavenSession() );
+ mojo.setProject( new MockProject() );
+
+ MockEnforcerRule[] rules = new MockEnforcerRule[10];
+
+ //check that basic caching works.
+ rules[0] = new MockEnforcerRule( false, "", true, true );
+ rules[1] = new MockEnforcerRule( false, "", true, true );
+ mojo.setRules( rules );
+
+ EnforceMojo.cache.clear();
+ mojo.execute();
+
+ assertTrue( "Expected this rule to be executed.",rules[0].executed );
+ assertFalse( "Expected this rule not to be executed.",rules[1].executed);
+
+ //check that skip caching works.
+ rules[0] = new MockEnforcerRule( false, "", true, true );
+ rules[1] = new MockEnforcerRule( false, "", true, true );
+ mojo.setRules( rules );
+
+ EnforceMojo.cache.clear();
+ mojo.ignoreCache = true;
+ mojo.execute();
+
+ assertTrue( "Expected this rule to be executed.",rules[0].executed );
+ assertTrue( "Expected this rule to be executed.",rules[1].executed );
+
+ mojo.ignoreCache = false;
+
+ //check that different ids are compared.
+ rules[0] = new MockEnforcerRule( false, "1", true, true );
+ rules[1] = new MockEnforcerRule( false, "2", true, true );
+ rules[2] = new MockEnforcerRule( false, "2", true, true );
+ mojo.setRules( rules );
+
+ EnforceMojo.cache.clear();
+ mojo.execute();
+
+ assertTrue( "Expected this rule to be executed.",rules[0].executed );
+ assertTrue( "Expected this rule to be executed.",rules[1].executed);
+ assertFalse( "Expected this rule not to be executed.",rules[2].executed);
+
+ //check that future overrides are working
+ rules[0] = new MockEnforcerRule( false, "1", true, true );
+ rules[1] = new MockEnforcerRule( false, "1", false, true );
+ rules[2] = null;
+ mojo.setRules( rules );
+
+ EnforceMojo.cache.clear();
+ mojo.execute();
+
+ assertTrue( "Expected this rule to be executed.",rules[0].executed );
+ assertTrue( "Expected this rule to be executed.",rules[1].executed);
+
+ //check that future isResultValid is used
+ rules[0] = new MockEnforcerRule( false, "1", true, true );
+ rules[1] = new MockEnforcerRule( false, "1", true, false );
+ rules[2] = null;
+ mojo.setRules( rules );
+
+ EnforceMojo.cache.clear();
+ mojo.execute();
+
+ assertTrue( "Expected this rule to be executed.",rules[0].executed );
+ assertTrue( "Expected this rule to be executed.",rules[1].executed);
+
+ }
+
+ public void testCachePersistence1() throws MojoExecutionException
+ {
+ EnforceMojo mojo = new EnforceMojo();
+ mojo.setFail( true );
+ mojo.setSession( EnforcerTestUtils.getMavenSession() );
+ mojo.setProject( new MockProject() );
+
+ MockEnforcerRule[] rules = new MockEnforcerRule[10];
+
+ //check that basic caching works.
+ rules[0] = new MockEnforcerRule( false, "", true, true );
+ rules[1] = new MockEnforcerRule( false, "", true, true );
+ mojo.setRules( rules );
+
+ EnforceMojo.cache.clear();
+ mojo.execute();
+
+ assertTrue( "Expected this rule to be executed.",rules[0].executed );
+ assertFalse( "Expected this rule not to be executed.",rules[1].executed);
+
+ }
+
+ public void testCachePersistence2() throws MojoExecutionException
+ {
+ EnforceMojo mojo = new EnforceMojo();
+ mojo.setFail( true );
+ mojo.setSession( EnforcerTestUtils.getMavenSession() );
+ mojo.setProject( new MockProject() );
+
+ MockEnforcerRule[] rules = new MockEnforcerRule[10];
+
+ //check that basic caching works.
+ rules[0] = new MockEnforcerRule( false, "", true, true );
+ rules[1] = new MockEnforcerRule( false, "", true, true );
+ mojo.setRules( rules );
+
+ mojo.execute();
+
+ assertFalse( "Expected this rule not to be executed.",rules[0].executed);
+ assertFalse( "Expected this rule not to be executed.",rules[1].executed);
+
+ }
+
+ public void testCachePersistence3() throws MojoExecutionException
+ {
+ System.gc();
+
+ try
+ {
+ Thread.sleep( 1000 );
+ }
+ catch ( InterruptedException e )
+ {
+ }
+
+ EnforceMojo mojo = new EnforceMojo();
+ mojo.setFail( true );
+ mojo.setSession( EnforcerTestUtils.getMavenSession() );
+ mojo.setProject( new MockProject() );
+
+ MockEnforcerRule[] rules = new MockEnforcerRule[10];
+
+ //check that basic caching works.
+ rules[0] = new MockEnforcerRule( false, "", true, true );
+ rules[1] = new MockEnforcerRule( false, "", true, true );
+ mojo.setRules( rules );
+
+ mojo.execute();
+
+ assertFalse( "Expected this rule not to be executed.",rules[0].executed);
+ assertFalse( "Expected this rule not to be executed.",rules[1].executed);
+
+ }
+}
Propchange: maven/enforcer/trunk/maven-enforcer-plugin/src/test/java/org/apache/maven/plugins/enforcer/TestEnforceMojo.java
------------------------------------------------------------------------------
svn:eol-style = native