use of org.apache.maven.plugins.dependency.resolvers.CollectDependenciesMojo in project maven-plugins by apache.
the class TestCollectMojo method testCollectTestEnvironment.
/**
* tests the proper discovery and configuration of the mojo
*
* @throws Exception if a problem occurs
*/
public void testCollectTestEnvironment() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/collect-test/plugin-config.xml");
CollectDependenciesMojo mojo = (CollectDependenciesMojo) lookupMojo("collect", testPom);
assertNotNull(mojo);
assertNotNull(mojo.getProject());
MavenProject project = mojo.getProject();
mojo.setSilent(true);
Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
artifacts.addAll(directArtifacts);
project.setArtifacts(artifacts);
project.setDependencyArtifacts(directArtifacts);
mojo.execute();
DependencyStatusSets results = mojo.getResults();
assertNotNull(results);
assertEquals(artifacts.size(), results.getResolvedDependencies().size());
}
use of org.apache.maven.plugins.dependency.resolvers.CollectDependenciesMojo in project maven-plugins by apache.
the class TestCollectMojo method testSilent.
public void testSilent() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/collect-test/plugin-config.xml");
CollectDependenciesMojo mojo = (CollectDependenciesMojo) lookupMojo("collect", testPom);
mojo.setSilent(false);
assertFalse(mojo.getLog() instanceof SilentLog);
}
use of org.apache.maven.plugins.dependency.resolvers.CollectDependenciesMojo in project maven-plugins by apache.
the class TestCollectMojo method testCollectTestEnvironment_excludeTransitive.
/**
* tests the proper discovery and configuration of the mojo
*
* @throws Exception if a problem occurs
*/
public void testCollectTestEnvironment_excludeTransitive() throws Exception {
File testPom = new File(getBasedir(), "target/test-classes/unit/collect-test/plugin-config.xml");
CollectDependenciesMojo mojo = (CollectDependenciesMojo) lookupMojo("collect", testPom);
assertNotNull(mojo);
assertNotNull(mojo.getProject());
MavenProject project = mojo.getProject();
mojo.setSilent(true);
Set<Artifact> artifacts = this.stubFactory.getScopedArtifacts();
Set<Artifact> directArtifacts = this.stubFactory.getReleaseAndSnapshotArtifacts();
artifacts.addAll(directArtifacts);
project.setArtifacts(artifacts);
project.setDependencyArtifacts(directArtifacts);
setVariableValueToObject(mojo, "excludeTransitive", Boolean.TRUE);
mojo.execute();
DependencyStatusSets results = mojo.getResults();
assertNotNull(results);
assertEquals(directArtifacts.size(), results.getResolvedDependencies().size());
}
Aggregations