use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddDependencySetsTask in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testGetModuleProjects_ShouldReturnNothingWhenReactorContainsTwoSiblingProjects.
public void testGetModuleProjects_ShouldReturnNothingWhenReactorContainsTwoSiblingProjects() throws ArchiveCreationException {
final EasyMockSupport mm = new EasyMockSupport();
final MavenProject project = createProject("group", "artifact", "version", null);
final MockAndControlForAddDependencySetsTask macTask = new MockAndControlForAddDependencySetsTask(mm, project);
final MavenProject project2 = createProject("group", "artifact2", "version", null);
final List<MavenProject> projects = new ArrayList<MavenProject>();
projects.add(project);
projects.add(project2);
macTask.expectGetReactorProjects(projects);
final ModuleSet moduleSet = new ModuleSet();
moduleSet.setIncludeSubModules(true);
mm.replayAll();
final Set<MavenProject> moduleProjects = ModuleSetAssemblyPhase.getModuleProjects(moduleSet, macTask.configSource, logger);
assertTrue(moduleProjects.isEmpty());
mm.verifyAll();
}
use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddDependencySetsTask in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testGetModuleProjects_ShouldReturnNothingWhenReactorContainsOnlyCurrentProject.
public void testGetModuleProjects_ShouldReturnNothingWhenReactorContainsOnlyCurrentProject() throws ArchiveCreationException {
final EasyMockSupport mm = new EasyMockSupport();
final MavenProject project = createProject("group", "artifact", "version", null);
final MockAndControlForAddDependencySetsTask macTask = new MockAndControlForAddDependencySetsTask(mm, project);
final List<MavenProject> projects = Collections.singletonList(project);
macTask.expectGetReactorProjects(projects);
final ModuleSet moduleSet = new ModuleSet();
moduleSet.setIncludeSubModules(true);
mm.replayAll();
final Set<MavenProject> moduleProjects = ModuleSetAssemblyPhase.getModuleProjects(moduleSet, macTask.configSource, logger);
assertTrue(moduleProjects.isEmpty());
mm.verifyAll();
}
use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddDependencySetsTask in project maven-plugins by apache.
the class ModuleSetAssemblyPhaseTest method testGetModuleProjects_ShouldReturnDescendentModulesOfCurrentProject.
public void testGetModuleProjects_ShouldReturnDescendentModulesOfCurrentProject() throws ArchiveCreationException {
final EasyMockSupport mm = new EasyMockSupport();
final MavenProject project = createProject("group", "artifact", "version", null);
final MockAndControlForAddDependencySetsTask macTask = new MockAndControlForAddDependencySetsTask(mm, project);
final MavenProject project2 = createProject("group", "artifact2", "version", project);
final MavenProject project3 = createProject("group", "artifact3", "version", project2);
final List<MavenProject> projects = new ArrayList<MavenProject>();
projects.add(project);
projects.add(project2);
projects.add(project3);
macTask.expectGetReactorProjects(projects);
final ModuleSet moduleSet = new ModuleSet();
moduleSet.setIncludeSubModules(true);
mm.replayAll();
final Set<MavenProject> moduleProjects = ModuleSetAssemblyPhase.getModuleProjects(moduleSet, macTask.configSource, logger);
assertEquals(2, moduleProjects.size());
final List<MavenProject> check = new ArrayList<MavenProject>();
check.add(project2);
check.add(project3);
verifyResultIs(check, moduleProjects);
mm.verifyAll();
}
use of org.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddDependencySetsTask 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.apache.maven.plugins.assembly.archive.task.testutils.MockAndControlForAddDependencySetsTask 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