use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testAddModuleBinaries_ShouldFailWhenOneModuleDoesntHaveAttachmentWithMatchingClassifier.
public void testAddModuleBinaries_ShouldFailWhenOneModuleDoesntHaveAttachmentWithMatchingClassifier() throws ArchiveCreationException, AssemblyFormattingException, IOException, DependencyResolutionException {
final EasyMockSupport mm = new EasyMockSupport();
final MockAndControlForAddArtifactTask macTask = new MockAndControlForAddArtifactTask(mm);
final ArtifactMock artifactMock = new ArtifactMock(mm, "group", "artifact", "version", "jar", "test", false);
artifactMock.setNewFile();
final ModuleBinaries binaries = new ModuleBinaries();
binaries.setUnpack(false);
binaries.setFileMode("777");
binaries.setOutputDirectory("out");
binaries.setOutputFileNameMapping("artifact");
binaries.setAttachmentClassifier("test");
final MavenProject project = createProject("group", "artifact", "version", null);
project.setArtifact(artifactMock.getArtifact());
final Set<MavenProject> projects = singleton(project);
mm.replayAll();
final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
try {
createPhase(logger, null).addModuleBinaries(null, null, binaries, projects, macTask.archiver, macTask.configSource);
fail("Should throw an invalid configuration exception because of module with missing attachment.");
} catch (final InvalidAssemblerConfigurationException e) {
// should throw this because of missing attachment.
}
mm.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testIsDeprecatedModuleSourcesConfigPresent_ShouldCatchInclude.
public void testIsDeprecatedModuleSourcesConfigPresent_ShouldCatchInclude() {
final ModuleSources sources = new ModuleSources();
sources.addInclude("**/included.txt");
final ModuleSetAssemblyPhase phase = createPhase(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null);
assertTrue(phase.isDeprecatedModuleSourcesConfigPresent(sources));
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testExecute_ShouldAddOneModuleSetWithOneModuleInIt.
public void testExecute_ShouldAddOneModuleSetWithOneModuleInIt() throws ArchiveCreationException, AssemblyFormattingException, IOException, InvalidAssemblerConfigurationException, DependencyResolutionException {
final EasyMockSupport mm = new EasyMockSupport();
final MavenProject project = createProject("group", "artifact", "version", null);
final MockAndControlForAddArtifactTask macTask = new MockAndControlForAddArtifactTask(mm, project);
final MavenProject module = createProject("group", "module", "version", project);
final ArtifactMock moduleArtifactMock = new ArtifactMock(mm, "group", "module", "version", "jar", false);
final File moduleArtifactFile = moduleArtifactMock.setNewFile();
module.setArtifact(moduleArtifactMock.getArtifact());
final List<MavenProject> projects = new ArrayList<MavenProject>();
projects.add(module);
macTask.expectGetReactorProjects(projects);
macTask.expectGetFinalName("final-name");
macTask.expectGetDestFile(new File("junk"));
macTask.expectGetMode(0777, 0777);
final int mode = TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
macTask.expectAddFile(moduleArtifactFile, "out/artifact", mode);
final Assembly assembly = new Assembly();
assembly.setIncludeBaseDirectory(false);
final ModuleSet ms = new ModuleSet();
final ModuleBinaries bin = new ModuleBinaries();
bin.setOutputFileNameMapping("artifact");
bin.setOutputDirectory("out");
bin.setFileMode("777");
bin.setUnpack(false);
bin.setIncludeDependencies(false);
ms.setBinaries(bin);
assembly.addModuleSet(ms);
final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
macTask.expectResolveDependencySets();
DefaultAssemblyArchiverTest.setupInterpolators(macTask.configSource);
mm.replayAll();
final ModuleSetAssemblyPhase phase = createPhase(logger, macTask.dependencyResolver, null);
phase.execute(assembly, macTask.archiver, macTask.configSource);
mm.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testAddModuleSourceFileSets_ShouldReturnImmediatelyIfSourcesIsNull.
public void testAddModuleSourceFileSets_ShouldReturnImmediatelyIfSourcesIsNull() throws ArchiveCreationException, AssemblyFormattingException {
final EasyMockSupport mm = new EasyMockSupport();
mm.replayAll();
createPhase(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null).addModuleSourceFileSets(null, null, null, null);
mm.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AddArtifactTaskTest method createTask.
private AddArtifactTask createTask(Artifact artifact) {
AddArtifactTask task = new AddArtifactTask(artifact, new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null);
task.setFileNameMapping("artifact");
return task;
}
Aggregations