aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-06-03 10:15:14 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-06-03 10:18:46 +0200
commitfc83fa0377c95e54e21e961032a31a73d68e8df0 (patch)
treeafe97edb3a78130c8297800f21f8b9f7ea45a47d /server
parentccf24581e2de42c829513b6270eac15bb0c0e9e7 (diff)
downloadsonarqube-fc83fa0377c95e54e21e961032a31a73d68e8df0.tar.gz
sonarqube-fc83fa0377c95e54e21e961032a31a73d68e8df0.zip
SONAR-6528 ws api/projects/bulk_delete update description and error message with ids instead of uuids
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java10
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkDeleteActionTest.java12
2 files changed, 11 insertions, 11 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java
index 52293fdc6c8..8c36a26c2c7 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkDeleteAction.java
@@ -38,7 +38,7 @@ import java.util.List;
public class BulkDeleteAction implements ProjectsWsAction {
private static final String ACTION = "bulk_delete";
- public static final String PARAM_UUIDS = "ids";
+ public static final String PARAM_IDS = "ids";
public static final String PARAM_KEYS = "keys";
private final ComponentCleanerService componentCleanerService;
@@ -61,8 +61,8 @@ public class BulkDeleteAction implements ProjectsWsAction {
.setHandler(this);
action
- .createParam(PARAM_UUIDS)
- .setDescription("List of project UUIDs to delete")
+ .createParam(PARAM_IDS)
+ .setDescription("List of project ids to delete")
.setExampleValue("ce4c03d6-430f-40a9-b777-ad877c00aa4d,c526ef20-131b-4486-9357-063fa64b5079");
action
@@ -74,7 +74,7 @@ public class BulkDeleteAction implements ProjectsWsAction {
@Override
public void handle(Request request, Response response) throws Exception {
userSession.checkGlobalPermission(UserRole.ADMIN);
- List<String> uuids = request.paramAsStrings(PARAM_UUIDS);
+ List<String> uuids = request.paramAsStrings(PARAM_IDS);
List<String> keys = request.paramAsStrings(PARAM_KEYS);
DbSession dbSession = dbClient.openSession(false);
@@ -96,6 +96,6 @@ public class BulkDeleteAction implements ProjectsWsAction {
return dbClient.componentDao().selectByKeys(dbSession, keys);
}
- throw new IllegalArgumentException("UUIDs or keys must be provided");
+ throw new IllegalArgumentException("ids or keys must be provided");
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkDeleteActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkDeleteActionTest.java
index c447745f4e0..40385f5e2e6 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkDeleteActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkDeleteActionTest.java
@@ -76,7 +76,7 @@ import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.sonar.server.project.ws.BulkDeleteAction.PARAM_KEYS;
-import static org.sonar.server.project.ws.BulkDeleteAction.PARAM_UUIDS;
+import static org.sonar.server.project.ws.BulkDeleteAction.PARAM_IDS;
@Category(DbTests.class)
public class BulkDeleteActionTest {
@@ -127,7 +127,7 @@ public class BulkDeleteActionTest {
long snapshotId4 = insertNewProjectInDbAndReturnSnapshotId(4);
ws.newPostRequest("api/projects", ACTION)
- .setParam(PARAM_UUIDS, "project-uuid-1, project-uuid-3, project-uuid-4").execute();
+ .setParam(PARAM_IDS, "project-uuid-1, project-uuid-3, project-uuid-4").execute();
dbSession.commit();
assertThat(dbClient.componentDao().selectByUuids(dbSession, Arrays.asList("project-uuid-1", "project-uuid-3", "project-uuid-4"))).isEmpty();
@@ -180,7 +180,7 @@ public class BulkDeleteActionTest {
public void web_service_returns_204() throws Exception {
insertNewProjectInDbAndReturnSnapshotId(1);
- WsTester.Result result = ws.newPostRequest("api/projects", ACTION).setParam(PARAM_UUIDS, "project-uuid-1").execute();
+ WsTester.Result result = ws.newPostRequest("api/projects", ACTION).setParam(PARAM_IDS, "project-uuid-1").execute();
result.assertNoContent();
}
@@ -190,7 +190,7 @@ public class BulkDeleteActionTest {
userSessionRule.setGlobalPermissions(UserRole.CODEVIEWER, UserRole.ISSUE_ADMIN, UserRole.USER);
expectedException.expect(ForbiddenException.class);
- ws.newPostRequest("api/projects", ACTION).setParam(PARAM_UUIDS, "whatever-the-uuid").execute();
+ ws.newPostRequest("api/projects", ACTION).setParam(PARAM_IDS, "whatever-the-uuid").execute();
}
@Test
@@ -199,7 +199,7 @@ public class BulkDeleteActionTest {
dbClient.componentDao().insert(dbSession, ComponentTesting.newFileDto(ComponentTesting.newProjectDto(), "file-uuid"));
dbSession.commit();
- ws.newPostRequest("api/projects", ACTION).setParam(PARAM_UUIDS, "file-uuid").execute();
+ ws.newPostRequest("api/projects", ACTION).setParam(PARAM_IDS, "file-uuid").execute();
}
@Test
@@ -209,7 +209,7 @@ public class BulkDeleteActionTest {
dbSession.commit();
when(resourceType.getBooleanProperty(anyString())).thenReturn(false);
- ws.newPostRequest("api/projects", ACTION).setParam(PARAM_UUIDS, "project-uuid").execute();
+ ws.newPostRequest("api/projects", ACTION).setParam(PARAM_IDS, "project-uuid").execute();
}
private long insertNewProjectInDbAndReturnSnapshotId(int id) {