use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.
the class ProjectConfigurationFactoryTest method project_settings_override_global_settings.
@Test
public void project_settings_override_global_settings() {
settings.setProperty("key", "value");
ComponentDto project = db.components().insertPrivateProject();
db.properties().insertProperties(null, project.getKey(), project.name(), project.qualifier(), newComponentPropertyDto(project).setKey("key").setValue("value2"));
Configuration projectConfig = underTest.newProjectConfiguration(project.getDbKey(), new DefaultBranchImpl());
assertThat(projectConfig.get("key")).hasValue("value2");
}
use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.
the class BuildComponentTreeStepTest method setAnalysisMetadataHolder.
private void setAnalysisMetadataHolder(boolean isPr) {
Branch branch = isPr ? new PrBranch() : new DefaultBranchImpl();
analysisMetadataHolder.setRootComponentRef(ROOT_REF).setAnalysisDate(ANALYSIS_DATE).setBranch(branch).setProject(Project.from(newPrivateProjectDto().setDbKey(REPORT_PROJECT_KEY).setName(REPORT_PROJECT_KEY)));
}
use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.
the class QualityGateEventsStepTest method verify_branch_name_is_not_set_in_notification_when_main.
@Test
public void verify_branch_name_is_not_set_in_notification_when_main() {
analysisMetadataHolder.setBranch(new DefaultBranchImpl());
when(measureRepository.getRawMeasure(PROJECT_COMPONENT, alertStatusMetric)).thenReturn(of(Measure.newMeasureBuilder().setQualityGateStatus(OK_QUALITY_GATE_STATUS).createNoValue()));
when(measureRepository.getBaseMeasure(PROJECT_COMPONENT, alertStatusMetric)).thenReturn(of(Measure.newMeasureBuilder().setQualityGateStatus(new QualityGateStatus(ERROR)).createNoValue()));
underTest.execute(new TestComputationStepContext());
verify(notificationService).deliver(notificationArgumentCaptor.capture());
Notification notification = notificationArgumentCaptor.getValue();
assertThat(notification.getType()).isEqualTo("alerts");
assertThat(notification.getFieldValue("projectKey")).isEqualTo(PROJECT_COMPONENT.getKey());
assertThat(notification.getFieldValue("projectName")).isEqualTo(PROJECT_COMPONENT.getName());
assertThat(notification.getFieldValue("projectVersion")).isEqualTo(PROJECT_COMPONENT.getProjectAttributes().getProjectVersion());
assertThat(notification.getFieldValue("branch")).isNull();
reset(measureRepository, eventRepository, notificationService);
}
use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.
the class ViewsPersistComponentsStepTest method setup.
@Before
public void setup() throws Exception {
now = DATE_FORMAT.parse("2015-06-02");
when(system2.now()).thenReturn(now.getTime());
analysisMetadataHolder.setBranch(new DefaultBranchImpl());
BranchPersister branchPersister = mock(BranchPersister.class);
ProjectPersister projectPersister = mock(ProjectPersister.class);
underTest = new PersistComponentsStep(dbClient, treeRootHolder, system2, disabledComponentsHolder, analysisMetadataHolder, branchPersister, projectPersister);
}
Aggregations