Search in sources :

Example 11 with ComputationStep

use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.

the class ReportComputationStepsTest method instances_throws_ISE_if_container_does_not_have_second_step.

@Test
public void instances_throws_ISE_if_container_does_not_have_second_step() {
    ExtractReportStep reportExtractionStep = mock(ExtractReportStep.class);
    SpringComponentContainer componentContainer = new SpringComponentContainer() {

        {
            add(reportExtractionStep);
        }
    }.startComponents();
    TaskContainerImpl computeEngineContainer = new TaskContainerImpl(componentContainer, container -> {
    // do nothing
    });
    computeEngineContainer.startComponents();
    Iterable<ComputationStep> instances = new ReportComputationSteps(computeEngineContainer).instances();
    assertThatThrownBy(() -> newArrayList(instances)).isInstanceOf(IllegalStateException.class).hasMessageContaining("org.sonar.ce.task.projectanalysis.step.PersistScannerContextStep");
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) TaskContainerImpl(org.sonar.ce.task.container.TaskContainerImpl) ComputationStep(org.sonar.ce.task.step.ComputationStep) Test(org.junit.Test)

Example 12 with ComputationStep

use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.

the class ReportComputationStepsTest method instances_throws_ISE_if_container_does_not_have_any_step.

@Test
public void instances_throws_ISE_if_container_does_not_have_any_step() {
    TaskContainerImpl computeEngineContainer = new TaskContainerImpl(new SpringComponentContainer(), container -> {
    // do nothing
    });
    Iterable<ComputationStep> instances = new ReportComputationSteps(computeEngineContainer).instances();
    assertThatThrownBy(() -> newArrayList(instances)).isInstanceOf(IllegalStateException.class).hasMessageContaining(ExtractReportStep.class.getName());
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) TaskContainerImpl(org.sonar.ce.task.container.TaskContainerImpl) ComputationStep(org.sonar.ce.task.step.ComputationStep) Test(org.junit.Test)

Example 13 with ComputationStep

use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.

the class IssueSyncTaskProcessorTest method orderedStepClasses.

@Test
public void orderedStepClasses() {
    SyncComputationSteps syncComputationSteps = new SyncComputationSteps(null);
    List<Class<? extends ComputationStep>> steps = syncComputationSteps.orderedStepClasses();
    Assertions.assertThat(steps).containsExactly(IgnoreOrphanBranchStep.class, IndexIssuesStep.class);
}
Also used : ComputationStep(org.sonar.ce.task.step.ComputationStep) SyncComputationSteps(org.sonar.ce.task.projectanalysis.taskprocessor.IssueSyncTaskProcessor.SyncComputationSteps) Test(org.junit.Test)

Example 14 with ComputationStep

use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.

the class ProjectExportComputationStepsTest method instances_throws_ISE_if_container_does_not_have_second_step.

@Test
public void instances_throws_ISE_if_container_does_not_have_second_step() {
    ComplexityMeasuresStep reportExtractionStep = mock(ComplexityMeasuresStep.class);
    SpringComponentContainer componentContainer = new SpringComponentContainer() {

        {
            add(reportExtractionStep);
        }
    }.startComponents();
    TaskContainerImpl computeEngineContainer = new TaskContainerImpl(componentContainer, container -> {
    // do nothing
    });
    computeEngineContainer.startComponents();
    Iterable<ComputationStep> instances = new ProjectExportComputationSteps(computeEngineContainer).instances();
    assertThatThrownBy(() -> Lists.newArrayList(instances)).isInstanceOf(IllegalStateException.class).hasMessageContaining("class org.sonar.ce.task.projectexport.steps.LoadProjectStep");
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) TaskContainerImpl(org.sonar.ce.task.container.TaskContainerImpl) ComputationStep(org.sonar.ce.task.step.ComputationStep) ComplexityMeasuresStep(org.sonar.ce.task.projectanalysis.step.ComplexityMeasuresStep) Test(org.junit.Test)

Example 15 with ComputationStep

use of org.sonar.ce.task.step.ComputationStep in project sonarqube by SonarSource.

the class AuditPurgeTaskProcessorTest method orderedStepClasses.

@Test
public void orderedStepClasses() {
    AuditPurgeComputationSteps auditPurgeComputationSteps = new AuditPurgeComputationSteps(null);
    List<Class<? extends ComputationStep>> steps = auditPurgeComputationSteps.orderedStepClasses();
    Assertions.assertThat(steps).containsExactly(AuditPurgeStep.class);
}
Also used : ComputationStep(org.sonar.ce.task.step.ComputationStep) AuditPurgeComputationSteps(org.sonar.ce.task.projectanalysis.taskprocessor.AuditPurgeTaskProcessor.AuditPurgeComputationSteps) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)22 ComputationStep (org.sonar.ce.task.step.ComputationStep)22 TestComputationStepContext (org.sonar.ce.task.step.TestComputationStepContext)17 MeasureComputer (org.sonar.api.ce.measure.MeasureComputer)11 CeTask (org.sonar.ce.task.CeTask)3 TaskContainerImpl (org.sonar.ce.task.container.TaskContainerImpl)3 SpringComponentContainer (org.sonar.core.platform.SpringComponentContainer)3 MessageException (org.sonar.api.utils.MessageException)2 MeasureComputerWrapper (org.sonar.ce.task.projectanalysis.api.measurecomputer.MeasureComputerWrapper)2 ComplexityMeasuresStep (org.sonar.ce.task.projectanalysis.step.ComplexityMeasuresStep)1 AuditPurgeComputationSteps (org.sonar.ce.task.projectanalysis.taskprocessor.AuditPurgeTaskProcessor.AuditPurgeComputationSteps)1 SyncComputationSteps (org.sonar.ce.task.projectanalysis.taskprocessor.IssueSyncTaskProcessor.SyncComputationSteps)1 ComponentDto (org.sonar.db.component.ComponentDto)1