当前位置: 首页>>代码示例>>Java>>正文


Java ScmFile类代码示例

本文整理汇总了Java中org.apache.maven.scm.ScmFile的典型用法代码示例。如果您正苦于以下问题:Java ScmFile类的具体用法?Java ScmFile怎么用?Java ScmFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScmFile类属于org.apache.maven.scm包,在下文中一共展示了ScmFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateChangedModules

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
/**
 * Calculate the modules which needed to be rebuilt based on the list of changes from SCM.
 * 
 * @param projectRootpath Root path of the project.
 * @return The list of modules which needed to be rebuilt.
 */
public List<MavenProject> calculateChangedModules( Path projectRootpath )
{
    // TODO: Think about if we got only pom packaging modules? Do we
    // need to do something special there?
    List<MavenProject> result = new ArrayList<>();
    for ( MavenProject project : projectList )
    {
        Path relativize = projectRootpath.relativize( project.getBasedir().toPath() );
        for ( ScmFile fileItem : changeList )
        {
            boolean startsWith = new File( fileItem.getPath() ).toPath().startsWith( relativize );
            logger.debug( "startswith: " + startsWith + " " + fileItem.getPath() + " " + relativize );
            if ( startsWith )
            {
                if ( !result.contains( project ) )
                {
                    result.add( project );
                }
            }
        }
    }
    return result;
}
 
开发者ID:khmarbaise,项目名称:incremental-module-builder,代码行数:30,代码来源:ModuleCalculator.java

示例2: shouldResultInThreeModules

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
@Ignore
public void shouldResultInThreeModules()
{
    // TODO: Think about this test case. What
    // should be returned for the root module ?
    // If i call mvn -pl root ... it will not work?
    Path root = baseDir.toPath();
    List<ScmFile> changeList = Arrays.asList( 
      new ScmFile( "domain/subdomain/pom.xml", ScmFileStatus.MODIFIED ),
      new ScmFile( "domain/pom.xml", ScmFileStatus.MODIFIED ),
      new ScmFile( "pom.xml", ScmFileStatus.MODIFIED ) 
    );
    moduleCalculator = new ModuleCalculator( projectList, changeList );
    List<MavenProject> changedModules = moduleCalculator.calculateChangedModules( root );

    assertThat( changedModules ).hasSize( 3 ).containsOnly( domain, subdomain, parent );
}
 
开发者ID:khmarbaise,项目名称:incremental-module-builder,代码行数:18,代码来源:ModuleCalculatorTest.java

示例3: shouldResultInASingleModule

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
@Test
public void shouldResultInASingleModule()
{
    Path root = baseDir.toPath();
    List<ScmFile> changeList =
        Arrays.asList( new ScmFile( "domain/src/main/java/com/test.java", ScmFileStatus.MODIFIED ) );
    moduleCalculator = new ModuleCalculator( projectList, changeList );
    List<MavenProject> changedModules = moduleCalculator.calculateChangedModules( root );

    assertThat( changedModules ).hasSize( 1 ).containsExactly( domain );
}
 
开发者ID:khmarbaise,项目名称:incremental-module-builder,代码行数:12,代码来源:ModuleCalculatorTest.java

示例4: shouldResultInTwoModules

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
@Test
public void shouldResultInTwoModules()
{
    Path root = baseDir.toPath();
    List<ScmFile> changeList =
        Arrays.asList( new ScmFile( "domain/src/main/java/com/test.java", ScmFileStatus.MODIFIED ),
                       new ScmFile( "assembly/pom.xml", ScmFileStatus.MODIFIED ) );
    moduleCalculator = new ModuleCalculator( projectList, changeList );
    List<MavenProject> changedModules = moduleCalculator.calculateChangedModules( root );

    assertThat( changedModules ).hasSize( 2 ).containsOnly( domain, assembly );
}
 
开发者ID:khmarbaise,项目名称:incremental-module-builder,代码行数:13,代码来源:ModuleCalculatorTest.java

