use of org.sonar.api.ce.measure.MeasureComputer in project sonarqube by SonarSource.
the class MeasureComputersVisitor method visitAny.
@Override
public void visitAny(org.sonar.server.computation.task.projectanalysis.component.Component component) {
MeasureComputerContextImpl context = new MeasureComputerContextImpl(component, settings, measureRepository, metricRepository, componentIssuesRepository);
for (MeasureComputerWrapper measureComputerWrapper : measureComputersHolder.getMeasureComputers()) {
context.setDefinition(measureComputerWrapper.getDefinition());
MeasureComputer measureComputer = measureComputerWrapper.getComputer();
LOGGER.trace("Measure computer '{}' is computing component {}", measureComputer, component);
measureComputer.compute(context);
}
}
use of org.sonar.api.ce.measure.MeasureComputer in project sonarqube by SonarSource.
the class MeasureComputersHolderRule method addMeasureComputer.
public void addMeasureComputer(MeasureComputer measureComputer) {
requireNonNull(measureComputer, "Measure computer cannot be null");
MeasureComputer.MeasureComputerDefinition definition = measureComputer.define(context);
this.measureComputers.add(new MeasureComputerWrapper(measureComputer, definition));
}
use of org.sonar.api.ce.measure.MeasureComputer in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method not_fail_if_input_metrics_are_same_as_output_metrics.
@Test
public void not_fail_if_input_metrics_are_same_as_output_metrics() throws Exception {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NEW_METRIC_1), array(NEW_METRIC_1)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute();
assertThat(holder.getMeasureComputers()).hasSize(1);
}
use of org.sonar.api.ce.measure.MeasureComputer in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method support_core_metrics_as_input_metrics.
@Test
public void support_core_metrics_as_input_metrics() throws Exception {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NCLOC_KEY), array(NEW_METRIC_1)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute();
assertThat(holder.getMeasureComputers()).hasSize(1);
}
use of org.sonar.api.ce.measure.MeasureComputer in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method support_plugin_metrics_as_input_metrics.
@Test
public void support_plugin_metrics_as_input_metrics() throws Exception {
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NEW_METRIC_1), array(NEW_METRIC_2)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute();
assertThat(holder.getMeasureComputers()).hasSize(1);
}
Aggregations