private final DbClient dbClient;
private final ComponentFinder componentFinder;
private final UserSession userSession;
- private final QualityGatesWsSupport wsSupport;
- public ProjectStatusAction(DbClient dbClient, ComponentFinder componentFinder, UserSession userSession, QualityGatesWsSupport wsSupport) {
+ public ProjectStatusAction(DbClient dbClient, ComponentFinder componentFinder, UserSession userSession) {
this.dbClient = dbClient;
this.componentFinder = componentFinder;
this.userSession = userSession;
- this.wsSupport = wsSupport;
}
@Override
import org.sonar.server.exceptions.BadRequestException;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.exceptions.NotFoundException;
-import org.sonar.server.organization.TestDefaultOrganizationProvider;
import org.sonar.server.tester.UserSessionRule;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.Qualitygates.ProjectStatusResponse;
private DbClient dbClient = db.getDbClient();
private DbSession dbSession = db.getSession();
- private WsActionTester ws = new WsActionTester(new ProjectStatusAction(dbClient, TestComponentFinder.from(db), userSession,
- new QualityGatesWsSupport(db.getDbClient(), userSession, TestDefaultOrganizationProvider.from(db))));
+ private WsActionTester ws = new WsActionTester(new ProjectStatusAction(dbClient, TestComponentFinder.from(db), userSession));
@Test
public void test_definition() {
.setDebugLogs(true);
orchestrator.executeBuild(analysis);
assertThat(getMeasure(orchestrator, project.getKey(), "alert_status").getValue()).isEqualTo("OK");
- assertIgnoredConditions(organization,"qualitygate/small-changesets/v1-1000-lines", false);
+ assertIgnoredConditions("qualitygate/small-changesets/v1-1000-lines", false);
// small leak => ignore coverage warning or error
SonarScanner analysis2 = SonarScanner
.setDebugLogs(true);
orchestrator.executeBuild(analysis2);
assertThat(getMeasure(orchestrator, project.getKey(), "alert_status").getValue()).isEqualTo("OK");
- assertIgnoredConditions(organization, "qualitygate/small-changesets/v2-1019-lines", true);
+ assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", true);
// small leak => if coverage is OK anyways, we do not have to ignore anything
tester.wsClient().qualitygates().updateCondition(new UpdateConditionRequest()
.setDebugLogs(true);
orchestrator.executeBuild(analysis3);
assertThat(getMeasure(orchestrator, project.getKey(), "alert_status").getValue()).isEqualTo("OK");
- assertIgnoredConditions(organization, "qualitygate/small-changesets/v2-1019-lines", false);
+ assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", false);
// big leak => use usual behaviour
tester.wsClient().qualitygates().updateCondition(new UpdateConditionRequest()
.setDebugLogs(true);
orchestrator.executeBuild(analysis4);
assertThat(getMeasure(orchestrator, project.getKey(), "alert_status").getValue()).isEqualTo("ERROR");
- assertIgnoredConditions(organization, "qualitygate/small-changesets/v2-1020-lines", false);
+ assertIgnoredConditions("qualitygate/small-changesets/v2-1020-lines", false);
}
- private void assertIgnoredConditions(Organizations.Organization organization, String projectDir, boolean expected) throws IOException {
+ private void assertIgnoredConditions(String projectDir, boolean expected) throws IOException {
String analysisId = getAnalysisId(getTaskIdInLocalReport(projectDir(projectDir)));
boolean ignoredConditions = tester.wsClient().qualitygates()
- .projectStatus(new ProjectStatusRequest().setOrganization(organization.getKey()).setAnalysisId(analysisId))
+ .projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId))
.getProjectStatus()
.getIgnoredConditions();
assertThat(ignoredConditions).isEqualTo(expected);