Package org.apache.maven.plugin.assembly.mojos

Examples of org.apache.maven.plugin.assembly.mojos.AssemblyMojo


    }

    public void testMASSEMBLY98()
        throws Exception
    {
        AssemblyMojo mojo = executeMojo( "MASSEMBLY-98-plugin-config.xml" );

        File tempRoot = (File) getVariableValueFromObject( mojo, "tempRoot" );

        File tmpRepositoryDir = new File( tempRoot, "repository" );
        assertTrue( "Test if repository output directory is used", tmpRepositoryDir.exists() );
View Full Code Here


    }

    public void testComponents()
        throws Exception
    {
        AssemblyMojo mojo = executeMojo( "component-plugin-config.xml" );

        Map archivedFiles = ArchiverManagerStub.archiverStub.getFiles();

        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
        assertNotNull( "Test if project jar is in archive", archivedFiles.remove( project.getArtifact().getFile() ) );
View Full Code Here

        String fileContents = "<component-set>\n  <components>\n    <component>\n      <role>class.Role</role>" +
            "\n      <implementation>class.Implementation</implementation>\n    </component>\n  </components>" +
            "\n</component-set>";
        FileUtils.fileWrite( new File( plexusDir, "components.xml" ).getAbsolutePath(), fileContents );

        AssemblyMojo mojo = executeMojo( "plexus-components-plugin-config.xml" );

        Map files = ArchiverManagerStub.archiverStub.getFiles();

        File fileSetDir = new File( PlexusTestCase.getBasedir() + "/target/test-classes/fileSet" );
        assertNotNull( "Test if FileSet is in the archive", files.remove( fileSetDir ) );
View Full Code Here

    }

    public void testIncludeSiteDirectory()
        throws Exception
    {
        AssemblyMojo mojo = getMojo( "includeSite-plugin-config.xml" );

        File siteDir = (File) getVariableValueFromObject( mojo, "siteDirectory" );

        siteDir.mkdirs();

        mojo.execute();

        assertTrue( "Test an archive was created", ArchiverManagerStub.archiverStub.getDestFile().exists() );

        Map files = ArchiverManagerStub.archiverStub.getFiles();
View Full Code Here

    public void testArchiverExceptionOnAddDirectoryMethod()
        throws Exception
    {
        generateTestFileSets( "\n" );

        AssemblyMojo mojo = getMojo( "fileSet-plugin-config.xml" );

        ArchiverManagerStub.archiverStub = new JarArchiverStub()
        {
            public void addDirectory( File file, String string, String[] includes, String[] excludes )
                throws ArchiverException
            {
                throw new ArchiverException( "Intentional exception" );
            }
        };

        try
        {
            mojo.execute();

            fail( "Expected exception not thrown" );
        }
        catch ( MojoExecutionException e )
        {
View Full Code Here

    }

    public void testArchiverExceptionInModuleSet()
        throws Exception
    {
        AssemblyMojo mojo = getMojo( "moduleSet-plugin-config.xml" );

        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "executedProject" );

        List reactorProjectsList = (List) getVariableValueFromObject( mojo, "reactorProjects" );

        for ( Iterator reactorProjects = reactorProjectsList.iterator(); reactorProjects.hasNext(); )
        {
            MavenProject reactorProject = (MavenProject) reactorProjects.next();

            reactorProject.setParent( project );
        }

        ArchiverManagerStub.archiverStub = new JarArchiverStub()
        {
            public void addDirectory( File file, String string, String[] includes, String[] excludes )
                throws ArchiverException
            {
                throw new ArchiverException( "Intentional exception" );
            }
        };

        try
        {
            mojo.execute();

            fail( "Expected exception not thrown" );
        }
        catch ( MojoExecutionException e )
        {
View Full Code Here

    }

    private AssemblyMojo executeMojo( String pluginXml )
        throws Exception
    {
        AssemblyMojo mojo = getMojo( pluginXml );

        mojo.execute();

        assertTrue( "Test an archive was created", ArchiverManagerStub.archiverStub.getDestFile().exists() );

        return mojo;
    }
View Full Code Here

    }

    public void testPackedDependencySet()
        throws Exception
    {
        AssemblyMojo mojo = getMojo( "depSet-default-plugin-config.xml" );

        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "executedProject" );
        Set artifactSet = project.getArtifacts();

        mojo.execute();

        Map archiveMap = ArchiverManagerStub.archiverStub.getFiles();
        Collection archivedFiles = archiveMap.keySet();

        assertEquals( "Test number of files in archive", artifactSet.size() + 1, archivedFiles.size() );
View Full Code Here

    }

    public void testPackedDependencySetWithFilenameMapping()
        throws Exception
    {
        AssemblyMojo mojo = getMojo( "depSet-filename-mapping-plugin-config.xml" );

        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "executedProject" );
        Set artifactSet = project.getArtifacts();

        mojo.execute();

        Map archiveMap = ArchiverManagerStub.archiverStub.getFiles();
        Collection archivedFiles = archiveMap.keySet();

        assertEquals( "Test number of files in archive", artifactSet.size() + 1, archivedFiles.size() );
View Full Code Here

    }

    public void testPackedDependencySetWithFilenameMappingAndClassifier()
        throws Exception
    {
        AssemblyMojo mojo = getMojo( "depSet-filename-mapping-and-classifier-plugin-config.xml" );

        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "executedProject" );
        Set artifactSet = project.getArtifacts();

        mojo.execute();

        Map archiveMap = ArchiverManagerStub.archiverStub.getFiles();
        Collection archivedFiles = archiveMap.keySet();

        assertEquals( "Test number of files in archive", artifactSet.size() + 1, archivedFiles.size() );
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.assembly.mojos.AssemblyMojo

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.