use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class FilterUtilsTest method verifyProjectFiltering.
private void verifyProjectFiltering(final String groupId, final String artifactId, final String inclusionPattern, final String exclusionPattern, final List<String> depTrail, final boolean verifyInclusion) {
final ProjectWithArtifactMockControl pmac = new ProjectWithArtifactMockControl(groupId, artifactId, depTrail);
mockManager.replayAll();
// make sure the mock is satisfied...you can't disable this expectation.
pmac.mac.artifact.getDependencyConflictId();
final Set<MavenProject> projects = new HashSet<MavenProject>();
projects.add(pmac);
List<String> inclusions;
if (inclusionPattern != null) {
inclusions = Collections.singletonList(inclusionPattern);
} else {
inclusions = Collections.emptyList();
}
List<String> exclusions;
if (exclusionPattern != null) {
exclusions = Collections.singletonList(exclusionPattern);
} else {
exclusions = Collections.emptyList();
}
final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
Set<MavenProject> result = FilterUtils.filterProjects(projects, inclusions, exclusions, depTrail != null, logger);
if (verifyInclusion) {
assertEquals(1, result.size());
assertEquals(pmac.getId(), result.iterator().next().getId());
} else {
assertTrue(result.isEmpty());
}
mockManager.verifyAll();
// get ready for multiple calls per test.
mockManager.resetAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AddArtifactTaskTest method testShouldAddArchiveFileWithUnpackAndModes.
public void testShouldAddArchiveFileWithUnpackAndModes() throws ArchiveCreationException, AssemblyFormattingException, IOException {
int directoryMode = TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
int fileMode = TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
mac.expectModeChange(-1, -1, directoryMode, fileMode, 2);
mac.expectInterpolators();
ArtifactMock artifactMock = new ArtifactMock(mockManager, "group", "artifact", "version", "jar", false);
artifactMock.setNewFile();
mac.expectGetDestFile(new File("junk"));
try {
mac.archiver.addArchivedFileSet((ArchivedFileSet) anyObject(), (Charset) anyObject());
} catch (ArchiverException e) {
fail("Should never happen.");
}
mockManager.replayAll();
AddArtifactTask task = createTask(artifactMock.getArtifact());
task.setUnpack(true);
task.setDirectoryMode(directoryMode);
task.setFileMode(fileMode);
task.execute(mac.archiver, mac.configSource);
mockManager.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AnnouncementMailMojo method execute.
public void execute() throws MojoExecutionException {
// Fail build fast if it is using deprecated parameters
if (templateOutputDirectory != null) {
throw new MojoExecutionException("You are using the old parameter 'templateOutputDirectory'. " + "You must use 'announcementDirectory' instead.");
}
// Run only at the execution root
if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) {
getLog().info("Skipping the announcement mail in this project because it's not the Execution Root");
} else {
File file = new File(announcementDirectory, announcementFile);
ConsoleLogger logger = new ConsoleLogger(Logger.LEVEL_INFO, "base");
if (getLog().isDebugEnabled()) {
logger.setThreshold(Logger.LEVEL_DEBUG);
}
mailer.enableLogging(logger);
mailer.setSmtpHost(getSmtpHost());
mailer.setSmtpPort(getSmtpPort());
mailer.setSslMode(sslMode, startTls);
if (username != null) {
mailer.setUsername(username);
}
if (password != null) {
mailer.setPassword(password);
}
mailer.initialize();
if (getLog().isDebugEnabled()) {
getLog().debug("fromDeveloperId: " + getFromDeveloperId());
}
if (file.isFile()) {
getLog().info("Connecting to Host: " + getSmtpHost() + ":" + getSmtpPort());
sendMessage();
} else {
throw new MojoExecutionException("Announcement file " + file + " not found...");
}
}
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class ProjectUtilsTest method testGetProjectModules_ShouldIncludeDirectModuleOfMasterProject.
public void testGetProjectModules_ShouldIncludeDirectModuleOfMasterProject() throws IOException {
final MavenProject master = createTestProject("test", "testGroup", "1.0");
master.setFile(new File("pom.xml"));
master.getModel().addModule("module");
final MavenProject module = createTestProject("module", "testGroup", "1.0");
module.setFile(new File("module/pom.xml"));
final List<MavenProject> projects = new ArrayList<MavenProject>(2);
projects.add(master);
projects.add(module);
final Set<MavenProject> result = ProjectUtils.getProjectModules(master, projects, true, new ConsoleLogger(Logger.LEVEL_INFO, "test"));
assertNotNull(result);
assertEquals(1, result.size());
assertEquals(module.getId(), result.iterator().next().getId());
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class ProjectUtilsTest method testGetProjectModules_ShouldIncludeInDirectModuleOfMasterWhenIncludeSubModulesIsTrue.
public void testGetProjectModules_ShouldIncludeInDirectModuleOfMasterWhenIncludeSubModulesIsTrue() throws IOException {
final MavenProject master = createTestProject("test", "testGroup", "1.0");
master.setFile(new File("project/pom.xml"));
master.getModel().addModule("module");
final MavenProject module = createTestProject("module", "testGroup", "1.0");
module.getModel().addModule("submodule");
module.setFile(new File("project/module/pom.xml"));
final MavenProject subModule = createTestProject("sub-module", "testGroup", "1.0");
subModule.setFile(new File("project/module/submodule/pom.xml"));
final List<MavenProject> projects = new ArrayList<MavenProject>(3);
projects.add(master);
projects.add(module);
projects.add(subModule);
final Set<MavenProject> result = ProjectUtils.getProjectModules(master, projects, true, new ConsoleLogger(Logger.LEVEL_INFO, "test"));
assertNotNull(result);
assertEquals(2, result.size());
final List<MavenProject> verify = new ArrayList<MavenProject>(projects);
verify.remove(master);
verifyProjectsPresent(verify, result);
}
Aggregations