Package org.apache.maven.scm

Examples of org.apache.maven.scm.ScmFileSet


        createBarJava( barJava );

        changeReadmeTxt( readmeTxt );

        AddScmResult addResult = getScmManager().add( getScmRepository(),
                                                      new ScmFileSet( getWorkingCopy(), "src/main/java/Foo.java",
                                                                      null ) );

        assertResultIsSuccess( addResult );

        CheckInScmResult result =
            getScmManager().checkIn( getScmRepository(), new ScmFileSet( getWorkingCopy() ), "Commit message" );

        assertResultIsSuccess( result );

        List<ScmFile> files = result.getCheckedInFiles();

        assertNotNull( files );

        assertEquals( 2, files.size() );

        Map<String, ScmFile> fileMap = mapFilesByPath( files );
        ScmFile file1 = fileMap.get( "src/main/java/Foo.java" );
        assertNotNull( file1 );
        assertEquals( ScmFileStatus.CHECKED_IN, file1.getStatus() );

        ScmFile file2 = fileMap.get( "readme.txt" );
        assertNotNull( file2 );
        assertEquals( ScmFileStatus.CHECKED_IN, file2.getStatus() );

        CheckOutScmResult checkoutResult =
            getScmManager().checkOut( getScmRepository(), new ScmFileSet( getAssertionCopy() ) );

        assertResultIsSuccess( checkoutResult );

        fooJava = new File( getAssertionCopy(), "src/main/java/Foo.java" );
View Full Code Here


        createBarJava( barJava );

        changeReadmeTxt( readmeTxt );

        AddScmResult addResult = getScmManager().getProviderByUrl( getScmUrl() ).add( getScmRepository(),
                                                                                      new ScmFileSet( getWorkingCopy(),
                                                                                                      "src/main/java/Foo.java",
                                                                                                      null ) );

        assertResultIsSuccess( addResult );

        CheckInScmResult result =
            getScmManager().checkIn( getScmRepository(), new ScmFileSet( getWorkingCopy(), "**/Foo.java", null ),
                                     "Commit message" );

        assertResultIsSuccess( result );

        List<ScmFile> files = result.getCheckedInFiles();

        assertNotNull( files );

        assertEquals( 1, files.size() );

        ScmFile file1 = files.get( 0 );

        assertEquals( ScmFileStatus.CHECKED_IN, file1.getStatus() );

        assertPath( "/test-repo/check-in/Foo.java", file1.getPath() );

        CheckOutScmResult checkoutResult =
            getScmManager().checkOut( getScmRepository(), new ScmFileSet( getAssertionCopy() ) );

        assertResultIsSuccess( checkoutResult );

        fooJava = new File( getAssertionCopy(), "src/main/java/Foo.java" );

