import org.sonar.api.server.ws.WebService;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.CONTROLLER;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_BRANCH;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT;
public class BranchesWs implements WebService {
private final BranchWsAction[] actions;
import static org.sonar.server.branch.ws.BranchesWs.addBranchParam;
import static org.sonar.server.branch.ws.BranchesWs.addProjectParam;
import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.ACTION_DELETE;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_BRANCH;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT;
public class DeleteAction implements BranchWsAction {
private final DbClient dbClient;
import static org.sonar.db.component.BranchType.LONG;
import static org.sonar.db.component.BranchType.SHORT;
import static org.sonar.server.branch.ws.BranchesWs.addProjectParam;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.ACTION_LIST;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT;
public class ListAction implements BranchWsAction {
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.branch.ws;
+
+public class ProjectBranchesParameters {
+
+ public static final String CONTROLLER = "api/project_branches";
+
+ // actions
+ public static final String ACTION_LIST = "list";
+ public static final String ACTION_DELETE = "delete";
+ public static final String ACTION_RENAME = "rename";
+
+ // parameters
+ public static final String PARAM_PROJECT = "project";
+ public static final String PARAM_COMPONENT = "component";
+ public static final String PARAM_BRANCH = "branch";
+ public static final String PARAM_NAME = "name";
+
+ private ProjectBranchesParameters() {
+ // static utility class
+ }
+}
import static com.google.common.base.Preconditions.checkArgument;
import static org.sonar.server.branch.ws.BranchesWs.addProjectParam;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.ACTION_RENAME;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_NAME;
+import static org.sonar.server.branch.ws.ProjectBranchesParameters.PARAM_PROJECT;
public class RenameAction implements BranchWsAction {
private final ComponentFinder componentFinder;
import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
import static org.sonar.server.ws.WsUtils.checkRequest;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_QUERY;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_ONLY_CURRENTS;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_ONLY_CURRENTS;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_STATUS;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_TYPE;
public class ActivityAction implements CeWsAction {
private static final int MAX_PAGE_SIZE = 1000;
import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_KEY;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
+import static org.sonar.server.ce.ws.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
public class ActivityStatusAction implements CeWsAction {
private final UserSession userSession;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.ce.ws;
+
+public class CeWsParameters {
+
+ public static final String ACTION_WORKER_COUNT = "worker_count";
+
+ public static final String PARAM_COMPONENT_ID = "componentId";
+ public static final String DEPRECATED_PARAM_COMPONENT_KEY = "componentKey";
+ public static final String PARAM_COMPONENT = "component";
+ public static final String PARAM_COMPONENT_QUERY = "componentQuery";
+ public static final String PARAM_TYPE = "type";
+ public static final String PARAM_STATUS = "status";
+ public static final String PARAM_ONLY_CURRENTS = "onlyCurrents";
+ public static final String PARAM_MIN_SUBMITTED_AT = "minSubmittedAt";
+ public static final String PARAM_MAX_EXECUTED_AT = "maxExecutedAt";
+
+ private CeWsParameters() {
+ // prevent instantiation
+ }
+}
import static org.sonar.db.Pagination.forPage;
import static org.sonar.server.component.ComponentFinder.ParamNames.COMPONENT_ID_AND_COMPONENT;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
public class ComponentAction implements CeWsAction {
import org.sonarqube.ws.Ce.WorkerCountResponse;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.ce.CeWsParameters.ACTION_WORKER_COUNT;
+import static org.sonar.server.ce.ws.CeWsParameters.ACTION_WORKER_COUNT;
public class WorkerCountAction implements CeWsAction {
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT;
public class AddAction implements FavoritesWsAction {
private final UserSession userSession;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.favorite.ws;
+
+public class FavoritesWsParameters {
+ public static final String CONTROLLER_FAVORITES = "api/favorites";
+
+ public static final String ACTION_ADD = "add";
+ public static final String ACTION_REMOVE = "remove";
+ public static final String ACTION_SEARCH = "search";
+
+ public static final String PARAM_COMPONENT = "component";
+
+ private FavoritesWsParameters() {
+ // prevent instantiation
+ }
+}
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT;
public class RemoveAction implements FavoritesWsAction {
private final UserSession userSession;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.Favorites.Favorite;
import org.sonarqube.ws.Favorites.SearchResponse;
-import org.sonarqube.ws.client.favorite.SearchRequest;
+import org.sonarqube.ws.client.favorites.SearchRequest;
import static com.google.common.base.Preconditions.checkArgument;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.favorite.SearchRequest.MAX_PAGE_SIZE;
+import static org.sonar.server.favorite.ws.FavoritesWsParameters.ACTION_SEARCH;
public class SearchAction implements FavoritesWsAction {
+ private static final int MAX_PAGE_SIZE = 500;
+
private final FavoriteFinder favoriteFinder;
private final DbClient dbClient;
private final UserSession userSession;
private static SearchRequest toWsRequest(Request request) {
return new SearchRequest()
- .setPage(request.mandatoryParamAsInt(Param.PAGE))
- .setPageSize(request.mandatoryParamAsInt(Param.PAGE_SIZE));
+ .setP(request.mandatoryParam(Param.PAGE))
+ .setPs(request.mandatoryParam(Param.PAGE_SIZE));
}
private SearchResults toSearchResults(SearchRequest request) {
userSession.checkLoggedIn();
try (DbSession dbSession = dbClient.openSession(false)) {
List<ComponentDto> authorizedFavorites = getAuthorizedFavorites();
- Paging paging = Paging.forPageIndex(request.getPage()).withPageSize(request.getPageSize()).andTotal(authorizedFavorites.size());
+ Paging paging = Paging.forPageIndex(Integer.parseInt(request.getP())).withPageSize(Integer.parseInt(request.getPs())).andTotal(authorizedFavorites.size());
List<ComponentDto> displayedFavorites = authorizedFavorites.stream()
.skip(paging.offset())
.limit(paging.pageSize())
import org.sonar.server.notification.email.EmailNotificationChannel;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import org.sonarqube.ws.client.notification.AddRequest;
+import org.sonarqube.ws.client.notifications.AddRequest;
import static java.util.Optional.empty;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION;
import static org.sonar.server.ws.WsUtils.checkFound;
import static org.sonar.server.ws.WsUtils.checkRequest;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.ACTION_ADD;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.ACTION_ADD;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE;
public class AddAction implements NotificationsWsAction {
private final NotificationCenter notificationCenter;
}
private AddRequest toWsRequest(Request request) {
- AddRequest.Builder requestBuilder = AddRequest.builder()
+ AddRequest add = new AddRequest()
.setType(request.mandatoryParam(PARAM_TYPE))
.setChannel(request.mandatoryParam(PARAM_CHANNEL));
- setNullable(request.param(PARAM_PROJECT), requestBuilder::setProject);
- setNullable(request.param(PARAM_LOGIN), requestBuilder::setLogin);
- AddRequest wsRequest = requestBuilder.build();
+ setNullable(request.param(PARAM_PROJECT), add::setProject);
+ setNullable(request.param(PARAM_LOGIN), add::setLogin);
- if (wsRequest.getProject() == null) {
- checkRequest(globalDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s",
+ if (add.getProject() == null) {
+ checkRequest(globalDispatchers.contains(add.getType()), "Value of parameter '%s' (%s) must be one of: %s",
PARAM_TYPE,
- wsRequest.getType(),
+ add.getType(),
globalDispatchers);
} else {
- checkRequest(projectDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s",
+ checkRequest(projectDispatchers.contains(add.getType()), "Value of parameter '%s' (%s) must be one of: %s",
PARAM_TYPE,
- wsRequest.getType(),
+ add.getType(),
projectDispatchers);
}
- return wsRequest;
+ return add;
}
}
import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION;
import static org.sonar.server.ws.WsUtils.checkFound;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.ACTION_LIST;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.ACTION_LIST;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN;
public class ListAction implements NotificationsWsAction {
private static final Splitter PROPERTY_KEY_SPLITTER = Splitter.on(".");
import org.sonar.api.server.ws.WebService;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.CONTROLLER;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.CONTROLLER;
public class NotificationsWs implements WebService {
private final NotificationsWsAction[] actions;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.notification.ws;
+
+public class NotificationsWsParameters {
+ public static final String CONTROLLER = "api/notifications";
+ public static final String ACTION_ADD = "add";
+ public static final String ACTION_REMOVE = "remove";
+ public static final String ACTION_LIST = "list";
+
+ public static final String PARAM_PROJECT = "project";
+ public static final String PARAM_CHANNEL = "channel";
+ public static final String PARAM_TYPE = "type";
+ public static final String PARAM_LOGIN = "login";
+
+ private NotificationsWsParameters() {
+ // prevent instantiation
+ }
+}
import org.sonar.server.notification.email.EmailNotificationChannel;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.KeyExamples;
-import org.sonarqube.ws.client.notification.RemoveRequest;
+import org.sonarqube.ws.client.notifications.RemoveRequest;
import static java.util.Optional.empty;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION;
import static org.sonar.server.ws.WsUtils.checkFound;
import static org.sonar.server.ws.WsUtils.checkRequest;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.ACTION_REMOVE;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.ACTION_REMOVE;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE;
public class RemoveAction implements NotificationsWsAction {
private final NotificationCenter notificationCenter;
}
private RemoveRequest toWsRequest(Request request) {
- RemoveRequest.Builder requestBuilder = RemoveRequest.builder()
+ RemoveRequest remove = new RemoveRequest()
.setType(request.mandatoryParam(PARAM_TYPE))
.setChannel(request.mandatoryParam(PARAM_CHANNEL));
- setNullable(request.param(PARAM_PROJECT), requestBuilder::setProject);
- setNullable(request.param(PARAM_LOGIN), requestBuilder::setLogin);
- RemoveRequest wsRequest = requestBuilder.build();
+ setNullable(request.param(PARAM_PROJECT), remove::setProject);
+ setNullable(request.param(PARAM_LOGIN), remove::setLogin);
- if (wsRequest.getProject() == null) {
- checkRequest(globalDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s",
+ if (remove.getProject() == null) {
+ checkRequest(globalDispatchers.contains(remove.getType()), "Value of parameter '%s' (%s) must be one of: %s",
PARAM_TYPE,
- wsRequest.getType(),
+ remove.getType(),
globalDispatchers);
} else {
- checkRequest(projectDispatchers.contains(wsRequest.getType()), "Value of parameter '%s' (%s) must be one of: %s",
+ checkRequest(projectDispatchers.contains(remove.getType()), "Value of parameter '%s' (%s) must be one of: %s",
PARAM_TYPE,
- wsRequest.getType(),
+ remove.getType(),
projectDispatchers);
}
- return wsRequest;
+ return remove;
}
}
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.ProjectLinks;
import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
-import org.sonarqube.ws.client.projectlinks.CreateWsRequest;
+import org.sonarqube.ws.client.projectlinks.CreateRequest;
import static org.sonar.core.util.Slug.slugify;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_CREATE;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.ACTION_CREATE;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_NAME;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_URL;
public class CreateAction implements ProjectLinksWsAction {
private final DbClient dbClient;
@Override
public void handle(Request request, Response response) throws Exception {
- CreateWsRequest searchWsRequest = toCreateWsRequest(request);
+ CreateRequest searchWsRequest = toCreateWsRequest(request);
CreateWsResponse createWsResponse = doHandle(searchWsRequest);
writeProtobuf(createWsResponse, request, response);
}
- private CreateWsResponse doHandle(CreateWsRequest createWsRequest) {
+ private CreateWsResponse doHandle(CreateRequest createWsRequest) {
String name = createWsRequest.getName();
String url = createWsRequest.getUrl();
.build();
}
- private ComponentDto getComponentByUuidOrKey(DbSession dbSession, CreateWsRequest request) {
+ private ComponentDto getComponentByUuidOrKey(DbSession dbSession, CreateRequest request) {
return componentFinder.getRootComponentByUuidOrKey(
dbSession,
request.getProjectId(),
ComponentFinder.ParamNames.PROJECT_ID_AND_KEY);
}
- private static CreateWsRequest toCreateWsRequest(Request request) {
- return new CreateWsRequest()
+ private static CreateRequest toCreateWsRequest(Request request) {
+ return new CreateRequest()
.setProjectId(request.param(PARAM_PROJECT_ID))
.setProjectKey(request.param(PARAM_PROJECT_KEY))
.setName(request.mandatoryParam(PARAM_NAME))
import org.sonar.db.component.ComponentLinkDto;
import org.sonar.server.user.UserSession;
import org.sonar.server.ws.WsUtils;
-import org.sonarqube.ws.client.projectlinks.DeleteWsRequest;
+import org.sonarqube.ws.client.projectlinks.DeleteRequest;
import static org.sonar.db.component.ComponentLinkDto.PROVIDED_TYPES;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_DELETE;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.ACTION_DELETE;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_ID;
public class DeleteAction implements ProjectLinksWsAction {
private final DbClient dbClient;
@Override
public void handle(Request request, Response response) throws Exception {
- DeleteWsRequest deleteWsRequest = toDeleteWsRequest(request);
+ DeleteRequest deleteWsRequest = toDeleteWsRequest(request);
doHandle(deleteWsRequest);
response.noContent();
}
- private static DeleteWsRequest toDeleteWsRequest(Request request) {
- return new DeleteWsRequest()
- .setId(request.mandatoryParamAsLong(PARAM_ID));
+ private static DeleteRequest toDeleteWsRequest(Request request) {
+ return new DeleteRequest()
+ .setId(request.mandatoryParam(PARAM_ID));
}
- private void doHandle(DeleteWsRequest request) {
+ private void doHandle(DeleteRequest request) {
try (DbSession dbSession = dbClient.openSession(false)) {
- long id = request.getId();
+ long id = Long.parseLong(request.getId());
ComponentLinkDto link = dbClient.componentLinkDao().selectById(dbSession, id);
link = WsUtils.checkFound(link, "Link with id '%s' not found", id);
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.projectlink.ws;
+
+public class ProjectLinksWsParameters {
+
+ //actions
+ public static final String ACTION_SEARCH = "search";
+ public static final String ACTION_CREATE = "create";
+ public static final String ACTION_DELETE = "delete";
+
+ // parameters
+ public static final String PARAM_PROJECT_ID = "projectId";
+ public static final String PARAM_PROJECT_KEY = "projectKey";
+ public static final String PARAM_ID = "id";
+ public static final String PARAM_NAME = "name";
+ public static final String PARAM_URL = "url";
+
+ private ProjectLinksWsParameters() {
+ // static utility class
+ }
+}
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.ProjectLinks.Link;
import org.sonarqube.ws.ProjectLinks.SearchWsResponse;
-import org.sonarqube.ws.client.projectlinks.SearchWsRequest;
+import org.sonarqube.ws.client.projectlinks.SearchRequest;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.ACTION_SEARCH;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
public class SearchAction implements ProjectLinksWsAction {
private final DbClient dbClient;
@Override
public void handle(Request request, Response response) throws Exception {
- SearchWsRequest searchWsRequest = toSearchWsRequest(request);
+ SearchRequest searchWsRequest = toSearchWsRequest(request);
SearchWsResponse searchWsResponse = doHandle(searchWsRequest);
writeProtobuf(searchWsResponse, request, response);
}
- private SearchWsResponse doHandle(SearchWsRequest searchWsRequest) {
+ private SearchWsResponse doHandle(SearchRequest searchWsRequest) {
try (DbSession dbSession = dbClient.openSession(false)) {
ComponentDto component = getComponentByUuidOrKey(dbSession, searchWsRequest);
List<ComponentLinkDto> links = dbClient.componentLinkDao()
return builder.build();
}
- private ComponentDto getComponentByUuidOrKey(DbSession dbSession, SearchWsRequest request) {
+ private ComponentDto getComponentByUuidOrKey(DbSession dbSession, SearchRequest request) {
ComponentDto component = componentFinder.getRootComponentByUuidOrKey(
dbSession,
request.getProjectId(),
return component;
}
- private static SearchWsRequest toSearchWsRequest(Request request) {
- return new SearchWsRequest()
+ private static SearchRequest toSearchWsRequest(Request request) {
+ return new SearchRequest()
.setProjectId(request.param(PARAM_PROJECT_ID))
.setProjectKey(request.param(PARAM_PROJECT_KEY));
}
import org.sonar.db.qualitygate.QualityGateDto;
import org.sonar.server.qualitygate.QualityGates;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME;
public class CopyAction implements QualityGatesWsAction {
import org.sonarqube.ws.Qualitygates.CreateWsResponse;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_CREATE;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME;
public class CreateAction implements QualityGatesWsAction {
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.qualitygate.ws.QualityGatesWs.addConditionParams;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_CREATE_CONDITION;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_CREATE_CONDITION;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING;
public class CreateConditionAction implements QualityGatesWsAction {
import org.sonar.server.user.UserSession;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
public class DeleteConditionAction implements QualityGatesWsAction {
import org.sonar.server.qualitygate.QualityGates;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY;
public class DeselectAction implements QualityGatesWsAction {
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.server.qualitygate.QualityGates;
-import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters;
public class DestroyAction implements QualityGatesWsAction {
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_GET_BY_PROJECT;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_GET_BY_PROJECT;
public class GetByProjectAction implements QualityGatesWsAction {
private static final String PARAM_PROJECT = "project";
import static org.sonar.server.ws.WsUtils.checkFoundWithOptional;
import static org.sonar.server.ws.WsUtils.checkRequest;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_PROJECT_STATUS;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_PROJECT_STATUS;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ANALYSIS_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY;
public class ProjectStatusAction implements QualityGatesWsAction {
private static final String QG_STATUSES_ONE_LINE = Arrays.stream(ProjectStatusWsResponse.Status.values())
import org.sonar.db.qualitygate.QualityGateDto;
import org.sonar.server.exceptions.BadRequestException;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.CONTROLLER_QUALITY_GATES;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.CONTROLLER_QUALITY_GATES;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING;
public class QualityGatesWs implements WebService {
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.qualitygate.ws;
+
+public class QualityGatesWsParameters {
+
+ public static final String CONTROLLER_QUALITY_GATES = "api/qualitygates";
+
+ public static final String ACTION_PROJECT_STATUS = "project_status";
+ public static final String ACTION_GET_BY_PROJECT = "get_by_project";
+ public static final String ACTION_SELECT = "select";
+ public static final String ACTION_CREATE = "create";
+ public static final String ACTION_CREATE_CONDITION = "create_condition";
+ public static final String ACTION_UPDATE_CONDITION = "update_condition";
+
+ public static final String PARAM_ANALYSIS_ID = "analysisId";
+ public static final String PARAM_PROJECT_ID = "projectId";
+ public static final String PARAM_PROJECT_KEY = "projectKey";
+ public static final String PARAM_PAGE_SIZE = "pageSize";
+ public static final String PARAM_PAGE = "page";
+ public static final String PARAM_QUERY = "query";
+ public static final String PARAM_NAME = "name";
+ public static final String PARAM_ERROR = "error";
+ public static final String PARAM_WARNING = "warning";
+ public static final String PARAM_PERIOD = "period";
+ public static final String PARAM_OPERATOR = "op";
+ public static final String PARAM_METRIC = "metric";
+ public static final String PARAM_GATE_ID = "gateId";
+ public static final String PARAM_ID = "id";
+
+ private QualityGatesWsParameters() {
+ // prevent instantiation
+ }
+
+}
import org.sonar.server.qualitygate.QualityGates;
import static org.sonar.server.qualitygate.ws.CreateAction.NAME_MAXIMUM_LENGTH;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME;
public class RenameAction implements QualityGatesWsAction {
import org.sonar.db.qualitygate.ProjectQgateAssociation;
import org.sonar.db.qualitygate.ProjectQgateAssociationQuery;
import org.sonar.server.qualitygate.QgateProjectFinder;
-import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters;
public class SearchAction implements QualityGatesWsAction {
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.server.ws.WsUtils.checkFound;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_SELECT;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_SELECT;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY;
public class SelectAction implements QualityGatesWsAction {
private final DbClient dbClient;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.server.qualitygate.QualityGates;
-import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters;
public class SetAsDefaultAction implements QualityGatesWsAction {
import org.sonar.server.qualitygate.QualityGates;
import static org.sonar.server.ws.WsUtils.checkRequest;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_NAME;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_NAME;
public class ShowAction implements QualityGatesWsAction {
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
import org.sonar.server.qualitygate.QualityGates;
-import org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters;
public class UnsetDefaultAction implements QualityGatesWsAction {
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES;
import static org.sonar.server.qualitygate.ws.QualityGatesWs.addConditionParams;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.ACTION_UPDATE_CONDITION;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.ACTION_UPDATE_CONDITION;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING;
public class UpdateConditionAction implements QualityGatesWsAction {
import org.sonar.server.usertoken.TokenGenerator;
import org.sonarqube.ws.UserTokens;
import org.sonarqube.ws.UserTokens.GenerateWsResponse;
-import org.sonarqube.ws.client.usertoken.GenerateWsRequest;
+import org.sonarqube.ws.client.usertokens.GenerateRequest;
import static java.net.HttpURLConnection.HTTP_INTERNAL_ERROR;
import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException;
import static org.sonar.server.ws.WsUtils.checkRequest;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_GENERATE;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.ACTION_GENERATE;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME;
public class GenerateAction implements UserTokensWsAction {
private static final int MAX_TOKEN_NAME_LENGTH = 100;
writeProtobuf(generateWsResponse, request, response);
}
- private UserTokens.GenerateWsResponse doHandle(GenerateWsRequest request) {
+ private UserTokens.GenerateWsResponse doHandle(GenerateRequest request) {
try (DbSession dbSession = dbClient.openSession(false)) {
checkWsRequest(dbSession, request);
TokenPermissionsValidator.validate(userSession, request.getLogin());
return tokenHash;
}
- private void checkWsRequest(DbSession dbSession, GenerateWsRequest request) {
+ private void checkWsRequest(DbSession dbSession, GenerateRequest request) {
checkLoginExists(dbSession, request);
Optional<UserTokenDto> userTokenDto = dbClient.userTokenDao().selectByLoginAndName(dbSession, request.getLogin(), request.getName());
checkRequest(!userTokenDto.isPresent(), "A user token with login '%s' and name '%s' already exists", request.getLogin(), request.getName());
}
- private void checkLoginExists(DbSession dbSession, GenerateWsRequest request) {
+ private void checkLoginExists(DbSession dbSession, GenerateRequest request) {
UserDto user = dbClient.userDao().selectByLogin(dbSession, request.getLogin());
if (user == null) {
throw insufficientPrivilegesException();
}
}
- private UserTokenDto insertTokenInDb(DbSession dbSession, GenerateWsRequest request, String tokenHash) {
+ private UserTokenDto insertTokenInDb(DbSession dbSession, GenerateRequest request, String tokenHash) {
UserTokenDto userTokenDto = new UserTokenDto()
.setLogin(request.getLogin())
.setName(request.getName())
return userTokenDto;
}
- private GenerateWsRequest toCreateWsRequest(Request request) {
- GenerateWsRequest generateWsRequest = new GenerateWsRequest()
+ private GenerateRequest toCreateWsRequest(Request request) {
+ GenerateRequest generateWsRequest = new GenerateRequest()
.setLogin(request.param(PARAM_LOGIN))
.setName(request.mandatoryParam(PARAM_NAME).trim());
if (generateWsRequest.getLogin() == null) {
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
import org.sonar.server.user.UserSession;
-import org.sonarqube.ws.client.usertoken.RevokeWsRequest;
+import org.sonarqube.ws.client.usertokens.RevokeRequest;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_REVOKE;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.ACTION_REVOKE;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME;
public class RevokeAction implements UserTokensWsAction {
private final DbClient dbClient;
@Override
public void handle(Request request, Response response) throws Exception {
- doHandle(toRevokeWsRequest(request));
+ doHandle(toRevokeRequest(request));
response.noContent();
}
- private void doHandle(RevokeWsRequest request) {
+ private void doHandle(RevokeRequest request) {
TokenPermissionsValidator.validate(userSession, request.getLogin());
try (DbSession dbSession = dbClient.openSession(false)) {
}
}
- private RevokeWsRequest toRevokeWsRequest(Request request) {
- RevokeWsRequest revokeWsRequest = new RevokeWsRequest()
+ private RevokeRequest toRevokeRequest(Request request) {
+ RevokeRequest RevokeRequest = new RevokeRequest()
.setLogin(request.param(PARAM_LOGIN))
.setName(request.mandatoryParam(PARAM_NAME));
- if (revokeWsRequest.getLogin() == null) {
- revokeWsRequest.setLogin(userSession.getLogin());
+ if (RevokeRequest.getLogin() == null) {
+ RevokeRequest.setLogin(userSession.getLogin());
}
- return revokeWsRequest;
+ return RevokeRequest;
}
}
import org.sonar.db.user.UserTokenDto;
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.UserTokens.SearchWsResponse;
-import org.sonarqube.ws.client.usertoken.SearchWsRequest;
+import org.sonarqube.ws.client.usertokens.SearchRequest;
import static org.sonar.api.utils.DateUtils.formatDateTime;
import static org.sonar.server.ws.WsUtils.checkFound;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.ACTION_SEARCH;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN;
public class SearchAction implements UserTokensWsAction {
private final DbClient dbClient;
@Override
public void handle(Request request, Response response) throws Exception {
- SearchWsResponse searchWsResponse = doHandle(toSearchWsRequest(request));
+ SearchWsResponse searchWsResponse = doHandle(toSearchRequest(request));
writeProtobuf(searchWsResponse, request, response);
}
- private SearchWsResponse doHandle(SearchWsRequest request) {
+ private SearchWsResponse doHandle(SearchRequest request) {
TokenPermissionsValidator.validate(userSession, request.getLogin());
try (DbSession dbSession = dbClient.openSession(false)) {
}
}
- private SearchWsRequest toSearchWsRequest(Request request) {
- SearchWsRequest searchWsRequest = new SearchWsRequest().setLogin(request.param(PARAM_LOGIN));
- if (searchWsRequest.getLogin() == null) {
- searchWsRequest.setLogin(userSession.getLogin());
+ private SearchRequest toSearchRequest(Request request) {
+ SearchRequest SearchRequest = new SearchRequest().setLogin(request.param(PARAM_LOGIN));
+ if (SearchRequest.getLogin() == null) {
+ SearchRequest.setLogin(userSession.getLogin());
}
- return searchWsRequest;
+ return SearchRequest;
}
private static SearchWsResponse buildResponse(String login, List<UserTokenDto> userTokensDto) {
import org.sonar.api.server.ws.WebService;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.CONTROLLER;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.CONTROLLER;
public class UserTokensWs implements WebService {
private final UserTokensWsAction[] actions;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * 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.usertoken.ws;
+
+public class UserTokensWsParameters {
+ public static final String CONTROLLER = "api/user_tokens";
+ public static final String ACTION_GENERATE = "generate";
+ public static final String ACTION_REVOKE = "revoke";
+ public static final String ACTION_SEARCH = "search";
+
+ public static final String PARAM_LOGIN = "login";
+ public static final String PARAM_NAME = "name";
+
+ private UserTokensWsParameters() {
+ // constants only
+ }
+}
import org.sonarqube.ws.Ce;
import org.sonarqube.ws.Common;
import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.Ce;
import org.sonarqube.ws.Ce.ActivityResponse;
import org.sonarqube.ws.Ce.Task;
import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY;
import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY;
import static org.sonar.db.component.BranchType.LONG;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_QUERY;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MAX_EXECUTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_STATUS;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_TYPE;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_QUERY;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MAX_EXECUTED_AT;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_MIN_SUBMITTED_AT;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_STATUS;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_TYPE;
public class ActivityActionTest {
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.WsActionTester;
import org.sonarqube.ws.Ce;
-import org.sonarqube.ws.Ce;
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.ce.CeQueueTesting.newCeQueueDto;
import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.ce.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
+import static org.sonar.server.ce.ws.CeWsParameters.DEPRECATED_PARAM_COMPONENT_KEY;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
public class ActivityStatusActionTest {
import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_TYPE_KEY;
import static org.sonar.db.component.BranchType.LONG;
import static org.sonar.db.component.BranchType.SHORT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT;
-import static org.sonarqube.ws.client.ce.CeWsParameters.PARAM_COMPONENT_ID;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.ce.ws.CeWsParameters.PARAM_COMPONENT_ID;
public class ComponentActionTest {
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.db.component.ComponentTesting.newFileDto;
import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT;
public class AddActionTest {
private static final String PROJECT_KEY = "project-key";
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.db.component.ComponentTesting.newFileDto;
import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT;
+import static org.sonar.server.favorite.ws.FavoritesWsParameters.PARAM_COMPONENT;
public class RemoveActionTest {
private static final String PROJECT_KEY = "project-key";
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.client.notification.AddRequest;
+import org.sonarqube.ws.client.notifications.AddRequest;
import static java.lang.String.format;
import static java.net.HttpURLConnection.HTTP_NO_CONTENT;
import static org.sonar.db.component.ComponentTesting.newView;
import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION;
import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE;
public class AddActionTest {
private static final String NOTIF_MY_NEW_ISSUES = "Dispatcher1";
private AddAction underTest;
private WsActionTester ws;
- private AddRequest.Builder request = AddRequest.builder()
- .setType(NOTIF_MY_NEW_ISSUES);
+ private AddRequest request = new AddRequest().setType(NOTIF_MY_NEW_ISSUES);
@Before
public void setUp() {
.setLogin(userSession.getLogin()));
}
- private TestResponse call(AddRequest.Builder wsRequestBuilder) {
- AddRequest wsRequest = wsRequestBuilder.build();
+ private TestResponse call(AddRequest add) {
TestRequest request = ws.newRequest();
- request.setParam(PARAM_TYPE, wsRequest.getType());
- setNullable(wsRequest.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel));
- setNullable(wsRequest.getProject(), project -> request.setParam(PARAM_PROJECT, project));
- setNullable(wsRequest.getLogin(), login -> request.setParam(PARAM_LOGIN, login));
+ request.setParam(PARAM_TYPE, add.getType());
+ setNullable(add.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel));
+ setNullable(add.getProject(), project -> request.setParam(PARAM_PROJECT, project));
+ setNullable(add.getLogin(), login -> request.setParam(PARAM_LOGIN, login));
return request.execute();
}
import org.sonar.server.ws.TestRequest;
import org.sonar.server.ws.TestResponse;
import org.sonar.server.ws.WsActionTester;
-import org.sonarqube.ws.client.notification.RemoveRequest;
+import org.sonarqube.ws.client.notifications.RemoveRequest;
import static java.lang.String.format;
import static java.net.HttpURLConnection.HTTP_NO_CONTENT;
import static org.sonar.db.component.ComponentTesting.newView;
import static org.sonar.server.notification.NotificationDispatcherMetadata.GLOBAL_NOTIFICATION;
import static org.sonar.server.notification.NotificationDispatcherMetadata.PER_PROJECT_NOTIFICATION;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_CHANNEL;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_PROJECT;
-import static org.sonarqube.ws.client.notification.NotificationsWsParameters.PARAM_TYPE;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_CHANNEL;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_LOGIN;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_PROJECT;
+import static org.sonar.server.notification.ws.NotificationsWsParameters.PARAM_TYPE;
public class RemoveActionTest {
private static final String NOTIF_MY_NEW_ISSUES = "Dispatcher1";
private RemoveAction underTest;
private WsActionTester ws;
- private RemoveRequest.Builder request = RemoveRequest.builder().setType(NOTIF_MY_NEW_ISSUES);
+ private RemoveRequest request = new RemoveRequest().setType(NOTIF_MY_NEW_ISSUES);
private UserDto user;
call(request.setProject(branch.getDbKey()));
}
- private TestResponse call(RemoveRequest.Builder wsRequestBuilder) {
- RemoveRequest wsRequest = wsRequestBuilder.build();
-
+ private TestResponse call(RemoveRequest remove) {
TestRequest request = ws.newRequest();
- request.setParam(PARAM_TYPE, wsRequest.getType());
- setNullable(wsRequest.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel));
- setNullable(wsRequest.getProject(), project -> request.setParam(PARAM_PROJECT, project));
- setNullable(wsRequest.getLogin(), login -> request.setParam(PARAM_LOGIN, login));
+ request.setParam(PARAM_TYPE, remove.getType());
+ setNullable(remove.getChannel(), channel -> request.setParam(PARAM_CHANNEL, channel));
+ setNullable(remove.getProject(), project -> request.setParam(PARAM_PROJECT, project));
+ setNullable(remove.getLogin(), login -> request.setParam(PARAM_LOGIN, login));
return request.execute();
}
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_NAME;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_URL;
public class CreateActionTest {
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_ID;
public class DeleteActionTest {
import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
import static org.sonar.server.ws.KeyExamples.KEY_PROJECT_EXAMPLE_001;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.projectlink.ws.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
public class SearchActionTest {
import static org.sonar.db.metric.MetricTesting.newMetricDto;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES;
import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.PERCENT;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_GATE_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_GATE_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING;
public class CreateConditionActionTest {
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
public class DeleteConditionActionTest {
import static org.sonar.db.measure.MeasureTesting.newMeasureDto;
import static org.sonar.db.metric.MetricTesting.newMetricDto;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ANALYSIS_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PROJECT_KEY;
public class ProjectStatusActionTest {
private static final String ANALYSIS_ID = "task-uuid";
import static org.sonar.db.metric.MetricTesting.newMetricDto;
import static org.sonar.db.permission.OrganizationPermission.ADMINISTER_QUALITY_GATES;
import static org.sonar.server.computation.task.projectanalysis.metric.Metric.MetricType.PERCENT;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ERROR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_METRIC;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_OPERATOR;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PERIOD;
-import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_WARNING;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ERROR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_ID;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_METRIC;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_OPERATOR;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_PERIOD;
+import static org.sonar.server.qualitygate.ws.QualityGatesWsParameters.PARAM_WARNING;
public class UpdateConditionActionTest {
import static org.sonar.db.user.UserTesting.newUserDto;
import static org.sonar.db.user.UserTokenTesting.newUserToken;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME;
public class GenerateActionTest {
private static final String GRACE_HOPPER = "grace.hopper";
import static org.assertj.core.api.Assertions.assertThat;
import static org.sonar.db.user.UserTokenTesting.newUserToken;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_NAME;
public class RevokeActionTest {
import static org.sonar.db.user.UserTesting.newUserDto;
import static org.sonar.db.user.UserTokenTesting.newUserToken;
import static org.sonar.test.JsonAssert.assertJson;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN;
+import static org.sonar.server.usertoken.ws.UserTokensWsParameters.PARAM_LOGIN;
public class SearchActionTest {
private static final String GRACE_HOPPER = "grace.hopper";
import org.sonarqube.ws.client.ce.CeService;
import org.sonarqube.ws.client.component.ComponentsService;
-import org.sonarqube.ws.client.favorite.FavoritesService;
+import org.sonarqube.ws.client.favorites.FavoritesService;
import org.sonarqube.ws.client.issue.IssuesService;
import org.sonarqube.ws.client.measure.MeasuresService;
+import org.sonarqube.ws.client.notifications.NotificationsService;
import org.sonarqube.ws.client.organization.OrganizationService;
import org.sonarqube.ws.client.permission.PermissionsService;
import org.sonarqube.ws.client.project.ProjectsService;
import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
-import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld;
+import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofile.QualityProfilesService;
import org.sonarqube.ws.client.root.RootsService;
import org.sonarqube.ws.client.rule.RulesService;
import org.sonarqube.ws.client.setting.SettingsService;
-import org.sonarqube.ws.client.system.SystemServiceOld;
+import org.sonarqube.ws.client.system.SystemService;
import org.sonarqube.ws.client.user.UsersService;
import org.sonarqube.ws.client.usergroup.UserGroupsService;
-import org.sonarqube.ws.client.usertoken.UserTokensService;
-import org.sonarqube.ws.client.webhook.WebhooksService;
+import org.sonarqube.ws.client.usertokens.UserTokensService;
+import org.sonarqube.ws.client.webhooks.WebhooksService;
/**
* This class is not public anymore since version 5.5. It is
private final UserTokensService userTokensService;
private final QualitygatesService qualityGatesService;
private final MeasuresService measuresService;
- private final SystemServiceOld systemService;
+ private final SystemService systemService;
private final CeService ceService;
private final RulesService rulesService;
private final ProjectsService projectsService;
private final RootsService rootsService;
private final WebhooksService webhooksService;
private final ProjectAnalysisService projectAnalysisService;
- private final ProjectBranchesServiceOld projectBranchesService;
+ private final NotificationsService notificationsService;
+ private final ProjectBranchesService projectBranchesService;
DefaultWsClient(WsConnector wsConnector) {
this.wsConnector = wsConnector;
this.userTokensService = new UserTokensService(wsConnector);
this.qualityGatesService = new QualitygatesService(wsConnector);
this.measuresService = new MeasuresService(wsConnector);
- this.systemService = new SystemServiceOld(wsConnector);
+ this.systemService = new SystemService(wsConnector);
this.ceService = new CeService(wsConnector);
this.rulesService = new RulesService(wsConnector);
this.projectsService = new ProjectsService(wsConnector);
this.rootsService = new RootsService(wsConnector);
this.webhooksService = new WebhooksService(wsConnector);
this.projectAnalysisService = new ProjectAnalysisService(wsConnector);
- this.projectBranchesService = new ProjectBranchesServiceOld(wsConnector);
+ this.projectBranchesService = new ProjectBranchesService(wsConnector);
+ this.notificationsService = new NotificationsService(wsConnector);
}
@Override
}
@Override
- public SystemServiceOld system() {
+ public SystemService system() {
return systemService;
}
}
@Override
- public ProjectBranchesServiceOld projectBranches() {
+ public ProjectBranchesService projectBranches() {
return projectBranchesService;
}
+
+ @Override
+ public NotificationsService notifications() {
+ return notificationsService;
+ }
}
import org.sonarqube.ws.client.ce.CeService;
import org.sonarqube.ws.client.component.ComponentsService;
-import org.sonarqube.ws.client.favorite.FavoritesService;
+import org.sonarqube.ws.client.favorites.FavoritesService;
import org.sonarqube.ws.client.issue.IssuesService;
import org.sonarqube.ws.client.measure.MeasuresService;
+import org.sonarqube.ws.client.notifications.NotificationsService;
import org.sonarqube.ws.client.organization.OrganizationService;
import org.sonarqube.ws.client.permission.PermissionsService;
import org.sonarqube.ws.client.project.ProjectsService;
import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
-import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld;
+import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofile.QualityProfilesService;
import org.sonarqube.ws.client.root.RootsService;
import org.sonarqube.ws.client.rule.RulesService;
import org.sonarqube.ws.client.setting.SettingsService;
-import org.sonarqube.ws.client.system.SystemServiceOld;
+import org.sonarqube.ws.client.system.SystemService;
import org.sonarqube.ws.client.user.UsersService;
import org.sonarqube.ws.client.usergroup.UserGroupsService;
-import org.sonarqube.ws.client.usertoken.UserTokensService;
-import org.sonarqube.ws.client.webhook.WebhooksService;
+import org.sonarqube.ws.client.usertokens.UserTokensService;
+import org.sonarqube.ws.client.webhooks.WebhooksService;
/**
* Allows to request the web services of SonarQube server. Instance is provided by
IssuesService issues();
+ NotificationsService notifications();
+
PermissionsService permissions();
QualityProfilesService qualityProfiles();
MeasuresService measures();
- SystemServiceOld system();
+ SystemService system();
CeService ce();
/**
* @since 6.6>
*/
- ProjectBranchesServiceOld projectBranches();
+ ProjectBranchesService projectBranches();
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.ce;
-
-public class CeWsParameters {
-
- public static final String ACTION_WORKER_COUNT = "worker_count";
-
- public static final String PARAM_COMPONENT_ID = "componentId";
- public static final String DEPRECATED_PARAM_COMPONENT_KEY = "componentKey";
- public static final String PARAM_COMPONENT = "component";
- public static final String PARAM_COMPONENT_QUERY = "componentQuery";
- public static final String PARAM_TYPE = "type";
- public static final String PARAM_STATUS = "status";
- public static final String PARAM_ONLY_CURRENTS = "onlyCurrents";
- public static final String PARAM_MIN_SUBMITTED_AT = "minSubmittedAt";
- public static final String PARAM_MAX_EXECUTED_AT = "maxExecutedAt";
-
- private CeWsParameters() {
- // prevent instantiation
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.ce;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.favorite;
-
-import org.sonar.api.server.ws.WebService.Param;
-import org.sonarqube.ws.Favorites.SearchResponse;
-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.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_ADD;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_REMOVE;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.CONTROLLER_FAVORITES;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT;
-
-public class FavoritesService extends BaseService {
- public FavoritesService(WsConnector wsConnector) {
- super(wsConnector, CONTROLLER_FAVORITES);
- }
-
- public void add(String component) {
- PostRequest post = new PostRequest(path(ACTION_ADD)).setParam(PARAM_COMPONENT, component);
-
- call(post);
- }
-
- public void remove(String component) {
- PostRequest post = new PostRequest(path(ACTION_REMOVE)).setParam(PARAM_COMPONENT, component);
-
- call(post);
- }
-
- public SearchResponse search(SearchRequest request) {
- GetRequest get = new GetRequest(path(ACTION_SEARCH));
- if (request.getPage() != null) {
- get.setParam(Param.PAGE, request.getPage());
- }
- if (request.getPageSize() != null) {
- get.setParam(Param.PAGE_SIZE, request.getPageSize());
- }
-
- return call(get, SearchResponse.parser());
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.favorite;
-
-public class FavoritesWsParameters {
- public static final String CONTROLLER_FAVORITES = "api/favorites";
-
- public static final String ACTION_ADD = "add";
- public static final String ACTION_REMOVE = "remove";
- public static final String ACTION_SEARCH = "search";
-
- public static final String PARAM_COMPONENT = "component";
-
- private FavoritesWsParameters() {
- // prevent instantiation
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.favorite;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class SearchRequest {
- public static final int MAX_PAGE_SIZE = 500;
-
- private Integer page;
- private Integer pageSize;
-
- @CheckForNull
- public Integer getPage() {
- return page;
- }
-
- public SearchRequest setPage(@Nullable Integer page) {
- this.page = page;
- return this;
- }
-
- @CheckForNull
- public Integer getPageSize() {
- return pageSize;
- }
-
- public SearchRequest setPageSize(@Nullable Integer pageSize) {
- if (pageSize != null && pageSize > MAX_PAGE_SIZE) {
- throw new IllegalArgumentException("Page size must be lower than or equals to " + MAX_PAGE_SIZE);
- }
- this.pageSize = pageSize;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.favorite;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.notification;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static java.util.Objects.requireNonNull;
-
-public class AddRequest {
- private final String type;
- private final String channel;
- private final String project;
- private final String login;
-
- private AddRequest(Builder builder) {
- this.channel = builder.channel;
- this.type = builder.type;
- this.project = builder.project;
- this.login = builder.login;
- }
-
- public String getType() {
- return type;
- }
-
- @CheckForNull
- public String getChannel() {
- return channel;
- }
-
- @CheckForNull
- public String getProject() {
- return project;
- }
-
- @CheckForNull
- public String getLogin() {
- return login;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String type;
- private String channel;
- private String project;
- private String login;
-
- private Builder() {
- // enforce factory method
- }
-
- public Builder setType(String type) {
- this.type = type;
- return this;
- }
-
- public Builder setChannel(@Nullable String channel) {
- this.channel = channel;
- return this;
- }
-
- public Builder setProject(@Nullable String project) {
- this.project = project;
- return this;
- }
-
- public Builder setLogin(@Nullable String login) {
- this.login = login;
- return this;
- }
-
- public AddRequest build() {
- requireNonNull(type, "Notification is required");
- return new AddRequest(this);
- }
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.notification;
-
-public class NotificationsWsParameters {
- public static final String CONTROLLER = "api/notifications";
- public static final String ACTION_ADD = "add";
- public static final String ACTION_REMOVE = "remove";
- public static final String ACTION_LIST = "list";
-
- public static final String PARAM_PROJECT = "project";
- public static final String PARAM_CHANNEL = "channel";
- public static final String PARAM_TYPE = "type";
- public static final String PARAM_LOGIN = "login";
-
- private NotificationsWsParameters() {
- // prevent instantiation
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.notification;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import static java.util.Objects.requireNonNull;
-
-public class RemoveRequest {
- private final String type;
- private final String channel;
- private final String project;
- private final String login;
-
- private RemoveRequest(Builder builder) {
- this.channel = builder.channel;
- this.type = builder.type;
- this.project = builder.project;
- this.login = builder.login;
- }
-
- public String getType() {
- return type;
- }
-
- @CheckForNull
- public String getChannel() {
- return channel;
- }
-
- @CheckForNull
- public String getProject() {
- return project;
- }
-
- @CheckForNull
- public String getLogin() {
- return login;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String type;
- private String channel;
- private String project;
- private String login;
-
- private Builder() {
- // enforce factory method
- }
-
- public Builder setType(String type) {
- this.type = type;
- return this;
- }
-
- public Builder setChannel(@Nullable String channel) {
- this.channel = channel;
- return this;
- }
-
- public Builder setProject(@Nullable String project) {
- this.project = project;
- return this;
- }
-
- public Builder setLogin(@Nullable String login) {
- this.login = login;
- return this;
- }
-
- public RemoveRequest build() {
- requireNonNull(type, "Notification is required");
- return new RemoveRequest(this);
- }
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.notification;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectbranches;
-
-public class ProjectBranchesParameters {
-
- public static final String CONTROLLER = "api/project_branches";
-
- // actions
- public static final String ACTION_LIST = "list";
- public static final String ACTION_SHOW = "show";
- public static final String ACTION_DELETE = "delete";
- public static final String ACTION_RENAME = "rename";
-
- // parameters
- public static final String PARAM_PROJECT = "project";
- public static final String PARAM_COMPONENT = "component";
- public static final String PARAM_BRANCH = "branch";
- public static final String PARAM_NAME = "name";
-
- private ProjectBranchesParameters() {
- // static utility class
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectbranches;
-
-import org.sonarqube.ws.ProjectBranches.ListWsResponse;
-import org.sonarqube.ws.ProjectBranches.ShowWsResponse;
-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.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_DELETE;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_LIST;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_RENAME;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.ACTION_SHOW;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.CONTROLLER;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
-
-public class ProjectBranchesServiceOld extends BaseService {
-
- public ProjectBranchesServiceOld(WsConnector wsConnector) {
- super(wsConnector, CONTROLLER);
- }
-
- public ListWsResponse list(String project) {
- GetRequest get = new GetRequest(path(ACTION_LIST))
- .setParam(PARAM_PROJECT, project);
- return call(get, ListWsResponse.parser());
- }
-
- public ShowWsResponse show(String project, String branch) {
- GetRequest get = new GetRequest(path(ACTION_SHOW))
- .setParam(PARAM_PROJECT, project)
- .setParam(PARAM_BRANCH, branch);
- return call(get, ShowWsResponse.parser());
- }
-
- public void delete(String project, String branch) {
- PostRequest post = new PostRequest(path(ACTION_DELETE))
- .setParam(PARAM_PROJECT, project)
- .setParam(PARAM_BRANCH, branch);
- call(post);
- }
-
- public void rename(String project, String name) {
- PostRequest post = new PostRequest(path(ACTION_RENAME))
- .setParam(PARAM_PROJECT, project)
- .setParam(PARAM_NAME, name);
- call(post);
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.projectbranches;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectlinks;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class CreateWsRequest {
- private String projectId;
- private String projectKey;
- private String name;
- private String url;
-
- @CheckForNull
- public String getProjectId() {
- return projectId;
- }
-
- public CreateWsRequest setProjectId(@Nullable String projectId) {
- this.projectId = projectId;
- return this;
- }
-
- @CheckForNull
- public String getProjectKey() {
- return projectKey;
- }
-
- public CreateWsRequest setProjectKey(@Nullable String projectKey) {
- this.projectKey = projectKey;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public CreateWsRequest setName(String name) {
- this.name = name;
- return this;
- }
-
- public String getUrl() {
- return url;
- }
-
- public CreateWsRequest setUrl(String url) {
- this.url = url;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectlinks;
-
-public class DeleteWsRequest {
- private Long id;
-
- public Long getId() {
- return id;
- }
-
- public DeleteWsRequest setId(Long id) {
- this.id = id;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectlinks;
-
-import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
-import org.sonarqube.ws.ProjectLinks.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.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_CREATE;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_DELETE;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL;
-
-public class ProjectLinksService extends BaseService {
-
- public ProjectLinksService(WsConnector wsConnector) {
- super(wsConnector, "api/project_links");
- }
-
- public SearchWsResponse search(SearchWsRequest request) {
- return call(new GetRequest(path(ACTION_SEARCH))
- .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
- .setParam(PARAM_PROJECT_ID, request.getProjectId()),
- SearchWsResponse.parser());
- }
-
- public CreateWsResponse create(CreateWsRequest request) {
- return call(new PostRequest(path(ACTION_CREATE))
- .setParam(PARAM_PROJECT_KEY, request.getProjectKey())
- .setParam(PARAM_PROJECT_ID, request.getProjectId())
- .setParam(PARAM_NAME, request.getName())
- .setParam(PARAM_URL, request.getUrl()),
- CreateWsResponse.parser());
- }
-
- public void delete(DeleteWsRequest request) {
- call(new PostRequest(path(ACTION_DELETE))
- .setParam(PARAM_ID, request.getId()));
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectlinks;
-
-public class ProjectLinksWsParameters {
-
- //actions
- public static final String ACTION_SEARCH = "search";
- public static final String ACTION_CREATE = "create";
- public static final String ACTION_DELETE = "delete";
-
- // parameters
- public static final String PARAM_PROJECT_ID = "projectId";
- public static final String PARAM_PROJECT_KEY = "projectKey";
- public static final String PARAM_ID = "id";
- public static final String PARAM_NAME = "name";
- public static final String PARAM_URL = "url";
-
- private ProjectLinksWsParameters() {
- // static utility class
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectlinks;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class SearchWsRequest {
- @CheckForNull
- private String projectId;
- @CheckForNull
- private String projectKey;
-
- @CheckForNull
- public String getProjectId() {
- return projectId;
- }
-
- public SearchWsRequest setProjectId(@Nullable String projectId) {
- this.projectId = projectId;
- return this;
- }
-
- @CheckForNull
- public String getProjectKey() {
- return projectKey;
- }
-
- public SearchWsRequest setProjectKey(@Nullable String projectKey) {
- this.projectKey = projectKey;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.projectlinks;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.qualitygate;
-
-public class QualityGatesWsParameters {
-
- public static final String CONTROLLER_QUALITY_GATES = "api/qualitygates";
-
- public static final String ACTION_PROJECT_STATUS = "project_status";
- public static final String ACTION_GET_BY_PROJECT = "get_by_project";
- public static final String ACTION_SELECT = "select";
- public static final String ACTION_CREATE = "create";
- public static final String ACTION_CREATE_CONDITION = "create_condition";
- public static final String ACTION_UPDATE_CONDITION = "update_condition";
-
- public static final String PARAM_ANALYSIS_ID = "analysisId";
- public static final String PARAM_PROJECT_ID = "projectId";
- public static final String PARAM_PROJECT_KEY = "projectKey";
- public static final String PARAM_PAGE_SIZE = "pageSize";
- public static final String PARAM_PAGE = "page";
- public static final String PARAM_QUERY = "query";
- public static final String PARAM_NAME = "name";
- public static final String PARAM_ERROR = "error";
- public static final String PARAM_WARNING = "warning";
- public static final String PARAM_PERIOD = "period";
- public static final String PARAM_OPERATOR = "op";
- public static final String PARAM_METRIC = "metric";
- public static final String PARAM_GATE_ID = "gateId";
- public static final String PARAM_ID = "id";
-
- private QualityGatesWsParameters() {
- // prevent instantiation
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.qualitygate;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.system;
-
-import org.sonarqube.ws.System;
-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 org.sonarqube.ws.client.WsResponse;
-
-public class SystemServiceOld extends BaseService {
- public SystemServiceOld(WsConnector wsConnector) {
- super(wsConnector, "api/system");
- }
-
- public System.HealthResponse health() {
- return call(new GetRequest(path("health")), System.HealthResponse.parser());
- }
-
- public void restart() {
- call(new PostRequest(path("restart")));
- }
-
- public System.StatusResponse status() {
- return call(new GetRequest(path("status")), System.StatusResponse.parser());
- }
-
- public void changeLogLevel(String level) {
- call(new PostRequest(path("change_log_level")).setParam("level", level));
- }
-
- public WsResponse info() {
- return call(new GetRequest(path("info")));
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.system;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.usertoken;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class GenerateWsRequest {
- private String login;
- private String name;
-
- @CheckForNull
- public String getLogin() {
- return login;
- }
-
- public GenerateWsRequest setLogin(@Nullable String login) {
- this.login = login;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public GenerateWsRequest setName(String name) {
- this.name = name;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.usertoken;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class RevokeWsRequest {
- private String login;
- private String name;
-
- @CheckForNull
- public String getLogin() {
- return login;
- }
-
- public RevokeWsRequest setLogin(@Nullable String login) {
- this.login = login;
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public RevokeWsRequest setName(String name) {
- this.name = name;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.usertoken;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class SearchWsRequest {
- private String login;
-
- @CheckForNull
- public String getLogin() {
- return login;
- }
-
- public SearchWsRequest setLogin(@Nullable String login) {
- this.login = login;
- return this;
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.usertoken;
-
-import org.sonarqube.ws.UserTokens.GenerateWsResponse;
-import org.sonarqube.ws.UserTokens.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.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_GENERATE;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_REVOKE;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.ACTION_SEARCH;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.CONTROLLER;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_LOGIN;
-import static org.sonarqube.ws.client.usertoken.UserTokensWsParameters.PARAM_NAME;
-
-public class UserTokensService extends BaseService {
-
- public UserTokensService(WsConnector wsConnector) {
- super(wsConnector, CONTROLLER);
- }
-
- public GenerateWsResponse generate(GenerateWsRequest request) {
- return call(
- new PostRequest(path(ACTION_GENERATE))
- .setParam(PARAM_LOGIN, request.getLogin())
- .setParam(PARAM_NAME, request.getName()),
- GenerateWsResponse.parser());
- }
-
- public SearchWsResponse search(SearchWsRequest request) {
- return call(
- new GetRequest(path(ACTION_SEARCH)).setParam(PARAM_LOGIN, request.getLogin()),
- SearchWsResponse.parser());
- }
-
- public void revoke(RevokeWsRequest request) {
- call(
- new PostRequest(path(ACTION_REVOKE))
- .setParam(PARAM_LOGIN, request.getLogin())
- .setParam(PARAM_NAME, request.getName()));
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.usertoken;
-
-public class UserTokensWsParameters {
- public static final String CONTROLLER = "api/user_tokens";
- public static final String ACTION_GENERATE = "generate";
- public static final String ACTION_REVOKE = "revoke";
- public static final String ACTION_SEARCH = "search";
-
- public static final String PARAM_LOGIN = "login";
- public static final String PARAM_NAME = "name";
-
- private UserTokensWsParameters() {
- // constants only
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.usertoken;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.webhook;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-@Immutable
-public class DeliveriesRequest {
-
- private final String componentKey;
- private final String ceTaskId;
-
- private DeliveriesRequest(Builder builder) {
- this.componentKey = builder.componentKey;
- this.ceTaskId = builder.ceTaskId;
- }
-
- @CheckForNull
- public String getComponentKey() {
- return componentKey;
- }
-
- @CheckForNull
- public String getCeTaskId() {
- return ceTaskId;
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public static class Builder {
- private String componentKey;
- private String ceTaskId;
-
- /**
- * @see #builder()
- */
- private Builder() {
- }
-
- public Builder setComponentKey(@Nullable String s) {
- this.componentKey = s;
- return this;
- }
-
- public Builder setCeTaskId(@Nullable String s) {
- this.ceTaskId = s;
- return this;
- }
-
- public DeliveriesRequest build() {
- return new DeliveriesRequest(this);
- }
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.webhook;
-
-import org.sonarqube.ws.Webhooks;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.WsConnector;
-
-/**
- * @since 6.2
- */
-public class WebhooksService extends BaseService {
-
- public WebhooksService(WsConnector wsConnector) {
- super(wsConnector, "api/webhooks");
- }
-
- public Webhooks.DeliveryWsResponse delivery(String deliveryId) {
- GetRequest httpRequest = new GetRequest(path("delivery"))
- .setParam("deliveryId", deliveryId);
- return call(httpRequest, Webhooks.DeliveryWsResponse.parser());
- }
-
- /**
- * @throws org.sonarqube.ws.client.HttpException if HTTP status code is not 2xx.
- */
- public Webhooks.DeliveriesWsResponse deliveries(DeliveriesRequest request) {
- GetRequest httpRequest = new GetRequest(path("deliveries"))
- .setParam("componentKey", request.getComponentKey())
- .setParam("ceTaskId", request.getCeTaskId());
- return call(httpRequest, Webhooks.DeliveriesWsResponse.parser());
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonarqube.ws.client.webhook;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.favorite;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.server.ws.WebService.Param;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.client.favorite.FavoritesWsParameters.PARAM_COMPONENT;
-
-public class FavoritesServiceTest {
- @Rule
- public ServiceTester<FavoritesService> serviceTester = new ServiceTester<>(new FavoritesService(mock(WsConnector.class)));
-
- private FavoritesService underTest = serviceTester.getInstanceUnderTest();
-
- @Test
- public void add() {
- underTest.add("my_project");
-
- serviceTester.assertThat(serviceTester.getPostRequest())
- .hasPath("add")
- .hasParam(PARAM_COMPONENT, "my_project")
- .andNoOtherParam();
- }
-
- @Test
- public void remove() {
- underTest.remove("my_project");
-
- serviceTester.assertThat(serviceTester.getPostRequest())
- .hasPath("remove")
- .hasParam(PARAM_COMPONENT, "my_project")
- .andNoOtherParam();
- }
-
- @Test
- public void search() {
- underTest.search(new SearchRequest().setPage(42).setPageSize(255));
-
- serviceTester.assertThat(serviceTester.getGetRequest())
- .hasPath("search")
- .hasParam(Param.PAGE, 42)
- .hasParam(Param.PAGE_SIZE, 255)
- .andNoOtherParam();
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.favorite;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-public class SearchRequestTest {
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- private SearchRequest underTest = new SearchRequest();
-
- @Test
- public void fail_if_page_size_greater_than_500() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("Page size must be lower than or equals to 500");
-
- underTest.setPageSize(501);
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectbranches;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.ProjectBranches.ListWsResponse;
-import org.sonarqube.ws.ProjectBranches.ShowWsResponse;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_BRANCH;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectbranches.ProjectBranchesParameters.PARAM_PROJECT;
-
-public class ProjectBranchesServiceTest {
-
- @Rule
- public ServiceTester<ProjectBranchesServiceOld> serviceTester = new ServiceTester<>(new ProjectBranchesServiceOld(mock(WsConnector.class)));
-
- private ProjectBranchesServiceOld underTest = serviceTester.getInstanceUnderTest();
-
- @Test
- public void list() {
- underTest.list("projectKey");
-
- assertThat(serviceTester.getGetParser()).isSameAs(ListWsResponse.parser());
-
- GetRequest getRequest = serviceTester.getGetRequest();
- serviceTester.assertThat(getRequest)
- .hasPath("list")
- .hasParam(PARAM_PROJECT, "projectKey")
- .andNoOtherParam();
- }
-
- @Test
- public void show() {
- underTest.show("projectKey", "my_branch");
-
- assertThat(serviceTester.getGetParser()).isSameAs(ShowWsResponse.parser());
-
- GetRequest getRequest = serviceTester.getGetRequest();
- serviceTester.assertThat(getRequest)
- .hasPath("show")
- .hasParam(PARAM_PROJECT, "projectKey")
- .hasParam(PARAM_BRANCH, "my_branch")
- .andNoOtherParam();
- }
-
- @Test
- public void delete() {
- underTest.delete("projectKey", "my_branch");
-
- PostRequest postRequest = serviceTester.getPostRequest();
- serviceTester.assertThat(postRequest)
- .hasPath("delete")
- .hasParam(PARAM_PROJECT, "projectKey")
- .hasParam(PARAM_BRANCH, "my_branch")
- .andNoOtherParam();
- }
-
- @Test
- public void rename() {
- underTest.rename("projectKey", "my_branch");
-
- PostRequest postRequest = serviceTester.getPostRequest();
- serviceTester.assertThat(postRequest)
- .hasPath("rename")
- .hasParam(PARAM_PROJECT, "projectKey")
- .hasParam(PARAM_NAME, "my_branch")
- .andNoOtherParam();
- }
-
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.projectlinks;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
-import org.sonarqube.ws.ProjectLinks.SearchWsResponse;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_NAME;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_ID;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_PROJECT_KEY;
-import static org.sonarqube.ws.client.projectlinks.ProjectLinksWsParameters.PARAM_URL;
-
-public class ProjectLinksServiceTest {
- private static final String PROJECT_ID_VALUE = "project_id_value";
- private static final String PROJECT_KEY_VALUE = "project_key_value";
- private static final String NAME_VALUE = "name_value";
- private static final String URL_VALUE = "url_value";
- private static final long ID_VALUE = 175;
-
- @Rule
- public ServiceTester<ProjectLinksService> serviceTester = new ServiceTester<>(new ProjectLinksService(mock(WsConnector.class)));
-
- private ProjectLinksService underTest = serviceTester.getInstanceUnderTest();
-
- @Test
- public void search_does_GET_request() {
- underTest.search(new SearchWsRequest()
- .setProjectId(PROJECT_ID_VALUE)
- .setProjectKey(PROJECT_KEY_VALUE));
-
- assertThat(serviceTester.getGetParser()).isSameAs(SearchWsResponse.parser());
-
- GetRequest getRequest = serviceTester.getGetRequest();
-
- serviceTester.assertThat(getRequest)
- .hasPath("search")
- .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE)
- .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE)
- .andNoOtherParam();
- }
-
- @Test
- public void create_does_POST_request() {
- underTest.create(new CreateWsRequest()
- .setProjectId(PROJECT_ID_VALUE)
- .setProjectKey(PROJECT_KEY_VALUE)
- .setName(NAME_VALUE)
- .setUrl(URL_VALUE));
-
- assertThat(serviceTester.getPostParser()).isSameAs(CreateWsResponse.parser());
-
- PostRequest postRequest = serviceTester.getPostRequest();
-
- serviceTester.assertThat(postRequest)
- .hasPath("create")
- .hasParam(PARAM_PROJECT_ID, PROJECT_ID_VALUE)
- .hasParam(PARAM_PROJECT_KEY, PROJECT_KEY_VALUE)
- .hasParam(PARAM_NAME, NAME_VALUE)
- .hasParam(PARAM_URL, URL_VALUE)
- .andNoOtherParam();
- }
-
- @Test
- public void delete_does_POST_request() {
- underTest.delete(new DeleteWsRequest().setId(ID_VALUE));
-
- assertThat(serviceTester.getPostParser()).isNull();
-
- PostRequest postRequest = serviceTester.getPostRequest();
-
- serviceTester.assertThat(postRequest)
- .hasPath("delete")
- .hasParam(PARAM_ID, String.valueOf(ID_VALUE))
- .andNoOtherParam();
- }
-}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * 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.system;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.ServiceTester;
-import org.sonarqube.ws.client.WsConnector;
-
-import static org.mockito.Mockito.mock;
-
-public class SystemServiceTest {
-
- @Rule
- public ServiceTester<SystemServiceOld> serviceTester = new ServiceTester<>(new SystemServiceOld(mock(WsConnector.class)));
-
- private SystemServiceOld underTest = serviceTester.getInstanceUnderTest();
-
- @Test
- public void test_health() throws Exception {
- underTest.health();
-
- GetRequest getRequest = serviceTester.getGetRequest();
- serviceTester.assertThat(getRequest)
- .hasPath("health")
- .andNoOtherParam();
- }
-
- @Test
- public void test_status() throws Exception {
- underTest.status();
-
- GetRequest getRequest = serviceTester.getGetRequest();
- serviceTester.assertThat(getRequest)
- .hasPath("status")
- .andNoOtherParam();
- }
-
- @Test
- public void test_restart() throws Exception {
- underTest.restart();
-
- PostRequest postRequest = serviceTester.getPostRequest();
- serviceTester.assertThat(postRequest)
- .hasPath("restart")
- .andNoOtherParam();
- }
-
- @Test
- public void test_changeLogLevel() throws Exception {
- underTest.changeLogLevel("TRACE");
-
- PostRequest postRequest = serviceTester.getPostRequest();
- serviceTester.assertThat(postRequest)
- .hasPath("change_log_level")
- .hasParam("level", "TRACE")
- .andNoOtherParam();
- }
-
- @Test
- public void test_info() throws Exception {
- underTest.info();
-
- GetRequest getRequest = serviceTester.getGetRequest();
- serviceTester.assertThat(getRequest)
- .hasPath("info")
- .andNoOtherParam();
- }
-}
import org.sonarqube.ws.Favorites.Favorite;
import org.sonarqube.ws.Permissions;
import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.favorite.SearchRequest;
+import org.sonarqube.ws.client.favorites.SearchRequest;
import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest;
import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateWsRequest;
import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.MavenBuild;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category3Suite;
import java.util.List;
import java.util.Optional;
import org.junit.After;
import org.junit.ClassRule;
import org.junit.Test;
+import org.sonarqube.tests.Category3Suite;
import org.sonarqube.ws.ProjectLinks;
import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.projectlinks.SearchWsRequest;
+import org.sonarqube.ws.client.projectlinks.SearchRequest;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
private void verifyLinks() {
WsClient wsClient = ItUtils.newWsClient(orchestrator);
- List<ProjectLinks.Link> links = wsClient.projectLinks().search(new SearchWsRequest().setProjectKey(PROJECT_KEY)).getLinksList();
+ List<ProjectLinks.Link> links = wsClient.projectLinks().search(new SearchRequest().setProjectKey(PROJECT_KEY)).getLinksList();
verifyLink(links, "homepage", "http://www.simplesample.org_OVERRIDDEN");
verifyLink(links, "ci", "http://bamboo.ci.codehaus.org/browse/SIMPLESAMPLE");
verifyLink(links, "issue", "http://jira.codehaus.org/browse/SIMPLESAMPLE");
import org.sonarqube.ws.UserTokens;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.permission.AddUserWsRequest;
-import org.sonarqube.ws.client.usertoken.GenerateWsRequest;
-import org.sonarqube.ws.client.usertoken.RevokeWsRequest;
-import org.sonarqube.ws.client.usertoken.UserTokensService;
+import org.sonarqube.ws.client.usertokens.GenerateRequest;
+import org.sonarqube.ws.client.usertokens.RevokeRequest;
+import org.sonarqube.ws.client.usertokens.UserTokensService;
import util.user.UserRule;
import static org.assertj.core.api.Assertions.assertThat;
createUserWithProvisioningAndScanPermissions();
String tokenName = "For test";
- UserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest()
+ UserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateRequest()
.setLogin(A_LOGIN)
.setName(tokenName));
SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample"));
BuildResult buildResult = orchestrator.executeBuild(sampleProject);
assertThat(buildResult.isSuccess()).isTrue();
- userTokensWsClient.revoke(new RevokeWsRequest().setLogin(A_LOGIN).setName(tokenName));
+ userTokensWsClient.revoke(new RevokeRequest().setLogin(A_LOGIN).setName(tokenName));
}
@Test
import org.sonarqube.ws.ProjectBranches;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
+import org.sonarqube.ws.client.projectbranches.ListRequest;
import util.ItUtils;
import static org.assertj.core.api.Java6Assertions.assertThat;
public void list_branches_contains_main_branch() {
runProjectAnalysis(orchestrator, "shared/xoo-sample");
- ProjectBranches.ListWsResponse result = tester.wsClient().projectBranches().list("sample");
+ ProjectBranches.ListWsResponse result = tester.wsClient().projectBranches().list(new ListRequest().setProject("sample"));
assertThat(result.getBranchesList())
.extracting(ProjectBranches.Branch::getName, ProjectBranches.Branch::getType, ProjectBranches.Branch::getIsMain)
import org.sonarqube.qa.util.pageobjects.ProjectLinkItem;
import org.sonarqube.qa.util.pageobjects.ProjectLinksPage;
import org.sonarqube.ws.ProjectLinks.CreateWsResponse;
-import org.sonarqube.ws.client.projectlinks.CreateWsRequest;
-import org.sonarqube.ws.client.projectlinks.DeleteWsRequest;
+import org.sonarqube.ws.client.projectlinks.CreateRequest;
+import org.sonarqube.ws.client.projectlinks.DeleteRequest;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
}
private CreateWsResponse createCustomLink() {
- return tester.wsClient().projectLinks().create(new CreateWsRequest()
+ return tester.wsClient().projectLinks().create(new CreateRequest()
.setProjectKey("sample")
.setName("Custom")
.setUrl("http://example.org/custom"));
private void deleteLink(long id) {
try {
- tester.wsClient().projectLinks().delete(new DeleteWsRequest().setId(id));
+ tester.wsClient().projectLinks().delete(new DeleteRequest().setId("" + id));
} catch (Exception e) {
// fail silently
}
import org.sonarqube.ws.Users;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
+import org.sonarqube.ws.client.favorites.AddRequest;
+import org.sonarqube.ws.client.favorites.RemoveRequest;
import static com.codeborne.selenide.Selenide.clearBrowserLocalStorage;
import static com.codeborne.selenide.WebDriverRunner.url;
// favorite one project
WsClient administratorWsClient = tester.as(administrator.getLogin()).wsClient();
- administratorWsClient.favorites().add(PROJECT_KEY);
+ administratorWsClient.favorites().add(new AddRequest().setComponent(PROJECT_KEY));
page = nav.openProjects();
page.shouldHaveTotal(1).shouldDisplayFavoriteProjects();
// un-favorite this project
- administratorWsClient.favorites().remove(PROJECT_KEY);
+ administratorWsClient.favorites().remove(new RemoveRequest().setComponent(PROJECT_KEY));
page = nav.openProjects();
page.shouldHaveTotal(2).shouldDisplayAllProjects();
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category4Suite;
import java.util.List;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
+import org.sonarqube.tests.Category4Suite;
import org.sonarqube.ws.Favorites.Favorite;
import org.sonarqube.ws.client.WsClient;
-import org.sonarqube.ws.client.favorite.SearchRequest;
+import org.sonarqube.ws.client.favorites.AddRequest;
+import org.sonarqube.ws.client.favorites.RemoveRequest;
+import org.sonarqube.ws.client.favorites.SearchRequest;
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.newAdminWsClient;
assertThat(favorites).isEmpty();
// POST (create favorites)
- adminClient.favorites().add("sample");
- adminClient.favorites().add("sample:src/main/xoo/sample/Sample.xoo");
+ adminClient.favorites().add(new AddRequest().setComponent("sample"));
+ adminClient.favorites().add(new AddRequest().setComponent("sample:src/main/xoo/sample/Sample.xoo"));
// GET (created favorites)
favorites = adminClient.favorites().search(new SearchRequest()).getFavoritesList();
assertThat(favorites.stream().map(Favorite::getKey)).containsOnly("sample", "sample:src/main/xoo/sample/Sample.xoo");
// DELETE (a favorite)
- adminClient.favorites().remove("sample");
+ adminClient.favorites().remove(new RemoveRequest().setComponent("sample"));
favorites = adminClient.favorites().search(new SearchRequest()).getFavoritesList();
assertThat(favorites.stream().map(Favorite::getKey)).containsOnly("sample:src/main/xoo/sample/Sample.xoo");
}
import org.sonarqube.ws.client.WsClientFactories;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.ws.client.user.CreateRequest;
-import org.sonarqube.ws.client.usertoken.GenerateWsRequest;
-import org.sonarqube.ws.client.usertoken.RevokeWsRequest;
-import org.sonarqube.ws.client.usertoken.SearchWsRequest;
-import org.sonarqube.ws.client.usertoken.UserTokensService;
+import org.sonarqube.ws.client.usertokens.GenerateRequest;
+import org.sonarqube.ws.client.usertokens.RevokeRequest;
+import org.sonarqube.ws.client.usertokens.SearchRequest;
+import org.sonarqube.ws.client.usertokens.UserTokensService;
import util.selenium.Selenese;
import static java.lang.String.format;
User user = tester.users().generate();
String tokenName = "Validate token based authentication";
UserTokensService tokensService = tester.wsClient().userTokens();
- UserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateWsRequest()
+ UserTokens.GenerateWsResponse generateWsResponse = tokensService.generate(new GenerateRequest()
.setLogin(user.getLogin())
.setName(tokenName));
WsClient wsClient = WsClientFactories.getDefault().newClient(HttpConnector.newBuilder()
assertThat(response.content()).isEqualTo("{\"valid\":true}");
- UserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin()));
+ UserTokens.SearchWsResponse searchResponse = tokensService.search(new SearchRequest().setLogin(user.getLogin()));
assertThat(searchResponse.getUserTokensCount()).isEqualTo(1);
- tokensService.revoke(new RevokeWsRequest().setLogin(user.getLogin()).setName(tokenName));
- searchResponse = tokensService.search(new SearchWsRequest().setLogin(user.getLogin()));
+ tokensService.revoke(new RevokeRequest().setLogin(user.getLogin()).setName(tokenName));
+ searchResponse = tokensService.search(new SearchRequest().setLogin(user.getLogin()));
assertThat(searchResponse.getUserTokensCount()).isEqualTo(0);
}
import org.sonarqube.ws.client.project.DeleteRequest;
import org.sonarqube.ws.client.setting.ResetRequest;
import org.sonarqube.ws.client.setting.SetRequest;
-import org.sonarqube.ws.client.webhook.DeliveriesRequest;
+import org.sonarqube.ws.client.webhooks.DeliveriesRequest;
+import org.sonarqube.ws.client.webhooks.DeliveryRequest;
import util.ItUtils;
import static java.util.Objects.requireNonNull;
}
private List<Webhooks.Delivery> getPersistedDeliveries() {
- DeliveriesRequest deliveriesReq = DeliveriesRequest.builder().setComponentKey(PROJECT_KEY).build();
+ DeliveriesRequest deliveriesReq = new DeliveriesRequest().setComponentKey(PROJECT_KEY);
return adminWs.webhooks().deliveries(deliveriesReq).getDeliveriesList();
}
}
private Webhooks.Delivery getDetailOfPersistedDelivery(Webhooks.Delivery delivery) {
- Webhooks.Delivery detail = adminWs.webhooks().delivery(delivery.getId()).getDelivery();
+ Webhooks.Delivery detail = adminWs.webhooks().delivery(new DeliveryRequest().setDeliveryId(delivery.getId())).getDelivery();
return requireNonNull(detail);
}