Skip to content

Commit

Permalink
Fix JavaDoc and lock sisu-maven-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rfscholte committed Jul 26, 2021
1 parent 014253f commit da3f888
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,24 @@ public void execute( EnforcerRuleHelper helper )

/**
* How the property that is being evaluated is called
* @return kind of property
*/
public abstract String getName();
protected abstract String getName();

/**
* The name of the property currently being evaluated, this is used for default message pourpouses only
* The name of the property currently being evaluated, this is used for default message purposes only
*
* @return the name of the property
*/
public abstract String getPropertyName();
protected abstract String getPropertyName();

/**
* Resolves the property value
*
* @param helper
* @throws EnforcerRuleException
*/
public abstract Object resolveValue( EnforcerRuleHelper helper )
protected abstract Object resolveValue( EnforcerRuleHelper helper )
throws EnforcerRuleException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ else if ( includes != null && !includes.contains( SystemUtils.JAVA_VENDOR ) )
* java.vendor, which you can also see with mvn --version. <br>
* Excludes override the include rules.
*
* Some examples are:
* <ul>
* <li><code>AdoptOpenJDK</code> prohibits vendor name AdoptOpenJDK </li>
* <li><code>Amazon</code> prohibits vendor name Amazon </li>
* </ul>
* @param theExcludes the vendor to to exclude from the include list.
*/
public void setExcludes( List<String> theExcludes )
{
Expand All @@ -90,7 +86,15 @@ public void setExcludes( List<String> theExcludes )
* The rule will fail if vendor name matches any exclude, unless it also matches an
* include rule.
*
* @see #setIncludes(List)
* Some examples are:
* <ul>
* <li><code>AdoptOpenJDK</code> prohibits vendor name AdoptOpenJDK </li>
* <li><code>Amazon</code> prohibits vendor name Amazon </li>
* </ul>
*
* @param theIncludes the list of required vendors.
*
* @see #setExcludes(List)
*/
public void setIncludes( List<String> theIncludes )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ public String toString()

/**
* Construct class by providing patterns as strings. Empty strings are ignored.
*
*
* @param patterns includes
* @param ignorePatterns excludes
* @throws NullPointerException if any of the arguments is null
*/
public ArtifactMatcher( final Collection<String> patterns, final Collection<String> ignorePatterns )
Expand Down Expand Up @@ -195,7 +197,10 @@ public ArtifactMatcher( final Collection<String> patterns, final Collection<Stri
/**
* Check if artifact matches patterns.
*
* @throws InvalidVersionSpecificationException
* @param artifact the artifact to match
* @return {@code true} if artifact matches any {@link #patterns} and none of the {@link #ignorePatterns}, otherwise
* {@code false}
* @throws InvalidVersionSpecificationException if any pattern contains an invalid version range
*/
public boolean match( Artifact artifact )
throws InvalidVersionSpecificationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ public static List<PluginWrapper> addAll( List<? extends InputLocationTracker> p
}

/**
* Whether the version is coming from the default lifecycle bindings.
* Cannot be determined before Maven 3.6.1
*
* @param o either Plugin or ReportPlugin
* @return
* @return null if untraceable, otherwise its matching value
* @see <a href="https://issues.apache.org/jira/browse/MNG-6600">MNG-6600</a>
*/
public static Optional<Boolean> isVersionFromDefaultLifecycleBindings( InputLocationTracker o )
{
Expand All @@ -93,9 +96,12 @@ public static Optional<Boolean> isVersionFromDefaultLifecycleBindings( InputLoca
}

/**
* Whether the version is coming from the super POM.
* Cannot be determined before Maven 3.6.1
*
* @param o either Plugin or ReportPlugin
* @return null if untraceable, otherwise its matching value
* @return null if untraceable, otherwise its matching value
* @see <a href="https://issues.apache.org/jira/browse/MNG-6593">MNG-6593</a>
*/
public static Optional<Boolean> isVersionFromSuperpom( InputLocationTracker o )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void shouldNotFailWithoutDistributionManagement()
* &lt;/distributionManagement&gt;
* </pre>
*
* @throws Exception
* @throws Exception if any occurs
*/
@Test( expected = EnforcerRuleException.class )
public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepository()
Expand All @@ -85,6 +85,8 @@ public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepository(
* &lt;/snapshotRepository&gt;
* &lt;/distributionManagement&gt;
* </pre>
*
* @throws Exception if any occurs
*/
@Test( expected = EnforcerRuleException.class )
public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositorySnapshotRepository()
Expand All @@ -110,6 +112,8 @@ public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositoryS
* &lt;/site&gt;
* &lt;/distributionManagement&gt;
* </pre>
*
* @throws Exception if any occurs
*/
@Test( expected = EnforcerRuleException.class )
public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositorySnapshotRepositorySite()
Expand All @@ -130,6 +134,8 @@ public void shouldThrowExceptionIfDistributionManagementIsDefinedWithRepositoryS
* &lt;/repository&gt;
* &lt;/distributionManagement&gt;
* </pre>
*
* @throws Exception if any occurs
*/
@Test
public void shouldAllowDistributionManagementHavingRepository()
Expand All @@ -153,6 +159,8 @@ public void shouldAllowDistributionManagementHavingRepository()
* &lt;/snapshotRepository&gt;
* &lt;/distributionManagement&gt;
* </pre>
*
* @throws Exception if any occurs
*/
@Test
public void shouldAllowDistributionManagementHavingRepositorySnapshotRepository()
Expand Down Expand Up @@ -180,6 +188,8 @@ public void shouldAllowDistributionManagementHavingRepositorySnapshotRepository(
* &lt;/site&gt;
* &lt;/distributionManagement&gt;
* </pre>
*
* @throws Exception if any occurs
*/
@Test
public void shouldAllowDistributionManagementHavingRepositorySnapshotRepositorySite()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ public void setUp()

/**
* Test rule.
*
*/
public void testRulePass()
throws EnforcerRuleException, ExpressionEvaluationException
throws Exception
{
EvaluateBeanshell rule = new EvaluateBeanshell();
// this property should not be set
Expand All @@ -67,7 +68,7 @@ public void testRulePass()
}

public void testRuleFail()
throws EnforcerRuleException, ExpressionEvaluationException
throws Exception
{
EvaluateBeanshell rule = new EvaluateBeanshell();
// this property should be set by the surefire
Expand All @@ -88,7 +89,7 @@ public void testRuleFail()
}

public void testRuleFailNoMessage()
throws EnforcerRuleException, ExpressionEvaluationException
throws Exception
{
EvaluateBeanshell rule = new EvaluateBeanshell();
// this property should be set by the surefire
Expand All @@ -108,7 +109,7 @@ public void testRuleFailNoMessage()
}

public void testRuleInvalidExpression()
throws EnforcerRuleException, ExpressionEvaluationException
throws Exception
{
EvaluateBeanshell rule = new EvaluateBeanshell();
rule.setCondition( "${env} == null" );
Expand All @@ -129,7 +130,7 @@ public void testRuleInvalidExpression()
}

public void testRuleInvalidBeanshell()
throws EnforcerRuleException, ExpressionEvaluationException
throws Exception
{
EvaluateBeanshell rule = new EvaluateBeanshell();
rule.setCondition( "this is not valid beanshell" );
Expand All @@ -147,7 +148,7 @@ public void testRuleInvalidBeanshell()
}


public void testRuleCanExecuteMultipleThreads() throws InterruptedException {
public void testRuleCanExecuteMultipleThreads() throws Exception {
final String condition = "String property1 = \"${property1}\";\n" +
"(property1.equals(\"prop0\") && \"${property2}\".equals(\"prop0\"))\n" +
"|| (property1.equals(\"prop1\") && \"${property2}\".equals(\"prop1\"))\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class TestRequireReleaseDeps
/**
* Test rule.
*
* @throws IOException Signals that an I/O exception has occurred.
* @throws Exception if any occurs
*/
@Test
public void testRule()
Expand Down Expand Up @@ -105,9 +105,17 @@ public void testWildcardIgnore() throws Exception

EnforcerRuleUtilsHelper.execute( rule, helper, false );
}



/**
* Test id.
*/
@Test
public void testId()
{
RequireReleaseDeps rule = newRequireReleaseDeps();
rule.getCacheId();
}

private RequireReleaseDeps newRequireReleaseDeps()
{
RequireReleaseDeps rule = new RequireReleaseDeps()
Expand All @@ -125,14 +133,4 @@ protected Set<Artifact> getDependenciesToCheck( ProjectBuildingRequest buildingR
};
return rule;
}

/**
* Test id.
*/
@Test
public void testId()
{
RequireReleaseDeps rule = newRequireReleaseDeps();
rule.getCacheId();
}
}
1 change: 1 addition & 0 deletions maven-enforcer-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.3.4</version>
<executions>
<execution>
<id>index-project</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ private boolean havingRules()
return rules != null && rules.length > 0;
}

/**
* Entry point to the mojo
*
* @throws MojoExecutionException
*/
@Override
public void execute()
throws MojoExecutionException
Expand Down

0 comments on commit da3f888

Please sign in to comment.