From da6b8dc9f8919b2b80e48dd1c2fa9bd5d5340710 Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Thu, 16 Feb 2017 17:10:48 +0100 Subject: [PATCH] SONAR-8773 Move WS update_key and bulk_update_key to api/projects --- .../src/test/java/it/Category4Suite.java | 4 +- .../java/it/component/ComponentsWsTest.java | 37 ------------- ...ectSearchTest.java => ProjectsWsTest.java} | 53 ++++++++++++++++++- .../component/ws/ComponentsWsModule.java | 2 - .../ws/BulkUpdateKeyAction.java | 46 +++++++++------- .../server/project/ws/ProjectsWsModule.java | 2 + .../ws/UpdateKeyAction.java | 31 +++++++---- .../ws/bulk_update_key-example.json | 0 .../component/ws/ComponentsWsModuleTest.java | 2 +- .../ws/BulkUpdateKeyActionTest.java | 24 ++++----- .../project/ws/ProjectsWsModuleTest.java | 2 +- .../ws/UpdateKeyActionTest.java | 11 ++-- .../client/component/ComponentsService.java | 28 ---------- .../component/ComponentsWsParameters.java | 8 --- .../BulkUpdateKeyWsRequest.java} | 11 ++-- .../ws/client/project/ProjectsService.java | 34 ++++++++++-- .../client/project/ProjectsWsParameters.java | 7 +++ .../UpdateKeyWsRequest.java} | 11 ++-- .../src/main/protobuf/ws-components.proto | 11 ---- sonar-ws/src/main/protobuf/ws-projects.proto | 10 ++++ .../UpdateKeyWsRequestTest.java} | 7 +-- 21 files changed, 188 insertions(+), 153 deletions(-) rename it/it-tests/src/test/java/it/component/{ProjectSearchTest.java => ProjectsWsTest.java} (54%) rename server/sonar-server/src/main/java/org/sonar/server/{component => project}/ws/BulkUpdateKeyAction.java (81%) rename server/sonar-server/src/main/java/org/sonar/server/{component => project}/ws/UpdateKeyAction.java (79%) rename server/sonar-server/src/main/resources/org/sonar/server/{component => project}/ws/bulk_update_key-example.json (100%) rename server/sonar-server/src/test/java/org/sonar/server/{component => project}/ws/BulkUpdateKeyActionTest.java (91%) rename server/sonar-server/src/test/java/org/sonar/server/{component => project}/ws/UpdateKeyActionTest.java (91%) rename sonar-ws/src/main/java/org/sonarqube/ws/client/{component/BulkUpdateWsRequest.java => project/BulkUpdateKeyWsRequest.java} (92%) rename sonar-ws/src/main/java/org/sonarqube/ws/client/{component/UpdateWsRequest.java => project/UpdateKeyWsRequest.java} (90%) rename sonar-ws/src/test/java/org/sonarqube/ws/client/{component/UpdateWsRequestTest.java => project/UpdateKeyWsRequestTest.java} (90%) diff --git a/it/it-tests/src/test/java/it/Category4Suite.java b/it/it-tests/src/test/java/it/Category4Suite.java index 101287d0099..c2705a97589 100644 --- a/it/it-tests/src/test/java/it/Category4Suite.java +++ b/it/it-tests/src/test/java/it/Category4Suite.java @@ -23,7 +23,7 @@ import com.sonar.orchestrator.Orchestrator; import it.analysisExclusion.FileExclusionsTest; import it.analysisExclusion.IssueExclusionsTest; import it.component.ComponentsWsTest; -import it.component.ProjectSearchTest; +import it.component.ProjectsWsTest; import it.dbCleaner.PurgeTest; import it.duplication.CrossProjectDuplicationsOnRemoveFileTest; import it.duplication.CrossProjectDuplicationsTest; @@ -69,7 +69,7 @@ import static util.ItUtils.xooPlugin; BaseIdentityProviderTest.class, OAuth2IdentityProviderTest.class, // component search - ProjectSearchTest.class, + ProjectsWsTest.class, ComponentsWsTest.class, // analysis exclusion FileExclusionsTest.class, diff --git a/it/it-tests/src/test/java/it/component/ComponentsWsTest.java b/it/it-tests/src/test/java/it/component/ComponentsWsTest.java index 605accaeb0b..4820f670cf8 100644 --- a/it/it-tests/src/test/java/it/component/ComponentsWsTest.java +++ b/it/it-tests/src/test/java/it/component/ComponentsWsTest.java @@ -28,12 +28,9 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsComponents.BulkUpdateKeyWsResponse.Key; import org.sonarqube.ws.client.WsClient; -import org.sonarqube.ws.client.component.BulkUpdateWsRequest; import org.sonarqube.ws.client.component.SearchWsRequest; import org.sonarqube.ws.client.component.ShowWsRequest; -import org.sonarqube.ws.client.component.UpdateWsRequest; import util.ItUtils; import static java.util.Collections.singletonList; @@ -44,7 +41,6 @@ public class ComponentsWsTest { @ClassRule public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; private static final String FILE_KEY = "sample:src/main/xoo/sample/Sample.xoo"; - private static final String PROJECT_KEY = "sample"; @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -76,37 +72,4 @@ public class ComponentsWsTest { assertThat(response).isNotNull(); assertThat(response.getComponents(0).getKey()).isEqualTo(FILE_KEY); } - - @Test - public void update_key() { - String newProjectKey = "another_project_key"; - WsComponents.Component project = wsClient.components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); - assertThat(project.getKey()).isEqualTo(PROJECT_KEY); - - wsClient.components().updateKey(UpdateWsRequest.builder() - .setKey(PROJECT_KEY) - .setNewKey(newProjectKey) - .build()); - - assertThat(wsClient.components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); - } - - @Test - public void bulk_update_key() { - String newProjectKey = "another_project_key"; - WsComponents.Component project = wsClient.components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); - assertThat(project.getKey()).isEqualTo(PROJECT_KEY); - - WsComponents.BulkUpdateKeyWsResponse result = wsClient.components().bulkUpdateKey(BulkUpdateWsRequest.builder() - .setKey(PROJECT_KEY) - .setFrom(PROJECT_KEY) - .setTo(newProjectKey) - .build()); - - assertThat(wsClient.components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); - assertThat(result.getKeysCount()).isEqualTo(1); - assertThat(result.getKeys(0)) - .extracting(Key::getKey, Key::getNewKey, Key::getDuplicate) - .containsOnlyOnce(PROJECT_KEY, newProjectKey, false); - } } diff --git a/it/it-tests/src/test/java/it/component/ProjectSearchTest.java b/it/it-tests/src/test/java/it/component/ProjectsWsTest.java similarity index 54% rename from it/it-tests/src/test/java/it/component/ProjectSearchTest.java rename to it/it-tests/src/test/java/it/component/ProjectsWsTest.java index 48941aa2214..a8f760178d9 100644 --- a/it/it-tests/src/test/java/it/component/ProjectSearchTest.java +++ b/it/it-tests/src/test/java/it/component/ProjectsWsTest.java @@ -31,20 +31,38 @@ import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.junit.Before; import org.junit.ClassRule; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.sonarqube.ws.WsComponents; +import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse.Key; +import org.sonarqube.ws.client.WsClient; +import org.sonarqube.ws.client.component.ShowWsRequest; +import org.sonarqube.ws.client.project.BulkUpdateKeyWsRequest; +import org.sonarqube.ws.client.project.UpdateKeyWsRequest; +import util.ItUtils; import static org.assertj.core.api.Assertions.assertThat; import static util.ItUtils.projectDir; -public class ProjectSearchTest { +public class ProjectsWsTest { @ClassRule public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; + private static final String PROJECT_KEY = "sample"; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + private WsClient wsClient; @Before public void inspectProject() { orchestrator.resetData(); orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); + + wsClient = ItUtils.newAdminWsClient(orchestrator); } /** @@ -71,4 +89,37 @@ public class ProjectSearchTest { httpclient.getConnectionManager().shutdown(); } } + + @Test + public void update_key() { + String newProjectKey = "another_project_key"; + WsComponents.Component project = wsClient.components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); + assertThat(project.getKey()).isEqualTo(PROJECT_KEY); + + wsClient.projects().updateKey(UpdateKeyWsRequest.builder() + .setKey(PROJECT_KEY) + .setNewKey(newProjectKey) + .build()); + + assertThat(wsClient.components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); + } + + @Test + public void bulk_update_key() { + String newProjectKey = "another_project_key"; + WsComponents.Component project = wsClient.components().show(new ShowWsRequest().setKey(PROJECT_KEY)).getComponent(); + assertThat(project.getKey()).isEqualTo(PROJECT_KEY); + + BulkUpdateKeyWsResponse result = wsClient.projects().bulkUpdateKey(BulkUpdateKeyWsRequest.builder() + .setKey(PROJECT_KEY) + .setFrom(PROJECT_KEY) + .setTo(newProjectKey) + .build()); + + assertThat(wsClient.components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey); + assertThat(result.getKeysCount()).isEqualTo(1); + assertThat(result.getKeys(0)) + .extracting(Key::getKey, Key::getNewKey, Key::getDuplicate) + .containsOnlyOnce(PROJECT_KEY, newProjectKey, false); + } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java index 8d4526d1be8..a9a4edf5f58 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ComponentsWsModule.java @@ -33,8 +33,6 @@ public class ComponentsWsModule extends Module { SuggestionsAction.class, TreeAction.class, ShowAction.class, - UpdateKeyAction.class, - BulkUpdateKeyAction.class, SearchProjectsAction.class, ProjectMeasuresQueryValidator.class); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/BulkUpdateKeyAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java similarity index 81% rename from server/sonar-server/src/main/java/org/sonar/server/component/ws/BulkUpdateKeyAction.java rename to server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java index 0cee6c34e23..f7924fceda3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/BulkUpdateKeyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/BulkUpdateKeyAction.java @@ -17,10 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.component.ws; +package org.sonar.server.project.ws; import com.google.common.collect.ImmutableList; +import java.util.Comparator; import java.util.Map; +import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -33,22 +35,21 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentFinder.ParamNames; import org.sonar.server.component.ComponentService; import org.sonar.server.user.UserSession; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsComponents.BulkUpdateKeyWsResponse; -import org.sonarqube.ws.client.component.BulkUpdateWsRequest; +import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.client.project.BulkUpdateKeyWsRequest; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.db.component.ComponentKeyUpdaterDao.checkIsProjectOrModule; import static org.sonar.server.ws.WsUtils.checkRequest; import static org.sonar.server.ws.WsUtils.writeProtobuf; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_BULK_UPDATE_KEY; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_DRY_RUN; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_FROM; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_TO; - -public class BulkUpdateKeyAction implements ComponentsWsAction { +import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_BULK_UPDATE_KEY; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_DRY_RUN; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_FROM; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_ID; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_TO; + +public class BulkUpdateKeyAction implements ProjectsWsAction { private final DbClient dbClient; private final ComponentFinder componentFinder; private final ComponentKeyUpdaterDao componentKeyUpdater; @@ -65,6 +66,10 @@ public class BulkUpdateKeyAction implements ComponentsWsAction { @Override public void define(WebService.NewController context) { + doDefine(context); + } + + public WebService.NewAction doDefine(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_BULK_UPDATE_KEY) .setDescription("Bulk update a project or module key and all its sub-components keys. " + "The bulk update allows to replace a part of the current key by another string on the current project and all its sub-modules.
" + @@ -89,6 +94,9 @@ public class BulkUpdateKeyAction implements ComponentsWsAction { .setResponseExample(getClass().getResource("bulk_update_key-example.json")) .setHandler(this); + action.setChangelog( + new Change("6.4", "Moved from api/components/bulk_update_key to api/projects/bulk_update_key")); + action.createParam(PARAM_PROJECT_ID) .setDescription("Project or module ID") .setDeprecatedKey("id", "6.4") @@ -113,6 +121,8 @@ public class BulkUpdateKeyAction implements ComponentsWsAction { .setDescription("Simulate bulk update. No component key is updated.") .setBooleanPossibleValues() .setDefaultValue(false); + + return action; } @Override @@ -120,7 +130,7 @@ public class BulkUpdateKeyAction implements ComponentsWsAction { writeProtobuf(doHandle(toWsRequest(request)), request, response); } - private BulkUpdateKeyWsResponse doHandle(BulkUpdateWsRequest request) { + private BulkUpdateKeyWsResponse doHandle(BulkUpdateKeyWsRequest request) { DbSession dbSession = dbClient.openSession(false); try { ComponentDto projectOrModule = componentFinder.getByUuidOrKey(dbSession, request.getId(), request.getKey(), ParamNames.ID_AND_KEY); @@ -145,17 +155,17 @@ public class BulkUpdateKeyAction implements ComponentsWsAction { newKeysWithDuplicateMap.entrySet().forEach(entry -> checkRequest(!entry.getValue(), "Impossible to update key: a component with key \"%s\" already exists.", entry.getKey())); } - private void bulkUpdateKey(DbSession dbSession, BulkUpdateWsRequest request, ComponentDto projectOrModule) { + private void bulkUpdateKey(DbSession dbSession, BulkUpdateKeyWsRequest request, ComponentDto projectOrModule) { componentService.bulkUpdateKey(dbSession, projectOrModule.uuid(), request.getFrom(), request.getTo()); dbSession.commit(); } private static BulkUpdateKeyWsResponse buildResponse(Map newKeysByOldKeys, Map newKeysWithDuplicateMap) { - WsComponents.BulkUpdateKeyWsResponse.Builder response = WsComponents.BulkUpdateKeyWsResponse.newBuilder(); + BulkUpdateKeyWsResponse.Builder response = BulkUpdateKeyWsResponse.newBuilder(); newKeysByOldKeys.entrySet().stream() // sort by old key - .sorted((e1, e2) -> e1.getKey().compareTo(e2.getKey())) + .sorted(Comparator.comparing(Map.Entry::getKey)) .forEach( entry -> { String newKey = entry.getValue(); @@ -168,8 +178,8 @@ public class BulkUpdateKeyAction implements ComponentsWsAction { return response.build(); } - private static BulkUpdateWsRequest toWsRequest(Request request) { - return BulkUpdateWsRequest.builder() + private static BulkUpdateKeyWsRequest toWsRequest(Request request) { + return BulkUpdateKeyWsRequest.builder() .setId(request.param(PARAM_PROJECT_ID)) .setKey(request.param(PARAM_PROJECT)) .setFrom(request.mandatoryParam(PARAM_FROM)) diff --git a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWsModule.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWsModule.java index d3c00cf99ed..4fcc3bebc44 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWsModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/ProjectsWsModule.java @@ -31,6 +31,8 @@ public class ProjectsWsModule extends Module { IndexAction.class, BulkDeleteAction.class, DeleteAction.class, + UpdateKeyAction.class, + BulkUpdateKeyAction.class, GhostsAction.class, ProvisionedAction.class, SearchMyProjectsAction.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/UpdateKeyAction.java b/server/sonar-server/src/main/java/org/sonar/server/project/ws/UpdateKeyAction.java similarity index 79% rename from server/sonar-server/src/main/java/org/sonar/server/component/ws/UpdateKeyAction.java rename to server/sonar-server/src/main/java/org/sonar/server/project/ws/UpdateKeyAction.java index 38e59a5d8c5..8fc2254e412 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/UpdateKeyAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/project/ws/UpdateKeyAction.java @@ -17,8 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.component.ws; +package org.sonar.server.project.ws; + +import org.sonar.api.server.ws.Change; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; @@ -28,15 +30,15 @@ import org.sonar.db.component.ComponentDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentFinder.ParamNames; import org.sonar.server.component.ComponentService; -import org.sonarqube.ws.client.component.UpdateWsRequest; +import org.sonarqube.ws.client.project.UpdateKeyWsRequest; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_UPDATE_KEY; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_NEW_PROJECT; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT_ID; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_UPDATE_KEY; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_NEW_PROJECT; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_ID; -public class UpdateKeyAction implements ComponentsWsAction { +public class UpdateKeyAction implements ProjectsWsAction { private final DbClient dbClient; private final ComponentFinder componentFinder; private final ComponentService componentService; @@ -49,6 +51,10 @@ public class UpdateKeyAction implements ComponentsWsAction { @Override public void define(WebService.NewController context) { + doDefine(context); + } + + public WebService.NewAction doDefine(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_UPDATE_KEY) .setDescription("Update a project or module key and all its sub-components keys.
" + "Either '%s' or '%s' must be provided, not both.
" + @@ -62,6 +68,9 @@ public class UpdateKeyAction implements ComponentsWsAction { .setPost(true) .setHandler(this); + action.setChangelog( + new Change("6.4", "Move from api/components/update_key to api/projects/update_key")); + action.createParam(PARAM_PROJECT_ID) .setDescription("Project or module id") .setDeprecatedKey("id", "6.4") @@ -77,6 +86,8 @@ public class UpdateKeyAction implements ComponentsWsAction { .setRequired(true) .setDeprecatedKey("newKey", "6.4") .setExampleValue("my_new_project"); + + return action; } @Override @@ -85,7 +96,7 @@ public class UpdateKeyAction implements ComponentsWsAction { response.noContent(); } - private void doHandle(UpdateWsRequest request) { + private void doHandle(UpdateKeyWsRequest request) { DbSession dbSession = dbClient.openSession(false); try { ComponentDto projectOrModule = componentFinder.getByUuidOrKey(dbSession, request.getId(), request.getKey(), ParamNames.PROJECT_ID_AND_PROJECT); @@ -96,8 +107,8 @@ public class UpdateKeyAction implements ComponentsWsAction { } } - private static UpdateWsRequest toWsRequest(Request request) { - return UpdateWsRequest.builder() + private static UpdateKeyWsRequest toWsRequest(Request request) { + return UpdateKeyWsRequest.builder() .setId(request.param(PARAM_PROJECT_ID)) .setKey(request.param(PARAM_PROJECT)) .setNewKey(request.mandatoryParam(PARAM_NEW_PROJECT)) diff --git a/server/sonar-server/src/main/resources/org/sonar/server/component/ws/bulk_update_key-example.json b/server/sonar-server/src/main/resources/org/sonar/server/project/ws/bulk_update_key-example.json similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/component/ws/bulk_update_key-example.json rename to server/sonar-server/src/main/resources/org/sonar/server/project/ws/bulk_update_key-example.json diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java index d59687fd3f0..6c965f414e7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsModuleTest.java @@ -30,6 +30,6 @@ public class ComponentsWsModuleTest { public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new ComponentsWsModule().configure(container); - assertThat(container.size()).isEqualTo(11 + COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER); + assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 9); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/BulkUpdateKeyActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java similarity index 91% rename from server/sonar-server/src/test/java/org/sonar/server/component/ws/BulkUpdateKeyActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java index a95509b5414..2a682db0887 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/BulkUpdateKeyActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/BulkUpdateKeyActionTest.java @@ -17,7 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.component.ws; + +package org.sonar.server.project.ws; import com.google.common.base.Throwables; import java.io.IOException; @@ -47,9 +48,8 @@ import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; import org.sonar.server.ws.WsActionTester; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.WsComponents; -import org.sonarqube.ws.WsComponents.BulkUpdateKeyWsResponse; -import org.sonarqube.ws.WsComponents.BulkUpdateKeyWsResponse.Key; +import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse; +import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse.Key; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; @@ -61,11 +61,11 @@ import static org.sonar.db.component.ComponentTesting.newFileDto; import static org.sonar.db.component.ComponentTesting.newModuleDto; import static org.sonar.db.component.ComponentTesting.newProjectDto; import static org.sonar.test.JsonAssert.assertJson; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_DRY_RUN; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_FROM; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT_ID; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_TO; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_DRY_RUN; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_FROM; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_ID; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_TO; public class BulkUpdateKeyActionTest { private static final String MY_PROJECT_KEY = "my_project"; @@ -265,7 +265,7 @@ public class BulkUpdateKeyActionTest { return componentDb.insertComponent(newProjectDto(db.organizations().insert()).setKey(MY_PROJECT_KEY)); } - private WsComponents.BulkUpdateKeyWsResponse callDryRunByUuid(@Nullable String uuid, @Nullable String from, @Nullable String to) { + private BulkUpdateKeyWsResponse callDryRunByUuid(@Nullable String uuid, @Nullable String from, @Nullable String to) { return call(uuid, null, from, to, true); } @@ -273,7 +273,7 @@ public class BulkUpdateKeyActionTest { return call(null, key, from, to, true); } - private WsComponents.BulkUpdateKeyWsResponse callByUuid(@Nullable String uuid, @Nullable String from, @Nullable String to) { + private BulkUpdateKeyWsResponse callByUuid(@Nullable String uuid, @Nullable String from, @Nullable String to) { return call(uuid, null, from, to, false); } @@ -302,7 +302,7 @@ public class BulkUpdateKeyActionTest { } try { - return WsComponents.BulkUpdateKeyWsResponse.parseFrom(request.execute().getInputStream()); + return BulkUpdateKeyWsResponse.parseFrom(request.execute().getInputStream()); } catch (IOException e) { throw Throwables.propagate(e); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsModuleTest.java index abd0abd5105..1a8b29a0624 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsModuleTest.java @@ -30,6 +30,6 @@ public class ProjectsWsModuleTest { public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new ProjectsWsModule().configure(container); - assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 11); + assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 13); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/UpdateKeyActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java similarity index 91% rename from server/sonar-server/src/test/java/org/sonar/server/component/ws/UpdateKeyActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java index bbfd6d5988f..222a6ecd388 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/UpdateKeyActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/UpdateKeyActionTest.java @@ -17,7 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.component.ws; + +package org.sonar.server.project.ws; import javax.annotation.Nullable; import org.junit.Rule; @@ -43,9 +44,9 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.sonar.db.component.ComponentTesting.newProjectDto; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_NEW_PROJECT; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT_ID; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_NEW_PROJECT; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_ID; public class UpdateKeyActionTest { private static final String ANOTHER_KEY = "another_key"; @@ -58,7 +59,7 @@ public class UpdateKeyActionTest { ComponentService componentService = mock(ComponentService.class); - WsActionTester ws = new WsActionTester(new UpdateKeyAction(dbClient, new ComponentFinder(dbClient), componentService)); + WsActionTester ws = new WsActionTester(new org.sonar.server.project.ws.UpdateKeyAction(dbClient, new ComponentFinder(dbClient), componentService)); @Test public void call_by_key() { diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java index 5a4817ddc1d..202e7eb33ea 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsService.java @@ -21,35 +21,26 @@ package org.sonarqube.ws.client.component; import com.google.common.base.Joiner; import java.util.List; -import org.sonarqube.ws.WsComponents.BulkUpdateKeyWsResponse; import org.sonarqube.ws.WsComponents.SearchProjectsWsResponse; import org.sonarqube.ws.WsComponents.SearchWsResponse; import org.sonarqube.ws.WsComponents.ShowWsResponse; import org.sonarqube.ws.WsComponents.TreeWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsConnector; import static org.sonar.api.server.ws.WebService.Param; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_BULK_UPDATE_KEY; import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SEARCH; import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SEARCH_PROJECTS; import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_SHOW; import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_TREE; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.ACTION_UPDATE_KEY; import static org.sonarqube.ws.client.component.ComponentsWsParameters.CONTROLLER_COMPONENTS; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COMPONENT; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_COMPONENT_ID; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_FILTER; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_FROM; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_NEW_PROJECT; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_ORGANIZATION; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_PROJECT_ID; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_QUALIFIERS; import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_STRATEGY; -import static org.sonarqube.ws.client.component.ComponentsWsParameters.PARAM_TO; public class ComponentsService extends BaseService { @@ -87,25 +78,6 @@ public class ComponentsService extends BaseService { return call(get, ShowWsResponse.parser()); } - public void updateKey(UpdateWsRequest request) { - PostRequest post = new PostRequest(path(ACTION_UPDATE_KEY)) - .setParam(PARAM_PROJECT_ID, request.getId()) - .setParam(PARAM_PROJECT, request.getKey()) - .setParam(PARAM_NEW_PROJECT, request.getNewKey()); - - call(post); - } - - public BulkUpdateKeyWsResponse bulkUpdateKey(BulkUpdateWsRequest request) { - PostRequest post = new PostRequest(path(ACTION_BULK_UPDATE_KEY)) - .setParam(PARAM_PROJECT_ID, request.getId()) - .setParam(PARAM_PROJECT, request.getKey()) - .setParam(PARAM_FROM, request.getFrom()) - .setParam(PARAM_TO, request.getTo()); - - return call(post, BulkUpdateKeyWsResponse.parser()); - } - public SearchProjectsWsResponse searchProjects(SearchProjectsRequest request) { List additionalFields = request.getAdditionalFields(); GetRequest get = new GetRequest(path(ACTION_SEARCH_PROJECTS)) diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsWsParameters.java index 2b62d38f457..de4f3016a8a 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsWsParameters.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/component/ComponentsWsParameters.java @@ -25,10 +25,8 @@ public class ComponentsWsParameters { // actions public static final String ACTION_SEARCH = "search"; - public static final String ACTION_UPDATE_KEY = "update_key"; public static final String ACTION_TREE = "tree"; public static final String ACTION_SHOW = "show"; - public static final String ACTION_BULK_UPDATE_KEY = "bulk_update_key"; public static final String ACTION_SEARCH_PROJECTS = "search_projects"; public static final String ACTION_SUGGESTIONS = "suggestions"; @@ -37,15 +35,9 @@ public class ComponentsWsParameters { public static final String PARAM_QUALIFIERS = "qualifiers"; public static final String PARAM_LANGUAGE = "language"; public static final String PARAM_STRATEGY = "strategy"; - public static final String PARAM_FROM = "from"; - public static final String PARAM_TO = "to"; - public static final String PARAM_DRY_RUN = "dryRun"; public static final String PARAM_FILTER = "filter"; - public static final String PARAM_PROJECT_ID = "projectId"; - public static final String PARAM_PROJECT = "project"; public static final String PARAM_COMPONENT_ID = "componentId"; public static final String PARAM_COMPONENT = "component"; - public static final String PARAM_NEW_PROJECT = "newProject"; private ComponentsWsParameters() { // static utility class diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/BulkUpdateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyWsRequest.java similarity index 92% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/component/BulkUpdateWsRequest.java rename to sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyWsRequest.java index d86e6614a91..41a72f3e6c9 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/BulkUpdateWsRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/BulkUpdateKeyWsRequest.java @@ -17,7 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.ws.client.component; + +package org.sonarqube.ws.client.project; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -26,14 +27,14 @@ import javax.annotation.concurrent.Immutable; import static com.google.common.base.Preconditions.checkArgument; @Immutable -public class BulkUpdateWsRequest { +public class BulkUpdateKeyWsRequest { private final String id; private final String key; private final String from; private final String to; private final boolean dryRun; - public BulkUpdateWsRequest(Builder builder) { + public BulkUpdateKeyWsRequest(Builder builder) { this.id = builder.id; this.key = builder.key; this.from = builder.from; @@ -103,10 +104,10 @@ public class BulkUpdateWsRequest { return this; } - public BulkUpdateWsRequest build() { + public BulkUpdateKeyWsRequest build() { checkArgument(from != null && !from.isEmpty(), "The string to match must not be empty"); checkArgument(to != null && !to.isEmpty(), "The string replacement must not be empty"); - return new BulkUpdateWsRequest(this); + return new BulkUpdateKeyWsRequest(this); } } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java index b2646fa7ccc..80ae0bf1ea7 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsService.java @@ -20,21 +20,28 @@ package org.sonarqube.ws.client.project; import com.google.common.base.Joiner; -import org.sonarqube.ws.WsProjects; +import org.sonarqube.ws.WsProjects.BulkUpdateKeyWsResponse; import org.sonarqube.ws.WsProjects.CreateWsResponse; +import org.sonarqube.ws.WsProjects.SearchWsResponse; import org.sonarqube.ws.client.BaseService; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsConnector; -import static org.sonar.api.server.ws.WebService.Param.*; +import static org.sonar.api.server.ws.WebService.Param.PAGE; +import static org.sonar.api.server.ws.WebService.Param.PAGE_SIZE; +import static org.sonar.api.server.ws.WebService.Param.TEXT_QUERY; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_BULK_UPDATE_KEY; import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_CREATE; import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_SEARCH; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.ACTION_UPDATE_KEY; import static org.sonarqube.ws.client.project.ProjectsWsParameters.CONTROLLER; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_BRANCH; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_NAME; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_NEW_PROJECT; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_ORGANIZATION; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT; +import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_PROJECT_ID; import static org.sonarqube.ws.client.project.ProjectsWsParameters.PARAM_QUALIFIERS; /** @@ -70,13 +77,32 @@ public class ProjectsService extends BaseService { .setParam("key", request.getKey())); } - public WsProjects.SearchWsResponse search(SearchWsRequest request) { + public void updateKey(UpdateKeyWsRequest request) { + PostRequest post = new PostRequest(path(ACTION_UPDATE_KEY)) + .setParam(PARAM_PROJECT_ID, request.getId()) + .setParam(PARAM_PROJECT, request.getKey()) + .setParam(PARAM_NEW_PROJECT, request.getNewKey()); + + call(post); + } + + public BulkUpdateKeyWsResponse bulkUpdateKey(BulkUpdateKeyWsRequest request) { + PostRequest post = new PostRequest(path(ACTION_BULK_UPDATE_KEY)) + .setParam(PARAM_PROJECT_ID, request.getId()) + .setParam(PARAM_PROJECT, request.getKey()) + .setParam(ProjectsWsParameters.PARAM_FROM, request.getFrom()) + .setParam(ProjectsWsParameters.PARAM_TO, request.getTo()); + + return call(post, BulkUpdateKeyWsResponse.parser()); + } + + public SearchWsResponse search(SearchWsRequest request) { GetRequest get = new GetRequest(path(ACTION_SEARCH)) .setParam(PARAM_ORGANIZATION, request.getOrganization()) .setParam(PARAM_QUALIFIERS, Joiner.on(",").join(request.getQualifiers())) .setParam(TEXT_QUERY, request.getQuery()) .setParam(PAGE, request.getPage()) .setParam(PAGE_SIZE, request.getPageSize()); - return call(get, WsProjects.SearchWsResponse.parser()); + return call(get, SearchWsResponse.parser()); } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsWsParameters.java index fe4371a341f..044b8448e15 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsWsParameters.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/ProjectsWsParameters.java @@ -28,13 +28,20 @@ public class ProjectsWsParameters { public static final String ACTION_CREATE = "create"; public static final String ACTION_INDEX = "index"; public static final String ACTION_SEARCH = "search"; + public static final String ACTION_UPDATE_KEY = "update_key"; + public static final String ACTION_BULK_UPDATE_KEY = "bulk_update_key"; public static final String PARAM_PROJECT = "project"; public static final String PARAM_PROJECT_ID = "projectId"; + public static final String PARAM_NEW_PROJECT = "newProject"; public static final String PARAM_NAME = "name"; public static final String PARAM_BRANCH = "branch"; public static final String PARAM_ORGANIZATION = "organization"; public static final String PARAM_QUALIFIERS = "qualifiers"; + public static final String PARAM_FROM = "from"; + public static final String PARAM_TO = "to"; + public static final String PARAM_DRY_RUN = "dryRun"; + public static final String FILTER_LANGUAGE = "language"; diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/UpdateWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyWsRequest.java similarity index 90% rename from sonar-ws/src/main/java/org/sonarqube/ws/client/component/UpdateWsRequest.java rename to sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyWsRequest.java index 074337a1a9a..206cb827cc2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/component/UpdateWsRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/project/UpdateKeyWsRequest.java @@ -17,7 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.ws.client.component; + +package org.sonarqube.ws.client.project; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -26,12 +27,12 @@ import javax.annotation.concurrent.Immutable; import static com.google.common.base.Preconditions.checkArgument; @Immutable -public class UpdateWsRequest { +public class UpdateKeyWsRequest { private final String id; private final String key; private final String newKey; - public UpdateWsRequest(Builder builder) { + public UpdateKeyWsRequest(Builder builder) { this.id = builder.id; this.key = builder.key; this.newKey = builder.newKey; @@ -79,9 +80,9 @@ public class UpdateWsRequest { return this; } - public UpdateWsRequest build() { + public UpdateKeyWsRequest build() { checkArgument(newKey != null && !newKey.isEmpty(), "The new key must not be empty"); - return new UpdateWsRequest(this); + return new UpdateKeyWsRequest(this); } } } diff --git a/sonar-ws/src/main/protobuf/ws-components.proto b/sonar-ws/src/main/protobuf/ws-components.proto index 2c5b2673eb4..effdadc7386 100644 --- a/sonar-ws/src/main/protobuf/ws-components.proto +++ b/sonar-ws/src/main/protobuf/ws-components.proto @@ -56,17 +56,6 @@ message SuggestionsWsResponse { } } -// WS api/components/prepare_bulk_update_key -message BulkUpdateKeyWsResponse { - repeated Key keys = 1; - - message Key { - optional string key = 1; - optional string newKey = 2; - optional bool duplicate = 3; - } -} - // WS api/components/search_projects message SearchProjectsWsResponse { optional sonarqube.ws.commons.Paging paging = 1; diff --git a/sonar-ws/src/main/protobuf/ws-projects.proto b/sonar-ws/src/main/protobuf/ws-projects.proto index 7dcb6260857..86ed442a8d6 100644 --- a/sonar-ws/src/main/protobuf/ws-projects.proto +++ b/sonar-ws/src/main/protobuf/ws-projects.proto @@ -71,3 +71,13 @@ message SearchWsResponse { } } +// WS api/projects/prepare_bulk_update_key +message BulkUpdateKeyWsResponse { + repeated Key keys = 1; + + message Key { + optional string key = 1; + optional string newKey = 2; + optional bool duplicate = 3; + } +} diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/component/UpdateWsRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyWsRequestTest.java similarity index 90% rename from sonar-ws/src/test/java/org/sonarqube/ws/client/component/UpdateWsRequestTest.java rename to sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyWsRequestTest.java index 4999b60062e..0eb51978769 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/component/UpdateWsRequestTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/project/UpdateKeyWsRequestTest.java @@ -17,18 +17,19 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.ws.client.component; + +package org.sonarqube.ws.client.project; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -public class UpdateWsRequestTest { +public class UpdateKeyWsRequestTest { @Rule public ExpectedException expectedException = ExpectedException.none(); - UpdateWsRequest.Builder underTest = UpdateWsRequest.builder(); + UpdateKeyWsRequest.Builder underTest = UpdateKeyWsRequest.builder(); @Test public void fail_if_new_key_is_null() { -- 2.39.5