示例5: shouldResultInTwoModulesTwoChangesInSingleModule

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
@Test
public void shouldResultInTwoModulesTwoChangesInSingleModule()
{
    Path root = baseDir.toPath();
    List<ScmFile> changeList =
        Arrays.asList( new ScmFile( "domain/src/main/java/com/test.java", ScmFileStatus.MODIFIED ),
                       new ScmFile( "domain/src/main/java/Anton.java", ScmFileStatus.MODIFIED ),
                       new ScmFile( "assembly/pom.xml", ScmFileStatus.MODIFIED ) );

    moduleCalculator = new ModuleCalculator( projectList, changeList );
    List<MavenProject> changedModules = moduleCalculator.calculateChangedModules( root );

    assertThat( changedModules ).hasSize( 2 ).containsOnly( domain, assembly );
}
 
开发者ID:khmarbaise,项目名称:incremental-module-builder,代码行数:15,代码来源:ModuleCalculatorTest.java

示例6: shouldResultInTwoModulesDomainAndSubDomain

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
@Test
public void shouldResultInTwoModulesDomainAndSubDomain()
{
    Path root = baseDir.toPath();
    List<ScmFile> changeList = Arrays.asList( new ScmFile( "domain/subdomain/pom.xml", ScmFileStatus.MODIFIED ),
                                              new ScmFile( "domain/pom.xml", ScmFileStatus.MODIFIED ) );
    moduleCalculator = new ModuleCalculator( projectList, changeList );
    List<MavenProject> changedModules = moduleCalculator.calculateChangedModules( root );

    assertThat( changedModules ).hasSize( 2 ).containsOnly( domain, subdomain );
}
 
开发者ID:khmarbaise,项目名称:incremental-module-builder,代码行数:12,代码来源:ModuleCalculatorTest.java

示例7: handleEvent

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
/**
 * Creates a {@link ScmFile} for each event with the exception of directories.
 * Directory events are ignored.
 */
