use of org.apache.maven.plugins.assembly.AssemblerConfigurationSource in project maven-plugins by apache.
the class AssemblyFormatUtilsTest method testEvalFileNameMapping_ShouldResolveArtifactIdAndBaseVersionInOutDir_UseArtifactInfo_WithValidMainProject.
public void testEvalFileNameMapping_ShouldResolveArtifactIdAndBaseVersionInOutDir_UseArtifactInfo_WithValidMainProject() throws AssemblyFormattingException {
final MavenProject mainProject = createProject("group", "main", "1", null);
final String artifactVersion = "2-20070807.112233-1";
final String artifactBaseVersion = "2-SNAPSHOT";
final MavenProject artifactProject = createProject("group", "artifact", artifactVersion, null);
final ArtifactMock artifactMock = new ArtifactMock(mockManager, "group", "artifact", artifactVersion, "jar", true, artifactBaseVersion);
artifactProject.setArtifact(artifactMock.getArtifact());
final MavenSession session = mockManager.createMock(MavenSession.class);
expect(session.getExecutionProperties()).andReturn(null).anyTimes();
expect(session.getUserProperties()).andReturn(new Properties()).anyTimes();
final AssemblerConfigurationSource cs = mockManager.createMock(AssemblerConfigurationSource.class);
expect(cs.getMavenSession()).andReturn(session).anyTimes();
DefaultAssemblyArchiverTest.setupInterpolators(cs);
mockManager.replayAll();
final String result = AssemblyFormatUtils.evaluateFileNameMapping("${artifact.artifactId}-${artifact.baseVersion}", artifactMock.getArtifact(), mainProject, null, cs, AssemblyFormatUtils.moduleProjectInterpolator(null), AssemblyFormatUtils.artifactProjectInterpolator(artifactProject));
/*
final Artifact artifact = artifactMock.getArtifact();
final String result =
AssemblyFormatUtils.evaluateFileNameMapping( "${artifact.artifactId}-${artifact.baseVersion}",
moduleArtifactInterpolator( null ),
moduleProjectInterpolator( null ),
artifactInterpolator( artifact ),
artifactProjectInterpolator( artifactProject ),
mainArtifactPropsOnly( mainProject ),
classifierRules( artifact ),
FixedStringSearchInterpolator.empty() );
*/
assertEquals("artifact-2-SNAPSHOT", result);
mockManager.verifyAll();
// clear out for next call.
mockManager.resetAll();
}
Aggregations