Package org.sonar.api.component

Examples of org.sonar.api.component.Component.key()


  public void should_return_null_on_null_component() throws Exception {

    String componentKey = "org.foo.Bar";

    Component component = mock(Component.class);
    when(component.key()).thenReturn(componentKey);

    ScanGraph graph = mock(ScanGraph.class);
    when(graph.getComponent(componentKey)).thenReturn(null);

    GraphPerspectiveLoader perspectiveLoader = mock(GraphPerspectiveLoader.class);
View Full Code Here


      json.prop("name", testCase.name());
      json.prop("status", testCase.status().name());
      json.prop("durationInMs", testCase.durationInMs());

      Component testPlan = testCase.testPlan().component();
      Integer ref = refByTestPlan.get(testPlan.key());
      if (ref == null) {
        ref = refByTestPlan.size() + 1;
        refByTestPlan.put(testPlan.key(), ref);
        componentsByKey.put(testPlan.key(), testPlan);
      }
View Full Code Here

      Component testPlan = testCase.testPlan().component();
      Integer ref = refByTestPlan.get(testPlan.key());
      if (ref == null) {
        ref = refByTestPlan.size() + 1;
        refByTestPlan.put(testPlan.key(), ref);
        componentsByKey.put(testPlan.key(), testPlan);
      }
      json.prop("_ref", Integer.toString(ref));
      json.endObject();
    }
View Full Code Here

      Component testPlan = testCase.testPlan().component();
      Integer ref = refByTestPlan.get(testPlan.key());
      if (ref == null) {
        ref = refByTestPlan.size() + 1;
        refByTestPlan.put(testPlan.key(), ref);
        componentsByKey.put(testPlan.key(), testPlan);
      }
      json.prop("_ref", Integer.toString(ref));
      json.endObject();
    }
    json.endArray();
View Full Code Here

    for (Map.Entry<String, Integer> entry : refByTestPlan.entrySet()) {
      String componentKey = entry.getKey();
      Integer ref = entry.getValue();
      Component file = componentsByKey.get(componentKey);
      json.name(Integer.toString(ref)).beginObject();
      json.prop("key", file.key());
      json.prop("longName", file.longName());
      json.endObject();
    }
    json.endObject();
  }
View Full Code Here

    json.name("files").beginArray();
    for (TestCase testCase : testPlan.testCasesByName(test)) {
      for (CoverageBlock coverageBlock : testCase.coverageBlocks()) {
        json.beginObject();
        Component file = coverageBlock.testable().component();
        json.prop("key", file.key());
        json.prop("longName", file.longName());
        json.prop("coveredLines", coverageBlock.lines().size());
        json.endObject();
      }
    }
View Full Code Here

    DefaultComponentQueryResult results = finder.find(query, components);

    assertThat(results.components()).hasSize(3);
    Component component = results.components().iterator().next();
    assertThat(component.name()).isEqualTo("Apache Tika");
    assertThat(component.key()).isEqualTo("org.apache.tika:tika");
    assertThat(component.qualifier()).isEqualTo("TRK");
  }

  @Test
  public void should_find_components_by_key_pattern() {
View Full Code Here

  }

  @Test
  public void get_project_settings(){
    Component project = mock(Component.class);
    when(project.key()).thenReturn("struts");

    // Global property
    settings.appendProperty("sonar.core.version", "3.6");

    // Project property
View Full Code Here

  }

  @Test
  public void should_apply_registered_highlighting() throws Exception {
    Component component = mock(Component.class);
    when(component.key()).thenReturn("myComponent");

    ComponentDataCache cache = mock(ComponentDataCache.class);

    DefaultHighlightable highlightable = new DefaultHighlightable(component, cache);
    highlightable.newHighlighting()
View Full Code Here

  @Test
  public void should_update_cache_when_done() throws Exception {

    Component component = mock(Component.class);
    when(component.key()).thenReturn("myComponent");

    ComponentDataCache cache = mock(ComponentDataCache.class);

    DefaultSymbolizable symbolPerspective = new DefaultSymbolizable(cache, component);
    Symbolizable.SymbolTableBuilder symbolTableBuilder = symbolPerspective.newSymbolTableBuilder();
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.