Search in sources :

Example 16 with ManipulationSession

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

the class DistributionEnforcingManipulatorTest method before.

@Before
public void before() throws Exception {
    userCliProperties = new Properties();
    session = new ManipulationSession();
    final GalleyInfrastructure galleyInfra = new GalleyInfrastructure(session.getTargetDir(), session.getRemoteRepositories(), session.getLocalRepository(), session.getSettings(), session.getActiveProfiles(), null, null, null, temp.newFolder("cache-dir"));
    final GalleyAPIWrapper wrapper = new GalleyAPIWrapper(galleyInfra);
    manipulator = new DistributionEnforcingManipulator();
    FieldUtils.writeField(manipulator, "galleyWrapper", wrapper, true);
}
Also used : GalleyInfrastructure(org.commonjava.maven.ext.io.resolver.GalleyInfrastructure) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) GalleyAPIWrapper(org.commonjava.maven.ext.io.resolver.GalleyAPIWrapper) Properties(java.util.Properties) Before(org.junit.Before)

Example 17 with ManipulationSession

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

the class PropertiesUtilsTest method testUpdateNestedProperties2.

@Test
public void testUpdateNestedProperties2() throws Exception {
    Project pP = getProject();
    ManipulationSession session = createUpdateSession();
    assertTrue(updateProperties(session, pP, false, "version.hibernate.osgi", "5.0.4.Final-redhat-1") == PropertiesUtils.PropertyUpdate.FOUND);
    assertFalse(updateProperties(session, pP, false, "version.scala", "2.11.7") == PropertiesUtils.PropertyUpdate.FOUND);
}
Also used : Project(org.commonjava.maven.ext.common.model.Project) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) Test(org.junit.Test)

Example 18 with ManipulationSession

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

the class PropertiesUtilsTest method testResolvePluginsProject.

@Test
public void testResolvePluginsProject() throws Exception {
    final Model modelChild = TestUtils.resolveModelResource(RESOURCE_BASE, "inherited-properties.pom");
    ManipulationSession session = createUpdateSession();
    Project pC = new Project(modelChild);
    assertTrue(pC.getResolvedPlugins(session).size() == 0);
    assertTrue(pC.getResolvedManagedPlugins(session).size() == 0);
}
Also used : Project(org.commonjava.maven.ext.common.model.Project) Model(org.apache.maven.model.Model) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) Test(org.junit.Test)

Example 19 with ManipulationSession

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

the class PropertiesUtilsTest method createUpdateSession.

private ManipulationSession createUpdateSession() throws Exception {
    ManipulationSession session = new ManipulationSession();
    session.setState(new DependencyState(p));
    session.setState(new VersioningState(p));
    session.setState(new CommonState(p));
    final MavenExecutionRequest req = new DefaultMavenExecutionRequest().setUserProperties(p).setRemoteRepositories(Collections.<ArtifactRepository>emptyList());
    final PlexusContainer container = new DefaultPlexusContainer();
    final MavenSession mavenSession = new MavenSession(container, null, req, new DefaultMavenExecutionResult());
    session.setMavenSession(mavenSession);
    return session;
}
Also used : CommonState(org.commonjava.maven.ext.core.state.CommonState) MavenSession(org.apache.maven.execution.MavenSession) DefaultPlexusContainer(org.codehaus.plexus.DefaultPlexusContainer) PlexusContainer(org.codehaus.plexus.PlexusContainer) DefaultPlexusContainer(org.codehaus.plexus.DefaultPlexusContainer) DependencyState(org.commonjava.maven.ext.core.state.DependencyState) DefaultMavenExecutionResult(org.apache.maven.execution.DefaultMavenExecutionResult) MavenExecutionRequest(org.apache.maven.execution.MavenExecutionRequest) DefaultMavenExecutionRequest(org.apache.maven.execution.DefaultMavenExecutionRequest) DefaultMavenExecutionRequest(org.apache.maven.execution.DefaultMavenExecutionRequest) ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) VersioningState(org.commonjava.maven.ext.core.state.VersioningState)

Example 20 with ManipulationSession

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

the class PropertiesUtilsTest method testCheckStrictValue.

@Test
public void testCheckStrictValue() throws Exception {
    ManipulationSession session = createUpdateSession();
    assertFalse(PropertiesUtils.checkStrictValue(session, null, "1.0"));
    assertFalse(PropertiesUtils.checkStrictValue(session, "1.0", null));
    assertFalse(PropertiesUtils.checkStrictValue(session, "1.0.0.Final", "1.0.0.redhat-1"));
    assertTrue(PropertiesUtils.checkStrictValue(session, "1.0.0", "1.0.0.redhat-1"));
    assertTrue(PropertiesUtils.checkStrictValue(session, "1.0.0-SNAPSHOT", "1.0.0.redhat-1"));
    assertFalse(PropertiesUtils.checkStrictValue(session, "1.0.Final-SNAPSHOT", "1.0.0.redhat-1"));
    assertTrue(PropertiesUtils.checkStrictValue(session, "1.0-SNAPSHOT", "1.0.0.redhat-1"));
}
Also used : ManipulationSession(org.commonjava.maven.ext.core.ManipulationSession) 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