]> source.dussan.org Git - sonarqube.git/commitdiff
Generate class WsClient in sonar-ws
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>
Mon, 4 Dec 2017 16:59:44 +0000 (17:59 +0100)
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>
Wed, 6 Dec 2017 13:40:17 +0000 (14:40 +0100)
24 files changed:
server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/QGateTester.java
sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/CodeFormatter.java
sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/Helper.java
sonar-ws-generator/src/main/resources/defaultWsClient.vm [new file with mode: 0644]
sonar-ws-generator/src/main/resources/package-info.vm
sonar-ws-generator/src/main/resources/wsClient.vm [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/DefaultWsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/WsClient.java
sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/package-info.java
sonar-ws/src/main/java/org/sonarqube/ws/client/qualitygates/QualitygatesService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/users/ChangePasswordRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/users/CreateRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/users/DeactivateRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/users/GroupsRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/users/SearchRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/users/UpdateRequest.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/users/UsersService.java [new file with mode: 0644]
sonar-ws/src/main/java/org/sonarqube/ws/client/users/package-info.java [new file with mode: 0644]
tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateForSmallChangesetsTest.java
tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateTest.java
tests/src/test/java/org/sonarqube/tests/qualityGate/ProjectQualityGatePageTest.java
tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateOnRatingMeasuresTest.java
tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateTest.java

index 66ef0f036db5f92f88b6e7de4ba2fbccb7aa8452..a90e2f3692546f141e3ceb77e4683a70f20396ed 100644 (file)
@@ -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){
index aebeabf2323a9ce225a4ea8841dc15190bae7cb2..577ff739c36cb542c3adede93a45f4190087e3e9 100644 (file)
@@ -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<String> 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();
index e38ea016dcf11dfaf76a4c6bba0feab25e057a86..62190c14c542852d579e0371c683a7055a715005 100644 (file)
@@ -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<String> PATH_EXCLUSIONS = new HashSet<>(asList("api/orchestrator"));
   private static final String OUTPUT_DIR = "target/generated-sources/results";
   private final Map<String, List<String[]>> 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 (file)
index 0000000..eb5b11a
--- /dev/null
@@ -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
+}
index ee1ea241f7b040d28bd26c656642c144989ca8e7..4eae5072ad821f3cb2e70fd7ca392b7932e82370 100644 (file)
  */
 @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 (file)
index 0000000..667f418
--- /dev/null
@@ -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}.
+ *
+ * <p>
+ * Usage:
+ * <pre>
+ *   HttpConnector httpConnector = HttpConnector.newBuilder()
+ *     .url("http://localhost:9000")
+ *     .credentials("admin", "admin")
+ *     .build();
+ *   WsClient wsClient = WsClientFactories.getDefault().newClient(httpConnector);
+ *   wsClient.issues().search(issueRequest);
+ * </pre>
+ * </p>
+ *
+ * @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
+}
index 3712426dd3a375ab0b56d790da15b371fe5659a1..ecef12eecfd91704c076632a6021cf0ab8108464 100644 (file)
  */
 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;
   }
 }
index 88948a30469cba72b16eeb30822664db8b3001a5..3c602a95e753aa353df9749886975ba792a35ae7 100644 (file)
  */
 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();
 }
index 6ead62cc9cc2ef6e6affe970f9ea18d0313ad93e..42bd594689a0f641b52badce449fae5ba75054d3 100644 (file)
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues">Further information about this web service online</a>
index 8e2e690c6ebe3a0f5f53e32427d25c8bc64fa2b7..2498aa783300aaa33b30fd2231ed48361356249d 100644 (file)
@@ -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;
 
index e33ccfd16acfd05ffeb0996c6c4805521c7d54e9..bfef940b019b67ba6c6c31b9fa5d7eab0f5e4d2c 100644 (file)
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/app">Further information about this action online (including a response example)</a>
-   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/list">Further information about this action online (including a response example)</a>
    * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/show">Further information about this action online (including a response example)</a>
    * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/unset_default">Further information about this action online (including a response example)</a>
    * @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 (file)
index 0000000..fe370e4
--- /dev/null
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/change_password">Further information about this action online (including a response example)</a>
+ * @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 (file)
index 0000000..7852c68
--- /dev/null
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/create">Further information about this action online (including a response example)</a>
+ * @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:
+   * <ul>
+   *   <li>"true"</li>
+   *   <li>"false"</li>
+   *   <li>"yes"</li>
+   *   <li>"no"</li>
+   * </ul>
+   */
+  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 (file)
index 0000000..cf8906d
--- /dev/null
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/deactivate">Further information about this action online (including a response example)</a>
+ * @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 (file)
index 0000000..8db1e4e
--- /dev/null
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/groups">Further information about this action online (including a response example)</a>
+ * @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:
+   * <ul>
+   *   <li>"all"</li>
+   *   <li>"deselected"</li>
+   *   <li>"selected"</li>
+   * </ul>
+   */
+  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 (file)
index 0000000..f7b7967
--- /dev/null
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/search">Further information about this action online (including a response example)</a>
+ * @since 3.6
+ */
+@Generated("sonar-ws-generator")
+public class SearchRequest {
+
+  private List<String> f;
+  private String p;
+  private String ps;
+  private String q;
+
+  /**
+   * Possible values:
+   * <ul>
+   *   <li>"name"</li>
+   *   <li>"email"</li>
+   *   <li>"avatart"</li>
+   *   <li>"scmAccounts"</li>
+   *   <li>"groups"</li>
+   *   <li>"active"</li>
+   *   <li>"local"</li>
+   *   <li>"externalIdentity"</li>
+   *   <li>"externalProvider"</li>
+   * </ul>
+   * @deprecated since 5.4
+   */
+  @Deprecated
+  public SearchRequest setF(List<String> f) {
+    this.f = f;
+    return this;
+  }
+
+  public List<String> 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 (file)
index 0000000..672f3c8
--- /dev/null
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/update">Further information about this action online (including a response example)</a>
+ * @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 (file)
index 0000000..f456762
--- /dev/null
@@ -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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users">Further information about this web service online</a>
+ */
+@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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/change_password">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/create">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/current">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/deactivate">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/groups">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/identity_providers">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/search">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/skip_onboarding_tutorial">Further information about this action online (including a response example)</a>
+   * @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 <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/update">Further information about this action online (including a response example)</a>
+   * @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 (file)
index 0000000..90f68b1
--- /dev/null
@@ -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;
+
index fd8d71284c046f2a52555c58428e36de0297d34c..d0f2190c111f301e34e9489f1db23bc9fef56b3d 100644 (file)
@@ -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();
index 953df1c4a21a6232f2d1021c60f8788697df008e..bfaba6cc19bb2a941cb3eb7af7cf8df35251d490 100644 (file)
@@ -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")
index 1cdc8389520185b6d4538daecba02db219d2dc9e..779c59e0652b2e3aa664a1857f691a0eacc7df9a 100644 (file)
@@ -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() {
index 66041b9c68b3aa0e903d8373faadb87f606ffa40..4f327896194ee9f1ee1ae6a7e185ba4e13824e9f 100644 (file)
@@ -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")
index 37d2ae3680503e3902c1a9893bf44cf2945682d4..83e3cb6e9c63c016b694ad7c31d80b6e5ca7c8ce 100644 (file)
@@ -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