public void handleEvent( SVNEvent event, double progress )
{
    ScmFileStatus status = SvnJavaUtil.getScmFileStatus( event.getExpectedAction() );

    // Do nothing for events without files
    if ( event.getFile() == null || event.getExpectedAction() == SVNEventAction.COMMIT_DELTA_SENT
        || event.getExpectedAction() == SVNEventAction.COMMIT_COMPLETED || event.getNodeKind() != SVNNodeKind.FILE )
    {
        return;
    }

    if ( status == null )
    {
        if ( logger.isInfoEnabled() )
        {
            logger.info( "Unknown SVN file status: '" + event.getExpectedAction() + "' for file: "
                             + event.getFile().getAbsolutePath() );
        }

        status = ScmFileStatus.UNKNOWN;
    }

    if ( logger.isDebugEnabled() )
    {
        logger.debug( StringUtils.defaultString( status, event.getContentsStatus().toString() ) + " - "
                          + event.getFile().getAbsolutePath() );
    }

    String currentFile = event.getFile().getAbsolutePath();
    if ( currentFile.startsWith( baseDirectory.getAbsolutePath() ) )
    {
        currentFile = currentFile.substring( baseDirectory.getAbsolutePath().length() + 1 );
    }

    files.add( new ScmFile( currentFile, status ) );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:41,代码来源:ScmFileEventHandler.java

示例8: doCommit

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
/**
 * FIXME remove when upgrading to scm 1.8 as the method commit has been to protected
 */
protected void doCommit( File workingDirectory, ScmRepository repository )
    throws Exception
{
    CheckInScmResult result = getScmManager().checkIn( repository, new ScmFileSet( workingDirectory ), "No msg" );

    assertTrue( "Check result was successful, output: " + result.getCommandOutput(), result.isSuccess() );

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

    assertEquals( "Expected 2 files in the committed files list " + committedFiles, 2, committedFiles.size() );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:15,代码来源:SvnJavaStatusCommandTckTest.java

示例9: testList

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
@Test
public void testList()
    throws Exception
{
    ScmManager scmManager = (ScmManager) lookup( ScmManager.ROLE );
    String url = System.getProperty( "svnUrl" );
    String scmUrl = "scm:javasvn:" + url;
    SvnJavaScmProviderRepository repository =
        new SvnJavaScmProviderRepository( SVNURL.parseURIEncoded( url ), scmUrl );

    SvnJavaScmProvider provider = (SvnJavaScmProvider) scmManager.getProviderByUrl( scmUrl );

    ScmFileSet fileSet = new ScmFileSet( new File( "." ), new File( "." ) );

    ListScmResult listScmResult = provider.list( repository, fileSet, null );

    System.out.println( listScmResult.getFiles() );

    boolean containsPom = false;

    for ( ScmFile scmFile : listScmResult.getFiles() )
    {
        if ( StringUtils.equals( scmFile.getPath(), "pom.xml" ) )
        {
            containsPom = true;
        }
    }

    assertTrue( "pom.xml not in list result", containsPom );
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:31,代码来源:SvnJavaListCommandTest.java

示例10: doLocalModificationExist

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
private boolean doLocalModificationExist( StringBuilder message )
    throws MojoExecutionException
{
    boolean result = false;

    getLog().debug( "Verifying there are no local modifications ..." );

    List<ScmFile> changedFiles;

    try
    {
        changedFiles = getStatus();
    }
    catch ( ScmException e )
    {
        throw new MojoExecutionException( "An error has occurred while checking scm status.", e );
    }

    if ( !changedFiles.isEmpty() )
    {
        for ( ScmFile file : changedFiles )
        {
            message.append( file.toString() );

            message.append( System.lineSeparator() );
        }

        result = true;
    }

    return result;
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:33,代码来源:CreateMojo.java

示例11: update

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
public List<ScmFile> update()
    throws MojoExecutionException
{
    try
    {
        ScmRepository repository = getScmRepository();

        ScmProvider scmProvider = scmManager.getProviderByRepository( repository );

        UpdateScmResult result = scmProvider.update( repository, new ScmFileSet( scmDirectory ) );

        if ( result == null )
        {
            return Collections.emptyList();
        }

        checkResult( result );

        if ( result instanceof UpdateScmResultWithRevision )
        {
            String revision = ( (UpdateScmResultWithRevision) result ).getRevision();
            getLog().info( "Got a revision during update: " + revision );
            this.revision = revision;
        }

        return result.getUpdatedFiles();
    }
    catch ( ScmException e )
    {
        throw new MojoExecutionException( "Couldn't update project. " + e.getMessage(), e );
    }

}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:34,代码来源:CreateMojo.java

示例12: localChanges

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
private Set<String> localChanges(Set<ScmFileStatus> statusToInclude, ScmRepository repository, File scmRoot) throws ScmException {
  final StatusScmResult status = this.manager.status(repository,
          new ScmFileSet(scmRoot));
  Set<String> affected = new LinkedHashSet<>();
  for (final ScmFile file : status.getChangedFiles()) {
    if (statusToInclude.contains(file.getStatus())) {
      affected.add(file.getPath());
    }
  }
  return affected;
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:12,代码来源:ScmMojo.java

示例13: setFileWithStatus

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
private void setFileWithStatus(final ScmFileStatus status)
    throws ScmException {
  when(this.manager.status(any(ScmRepository.class), any(ScmFileSet.class)))
      .thenReturn(
          new StatusScmResult("", Arrays.asList(new ScmFile(
              "foo/bar/Bar.java", status))));
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:8,代码来源:ScmMojoTest.java

示例14: testUnknownAndDeletedClassesAreNotMutationTested

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
public void testUnknownAndDeletedClassesAreNotMutationTested()
    throws Exception {
  setupConnection();
  when(this.manager.status(any(ScmRepository.class), any(ScmFileSet.class)))
      .thenReturn(
          new StatusScmResult("", Arrays.asList(new ScmFile(
              "foo/bar/Bar.java", ScmFileStatus.DELETED), new ScmFile(
              "foo/bar/Bar.java", ScmFileStatus.UNKNOWN))));
  this.testee.execute();
  verify(this.executionStrategy, never()).execute(any(File.class),
      any(ReportOptions.class), any(PluginServices.class), anyMap());
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:13,代码来源:ScmMojoTest.java

示例15: createScmDiffResultWrapper

import org.apache.maven.scm.ScmFile; //导入依赖的package包/类
private ScmResultWrapper createScmDiffResultWrapper(final DiffScmResult diff)
{
  return new AbstractScmResultWrapper(diff)
  {
    @Override
  public List<ScmFile> getChangedFiles()
    {
      return diff.getChangedFiles();
    }
  };
}
 
开发者ID:release-engineering,项目名称:buildmetadata-maven-plugin,代码行数:12,代码来源:MavenScmRevisionNumberFetcher.java


注:本文中的org.apache.maven.scm.ScmFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。