use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AddDependencySetsTaskTest method verifyOneDependencyAdded.
private void verifyOneDependencyAdded(final String outputLocation, final boolean unpack) throws AssemblyFormattingException, ArchiveCreationException, IOException, InvalidAssemblerConfigurationException {
final MavenProject project = new MavenProject(new Model());
final DependencySet ds = new DependencySet();
ds.setOutputDirectory(outputLocation);
ds.setOutputFileNameMapping("artifact");
ds.setUnpack(unpack);
ds.setScope(Artifact.SCOPE_COMPILE);
ds.setDirectoryMode(Integer.toString(10, 8));
ds.setFileMode(Integer.toString(10, 8));
final MockAndControlForAddDependencySetsTask macTask = new MockAndControlForAddDependencySetsTask(mockManager, new MavenProject(new Model()));
final ArtifactMock artifactMock = new ArtifactMock(mockManager, "group", "artifact", "version", "jar", false);
final File artifactFile = artifactMock.setNewFile();
if (unpack) {
macTask.expectAddArchivedFileSet();
// macTask.expectModeChange( -1, -1, 10, 10, 2 );
} else {
macTask.expectAddFile(artifactFile, outputLocation + "/artifact", 10);
}
macTask.expectGetDestFile(new File("junk"));
macTask.expectCSGetFinalName("final-name");
macTask.expectCSGetRepositories(null, null);
final MavenProject depProject = new MavenProject(new Model());
macTask.expectBuildFromRepository(depProject);
macTask.expectGetMode(0222, 0222);
final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
final AddDependencySetsTask task = new AddDependencySetsTask(Collections.singletonList(ds), Collections.singleton(artifactMock.getArtifact()), project, macTask.projectBuilder, logger);
DefaultAssemblyArchiverTest.setupInterpolators(macTask.configSource);
mockManager.replayAll();
task.addDependencySet(ds, macTask.archiver, macTask.configSource);
mockManager.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AddFileSetsTaskTest method testAddFileSet_ShouldAddDirectory.
public void testAddFileSet_ShouldAddDirectory() throws ArchiveCreationException, AssemblyFormattingException {
final FileSet fs = new FileSet();
final String dirname = "dir";
fs.setDirectory(dirname);
fs.setOutputDirectory("dir2");
// ensure this exists, so the directory addition will proceed.
final File srcDir = new File(macTask.archiveBaseDir, dirname);
srcDir.mkdirs();
final int[] modes = { -1, -1, -1, -1 };
macTask.expectAdditionOfSingleFileSet(null, null, true, modes, 1, true, false);
// macTask.expectGetProject( null );
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, macTask.archiveBaseDir);
mockManager.verifyAll();
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class AddFileSetsTaskTest method testAddFileSet_ShouldAddDirectoryUsingSourceDirNameForDestDir.
public void testAddFileSet_ShouldAddDirectoryUsingSourceDirNameForDestDir() throws ArchiveCreationException, AssemblyFormattingException {
final FileSet fs = new FileSet();
final String dirname = "dir";
fs.setDirectory(dirname);
final File archiveBaseDir = fileManager.createTempDir();
// ensure this exists, so the directory addition will proceed.
final File srcDir = new File(archiveBaseDir, dirname);
srcDir.mkdirs();
final int[] modes = { -1, -1, -1, -1 };
macTask.expectAdditionOfSingleFileSet(null, null, true, modes, 1, true, false);
// macTask.expectGetProject( null );
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 AssemblyProxyArchiverTest method addDirectory_NoPerms_CallAcceptFilesOnlyOnce.
@Test
public void addDirectory_NoPerms_CallAcceptFilesOnlyOnce() throws IOException, ArchiverException {
final Archiver delegate = new JarArchiver();
final File output = fileManager.createTempFile();
delegate.setDestFile(output);
final CounterSelector counter = new CounterSelector(true);
final List<FileSelector> selectors = new ArrayList<FileSelector>();
selectors.add(counter);
final AssemblyProxyArchiver archiver = new AssemblyProxyArchiver("", delegate, null, selectors, null, new File("."), new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
archiver.setForced(true);
final File dir = fileManager.createTempDir();
FileUtils.cleanDirectory(dir);
fileManager.createFile(dir, "file.txt", "This is a test.");
archiver.addDirectory(dir);
archiver.createArchive();
assertEquals(1, counter.getCount());
}
use of org.codehaus.plexus.logging.console.ConsoleLogger in project maven-plugins by apache.
the class DependencySetAssemblyPhaseTest method testExecute_ShouldNotAddDependenciesWhenProjectHasNone.
public void testExecute_ShouldNotAddDependenciesWhenProjectHasNone() throws AssemblyFormattingException, ArchiveCreationException, IOException, InvalidAssemblerConfigurationException, DependencyResolutionException {
final Assembly assembly = new Assembly();
assembly.setId("test");
assembly.setIncludeBaseDirectory(false);
final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
final MockAndControlForAddDependencySetsTask macTask = new MockAndControlForAddDependencySetsTask(mm, null);
macTask.expectResolveDependencySets();
mm.replayAll();
createPhase(macTask, logger, macTask.dependencyResolver).execute(assembly, null, macTask.configSource);
mm.verifyAll();
}
Aggregations