Package org.apache.maven.scm.command.checkout

Examples of org.apache.maven.scm.command.checkout.CheckOutScmResult


        repo.setPersistCheckout( false );

        ScmRepository scmRepo = new ScmRepository( "accurev", repo );

        AccuRevScmProvider provider = new AccuRevScmProvider();
        CheckOutScmResult result = provider.checkOut( scmRepo, new ScmFileSet( basedir ), new ScmTag( "mySnapShot" ) );

        verify( accurev ).rmws( "myStream_me" );
        verify( accurev ).reactivate( "myStream_me" );

        assertTrue( result.isSuccess() );

    }
View Full Code Here


        List<File> updatedFiles = Collections.singletonList( new File( "updated/file" ) );
        when( accurev.update( basedir, "now" ) ).thenReturn( updatedFiles );

        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );

        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), new CommandParameters() );

        assertThat( result.isSuccess(), is( true ) );
        assertThat( result.getRelativePathProjectDirectory(), is( "/project/dir" ) );
        List<ScmFile> checkedOutFiles = result.getCheckedOutFiles();
        assertThat( checkedOutFiles.size(), is( 1 ) );
        assertHasScmFile( checkedOutFiles, "updated/file", ScmFileStatus.CHECKED_OUT );

    }
View Full Code Here

                                                                                                                                true );
        when( accurev.update( basedir, "now" ) ).thenReturn( null );

        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );

        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), new CommandParameters() );

        assertThat( result.isSuccess(), is( false ) );
        assertThat( result.getProviderMessage(), notNullValue() );

    }
View Full Code Here

        List<File> updatedFiles = Collections.singletonList( new File( "updated/file" ) );
        when( accurev.update( basedir, null ) ).thenReturn( updatedFiles );

        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );

        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), new CommandParameters() );

        verify( accurev ).pop( basedir, null );

        assertThat( result.isSuccess(), is( true ) );
        assertThat( result.getRelativePathProjectDirectory(), is( "/project/dir" ) );

    }
View Full Code Here

        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );

        CommandParameters params = new CommandParameters();
        params.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( "mySnapShot" ) );

        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), params );

        verify( accurev ).chws( basedir, "someOldStream_someUser", "mySnapShot" );

        assertThat( result.isSuccess(), is( true ) );
        assertThat( result.getRelativePathProjectDirectory(), is( "/project/dir" ) );

    }
View Full Code Here

        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );

        CommandParameters parameters = new CommandParameters();
        parameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmRevision( "anotherStream/12" ) );
       
        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), parameters );

        assertThat( result.isSuccess(), is( true ) );
        assertThat( result.getCheckedOutFiles().size(), is( 1 ) );

    }
View Full Code Here

        AccuRevCheckOutCommand command = new AccuRevCheckOutCommand( getLogger() );

        CommandParameters parameters = new CommandParameters();
        parameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmRevision( "myStream/12" ) );
        CheckOutScmResult result = command.checkout( repo, new ScmFileSet( basedir ), parameters );

        verify( accurev ).pop( basedir, null );

        assertThat( result.isSuccess(), is( true ) );
        assertThat( result.getCheckedOutFiles().size(), is( 1 ) );

    }
View Full Code Here

                                                              cl.getWorkingDirectory().getAbsolutePath(), logListener,
                                                              getLogger() );

            if ( !isSuccess )
            {
                return new CheckOutScmResult( cl.toString(), "The cvs command failed.",
                                              logListener.getStderr().toString(), false );
            }
            BufferedReader stream = new BufferedReader(
                new InputStreamReader( new ByteArrayInputStream( logListener.getStdout().toString().getBytes() ) ) );

            String line;

            while ( ( line = stream.readLine() ) != null )
            {
                consumer.consumeLine( line );
            }
        }
        catch ( Exception e )
        {
            e.printStackTrace();
            return new CheckOutScmResult( cl.toString(), "The cvs command failed.", logListener.getStdout().toString(),
                                          false );
        }

        return new CheckOutScmResult( cl.toString(), consumer.getCheckedOutFiles() );
    }
View Full Code Here

        assertResultIsSuccess( tagResult );

        scmRepository.getProviderRepository().setPersistCheckout( false );

        CheckOutScmResult checkoutResult =
            getScmManager().checkOut( scmRepository, new ScmFileSet( new File( getWorkingCopy(), "target/checkout" ) ),
                                      new ScmTag( tag ) );

        assertResultIsSuccess( checkoutResult );
View Full Code Here

        PerforceCheckOutCommand command = new PerforceCheckOutCommand();
        command.setLogger( getLogger() );
        CommandParameters params = new CommandParameters();
        params.setScmVersion( CommandParameter.SCM_VERSION, scmVersion );

        CheckOutScmResult cosr = (CheckOutScmResult) command.execute( repo, files, params );
        if ( !cosr.isSuccess() )
        {
            return new UpdateScmResult( cosr.getCommandLine(), cosr.getProviderMessage(), cosr.getCommandOutput(),
                                        false );
        }

        PerforceScmProviderRepository p4repo = (PerforceScmProviderRepository) repo;
        String clientspec = PerforceScmProvider.getClientspecName( getLogger(), p4repo, files.getBasedir() );
        Commandline cl = createCommandLine( p4repo, files.getBasedir(), clientspec );

        @SuppressWarnings( "unused" )
        String location = PerforceScmProvider.getRepoPath( getLogger(), p4repo, files.getBasedir() );
        PerforceHaveConsumer consumer =
            new PerforceHaveConsumer( getLogger() );

        try
        {
            if ( getLogger().isDebugEnabled() )
            {
                getLogger().debug( PerforceScmProvider.clean( "Executing " + cl.toString() ) );
            }

            CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
            int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, err );

            if ( exitCode != 0 )
            {
                String cmdLine = CommandLineUtils.toString( cl.getCommandline() );

                StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
                msg.append( '\n' );
                msg.append( "Command line was:" + cmdLine );

                throw new CommandLineException( msg.toString() );
            }
        }
        catch ( CommandLineException e )
        {
            if ( getLogger().isErrorEnabled() )
            {
                getLogger().error( "CommandLineException " + e.getMessage(), e );
            }
        }

        return new UpdateScmResultWithRevision( cosr.getCommandLine(), cosr.getCheckedOutFiles(),
                                                String.valueOf( consumer.getHave() ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.command.checkout.CheckOutScmResult

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.