use of org.sonar.server.computation.task.projectanalysis.analysis.Organization in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStep method execute.
@Override
public void execute() {
ScannerReport.Metadata reportMetadata = reportReader.readMetadata();
mutableAnalysisMetadataHolder.setAnalysisDate(reportMetadata.getAnalysisDate());
checkProjectKeyConsistency(reportMetadata);
Organization organization = toOrganization(ceTask.getOrganizationUuid());
checkOrganizationKeyConsistency(reportMetadata, organization);
mutableAnalysisMetadataHolder.setRootComponentRef(reportMetadata.getRootComponentRef());
mutableAnalysisMetadataHolder.setBranch(isNotEmpty(reportMetadata.getBranch()) ? reportMetadata.getBranch() : null);
mutableAnalysisMetadataHolder.setCrossProjectDuplicationEnabled(reportMetadata.getCrossProjectDuplicationActivated());
mutableAnalysisMetadataHolder.setQProfilesByLanguage(transformValues(reportMetadata.getQprofilesPerLanguage(), TO_COMPUTE_QPROFILE));
mutableAnalysisMetadataHolder.setOrganization(organization);
}
use of org.sonar.server.computation.task.projectanalysis.analysis.Organization in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_set_organization_from_ce_task_when_organizationKey_is_set_in_report.
@Test
public void execute_set_organization_from_ce_task_when_organizationKey_is_set_in_report() {
reportReader.setMetadata(newBatchReportBuilder().setOrganizationKey(dbTester.getDefaultOrganization().getKey()).build());
underTest.execute();
Organization organization = analysisMetadataHolder.getOrganization();
OrganizationDto defaultOrganization = dbTester.getDefaultOrganization();
assertThat(organization.getUuid()).isEqualTo(defaultOrganization.getUuid());
assertThat(organization.getKey()).isEqualTo(defaultOrganization.getKey());
assertThat(organization.getName()).isEqualTo(defaultOrganization.getName());
}
use of org.sonar.server.computation.task.projectanalysis.analysis.Organization 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.projectanalysis.analysis.Organization in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_set_organization_from_ce_task_when_organizationKey_is_not_set_in_report.
@Test
public void execute_set_organization_from_ce_task_when_organizationKey_is_not_set_in_report() {
reportReader.setMetadata(newBatchReportBuilder().build());
underTest.execute();
Organization organization = analysisMetadataHolder.getOrganization();
OrganizationDto defaultOrganization = dbTester.getDefaultOrganization();
assertThat(organization.getUuid()).isEqualTo(defaultOrganization.getUuid());
assertThat(organization.getKey()).isEqualTo(defaultOrganization.getKey());
assertThat(organization.getName()).isEqualTo(defaultOrganization.getName());
}
Aggregations