Examples of InputFile


Examples of org.sonar.api.batch.fs.InputFile

  public void match_absolute_path_and_insensitive_file_extension() throws Exception {
    PathPattern pattern = PathPattern.create("file:**/src/main/**Foo.java");
    assertThat(pattern.toString()).isEqualTo("file:**/src/main/**Foo.java");

    File file = new File(temp.newFolder(), "src/main/java/org/MyFoo.JAVA");
    InputFile inputFile = new DefaultInputFile("ABCDE", "src/main/java/org/MyFoo.JAVA").setFile(file);
    assertThat(pattern.match(inputFile, false)).isTrue();

    file = new File(temp.newFolder(), "src/main/java/org/Other.JAVA");
    inputFile = new DefaultInputFile("ABCDE", "src/main/java/org/Other.JAVA").setFile(file);
    assertThat(pattern.match(inputFile, false)).isFalse();
View Full Code Here

Examples of org.sonar.api.batch.fs.InputFile

  public Object get(Value value, Class clazz, CoderContext context) {
    DefaultMeasure newMeasure = new DefaultMeasure(null);
    String moduleKey = value.getString();
    if (moduleKey != null) {
      String relativePath = value.getString();
      InputFile f = inputPathCache.getFile(moduleKey, relativePath);
      newMeasure.onFile(f);
    } else {
      newMeasure.onProject();
    }
    Metric m = metricFinder.findByKey(value.getString());
View Full Code Here

Examples of org.sonar.api.resources.InputFile

  }

  private static Project mockProjectWithSomeFiles(String languageKey) {
    Project project = TestUtils.mockProject();
    List<InputFile> listofFiles = new LinkedList<InputFile>();
    InputFile inputFile = mock(InputFile.class);
    listofFiles.add(0, inputFile);
    when(project.getLanguageKey()).thenReturn(languageKey);
    when(project.getFileSystem().mainFiles(languageKey)).thenReturn(listofFiles);
    return project;
  }
View Full Code Here

Examples of org.sonar.api.resources.InputFile

  }

  private static List<InputFile> fromSourceFiles(List<File> sourceFiles) {
    List<InputFile> result = new ArrayList<InputFile>();
    for (File file : sourceFiles) {
      InputFile inputFile = mock(InputFile.class);
      when(inputFile.getFile()).thenReturn(new File(file, ""));
      result.add(inputFile);
    }
    return result;
  }
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.