Package org.apache.maven.plugin.deploy

Examples of org.apache.maven.plugin.deploy.DeployMojo


        throws Exception
    {
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
   
        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
   
        assertNotNull( mojo );
    }
View Full Code Here


        throws Exception
    {
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );

        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
       
        assertNotNull( mojo );
       
        File file = new File( getBasedir(),
                              "target/test-classes/unit/basic-deploy-test/target/" +
                              "deploy-test-file-1.0-SNAPSHOT.jar" );

        assertTrue( file.exists() );

        artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, "artifact" );

        String packaging = ( String ) getVariableValueFromObject( mojo, "packaging" );
       
        assertEquals( "jar", packaging );
       
        artifact.setFile( file );       
       
        ArtifactRepositoryStub repo = getRepoStub( mojo );

        assertNotNull( repo );
       
        repo.setAppendToUrl( "basic-deploy-test" );
       
        assertEquals( "deploy-test", repo.getId() );
        assertEquals( "deploy-test", repo.getKey() );
        assertEquals( "file", repo.getProtocol() );
        assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );
       
        mojo.execute();

        //check the artifact in local repository
        List expectedFiles = new ArrayList();
        List fileList = new ArrayList();
       
View Full Code Here

    public void testSkippingDeploy()
        throws Exception
    {
        File testPom = new File( getBasedir(), "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );

        DeployMojo mojo = (DeployMojo) lookupMojo( "deploy", testPom );

        assertNotNull( mojo );

        File file = new File( getBasedir(), "target/test-classes/unit/basic-deploy-test/target/"
            + "deploy-test-file-1.0-SNAPSHOT.jar" );

        assertTrue( file.exists() );

        artifact = (DeployArtifactStub) getVariableValueFromObject( mojo, "artifact" );

        String packaging = (String) getVariableValueFromObject( mojo, "packaging" );

        assertEquals( "jar", packaging );

        artifact.setFile( file );

        ArtifactRepositoryStub repo = getRepoStub( mojo );

        assertNotNull( repo );

        repo.setAppendToUrl( "basic-deploy-test" );

        assertEquals( "deploy-test", repo.getId() );
        assertEquals( "deploy-test", repo.getKey() );
        assertEquals( "file", repo.getProtocol() );
        assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );

        setVariableValueToObject( mojo, "skip", Boolean.TRUE );
       
        mojo.execute();

        File localRepo = new File( LOCAL_REPO, "" );

        File[] files = localRepo.listFiles();
View Full Code Here

        throws Exception
    {
        File testPom = new File( getBasedir(),
                        "target/test-classes/unit/basic-deploy-pom/plugin-config.xml" );
       
        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
       
        assertNotNull( mojo );
       
        String packaging = ( String ) getVariableValueFromObject( mojo, "packaging" );
       
        assertEquals( "pom", packaging );
       
        artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, "artifact" );
       
        artifact.setArtifactHandlerExtension( packaging );
       
        ArtifactRepositoryStub repo = getRepoStub( mojo );
       
        repo.setAppendToUrl( "basic-deploy-pom" );
       
        mojo.execute();
       
        List expectedFiles = new ArrayList();
        List fileList = new ArrayList();
       
        expectedFiles.add( "org" );
View Full Code Here

        throws Exception
    {
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-pom/plugin-config.xml" );
       
        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
       
        assertNotNull( mojo );
       
        boolean updateReleaseInfo = ( ( Boolean ) getVariableValueFromObject( mojo, "updateReleaseInfo" ) ).booleanValue();
       
        assertTrue( updateReleaseInfo );
       
        artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, "artifact" );
       
        artifact.setFile( testPom );
       
        ArtifactRepositoryStub repo = getRepoStub( mojo );
       
        repo.setAppendToUrl( "basic-deploy-updateReleaseParam" );       
       
        mojo.execute();
       
        assertTrue( artifact.isRelease() );
    }
View Full Code Here

        throws Exception
    {
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
       
        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
       
        assertNotNull( mojo );
       
        artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, "artifact" );
       
        artifact.setFile( null );
       
        assertNull( artifact.getFile() );
       
        try
        {
            mojo.execute();

            fail( "Did not throw mojo execution exception" );
        }
        catch( MojoExecutionException e )
        {
View Full Code Here

    {
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-with-attached-artifacts/" +
                                 "plugin-config.xml" );

        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );

        assertNotNull( mojo );

        artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, "artifact" );
       
        File file = new File( getBasedir(),
                              "target/test-classes/unit/basic-deploy-with-attached-artifacts/target/" +
                              "deploy-test-file-1.0-SNAPSHOT.jar" );
       
        artifact.setFile( file );
       
        List attachedArtifacts = ( ArrayList ) getVariableValueFromObject( mojo, "attachedArtifacts" );

        ArtifactRepositoryStub repo = getRepoStub( mojo );
       
        repo.setAppendToUrl( "basic-deploy-with-attached-artifacts" );         
       
        mojo.execute();

        String packaging = getVariableValueFromObject( mojo, "packaging" ).toString();

        for( Iterator iter=attachedArtifacts.iterator(); iter.hasNext(); )
        {
View Full Code Here

        System.setProperties( props );
       
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-scp/plugin-config.xml" );
       
        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
       
        assertNotNull( mojo );
       
        ArtifactDeployerStub deployer = new ArtifactDeployerStub();
       
        setVariableValueToObject( mojo, "deployer", deployer );
       
        File file = new File( getBasedir(),
                              "target/test-classes/unit/basic-deploy-scp/target/" +
                              "deploy-test-file-1.0-SNAPSHOT.jar" );

        assertTrue( file.exists() );
       
        DeployArtifactStub artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, "artifact" );       
       
        artifact.setFile( file );
       
        String altUserHome = System.getProperty( "user.home" );
       
        if ( altUserHome.equals( originalUserHome ) )
        {
            // this is *very* bad!
            throw new IllegalStateException( "Setting 'user.home' system property to alternate value did NOT work. Aborting test." );
        }
       
        File sshFile = new File( altUserHome, ".ssh" );
       
        System.out.println( "Testing .ssh dir: " + sshFile.getCanonicalPath() );
       
        //delete first the .ssh folder if existing before executing the mojo
        if( sshFile.exists() )
        {
            FileUtils.deleteDirectory( sshFile );
        }

        mojo.execute();
           
        assertTrue( sshFile.exists() );
       
        FileUtils.deleteDirectory( sshFile );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.deploy.DeployMojo

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.