Examples of InputFile


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

  @Override
  public Object get(Value value, Class clazz, CoderContext context) {
    String fromModuleKey = value.getString();
    String fromRelativePath = value.getString();
    InputFile from = inputPathCache.getFile(fromModuleKey, fromRelativePath);
    if (from == null) {
      throw new IllegalStateException("Unable to load InputFile " + fromModuleKey + ":" + fromRelativePath);
    }
    String toModuleKey = value.getString();
    String toRelativePath = value.getString();
    InputFile to = inputPathCache.getFile(toModuleKey, toRelativePath);
    if (to == null) {
      throw new IllegalStateException("Unable to load InputFile " + toModuleKey + ":" + toRelativePath);
    }
    int weight = value.getInt();
    return new DefaultDependency()
View Full Code Here

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

  @Override
  public Object get(Value value, Class clazz, CoderContext context) {
    String testModuleKey = value.getString();
    String testRelativePath = value.getString();
    InputFile testFile = inputPathCache.getFile(testModuleKey, testRelativePath);
    if (testFile == null) {
      throw new IllegalStateException("Unable to load InputFile " + testModuleKey + ":" + testRelativePath);
    }
    String name = value.getString();
    String mainModuleKey = value.getString();
    String mainRelativePath = value.getString();
    InputFile mainFile = inputPathCache.getFile(mainModuleKey, mainRelativePath);
    if (mainFile == null) {
      throw new IllegalStateException("Unable to load InputFile " + mainModuleKey + ":" + mainRelativePath);
    }
    int size = value.getInt();
    List<Integer> lines = new ArrayList<Integer>(size);
View Full Code Here

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

  @Override
  public Object get(Value value, Class clazz, CoderContext context) {
    String moduleKey = value.getString();
    String relativePath = value.getString();
    InputFile testFile = inputPathCache.getFile(moduleKey, relativePath);
    if (testFile == null) {
      throw new IllegalStateException("Unable to load InputFile " + moduleKey + ":" + relativePath);
    }
    String name = value.getString();
    String message = value.getString();
View Full Code Here

Examples of org.sonar.api.batch.fs.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.api.batch.fs.InputFile

  public void should_search_input_files() throws Exception {
    DefaultModuleFileSystem fs = new DefaultModuleFileSystem(moduleInputFileCache,
      new Project("foo"), settings, fileIndexer, initializer, componentIndexer);

    File mainFile = temp.newFile();
    InputFile mainInput = new DeprecatedDefaultInputFile("foo", "Main.java").setFile(mainFile).setType(InputFile.Type.MAIN);
    InputFile testInput = new DeprecatedDefaultInputFile("foo", "Test.java").setFile(temp.newFile()).setType(InputFile.Type.TEST);
    when(moduleInputFileCache.inputFiles()).thenReturn(Lists.newArrayList(mainInput, testInput));

    fs.index();
    Iterable<InputFile> inputFiles = fs.inputFiles(fs.predicates().hasType(InputFile.Type.MAIN));
    assertThat(inputFiles).containsOnly(mainInput);
View Full Code Here

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

    assertThat(adaptor.newMeasure()).isNotNull();
  }

  @Test
  public void shouldFailIfUnknowMetric() {
    InputFile file = new DefaultInputFile("foo", "src/Foo.php");

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Unknow metric with key: lines");

    adaptor.store(new DefaultMeasure()
View Full Code Here

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

      .withValue(10));
  }

  @Test
  public void shouldSaveFileMeasureToSensorContext() {
    InputFile file = new DefaultInputFile("foo", "src/Foo.php");

    ArgumentCaptor<org.sonar.api.measures.Measure> argumentCaptor = ArgumentCaptor.forClass(org.sonar.api.measures.Measure.class);
    when(sensorContext.saveMeasure(eq(file), argumentCaptor.capture())).thenReturn(null);

    adaptor.store(new DefaultMeasure()
View Full Code Here

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

  @Test
  public void shouldSetAppropriatePersistenceMode() {
    // Metric FUNCTION_COMPLEXITY_DISTRIBUTION is only persisted on directories.

    InputFile file = new DefaultInputFile("foo", "src/Foo.php");

    ArgumentCaptor<org.sonar.api.measures.Measure> argumentCaptor = ArgumentCaptor.forClass(org.sonar.api.measures.Measure.class);
    when(sensorContext.saveMeasure(eq(file), argumentCaptor.capture())).thenReturn(null);

    adaptor.store(new DefaultMeasure()
View Full Code Here

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

    assertThat(m.getMetric()).isEqualTo(CoreMetrics.NCLOC);
  }

  @Test
  public void shouldAddIssueOnFile() {
    InputFile file = new DefaultInputFile("foo", "src/Foo.php");

    ArgumentCaptor<Issue> argumentCaptor = ArgumentCaptor.forClass(Issue.class);

    Issuable issuable = mock(Issuable.class);
    when(resourcePerspectives.as(Issuable.class, File.create("src/Foo.php"))).thenReturn(issuable);
View Full Code Here

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

  @Test
  public void no_filters() throws Exception {
    DeprecatedFileFilters filters = new DeprecatedFileFilters();

    InputFile inputFile = new DeprecatedDefaultInputFile("foo", "src/main/java/Foo.java").setFile(temp.newFile());
    assertThat(filters.accept(inputFile)).isTrue();
  }
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.