use of org.easymock.classextension.EasyMockSupport 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.easymock.classextension.EasyMockSupport in project maven-plugins by apache.
the class RepositoryAssemblyPhaseTest method testExecute_ShouldIncludeOneRepository.
public void testExecute_ShouldIncludeOneRepository() throws ArchiveCreationException, AssemblyFormattingException, InvalidAssemblerConfigurationException {
final EasyMockSupport mm = new EasyMockSupport();
final MockAndControlForRepositoryAssembler macRepo = new MockAndControlForRepositoryAssembler(mm);
final MockAndControlForArchiver macArchiver = new MockAndControlForArchiver(mm);
final MockAndControlForConfigSource macCS = new MockAndControlForConfigSource(mm);
final File tempRoot = fileManager.createTempDir();
macCS.expectGetTemporaryRootDirectory(tempRoot);
macCS.expectGetProject(new MavenProject(new Model()));
macCS.expectGetFinalName("final-name");
macCS.expectInterpolators();
final Assembly assembly = new Assembly();
assembly.setId("test");
final Repository repo = new Repository();
repo.setOutputDirectory("out");
repo.setDirectoryMode("777");
repo.setFileMode("777");
final int mode = TypeConversionUtils.modeToInt("777", new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
final File outDir = new File(tempRoot, "out");
macArchiver.expectModeChange(-1, -1, mode, mode, true);
macArchiver.expectAddDirectory(outDir, "out/", null, null);
macRepo.expectAssemble();
assembly.addRepository(repo);
mm.replayAll();
createPhase(macRepo.repositoryAssembler, new ConsoleLogger(Logger.LEVEL_DEBUG, "test")).execute(assembly, macArchiver.archiver, macCS.configSource);
mm.verifyAll();
}
use of org.easymock.classextension.EasyMockSupport in project maven-plugins by apache.
the class DefaultAssemblyArchiverTest method testCreateTarArchiver_TarGzFormat_ShouldInitializeGZipCompression.
@Test
public void testCreateTarArchiver_TarGzFormat_ShouldInitializeGZipCompression() throws NoSuchArchiverException, ArchiverException {
final EasyMockSupport mm = new EasyMockSupport();
final TestTarArchiver ttArchiver = new TestTarArchiver();
final DefaultAssemblyArchiver subject = createSubject(mm, ttArchiver);
subject.createTarArchiver("tar.gz", TarLongFileMode.fail);
assertEquals(TarArchiver.TarCompressionMethod.gzip, ttArchiver.compressionMethod);
assertEquals(TarLongFileMode.fail, ttArchiver.longFileMode);
mm.verifyAll();
}
use of org.easymock.classextension.EasyMockSupport in project maven-plugins by apache.
the class DefaultAssemblyArchiverTest method testCreateWarArchiver_ShouldDisableIgnoreWebxmlOption.
@Test
public void testCreateWarArchiver_ShouldDisableIgnoreWebxmlOption() throws NoSuchArchiverException {
final EasyMockSupport mm = new EasyMockSupport();
final TestWarArchiver twArchiver = new TestWarArchiver();
final MockAndControlForAssemblyArchiver macArchiverManager = new MockAndControlForAssemblyArchiver(mm);
macArchiverManager.expectGetArchiver("war", twArchiver);
mm.replayAll();
final DefaultAssemblyArchiver subject = createSubject(macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null);
subject.createWarArchiver();
assertFalse(twArchiver.ignoreWebxml);
}
use of org.easymock.classextension.EasyMockSupport in project maven-plugins by apache.
the class DefaultAssemblyArchiverTest method testCreateArchiver_ShouldCreateZipArchiver.
@Test
public void testCreateArchiver_ShouldCreateZipArchiver() throws NoSuchArchiverException, ArchiverException {
final EasyMockSupport mm = new EasyMockSupport();
final ZipArchiver archiver = new ZipArchiver();
final MockAndControlForAssemblyArchiver macArchiverManager = new MockAndControlForAssemblyArchiver(mm);
macArchiverManager.expectGetArchiver("zip", archiver);
final AssemblerConfigurationSource configSource = mm.createMock(AssemblerConfigurationSource.class);
expect(configSource.isDryRun()).andReturn(false).anyTimes();
expect(configSource.getArchiverConfig()).andReturn(null).anyTimes();
expect(configSource.getWorkingDirectory()).andReturn(new File(".")).anyTimes();
expect(configSource.isUpdateOnly()).andReturn(false).anyTimes();
expect(configSource.getJarArchiveConfiguration()).andReturn(null).anyTimes();
expect(configSource.isIgnorePermissions()).andReturn(true).anyTimes();
mm.replayAll();
final DefaultAssemblyArchiver subject = createSubject(macArchiverManager, new ArrayList<AssemblyArchiverPhase>(), null);
subject.createArchiver("zip", false, null, configSource, null, false, null);
}
Aggregations