use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AddDependencySetsTaskTest method testGetDependencyArtifacts_ShouldFilterOneDependencyArtifactViaInclude.
public void testGetDependencyArtifacts_ShouldFilterOneDependencyArtifactViaInclude() throws ArchiveCreationException, InvalidAssemblerConfigurationException {
final MavenProject project = new MavenProject(new Model());
final Set<Artifact> artifacts = new HashSet<Artifact>();
final ArtifactMock am = new ArtifactMock(mockManager, "group", "artifact", "1.0", "jar", false);
am.setDependencyTrail(Collections.singletonList(project.getId()));
artifacts.add(am.getArtifact());
final ArtifactMock am2 = new ArtifactMock(mockManager, "group2", "artifact2", "1.0", "jar", false);
am2.setDependencyTrail(Collections.singletonList(project.getId()));
artifacts.add(am2.getArtifact());
final DependencySet dependencySet = new DependencySet();
dependencySet.addInclude("group:artifact");
dependencySet.setUseTransitiveFiltering(true);
final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
mockManager.replayAll();
final AddDependencySetsTask task = new AddDependencySetsTask(Collections.singletonList(dependencySet), artifacts, project, null, logger);
final Set<Artifact> result = task.resolveDependencyArtifacts(dependencySet);
assertNotNull(result);
assertEquals(1, result.size());
assertSame(am.getArtifact(), result.iterator().next());
mockManager.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AddFileSetsTaskTest method testAddFileSet_ShouldNotAddDirectoryWhenSourceDirNonExistent.
public void testAddFileSet_ShouldNotAddDirectoryWhenSourceDirNonExistent() throws ArchiveCreationException, AssemblyFormattingException {
final FileSet fs = new FileSet();
final String dirname = "dir";
fs.setDirectory(dirname);
final File archiveBaseDir = fileManager.createTempDir();
macTask.expectGetFinalName("finalName");
// macTask.expectGetProject( null );
expect(macTask.archiver.getOverrideDirectoryMode()).andReturn(-1);
expect(macTask.archiver.getOverrideFileMode()).andReturn(-1);
final MavenProject project = new MavenProject(new Model());
DefaultAssemblyArchiverTest.setupInterpolators(macTask.configSource);
mockManager.replayAll();
final AddFileSetsTask task = new AddFileSetsTask(new ArrayList<FileSet>());
task.setLogger(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
task.setProject(project);
task.addFileSet(fs, macTask.archiver, macTask.configSource, archiveBaseDir);
mockManager.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class ReaderFormatterTest method getPojoConfigSource.
private PojoConfigSource getPojoConfigSource() {
final PojoConfigSource cfg = new PojoConfigSource();
cfg.setEncoding("UTF-8");
DefaultMavenReaderFilter mavenReaderFilter = new DefaultMavenReaderFilter();
mavenReaderFilter.enableLogging(new ConsoleLogger(2, "fud"));
cfg.setMavenReaderFilter(mavenReaderFilter);
cfg.setEscapeString(null);
cfg.setMavenProject(createBasicMavenProject());
/* expect( configSource.getFilters()).andReturn( filters );
expect( configSource.isIncludeProjectBuildFilters()).andReturn( includeProjectBuildFilters );
expect( configSource.getDelimiters()).andReturn( delimiters );
*/
return cfg;
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class FileItemAssemblyPhaseTest method testExecute_WithOutputDirectoryAndDestName.
public void testExecute_WithOutputDirectoryAndDestName() throws Exception {
final EasyMockSupport mm = new EasyMockSupport();
final MockAndControlForConfigSource macCS = new MockAndControlForConfigSource(mm);
final File basedir = fileManager.createTempDir();
final File readmeFile = fileManager.createFile(basedir, "README.txt", "This is a test file for README.txt.");
final File licenseFile = fileManager.createFile(basedir, "LICENSE.txt", "This is a test file for LICENSE.txt.");
final File configFile = fileManager.createFile(basedir, "config/config.txt", "This is a test file for config/config.txt");
macCS.expectGetBasedir(basedir);
macCS.expectGetProject(new MavenProject(new Model()));
macCS.expectGetFinalName("final-name");
macCS.expectInterpolators();
final MockAndControlForLogger macLogger = new MockAndControlForLogger(mm);
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
macLogger.logger.error("OS=Windows and the assembly descriptor contains a *nix-specific " + "root-relative-reference (starting with slash) /");
} else {
macLogger.logger.warn((String) anyObject());
}
final MockAndControlForArchiver macArchiver = new MockAndControlForArchiver(mm);
final Assembly assembly = new Assembly();
assembly.setId("test");
assembly.setIncludeBaseDirectory(true);
final FileItem readmeFileItem = new FileItem();
readmeFileItem.setSource("README.txt");
readmeFileItem.setOutputDirectory("");
readmeFileItem.setDestName("README_renamed.txt");
readmeFileItem.setFiltered(false);
readmeFileItem.setLineEnding("keep");
readmeFileItem.setFileMode("777");
final FileItem licenseFileItem = new FileItem();
licenseFileItem.setSource("LICENSE.txt");
licenseFileItem.setOutputDirectory("/");
licenseFileItem.setDestName("LICENSE_renamed.txt");
licenseFileItem.setFiltered(false);
licenseFileItem.setLineEnding("keep");
licenseFileItem.setFileMode("777");
final FileItem configFileItem = new FileItem();
configFileItem.setSource("config/config.txt");
configFileItem.setDestName("config_renamed.txt");
configFileItem.setOutputDirectory("config");
configFileItem.setFiltered(false);
configFileItem.setLineEnding("keep");
configFileItem.setFileMode("777");
macArchiver.expectAddFile(readmeFile, "README_renamed.txt", TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test")));
macArchiver.expectAddFile(licenseFile, "LICENSE_renamed.txt", TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test")));
macArchiver.expectAddFile(configFile, "config/config_renamed.txt", TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test")));
assembly.addFile(readmeFileItem);
assembly.addFile(licenseFileItem);
assembly.addFile(configFileItem);
mm.replayAll();
createPhase(macLogger.logger).execute(assembly, macArchiver.archiver, macCS.configSource);
mm.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class FileItemAssemblyPhaseTest method testExecute_ShouldAddRelativeFileNoFilterNoLineEndingConversion.
public void testExecute_ShouldAddRelativeFileNoFilterNoLineEndingConversion() throws ArchiveCreationException, AssemblyFormattingException, IOException {
final EasyMockSupport mm = new EasyMockSupport();
final MockAndControlForConfigSource macCS = new MockAndControlForConfigSource(mm);
final File basedir = fileManager.createTempDir();
final File file = fileManager.createFile(basedir, "file.txt", "This is a test file.");
macCS.expectGetBasedir(basedir);
macCS.expectGetProject(new MavenProject(new Model()));
macCS.expectGetFinalName("final-name");
macCS.expectInterpolators();
final MockAndControlForLogger macLogger = new MockAndControlForLogger(mm);
final MockAndControlForArchiver macArchiver = new MockAndControlForArchiver(mm);
final Assembly assembly = new Assembly();
assembly.setId("test");
final FileItem fi = new FileItem();
fi.setSource("file.txt");
fi.setFiltered(false);
fi.setLineEnding("keep");
fi.setFileMode("777");
macArchiver.expectAddFile(file, "file.txt", TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test")));
assembly.addFile(fi);
mm.replayAll();
createPhase(macLogger.logger).execute(assembly, macArchiver.archiver, macCS.configSource);
mm.verifyAll();
}
Aggregations