Search in sources :

Example 21 with ManipulationSession

use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.

the class ResolveArtifactTest method testResolveArtifacts.

@Test
public void testResolveArtifacts() throws Exception {
    final ManipulationSession session = new ManipulationSession();
    // Locate the PME project pom file.
    final File projectroot = new File(TestUtils.resolveFileResource("properties/", "").getParentFile().getParentFile().getParentFile().getParentFile(), "pom.xml");
    PomIO pomIO = new PomIO();
    List<Project> projects = pomIO.parseProject(projectroot);
    Set<ArtifactRef> artifacts = RESTCollector.establishAllDependencies(session, projects, null);
    // NB If this test fails then check if PME deps/plugins have changed...
    assertTrue(artifacts.size() == 59);
}
Also used : Project(org.commonjava.maven.ext.common.model.Project) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) File(java.io.File) PomIO(org.commonjava.maven.ext.io.PomIO) ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef) Test(org.junit.Test)

Example 22 with ManipulationSession

use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.

the class ProjectInheritanceTest method testVerifyProjectVersion.

@Test
public void testVerifyProjectVersion() throws Exception {
    final ManipulationSession session = new ManipulationSession();
    final File projectroot = new File(TestUtils.resolveFileResource(RESOURCE_BASE, "").getParentFile().getParentFile().getParentFile().getParentFile(), "integration-test/src/it/project-inheritance/pom.xml");
    PomIO pomIO = new PomIO();
    List<Project> projects = pomIO.parseProject(projectroot);
    for (Project p : projects) {
        if (p.getPom().equals(projectroot)) {
            HashMap<ArtifactRef, Dependency> deps = p.getResolvedManagedDependencies(session);
            for (ArtifactRef a : deps.keySet()) {
                assertFalse(a.getVersionString().contains("project.version"));
            }
            deps = p.getResolvedDependencies(session);
            assertTrue(deps.size() == 1);
            for (ArtifactRef a : deps.keySet()) {
                assertFalse(a.getVersionString().contains("project.version"));
            }
            assertFalse(deps.containsKey("org.mockito:mockito-all:jar:*"));
            deps = p.getAllResolvedDependencies(session);
            assertTrue(deps.size() == 3);
            for (ArtifactRef a : deps.keySet()) {
                assertFalse(a.getVersionString().contains("project.version"));
                if (a.getGroupId().equals("org.mockito")) {
                    assertTrue(a.getVersionString().contains("*"));
                }
            }
            assertTrue(deps.containsKey(SimpleArtifactRef.parse("org.mockito:mockito-all:jar:*")));
        }
    }
}
Also used : Project(org.commonjava.maven.ext.common.model.Project) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) Dependency(org.apache.maven.model.Dependency) File(java.io.File) PomIO(org.commonjava.maven.ext.io.PomIO) SimpleArtifactRef(org.commonjava.maven.atlas.ident.ref.SimpleArtifactRef) ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef) Test(org.junit.Test)

Example 23 with ManipulationSession

use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.

the class PropertyInterpolatorTest method testResolveProjectDependencies.

@Test
public void testResolveProjectDependencies() throws Exception {
    final Model model = TestUtils.resolveModelResource(RESOURCE_BASE, "infinispan-bom-8.2.0.Final.pom");
    final Project project = new Project(model);
    HashMap<ArtifactRef, Dependency> deps = project.getResolvedManagedDependencies(new ManipulationSession());
    assertTrue(deps.size() == 66);
}
Also used : Project(org.commonjava.maven.ext.common.model.Project) Model(org.apache.maven.model.Model) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) Dependency(org.apache.maven.model.Dependency) ArtifactRef(org.commonjava.maven.atlas.ident.ref.ArtifactRef) Test(org.junit.Test)

Aggregations

ManipulationSession (org.commonjava.maven.ext.core.ManipulationSession)23 Test (org.junit.Test)20 Project (org.commonjava.maven.ext.common.model.Project)9 File (java.io.File)8 MavenSession (org.apache.maven.execution.MavenSession)7 Model (org.apache.maven.model.Model)4 ArtifactRef (org.commonjava.maven.atlas.ident.ref.ArtifactRef)3 DefaultMavenExecutionRequest (org.apache.maven.execution.DefaultMavenExecutionRequest)2 DefaultMavenExecutionResult (org.apache.maven.execution.DefaultMavenExecutionResult)2 MavenExecutionRequest (org.apache.maven.execution.MavenExecutionRequest)2 Dependency (org.apache.maven.model.Dependency)2 DefaultPlexusContainer (org.codehaus.plexus.DefaultPlexusContainer)2 PlexusContainer (org.codehaus.plexus.PlexusContainer)2 ManipulationException (org.commonjava.maven.ext.common.ManipulationException)2 VersioningState (org.commonjava.maven.ext.core.state.VersioningState)2 PomIO (org.commonjava.maven.ext.io.PomIO)2 GalleyAPIWrapper (org.commonjava.maven.ext.io.resolver.GalleyAPIWrapper)2 GalleyInfrastructure (org.commonjava.maven.ext.io.resolver.GalleyInfrastructure)2 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1