-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MENFORCER-211] wildcard ignore in requireReleaseDeps
- Loading branch information
Showing
3 changed files
with
42 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,36 +19,34 @@ | |
* under the License. | ||
*/ | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.apache.maven.artifact.Artifact; | ||
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper; | ||
import org.apache.maven.plugin.testing.ArtifactStubFactory; | ||
import org.apache.maven.plugins.enforcer.utils.EnforcerRuleUtilsHelper; | ||
import org.apache.maven.project.MavenProject; | ||
import org.apache.maven.project.ProjectBuildingRequest; | ||
import org.junit.Test; | ||
|
||
/** | ||
* The Class TestNoSnapshots. | ||
* | ||
* @author <a href="mailto:[email protected]">Brian Fox</a> | ||
*/ | ||
public class TestRequireReleaseDeps | ||
extends TestCase | ||
{ | ||
|
||
/** | ||
* Test rule. | ||
* | ||
* @throws IOException Signals that an I/O exception has occurred. | ||
*/ | ||
@Test | ||
public void testRule() | ||
throws IOException | ||
throws Exception | ||
{ | ||
|
||
ArtifactStubFactory factory = new ArtifactStubFactory(); | ||
MockProject project = new MockProject(); | ||
EnforcerRuleHelper helper = EnforcerTestUtils.getHelper( project ); | ||
|
@@ -89,9 +87,26 @@ public void testRule() | |
|
||
rule.setFailWhenParentIsSnapshot( false ); | ||
EnforcerRuleUtilsHelper.execute( rule, helper, false ); | ||
|
||
|
||
} | ||
|
||
@Test | ||
public void testWildcardIgnore() throws Exception | ||
{ | ||
RequireReleaseDeps rule = newRequireReleaseDeps(); | ||
rule.setExcludes( Collections.singletonList( "*:*:*:*:test" ) ); | ||
rule.setOnlyWhenRelease( true ); | ||
rule.setSearchTransitive( false ); | ||
|
||
ArtifactStubFactory factory = new ArtifactStubFactory(); | ||
MockProject project = new MockProject(); | ||
project.setArtifact( factory.getReleaseArtifact() ); | ||
project.setDependencyArtifacts( Collections.singleton( factory.createArtifact( "g", "a", "1.0-SNAPSHOT", "test" ) ) ); | ||
EnforcerRuleHelper helper = EnforcerTestUtils.getHelper( project ); | ||
|
||
EnforcerRuleUtilsHelper.execute( rule, helper, false ); | ||
} | ||
|
||
|
||
|
||
private RequireReleaseDeps newRequireReleaseDeps() | ||
{ | ||
|
@@ -114,6 +129,7 @@ protected Set<Artifact> getDependenciesToCheck( ProjectBuildingRequest buildingR | |
/** | ||
* Test id. | ||
*/ | ||
@Test | ||
public void testId() | ||
{ | ||
RequireReleaseDeps rule = newRequireReleaseDeps(); | ||
|