use of org.sonarqube.ws.client.component.ShowWsRequest in project sonarqube by SonarSource.
the class ProjectsWsTest method update_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.projects().updateKey(UpdateKeyWsRequest.builder().setKey(PROJECT_KEY).setNewKey(newProjectKey).build());
assertThat(wsClient.components().show(new ShowWsRequest().setId(project.getId())).getComponent().getKey()).isEqualTo(newProjectKey);
}
use of org.sonarqube.ws.client.component.ShowWsRequest in project sonarqube by SonarSource.
the class ProjectsWsTest method bulk_update_key.
@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);
}
use of org.sonarqube.ws.client.component.ShowWsRequest in project sonarqube by SonarSource.
the class ShowAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
ShowWsRequest showWsRequest = toShowWsRequest(request);
ShowWsResponse showWsResponse = doHandle(showWsRequest);
writeProtobuf(showWsResponse, request, response);
}
Aggregations