use of org.sonar.ce.task.projectanalysis.analysis.Branch in project sonarqube by SonarSource.
the class BranchPersisterImpl method persist.
public void persist(DbSession dbSession) {
Branch branch = analysisMetadataHolder.getBranch();
String branchUuid = treeRootHolder.getRoot().getUuid();
ComponentDto branchComponentDto = dbClient.componentDao().selectByUuid(dbSession, branchUuid).orElseThrow(() -> new IllegalStateException("Component has been deleted by end-user during analysis"));
// insert or update in table project_branches
dbClient.branchDao().upsert(dbSession, toBranchDto(dbSession, branchComponentDto, branch, checkIfExcludedFromPurge()));
}
use of org.sonar.ce.task.projectanalysis.analysis.Branch in project sonarqube by SonarSource.
the class PostProjectAnalysisTasksExecutorTest method setUp.
@Before
public void setUp() {
qualityGateHolder.setQualityGate(new QualityGate(QUALITY_GATE_UUID, QUALITY_GATE_NAME, of(CONDITION_1, CONDITION_2)));
qualityGateStatusHolder.setStatus(QualityGateStatus.OK, ImmutableMap.of(CONDITION_1, ConditionStatus.create(ConditionStatus.EvaluationStatus.OK, "value"), CONDITION_2, ConditionStatus.NO_VALUE_STATUS));
Branch branch = mock(Branch.class);
when(branch.getType()).thenReturn(BranchType.BRANCH);
analysisMetadataHolder.setBranch(branch);
reportReader.setMetadata(ScannerReport.Metadata.newBuilder().build());
}
use of org.sonar.ce.task.projectanalysis.analysis.Branch in project sonarqube by SonarSource.
the class BranchPersisterImplTest method createPullRequest.
private static Branch createPullRequest(String key, String mergeBranchUuid) {
Branch branch = createBranch(PULL_REQUEST, false, key, mergeBranchUuid);
when(branch.getPullRequestKey()).thenReturn(key);
return branch;
}
use of org.sonar.ce.task.projectanalysis.analysis.Branch in project sonarqube by SonarSource.
the class ComponentTreeBuilderTest method newUnderTest.
private ComponentTreeBuilder newUnderTest(ProjectAttributes projectAttributes, boolean mainBranch) {
Branch branch = mock(Branch.class);
when(branch.isMain()).thenReturn(mainBranch);
return new ComponentTreeBuilder(KEY_GENERATOR, PUBLIC_KEY_GENERATOR, UUID_SUPPLIER, scannerComponentProvider, projectInDb, branch, projectAttributes);
}
use of org.sonar.ce.task.projectanalysis.analysis.Branch in project sonarqube by SonarSource.
the class ConfigurationRepositoryTest method branch_settings.
@Test
public void branch_settings() {
ComponentDto project = db.components().insertPublicProject();
ComponentDto branchDto = db.components().insertProjectBranch(project);
Branch branch = mock(Branch.class);
when(branch.getName()).thenReturn(branchDto.getBranch());
analysisMetadataHolder.setProject(Project.from(project)).setBranch(branch);
globalSettings.setProperty("global", "global value");
insertProjectProperty(project, "project", "project value");
insertProjectProperty(branchDto, "branch", "branch value");
Configuration config = underTest.getConfiguration();
assertThat(config.get("global")).hasValue("global value");
assertThat(config.get("project")).hasValue("project value");
assertThat(config.get("branch")).hasValue("branch value");
}
Aggregations