public void testExecute_ShouldAddOneModuleSetWithOneModuleInIt()
throws ArchiveCreationException, AssemblyFormattingException, IOException,
InvalidAssemblerConfigurationException, DependencyResolutionException
{
final EasyMockSupport mm = new EasyMockSupport();
final MavenProject project = createProject( "group", "artifact", "version", null );
final MockAndControlForAddArtifactTask macTask = new MockAndControlForAddArtifactTask( mm, project );
final MavenProject module = createProject( "group", "module", "version", project );
final ArtifactMock moduleArtifactMock = new ArtifactMock( mm, "group", "module", "version", "jar", false );
final File moduleArtifactFile = moduleArtifactMock.setNewFile();
module.setArtifact( moduleArtifactMock.getArtifact() );
final List<MavenProject> projects = new ArrayList<MavenProject>();
projects.add( module );
macTask.expectGetReactorProjects( projects );
macTask.expectGetFinalName( "final-name" );
macTask.expectGetDestFile( new File( "junk" ) );
final int mode = TypeConversionUtils.modeToInt( "777", new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
macTask.expectAddFile( moduleArtifactFile, "out/artifact", mode );
final Assembly assembly = new Assembly();
assembly.setIncludeBaseDirectory( false );
final ModuleSet ms = new ModuleSet();
final ModuleBinaries bin = new ModuleBinaries();
bin.setOutputFileNameMapping( "artifact" );
bin.setOutputDirectory( "out" );
bin.setFileMode( "777" );
bin.setUnpack( false );
bin.setIncludeDependencies( false );
ms.setBinaries( bin );
assembly.addModuleSet( ms );
final Logger logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "test" );
macTask.expectResolveDependencySets();
mm.replayAll();
final ModuleSetAssemblyPhase phase = createPhase( logger, macTask.dependencyResolver, null);
phase.execute( assembly, macTask.archiver, macTask.configSource );
mm.verifyAll();
}