]> source.dussan.org Git - sonarqube.git/commitdiff
change ws path from /api/analysis_reports/* to /api/computation/*
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 8 Jan 2015 11:03:43 +0000 (12:03 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 8 Jan 2015 11:03:43 +0000 (12:03 +0100)
13 files changed:
server/sonar-server/src/main/java/org/sonar/server/computation/ws/ComputationWebService.java
server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWebService.java [new file with mode: 0644]
server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWsAction.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/computation/ws/QueueWsAction.java
server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComputationWebServiceTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWebServiceTest.java [new file with mode: 0644]
server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWsActionTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/computation/ws/QueueWsActionTest.java
server/sonar-server/src/test/resources/org/sonar/server/computation/ws/QueueWsActionTest/list_active_reports.json [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/computation/ws/QueueWsActionTest/list_queue_reports.json [new file with mode: 0644]
server/sonar-web/src/main/coffee/analysis-reports/models/reports.coffee
sonar-batch/src/main/java/org/sonar/batch/report/PublishReportJob.java

index 62f579c7ce7471aacf5808d865f08b66b3aaca58..e048ff397c71212afb4808ede36330840c6e4970 100644 (file)
@@ -31,7 +31,7 @@ import org.sonar.api.server.ws.WebService;
  * </ul>
  */
 public class ComputationWebService implements WebService {
-  public static final String API_ENDPOINT = "api/analysis_reports";
+  public static final String API_ENDPOINT = "api/computation";
 
   private final ComputationWsAction[] actions;
 
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWebService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWebService.java
new file mode 100644 (file)
index 0000000..986438a
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.ws;
+
+import org.apache.commons.io.IOUtils;
+import org.sonar.api.server.ws.Request;
+import org.sonar.api.server.ws.RequestHandler;
+import org.sonar.api.server.ws.Response;
+import org.sonar.api.server.ws.WebService;
+import org.sonar.core.computation.db.AnalysisReportDto;
+import org.sonar.server.computation.AnalysisReportQueue;
+
+import java.util.List;
+
+/**
+ * Internal WebService with one action
+ */
+public class IsQueueEmptyWebService implements WebService {
+  public static final String API_ENDPOINT = "api/analysis_reports";
+
+  private final IsQueueEmptyWsAction action;
+
+  public IsQueueEmptyWebService(AnalysisReportQueue queue) {
+    this.action = new IsQueueEmptyWsAction(queue);
+  }
+
+  @Override
+  public void define(Context context) {
+    NewController controller = context
+      .createController(API_ENDPOINT)
+      .setDescription("Analysis reports processed");
+    action.define(controller);
+    controller.done();
+  }
+
+  static class IsQueueEmptyWsAction implements RequestHandler {
+    private final AnalysisReportQueue queue;
+
+    public IsQueueEmptyWsAction(AnalysisReportQueue queue) {
+      this.queue = queue;
+    }
+
+    public void define(WebService.NewController controller) {
+      controller
+        .createAction("is_queue_empty")
+        .setDescription("Check if the analysis report queue is empty")
+        .setInternal(true)
+        .setHandler(this);
+    }
+
+    @Override
+    public void handle(Request request, Response response) throws Exception {
+      List<AnalysisReportDto> reports = queue.all();
+      boolean isQueueEmpty = reports.isEmpty();
+
+      IOUtils.write(String.valueOf(isQueueEmpty), response.stream().output());
+    }
+  }
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWsAction.java b/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWsAction.java
deleted file mode 100644 (file)
index 1870d6b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.server.computation.ws;
-
-import org.apache.commons.io.IOUtils;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.RequestHandler;
-import org.sonar.api.server.ws.Response;
-import org.sonar.api.server.ws.WebService;
-import org.sonar.core.computation.db.AnalysisReportDto;
-import org.sonar.server.computation.AnalysisReportQueue;
-
-import java.util.List;
-
-public class IsQueueEmptyWsAction implements ComputationWsAction, RequestHandler {
-  private final AnalysisReportQueue queue;
-
-  public IsQueueEmptyWsAction(AnalysisReportQueue queue) {
-    this.queue = queue;
-  }
-
-  @Override
-  public void define(WebService.NewController controller) {
-    controller
-      .createAction("is_queue_empty")
-      .setDescription("Check if the analysis report queue is empty")
-      .setInternal(true)
-      .setHandler(this);
-  }
-
-  @Override
-  public void handle(Request request, Response response) throws Exception {
-    List<AnalysisReportDto> reports = queue.all();
-    boolean isQueueEmpty = reports.isEmpty();
-
-    IOUtils.write(String.valueOf(isQueueEmpty), response.stream().output());
-  }
-}
index d4888146134f3e4c4702b15519333f43d3d3ed95..0d7681a55f3ddd3b551ed249013d9a2401c78e1e 100644 (file)
@@ -43,7 +43,7 @@ public class QueueWsAction implements ComputationWsAction, RequestHandler {
   @Override
   public void define(WebService.NewController controller) {
     controller
-      .createAction("active")
+      .createAction("queue")
       .setDescription("List all the active analysis reports")
       .setSince("5.0")
       .setInternal(true)
@@ -64,10 +64,8 @@ public class QueueWsAction implements ComputationWsAction, RequestHandler {
     json.name("reports").beginArray();
     for (AnalysisReportDto report : reports) {
       json.beginObject();
-      // TODO naming consistency -> rename id to key
-      json.prop("id", report.getId());
-      // TODO rename to projectKey
-      json.prop("project", report.getProjectKey());
+      json.prop("key", report.getId());
+      json.prop("projectKey", report.getProjectKey());
       json.prop("projectName", report.getProjectKey());
       json.propDateTime("startedAt", report.getStartedAt());
       json.propDateTime("finishedAt", report.getFinishedAt());
index 033e11142621d75e3f8e7c6c912840245fa1d66f..d1d7c27913c0773d47eb2e401310da545f848773 100644 (file)
@@ -54,13 +54,7 @@ import org.sonar.core.measure.db.MeasureFilterDao;
 import org.sonar.core.metric.DefaultMetricFinder;
 import org.sonar.core.notification.DefaultNotificationManager;
 import org.sonar.core.permission.PermissionFacade;
-import org.sonar.core.persistence.DaoUtils;
-import org.sonar.core.persistence.DatabaseVersion;
-import org.sonar.core.persistence.DefaultDatabase;
-import org.sonar.core.persistence.MyBatis;
-import org.sonar.core.persistence.PreviewDatabaseFactory;
-import org.sonar.core.persistence.SemaphoreUpdater;
-import org.sonar.core.persistence.SemaphoresImpl;
+import org.sonar.core.persistence.*;
 import org.sonar.core.preview.PreviewCache;
 import org.sonar.core.profiling.Profiling;
 import org.sonar.core.purge.PurgeProfiler;
@@ -86,11 +80,7 @@ import org.sonar.server.activity.index.ActivityNormalizer;
 import org.sonar.server.activity.ws.ActivitiesWebService;
 import org.sonar.server.activity.ws.ActivityMapping;
 import org.sonar.server.authentication.ws.AuthenticationWs;
-import org.sonar.server.batch.BatchIndex;
-import org.sonar.server.batch.BatchWs;
-import org.sonar.server.batch.GlobalReferentialsAction;
-import org.sonar.server.batch.ProjectReferentialsAction;
-import org.sonar.server.batch.ProjectReferentialsLoader;
+import org.sonar.server.batch.*;
 import org.sonar.server.charts.ChartFactory;
 import org.sonar.server.component.ComponentCleanerService;
 import org.sonar.server.component.ComponentService;
@@ -98,32 +88,11 @@ import org.sonar.server.component.DefaultComponentFinder;
 import org.sonar.server.component.DefaultRubyComponentService;
 import org.sonar.server.component.db.ComponentDao;
 import org.sonar.server.component.db.SnapshotDao;
-import org.sonar.server.component.ws.ComponentAppAction;
-import org.sonar.server.component.ws.ComponentsWs;
-import org.sonar.server.component.ws.EventsWs;
-import org.sonar.server.component.ws.ProjectsWs;
-import org.sonar.server.component.ws.ResourcesWs;
-import org.sonar.server.computation.AnalysisReportQueue;
-import org.sonar.server.computation.AnalysisReportService;
-import org.sonar.server.computation.AnalysisReportTaskCleaner;
-import org.sonar.server.computation.AnalysisReportTaskLauncher;
-import org.sonar.server.computation.ComputationService;
-import org.sonar.server.computation.ComputeEngineIssueStorageFactory;
+import org.sonar.server.component.ws.*;
+import org.sonar.server.computation.*;
 import org.sonar.server.computation.db.AnalysisReportDao;
-import org.sonar.server.computation.step.CleanReportStep;
-import org.sonar.server.computation.step.ComponentIndexationInDatabaseStep;
-import org.sonar.server.computation.step.ComputationStepRegistry;
-import org.sonar.server.computation.step.DataCleanerStep;
-import org.sonar.server.computation.step.DigestReportStep;
-import org.sonar.server.computation.step.IndexProjectIssuesStep;
-import org.sonar.server.computation.step.InvalidatePreviewCacheStep;
-import org.sonar.server.computation.step.SwitchSnapshotStep;
-import org.sonar.server.computation.step.SynchronizeProjectPermissionsStep;
-import org.sonar.server.computation.ws.ComputationWebService;
-import org.sonar.server.computation.ws.HistoryWsAction;
-import org.sonar.server.computation.ws.IsQueueEmptyWsAction;
-import org.sonar.server.computation.ws.QueueWsAction;
-import org.sonar.server.computation.ws.SubmitReportWsAction;
+import org.sonar.server.computation.step.*;
+import org.sonar.server.computation.ws.*;
 import org.sonar.server.config.ws.PropertiesWs;
 import org.sonar.server.dashboard.db.DashboardDao;
 import org.sonar.server.dashboard.db.WidgetDao;
@@ -135,14 +104,7 @@ import org.sonar.server.db.DbClient;
 import org.sonar.server.db.EmbeddedDatabaseFactory;
 import org.sonar.server.db.migrations.DatabaseMigrations;
 import org.sonar.server.db.migrations.DatabaseMigrator;
-import org.sonar.server.debt.DebtCharacteristicsXMLImporter;
-import org.sonar.server.debt.DebtModelBackup;
-import org.sonar.server.debt.DebtModelLookup;
-import org.sonar.server.debt.DebtModelOperations;
-import org.sonar.server.debt.DebtModelPluginRepository;
-import org.sonar.server.debt.DebtModelService;
-import org.sonar.server.debt.DebtModelXMLExporter;
-import org.sonar.server.debt.DebtRulesXMLImporter;
+import org.sonar.server.debt.*;
 import org.sonar.server.design.FileDesignWidget;
 import org.sonar.server.duplication.ws.DuplicationsJsonWriter;
 import org.sonar.server.duplication.ws.DuplicationsParser;
@@ -150,38 +112,15 @@ import org.sonar.server.duplication.ws.DuplicationsWs;
 import org.sonar.server.es.EsClient;
 import org.sonar.server.es.IndexCreator;
 import org.sonar.server.es.IndexRegistry;
-import org.sonar.server.issue.ActionService;
-import org.sonar.server.issue.AddTagsAction;
-import org.sonar.server.issue.AssignAction;
-import org.sonar.server.issue.CommentAction;
-import org.sonar.server.issue.InternalRubyIssueService;
-import org.sonar.server.issue.IssueBulkChangeService;
-import org.sonar.server.issue.IssueChangelogFormatter;
-import org.sonar.server.issue.IssueChangelogService;
-import org.sonar.server.issue.IssueCommentService;
-import org.sonar.server.issue.IssueQueryService;
-import org.sonar.server.issue.IssueService;
-import org.sonar.server.issue.PlanAction;
-import org.sonar.server.issue.RemoveTagsAction;
-import org.sonar.server.issue.ServerIssueStorage;
-import org.sonar.server.issue.SetSeverityAction;
-import org.sonar.server.issue.TransitionAction;
+import org.sonar.server.issue.*;
 import org.sonar.server.issue.actionplan.ActionPlanService;
 import org.sonar.server.issue.actionplan.ActionPlanWs;
 import org.sonar.server.issue.db.IssueDao;
 import org.sonar.server.issue.filter.IssueFilterService;
 import org.sonar.server.issue.filter.IssueFilterWriter;
 import org.sonar.server.issue.filter.IssueFilterWs;
-import org.sonar.server.issue.index.IssueAuthorizationIndexer;
-import org.sonar.server.issue.index.IssueIndex;
-import org.sonar.server.issue.index.IssueIndexDefinition;
-import org.sonar.server.issue.index.IssueIndexer;
-import org.sonar.server.issue.index.IssueNormalizer;
-import org.sonar.server.issue.ws.ComponentTagsAction;
-import org.sonar.server.issue.ws.IssueActionsWriter;
-import org.sonar.server.issue.ws.IssueShowAction;
-import org.sonar.server.issue.ws.IssuesWs;
-import org.sonar.server.issue.ws.SetTagsAction;
+import org.sonar.server.issue.index.*;
+import org.sonar.server.issue.ws.*;
 import org.sonar.server.measure.MeasureFilterEngine;
 import org.sonar.server.measure.MeasureFilterExecutor;
 import org.sonar.server.measure.MeasureFilterFactory;
@@ -200,118 +139,36 @@ import org.sonar.server.platform.ws.L10nWs;
 import org.sonar.server.platform.ws.RestartHandler;
 import org.sonar.server.platform.ws.ServerWs;
 import org.sonar.server.platform.ws.SystemWs;
-import org.sonar.server.plugins.InstalledPluginReferentialFactory;
-import org.sonar.server.plugins.PluginDownloader;
-import org.sonar.server.plugins.ServerExtensionInstaller;
-import org.sonar.server.plugins.ServerPluginJarInstaller;
-import org.sonar.server.plugins.ServerPluginJarsInstaller;
-import org.sonar.server.plugins.ServerPluginRepository;
-import org.sonar.server.plugins.UpdateCenterClient;
-import org.sonar.server.plugins.UpdateCenterMatrixFactory;
+import org.sonar.server.plugins.*;
 import org.sonar.server.properties.ProjectSettingsFactory;
 import org.sonar.server.qualitygate.QgateProjectFinder;
 import org.sonar.server.qualitygate.QualityGates;
 import org.sonar.server.qualitygate.RegisterQualityGates;
-import org.sonar.server.qualitygate.ws.QGatesAppAction;
-import org.sonar.server.qualitygate.ws.QGatesCopyAction;
-import org.sonar.server.qualitygate.ws.QGatesCreateAction;
-import org.sonar.server.qualitygate.ws.QGatesCreateConditionAction;
-import org.sonar.server.qualitygate.ws.QGatesDeleteConditionAction;
-import org.sonar.server.qualitygate.ws.QGatesDeselectAction;
-import org.sonar.server.qualitygate.ws.QGatesDestroyAction;
-import org.sonar.server.qualitygate.ws.QGatesListAction;
-import org.sonar.server.qualitygate.ws.QGatesRenameAction;
-import org.sonar.server.qualitygate.ws.QGatesSearchAction;
-import org.sonar.server.qualitygate.ws.QGatesSelectAction;
-import org.sonar.server.qualitygate.ws.QGatesSetAsDefaultAction;
-import org.sonar.server.qualitygate.ws.QGatesShowAction;
-import org.sonar.server.qualitygate.ws.QGatesUnsetDefaultAction;
-import org.sonar.server.qualitygate.ws.QGatesUpdateConditionAction;
-import org.sonar.server.qualitygate.ws.QGatesWs;
-import org.sonar.server.qualityprofile.BuiltInProfiles;
-import org.sonar.server.qualityprofile.QProfileBackuper;
-import org.sonar.server.qualityprofile.QProfileCopier;
-import org.sonar.server.qualityprofile.QProfileExporters;
-import org.sonar.server.qualityprofile.QProfileFactory;
-import org.sonar.server.qualityprofile.QProfileLoader;
-import org.sonar.server.qualityprofile.QProfileLookup;
-import org.sonar.server.qualityprofile.QProfileProjectLookup;
-import org.sonar.server.qualityprofile.QProfileProjectOperations;
-import org.sonar.server.qualityprofile.QProfileReset;
-import org.sonar.server.qualityprofile.QProfileService;
-import org.sonar.server.qualityprofile.QProfiles;
-import org.sonar.server.qualityprofile.RegisterQualityProfiles;
-import org.sonar.server.qualityprofile.RuleActivator;
-import org.sonar.server.qualityprofile.RuleActivatorContextFactory;
+import org.sonar.server.qualitygate.ws.*;
+import org.sonar.server.qualityprofile.*;
 import org.sonar.server.qualityprofile.db.ActiveRuleDao;
 import org.sonar.server.qualityprofile.index.ActiveRuleIndex;
 import org.sonar.server.qualityprofile.index.ActiveRuleNormalizer;
-import org.sonar.server.qualityprofile.ws.BulkRuleActivationActions;
-import org.sonar.server.qualityprofile.ws.ProfilesWs;
-import org.sonar.server.qualityprofile.ws.QProfileRestoreBuiltInAction;
-import org.sonar.server.qualityprofile.ws.QProfilesWs;
-import org.sonar.server.qualityprofile.ws.RuleActivationActions;
-import org.sonar.server.rule.DefaultRuleFinder;
-import org.sonar.server.rule.DeprecatedRulesDefinitionLoader;
-import org.sonar.server.rule.RegisterRules;
-import org.sonar.server.rule.RubyRuleService;
-import org.sonar.server.rule.RuleCreator;
-import org.sonar.server.rule.RuleDefinitionsLoader;
-import org.sonar.server.rule.RuleDeleter;
-import org.sonar.server.rule.RuleOperations;
-import org.sonar.server.rule.RuleRepositories;
-import org.sonar.server.rule.RuleService;
-import org.sonar.server.rule.RuleUpdater;
+import org.sonar.server.qualityprofile.ws.*;
+import org.sonar.server.rule.*;
 import org.sonar.server.rule.db.RuleDao;
 import org.sonar.server.rule.index.RuleIndex;
 import org.sonar.server.rule.index.RuleNormalizer;
-import org.sonar.server.rule.ws.ActiveRuleCompleter;
-import org.sonar.server.rule.ws.AppAction;
-import org.sonar.server.rule.ws.DeleteAction;
-import org.sonar.server.rule.ws.RuleMapping;
-import org.sonar.server.rule.ws.RulesWebService;
+import org.sonar.server.rule.ws.*;
 import org.sonar.server.rule.ws.SearchAction;
 import org.sonar.server.rule.ws.TagsAction;
-import org.sonar.server.rule.ws.UpdateAction;
-import org.sonar.server.search.IndexClient;
-import org.sonar.server.search.IndexQueue;
-import org.sonar.server.search.IndexSynchronizer;
-import org.sonar.server.search.SearchClient;
-import org.sonar.server.search.SearchHealth;
+import org.sonar.server.search.*;
 import org.sonar.server.source.HtmlSourceDecorator;
 import org.sonar.server.source.IndexSourceLinesStep;
 import org.sonar.server.source.SourceService;
 import org.sonar.server.source.index.SourceLineIndex;
 import org.sonar.server.source.index.SourceLineIndexDefinition;
 import org.sonar.server.source.index.SourceLineIndexer;
-import org.sonar.server.source.ws.HashAction;
-import org.sonar.server.source.ws.IndexAction;
-import org.sonar.server.source.ws.LinesAction;
-import org.sonar.server.source.ws.RawAction;
-import org.sonar.server.source.ws.ScmAction;
-import org.sonar.server.source.ws.ScmWriter;
+import org.sonar.server.source.ws.*;
 import org.sonar.server.source.ws.ShowAction;
-import org.sonar.server.source.ws.SourcesWs;
-import org.sonar.server.startup.CleanPreviewAnalysisCache;
-import org.sonar.server.startup.CopyRequirementsFromCharacteristicsToRules;
-import org.sonar.server.startup.GeneratePluginIndex;
-import org.sonar.server.startup.JdbcDriverDeployer;
-import org.sonar.server.startup.LogServerId;
-import org.sonar.server.startup.RegisterDashboards;
-import org.sonar.server.startup.RegisterDebtModel;
-import org.sonar.server.startup.RegisterMetrics;
-import org.sonar.server.startup.RegisterNewMeasureFilters;
-import org.sonar.server.startup.RegisterPermissionTemplates;
-import org.sonar.server.startup.RegisterServletFilters;
-import org.sonar.server.startup.RenameDeprecatedPropertyKeys;
-import org.sonar.server.startup.ServerMetadataPersister;
+import org.sonar.server.startup.*;
 import org.sonar.server.test.CoverageService;
-import org.sonar.server.test.ws.CoverageShowAction;
-import org.sonar.server.test.ws.CoverageWs;
-import org.sonar.server.test.ws.TestsCoveredFilesAction;
-import org.sonar.server.test.ws.TestsShowAction;
-import org.sonar.server.test.ws.TestsTestCasesAction;
-import org.sonar.server.test.ws.TestsWs;
+import org.sonar.server.test.ws.*;
 import org.sonar.server.text.MacroInterpreter;
 import org.sonar.server.text.RubyTextService;
 import org.sonar.server.ui.JRubyI18n;
@@ -319,14 +176,7 @@ import org.sonar.server.ui.JRubyProfiling;
 import org.sonar.server.ui.PageDecorations;
 import org.sonar.server.ui.Views;
 import org.sonar.server.updatecenter.ws.UpdateCenterWs;
-import org.sonar.server.user.DefaultUserService;
-import org.sonar.server.user.DoPrivileged;
-import org.sonar.server.user.GroupMembershipFinder;
-import org.sonar.server.user.GroupMembershipService;
-import org.sonar.server.user.NewUserNotifier;
-import org.sonar.server.user.SecurityRealmFactory;
-import org.sonar.server.user.UserService;
-import org.sonar.server.user.UserUpdater;
+import org.sonar.server.user.*;
 import org.sonar.server.user.db.GroupDao;
 import org.sonar.server.user.db.UserDao;
 import org.sonar.server.user.db.UserGroupDao;
@@ -336,13 +186,7 @@ import org.sonar.server.user.index.UserIndexer;
 import org.sonar.server.user.ws.FavoritesWs;
 import org.sonar.server.user.ws.UserPropertiesWs;
 import org.sonar.server.user.ws.UsersWs;
-import org.sonar.server.util.BooleanTypeValidation;
-import org.sonar.server.util.FloatTypeValidation;
-import org.sonar.server.util.IntegerTypeValidation;
-import org.sonar.server.util.StringListTypeValidation;
-import org.sonar.server.util.StringTypeValidation;
-import org.sonar.server.util.TextTypeValidation;
-import org.sonar.server.util.TypeValidations;
+import org.sonar.server.util.*;
 import org.sonar.server.ws.ListingWs;
 import org.sonar.server.ws.WebServiceEngine;
 
@@ -790,8 +634,8 @@ class ServerComponents {
     pico.addSingleton(AnalysisReportQueue.class);
     pico.addSingleton(AnalysisReportTaskLauncher.class);
     pico.addSingleton(ComputationWebService.class);
+    pico.addSingleton(IsQueueEmptyWebService.class);
     pico.addSingleton(QueueWsAction.class);
-    pico.addSingleton(IsQueueEmptyWsAction.class);
     pico.addSingleton(HistoryWsAction.class);
     pico.addSingleton(DefaultPeriodCleaner.class);
     pico.addSingleton(DefaultPurgeTask.class);
index bec62034d7ef2a5cbd14cf5f652c4bba45a006b3..4330952f233a46cd9d9adeb70b71c4f4e7cd6352 100644 (file)
@@ -41,7 +41,7 @@ public class ComputationWebServiceTest {
     WebService.Context context = new WebService.Context();
     ws.define(context);
 
-    WebService.Controller controller = context.controller("api/analysis_reports");
+    WebService.Controller controller = context.controller("api/computation");
     assertThat(controller).isNotNull();
     assertThat(controller.description()).isNotEmpty();
     assertThat(controller.actions()).hasSize(1);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWebServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWebServiceTest.java
new file mode 100644 (file)
index 0000000..e975b07
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+package org.sonar.server.computation.ws;
+
+import com.google.common.collect.Lists;
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.server.ws.Request;
+import org.sonar.api.server.ws.Response;
+import org.sonar.core.computation.db.AnalysisReportDto;
+import org.sonar.server.computation.AnalysisReportQueue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class IsQueueEmptyWebServiceTest {
+
+  IsQueueEmptyWebService.IsQueueEmptyWsAction sut;
+  AnalysisReportQueue queue;
+  Response response;
+
+  @Before
+  public void before() throws Exception {
+    queue = mock(AnalysisReportQueue.class);
+    sut = new IsQueueEmptyWebService.IsQueueEmptyWsAction(queue);
+
+    response = mock(Response.class);
+    when(response.stream()).thenReturn(new FakeStream());
+  }
+
+  @Test
+  public void send_true_when_queue_is_empty() throws Exception {
+    when(queue.all()).thenReturn(new ArrayList<AnalysisReportDto>());
+
+    sut.handle(mock(Request.class), response);
+
+    assertThat(response.stream().toString()).isEqualTo("true");
+  }
+
+  @Test
+  public void send_false_when_queue_is_not_empty() throws Exception {
+    when(queue.all()).thenReturn(Lists.newArrayList(AnalysisReportDto.newForTests(1L)));
+
+    sut.handle(mock(Request.class), response);
+
+    assertThat(response.stream().toString()).isEqualTo("false");
+  }
+
+  private class FakeStream implements Response.Stream {
+    private ByteArrayOutputStream stream;
+
+    private FakeStream() {
+      this.stream = new ByteArrayOutputStream();
+    }
+
+    public String toString() {
+      return stream.toString();
+    }
+
+    @Override
+    public Response.Stream setMediaType(String s) {
+      return null;
+    }
+
+    @Override
+    public Response.Stream setStatus(int httpStatus) {
+      return null;
+    }
+
+    @Override
+    public OutputStream output() {
+      return stream;
+    }
+  }
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ws/IsQueueEmptyWsActionTest.java
deleted file mode 100644 (file)
index 3882643..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-
-package org.sonar.server.computation.ws;
-
-import com.google.common.collect.Lists;
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.server.ws.Request;
-import org.sonar.api.server.ws.Response;
-import org.sonar.core.computation.db.AnalysisReportDto;
-import org.sonar.server.computation.AnalysisReportQueue;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-
-import static org.fest.assertions.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class IsQueueEmptyWsActionTest {
-
-  IsQueueEmptyWsAction sut;
-  AnalysisReportQueue queue;
-  Response response;
-
-  @Before
-  public void before() throws Exception {
-    queue = mock(AnalysisReportQueue.class);
-    sut = new IsQueueEmptyWsAction(queue);
-
-    response = mock(Response.class);
-    when(response.stream()).thenReturn(new FakeStream());
-  }
-
-  @Test
-  public void send_true_when_queue_is_empty() throws Exception {
-    when(queue.all()).thenReturn(new ArrayList<AnalysisReportDto>());
-
-    sut.handle(mock(Request.class), response);
-
-    assertThat(response.stream().toString()).isEqualTo("true");
-  }
-
-  @Test
-  public void send_false_when_queue_is_not_empty() throws Exception {
-    when(queue.all()).thenReturn(Lists.newArrayList(AnalysisReportDto.newForTests(1L)));
-
-    sut.handle(mock(Request.class), response);
-
-    assertThat(response.stream().toString()).isEqualTo("false");
-  }
-
-  private class FakeStream implements Response.Stream {
-    private ByteArrayOutputStream stream;
-
-    private FakeStream() {
-      this.stream = new ByteArrayOutputStream();
-    }
-
-    public String toString() {
-      return stream.toString();
-    }
-
-    @Override
-    public Response.Stream setMediaType(String s) {
-      return null;
-    }
-
-    @Override
-    public Response.Stream setStatus(int httpStatus) {
-      return null;
-    }
-
-    @Override
-    public OutputStream output() {
-      return stream;
-    }
-  }
-}
index 094f175261a0e70cbdbb105c32072b0f040f4d45..9ab7d2b213a9f5d61348092168346d201ccf6836 100644 (file)
@@ -50,7 +50,7 @@ public class QueueWsActionTest {
   public void list_active_reports() throws Exception {
     AnalysisReportDto report = AnalysisReportDto
       .newForTests(1L)
-      .setProjectKey("project-name")
+      .setProjectKey("project-key")
       .setStatus(PENDING)
       .setData(null)
       .setCreatedAt(DateUtils.parseDateTime("2014-10-13T00:00:00+0200"))
@@ -59,12 +59,12 @@ public class QueueWsActionTest {
     List<AnalysisReportDto> reports = Lists.newArrayList(report);
     when(queue.all()).thenReturn(reports);
 
-    WsTester.TestRequest request = tester.newGetRequest(ComputationWebService.API_ENDPOINT, "active");
-    request.execute().assertJson(getClass(), "list_active_reports.json", false);
+    WsTester.TestRequest request = tester.newGetRequest(ComputationWebService.API_ENDPOINT, "queue");
+    request.execute().assertJson(getClass(), "list_queue_reports.json", false);
   }
 
   @Test
   public void define() throws Exception {
-    assertThat(tester.controller(ComputationWebService.API_ENDPOINT).action("active")).isNotNull();
+    assertThat(tester.controller(ComputationWebService.API_ENDPOINT).action("queue")).isNotNull();
   }
 }
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/ws/QueueWsActionTest/list_active_reports.json b/server/sonar-server/src/test/resources/org/sonar/server/computation/ws/QueueWsActionTest/list_active_reports.json
deleted file mode 100644 (file)
index a82f67d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-  "reports": [
-    {
-      "id": 1,
-      "status": "PENDING",
-      "projectName": "project-name",
-      "project": "project-name",
-      "submittedAt": "2014-10-13T00:00:00+0200",
-      "startedAt": "2014-10-13T00:00:00+0200",
-      "finishedAt": "2014-10-13T00:00:00+0200"
-    }
-  ]
-}
\ No newline at end of file
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/ws/QueueWsActionTest/list_queue_reports.json b/server/sonar-server/src/test/resources/org/sonar/server/computation/ws/QueueWsActionTest/list_queue_reports.json
new file mode 100644 (file)
index 0000000..67f2234
--- /dev/null
@@ -0,0 +1,13 @@
+{
+  "reports": [
+    {
+      "key": 1,
+      "status": "PENDING",
+      "projectName": "project-key",
+      "projectKey": "project-key",
+      "submittedAt": "2014-10-13T00:00:00+0200",
+      "startedAt": "2014-10-13T00:00:00+0200",
+      "finishedAt": "2014-10-13T00:00:00+0200"
+    }
+  ]
+}
\ No newline at end of file
index 16b23b10851b20621359121c99ad54883f8652e1..bff33c97932336587355320103d987d65bfa45fb 100644 (file)
@@ -21,12 +21,12 @@ define [
 
 
     fetchActive: ->
-      @fetch { url: "#{baseUrl}/api/analysis_reports/active" }, { reset: true }
+      @fetch { url: "#{baseUrl}/api/computation/queue" }, { reset: true }
 
 
     fetchHistory: (options = {  }) ->
       _.extend options,
-        url: "#{baseUrl}/api/analysis_reports/history"
+        url: "#{baseUrl}/api/computation/history"
       options.data = options.data || {}
       options.data.ps = 50
       @fetch options, { reset: true }
index 12bdd6d2240e0109161644d1b1c569f93dd72497..6f2242a2ca759dedb26bfa8115546ebc9bf9db9c 100644 (file)
@@ -102,7 +102,7 @@ public class PublishReportJob implements BatchComponent {
     URL url;
     try {
       int snapshotId = resourceCache.get(project.getEffectiveKey()).snapshotId();
-      url = new URL(serverClient.getURL() + "/api/analysis_reports/submit_report?projectKey=" + project.getEffectiveKey() + "&snapshot=" + snapshotId);
+      url = new URL(serverClient.getURL() + "/api/computation/submit_report?projectKey=" + project.getEffectiveKey() + "&snapshot=" + snapshotId);
     } catch (MalformedURLException e) {
       throw new IllegalArgumentException("Invalid URL", e);
     }