Package org.sonar.batch.index

Examples of org.sonar.batch.index.ComponentDataCache


    when(metricFinder.findByKey(CoreMetrics.NCLOC_KEY)).thenReturn(CoreMetrics.NCLOC);
    when(metricFinder.findByKey(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION_KEY)).thenReturn(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION);
    sensorContext = mock(SensorContext.class);
    settings = new Settings();
    resourcePerspectives = mock(ResourcePerspectives.class);
    ComponentDataCache componentDataCache = mock(ComponentDataCache.class);
    BlockCache blockCache = mock(BlockCache.class);
    project = new Project("myProject");
    sonarIndex = mock(SonarIndex.class);
    adaptor = new SensorContextAdapter(sensorContext, metricFinder, project,
      resourcePerspectives, settings, fs, activeRules, componentDataCache, blockCache, mock(DuplicationCache.class), sonarIndex);
View Full Code Here


        duplications.put(effectiveKey, entry.value());
      }
    }

    private void storeComponentData(ProjectScanContainer container) {
      ComponentDataCache componentDataCache = container.getComponentByType(ComponentDataCache.class);
      for (InputFile file : inputFiles.values()) {
        SyntaxHighlightingData highlighting = componentDataCache.getData(((DefaultInputFile) file).key(), SnapshotDataTypes.SYNTAX_HIGHLIGHTING);
        if (highlighting != null) {
          highlightingPerFile.put(file, highlighting);
        }
        SymbolData symbolTable = componentDataCache.getData(((DefaultInputFile) file).key(), SnapshotDataTypes.SYMBOL_HIGHLIGHTING);
        if (symbolTable != null) {
          symbolTablePerFile.put(file, symbolTable);
        }
      }
    }
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()
      .highlight(0, 10, "k")
      .highlight(20, 30, "cppd")
View Full Code Here

  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();
    Symbol firstSymbol = symbolTableBuilder.newSymbol(4, 8);
    symbolTableBuilder.newReference(firstSymbol, 12);
View Full Code Here

  @Rule
  public ExpectedException throwable = ExpectedException.none();

  @Test
  public void should_order_symbol_and_references() throws Exception {
    ComponentDataCache componentDataCache = mock(ComponentDataCache.class);
    SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTableBuilder("foo", componentDataCache);
    Symbol firstSymbol = symbolTableBuilder.newSymbol(10, 20);
    symbolTableBuilder.newReference(firstSymbol, 32);
    Symbol secondSymbol = symbolTableBuilder.newSymbol(84, 92);
    symbolTableBuilder.newReference(secondSymbol, 124);
View Full Code Here

  }

  @Test
  public void should_serialize_unused_symbol() throws Exception {

    ComponentDataCache componentDataCache = mock(ComponentDataCache.class);
    SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTableBuilder("foo", componentDataCache);
    symbolTableBuilder.newSymbol(10, 20);
    symbolTableBuilder.done();

    ArgumentCaptor<SymbolData> argCaptor = ArgumentCaptor.forClass(SymbolData.class);
View Full Code Here

  @Test
  public void should_reject_reference_conflicting_with_declaration() throws Exception {
    throwable.expect(UnsupportedOperationException.class);

    ComponentDataCache componentDataCache = mock(ComponentDataCache.class);
    SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTableBuilder("foo", componentDataCache);
    Symbol symbol = symbolTableBuilder.newSymbol(10, 20);
    symbolTableBuilder.newReference(symbol, 15);
  }
View Full Code Here

  @Test
  public void should_reject_reference_from_another_file() throws Exception {
    throwable.expect(UnsupportedOperationException.class);

    ComponentDataCache componentDataCache = mock(ComponentDataCache.class);
    SymbolTableBuilder symbolTableBuilder = new DefaultSymbolTableBuilder("foo", componentDataCache);
    Symbol symbol = symbolTableBuilder.newSymbol(10, 20);

    SymbolTableBuilder symbolTableBuilder2 = new DefaultSymbolTableBuilder("foo2", componentDataCache);
    Symbol symbol2 = symbolTableBuilder2.newSymbol(30, 40);
View Full Code Here

public class DefaultHighlightingBuilderTest {

  @Test
  public void should_apply_registered_highlighting() throws Exception {

    ComponentDataCache cache = mock(ComponentDataCache.class);

    DefaultHighlightingBuilder highlightable = new DefaultHighlightingBuilder("myComponent", cache);
    highlightable
      .highlight(0, 10, TypeOfText.KEYWORD)
      .highlight(20, 30, TypeOfText.CPP_DOC)
View Full Code Here

TOP

Related Classes of org.sonar.batch.index.ComponentDataCache

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.