Package org.apache.maven.plugin.assembly.model

Examples of org.apache.maven.plugin.assembly.model.FileSet


        assertEquals( srcDir.getAbsolutePath(), result.getAbsolutePath() );
    }

    public void testAddFileSet_ShouldAddDirectory() throws ArchiveCreationException, AssemblyFormattingException
    {
        final FileSet fs = new FileSet();

        final String dirname = "dir";

        fs.setDirectory( dirname );
        fs.setOutputDirectory( "dir2" );

        // ensure this exists, so the directory addition will proceed.
        final File srcDir = new File( macTask.archiveBaseDir, dirname );
        srcDir.mkdirs();
View Full Code Here


    }

    public void testAddFileSet_ShouldAddDirectoryUsingSourceDirNameForDestDir()
        throws ArchiveCreationException, AssemblyFormattingException
    {
        final FileSet fs = new FileSet();

        final String dirname = "dir";

        fs.setDirectory( dirname );

        final File archiveBaseDir = fileManager.createTempDir();

        // ensure this exists, so the directory addition will proceed.
        final File srcDir = new File( archiveBaseDir, dirname );
View Full Code Here

    }

    public void testAddFileSet_ShouldNotAddDirectoryWhenSourceDirNonExistent()
        throws ArchiveCreationException, AssemblyFormattingException
    {
        final FileSet fs = new FileSet();

        final String dirname = "dir";

        fs.setDirectory( dirname );

        final File archiveBaseDir = fileManager.createTempDir();

        macTask.expectGetFinalName( "finalName" );
View Full Code Here

            }
        }

        final UnpackOptions opts = dependencySet.getUnpackOptions();

        final FileSet fs = new FileSet();
        fs.setDirectory( dir.getAbsolutePath() );
        fs.setDirectoryMode( dependencySet.getDirectoryMode() );
        fs.setExcludes( opts.getExcludes() );
        fs.setFileMode( dependencySet.getFileMode() );
        fs.setFiltered( opts.isFiltered() );
        fs.setIncludes( opts.getIncludes() );

        String outDir = dependencySet.getOutputDirectory();
        if ( outDir == null )
        {
            outDir = defaultOutputDirectory;
        }

        String filenameMapping = dependencySet.getOutputFileNameMapping();
        if ( filenameMapping == null )
        {
            filenameMapping = defaultOutputFileNameMapping;
        }

        filenameMapping =
            AssemblyFormatUtils.evaluateFileNameMapping( filenameMapping, depArtifact, configSource.getProject(),
                                                         moduleProject, moduleArtifact, depProject, configSource );

        final String outputLocation = new File( outDir, filenameMapping ).getPath();

        fs.setOutputDirectory( outputLocation );

        fs.setLineEnding( opts.getLineEnding() );
        fs.setUseDefaultExcludes( opts.isUseDefaultExcludes() );

        final AddFileSetsTask task = new AddFileSetsTask( fs );
        task.setProject( depProject );
        task.setModuleProject( moduleProject );
        task.setLogger( logger );
View Full Code Here

        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() );

        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();
    }
View Full Code Here

        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() );

        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();
    }
View Full Code Here

        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() );

        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();
    }
View Full Code Here

        final Set<MavenProject> projects = Collections.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();
View Full Code Here

    }

    public void testShouldReturnOriginalUnalteredDirectoryWhenLineEndingIsNull()
        throws AssemblyFormattingException, IOException
    {
        final FileSet fs = new FileSet();

        final FileSetFormatter formatter = new FileSetFormatter( configSource, logger );

        final File dir = fileManager.createTempDir();
View Full Code Here

    }

    public void testShouldReturnOriginalUnalteredDirectoryWhenLineEndingIsKeep()
        throws AssemblyFormattingException, IOException
    {
        final FileSet fs = new FileSet();
        fs.setLineEnding( AssemblyFileUtils.LINE_ENDING_KEEP );

        final FileSetFormatter formatter = new FileSetFormatter( configSource, logger );

        final File dir = fileManager.createTempDir();
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.assembly.model.FileSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.