use of org.sonar.server.computation.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method set_branch.
@Test
public void set_branch() throws Exception {
reportReader.setMetadata(newBatchReportBuilder().setBranch(BRANCH).build());
CeTask ceTask = createCeTask(PROJECT_KEY + ":" + BRANCH, dbTester.getDefaultOrganization().getUuid());
ComputationStep underTest = createStep(ceTask);
underTest.execute();
assertThat(analysisMetadataHolder.getBranch()).isEqualTo(BRANCH);
}
use of org.sonar.server.computation.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_fails_with_MessageException_if_projectKey_is_null_in_CE_task.
@Test
public void execute_fails_with_MessageException_if_projectKey_is_null_in_CE_task() {
CeTask res = mock(CeTask.class);
when(res.getComponentUuid()).thenReturn("prj_uuid");
reportReader.setMetadata(ScannerReport.Metadata.newBuilder().build());
ComputationStep underTest = createStep(res);
expectedException.expect(MessageException.class);
expectedException.expectMessage("Compute Engine task component key is null. Project with UUID prj_uuid must have been deleted since report was uploaded. Can not proceed.");
underTest.execute();
}
use of org.sonar.server.computation.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_set_non_default_organization_from_ce_task.
@Test
public void execute_set_non_default_organization_from_ce_task() {
OrganizationDto nonDefaultOrganizationDto = dbTester.organizations().insert();
reportReader.setMetadata(newBatchReportBuilder().setOrganizationKey(nonDefaultOrganizationDto.getKey()).build());
ComputationStep underTest = createStep(createCeTask(PROJECT_KEY, nonDefaultOrganizationDto.getUuid()));
underTest.execute();
Organization organization = analysisMetadataHolder.getOrganization();
assertThat(organization.getUuid()).isEqualTo(nonDefaultOrganizationDto.getUuid());
assertThat(organization.getKey()).isEqualTo(nonDefaultOrganizationDto.getKey());
assertThat(organization.getName()).isEqualTo(nonDefaultOrganizationDto.getName());
}
use of org.sonar.server.computation.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method fail_with_ISE_when_input_metric_is_unknown.
@Test
public void fail_with_ISE_when_input_metric_is_unknown() throws Exception {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Metric 'unknown' cannot be used as an input metric as it's not a core metric and no plugin declare this metric");
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array("unknown"), array(NEW_METRIC_4)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute();
}
use of org.sonar.server.computation.task.step.ComputationStep in project sonarqube by SonarSource.
the class LoadMeasureComputersStepTest method fail_with_ISE_when_output_metric_is_a_core_metric.
@Test
public void fail_with_ISE_when_output_metric_is_a_core_metric() throws Exception {
thrown.expect(IllegalStateException.class);
thrown.expectMessage("Metric 'ncloc' cannot be used as an output metric as it's a core metric");
MeasureComputer[] computers = new MeasureComputer[] { newMeasureComputer(array(NEW_METRIC_4), array(NCLOC_KEY)) };
ComputationStep underTest = new LoadMeasureComputersStep(holder, array(new TestMetrics()), computers);
underTest.execute();
}
Aggregations