Package org.apache.maven.scm.command.login

Examples of org.apache.maven.scm.command.login.LoginScmResult


        info.setUser( "A.N.Other" );
        when( accurev.info( any( File.class ) ) ).thenReturn( info );
        when( accurev.login( "myUser", "aPassword" ) ).thenReturn( true );
        AccuRevLoginCommand command = new AccuRevLoginCommand( getLogger() );

        LoginScmResult result = command.login( repo, new ScmFileSet( basedir ), new CommandParameters() );

        assertThat( result.isSuccess(), is( true ) );
        verify( accurev ).login( "myUser", "aPassword" );

    }
View Full Code Here


        repo.setPassword( "aPassword" );
        info.setUser( "myUser" );
        when( accurev.info( any( File.class ) ) ).thenReturn( info );
        AccuRevLoginCommand command = new AccuRevLoginCommand( getLogger() );

        LoginScmResult result = command.login( repo, new ScmFileSet( basedir ), new CommandParameters() );

        assertThat( result.isSuccess(), is( true ) );
        // This is an important case as logging in will start an expiry timer
        // that might be shorter than the current expiry timer!
        verify( accurev, never() ).login( eq( "myUser" ), anyString() );

    }
View Full Code Here

        repo.setUser( null );
        info.setUser( "anyUser" );
        when( accurev.info( any( File.class ) ) ).thenReturn( info );
        AccuRevLoginCommand command = new AccuRevLoginCommand( getLogger() );

        LoginScmResult result = command.login( repo, new ScmFileSet( basedir ), new CommandParameters() );

        assertThat( result.isSuccess(), is( true ) );
        verify( accurev, never() ).login( anyString(), anyString() );

    }
View Full Code Here

        repo.setUser( null );
        info.setUser( "(not logged in)" );
        when( accurev.info( any( File.class ) ) ).thenReturn( info );
        AccuRevLoginCommand command = new AccuRevLoginCommand( getLogger() );

        LoginScmResult result = command.login( repo, new ScmFileSet( basedir ), new CommandParameters() );

        assertThat( result.isSuccess(), is( false ) );
        verify( accurev, never() ).login( anyString(), anyString() );

    }
View Full Code Here

        catch ( CommandLineException e )
        {
            throw new ScmException( e.getMessage(), e );
        }

        return new LoginScmResult( cl.toString(), isSuccess ? "Login successful" : "Login failed",
                                   consumer.getOutput(), isSuccess );
    }
View Full Code Here

    {
        CvsScmProviderRepository repo = (CvsScmProviderRepository) repository;

        if ( !"pserver".equals( repo.getTransport() ) )
        {
            return new LoginScmResult( null, "The cvs login ignored for " + repo.getTransport() + ".", "", true );
        }
        else if ( isCvsNT() )
        {
            //We don't continue becauseCVSNT doesn't use .cvspass
            return new LoginScmResult( null, "The cvs login ignored for CVSNT.", "", true );
        }

        CvsPass passGenerator = new CvsPass( getLogger() );

        passGenerator.setCvsroot( repo.getCvsRootForCvsPass() );

        passGenerator.setPassword( repo.getPassword() );
        try
        {
            passGenerator.execute();
        }
        catch ( IOException e )
        {
            throw new ScmException( "Error while executing cvs login command.", e );
        }

        return new LoginScmResult( null, "The cvs command succeed.", "", true );
    }
View Full Code Here

            result = info.isLoggedIn();
            providerMessage = result ? ( "Logged in externally as " + info.getUser() ) : "Not logged in";
        }

        getLogger().debug( providerMessage );
        return new LoginScmResult( accurev.getCommandLines(), providerMessage, accurev.getErrorOutput(), result );

    }
View Full Code Here

    public LoginScmResult executeLoginCommand( ScmProviderRepository repository, ScmFileSet fileSet,
                                               CommandParameters params )
        throws ScmException
    {
        getLogger().info( "Attempting to connect with the MKS Integrity Server" );
        LoginScmResult result;
        IntegrityScmProviderRepository iRepo = (IntegrityScmProviderRepository) repository;
        APISession api = iRepo.getAPISession();
        try
        {
            // First we will establish a connection to the MKS Integrity Server
            Response res = api.connect( iRepo.getHost(), iRepo.getPort(), iRepo.getUser(), iRepo.getPassword() );
            int exitCode = res.getExitCode();
            boolean success = ( exitCode == 0 ? true : false );
            result = new LoginScmResult( res.getCommandString(), "", "Exit Code: " + exitCode, success );

            // Next we will prepare the Project and Sandbox for the other commands
            Project siProject = new Project( api, iRepo.getConfigruationPath() );
            Sandbox siSandbox = new Sandbox( api, siProject, fileSet.getBasedir().getAbsolutePath() );
            iRepo.setProject( siProject );
            iRepo.setSandbox( siSandbox );
        }
        catch ( APIException aex )
        {
            ExceptionHandler eh = new ExceptionHandler( aex );
            getLogger().error( "MKS API Exception: " + eh.getMessage() );
            getLogger().info( eh.getCommand() + " exited with return code " + eh.getExitCode() );
            result = new LoginScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
        }

        return result;
    }
View Full Code Here

    {
        CvsScmProviderRepository repo = (CvsScmProviderRepository) repository;

        if ( !"pserver".equals( repo.getTransport() ) )
        {
            return new LoginScmResult( null, "The cvs login ignored for " + repo.getTransport() + ".", "", true );
        }
        else if ( isCvsNT() )
        {
            //We don't continue becauseCVSNT doesn't use .cvspass
            return new LoginScmResult( null, "The cvs login ignored for CVSNT.", "", true );
        }

        CvsPass passGenerator = new CvsPass( getLogger() );

        passGenerator.setCvsroot( repo.getCvsRootForCvsPass() );

        passGenerator.setPassword( repo.getPassword() );
        try
        {
            passGenerator.execute();
        }
        catch ( IOException e )
        {
            throw new ScmException( "Error while executing cvs login command.", e );
        }

        return new LoginScmResult( null, "The cvs command succeed.", "", true );
    }
View Full Code Here

        catch ( CommandLineException e )
        {
            throw new ScmException( e.getMessage(), e );
        }

        return new LoginScmResult( cl.toString(), isSuccess ? "Login successful" : "Login failed",
                                   consumer.getOutput(), isSuccess );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.login.LoginScmResult

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.