]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10134 Remove 'organization' parameter from project_status ws
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 20 Dec 2017 12:55:19 +0000 (13:55 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 20 Dec 2017 13:56:05 +0000 (14:56 +0100)
server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java
server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java
tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java

index d8fa0c73f9c53cf34e27643cd5090c9a8ec1834f..9acef31ec7db47e799351560fbfe94979e022e96 100644 (file)
@@ -63,13 +63,11 @@ public class ProjectStatusAction implements QualityGatesWsAction {
   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
index 8d5e287abf4bc43f8dcc933afc2c1a526b3b743d..1f942249ba262b96c1fcd85ba476422263d061db 100644 (file)
@@ -40,7 +40,6 @@ import org.sonar.server.component.TestComponentFinder;
 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;
@@ -72,8 +71,7 @@ public class ProjectStatusActionTest {
   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() {
index 717e26d888f6eb142da31344e58070e3dadd260e..98cb9a9b16258710d43841914b3818b947d4f74f 100644 (file)
@@ -87,7 +87,7 @@ public class OrganizationQualityGateForSmallChangesetsTest {
       .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
@@ -102,7 +102,7 @@ public class OrganizationQualityGateForSmallChangesetsTest {
       .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()
@@ -125,7 +125,7 @@ public class OrganizationQualityGateForSmallChangesetsTest {
       .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()
@@ -148,13 +148,13 @@ public class OrganizationQualityGateForSmallChangesetsTest {
       .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);