Package org.sonar.api.batch

Examples of org.sonar.api.batch.Decorator


  }

  @Test
  public void decoratorsShouldBeExecutedBeforeFormulas() {
    Project project = new Project("key");
    Decorator metric1Decorator = new Metric1Decorator();
    BatchExtensionDictionnary batchExtDictionnary = newBatchDictionnary(withFormula1, metric1Decorator);

    Collection<Decorator> decorators = new DecoratorsSelector(batchExtDictionnary).select(project);

    Decorator firstDecorator = Iterables.get(decorators, 0);
    Decorator secondDecorator = Iterables.get(decorators, 1);

    assertThat(firstDecorator).isInstanceOf(Metric1Decorator.class);
    assertThat(secondDecorator).isInstanceOf(FormulaDecorator.class);

    FormulaDecorator formulaDecorator = (FormulaDecorator) secondDecorator;
View Full Code Here


    // End of moduleA
    profiler.onProjectAnalysis(projectEvent(module, false));
  }

  private void decoratorPhase(PhasesSumUpTimeProfiler profiler) throws InterruptedException {
    Decorator decorator1 = new FakeDecorator1();
    Decorator decorator2 = new FakeDecorator2();
    // Start of decorator phase
    profiler.onDecoratorsPhase(decoratorsEvent(true));
    // Start of decorator 1
    profiler.onDecoratorExecution(decoratorEvent(decorator1, true));
    clock.sleep(10);
View Full Code Here

    assertThat(profiler.getMessage().indexOf("Decorator1")).isLessThan(profiler.getMessage().indexOf("Decorator2"));
  }

  @Test
  public void exceptionShouldIncludeResource() {
    Decorator decorator = mock(Decorator.class);
    doThrow(new SonarException()).when(decorator).decorate(any(Resource.class), any(DecoratorContext.class));

    DecoratorsExecutor executor = new DecoratorsExecutor(mock(BatchExtensionDictionnary.class), new Project("key"), mock(SonarIndex.class),
      mock(EventBus.class), mock(MeasurementFilters.class), mock(MeasureCache.class), mock(MetricFinder.class), mock(DuplicationCache.class));
    try {
View Full Code Here

TOP

Related Classes of org.sonar.api.batch.Decorator

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.