diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-07-28 11:10:44 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2016-07-29 10:54:01 +0200 |
commit | 88c26b4030c29372e57847eed22646b259d1a9c1 (patch) | |
tree | decb6f4921a0b912a75ec7aedf18388e12043d47 | |
parent | 8e8de73e9bb53bc2e87ab968244141d9c1e314c9 (diff) | |
download | sonarqube-88c26b4030c29372e57847eed22646b259d1a9c1.tar.gz sonarqube-88c26b4030c29372e57847eed22646b259d1a9c1.zip |
Rename Quality Gate WS classes
21 files changed, 86 insertions, 86 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index 14dc8817611..f64df96c3e8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -187,7 +187,7 @@ import org.sonar.server.qualitygate.ws.DeleteConditionAction; import org.sonar.server.qualitygate.ws.DeselectAction; import org.sonar.server.qualitygate.ws.DestroyAction; import org.sonar.server.qualitygate.ws.ProjectStatusAction; -import org.sonar.server.qualitygate.ws.QGatesWs; +import org.sonar.server.qualitygate.ws.QualityGatesWs; import org.sonar.server.qualitygate.ws.SelectAction; import org.sonar.server.qualitygate.ws.SetAsDefaultAction; import org.sonar.server.qualitygate.ws.UnsetDefaultAction; @@ -481,7 +481,7 @@ public class PlatformLevel4 extends PlatformLevel { UpdateConditionAction.class, org.sonar.server.qualitygate.ws.AppAction.class, ProjectStatusAction.class, - QGatesWs.class, + QualityGatesWs.class, // web services WebServiceEngine.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java index 81e5ec071ab..90aa2d27707 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/AppAction.java @@ -27,7 +27,7 @@ import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.text.JsonWriter; import org.sonar.server.qualitygate.QualityGates; -public class AppAction implements QGateWsAction { +public class AppAction implements QualityGatesWsAction { private final QualityGates qualityGates; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java index a18f1bb8b69..89e77f7998e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CopyAction.java @@ -26,7 +26,7 @@ import org.sonar.api.utils.text.JsonWriter; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; -public class CopyAction implements QGateWsAction { +public class CopyAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -42,12 +42,12 @@ public class CopyAction implements QGateWsAction { .setSince("4.3") .setHandler(this); - action.createParam(QGatesWs.PARAM_ID) + action.createParam(QualityGatesWs.PARAM_ID) .setDescription("The ID of the source quality gate") .setRequired(true) .setExampleValue("1"); - action.createParam(QGatesWs.PARAM_NAME) + action.createParam(QualityGatesWs.PARAM_NAME) .setDescription("The name of the quality gate to create") .setRequired(true) .setExampleValue("My Quality Gate"); @@ -55,9 +55,9 @@ public class CopyAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - QualityGateDto newQualityGate = qualityGates.copy(QGatesWs.parseId(request, QGatesWs.PARAM_ID), request.mandatoryParam(QGatesWs.PARAM_NAME)); + QualityGateDto newQualityGate = qualityGates.copy(QualityGatesWs.parseId(request, QualityGatesWs.PARAM_ID), request.mandatoryParam(QualityGatesWs.PARAM_NAME)); JsonWriter writer = response.newJsonWriter(); - QGatesWs.writeQualityGate(newQualityGate, writer).close(); + QualityGatesWs.writeQualityGate(newQualityGate, writer).close(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java index 0413a9d8bea..5ddc735e02b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateAction.java @@ -26,7 +26,7 @@ import org.sonar.api.utils.text.JsonWriter; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; -public class CreateAction implements QGateWsAction { +public class CreateAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -42,7 +42,7 @@ public class CreateAction implements QGateWsAction { .setPost(true) .setHandler(this); - action.createParam(QGatesWs.PARAM_NAME) + action.createParam(QualityGatesWs.PARAM_NAME) .setDescription("The name of the quality gate to create") .setRequired(true) .setExampleValue("My Quality Gate"); @@ -50,9 +50,9 @@ public class CreateAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - QualityGateDto newQualityGate = qualityGates.create(request.mandatoryParam(QGatesWs.PARAM_NAME)); + QualityGateDto newQualityGate = qualityGates.create(request.mandatoryParam(QualityGatesWs.PARAM_NAME)); JsonWriter writer = response.newJsonWriter(); - QGatesWs.writeQualityGate(newQualityGate, writer).close(); + QualityGatesWs.writeQualityGate(newQualityGate, writer).close(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java index fc77616ba0b..aa572402040 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/CreateConditionAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class CreateConditionAction implements QGateWsAction { +public class CreateConditionAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -41,24 +41,24 @@ public class CreateConditionAction implements QGateWsAction { .setHandler(this); createCondition - .createParam(QGatesWs.PARAM_GATE_ID) + .createParam(QualityGatesWs.PARAM_GATE_ID) .setDescription("ID of the quality gate") .setRequired(true) .setExampleValue("1"); - QGatesWs.addConditionParams(createCondition); + QualityGatesWs.addConditionParams(createCondition); } @Override public void handle(Request request, Response response) { - QGatesWs.writeQualityGateCondition( + QualityGatesWs.writeQualityGateCondition( qualityGates.createCondition( - QGatesWs.parseId(request, QGatesWs.PARAM_GATE_ID), - request.mandatoryParam(QGatesWs.PARAM_METRIC), - request.mandatoryParam(QGatesWs.PARAM_OPERATOR), - request.param(QGatesWs.PARAM_WARNING), - request.param(QGatesWs.PARAM_ERROR), - request.paramAsInt(QGatesWs.PARAM_PERIOD) + QualityGatesWs.parseId(request, QualityGatesWs.PARAM_GATE_ID), + request.mandatoryParam(QualityGatesWs.PARAM_METRIC), + request.mandatoryParam(QualityGatesWs.PARAM_OPERATOR), + request.param(QualityGatesWs.PARAM_WARNING), + request.param(QualityGatesWs.PARAM_ERROR), + request.paramAsInt(QualityGatesWs.PARAM_PERIOD) ), response.newJsonWriter() ).close(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java index ac01a7868b8..cd1f94f0f9a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeleteConditionAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class DeleteConditionAction implements QGateWsAction { +public class DeleteConditionAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -41,7 +41,7 @@ public class DeleteConditionAction implements QGateWsAction { .setHandler(this); createCondition - .createParam(QGatesWs.PARAM_ID) + .createParam(QualityGatesWs.PARAM_ID) .setRequired(true) .setDescription("Condition ID") .setExampleValue("2"); @@ -49,7 +49,7 @@ public class DeleteConditionAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - qualityGates.deleteCondition(QGatesWs.parseId(request, QGatesWs.PARAM_ID)); + qualityGates.deleteCondition(QualityGatesWs.parseId(request, QualityGatesWs.PARAM_ID)); response.noContent(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java index 059bbd35d6f..1f1bfee0a47 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class DeselectAction implements QGateWsAction { +public class DeselectAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -40,12 +40,12 @@ public class DeselectAction implements QGateWsAction { .setSince("4.3") .setHandler(this); - action.createParam(QGatesWs.PARAM_GATE_ID) + action.createParam(QualityGatesWs.PARAM_GATE_ID) .setDescription("Quality Gate ID") .setRequired(true) .setExampleValue("1"); - action.createParam(QGatesWs.PARAM_PROJECT_ID) + action.createParam(QualityGatesWs.PARAM_PROJECT_ID) .setDescription("Project ID") .setRequired(true) .setExampleValue("12"); @@ -53,7 +53,7 @@ public class DeselectAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - qualityGates.dissociateProject(QGatesWs.parseId(request, QGatesWs.PARAM_GATE_ID), QGatesWs.parseId(request, QGatesWs.PARAM_PROJECT_ID)); + qualityGates.dissociateProject(QualityGatesWs.parseId(request, QualityGatesWs.PARAM_GATE_ID), QualityGatesWs.parseId(request, QualityGatesWs.PARAM_PROJECT_ID)); response.noContent(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java index 27c234a36d3..654a693e7f0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DestroyAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class DestroyAction implements QGateWsAction { +public class DestroyAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -40,7 +40,7 @@ public class DestroyAction implements QGateWsAction { .setPost(true) .setHandler(this); - action.createParam(QGatesWs.PARAM_ID) + action.createParam(QualityGatesWs.PARAM_ID) .setDescription("ID of the quality gate to delete") .setRequired(true) .setExampleValue("1"); @@ -48,7 +48,7 @@ public class DestroyAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - qualityGates.delete(QGatesWs.parseId(request, QGatesWs.PARAM_ID)); + qualityGates.delete(QualityGatesWs.parseId(request, QualityGatesWs.PARAM_ID)); response.noContent(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ListAction.java index aa44510fdc5..dd2f0a49937 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ListAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ListAction.java @@ -27,7 +27,7 @@ import org.sonar.api.utils.text.JsonWriter; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; -public class ListAction implements QGateWsAction { +public class ListAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -48,7 +48,7 @@ public class ListAction implements QGateWsAction { public void handle(Request request, Response response) { JsonWriter writer = response.newJsonWriter().beginObject().name("qualitygates").beginArray(); for (QualityGateDto qgate : qualityGates.list()) { - QGatesWs.writeQualityGate(qgate, writer); + QualityGatesWs.writeQualityGate(qgate, writer); } writer.endArray(); QualityGateDto defaultQgate = qualityGates.getDefault(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java index ce4c6acd578..40b7cc507e6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ProjectStatusAction.java @@ -56,7 +56,7 @@ import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID; import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY; -public class ProjectStatusAction implements QGateWsAction { +public class ProjectStatusAction implements QualityGatesWsAction { private static final String QG_STATUSES_ONE_LINE = Joiner.on(", ") .join(Lists.transform(Arrays.asList(ProjectStatusWsResponse.Status.values()), new Function<ProjectStatusWsResponse.Status, String>() { @Nonnull diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QGatesWs.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWs.java index 6342b7c59dc..fc98402788a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QGatesWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWs.java @@ -26,7 +26,7 @@ import org.sonar.db.qualitygate.QualityGateConditionDto; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.exceptions.BadRequestException; -public class QGatesWs implements WebService { +public class QualityGatesWs implements WebService { static final String PARAM_PAGE_SIZE = "pageSize"; static final String PARAM_PAGE = "page"; @@ -41,9 +41,9 @@ public class QGatesWs implements WebService { static final String PARAM_PROJECT_ID = "projectId"; static final String PARAM_ID = "id"; - private final QGateWsAction[] actions; + private final QualityGatesWsAction[] actions; - public QGatesWs(QGateWsAction... actions) { + public QualityGatesWs(QualityGatesWsAction... actions) { this.actions = actions; } @@ -53,7 +53,7 @@ public class QGatesWs implements WebService { .setSince("4.3") .setDescription("Manage quality gates, including conditions and project association."); - for (QGateWsAction action : actions) { + for (QualityGatesWsAction action : actions) { action.define(controller); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QGateWsAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWsAction.java index e162a69d24d..a88a1d3a233 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QGateWsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/QualityGatesWsAction.java @@ -21,7 +21,7 @@ package org.sonar.server.qualitygate.ws; import org.sonar.server.ws.WsAction; -public interface QGateWsAction extends WsAction { +public interface QualityGatesWsAction extends WsAction { // Marker interface } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java index 51b807fd2ab..ca685d7fb61 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/RenameAction.java @@ -26,7 +26,7 @@ import org.sonar.api.utils.text.JsonWriter; import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.qualitygate.QualityGates; -public class RenameAction implements QGateWsAction { +public class RenameAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -42,12 +42,12 @@ public class RenameAction implements QGateWsAction { .setPost(true) .setHandler(this); - action.createParam(QGatesWs.PARAM_ID) + action.createParam(QualityGatesWs.PARAM_ID) .setDescription("ID of the quality gate to rename") .setRequired(true) .setExampleValue("1"); - action.createParam(QGatesWs.PARAM_NAME) + action.createParam(QualityGatesWs.PARAM_NAME) .setDescription("New name of the quality gate") .setRequired(true) .setExampleValue("My Quality Gate"); @@ -55,10 +55,10 @@ public class RenameAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - long idToRename = QGatesWs.parseId(request, QGatesWs.PARAM_ID); - QualityGateDto renamedQualityGate = qualityGates.rename(idToRename, request.mandatoryParam(QGatesWs.PARAM_NAME)); + long idToRename = QualityGatesWs.parseId(request, QualityGatesWs.PARAM_ID); + QualityGateDto renamedQualityGate = qualityGates.rename(idToRename, request.mandatoryParam(QualityGatesWs.PARAM_NAME)); JsonWriter writer = response.newJsonWriter(); - QGatesWs.writeQualityGate(renamedQualityGate, writer).close(); + QualityGatesWs.writeQualityGate(renamedQualityGate, writer).close(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java index a859ed87d08..8f57e3bf59d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SearchAction.java @@ -29,7 +29,7 @@ import org.sonar.db.qualitygate.ProjectQgateAssociation; import org.sonar.db.qualitygate.ProjectQgateAssociationQuery; import org.sonar.server.qualitygate.QgateProjectFinder; -public class SearchAction implements QGateWsAction { +public class SearchAction implements QualityGatesWsAction { private final QgateProjectFinder projectFinder; @@ -46,23 +46,23 @@ public class SearchAction implements QGateWsAction { .setResponseExample(Resources.getResource(this.getClass(), "example-search.json")) .setHandler(this); - action.createParam(QGatesWs.PARAM_GATE_ID) + action.createParam(QualityGatesWs.PARAM_GATE_ID) .setDescription("Quality Gate ID") .setRequired(true) .setExampleValue("1"); - action.createParam(QGatesWs.PARAM_QUERY) + action.createParam(QualityGatesWs.PARAM_QUERY) .setDescription("To search for projects containing this string. If this parameter is set, \"selected\" is set to \"all\".") .setExampleValue("abc"); action.addSelectionModeParam(); - action.createParam(QGatesWs.PARAM_PAGE) + action.createParam(QualityGatesWs.PARAM_PAGE) .setDescription("Page number") .setDefaultValue("1") .setExampleValue("2"); - action.createParam(QGatesWs.PARAM_PAGE_SIZE) + action.createParam(QualityGatesWs.PARAM_PAGE_SIZE) .setDescription("Page size") .setExampleValue("10"); } @@ -70,11 +70,11 @@ public class SearchAction implements QGateWsAction { @Override public void handle(Request request, Response response) { QgateProjectFinder.Association associations = projectFinder.find(ProjectQgateAssociationQuery.builder() - .gateId(request.mandatoryParam(QGatesWs.PARAM_GATE_ID)) - .membership(request.param(QGatesWs.PARAM_QUERY) == null ? request.param(Param.SELECTED) : ProjectQgateAssociationQuery.ANY) - .projectSearch(request.param(QGatesWs.PARAM_QUERY)) - .pageIndex(request.paramAsInt(QGatesWs.PARAM_PAGE)) - .pageSize(request.paramAsInt(QGatesWs.PARAM_PAGE_SIZE)) + .gateId(request.mandatoryParam(QualityGatesWs.PARAM_GATE_ID)) + .membership(request.param(QualityGatesWs.PARAM_QUERY) == null ? request.param(Param.SELECTED) : ProjectQgateAssociationQuery.ANY) + .projectSearch(request.param(QualityGatesWs.PARAM_QUERY)) + .pageIndex(request.paramAsInt(QualityGatesWs.PARAM_PAGE)) + .pageSize(request.paramAsInt(QualityGatesWs.PARAM_PAGE_SIZE)) .build()); JsonWriter writer = response.newJsonWriter(); writer.beginObject().prop("more", associations.hasMoreResults()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java index 16aea9680de..4afdc7ae8c5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class SelectAction implements QGateWsAction { +public class SelectAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -40,12 +40,12 @@ public class SelectAction implements QGateWsAction { .setSince("4.3") .setHandler(this); - action.createParam(QGatesWs.PARAM_GATE_ID) + action.createParam(QualityGatesWs.PARAM_GATE_ID) .setDescription("Quality Gate ID") .setRequired(true) .setExampleValue("1"); - action.createParam(QGatesWs.PARAM_PROJECT_ID) + action.createParam(QualityGatesWs.PARAM_PROJECT_ID) .setDescription("Project ID") .setRequired(true) .setExampleValue("12"); @@ -53,7 +53,7 @@ public class SelectAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - qualityGates.associateProject(QGatesWs.parseId(request, QGatesWs.PARAM_GATE_ID), QGatesWs.parseId(request, QGatesWs.PARAM_PROJECT_ID)); + qualityGates.associateProject(QualityGatesWs.parseId(request, QualityGatesWs.PARAM_GATE_ID), QualityGatesWs.parseId(request, QualityGatesWs.PARAM_PROJECT_ID)); response.noContent(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java index 276b7a1c2e9..38990131f9b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SetAsDefaultAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class SetAsDefaultAction implements QGateWsAction { +public class SetAsDefaultAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -40,7 +40,7 @@ public class SetAsDefaultAction implements QGateWsAction { .setPost(true) .setHandler(this); - action.createParam(QGatesWs.PARAM_ID) + action.createParam(QualityGatesWs.PARAM_ID) .setDescription("ID of the quality gate to set as default") .setRequired(true) .setExampleValue("1"); @@ -48,7 +48,7 @@ public class SetAsDefaultAction implements QGateWsAction { @Override public void handle(Request request, Response response) { - qualityGates.setDefault(QGatesWs.parseId(request, QGatesWs.PARAM_ID)); + qualityGates.setDefault(QualityGatesWs.parseId(request, QualityGatesWs.PARAM_ID)); response.noContent(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java index fa05d172b8f..cb447eb653c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/ShowAction.java @@ -31,7 +31,7 @@ import org.sonar.db.qualitygate.QualityGateDto; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.qualitygate.QualityGates; -public class ShowAction implements QGateWsAction { +public class ShowAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -47,32 +47,32 @@ public class ShowAction implements QGateWsAction { .setResponseExample(Resources.getResource(this.getClass(), "example-show.json")) .setHandler(this); - action.createParam(QGatesWs.PARAM_ID) + action.createParam(QualityGatesWs.PARAM_ID) .setDescription("ID of the quality gate. Either id or name must be set") .setExampleValue("1"); - action.createParam(QGatesWs.PARAM_NAME) + action.createParam(QualityGatesWs.PARAM_NAME) .setDescription("Name of the quality gate. Either id or name must be set") .setExampleValue("My Quality Gate"); } @Override public void handle(Request request, Response response) { - Long qGateId = request.paramAsLong(QGatesWs.PARAM_ID); - String qGateName = request.param(QGatesWs.PARAM_NAME); + Long qGateId = request.paramAsLong(QualityGatesWs.PARAM_ID); + String qGateName = request.param(QualityGatesWs.PARAM_NAME); checkOneOfIdOrNamePresent(qGateId, qGateName); QualityGateDto qGate = qGateId == null ? qualityGates.get(qGateName) : qualityGates.get(qGateId); qGateId = qGate.getId(); JsonWriter writer = response.newJsonWriter().beginObject() - .prop(QGatesWs.PARAM_ID, qGate.getId()) - .prop(QGatesWs.PARAM_NAME, qGate.getName()); + .prop(QualityGatesWs.PARAM_ID, qGate.getId()) + .prop(QualityGatesWs.PARAM_NAME, qGate.getName()); Collection<QualityGateConditionDto> conditions = qualityGates.listConditions(qGateId); if (!conditions.isEmpty()) { writer.name("conditions").beginArray(); for (QualityGateConditionDto condition : conditions) { - QGatesWs.writeQualityGateCondition(condition, writer); + QualityGatesWs.writeQualityGateCondition(condition, writer); } writer.endArray(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java index 0747a23d64b..29e905000ba 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UnsetDefaultAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class UnsetDefaultAction implements QGateWsAction { +public class UnsetDefaultAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -40,7 +40,7 @@ public class UnsetDefaultAction implements QGateWsAction { .setPost(true) .setHandler(this); - action.createParam(QGatesWs.PARAM_ID) + action.createParam(QualityGatesWs.PARAM_ID) .setDescription("ID of the quality gate to unset as default") .setRequired(true) .setExampleValue("1"); diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java index 16eb81dbc6d..111d68fc5ce 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/UpdateConditionAction.java @@ -24,7 +24,7 @@ import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.server.qualitygate.QualityGates; -public class UpdateConditionAction implements QGateWsAction { +public class UpdateConditionAction implements QualityGatesWsAction { private final QualityGates qualityGates; @@ -41,24 +41,24 @@ public class UpdateConditionAction implements QGateWsAction { .setHandler(this); createCondition - .createParam(QGatesWs.PARAM_ID) + .createParam(QualityGatesWs.PARAM_ID) .setDescription("Condition ID") .setRequired(true) .setExampleValue("10"); - QGatesWs.addConditionParams(createCondition); + QualityGatesWs.addConditionParams(createCondition); } @Override public void handle(Request request, Response response) { - QGatesWs.writeQualityGateCondition( + QualityGatesWs.writeQualityGateCondition( qualityGates.updateCondition( - QGatesWs.parseId(request, QGatesWs.PARAM_ID), - request.mandatoryParam(QGatesWs.PARAM_METRIC), - request.mandatoryParam(QGatesWs.PARAM_OPERATOR), - request.param(QGatesWs.PARAM_WARNING), - request.param(QGatesWs.PARAM_ERROR), - request.paramAsInt(QGatesWs.PARAM_PERIOD) + QualityGatesWs.parseId(request, QualityGatesWs.PARAM_ID), + request.mandatoryParam(QualityGatesWs.PARAM_METRIC), + request.mandatoryParam(QualityGatesWs.PARAM_OPERATOR), + request.param(QualityGatesWs.PARAM_WARNING), + request.param(QualityGatesWs.PARAM_ERROR), + request.paramAsInt(QualityGatesWs.PARAM_PERIOD) ), response.newJsonWriter() ).close(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java index cec59426d92..70b98ba5878 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/AppActionTest.java @@ -62,7 +62,7 @@ public class AppActionTest { @Before public void setUp() { - tester = new WsTester(new QGatesWs( + tester = new WsTester(new QualityGatesWs( new ListAction(qGates), new ShowAction(qGates), new SearchAction(mock(QgateProjectFinder.class)), new CreateAction(qGates), new CopyAction(qGates), new DestroyAction(qGates), new RenameAction(qGates), new SetAsDefaultAction(qGates), new UnsetDefaultAction(qGates), diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QGatesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QualityGatesWsTest.java index 39fb85de5e9..7ae85a1d2f5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QGatesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/QualityGatesWsTest.java @@ -49,7 +49,7 @@ import static org.mockito.Mockito.when; // TODO split testcases in action tests @RunWith(MockitoJUnitRunner.class) -public class QGatesWsTest { +public class QualityGatesWsTest { @Mock private QualityGates qGates; @@ -64,7 +64,7 @@ public class QGatesWsTest { @Before public void setUp() { - tester = new WsTester(new QGatesWs( + tester = new WsTester(new QualityGatesWs( new ListAction(qGates), new ShowAction(qGates), new SearchAction(projectFinder), new CreateAction(qGates), new CopyAction(qGates), new DestroyAction(qGates), new RenameAction(qGates), new SetAsDefaultAction(qGates), new UnsetDefaultAction(qGates), |