Search in sources :

Example 1 with DefaultBranchImpl

use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.

the class AnalysisMetadataHolderImplTest method set_branch.

@Test
public void set_branch() {
    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(editionProvider);
    underTest.setBranch(new DefaultBranchImpl());
    assertThat(underTest.getBranch().getName()).isEqualTo("master");
}
Also used : DefaultBranchImpl(org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl) Test(org.junit.Test)

Example 2 with DefaultBranchImpl

use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.

the class AnalysisMetadataHolderImplTest method setBranch_throws_ISE_when_called_twice.

@Test
public void setBranch_throws_ISE_when_called_twice() {
    AnalysisMetadataHolderImpl underTest = new AnalysisMetadataHolderImpl(editionProvider);
    underTest.setBranch(new DefaultBranchImpl());
    assertThatThrownBy(() -> underTest.setBranch(new DefaultBranchImpl())).isInstanceOf(IllegalStateException.class).hasMessage("Branch has already been set");
}
Also used : DefaultBranchImpl(org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl) Test(org.junit.Test)

Example 3 with DefaultBranchImpl

use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.

the class ProjectConfigurationFactoryTest method return_global_settings.

@Test
public void return_global_settings() {
    settings.setProperty("key", "value");
    Configuration config = underTest.newProjectConfiguration(PROJECT_KEY, new DefaultBranchImpl());
    assertThat(config.get("key")).hasValue("value");
}
Also used : Configuration(org.sonar.api.config.Configuration) DefaultBranchImpl(org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl) Test(org.junit.Test)

Example 4 with DefaultBranchImpl

use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.

the class ProjectConfigurationFactoryTest method return_project_settings.

@Test
public void return_project_settings() {
    ComponentDto project = db.components().insertPrivateProject();
    db.properties().insertProperties(null, project.getKey(), project.name(), project.qualifier(), newComponentPropertyDto(project).setKey("1").setValue("val1"), newComponentPropertyDto(project).setKey("2").setValue("val2"), newComponentPropertyDto(project).setKey("3").setValue("val3"));
    Configuration config = underTest.newProjectConfiguration(project.getDbKey(), new DefaultBranchImpl());
    assertThat(config.get("1")).hasValue("val1");
    assertThat(config.get("2")).hasValue("val2");
    assertThat(config.get("3")).hasValue("val3");
}
Also used : Configuration(org.sonar.api.config.Configuration) ComponentDto(org.sonar.db.component.ComponentDto) DefaultBranchImpl(org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl) Test(org.junit.Test)

Example 5 with DefaultBranchImpl

use of org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl in project sonarqube by SonarSource.

the class ReportPersistComponentsStepTest method prepareProject.

private ComponentDto prepareProject(Consumer<ComponentDto> populators) {
    ComponentDto dto = db.components().insertPrivateProject(populators);
    analysisMetadataHolder.setProject(Project.from(dto));
    analysisMetadataHolder.setBranch(new DefaultBranchImpl());
    return dto;
}
Also used : ComponentDto(org.sonar.db.component.ComponentDto) DefaultBranchImpl(org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl)

Aggregations

DefaultBranchImpl (org.sonar.ce.task.projectanalysis.component.DefaultBranchImpl)9 Test (org.junit.Test)6 Configuration (org.sonar.api.config.Configuration)3 ComponentDto (org.sonar.db.component.ComponentDto)3 Before (org.junit.Before)1 Notification (org.sonar.api.notifications.Notification)1 Branch (org.sonar.ce.task.projectanalysis.analysis.Branch)1 BranchPersister (org.sonar.ce.task.projectanalysis.component.BranchPersister)1 ProjectPersister (org.sonar.ce.task.projectanalysis.component.ProjectPersister)1 QualityGateStatus (org.sonar.ce.task.projectanalysis.measure.QualityGateStatus)1 TestComputationStepContext (org.sonar.ce.task.step.TestComputationStepContext)1 QGChangeNotification (org.sonar.server.qualitygate.notification.QGChangeNotification)1