Examples of inputFile()


Examples of org.sonar.api.batch.fs.FileSystem.inputFile()

  private void processLine(File coverPerTest, int lineNumber, SensorContext context, String line, InputFile file) {
    try {
      Iterator<String> split = Splitter.on(":").split(line).iterator();
      String otherFileRelativePath = split.next();
      FileSystem fs = context.fileSystem();
      InputFile otherFile = fs.inputFile(fs.predicates().hasRelativePath(otherFileRelativePath));
      if (otherFile == null) {
        throw new IllegalStateException("Unable to find file " + otherFileRelativePath);
      }
      int weight = Integer.parseInt(split.next());
      context.newDependency()
View Full Code Here

Examples of org.sonar.api.batch.fs.FileSystem.inputFile()

    try {
      Iterator<String> split = Splitter.on(":").split(line).iterator();
      String testCaseName = split.next();
      String mainFileRelativePath = split.next();
      FileSystem fs = context.fileSystem();
      InputFile mainFile = fs.inputFile(fs.predicates().hasRelativePath(mainFileRelativePath));
      if (mainFile == null) {
        throw new IllegalStateException("Unable to find file " + mainFileRelativePath);
      }
      List<Integer> coveredLines = new ArrayList<Integer>();
      Iterator<String> lines = Splitter.on(",").split(split.next()).iterator();
View Full Code Here

Examples of org.sonar.api.batch.sensor.measure.internal.DefaultMeasure.inputFile()

  }

  @Override
  public void put(Value value, Object object, CoderContext context) {
    DefaultMeasure m = (DefaultMeasure) object;
    DefaultInputFile inputFile = (DefaultInputFile) m.inputFile();
    if (inputFile != null) {
      value.putString(inputFile.moduleKey());
      value.putString(inputFile.relativePath());
    } else {
      value.putNull();
View Full Code Here

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult.inputFile()

    assertThat(result.inputFiles()).hasSize(2);

    // 4 measures per file
    assertThat(result.measures()).hasSize(8);

    InputFile inputFile = result.inputFile("src/sample1.xoo");
    // One clone group
    List<DuplicationGroup> duplicationGroups = result.duplicationsFor(inputFile);
    assertThat(duplicationGroups).hasSize(1);

    DuplicationGroup cloneGroup = duplicationGroups.get(0);
View Full Code Here

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult.inputFile()

        .build())
      .start();

    assertThat(result.inputFiles()).hasSize(1);
    assertThat(result.inputDirs()).hasSize(1);
    assertThat(result.inputFile("src/sample.xoo").type()).isEqualTo(InputFile.Type.MAIN);
    assertThat(result.inputFile("src/sample.xoo").relativePath()).isEqualTo("src/sample.xoo");
    assertThat(result.inputDir("src").relativePath()).isEqualTo("src");
  }

  @Test
View Full Code Here

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult.inputFile()

      .start();

    assertThat(result.inputFiles()).hasSize(1);
    assertThat(result.inputDirs()).hasSize(1);
    assertThat(result.inputFile("src/sample.xoo").type()).isEqualTo(InputFile.Type.MAIN);
    assertThat(result.inputFile("src/sample.xoo").relativePath()).isEqualTo("src/sample.xoo");
    assertThat(result.inputDir("src").relativePath()).isEqualTo("src");
  }

  @Test
  public void scanProjectWithTestDir() throws IOException {
View Full Code Here

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult.inputFile()

        .put("sonar.projectDescription", "Description of Foo Project")
        .put("sonar.sources", "src")
        .build())
      .start();

    InputFile file = result.inputFile("src/sample.xoo");
    assertThat(result.highlightingTypeFor(file, 0)).containsExactly(TypeOfText.STRING);
    assertThat(result.highlightingTypeFor(file, 9)).containsExactly(TypeOfText.STRING);
    assertThat(result.highlightingTypeFor(file, 10)).isEmpty();
    assertThat(result.highlightingTypeFor(file, 11)).containsExactly(TypeOfText.KEYWORD);
View Full Code Here

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult.inputFile()

        .put("sonar.tests", "test")
        .build())
      .start();

    assertThat(result.inputFiles()).hasSize(1);
    assertThat(result.inputFile("test/sampleTest.xoo").type()).isEqualTo(InputFile.Type.TEST);
  }

  /**
   * SONAR-5419
   */
 
View Full Code Here

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult.inputFile()

        .put("sonar.sources", "src")
        .build())
      .start();
    System.out.println("Duration: " + (System.currentTimeMillis() - start));

    InputFile file = result.inputFile("src/sample.xoo");
    assertThat(result.highlightingTypeFor(file, 0)).containsExactly(TypeOfText.STRING);

  }

}
View Full Code Here

Examples of org.sonar.batch.mediumtest.BatchMediumTester.TaskResult.inputFile()

        .put("sonar.projectDescription", "Description of Foo Project")
        .put("sonar.sources", "src")
        .build())
      .start();

    assertThat(result.dependencyWeight(result.inputFile("src/sample.xoo"), result.inputFile("src/sample2.xoo"))).isEqualTo(3);
    assertThat(result.dependencyWeight(result.inputFile("src/sample.xoo"), result.inputFile("src/foo/sample3.xoo"))).isEqualTo(6);
  }

}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.