use of org.apache.maven.plugins.assembly.model.FileSet in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testCreateFileSet_ShouldUseModuleDirOnlyWhenOutDirIsNull.
public void testCreateFileSet_ShouldUseModuleDirOnlyWhenOutDirIsNull() throws AssemblyFormattingException {
final EasyMockSupport mm = new EasyMockSupport();
final Model model = new Model();
model.setArtifactId("artifact");
final MavenProject project = new MavenProject(model);
final MockAndControlForAddArtifactTask macTask = new MockAndControlForAddArtifactTask(mm, project);
macTask.expectGetFinalName(null);
final FileSet fs = new FileSet();
final ModuleSources sources = new ModuleSources();
sources.setIncludeModuleDirectory(true);
final File basedir = fileManager.createTempDir();
final MavenProject artifactProject = new MavenProject(new Model());
artifactProject.setFile(new File(basedir, "pom.xml"));
final ArtifactMock artifactMock = new ArtifactMock(mm, "group", "artifact", "version", "jar", false);
artifactProject.setArtifact(artifactMock.getArtifact());
DefaultAssemblyArchiverTest.setupInterpolators(macTask.configSource);
mm.replayAll();
final FileSet result = createPhase(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null).createFileSet(fs, sources, artifactProject, macTask.configSource);
assertEquals("artifact/", result.getOutputDirectory());
mm.verifyAll();
}
use of org.apache.maven.plugins.assembly.model.FileSet 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();
}
use of org.apache.maven.plugins.assembly.model.FileSet in project maven-plugins by apache.
the class AddFileSetsTaskTest method testGetFileSetDirectory_ShouldReturnDirFromBasedirAndSourceDir.
public void testGetFileSetDirectory_ShouldReturnDirFromBasedirAndSourceDir() throws ArchiveCreationException, AssemblyFormattingException {
final File dir = fileManager.createTempDir();
final String srcPath = "source";
final File srcDir = new File(dir, srcPath);
final FileSet fs = new FileSet();
fs.setDirectory(srcPath);
final File result = new AddFileSetsTask(new ArrayList<FileSet>()).getFileSetDirectory(fs, dir, null);
assertEquals(srcDir.getAbsolutePath(), result.getAbsolutePath());
}
use of org.apache.maven.plugins.assembly.model.FileSet in project maven-plugins by apache.
the class AddFileSetsTaskTest method testGetFileSetDirectory_ShouldReturnAbsoluteSourceDir.
public void testGetFileSetDirectory_ShouldReturnAbsoluteSourceDir() throws ArchiveCreationException, AssemblyFormattingException {
final File dir = fileManager.createTempDir();
final FileSet fs = new FileSet();
fs.setDirectory(dir.getAbsolutePath());
final File result = new AddFileSetsTask(new ArrayList<FileSet>()).getFileSetDirectory(fs, null, null);
assertEquals(dir.getAbsolutePath(), result.getAbsolutePath());
}
use of org.apache.maven.plugins.assembly.model.FileSet in project maven-plugins by apache.
the class DefaultAssemblyReader method includeSiteInAssembly.
@Override
public void includeSiteInAssembly(final Assembly assembly, final AssemblerConfigurationSource configSource) throws InvalidAssemblerConfigurationException {
final File siteDirectory = configSource.getSiteDirectory();
if (!siteDirectory.exists()) {
throw new InvalidAssemblerConfigurationException("site did not exist in the target directory - " + "please run site:site before creating the assembly");
}
getLogger().info("Adding site directory to assembly : " + siteDirectory);
final FileSet siteFileSet = new FileSet();
siteFileSet.setDirectory(siteDirectory.getPath());
siteFileSet.setOutputDirectory("/site");
assembly.addFileSet(siteFileSet);
}
Aggregations