Search in sources :

Example 11 with DependencyArtifactStubFactory

use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-plugins by apache.

the class TestResolveMarkerFileFilter method setUp.

protected void setUp() throws Exception {
    super.setUp();
    outputFolder = new File("target/markers/");
    DependencyTestUtils.removeDirectory(outputFolder);
    assertFalse(outputFolder.exists());
    this.fact = new DependencyArtifactStubFactory(outputFolder, false);
    artifacts = fact.getReleaseAndSnapshotArtifacts();
}
Also used : File(java.io.File) DependencyArtifactStubFactory(org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory)

Example 12 with DependencyArtifactStubFactory

use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-plugins by apache.

the class TestClassifierTypeTranslator method setUp.

protected void setUp() throws Exception {
    super.setUp("classifiertype-translator", false);
    artifactHandlerManager = new DefaultArtifactHandlerManager();
    this.setVariableValueToObject(artifactHandlerManager, "artifactHandlers", new HashMap());
    artifactFactory = new DefaultArtifactFactory();
    this.setVariableValueToObject(artifactFactory, "artifactHandlerManager", artifactHandlerManager);
    artifactRepository = new StubArtifactRepository(null);
    DependencyArtifactStubFactory factory = new DependencyArtifactStubFactory(null, false);
    artifacts = factory.getMixedArtifacts();
    repoManager = lookup(RepositoryManager.class);
    MavenSession session = newMavenSession(new MavenProjectStub());
    buildingRequest = session.getProjectBuildingRequest();
    DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
    repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(stubFactory.getWorkingDir()));
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) SimpleLocalRepositoryManager(org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager) DefaultArtifactFactory(org.apache.maven.artifact.factory.DefaultArtifactFactory) MavenProjectStub(org.apache.maven.plugin.testing.stubs.MavenProjectStub) DefaultRepositorySystemSession(org.sonatype.aether.util.DefaultRepositorySystemSession) HashMap(java.util.HashMap) StubArtifactRepository(org.apache.maven.plugin.testing.stubs.StubArtifactRepository) RepositoryManager(org.apache.maven.shared.repository.RepositoryManager) SimpleLocalRepositoryManager(org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager) DefaultArtifactHandlerManager(org.apache.maven.artifact.handler.manager.DefaultArtifactHandlerManager) DependencyArtifactStubFactory(org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory)

Example 13 with DependencyArtifactStubFactory

use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-dependency-plugin by apache.

the class AbstractDependencyMojoTestCase method setUp.

protected void setUp(String testDirStr, boolean createFiles, boolean flattenedPath) throws Exception {
    // required for mojo lookups to work
    super.setUp();
    testDir = new File(getBasedir(), "target" + File.separatorChar + "unit-tests" + File.separatorChar + testDirStr + File.separatorChar);
    DependencyTestUtils.removeDirectory(testDir);
    assertFalse(testDir.exists());
    stubFactory = new DependencyArtifactStubFactory(this.testDir, createFiles, flattenedPath);
}
Also used : File(java.io.File) DependencyArtifactStubFactory(org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory)

Example 14 with DependencyArtifactStubFactory

use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-plugins by apache.

the class TestAnalyzeDepMgt method setUp.

protected void setUp() throws Exception {
    mojo = new AnalyzeDepMgt();
    MavenProject project = new DependencyProjectStub();
    stubFactory = new DependencyArtifactStubFactory(new File(""), false);
    Set<Artifact> allArtifacts = stubFactory.getMixedArtifacts();
    Set<Artifact> directArtifacts = stubFactory.getClassifiedArtifacts();
    exclusionArtifact = stubFactory.getReleaseArtifact();
    directArtifacts.add(exclusionArtifact);
    ex = new Exclusion();
    ex.setArtifactId(exclusionArtifact.getArtifactId());
    ex.setGroupId(exclusionArtifact.getGroupId());
    exclusion = new Dependency();
    exclusion.setArtifactId(exclusionArtifact.getArtifactId());
    exclusion.setGroupId(exclusionArtifact.getGroupId());
    exclusion.setType(exclusionArtifact.getType());
    exclusion.setClassifier("");
    exclusion.setVersion("3.0");
    exclusion.addExclusion(ex);
    List<Dependency> list = new ArrayList<Dependency>();
    list.add(exclusion);
    depMgt = new DependencyManagement();
    depMgt.setDependencies(list);
    project.setArtifacts(allArtifacts);
    project.setDependencyArtifacts(directArtifacts);
    mojo.setProject(project);
}
Also used : AnalyzeDepMgt(org.apache.maven.plugins.dependency.analyze.AnalyzeDepMgt) MavenProject(org.apache.maven.project.MavenProject) Exclusion(org.apache.maven.model.Exclusion) ArrayList(java.util.ArrayList) Dependency(org.apache.maven.model.Dependency) DependencyProjectStub(org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub) File(java.io.File) Artifact(org.apache.maven.artifact.Artifact) DependencyManagement(org.apache.maven.model.DependencyManagement) DependencyArtifactStubFactory(org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory)

Example 15 with DependencyArtifactStubFactory

use of org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory in project maven-plugins by apache.

the class TestDestFileFilter method setUp.

protected void setUp() throws Exception {
    super.setUp();
    outputFolder = new File("target/markers/");
    DependencyTestUtils.removeDirectory(outputFolder);
    assertFalse(outputFolder.exists());
    this.fact = new DependencyArtifactStubFactory(outputFolder, false);
    artifacts = fact.getReleaseAndSnapshotArtifacts();
}
Also used : File(java.io.File) DependencyArtifactStubFactory(org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory)

Aggregations

DependencyArtifactStubFactory (org.apache.maven.plugins.dependency.testUtils.DependencyArtifactStubFactory)16 File (java.io.File)12 Artifact (org.apache.maven.artifact.Artifact)6 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 DefaultArtifactFactory (org.apache.maven.artifact.factory.DefaultArtifactFactory)2 DefaultArtifactHandlerManager (org.apache.maven.artifact.handler.manager.DefaultArtifactHandlerManager)2 MavenSession (org.apache.maven.execution.MavenSession)2 Dependency (org.apache.maven.model.Dependency)2 DependencyManagement (org.apache.maven.model.DependencyManagement)2 Exclusion (org.apache.maven.model.Exclusion)2 MavenProjectStub (org.apache.maven.plugin.testing.stubs.MavenProjectStub)2 StubArtifactRepository (org.apache.maven.plugin.testing.stubs.StubArtifactRepository)2 AnalyzeDepMgt (org.apache.maven.plugins.dependency.analyze.AnalyzeDepMgt)2 ArtifactItem (org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem)2 DependencyProjectStub (org.apache.maven.plugins.dependency.testUtils.stubs.DependencyProjectStub)2 DefaultFileMarkerHandler (org.apache.maven.plugins.dependency.utils.markers.DefaultFileMarkerHandler)2 MavenProject (org.apache.maven.project.MavenProject)2 RepositoryManager (org.apache.maven.shared.repository.RepositoryManager)2