Search in sources :

Example 1 with ModuleSources

use of org.apache.maven.plugins.assembly.model.ModuleSources in project maven-plugins by apache.

the class ModuleSetAssemblyPhaseTest method testIsDeprecatedModuleSourcesConfigPresent_ShouldNotCatchDirMode.

public void testIsDeprecatedModuleSourcesConfigPresent_ShouldNotCatchDirMode() {
    final ModuleSources sources = new ModuleSources();
    sources.setDirectoryMode("777");
    final ModuleSetAssemblyPhase phase = createPhase(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null);
    assertFalse(phase.isDeprecatedModuleSourcesConfigPresent(sources));
}
Also used : ConsoleLogger(org.codehaus.plexus.logging.console.ConsoleLogger) ModuleSources(org.apache.maven.plugins.assembly.model.ModuleSources)

Example 2 with ModuleSources

use of org.apache.maven.plugins.assembly.model.ModuleSources in project maven-plugins by apache.

the class ModuleSetAssemblyPhaseTest method testIsDeprecatedModuleSourcesConfigPresent_ShouldCatchExclude.

public void testIsDeprecatedModuleSourcesConfigPresent_ShouldCatchExclude() {
    final ModuleSources sources = new ModuleSources();
    sources.addExclude("**/excluded.txt");
    final ModuleSetAssemblyPhase phase = createPhase(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null);
    assertTrue(phase.isDeprecatedModuleSourcesConfigPresent(sources));
}
Also used : ConsoleLogger(org.codehaus.plexus.logging.console.ConsoleLogger) ModuleSources(org.apache.maven.plugins.assembly.model.ModuleSources)

Example 3 with ModuleSources

use of org.apache.maven.plugins.assembly.model.ModuleSources in project maven-plugins by apache.

the class ModuleSetAssemblyPhaseTest method testCreateFileSet_ShouldPrependModuleDirWhenOutDirIsProvided.

public void testCreateFileSet_ShouldPrependModuleDirWhenOutDirIsProvided() 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();
    fs.setOutputDirectory("out");
    final ModuleSources sources = new ModuleSources();
    sources.setIncludeModuleDirectory(true);
    final MavenProject artifactProject = new MavenProject(new Model());
    final File basedir = fileManager.createTempDir();
    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/out/", result.getOutputDirectory());
    mm.verifyAll();
}
Also used : MockAndControlForAddArtifactTask(org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddArtifactTask) 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) Model(org.apache.maven.model.Model) ArtifactMock(org.apache.maven.plugins.assembly.archive.task.testutils.ArtifactMock) ModuleSources(org.apache.maven.plugins.assembly.model.ModuleSources) File(java.io.File)

Example 4 with ModuleSources

use of org.apache.maven.plugins.assembly.model.ModuleSources in project maven-plugins by apache.

the class ModuleSetAssemblyPhaseTest method testIsDeprecatedModuleSourcesConfigPresent_ShouldNotCatchFileMode.

public void testIsDeprecatedModuleSourcesConfigPresent_ShouldNotCatchFileMode() {
    final ModuleSources sources = new ModuleSources();
    sources.setFileMode("777");
    final ModuleSetAssemblyPhase phase = createPhase(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null);
    assertFalse(phase.isDeprecatedModuleSourcesConfigPresent(sources));
}
Also used : ConsoleLogger(org.codehaus.plexus.logging.console.ConsoleLogger) ModuleSources(org.apache.maven.plugins.assembly.model.ModuleSources)

Example 5 with ModuleSources

use of org.apache.maven.plugins.assembly.model.ModuleSources in project maven-plugins by apache.

the class ModuleSetAssemblyPhaseTest method testCreateFileSet_ShouldAddExcludesForSubModulesWhenExcludeSubModDirsIsTrue.

public void testCreateFileSet_ShouldAddExcludesForSubModulesWhenExcludeSubModDirsIsTrue() throws AssemblyFormattingException {
    final EasyMockSupport mm = new EasyMockSupport();
    final MockAndControlForAddArtifactTask macTask = new MockAndControlForAddArtifactTask(mm, null);
    macTask.expectGetFinalName(null);
    final FileSet fs = new FileSet();
    final ModuleSources sources = new ModuleSources();
    sources.setExcludeSubModuleDirectories(true);
    final Model model = new Model();
    model.setArtifactId("artifact");
    model.addModule("submodule");
    final MavenProject project = new MavenProject(model);
    final File basedir = fileManager.createTempDir();
    project.setFile(new File(basedir, "pom.xml"));
    final ArtifactMock artifactMock = new ArtifactMock(mm, "group", "artifact", "version", "jar", false);
    project.setArtifact(artifactMock.getArtifact());
    DefaultAssemblyArchiverTest.setupInterpolators(macTask.configSource);
    mm.replayAll();
    final FileSet result = createPhase(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"), null).createFileSet(fs, sources, project, macTask.configSource);
    assertEquals(1, result.getExcludes().size());
    assertEquals("submodule/**", result.getExcludes().get(0));
    mm.verifyAll();
}
Also used : MockAndControlForAddArtifactTask(org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddArtifactTask) EasyMockSupport(org.easymock.classextension.EasyMockSupport) FileSet(org.apache.maven.plugins.assembly.model.FileSet) MavenProject(org.apache.maven.project.MavenProject) ConsoleLogger(org.codehaus.plexus.logging.console.ConsoleLogger) Model(org.apache.maven.model.Model) ArtifactMock(org.apache.maven.plugins.assembly.archive.task.testutils.ArtifactMock) ModuleSources(org.apache.maven.plugins.assembly.model.ModuleSources) File(java.io.File)

Aggregations

ModuleSources (org.apache.maven.plugins.assembly.model.ModuleSources)9 ConsoleLogger (org.codehaus.plexus.logging.console.ConsoleLogger)9 ArtifactMock (org.apache.maven.plugins.assembly.archive.task.testutils.ArtifactMock)4 FileSet (org.apache.maven.plugins.assembly.model.FileSet)4 MavenProject (org.apache.maven.project.MavenProject)4 EasyMockSupport (org.easymock.classextension.EasyMockSupport)4 File (java.io.File)3 Model (org.apache.maven.model.Model)3 MockAndControlForAddArtifactTask (org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddArtifactTask)3 MockAndControlForAddFileSetsTask (org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddFileSetsTask)1 Logger (org.codehaus.plexus.logging.Logger)1