Search in sources :

Example 1 with ProjectConfigurationLoader

use of org.sonar.server.setting.ProjectConfigurationLoader in project sonarqube by SonarSource.

the class LiveMeasureComputerImplTest method run.

private List<QGChangeEvent> run(Collection<ComponentDto> components, IssueMetricFormula... formulas) {
    IssueMetricFormulaFactory formulaFactory = new TestIssueMetricFormulaFactory(asList(formulas));
    when(qGateComputer.loadQualityGate(any(DbSession.class), any(ProjectDto.class), any(BranchDto.class))).thenReturn(qualityGate);
    when(qGateComputer.getMetricsRelatedTo(qualityGate)).thenReturn(singleton(CoreMetrics.ALERT_STATUS_KEY));
    when(qGateComputer.refreshGateStatus(eq(project), same(qualityGate), any(MeasureMatrix.class), any(Configuration.class))).thenReturn(newQualityGate);
    MapSettings settings = new MapSettings(new PropertyDefinitions(System2.INSTANCE, CorePropertyDefinitions.all()));
    ProjectConfigurationLoader configurationLoader = new TestProjectConfigurationLoader(settings.asConfig());
    LiveMeasureComputerImpl underTest = new LiveMeasureComputerImpl(db.getDbClient(), formulaFactory, qGateComputer, configurationLoader, projectIndexer);
    return underTest.refresh(db.getSession(), components);
}
Also used : ProjectDto(org.sonar.db.project.ProjectDto) DbSession(org.sonar.db.DbSession) BranchDto(org.sonar.db.component.BranchDto) Configuration(org.sonar.api.config.Configuration) MapSettings(org.sonar.api.config.internal.MapSettings) CorePropertyDefinitions(org.sonar.core.config.CorePropertyDefinitions) PropertyDefinitions(org.sonar.api.config.PropertyDefinitions) TestProjectConfigurationLoader(org.sonar.server.setting.TestProjectConfigurationLoader) ProjectConfigurationLoader(org.sonar.server.setting.ProjectConfigurationLoader) TestProjectConfigurationLoader(org.sonar.server.setting.TestProjectConfigurationLoader)

Aggregations

Configuration (org.sonar.api.config.Configuration)1 PropertyDefinitions (org.sonar.api.config.PropertyDefinitions)1 MapSettings (org.sonar.api.config.internal.MapSettings)1 CorePropertyDefinitions (org.sonar.core.config.CorePropertyDefinitions)1 DbSession (org.sonar.db.DbSession)1 BranchDto (org.sonar.db.component.BranchDto)1 ProjectDto (org.sonar.db.project.ProjectDto)1 ProjectConfigurationLoader (org.sonar.server.setting.ProjectConfigurationLoader)1 TestProjectConfigurationLoader (org.sonar.server.setting.TestProjectConfigurationLoader)1