Package org.sonar.api.component

Examples of org.sonar.api.component.Component


public class DefaultSymbolizableTest {

  @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


  ComponentDataCache cache = mock(ComponentDataCache.class);

  @Test
  public void should_load_default_perspective() throws Exception {
    Resource file = new File("foo.c").setEffectiveKey("myproject:path/to/foo.c");
    Component component = new ResourceComponent(file);

    HighlightableBuilder builder = new HighlightableBuilder(cache);
    Highlightable perspective = builder.loadPerspective(Highlightable.class, component);

    assertThat(perspective).isNotNull().isInstanceOf(DefaultHighlightable.class);
View Full Code Here

    assertThat(perspective.component()).isSameAs(component);
  }

  @Test
  public void project_should_not_be_highlightable() {
    Component component = new ResourceComponent(new Project("struts").setEffectiveKey("org.struts"));

    HighlightableBuilder builder = new HighlightableBuilder(cache);
    Highlightable perspective = builder.loadPerspective(Highlightable.class, component);

    assertThat(perspective).isNull();
View Full Code Here

  ProjectTree projectTree = mock(ProjectTree.class);

  @Test
  public void file_should_be_issuable() throws Exception {
    IssuableFactory factory = new IssuableFactory(moduleIssues, cache, projectTree);
    Component component = new ResourceComponent(new File("foo/bar.c").setEffectiveKey("foo/bar.c"));
    Issuable issuable = factory.loadPerspective(Issuable.class, component);

    assertThat(issuable).isNotNull();
    assertThat(issuable.component()).isSameAs(component);
    assertThat(issuable.issues()).isEmpty();
View Full Code Here

  }

  @Test
  public void project_should_be_issuable() throws Exception {
    IssuableFactory factory = new IssuableFactory(moduleIssues, cache, projectTree);
    Component component = new ResourceComponent(new Project("Foo").setEffectiveKey("foo"));
    Issuable issuable = factory.loadPerspective(Issuable.class, component);

    assertThat(issuable).isNotNull();
    assertThat(issuable.component()).isSameAs(component);
    assertThat(issuable.issues()).isEmpty();
View Full Code Here

TOP

Related Classes of org.sonar.api.component.Component

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.