Package org.sonar.batch.protocol.input

Examples of org.sonar.batch.protocol.input.FileData


            revisions = ((MeasureModel) measureByKey[1]).getData(CoreMetrics.SCM_REVISIONS_BY_LINE);
          } else if (measureByKey[0].equals(CoreMetrics.SCM_AUTHORS_BY_LINE_KEY)) {
            authors = ((MeasureModel) measureByKey[1]).getData(CoreMetrics.SCM_AUTHORS_BY_LINE);
          }
        }
        ref.addFileData(module.getKeyWithBranch(), path, new FileData(hash, lastCommits, revisions, authors));
      }
    }
    ref.setLastAnalysisDate(lastSnapshotCreationDate(projectKey));
    return ref;
  }
View Full Code Here


      profiler.stop();
    }
  }

  private void copyPreviousMeasuresForUnmodifiedFiles(final SensorContext context, List<InputFile> filesToBlame, InputFile f) {
    FileData fileData = projectReferentials.fileData(projectDefinition.getKeyWithBranch(), f.relativePath());

    if (f.status() == Status.SAME && fileData != null) {
      String scmAuthorsByLine = fileData.scmAuthorsByLine();
      String scmLastCommitDatetimesByLine = fileData.scmLastCommitDatetimesByLine();
      String scmRevisionsByLine = fileData.scmRevisionsByLine();
      if (scmAuthorsByLine != null
        && scmLastCommitDatetimesByLine != null
        && scmRevisionsByLine != null) {
        saveMeasures(context, f, scmAuthorsByLine, scmLastCommitDatetimesByLine, scmRevisionsByLine);
      } else {
View Full Code Here

public class StatusDetectionTest {
  @Test
  public void detect_status() throws Exception {
    ProjectReferentials ref = new ProjectReferentials();
    ref.addFileData("foo", "src/Foo.java", new FileData("ABCDE", null, null, null));
    ref.addFileData("foo", "src/Bar.java", new FileData("FGHIJ", null, null, null));
    StatusDetection statusDetection = new StatusDetection(ref);

    assertThat(statusDetection.status("foo", "src/Foo.java", "ABCDE")).isEqualTo(InputFile.Status.SAME);
    assertThat(statusDetection.status("foo", "src/Foo.java", "XXXXX")).isEqualTo(InputFile.Status.CHANGED);
    assertThat(statusDetection.status("foo", "src/Other.java", "QWERT")).isEqualTo(InputFile.Status.ADDED);
View Full Code Here

  StatusDetection(ProjectReferentials projectReferentials) {
    this.projectReferentials = projectReferentials;
  }

  InputFile.Status status(String projectKey, String relativePath, String hash) {
    FileData fileDataPerPath = projectReferentials.fileData(projectKey, relativePath);
    if (fileDataPerPath == null) {
      return InputFile.Status.ADDED;
    }
    String previousHash = fileDataPerPath.hash();
    if (StringUtils.equals(hash, previousHash)) {
      return InputFile.Status.SAME;
    }
    if (StringUtils.isEmpty(previousHash)) {
      return InputFile.Status.ADDED;
View Full Code Here

TOP

Related Classes of org.sonar.batch.protocol.input.FileData

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.