From: Daniel Schwarz
Date: Mon, 4 Dec 2017 16:59:44 +0000 (+0100)
Subject: Generate class WsClient in sonar-ws
X-Git-Tag: 7.0-RC1~182
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7b767314a706c363ba466572d2fe8e7d46004b6a;p=sonarqube.git
Generate class WsClient in sonar-ws
---
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
index 66ef0f036db..a90e2f36925 100644
--- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
+++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
@@ -42,7 +42,7 @@ public class QGateTester {
}
public QualitygatesService service() {
- return session.wsClient().qualityGates();
+ return session.wsClient().qualitygates();
}
void deleteAll() {
@@ -55,7 +55,7 @@ public class QGateTester {
public Qualitygates.CreateResponse generate() {
int id = ID_GENERATOR.getAndIncrement();
- return session.wsClient().qualityGates().create(new CreateRequest().setName("QualityGate" + id));
+ return session.wsClient().qualitygates().create(new CreateRequest().setName("QualityGate" + id));
}
public void associateProject(Qualitygates.CreateResponse qualityGate, Project project){
diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java
index aebeabf2323..577ff739c36 100644
--- a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java
+++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java
@@ -30,26 +30,31 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.Writer;
-import java.util.HashSet;
import java.util.Properties;
-import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.util.Arrays.asList;
+import static org.sonarqube.wsgenerator.Helper.PATH_EXCLUSIONS;
public class CodeFormatter {
- private static final Set PATH_EXCLUSIONS = new HashSet<>(asList("api/orchestrator"));
-
public static void format(String json) {
JsonObject jsonElement = new Gson().fromJson(json, JsonObject.class);
JsonArray webServices = (JsonArray) jsonElement.get("webServices");
Helper helper = new Helper();
+ VelocityContext globalContext = new VelocityContext();
+ globalContext.put("webServices", webServices);
+ globalContext.put("helper", helper);
+ String defaultWsClientCode = applyTemplate("defaultWsClient.vm", globalContext);
+ writeSourceFile(helper.defaultWsClientFile(), defaultWsClientCode);
+ String wsClientCode = applyTemplate("wsClient.vm", globalContext);
+ writeSourceFile(helper.wsClientFile(), wsClientCode);
+ writeSourceFile(helper.packageInfoFile(), applyTemplate("package-info.vm", globalContext));
+
for (JsonElement webServiceElement : webServices) {
JsonObject webService = (JsonObject) webServiceElement;
String webServicePath = webService.get("path").getAsString();
diff --git a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java
index e38ea016dcf..62190c14c54 100644
--- a/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java
+++ b/sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java
@@ -25,13 +25,18 @@ import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static java.util.Arrays.asList;
+
public class Helper {
+ static final Set PATH_EXCLUSIONS = new HashSet<>(asList("api/orchestrator"));
private static final String OUTPUT_DIR = "target/generated-sources/results";
private final Map> responseTypes;
@@ -43,8 +48,16 @@ public class Helper {
.collect(Collectors.groupingBy(arr -> arr[0]));
}
+ public boolean isIncluded(String path) {
+ return !PATH_EXCLUSIONS.contains(path);
+ }
+
+ public String packageName() {
+ return "org.sonarqube.ws.client";
+ }
+
public String packageName(String path) {
- return "org.sonarqube.ws.client." + rawName(path).toLowerCase();
+ return packageName() + "." + rawName(path).toLowerCase();
}
private String rawName(String path) {
@@ -59,6 +72,19 @@ public class Helper {
String name = rawName(path);
return capitalizeFirstLetter(name) + "Service";
}
+ public String defaultWsClientFieldName(String path) {
+ String name = rawName(path);
+ return lowercaseFirstLetter(name) + "Service";
+ }
+
+ public String defaultWsClientMethodName(String path) {
+ String name = rawName(path);
+ return lowercaseFirstLetter(name);
+ }
+
+ public String webserviceTypeImport(String path) {
+ return "import " + packageName(path) + "." + className(path) + ";";
+ }
private String capitalizeFirstLetter(String name) {
return name.substring(0, 1).toUpperCase() + name.substring(1);
@@ -164,6 +190,18 @@ public class Helper {
return OUTPUT_DIR + "/org/sonarqube/ws/client/" + rawName(path).toLowerCase() + "/" + className(path) + ".java";
}
+ public String defaultWsClientFile() {
+ return OUTPUT_DIR + "/org/sonarqube/ws/client/DefaultWsClient.java";
+ }
+
+ public String wsClientFile() {
+ return OUTPUT_DIR + "/org/sonarqube/ws/client/WsClient.java";
+ }
+
+ public String packageInfoFile() {
+ return OUTPUT_DIR + "/org/sonarqube/ws/client/package-info.java";
+ }
+
public String packageInfoFile(String path) {
return OUTPUT_DIR + "/org/sonarqube/ws/client/" + rawName(path).toLowerCase() + "/package-info.java";
}
diff --git a/sonar-ws-generator/src/main/resources/defaultWsClient.vm b/sonar-ws-generator/src/main/resources/defaultWsClient.vm
new file mode 100644
index 00000000000..eb5b11a3c0e
--- /dev/null
+++ b/sonar-ws-generator/src/main/resources/defaultWsClient.vm
@@ -0,0 +1,79 @@
+/*
+ * 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;
+
+import javax.annotation.Generated;
+import org.sonarqube.ws.client.ce.CeService;
+import org.sonarqube.ws.client.organization.OrganizationService;
+import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
+import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld;
+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.system.SystemServiceOld;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+$helper.webserviceTypeImport($webService.path.asString)
+#end
+#end
+
+/**
+ * This class is not public anymore since version 5.5. It is
+ * created by {@link WsClientFactory}
+ *
+ * @since 5.3
+ */
+@Generated("sonar-ws-generator")
+class DefaultWsClient implements WsClient {
+
+ private final WsConnector wsConnector;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+ private final $helper.className($webService.path.asString) $helper.defaultWsClientFieldName($webService.path.asString);
+#end
+#end
+
+ DefaultWsClient(WsConnector wsConnector) {
+ this.wsConnector = wsConnector;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+ this.$helper.defaultWsClientFieldName($webService.path.asString) = new $helper.className($webService.path.asString)(wsConnector);
+#end
+#end
+ }
+
+ @Override
+ @Deprecated
+ public WsConnector wsConnector() {
+ return wsConnector;
+ }
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+
+ @Override
+ public $helper.className($webService.path.asString) $helper.defaultWsClientMethodName($webService.path.asString)() {
+ return $helper.defaultWsClientFieldName($webService.path.asString);
+ }
+#end
+#end
+}
diff --git a/sonar-ws-generator/src/main/resources/package-info.vm b/sonar-ws-generator/src/main/resources/package-info.vm
index ee1ea241f7b..4eae5072ad8 100644
--- a/sonar-ws-generator/src/main/resources/package-info.vm
+++ b/sonar-ws-generator/src/main/resources/package-info.vm
@@ -19,7 +19,11 @@
*/
@ParametersAreNonnullByDefault
@Generated("sonar-ws-generator")
+#if ($webService.path.asString)
package $helper.packageName($webService.path.asString);
+#else
+package $helper.packageName();
+#end
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.Generated;
diff --git a/sonar-ws-generator/src/main/resources/wsClient.vm b/sonar-ws-generator/src/main/resources/wsClient.vm
new file mode 100644
index 00000000000..667f4187915
--- /dev/null
+++ b/sonar-ws-generator/src/main/resources/wsClient.vm
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+import javax.annotation.Generated;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+$helper.webserviceTypeImport($webService.path.asString)
+#end
+#end
+
+/**
+ * Allows to request the web services of SonarQube server. Instance is provided by
+ * {@link WsClientFactory}.
+ *
+ *
+ * Usage:
+ *
+ * HttpConnector httpConnector = HttpConnector.newBuilder()
+ * .url("http://localhost:9000")
+ * .credentials("admin", "admin")
+ * .build();
+ * WsClient wsClient = WsClientFactories.getDefault().newClient(httpConnector);
+ * wsClient.issues().search(issueRequest);
+ *
+ *
+ *
+ * @since 5.3
+ */
+@Generated("https://github.com/SonarSource/sonar-ws-generator")
+public interface WsClient {
+
+ WsConnector wsConnector();
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+
+ $helper.className($webService.path.asString) $helper.defaultWsClientMethodName($webService.path.asString)();
+#end
+#end
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
index 3712426dd3a..ecef12eecfd 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
@@ -19,28 +19,53 @@
*/
package org.sonarqube.ws.client;
+import javax.annotation.Generated;
+import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
+import org.sonarqube.ws.client.authentication.AuthenticationService;
+import org.sonarqube.ws.client.batch.BatchService;
import org.sonarqube.ws.client.ce.CeService;
import org.sonarqube.ws.client.components.ComponentsService;
+import org.sonarqube.ws.client.custommeasures.CustomMeasuresService;
+import org.sonarqube.ws.client.duplications.DuplicationsService;
+import org.sonarqube.ws.client.editions.EditionsService;
+import org.sonarqube.ws.client.emails.EmailsService;
import org.sonarqube.ws.client.favorites.FavoritesService;
+import org.sonarqube.ws.client.favourites.FavouritesService;
import org.sonarqube.ws.client.issues.IssuesService;
+import org.sonarqube.ws.client.l10n.L10nService;
+import org.sonarqube.ws.client.languages.LanguagesService;
import org.sonarqube.ws.client.measures.MeasuresService;
+import org.sonarqube.ws.client.metrics.MetricsService;
+import org.sonarqube.ws.client.navigation.NavigationService;
import org.sonarqube.ws.client.notifications.NotificationsService;
import org.sonarqube.ws.client.organizations.OrganizationsService;
import org.sonarqube.ws.client.permissions.PermissionsService;
-import org.sonarqube.ws.client.project.ProjectsService;
+import org.sonarqube.ws.client.plugins.PluginsService;
+import org.sonarqube.ws.client.profiles.ProfilesService;
import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
+import org.sonarqube.ws.client.projects.ProjectsService;
+import org.sonarqube.ws.client.projecttags.ProjectTagsService;
+import org.sonarqube.ws.client.properties.PropertiesService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
+import org.sonarqube.ws.client.resources.ResourcesService;
import org.sonarqube.ws.client.roots.RootsService;
import org.sonarqube.ws.client.rules.RulesService;
+import org.sonarqube.ws.client.server.ServerService;
import org.sonarqube.ws.client.settings.SettingsService;
+import org.sonarqube.ws.client.sources.SourcesService;
import org.sonarqube.ws.client.system.SystemService;
-import org.sonarqube.ws.client.user.UsersService;
+import org.sonarqube.ws.client.tests.TestsService;
+import org.sonarqube.ws.client.timemachine.TimemachineService;
+import org.sonarqube.ws.client.updatecenter.UpdatecenterService;
import org.sonarqube.ws.client.usergroups.UserGroupsService;
+import org.sonarqube.ws.client.userproperties.UserPropertiesService;
+import org.sonarqube.ws.client.users.UsersService;
import org.sonarqube.ws.client.usertokens.UserTokensService;
import org.sonarqube.ws.client.webhooks.WebhooksService;
+import org.sonarqube.ws.client.webservices.WebservicesService;
/**
* This class is not public anymore since version 5.5. It is
@@ -48,76 +73,153 @@ import org.sonarqube.ws.client.webhooks.WebhooksService;
*
* @since 5.3
*/
+@Generated("sonar-ws-generator")
class DefaultWsClient implements WsClient {
private final WsConnector wsConnector;
- private final OrganizationsService organizations;
- private final PermissionsService permissions;
- private final ComponentsService components;
- private final FavoritesService favoritesService;
- private final QualityprofilesService qualityprofiles;
- private final IssuesService issues;
- private final UsersService usersService;
- private final UserGroupsService userGroupsService;
- private final UserTokensService userTokensService;
- private final QualitygatesService qualityGatesService;
- private final MeasuresService measures;
- private final SystemService systemService;
+
+ private final AnalysisReportsService analysisReportsService;
+ private final AuthenticationService authenticationService;
private final CeService ceService;
- private final RulesService rulesService;
- private final ProjectsService projectsService;
+ private final ComponentsService componentsService;
+ private final CustomMeasuresService customMeasuresService;
+ private final DuplicationsService duplicationsService;
+ private final EditionsService editionsService;
+ private final EmailsService emailsService;
+ private final FavoritesService favoritesService;
+ private final FavouritesService favouritesService;
+ private final IssuesService issuesService;
+ private final L10nService l10nService;
+ private final LanguagesService languagesService;
+ private final MeasuresService measuresService;
+ private final MetricsService metricsService;
+ private final NavigationService navigationService;
+ private final NotificationsService notificationsService;
+ private final OrganizationsService organizationsService;
+ private final PermissionsService permissionsService;
+ private final PluginsService pluginsService;
+ private final ProfilesService profilesService;
+ private final ProjectAnalysesService projectAnalysesService;
+ private final ProjectBranchesService projectBranchesService;
private final ProjectLinksService projectLinksService;
- private final SettingsService settingsService;
+ private final ProjectTagsService projectTagsService;
+ private final ProjectsService projectsService;
+ private final PropertiesService propertiesService;
+ private final QualitygatesService qualitygatesService;
+ private final QualityprofilesService qualityprofilesService;
+ private final ResourcesService resourcesService;
private final RootsService rootsService;
+ private final RulesService rulesService;
+ private final ServerService serverService;
+ private final SettingsService settingsService;
+ private final SourcesService sourcesService;
+ private final SystemService systemService;
+ private final TestsService testsService;
+ private final TimemachineService timemachineService;
+ private final UpdatecenterService updatecenterService;
+ private final UserGroupsService userGroupsService;
+ private final UserPropertiesService userPropertiesService;
+ private final UserTokensService userTokensService;
+ private final UsersService usersService;
private final WebhooksService webhooksService;
- private final ProjectAnalysesService projectAnalyses;
- private final NotificationsService notificationsService;
- private final ProjectBranchesService projectBranchesService;
+ private final WebservicesService webservicesService;
+ private final BatchService batchService;
DefaultWsClient(WsConnector wsConnector) {
this.wsConnector = wsConnector;
- this.organizations = new OrganizationsService(wsConnector);
- this.permissions = new PermissionsService(wsConnector);
- this.components = new ComponentsService(wsConnector);
- this.favoritesService = new FavoritesService(wsConnector);
- this.qualityprofiles = new QualityprofilesService(wsConnector);
- this.issues = new IssuesService(wsConnector);
- this.usersService = new UsersService(wsConnector);
- this.userGroupsService = new UserGroupsService(wsConnector);
- this.userTokensService = new UserTokensService(wsConnector);
- this.qualityGatesService = new QualitygatesService(wsConnector);
- this.measures = new MeasuresService(wsConnector);
- this.systemService = new SystemService(wsConnector);
+
+ this.analysisReportsService = new AnalysisReportsService(wsConnector);
+ this.authenticationService = new AuthenticationService(wsConnector);
this.ceService = new CeService(wsConnector);
- this.rulesService = new RulesService(wsConnector);
- this.projectsService = new ProjectsService(wsConnector);
+ this.componentsService = new ComponentsService(wsConnector);
+ this.customMeasuresService = new CustomMeasuresService(wsConnector);
+ this.duplicationsService = new DuplicationsService(wsConnector);
+ this.editionsService = new EditionsService(wsConnector);
+ this.emailsService = new EmailsService(wsConnector);
+ this.favoritesService = new FavoritesService(wsConnector);
+ this.favouritesService = new FavouritesService(wsConnector);
+ this.issuesService = new IssuesService(wsConnector);
+ this.l10nService = new L10nService(wsConnector);
+ this.languagesService = new LanguagesService(wsConnector);
+ this.measuresService = new MeasuresService(wsConnector);
+ this.metricsService = new MetricsService(wsConnector);
+ this.navigationService = new NavigationService(wsConnector);
+ this.notificationsService = new NotificationsService(wsConnector);
+ this.organizationsService = new OrganizationsService(wsConnector);
+ this.permissionsService = new PermissionsService(wsConnector);
+ this.pluginsService = new PluginsService(wsConnector);
+ this.profilesService = new ProfilesService(wsConnector);
+ this.projectAnalysesService = new ProjectAnalysesService(wsConnector);
+ this.projectBranchesService = new ProjectBranchesService(wsConnector);
this.projectLinksService = new ProjectLinksService(wsConnector);
- this.settingsService = new SettingsService(wsConnector);
+ this.projectTagsService = new ProjectTagsService(wsConnector);
+ this.projectsService = new ProjectsService(wsConnector);
+ this.propertiesService = new PropertiesService(wsConnector);
+ this.qualitygatesService = new QualitygatesService(wsConnector);
+ this.qualityprofilesService = new QualityprofilesService(wsConnector);
+ this.resourcesService = new ResourcesService(wsConnector);
this.rootsService = new RootsService(wsConnector);
+ this.rulesService = new RulesService(wsConnector);
+ this.serverService = new ServerService(wsConnector);
+ this.settingsService = new SettingsService(wsConnector);
+ this.sourcesService = new SourcesService(wsConnector);
+ this.systemService = new SystemService(wsConnector);
+ this.testsService = new TestsService(wsConnector);
+ this.timemachineService = new TimemachineService(wsConnector);
+ this.updatecenterService = new UpdatecenterService(wsConnector);
+ this.userGroupsService = new UserGroupsService(wsConnector);
+ this.userPropertiesService = new UserPropertiesService(wsConnector);
+ this.userTokensService = new UserTokensService(wsConnector);
+ this.usersService = new UsersService(wsConnector);
this.webhooksService = new WebhooksService(wsConnector);
- this.projectAnalyses = new ProjectAnalysesService(wsConnector);
- this.projectBranchesService = new ProjectBranchesService(wsConnector);
- this.notificationsService = new NotificationsService(wsConnector);
+ this.webservicesService = new WebservicesService(wsConnector);
+ this.batchService = new BatchService(wsConnector);
}
@Override
+ @Deprecated
public WsConnector wsConnector() {
return wsConnector;
}
@Override
- public OrganizationsService organizations() {
- return organizations;
+ public AnalysisReportsService analysisReports() {
+ return analysisReportsService;
}
@Override
- public PermissionsService permissions() {
- return permissions;
+ public AuthenticationService authentication() {
+ return authenticationService;
+ }
+
+ @Override
+ public CeService ce() {
+ return ceService;
}
@Override
public ComponentsService components() {
- return components;
+ return componentsService;
+ }
+
+ @Override
+ public CustomMeasuresService customMeasures() {
+ return customMeasuresService;
+ }
+
+ @Override
+ public DuplicationsService duplications() {
+ return duplicationsService;
+ }
+
+ @Override
+ public EditionsService editions() {
+ return editionsService;
+ }
+
+ @Override
+ public EmailsService emails() {
+ return emailsService;
}
@Override
@@ -126,58 +228,73 @@ class DefaultWsClient implements WsClient {
}
@Override
- public QualityprofilesService qualityProfiles() {
- return qualityprofiles;
+ public FavouritesService favourites() {
+ return favouritesService;
}
@Override
public IssuesService issues() {
- return issues;
+ return issuesService;
}
@Override
- public UsersService users() {
- return usersService;
+ public L10nService l10n() {
+ return l10nService;
}
@Override
- public UserGroupsService userGroups() {
- return userGroupsService;
+ public LanguagesService languages() {
+ return languagesService;
}
@Override
- public UserTokensService userTokens() {
- return userTokensService;
+ public MeasuresService measures() {
+ return measuresService;
}
@Override
- public QualitygatesService qualityGates() {
- return qualityGatesService;
+ public MetricsService metrics() {
+ return metricsService;
}
@Override
- public MeasuresService measures() {
- return measures;
+ public NavigationService navigation() {
+ return navigationService;
}
@Override
- public SystemService system() {
- return systemService;
+ public NotificationsService notifications() {
+ return notificationsService;
}
@Override
- public CeService ce() {
- return ceService;
+ public OrganizationsService organizations() {
+ return organizationsService;
}
@Override
- public RulesService rules() {
- return rulesService;
+ public PermissionsService permissions() {
+ return permissionsService;
}
@Override
- public ProjectsService projects() {
- return projectsService;
+ public PluginsService plugins() {
+ return pluginsService;
+ }
+
+ @Override
+ public ProfilesService profiles() {
+ return profilesService;
+ }
+
+ @Override
+ public ProjectAnalysesService projectAnalyses() {
+ return projectAnalysesService;
+ }
+
+ @Override
+ public ProjectBranchesService projectBranches() {
+ return projectBranchesService;
}
@Override
@@ -186,8 +303,33 @@ class DefaultWsClient implements WsClient {
}
@Override
- public SettingsService settings() {
- return settingsService;
+ public ProjectTagsService projectTags() {
+ return projectTagsService;
+ }
+
+ @Override
+ public ProjectsService projects() {
+ return projectsService;
+ }
+
+ @Override
+ public PropertiesService properties() {
+ return propertiesService;
+ }
+
+ @Override
+ public QualitygatesService qualitygates() {
+ return qualitygatesService;
+ }
+
+ @Override
+ public QualityprofilesService qualityprofiles() {
+ return qualityprofilesService;
+ }
+
+ @Override
+ public ResourcesService resources() {
+ return resourcesService;
}
@Override
@@ -196,22 +338,77 @@ class DefaultWsClient implements WsClient {
}
@Override
- public WebhooksService webhooks() {
- return webhooksService;
+ public RulesService rules() {
+ return rulesService;
}
@Override
- public ProjectAnalysesService projectAnalyses() {
- return projectAnalyses;
+ public ServerService server() {
+ return serverService;
}
@Override
- public ProjectBranchesService projectBranches() {
- return projectBranchesService;
+ public SettingsService settings() {
+ return settingsService;
}
@Override
- public NotificationsService notifications() {
- return notificationsService;
+ public SourcesService sources() {
+ return sourcesService;
+ }
+
+ @Override
+ public SystemService system() {
+ return systemService;
+ }
+
+ @Override
+ public TestsService tests() {
+ return testsService;
+ }
+
+ @Override
+ public TimemachineService timemachine() {
+ return timemachineService;
+ }
+
+ @Override
+ public UpdatecenterService updatecenter() {
+ return updatecenterService;
+ }
+
+ @Override
+ public UserGroupsService userGroups() {
+ return userGroupsService;
+ }
+
+ @Override
+ public UserPropertiesService userProperties() {
+ return userPropertiesService;
+ }
+
+ @Override
+ public UserTokensService userTokens() {
+ return userTokensService;
+ }
+
+ @Override
+ public UsersService users() {
+ return usersService;
+ }
+
+ @Override
+ public WebhooksService webhooks() {
+ return webhooksService;
+ }
+
+ @Override
+ public WebservicesService webservices() {
+ return webservicesService;
+ }
+
+ @Override
+ public BatchService batch() {
+ return batchService;
}
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
index 88948a30469..3c602a95e75 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
@@ -19,28 +19,54 @@
*/
package org.sonarqube.ws.client;
+import javax.annotation.Generated;
+
+import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
+import org.sonarqube.ws.client.authentication.AuthenticationService;
import org.sonarqube.ws.client.ce.CeService;
import org.sonarqube.ws.client.components.ComponentsService;
+import org.sonarqube.ws.client.custommeasures.CustomMeasuresService;
+import org.sonarqube.ws.client.duplications.DuplicationsService;
+import org.sonarqube.ws.client.editions.EditionsService;
+import org.sonarqube.ws.client.emails.EmailsService;
import org.sonarqube.ws.client.favorites.FavoritesService;
+import org.sonarqube.ws.client.favourites.FavouritesService;
import org.sonarqube.ws.client.issues.IssuesService;
+import org.sonarqube.ws.client.l10n.L10nService;
+import org.sonarqube.ws.client.languages.LanguagesService;
import org.sonarqube.ws.client.measures.MeasuresService;
+import org.sonarqube.ws.client.metrics.MetricsService;
+import org.sonarqube.ws.client.navigation.NavigationService;
import org.sonarqube.ws.client.notifications.NotificationsService;
import org.sonarqube.ws.client.organizations.OrganizationsService;
import org.sonarqube.ws.client.permissions.PermissionsService;
-import org.sonarqube.ws.client.project.ProjectsService;
+import org.sonarqube.ws.client.plugins.PluginsService;
+import org.sonarqube.ws.client.profiles.ProfilesService;
import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
+import org.sonarqube.ws.client.projecttags.ProjectTagsService;
+import org.sonarqube.ws.client.projects.ProjectsService;
+import org.sonarqube.ws.client.properties.PropertiesService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
+import org.sonarqube.ws.client.resources.ResourcesService;
import org.sonarqube.ws.client.roots.RootsService;
import org.sonarqube.ws.client.rules.RulesService;
+import org.sonarqube.ws.client.server.ServerService;
import org.sonarqube.ws.client.settings.SettingsService;
+import org.sonarqube.ws.client.sources.SourcesService;
import org.sonarqube.ws.client.system.SystemService;
-import org.sonarqube.ws.client.user.UsersService;
+import org.sonarqube.ws.client.tests.TestsService;
+import org.sonarqube.ws.client.timemachine.TimemachineService;
+import org.sonarqube.ws.client.updatecenter.UpdatecenterService;
import org.sonarqube.ws.client.usergroups.UserGroupsService;
+import org.sonarqube.ws.client.userproperties.UserPropertiesService;
import org.sonarqube.ws.client.usertokens.UserTokensService;
+import org.sonarqube.ws.client.users.UsersService;
import org.sonarqube.ws.client.webhooks.WebhooksService;
+import org.sonarqube.ws.client.webservices.WebservicesService;
+import org.sonarqube.ws.client.batch.BatchService;
/**
* Allows to request the web services of SonarQube server. Instance is provided by
@@ -60,69 +86,100 @@ import org.sonarqube.ws.client.webhooks.WebhooksService;
*
* @since 5.3
*/
+@Generated("https://github.com/SonarSource/sonar-ws-generator")
public interface WsClient {
- OrganizationsService organizations();
+ WsConnector wsConnector();
+
+ AnalysisReportsService analysisReports();
+
+ AuthenticationService authentication();
+
+ CeService ce();
ComponentsService components();
+ CustomMeasuresService customMeasures();
+
+ DuplicationsService duplications();
+
+ EditionsService editions();
+
+ EmailsService emails();
+
FavoritesService favorites();
+ FavouritesService favourites();
+
IssuesService issues();
+ L10nService l10n();
+
+ LanguagesService languages();
+
+ MeasuresService measures();
+
+ MetricsService metrics();
+
+ NavigationService navigation();
+
NotificationsService notifications();
+ OrganizationsService organizations();
+
PermissionsService permissions();
- QualityprofilesService qualityProfiles();
+ PluginsService plugins();
- UsersService users();
+ ProfilesService profiles();
- UserGroupsService userGroups();
+ ProjectAnalysesService projectAnalyses();
- UserTokensService userTokens();
+ ProjectBranchesService projectBranches();
- QualitygatesService qualityGates();
+ ProjectLinksService projectLinks();
- MeasuresService measures();
+ ProjectTagsService projectTags();
- SystemService system();
+ ProjectsService projects();
- CeService ce();
+ PropertiesService properties();
- RulesService rules();
+ QualitygatesService qualitygates();
- WsConnector wsConnector();
+ QualityprofilesService qualityprofiles();
- /**
- * @since 5.5
- */
- ProjectsService projects();
+ ResourcesService resources();
- /**
- * @since 6.1
- */
- ProjectLinksService projectLinks();
+ RootsService roots();
+
+ RulesService rules();
+
+ ServerService server();
- /**
- * @since 6.1
- */
SettingsService settings();
- /**
- * @since 6.2
- */
- RootsService roots();
+ SourcesService sources();
+
+ SystemService system();
+
+ TestsService tests();
+
+ TimemachineService timemachine();
+
+ UpdatecenterService updatecenter();
+
+ UserGroupsService userGroups();
+
+ UserPropertiesService userProperties();
+
+ UserTokensService userTokens();
+
+ UsersService users();
- /**
- * @since 6.2
- */
WebhooksService webhooks();
- ProjectAnalysesService projectAnalyses();
+ WebservicesService webservices();
- /**
- * @since 6.6>
- */
- ProjectBranchesService projectBranches();
+ BatchService batch();
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java
index 6ead62cc9cc..42bd594689a 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java
@@ -21,6 +21,11 @@ package org.sonarqube.ws.client.issues;
import java.util.stream.Collectors;
import javax.annotation.Generated;
+import org.sonarqube.ws.MediaTypes;
+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.Issues.AddCommentResponse;
import org.sonarqube.ws.Issues.AssignResponse;
import org.sonarqube.ws.Issues.AuthorsResponse;
@@ -33,11 +38,6 @@ import org.sonarqube.ws.Issues.SetSeverityResponse;
import org.sonarqube.ws.Issues.SetTagsResponse;
import org.sonarqube.ws.Issues.SetTypeResponse;
import org.sonarqube.ws.Issues.TagsResponse;
-import org.sonarqube.ws.MediaTypes;
-import org.sonarqube.ws.client.BaseService;
-import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.PostRequest;
-import org.sonarqube.ws.client.WsConnector;
/**
* @see Further information about this web service online
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/package-info.java
index 8e2e690c6eb..2498aa78330 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/package-info.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/package-info.java
@@ -18,7 +18,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@ParametersAreNonnullByDefault
+@Generated("sonar-ws-generator")
package org.sonarqube.ws.client;
import javax.annotation.ParametersAreNonnullByDefault;
+import javax.annotation.Generated;
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java
index e33ccfd16ac..bfef940b019 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java
@@ -26,11 +26,12 @@ 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.Qualitygates.AppResponse;
import org.sonarqube.ws.Qualitygates.CreateResponse;
import org.sonarqube.ws.Qualitygates.CreateConditionResponse;
import org.sonarqube.ws.Qualitygates.GetByProjectResponse;
+import org.sonarqube.ws.Qualitygates.ListWsResponse;
import org.sonarqube.ws.Qualitygates.ProjectStatusResponse;
+import org.sonarqube.ws.Qualitygates.ShowWsResponse;
import org.sonarqube.ws.Qualitygates.UpdateConditionResponse;
/**
@@ -43,19 +44,6 @@ public class QualitygatesService extends BaseService {
super(wsConnector, "api/qualitygates");
}
- /**
- *
- * This is part of the internal API.
- * This is a GET request.
- * @see Further information about this action online (including a response example)
- * @since 4.3
- */
- public AppResponse app() {
- return call(
- new GetRequest(path("app")),
- AppResponse.parser());
- }
-
/**
*
* This is part of the internal API.
@@ -172,11 +160,10 @@ public class QualitygatesService extends BaseService {
* @see Further information about this action online (including a response example)
* @since 4.3
*/
- public String list() {
+ public ListWsResponse list() {
return call(
- new GetRequest(path("list"))
- .setMediaType(MediaTypes.JSON)
- ).content();
+ new GetRequest(path("list")),
+ ListWsResponse.parser());
}
/**
@@ -269,13 +256,12 @@ public class QualitygatesService extends BaseService {
* @see Further information about this action online (including a response example)
* @since 4.3
*/
- public String show(ShowRequest request) {
+ public ShowWsResponse show(ShowRequest request) {
return call(
new GetRequest(path("show"))
.setParam("id", request.getId())
- .setParam("name", request.getName())
- .setMediaType(MediaTypes.JSON)
- ).content();
+ .setParam("name", request.getName()),
+ ShowWsResponse.parser());
}
/**
@@ -284,11 +270,12 @@ public class QualitygatesService extends BaseService {
* This is a POST request.
* @see Further information about this action online (including a response example)
* @since 4.3
+ * @deprecated since 7.0
*/
- public void unsetDefault(UnsetDefaultRequest request) {
- call(
+ @Deprecated
+ public String unsetDefault() {
+ return call(
new PostRequest(path("unset_default"))
- .setParam("id", request.getId())
.setMediaType(MediaTypes.JSON)
).content();
}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java
new file mode 100644
index 00000000000..fe370e42bff
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 5.2
+ */
+@Generated("sonar-ws-generator")
+public class ChangePasswordRequest {
+
+ private String login;
+ private String password;
+ private String previousPassword;
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public ChangePasswordRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "mypassword"
+ */
+ public ChangePasswordRequest setPassword(String password) {
+ this.password = password;
+ return this;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Example value: "oldpassword"
+ */
+ public ChangePasswordRequest setPreviousPassword(String previousPassword) {
+ this.previousPassword = previousPassword;
+ return this;
+ }
+
+ public String getPreviousPassword() {
+ return previousPassword;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java
new file mode 100644
index 00000000000..7852c6846c8
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.7
+ */
+@Generated("sonar-ws-generator")
+public class CreateRequest {
+
+ private String email;
+ private String local;
+ private String login;
+ private String name;
+ private String password;
+ private String scmAccount;
+ private String scmAccounts;
+
+ /**
+ * Example value: "myname@email.com"
+ */
+ public CreateRequest setEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * Possible values:
+ *
+ * - "true"
+ * - "false"
+ * - "yes"
+ * - "no"
+ *
+ */
+ public CreateRequest setLocal(String local) {
+ this.local = local;
+ return this;
+ }
+
+ public String getLocal() {
+ return local;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public CreateRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "My Name"
+ */
+ public CreateRequest setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Example value: "mypassword"
+ */
+ public CreateRequest setPassword(String password) {
+ this.password = password;
+ return this;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue"
+ */
+ public CreateRequest setScmAccount(String scmAccount) {
+ this.scmAccount = scmAccount;
+ return this;
+ }
+
+ public String getScmAccount() {
+ return scmAccount;
+ }
+
+ /**
+ * Example value: "myscmaccount1,myscmaccount2"
+ * @deprecated since 6.1
+ */
+ @Deprecated
+ public CreateRequest setScmAccounts(String scmAccounts) {
+ this.scmAccounts = scmAccounts;
+ return this;
+ }
+
+ public String getScmAccounts() {
+ return scmAccounts;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java
new file mode 100644
index 00000000000..cf8906d82ce
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.7
+ */
+@Generated("sonar-ws-generator")
+public class DeactivateRequest {
+
+ private String login;
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public DeactivateRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java
new file mode 100644
index 00000000000..8db1e4e3133
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 5.2
+ */
+@Generated("sonar-ws-generator")
+public class GroupsRequest {
+
+ private String login;
+ private String organization;
+ private String p;
+ private String ps;
+ private String q;
+ private String selected;
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "admin"
+ */
+ public GroupsRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * This is part of the internal API.
+ * Example value: "my-org"
+ */
+ public GroupsRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
+
+ /**
+ * Example value: "42"
+ */
+ public GroupsRequest setP(String p) {
+ this.p = p;
+ return this;
+ }
+
+ public String getP() {
+ return p;
+ }
+
+ /**
+ * Example value: "20"
+ */
+ public GroupsRequest setPs(String ps) {
+ this.ps = ps;
+ return this;
+ }
+
+ public String getPs() {
+ return ps;
+ }
+
+ /**
+ * Example value: "users"
+ */
+ public GroupsRequest setQ(String q) {
+ this.q = q;
+ return this;
+ }
+
+ public String getQ() {
+ return q;
+ }
+
+ /**
+ * Possible values:
+ *
+ * - "all"
+ * - "deselected"
+ * - "selected"
+ *
+ */
+ public GroupsRequest setSelected(String selected) {
+ this.selected = selected;
+ return this;
+ }
+
+ public String getSelected() {
+ return selected;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java
new file mode 100644
index 00000000000..f7b7967d1bc
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.6
+ */
+@Generated("sonar-ws-generator")
+public class SearchRequest {
+
+ private List f;
+ private String p;
+ private String ps;
+ private String q;
+
+ /**
+ * Possible values:
+ *
+ * - "name"
+ * - "email"
+ * - "avatart"
+ * - "scmAccounts"
+ * - "groups"
+ * - "active"
+ * - "local"
+ * - "externalIdentity"
+ * - "externalProvider"
+ *
+ * @deprecated since 5.4
+ */
+ @Deprecated
+ public SearchRequest setF(List f) {
+ this.f = f;
+ return this;
+ }
+
+ public List getF() {
+ return f;
+ }
+
+ /**
+ * Example value: "42"
+ */
+ public SearchRequest setP(String p) {
+ this.p = p;
+ return this;
+ }
+
+ public String getP() {
+ return p;
+ }
+
+ /**
+ * Example value: "20"
+ */
+ public SearchRequest setPs(String ps) {
+ this.ps = ps;
+ return this;
+ }
+
+ public String getPs() {
+ return ps;
+ }
+
+ /**
+ */
+ public SearchRequest setQ(String q) {
+ this.q = q;
+ return this;
+ }
+
+ public String getQ() {
+ return q;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java
new file mode 100644
index 00000000000..672f3c89be7
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.7
+ */
+@Generated("sonar-ws-generator")
+public class UpdateRequest {
+
+ private String email;
+ private String login;
+ private String name;
+ private String scmAccount;
+ private String scmAccounts;
+
+ /**
+ * Example value: "myname@email.com"
+ */
+ public UpdateRequest setEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public UpdateRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * Example value: "My Name"
+ */
+ public UpdateRequest setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue"
+ */
+ public UpdateRequest setScmAccount(String scmAccount) {
+ this.scmAccount = scmAccount;
+ return this;
+ }
+
+ public String getScmAccount() {
+ return scmAccount;
+ }
+
+ /**
+ * Example value: "myscmaccount1,myscmaccount2"
+ * @deprecated since 6.1
+ */
+ @Deprecated
+ public UpdateRequest setScmAccounts(String scmAccounts) {
+ this.scmAccounts = scmAccounts;
+ return this;
+ }
+
+ public String getScmAccounts() {
+ return scmAccounts;
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java
new file mode 100644
index 00000000000..f456762369b
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java
@@ -0,0 +1,191 @@
+/*
+ * 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.users;
+
+import java.util.stream.Collectors;
+import javax.annotation.Generated;
+import org.sonarqube.ws.MediaTypes;
+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.Users.CreateWsResponse;
+import org.sonarqube.ws.Users.CurrentWsResponse;
+import org.sonarqube.ws.Users.GroupsWsResponse;
+import org.sonarqube.ws.Users.IdentityProvidersWsResponse;
+import org.sonarqube.ws.Users.SearchWsResponse;
+
+/**
+ * @see Further information about this web service online
+ */
+@Generated("sonar-ws-generator")
+public class UsersService extends BaseService {
+
+ public UsersService(WsConnector wsConnector) {
+ super(wsConnector, "api/users");
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 5.2
+ */
+ public void changePassword(ChangePasswordRequest request) {
+ call(
+ new PostRequest(path("change_password"))
+ .setParam("login", request.getLogin())
+ .setParam("password", request.getPassword())
+ .setParam("previousPassword", request.getPreviousPassword())
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.7
+ */
+ public void create(CreateRequest request) {
+ call(
+ new PostRequest(path("create"))
+ .setParam("email", request.getEmail())
+ .setParam("local", request.getLocal())
+ .setParam("login", request.getLogin())
+ .setParam("name", request.getName())
+ .setParam("password", request.getPassword())
+ .setParam("scmAccount", request.getScmAccount())
+ .setParam("scmAccounts", request.getScmAccounts()),
+ CreateWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a GET request.
+ * @see Further information about this action online (including a response example)
+ * @since 5.2
+ */
+ public CurrentWsResponse current() {
+ return call(
+ new GetRequest(path("current")),
+ CurrentWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.7
+ */
+ public String deactivate(DeactivateRequest request) {
+ return call(
+ new PostRequest(path("deactivate"))
+ .setParam("login", request.getLogin())
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a GET request.
+ * @see Further information about this action online (including a response example)
+ * @since 5.2
+ */
+ public GroupsWsResponse groups(GroupsRequest request) {
+ return call(
+ new GetRequest(path("groups"))
+ .setParam("login", request.getLogin())
+ .setParam("organization", request.getOrganization())
+ .setParam("p", request.getP())
+ .setParam("ps", request.getPs())
+ .setParam("q", request.getQ())
+ .setParam("selected", request.getSelected()),
+ GroupsWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a GET request.
+ * @see Further information about this action online (including a response example)
+ * @since 5.5
+ */
+ public IdentityProvidersWsResponse identityProviders() {
+ return call(
+ new GetRequest(path("identity_providers")),
+ IdentityProvidersWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a GET request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.6
+ */
+ public SearchWsResponse search(SearchRequest request) {
+ return call(
+ new GetRequest(path("search"))
+ .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(",")))
+ .setParam("p", request.getP())
+ .setParam("ps", request.getPs())
+ .setParam("q", request.getQ()),
+ SearchWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 6.5
+ */
+ public void skipOnboardingTutorial() {
+ call(
+ new PostRequest(path("skip_onboarding_tutorial"))
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see Further information about this action online (including a response example)
+ * @since 3.7
+ */
+ public String update(UpdateRequest request) {
+ return call(
+ new PostRequest(path("update"))
+ .setParam("email", request.getEmail())
+ .setParam("login", request.getLogin())
+ .setParam("name", request.getName())
+ .setParam("scmAccount", request.getScmAccount())
+ .setParam("scmAccounts", request.getScmAccounts())
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+}
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/users/package-info.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/package-info.java
new file mode 100644
index 00000000000..90f68b1a6d2
--- /dev/null
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/users/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * 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
+@Generated("sonar-ws-generator")
+package org.sonarqube.ws.client.users;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import javax.annotation.Generated;
+
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java
index fd8d71284c0..d0f2190c111 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java
@@ -61,7 +61,7 @@ public class OrganizationQualityGateForSmallChangesetsTest {
Project project = tester.projects().provision(organization);
Qualitygates.CreateResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
- Qualitygates.CreateConditionResponse condition = tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ Qualitygates.CreateConditionResponse condition = tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate.getId()))
.setMetric("new_coverage")
.setOp("LT")
@@ -104,7 +104,7 @@ public class OrganizationQualityGateForSmallChangesetsTest {
assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", true);
// small leak => if coverage is OK anyways, we do not have to ignore anything
- tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest()
+ tester.wsClient().qualitygates().updateCondition(new UpdateConditionRequest()
.setId(String.valueOf(condition.getId()))
.setMetric("new_coverage")
.setOp("LT")
@@ -126,7 +126,7 @@ public class OrganizationQualityGateForSmallChangesetsTest {
assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", false);
// big leak => use usual behaviour
- tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest()
+ tester.wsClient().qualitygates().updateCondition(new UpdateConditionRequest()
.setId(String.valueOf(condition.getId()))
.setMetric("new_coverage")
.setOp("LT")
@@ -150,7 +150,7 @@ public class OrganizationQualityGateForSmallChangesetsTest {
private void assertIgnoredConditions(String projectDir, boolean expected) throws IOException {
String analysisId = getAnalysisId(getTaskIdInLocalReport(projectDir(projectDir)));
- boolean ignoredConditions = tester.wsClient().qualityGates()
+ boolean ignoredConditions = tester.wsClient().qualitygates()
.projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId))
.getProjectStatus()
.getIgnoredConditions();
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java
index 953df1c4a21..bfaba6cc19b 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java
@@ -52,7 +52,7 @@ public class OrganizationQualityGateTest {
Project project = tester.projects().provision(organization);
Qualitygates.CreateResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
- tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate.getId()))
.setMetric("new_coverage")
.setOp("LT")
@@ -82,7 +82,7 @@ public class OrganizationQualityGateTest {
Qualitygates.CreateResponse qualityGate2 = tester.qGates().generate();
tester.qGates().associateProject(qualityGate2, project);
- tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate2.getId()))
.setMetric("new_coverage")
.setOp("LT")
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java
index 1cdc8389520..779c59e0652 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java
@@ -127,7 +127,7 @@ public class ProjectQualityGatePageTest {
}
private void associateWithQualityGate(QualityGate qualityGate) {
- tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey("sample").setGateId(String.valueOf(qualityGate.id())));
+ tester.wsClient().qualitygates().select(new SelectRequest().setProjectKey("sample").setGateId(String.valueOf(qualityGate.id())));
}
private QualityGateClient qualityGateClient() {
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java
index 66041b9c68b..4f327896194 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java
@@ -68,7 +68,7 @@ public class QualityGateOnRatingMeasuresTest {
Qualitygates.CreateResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
tester.settings().setGlobalSetting("sonar.leak.period", "previous_version");
- tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate.getId()))
.setMetric("new_security_rating")
.setOp("GT")
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java
index 37d2ae36805..83e3cb6e9c6 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java
@@ -212,7 +212,7 @@ public class QualityGateTest {
String taskId = getTaskIdInLocalReport(projectDir("qualitygate/xoo-sample"));
String analysisId = getAnalysisId(taskId);
- ProjectStatusResponse projectStatusWsResponse = tester.wsClient().qualityGates().projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId));
+ ProjectStatusResponse projectStatusWsResponse = tester.wsClient().qualitygates().projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId));
ProjectStatusResponse.ProjectStatus projectStatus = projectStatusWsResponse.getProjectStatus();
assertThat(projectStatus.getStatus()).isEqualTo(ERROR);
assertThat(projectStatus.getConditionsCount()).isEqualTo(1);
@@ -232,7 +232,7 @@ public class QualityGateTest {
createCustomIntMetric(customMetricKey);
try {
// create quality gate
- Qualitygates.CreateResponse simple = tester.wsClient().qualityGates().create(new CreateRequest().setName("OnCustomMetric"));
+ Qualitygates.CreateResponse simple = tester.wsClient().qualitygates().create(new CreateRequest().setName("OnCustomMetric"));
Long qualityGateId = simple.getId();
qgClient().createCondition(NewCondition.create(qualityGateId).metricKey(customMetricKey).operator("GT").warningThreshold("40"));
@@ -240,7 +240,7 @@ public class QualityGateTest {
deleteCustomMetric(customMetricKey);
// run analysis
- tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey(projectKey).setGateId(String.valueOf(qualityGateId)));
+ tester.wsClient().qualitygates().select(new SelectRequest().setProjectKey(projectKey).setGateId(String.valueOf(qualityGateId)));
BuildResult buildResult = executeAnalysis(projectKey);
// verify quality gate