View Full Code Here

        throws Exception
    {
        String tag = "test-tag";

        @SuppressWarnings( "deprecation" ) TagScmResult tagResult =
            getScmManager().getProviderByUrl( getScmUrl() ).tag( getScmRepository(), new ScmFileSet( getWorkingCopy() ),
                                                                 tag );

        assertResultIsSuccess( tagResult );

        assertEquals( "check all 4 files tagged", 4, tagResult.getTaggedFiles().size() );

        File readmeTxt = new File( getWorkingCopy(), "readme.txt" );

        assertEquals( "check readme.txt contents", "/readme.txt", FileUtils.fileRead( readmeTxt ) );

        changeReadmeTxt( readmeTxt );

        CheckInScmResult checkinResult =
            getScmManager().checkIn( getScmRepository(), new ScmFileSet( getWorkingCopy() ), "commit message" );

        assertResultIsSuccess( checkinResult );

        CheckOutScmResult checkoutResult =
            getScmManager().checkOut( getScmRepository(), new ScmFileSet( getAssertionCopy() ) );

        assertResultIsSuccess( checkoutResult );

        readmeTxt = new File( getAssertionCopy(), "readme.txt" );

        assertEquals( "check readme.txt contents", "changed file", FileUtils.fileRead( readmeTxt ) );

        FileUtils.deleteDirectory( getAssertionCopy() );

        assertFalse( "check previous assertion copy deleted", getAssertionCopy().exists() );

        checkoutResult = getScmManager().getProviderByUrl( getScmUrl() ).checkOut( getScmRepository(),
                                                                                   new ScmFileSet( getAssertionCopy() ),
                                                                                   new ScmTag( tag ) );

        assertResultIsSuccess( checkoutResult );

        assertEquals( "check readme.txt contents is from tagged version", "/readme.txt",
View Full Code Here

        // ----------------------------------------------------------------------
        // Diff the project
        // ----------------------------------------------------------------------

        ScmProvider provider = getScmManager().getProviderByUrl( getScmUrl() );
        ScmFileSet fileSet = new ScmFileSet( getWorkingCopy() );
        DiffScmResult result = provider.diff( repository, fileSet, null, (ScmVersion) null );

        assertNotNull( "The command returned a null result.", result );

        assertResultIsSuccess( result );
View Full Code Here

            CvsScmTestUtils.executeCVS( assertionDirectory.getParentFile(), arguments );

            // A new check out should return 0 updated files.
            ScmRepository scmRepository = scmManager.makeScmRepository( scmUrl );

            UpdateScmResult result = scmManager.update( scmRepository, new ScmFileSet( assertionDirectory ) );

            assertNotNull( result );

            if ( !result.isSuccess() )
            {
                System.out.println( "result.providerMessage: " + result.getProviderMessage() );

                System.out.println( "result.commandOutput: " + result.getCommandOutput() );

                fail( "Command failed" );
            }

            assertNull( result.getProviderMessage() );

            assertNull( result.getCommandOutput() );

            assertNotNull( result.getUpdatedFiles() );

            assertEquals( 0, result.getUpdatedFiles().size() );

            // Modifing a file
            File fooJava = new File( workingDirectory, "Foo.java" );

            String content = FileUtils.fileRead( fooJava );

            writer = new FileWriter( fooJava );

            writer.write( content + System.getProperty( "line.separator" ) );
            writer.write( "extra line" );

            writer.close();

            // Adding a new file
            writer = new FileWriter( new File( workingDirectory, "New.txt" ) );

            writer.write( "new file" );

            writer.close();

            arguments = "-f -d " + repository.getAbsolutePath() + " add New.txt";

            CvsScmTestUtils.executeCVS( workingDirectory, arguments );

            // Committing
            arguments = "-f -d " + repository.getAbsolutePath() + " commit -m .";

            CvsScmTestUtils.executeCVS( workingDirectory, arguments );

            // Check the updated files
            result = scmManager.update( scmRepository, new ScmFileSet( assertionDirectory ) );

            assertNotNull( result );

            if ( !result.isSuccess() )
            {
View Full Code Here

    private static final String cmdPrefix = "p4 -d " + workingDirectory.getAbsolutePath();

    public void testGetCommandLine()
        throws Exception
    {
        ScmFileSet files = new ScmFileSet( new File( "." ), Arrays.asList(
            new File[]{ new File( "foo.xml" ), new File( "bar.xml" ) } ) );
        testCommandLine( "scm:perforce://depot/projects/pathname", cmdPrefix + " submit -i", files );
    }
View Full Code Here

    }

    public void testGetCommandLineAbsolutePaths()
        throws Exception
    {
        ScmFileSet files = new ScmFileSet( new File( "." ).getAbsoluteFile(), Arrays.asList(
            new File[]{ new File( "foo.xml" ).getAbsoluteFile(), new File( "bar.xml" ).getAbsoluteFile() } ) );
        testCommandLine( "scm:perforce://depot/projects/pathname", cmdPrefix + " submit -i", files );
    }
View Full Code Here

    }

    public void testGetCommandLineWithHost()
        throws Exception
    {
        ScmFileSet files = new ScmFileSet( new File( "." ), Arrays.asList(
            new File[]{ new File( "foo.xml" ), new File( "bar.xml" ) } ) );
        testCommandLine( "scm:perforce:a:username@//depot/projects/pathname", cmdPrefix + " -p a -u username submit -i",
                         files );
    }
View Full Code Here

    }

    public void testGetCommandLineWithHostAndPort()
        throws Exception
    {
        ScmFileSet files = new ScmFileSet( new File( "." ), Arrays.asList(
            new File[]{ new File( "foo.xml" ), new File( "bar.xml" ) } ) );
        testCommandLine( "scm:perforce:myhost:1234:username@//depot/projects/pathname",
                         cmdPrefix + " -p myhost:1234 -u username submit -i", files );
    }
View Full Code Here

    protected CheckOutScmResult checkoutRepo()
        throws Exception
    {
        CheckOutScmResult result =
            getScmManager().checkOut( scmRepository, new ScmFileSet( workingDirectory ), (ScmVersion) null );

        assertResultIsSuccess( result );
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.scm.ScmFileSet

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.