Search in sources :

Example 1 with MockAndControlForAddFileSetsTask

use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask in project maven-plugins by apache.

the class FileSetAssemblyPhaseTest method testShouldNotFailWhenNoFileSetsSpecified.

public void testShouldNotFailWhenNoFileSetsSpecified() throws ArchiveCreationException, AssemblyFormattingException {
    final Assembly assembly = new Assembly();
    assembly.setId("test");
    final MockAndControlForLogger macLogger = new MockAndControlForLogger();
    final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask(mm, fileManager);
    mm.replayAll();
    createPhase(macLogger).execute(assembly, macTask.archiver, macTask.configSource);
    mm.verifyAll();
}
Also used : MockAndControlForAddFileSetsTask(org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask) Assembly(org.apache.maven.plugins.assembly.model.Assembly)

Example 2 with MockAndControlForAddFileSetsTask

use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask in project maven-plugins by apache.

the class FileSetAssemblyPhaseTest method testShouldAddOneFileSet.

public void testShouldAddOneFileSet() throws ArchiveCreationException, AssemblyFormattingException {
    final Assembly assembly = new Assembly();
    assembly.setId("test");
    assembly.setIncludeBaseDirectory(false);
    final FileSet fs = new FileSet();
    fs.setOutputDirectory("/out");
    fs.setDirectory("/input");
    fs.setFileMode("777");
    fs.setDirectoryMode("777");
    assembly.addFileSet(fs);
    final MockAndControlForLogger macLogger = new MockAndControlForLogger();
    final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask(mm, fileManager);
    macTask.expectGetArchiveBaseDirectory();
    final MavenProject project = new MavenProject(new Model());
    macLogger.expectError(true, true);
    final int dirMode = Integer.parseInt("777", 8);
    final int fileMode = Integer.parseInt("777", 8);
    final int[] modes = { -1, -1, dirMode, fileMode };
    macTask.expectAdditionOfSingleFileSet(project, "final-name", false, modes, 1, true);
    DefaultAssemblyArchiverTest.setupInterpolators(macTask.configSource);
    mm.replayAll();
    createPhase(macLogger).execute(assembly, macTask.archiver, macTask.configSource);
    mm.verifyAll();
}
Also used : FileSet(org.apache.maven.plugins.assembly.model.FileSet) MavenProject(org.apache.maven.project.MavenProject) Model(org.apache.maven.model.Model) MockAndControlForAddFileSetsTask(org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask) Assembly(org.apache.maven.plugins.assembly.model.Assembly)

Example 3 with MockAndControlForAddFileSetsTask

use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask in project maven-plugins by apache.

the class AddFileSetsTaskTest method setUp.

@Override
public void setUp() {
    mockManager = new EasyMockSupport();
    fileManager = new TestFileManager("add-fileset.test.", "");
    macTask = new MockAndControlForAddFileSetsTask(mockManager, fileManager);
}
Also used : EasyMockSupport(org.easymock.classextension.EasyMockSupport) TestFileManager(org.apache.maven.plugins.assembly.testutils.TestFileManager) MockAndControlForAddFileSetsTask(org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask)

Example 4 with MockAndControlForAddFileSetsTask

use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask in project maven-plugins by apache.

the class ModuleSetAssemblyPhaseTest method testAddModuleSourceFileSets_ShouldAddOneSourceDirectory.

public void testAddModuleSourceFileSets_ShouldAddOneSourceDirectory() throws ArchiveCreationException, AssemblyFormattingException {
    final EasyMockSupport mm = new EasyMockSupport();
    final MockAndControlForAddFileSetsTask macTask = new MockAndControlForAddFileSetsTask(mm, fileManager);
    final MavenProject project = createProject("group", "artifact", "version", null);
    macTask.expectGetProject(project);
    final ArtifactMock artifactMock = new ArtifactMock(mm, "group", "artifact", "version", "jar", false);
    project.setArtifact(artifactMock.getArtifact());
    final Set<MavenProject> projects = singleton(project);
    final ModuleSources sources = new ModuleSources();
    final FileSet fs = new FileSet();
    fs.setDirectory("/src");
    fs.setDirectoryMode("777");
    fs.setFileMode("777");
    sources.addFileSet(fs);
    macTask.expectGetArchiveBaseDirectory();
    final int mode = TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
    final int[] modes = { -1, -1, mode, mode };
    macTask.expectAdditionOfSingleFileSet(project, "final-name", false, modes, 1, true, false);
    DefaultAssemblyArchiverTest.setupInterpolators(macTask.configSource);
    mm.replayAll();
    final Logger logger = new ConsoleLogger(Logger.LEVEL_DEBUG, "test");
    createPhase(logger, null).addModuleSourceFileSets(sources, projects, macTask.archiver, macTask.configSource);
    mm.verifyAll();
}
Also used : EasyMockSupport(org.easymock.classextension.EasyMockSupport) MavenProject(org.apache.maven.project.MavenProject) FileSet(org.apache.maven.plugins.assembly.model.FileSet) ConsoleLogger(org.codehaus.plexus.logging.console.ConsoleLogger) ArtifactMock(org.apache.maven.plugins.assembly.archive.task.testutils.ArtifactMock) MockAndControlForAddFileSetsTask(org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask) ModuleSources(org.apache.maven.plugins.assembly.model.ModuleSources) ConsoleLogger(org.codehaus.plexus.logging.console.ConsoleLogger) Logger(org.codehaus.plexus.logging.Logger)

Aggregations

MockAndControlForAddFileSetsTask (org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask)4 Assembly (org.apache.maven.plugins.assembly.model.Assembly)2 FileSet (org.apache.maven.plugins.assembly.model.FileSet)2 MavenProject (org.apache.maven.project.MavenProject)2 EasyMockSupport (org.easymock.classextension.EasyMockSupport)2 Model (org.apache.maven.model.Model)1 ArtifactMock (org.apache.maven.plugins.assembly.archive.task.testutils.ArtifactMock)1 ModuleSources (org.apache.maven.plugins.assembly.model.ModuleSources)1 TestFileManager (org.apache.maven.plugins.assembly.testutils.TestFileManager)1 Logger (org.codehaus.plexus.logging.Logger)1 ConsoleLogger (org.codehaus.plexus.logging.console.ConsoleLogger)1