From 950454051f247863735b75d251bee8460c7e07be Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Mon, 14 Mar 2016 16:51:28 +0100 Subject: [PATCH] SONAR-6732 disable Compute Engine in WebServer --- .../container/ComputeEngineContainerImpl.java | 5 +- .../ComputeEngineContainerImplTest.java | 4 +- .../src/main/java/org/sonar/ce/CeModule.java | 46 +++ .../log/CeFileAppenderFactory.java | 6 +- .../log/CeLogAcceptFilter.java | 2 +- .../log/CeLogDenyFilter.java | 2 +- .../computation => ce}/log/CeLogging.java | 4 +- .../computation => ce}/log/LogFileRef.java | 4 +- .../computation => ce}/log/package-info.java | 2 +- .../monitoring/CEQueueStatus.java | 2 +- .../ce/monitoring/DummyCEQueueStatusImpl.java | 93 ++++++ .../monitoring}/package-info.java | 2 +- .../main/java/org/sonar/ce/package-info.java | 23 ++ .../property/CePropertyDefinitions.java | 4 +- .../org/sonar/ce/property/package-info.java | 23 ++ .../computation => ce}/queue/CeQueue.java | 44 +-- .../computation => ce}/queue/CeQueueImpl.java | 114 +------- .../queue/CeQueueListener.java | 2 +- .../computation => ce}/queue/CeTask.java | 2 +- .../queue/CeTaskResult.java | 5 +- .../queue/CeTaskSubmit.java | 2 +- .../java/org/sonar/ce/queue/package-info.java | 23 ++ .../queue/report/ReportFiles.java | 2 +- .../queue/report/ReportSubmitter.java | 8 +- .../sonar/ce/queue/report/package-info.java | 23 ++ .../taskprocessor/CeTaskProcessor.java | 6 +- .../ReportTaskProcessorDeclaration.java | 44 +++ .../sonar/ce/taskprocessor/package-info.java | 23 ++ .../server/app/ServerProcessLogging.java | 4 +- .../ws/ActivityAction.java | 4 +- .../{computation => ce}/ws/CancelAction.java | 4 +- .../ws/CancelAllAction.java | 4 +- .../server/{computation => ce}/ws/CeWs.java | 2 +- .../{computation => ce}/ws/CeWsAction.java | 2 +- .../{computation => ce}/ws/CeWsModule.java | 2 +- .../ws/ComponentAction.java | 2 +- .../ws/IsQueueEmptyWs.java | 2 +- .../{computation => ce}/ws/LogsAction.java | 6 +- .../{computation => ce}/ws/SubmitAction.java | 6 +- .../{computation => ce}/ws/TaskAction.java | 2 +- .../{computation => ce}/ws/TaskFormatter.java | 6 +- .../ws/TaskTypesAction.java | 4 +- .../{computation => ce}/ws/package-info.java | 2 +- .../sonar/server/computation/CeModule.java | 4 +- .../batch/BatchReportDirectoryHolder.java | 2 +- .../container/ComputeEngineContainer.java | 2 +- .../container/ContainerFactory.java | 2 +- .../container/ContainerFactoryImpl.java | 2 +- ...ReportComputeEngineContainerPopulator.java | 2 +- .../container/ReportProcessingModule.java | 2 +- .../monitoring/CEQueueStatusImpl.java | 1 + .../monitoring/ComputeEngineQueueMonitor.java | 3 +- .../computation/queue/CeQueueCleaner.java | 6 +- .../computation/queue/CeQueueInitializer.java | 2 +- .../computation/queue/CeQueueModule.java | 6 +- .../computation/queue/InternalCeQueue.java | 76 +++++ .../queue/InternalCeQueueImpl.java | 146 ++++++++++ .../computation/queue/PurgeCeActivities.java | 4 +- .../report/CleanReportQueueListener.java | 5 +- .../computation/step/ExtractReportStep.java | 4 +- .../LoadReportAnalysisMetadataHolderStep.java | 2 +- .../step/PublishTaskResultStep.java | 2 +- .../CeTaskProcessorRepository.java | 3 +- .../CeTaskProcessorRepositoryImpl.java | 3 +- .../taskprocessor/CeWorkerCallable.java | 4 +- .../taskprocessor/CeWorkerCallableImpl.java | 14 +- .../MutableTaskResultHolder.java | 2 +- .../MutableTaskResultHolderImpl.java | 2 +- .../taskprocessor/TaskResultHolder.java | 2 +- .../report/ReportTaskProcessor.java | 6 +- .../platformlevel/PlatformLevel1.java | 2 +- .../platformlevel/PlatformLevel4.java | 13 +- .../platformlevel/PlatformLevelStartup.java | 2 - .../ui/ws/ComponentNavigationAction.java | 2 +- .../ws/activity-example.json | 0 .../ws/component-example.json | 0 .../ws/is_queue_empty-example.txt | 0 .../{computation => ce}/ws/logs-example.log | 0 .../ws/submit-example.json | 0 .../{computation => ce}/ws/task-example.json | 0 .../ws/task_types-example.json | 0 .../log/CeFileAppenderFactoryTest.java | 2 +- .../log/CeLogAcceptFilterTest.java | 4 +- .../log/CeLogDenyFilterTest.java | 4 +- .../computation => ce}/log/CeLoggingTest.java | 9 +- .../log/LogFileRefTest.java | 3 +- .../CEQueueStatusImplConcurrentTest.java | 3 +- .../property}/CePropertyDefinitionsTest.java | 3 +- .../org/sonar/ce/queue/CeQueueImplTest.java | 273 ++++++++++++++++++ .../computation => ce}/queue/CeTaskTest.java | 2 +- .../queue/report/ReportSubmitterTest.java | 8 +- .../ReportTaskProcessorDeclarationTest.java | 48 +++ .../server/app/ServerProcessLoggingTest.java | 3 +- .../ws/ActivityActionTest.java | 8 +- .../ws/CancelActionTest.java | 4 +- .../ws/CancelAllActionTest.java | 4 +- .../ws/CeWsModuleTest.java | 3 +- .../{computation => ce}/ws/CeWsTest.java | 4 +- .../ws/ComponentActionTest.java | 6 +- .../ws/LogsActionTest.java | 6 +- .../ws/SubmitActionTest.java | 6 +- .../ws/TaskActionTest.java | 6 +- .../ws/TaskFormatterTest.java | 6 +- .../ws/TaskTypesActionTest.java | 8 +- .../computation/PurgeCeActivitiesTest.java | 4 +- .../server/computation/ReportFilesTest.java | 2 +- ...rtComputeEngineContainerPopulatorTest.java | 2 +- .../ComputeEngineQueueMonitorTest.java | 3 +- .../computation/queue/CeQueueCleanerTest.java | 4 +- .../queue/CeQueueInitializerTest.java | 4 +- ...Test.java => InternalCeQueueImplTest.java} | 12 +- .../report/CleanReportQueueListenerTest.java | 3 +- .../step/ComputationStepsTest.java | 2 +- .../step/ExtractReportStepTest.java | 4 +- ...dReportAnalysisMetadataHolderStepTest.java | 2 +- .../CeTaskProcessorRepositoryImplTest.java | 5 +- .../CeTaskProcessorRepositoryRule.java | 5 +- .../CeWorkerCallableImplTest.java | 9 +- .../MutableTaskResultHolderImplTest.java | 2 +- 119 files changed, 1065 insertions(+), 321 deletions(-) create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/CeModule.java rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/log/CeFileAppenderFactory.java (94%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/log/CeLogAcceptFilter.java (96%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/log/CeLogDenyFilter.java (96%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/log/CeLogging.java (98%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/log/LogFileRef.java (97%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/log/package-info.java (95%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/monitoring/CEQueueStatus.java (98%) create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/monitoring/DummyCEQueueStatusImpl.java rename server/sonar-server/src/main/java/org/sonar/{server/computation/property => ce/monitoring}/package-info.java (95%) create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/package-info.java rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/property/CePropertyDefinitions.java (94%) create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/property/package-info.java rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/CeQueue.java (65%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/CeQueueImpl.java (72%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/CeQueueListener.java (95%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/CeTask.java (98%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/CeTaskResult.java (89%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/CeTaskSubmit.java (98%) create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/queue/package-info.java rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/report/ReportFiles.java (98%) rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/queue/report/ReportSubmitter.java (94%) create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/queue/report/package-info.java rename server/sonar-server/src/main/java/org/sonar/{server/computation => ce}/taskprocessor/CeTaskProcessor.java (93%) create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java create mode 100644 server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/package-info.java rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/ActivityAction.java (99%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/CancelAction.java (95%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/CancelAllAction.java (95%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/CeWs.java (97%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/CeWsAction.java (96%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/CeWsModule.java (96%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/ComponentAction.java (98%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/IsQueueEmptyWs.java (98%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/LogsAction.java (96%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/SubmitAction.java (95%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/TaskAction.java (99%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/TaskFormatter.java (98%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/TaskTypesAction.java (95%) rename server/sonar-server/src/main/java/org/sonar/server/{computation => ce}/ws/package-info.java (95%) create mode 100644 server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueue.java create mode 100644 server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueueImpl.java rename server/sonar-server/src/main/resources/org/sonar/server/{computation => ce}/ws/activity-example.json (100%) rename server/sonar-server/src/main/resources/org/sonar/server/{computation => ce}/ws/component-example.json (100%) rename server/sonar-server/src/main/resources/org/sonar/server/{computation => ce}/ws/is_queue_empty-example.txt (100%) rename server/sonar-server/src/main/resources/org/sonar/server/{computation => ce}/ws/logs-example.log (100%) rename server/sonar-server/src/main/resources/org/sonar/server/{computation => ce}/ws/submit-example.json (100%) rename server/sonar-server/src/main/resources/org/sonar/server/{computation => ce}/ws/task-example.json (100%) rename server/sonar-server/src/main/resources/org/sonar/server/{computation => ce}/ws/task_types-example.json (100%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/log/CeFileAppenderFactoryTest.java (97%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/log/CeLogAcceptFilterTest.java (93%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/log/CeLogDenyFilterTest.java (93%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/log/CeLoggingTest.java (97%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/log/LogFileRefTest.java (97%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/monitoring/CEQueueStatusImplConcurrentTest.java (97%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce/property}/CePropertyDefinitionsTest.java (92%) create mode 100644 server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/queue/CeTaskTest.java (98%) rename server/sonar-server/src/test/java/org/sonar/{server/computation => ce}/queue/report/ReportSubmitterTest.java (97%) create mode 100644 server/sonar-server/src/test/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclarationTest.java rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/ActivityActionTest.java (98%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/CancelActionTest.java (96%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/CancelAllActionTest.java (95%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/CeWsModuleTest.java (94%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/CeWsTest.java (92%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/ComponentActionTest.java (97%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/LogsActionTest.java (96%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/SubmitActionTest.java (96%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/TaskActionTest.java (98%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/TaskFormatterTest.java (98%) rename server/sonar-server/src/test/java/org/sonar/server/{computation => ce}/ws/TaskTypesActionTest.java (90%) rename server/sonar-server/src/test/java/org/sonar/server/computation/queue/{CeQueueImplTest.java => InternalCeQueueImplTest.java} (97%) diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index ad8abbfd0a9..4afc8215683 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -34,6 +34,7 @@ import org.sonar.api.server.rule.RulesDefinitionXmlLoader; import org.sonar.api.utils.Durations; import org.sonar.api.utils.System2; import org.sonar.api.utils.UriReader; +import org.sonar.ce.property.CePropertyDefinitions; import org.sonar.core.component.DefaultResourceTypes; import org.sonar.core.config.CorePropertyDefinitions; import org.sonar.core.i18n.DefaultI18n; @@ -65,7 +66,6 @@ import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentService; import org.sonar.server.computation.CeModule; import org.sonar.server.computation.container.ReportProcessingModule; -import org.sonar.server.computation.property.CePropertyDefinitions; import org.sonar.server.computation.queue.CeQueueModule; import org.sonar.server.computation.queue.PurgeCeActivities; import org.sonar.server.computation.taskprocessor.CeTaskProcessorModule; @@ -111,6 +111,7 @@ import org.sonar.server.plugins.InstalledPluginReferentialFactory; import org.sonar.server.plugins.ServerExtensionInstaller; import org.sonar.server.plugins.ServerPluginJarExploder; import org.sonar.server.plugins.ServerPluginRepository; +import org.sonar.server.properties.ProjectSettingsFactory; import org.sonar.server.qualityprofile.BuiltInProfiles; import org.sonar.server.qualityprofile.QProfileComparison; import org.sonar.server.qualityprofile.QProfileLookup; @@ -554,6 +555,8 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { CeTaskProcessorModule.class, // CeWsModule.class, no Web Service in CE + ProjectSettingsFactory.class, + // UI // GlobalNavigationAction.class, no Web Service in CE // SettingsNavigationAction.class, no Web Service in CE diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java index fd255a25fe4..44a2b815a9e 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java @@ -79,8 +79,8 @@ public class ComputeEngineContainerImplTest { + 59 // content of MigrationStepModule + 10 // level 2 + 5 // level 3 - + 76 // level 4 - + 6 // content of CeModule + + 77 // level 4 + + 5 // content of CeModule + 7 // content of CeQueueModule + 4 // content of ReportProcessingModule + 4 // content of CeTaskProcessorModule diff --git a/server/sonar-server/src/main/java/org/sonar/ce/CeModule.java b/server/sonar-server/src/main/java/org/sonar/ce/CeModule.java new file mode 100644 index 00000000000..f4f05b14fba --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/CeModule.java @@ -0,0 +1,46 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.ce; + +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.monitoring.DummyCEQueueStatusImpl; +import org.sonar.ce.queue.CeQueueImpl; +import org.sonar.ce.queue.report.ReportFiles; +import org.sonar.ce.queue.report.ReportSubmitter; +import org.sonar.ce.taskprocessor.ReportTaskProcessorDeclaration; +import org.sonar.core.platform.Module; + +public class CeModule extends Module { + @Override + protected void configureModule() { + add(CeLogging.class, + + // queue monitoring + DummyCEQueueStatusImpl.class, + + // Queue + CeQueueImpl.class, + ReportSubmitter.class, + ReportFiles.class, + + // Core tasks processors + ReportTaskProcessorDeclaration.class); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeFileAppenderFactory.java b/server/sonar-server/src/main/java/org/sonar/ce/log/CeFileAppenderFactory.java similarity index 94% rename from server/sonar-server/src/main/java/org/sonar/server/computation/log/CeFileAppenderFactory.java rename to server/sonar-server/src/main/java/org/sonar/ce/log/CeFileAppenderFactory.java index fc8ffab5b0b..f07289fc1e3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeFileAppenderFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/log/CeFileAppenderFactory.java @@ -17,7 +17,7 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.classic.encoder.PatternLayoutEncoder; import ch.qos.logback.core.Context; @@ -25,7 +25,7 @@ import ch.qos.logback.core.FileAppender; import ch.qos.logback.core.sift.AppenderFactory; import com.google.common.annotations.VisibleForTesting; import java.io.File; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import static java.lang.String.format; @@ -47,7 +47,7 @@ public class CeFileAppenderFactory implements AppenderFactory { /** * @param context * @param discriminatingValue path of log file relative to the directory data/ce/logs - * @see CeLogging#initForTask(CeTask) + * @see CeLogging#initForTask(CeTask) */ @Override public FileAppender buildAppender(Context context, String discriminatingValue) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogAcceptFilter.java b/server/sonar-server/src/main/java/org/sonar/ce/log/CeLogAcceptFilter.java similarity index 96% rename from server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogAcceptFilter.java rename to server/sonar-server/src/main/java/org/sonar/ce/log/CeLogAcceptFilter.java index 83818796914..892eea2cd7d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogAcceptFilter.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/log/CeLogAcceptFilter.java @@ -17,7 +17,7 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogDenyFilter.java b/server/sonar-server/src/main/java/org/sonar/ce/log/CeLogDenyFilter.java similarity index 96% rename from server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogDenyFilter.java rename to server/sonar-server/src/main/java/org/sonar/ce/log/CeLogDenyFilter.java index c1d564eab36..ea02d4d402d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogDenyFilter.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/log/CeLogDenyFilter.java @@ -17,7 +17,7 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogging.java b/server/sonar-server/src/main/java/org/sonar/ce/log/CeLogging.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogging.java rename to server/sonar-server/src/main/java/org/sonar/ce/log/CeLogging.java index 1b746df41ea..80264dcf329 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/log/CeLogging.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/log/CeLogging.java @@ -17,7 +17,7 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; @@ -40,7 +40,7 @@ import org.sonar.api.config.Settings; import org.sonar.process.LogbackHelper; import org.sonar.process.ProcessProperties; import org.sonar.process.Props; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java b/server/sonar-server/src/main/java/org/sonar/ce/log/LogFileRef.java similarity index 97% rename from server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java rename to server/sonar-server/src/main/java/org/sonar/ce/log/LogFileRef.java index 141eeba1e21..6692c7078e6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/log/LogFileRef.java @@ -17,7 +17,7 @@ * 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.log; +package org.sonar.ce.log; import com.google.common.annotations.VisibleForTesting; import java.util.regex.Pattern; @@ -25,7 +25,7 @@ import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import static java.lang.String.format; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/log/package-info.java b/server/sonar-server/src/main/java/org/sonar/ce/log/package-info.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/log/package-info.java rename to server/sonar-server/src/main/java/org/sonar/ce/log/package-info.java index f5eb15050ee..fa5b1f7790b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/log/package-info.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/log/package-info.java @@ -18,6 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonar.server.computation.log; +package org.sonar.ce.log; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/CEQueueStatus.java b/server/sonar-server/src/main/java/org/sonar/ce/monitoring/CEQueueStatus.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/CEQueueStatus.java rename to server/sonar-server/src/main/java/org/sonar/ce/monitoring/CEQueueStatus.java index 0dcab1aa0f2..1ffac1e5ffd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/CEQueueStatus.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/monitoring/CEQueueStatus.java @@ -17,7 +17,7 @@ * 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.monitoring; +package org.sonar.ce.monitoring; public interface CEQueueStatus { diff --git a/server/sonar-server/src/main/java/org/sonar/ce/monitoring/DummyCEQueueStatusImpl.java b/server/sonar-server/src/main/java/org/sonar/ce/monitoring/DummyCEQueueStatusImpl.java new file mode 100644 index 00000000000..9ed4fcc721a --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/monitoring/DummyCEQueueStatusImpl.java @@ -0,0 +1,93 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.ce.monitoring; + +import java.util.concurrent.atomic.AtomicLong; + +/** + * FIXME fix this dummy CEQueueStatus implementation, probably by removing its use from + */ +public class DummyCEQueueStatusImpl implements CEQueueStatus { + private final AtomicLong received = new AtomicLong(0); + + @Override + public long initPendingCount(long initialPendingCount) { + return notImplemented(); + } + + @Override + public long addReceived() { + return received.incrementAndGet(); + } + + @Override + public long addReceived(long numberOfReceived) { + return received.addAndGet(numberOfReceived); + } + + @Override + public long addInProgress() { + return notImplemented(); + } + + @Override + public long addSuccess(long processingTime) { + return notImplemented(); + } + + @Override + public long addError(long processingTime) { + return notImplemented(); + } + + @Override + public long getReceivedCount() { + return received.get(); + } + + @Override + public long getPendingCount() { + return notImplemented(); + } + + @Override + public long getInProgressCount() { + return notImplemented(); + } + + @Override + public long getErrorCount() { + return notImplemented(); + } + + @Override + public long getSuccessCount() { + return notImplemented(); + } + + @Override + public long getProcessingTime() { + return notImplemented(); + } + + private static long notImplemented() { + throw new UnsupportedOperationException("Not implemented!"); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/property/package-info.java b/server/sonar-server/src/main/java/org/sonar/ce/monitoring/package-info.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/property/package-info.java rename to server/sonar-server/src/main/java/org/sonar/ce/monitoring/package-info.java index a789ce7bcd4..08f19c0b25b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/property/package-info.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/monitoring/package-info.java @@ -18,6 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonar.server.computation.property; +package org.sonar.ce.monitoring; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/ce/package-info.java b/server/sonar-server/src/main/java/org/sonar/ce/package-info.java new file mode 100644 index 00000000000..29fd81a1a49 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.ce; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/property/CePropertyDefinitions.java b/server/sonar-server/src/main/java/org/sonar/ce/property/CePropertyDefinitions.java similarity index 94% rename from server/sonar-server/src/main/java/org/sonar/server/computation/property/CePropertyDefinitions.java rename to server/sonar-server/src/main/java/org/sonar/ce/property/CePropertyDefinitions.java index dcb94aa6083..9ad2dc1662e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/property/CePropertyDefinitions.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/property/CePropertyDefinitions.java @@ -17,13 +17,13 @@ * 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.property; +package org.sonar.ce.property; import java.util.List; import org.sonar.api.CoreProperties; import org.sonar.api.PropertyType; import org.sonar.api.config.PropertyDefinition; -import org.sonar.server.computation.log.CeLogging; +import org.sonar.ce.log.CeLogging; import static java.util.Arrays.asList; diff --git a/server/sonar-server/src/main/java/org/sonar/ce/property/package-info.java b/server/sonar-server/src/main/java/org/sonar/ce/property/package-info.java new file mode 100644 index 00000000000..58c72408e54 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/property/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.ce.property; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueue.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueue.java similarity index 65% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueue.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueue.java index dfedb006a47..fe8b10e51ff 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueue.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueue.java @@ -17,13 +17,10 @@ * 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.queue; +package org.sonar.ce.queue; -import com.google.common.base.Optional; import java.util.Collection; import java.util.List; -import javax.annotation.Nullable; -import org.sonar.db.ce.CeActivityDto; /** * Queue of pending Compute Engine tasks. Both producer and consumer actions @@ -60,17 +57,6 @@ public interface CeQueue { */ List massSubmit(Collection submissions); - /** - * Peek the oldest task in status {@link org.sonar.db.ce.CeQueueDto.Status#PENDING}. - * The task status is changed to {@link org.sonar.db.ce.CeQueueDto.Status#IN_PROGRESS}. - * Does not return anything if the queue is paused (see {@link #isPeekPaused()}. - * - *

Only a single task can be peeked by project.

- * - *

An unchecked exception may be thrown on technical errors (db connection, ...).

- */ - Optional peek(); - /** * Cancels a task in status {@link org.sonar.db.ce.CeQueueDto.Status#PENDING}. An unchecked * exception is thrown if the status is not {@link org.sonar.db.ce.CeQueueDto.Status#PENDING}. @@ -81,41 +67,19 @@ public interface CeQueue { boolean cancel(String taskUuid); /** - * Removes all the tasks from the queue, whatever their status. They are marked + * Removes all the tasks from the queue, except the tasks with status + * {@link org.sonar.db.ce.CeQueueDto.Status#IN_PROGRESS} are ignored. They are marked * as {@link org.sonar.db.ce.CeActivityDto.Status#CANCELED} in past activity. - * This method can NOT be called when workers are being executed, as in progress - * tasks can't be killed. - * - * @return the number of canceled tasks - */ - int clear(); - - /** - * Similar as {@link #clear()}, except that the tasks with status - * {@link org.sonar.db.ce.CeQueueDto.Status#IN_PROGRESS} are ignored. This method - * can be called at runtime, even if workers are being executed. + * This method can be called at runtime, even if workers are being executed. * * @return the number of canceled tasks */ int cancelAll(); - /** - * Removes a task from the queue and registers it to past activities. This method - * is called by Compute Engine workers when task is processed and can include an option {@link CeTaskResult} object. - * - * @throws IllegalStateException if the task does not exist in the queue - */ - void remove(CeTask task, CeActivityDto.Status status, @Nullable CeTaskResult taskResult); - void pauseSubmit(); void resumeSubmit(); boolean isSubmitPaused(); - void pausePeek(); - - void resumePeek(); - - boolean isPeekPaused(); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java similarity index 72% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java index 5d4cc559dc6..a6aff101fc0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java @@ -17,7 +17,7 @@ * 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.queue; +package org.sonar.ce.queue; import com.google.common.base.Function; import com.google.common.base.Optional; @@ -31,25 +31,22 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.sonar.api.server.ServerSide; -import org.sonar.api.utils.System2; import org.sonar.core.util.UuidFactory; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.component.ComponentDto; -import org.sonar.server.computation.monitoring.CEQueueStatus; +import org.sonar.ce.monitoring.CEQueueStatus; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Predicates.notNull; import static com.google.common.collect.FluentIterable.from; -import static java.lang.String.format; import static org.sonar.db.component.ComponentDtoFunctions.toUuid; @ServerSide public class CeQueueImpl implements CeQueue { - private final System2 system2; private final DbClient dbClient; private final UuidFactory uuidFactory; private final CEQueueStatus queueStatus; @@ -57,11 +54,15 @@ public class CeQueueImpl implements CeQueue { // state private AtomicBoolean submitPaused = new AtomicBoolean(false); - private AtomicBoolean peekPaused = new AtomicBoolean(false); - public CeQueueImpl(System2 system2, DbClient dbClient, UuidFactory uuidFactory, - CEQueueStatus queueStatus, CeQueueListener[] listeners) { - this.system2 = system2; + /** + * Constructor in case there is no CeQueueListener + */ + public CeQueueImpl(DbClient dbClient, UuidFactory uuidFactory, CEQueueStatus queueStatus) { + this(dbClient, uuidFactory, queueStatus, new CeQueueListener[]{}); + } + + public CeQueueImpl(DbClient dbClient, UuidFactory uuidFactory, CEQueueStatus queueStatus, CeQueueListener[] listeners) { this.dbClient = dbClient; this.uuidFactory = uuidFactory; this.queueStatus = queueStatus; @@ -112,27 +113,7 @@ public class CeQueueImpl implements CeQueue { } } - @Override - public Optional peek() { - if (peekPaused.get()) { - return Optional.absent(); - } - DbSession dbSession = dbClient.openSession(false); - try { - Optional dto = dbClient.ceQueueDao().peek(dbSession); - CeTask task = null; - if (dto.isPresent()) { - task = loadTask(dbSession, dto.get()); - queueStatus.addInProgress(); - } - return Optional.fromNullable(task); - - } finally { - dbClient.closeSession(dbSession); - } - } - - private CeTask loadTask(DbSession dbSession, CeQueueDto dto) { + protected CeTask loadTask(DbSession dbSession, CeQueueDto dto) { if (dto.getComponentUuid() == null) { return new CeQueueDtoToCeTask().apply(dto); } @@ -164,7 +145,7 @@ public class CeQueueImpl implements CeQueue { Optional queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, taskUuid); if (queueDto.isPresent()) { checkState(CeQueueDto.Status.PENDING.equals(queueDto.get().getStatus()), "Task is in progress and can't be canceled [uuid=%s]", taskUuid); - cancel(dbSession, queueDto.get()); + cancelImpl(dbSession, queueDto.get()); return true; } return false; @@ -173,30 +154,25 @@ public class CeQueueImpl implements CeQueue { } } - void cancel(DbSession dbSession, CeQueueDto q) { + protected void cancelImpl(DbSession dbSession, CeQueueDto q) { CeTask task = loadTask(dbSession, q); CeActivityDto activityDto = new CeActivityDto(q); activityDto.setStatus(CeActivityDto.Status.CANCELED); remove(dbSession, task, q, activityDto); } - @Override - public int clear() { - return cancelAll(true); - } - @Override public int cancelAll() { return cancelAll(false); } - private int cancelAll(boolean includeInProgress) { + protected int cancelAll(boolean includeInProgress) { int count = 0; DbSession dbSession = dbClient.openSession(false); try { for (CeQueueDto queueDto : dbClient.ceQueueDao().selectAllInAscOrder(dbSession)) { if (includeInProgress || !queueDto.getStatus().equals(CeQueueDto.Status.IN_PROGRESS)) { - cancel(dbSession, queueDto); + cancelImpl(dbSession, queueDto); count++; } } @@ -206,50 +182,7 @@ public class CeQueueImpl implements CeQueue { } } - @Override - public void remove(CeTask task, CeActivityDto.Status status, CeTaskResult taskResult) { - DbSession dbSession = dbClient.openSession(false); - try { - Optional queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, task.getUuid()); - if (!queueDto.isPresent()) { - throw new IllegalStateException(format("Task does not exist anymore: %s", task)); - } - CeActivityDto activityDto = new CeActivityDto(queueDto.get()); - activityDto.setStatus(status); - updateQueueStatus(status, activityDto); - updateTaskResult(activityDto, taskResult); - remove(dbSession, task, queueDto.get(), activityDto); - - } finally { - dbClient.closeSession(dbSession); - } - } - - private static void updateTaskResult(CeActivityDto activityDto, @Nullable CeTaskResult taskResult) { - if (taskResult != null) { - Long snapshotId = taskResult.getSnapshotId(); - if (snapshotId != null) { - activityDto.setSnapshotId(snapshotId); - } - } - } - - private void updateQueueStatus(CeActivityDto.Status status, CeActivityDto activityDto) { - Long startedAt = activityDto.getStartedAt(); - if (startedAt == null) { - return; - } - activityDto.setExecutedAt(system2.now()); - long executionTime = activityDto.getExecutedAt() - startedAt; - activityDto.setExecutionTimeMs(executionTime); - if (status == CeActivityDto.Status.SUCCESS) { - queueStatus.addSuccess(executionTime); - } else { - queueStatus.addError(executionTime); - } - } - - private void remove(DbSession dbSession, CeTask task, CeQueueDto queueDto, CeActivityDto activityDto) { + protected void remove(DbSession dbSession, CeTask task, CeQueueDto queueDto, CeActivityDto activityDto) { dbClient.ceActivityDao().insert(dbSession, activityDto); dbClient.ceQueueDao().deleteByUuid(dbSession, queueDto.getUuid()); dbSession.commit(); @@ -273,21 +206,6 @@ public class CeQueueImpl implements CeQueue { return submitPaused.get(); } - @Override - public void pausePeek() { - this.peekPaused.set(true); - } - - @Override - public void resumePeek() { - this.peekPaused.set(false); - } - - @Override - public boolean isPeekPaused() { - return peekPaused.get(); - } - private static class CeQueueDtoToCeTask implements Function { private final Map componentDtoByUuid; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueListener.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueListener.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueListener.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueListener.java index 3c837c9e78c..90e3a0a0915 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueListener.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueListener.java @@ -17,7 +17,7 @@ * 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.queue; +package org.sonar.ce.queue; import org.sonar.db.ce.CeActivityDto; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTask.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeTask.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTask.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/CeTask.java index e81ec1a20a2..391a0d50f85 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTask.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeTask.java @@ -17,7 +17,7 @@ * 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.queue; +package org.sonar.ce.queue; import com.google.common.base.Objects; import javax.annotation.CheckForNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTaskResult.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeTaskResult.java similarity index 89% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTaskResult.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/CeTaskResult.java index 6035bb44536..28f106d240e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTaskResult.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeTaskResult.java @@ -17,14 +17,15 @@ * 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.queue; +package org.sonar.ce.queue; import javax.annotation.CheckForNull; +import org.sonar.ce.taskprocessor.CeTaskProcessor; /** * Represents the result of the processing of a {@link CeTask}. * - * @see {@link org.sonar.server.computation.taskprocessor.CeTaskProcessor#process(CeTask)} + * @see {@link CeTaskProcessor#process(CeTask)} */ public interface CeTaskResult { /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTaskSubmit.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeTaskSubmit.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTaskSubmit.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/CeTaskSubmit.java index 0d621eb8f84..10230be5219 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeTaskSubmit.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeTaskSubmit.java @@ -17,7 +17,7 @@ * 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.queue; +package org.sonar.ce.queue; import java.util.Objects; import javax.annotation.CheckForNull; diff --git a/server/sonar-server/src/main/java/org/sonar/ce/queue/package-info.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/package-info.java new file mode 100644 index 00000000000..f7bf1c79b70 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.ce.queue; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/ReportFiles.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/report/ReportFiles.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/ReportFiles.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/report/ReportFiles.java index 1bc74abf973..7efca8e9def 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/ReportFiles.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/report/ReportFiles.java @@ -17,7 +17,7 @@ * 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.queue.report; +package org.sonar.ce.queue.report; import java.io.File; import java.io.InputStream; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/ReportSubmitter.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/report/ReportSubmitter.java similarity index 94% rename from server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/ReportSubmitter.java rename to server/sonar-server/src/main/java/org/sonar/ce/queue/report/ReportSubmitter.java index 5e2ec49215a..e3f357fd076 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/ReportSubmitter.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/report/ReportSubmitter.java @@ -17,7 +17,7 @@ * 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.queue.report; +package org.sonar.ce.queue.report; import java.io.InputStream; import javax.annotation.Nullable; @@ -29,9 +29,9 @@ import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; import org.sonar.server.component.ComponentService; import org.sonar.server.component.NewComponent; -import org.sonar.server.computation.queue.CeQueue; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.CeTaskSubmit; +import org.sonar.ce.queue.CeQueue; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskSubmit; import org.sonar.server.permission.PermissionService; import org.sonar.server.user.UserSession; diff --git a/server/sonar-server/src/main/java/org/sonar/ce/queue/report/package-info.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/report/package-info.java new file mode 100644 index 00000000000..3c197b8c457 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/report/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.ce.queue.report; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessor.java b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessor.java similarity index 93% rename from server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessor.java rename to server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessor.java index 48fb7e0f54e..eb6d91d5408 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessor.java +++ b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessor.java @@ -17,12 +17,12 @@ * 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.taskprocessor; +package org.sonar.ce.taskprocessor; import java.util.Set; import javax.annotation.CheckForNull; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; /** * This interface is used to provide the processing code for {@link CeTask}s of one or more type to be called by the diff --git a/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java new file mode 100644 index 00000000000..af2f851fa17 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclaration.java @@ -0,0 +1,44 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.ce.taskprocessor; + +import java.util.Collections; +import java.util.Set; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.db.ce.CeTaskTypes; + +/** + * CeTaskProcessor without any real implementation used to declare the CeTask type to the WebServer only. + */ +public class ReportTaskProcessorDeclaration implements CeTaskProcessor { + + private static final Set HANDLED_TYPES = Collections.singleton(CeTaskTypes.REPORT); + + @Override + public Set getHandledCeTaskTypes() { + return HANDLED_TYPES; + } + + @Override + public CeTaskResult process(CeTask task) { + throw new UnsupportedOperationException("process must not be called in WebServer"); + } +} diff --git a/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/package-info.java b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/package-info.java new file mode 100644 index 00000000000..66451d05b90 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/ce/taskprocessor/package-info.java @@ -0,0 +1,23 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +@ParametersAreNonnullByDefault +package org.sonar.ce.taskprocessor; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java b/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java index fbbd8b49f6d..cca3904252d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java +++ b/server/sonar-server/src/main/java/org/sonar/server/app/ServerProcessLogging.java @@ -29,8 +29,8 @@ import org.sonar.api.utils.MessageException; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.process.LogbackHelper; import org.sonar.process.Props; -import org.sonar.server.computation.log.CeLogDenyFilter; -import org.sonar.server.computation.log.CeLogging; +import org.sonar.ce.log.CeLogDenyFilter; +import org.sonar.ce.log.CeLogging; import org.sonar.server.platform.ServerLogging; /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActivityAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java similarity index 99% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActivityAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java index a318964313d..69781bece76 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ActivityAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ActivityAction.java @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.computation.ws; +package org.sonar.server.ce.ws; import com.google.common.base.Joiner; import com.google.common.base.Optional; @@ -50,7 +50,7 @@ import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentDtoFunctions; import org.sonar.db.component.ComponentQuery; -import org.sonar.server.computation.taskprocessor.CeTaskProcessor; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.user.UserSession; import org.sonarqube.ws.Common; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CancelAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CancelAction.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/CancelAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/CancelAction.java index 7c3caf97140..fc2ab9bffef 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CancelAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CancelAction.java @@ -17,14 +17,14 @@ * 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; +package org.sonar.server.ce.ws; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.api.web.UserRole; import org.sonar.core.util.Uuids; -import org.sonar.server.computation.queue.CeQueue; +import org.sonar.ce.queue.CeQueue; import org.sonar.server.user.UserSession; public class CancelAction implements CeWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CancelAllAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CancelAllAction.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/CancelAllAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/CancelAllAction.java index 547a68746e7..73457d1ff98 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CancelAllAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CancelAllAction.java @@ -17,13 +17,13 @@ * 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; +package org.sonar.server.ce.ws; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; import org.sonar.api.web.UserRole; -import org.sonar.server.computation.queue.CeQueue; +import org.sonar.ce.queue.CeQueue; import org.sonar.server.user.UserSession; public class CancelAllAction implements CeWsAction { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWs.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWs.java similarity index 97% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWs.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWs.java index 7ebc8f66515..8b037190ed3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWs.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import org.sonar.api.server.ws.WebService; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWsAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsAction.java similarity index 96% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWsAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsAction.java index 0748073b93b..6d68c0f9b12 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsAction.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import org.sonar.api.server.ws.WebService; import org.sonar.server.ws.WsAction; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWsModule.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsModule.java similarity index 96% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWsModule.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsModule.java index dacfb596435..73b04cf18ba 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/CeWsModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/CeWsModule.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import org.sonar.core.platform.Module; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ComponentAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/ComponentAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java index f4a946af90c..ffb78a203bf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/ComponentAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/ComponentAction.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import java.util.List; import org.sonar.api.server.ws.Request; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWs.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/IsQueueEmptyWs.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWs.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/IsQueueEmptyWs.java index 459aa43cd2f..c1742b65fe6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/IsQueueEmptyWs.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/IsQueueEmptyWs.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import org.apache.commons.io.IOUtils; import org.sonar.api.server.ws.Request; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/LogsAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/LogsAction.java similarity index 96% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/LogsAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/LogsAction.java index 36c3fd47ef6..f89b3c7981d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/LogsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/LogsAction.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import com.google.common.base.Optional; import java.io.File; @@ -32,8 +32,8 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.user.UserSession; import org.sonarqube.ws.MediaTypes; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/SubmitAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/SubmitAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java index 943f886f9de..33ca21f62e2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/SubmitAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/SubmitAction.java @@ -17,15 +17,15 @@ * 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; +package org.sonar.server.ce.ws; import java.io.InputStream; import org.apache.commons.lang.StringUtils; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.report.ReportSubmitter; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.report.ReportSubmitter; import org.sonar.server.ws.WsUtils; import org.sonarqube.ws.WsCe; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java similarity index 99% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java index fdd03322a66..55b61f80850 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskAction.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import com.google.common.base.Optional; import javax.annotation.Nullable; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java similarity index 98% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java index bfb9be84096..9e1fb53a750 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskFormatter.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import com.google.common.base.Function; import com.google.common.base.Optional; @@ -38,8 +38,8 @@ import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentDtoFunctions; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonarqube.ws.WsCe; import static com.google.common.base.Predicates.notNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskTypesAction.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskTypesAction.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskTypesAction.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskTypesAction.java index 392c84448e0..b2ae749116b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/TaskTypesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskTypesAction.java @@ -18,14 +18,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.computation.ws; +package org.sonar.server.ce.ws; import com.google.common.collect.ImmutableSet; import java.util.Set; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; -import org.sonar.server.computation.taskprocessor.CeTaskProcessor; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import org.sonarqube.ws.WsCe; import static org.sonar.server.ws.WsUtils.writeProtobuf; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/package-info.java b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/package-info.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/ws/package-info.java rename to server/sonar-server/src/main/java/org/sonar/server/ce/ws/package-info.java index 8e9e42e55e4..9526585ac78 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/ws/package-info.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ce/ws/package-info.java @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault -package org.sonar.server.computation.ws; +package org.sonar.server.ce.ws; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java b/server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java index d6b35a77a0a..25c04f2e25b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/CeModule.java @@ -19,13 +19,12 @@ */ package org.sonar.server.computation; +import org.sonar.ce.log.CeLogging; import org.sonar.core.platform.Module; import org.sonar.db.purge.period.DefaultPeriodCleaner; import org.sonar.server.computation.configuration.CeConfigurationImpl; import org.sonar.server.computation.dbcleaner.IndexPurgeListener; import org.sonar.server.computation.dbcleaner.ProjectCleaner; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.properties.ProjectSettingsFactory; /** * Globally available components in CE @@ -39,7 +38,6 @@ public class CeModule extends Module { DefaultPeriodCleaner.class, ProjectCleaner.class, - ProjectSettingsFactory.class, IndexPurgeListener.class); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolder.java index 72feb3e3796..d4f010d5cf3 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/batch/BatchReportDirectoryHolder.java @@ -20,7 +20,7 @@ package org.sonar.server.computation.batch; import java.io.File; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; public interface BatchReportDirectoryHolder { /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainer.java b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainer.java index abf817809ad..89d644ea212 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ComputeEngineContainer.java @@ -21,7 +21,7 @@ package org.sonar.server.computation.container; import org.sonar.core.platform.ComponentContainer; import org.sonar.core.platform.ContainerPopulator; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; /** * The Compute Engine container. Created for a specific parent {@link ComponentContainer} and a specific {@link CeTask}. diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactory.java b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactory.java index d31a0d11f91..8893ab2c885 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactory.java @@ -21,7 +21,7 @@ package org.sonar.server.computation.container; import javax.annotation.Nullable; import org.sonar.core.platform.ComponentContainer; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import org.sonar.server.devcockpit.DevCockpitBridge; public interface ContainerFactory { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactoryImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactoryImpl.java index 9b3890e4142..78d2f863f01 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactoryImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ContainerFactoryImpl.java @@ -21,7 +21,7 @@ package org.sonar.server.computation.container; import javax.annotation.Nullable; import org.sonar.core.platform.ComponentContainer; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import org.sonar.server.devcockpit.DevCockpitBridge; public class ContainerFactoryImpl implements ContainerFactory { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulator.java b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulator.java index 09e4e6b01e7..82ed25a8009 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulator.java @@ -81,7 +81,7 @@ import org.sonar.server.computation.qualitymodel.NewQualityModelMeasuresVisitor; import org.sonar.server.computation.qualitymodel.QualityModelMeasuresVisitor; import org.sonar.server.computation.qualitymodel.RatingSettings; import org.sonar.server.computation.qualityprofile.ActiveRulesHolderImpl; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import org.sonar.server.computation.scm.ScmInfoRepositoryImpl; import org.sonar.server.computation.source.LastCommitVisitor; import org.sonar.server.computation.source.SourceHashRepositoryImpl; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportProcessingModule.java b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportProcessingModule.java index 38a881a3752..1efe1b09380 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportProcessingModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/container/ReportProcessingModule.java @@ -20,7 +20,7 @@ package org.sonar.server.computation.container; import org.sonar.core.platform.Module; -import org.sonar.server.computation.queue.report.ReportSubmitter; +import org.sonar.ce.queue.report.ReportSubmitter; import org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor; import org.sonar.server.computation.step.ComputationStepExecutor; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/CEQueueStatusImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/CEQueueStatusImpl.java index e786e5997eb..d9e61e25e15 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/CEQueueStatusImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/CEQueueStatusImpl.java @@ -20,6 +20,7 @@ package org.sonar.server.computation.monitoring; import java.util.concurrent.atomic.AtomicLong; +import org.sonar.ce.monitoring.CEQueueStatus; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitor.java index 4820eb964a7..94d2322dc1c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitor.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitor.java @@ -20,8 +20,9 @@ package org.sonar.server.computation.monitoring; import java.util.LinkedHashMap; +import org.sonar.ce.monitoring.CEQueueStatus; import org.sonar.server.computation.configuration.CeConfiguration; -import org.sonar.server.computation.queue.CeQueue; +import org.sonar.ce.queue.CeQueue; import org.sonar.server.platform.monitoring.BaseMonitorMBean; public class ComputeEngineQueueMonitor extends BaseMonitorMBean implements ComputeEngineQueueMonitorMBean { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java index 4f725e38d4f..339eb7127ca 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java @@ -25,11 +25,11 @@ import org.sonar.api.platform.ServerUpgradeStatus; import org.sonar.api.server.ServerSide; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; +import org.sonar.ce.queue.report.ReportFiles; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.queue.report.ReportFiles; /** * Cleans-up the Compute Engine queue and resets the JMX counters. @@ -43,9 +43,9 @@ public class CeQueueCleaner { private final DbClient dbClient; private final ServerUpgradeStatus serverUpgradeStatus; private final ReportFiles reportFiles; - private final CeQueueImpl queue; + private final InternalCeQueue queue; - public CeQueueCleaner(DbClient dbClient, ServerUpgradeStatus serverUpgradeStatus, ReportFiles reportFiles, CeQueueImpl queue) { + public CeQueueCleaner(DbClient dbClient, ServerUpgradeStatus serverUpgradeStatus, ReportFiles reportFiles, InternalCeQueue queue) { this.dbClient = dbClient; this.serverUpgradeStatus = serverUpgradeStatus; this.reportFiles = reportFiles; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueInitializer.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueInitializer.java index 63ec0786528..b6f277f8f8f 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueInitializer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueInitializer.java @@ -24,7 +24,7 @@ import org.sonar.api.platform.ServerStartHandler; import org.sonar.api.server.ServerSide; import org.sonar.db.DbClient; import org.sonar.db.DbSession; -import org.sonar.server.computation.monitoring.CEQueueStatus; +import org.sonar.ce.monitoring.CEQueueStatus; import org.sonar.server.computation.taskprocessor.CeProcessingScheduler; /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java index 4087720e411..4be44d6936b 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueModule.java @@ -19,18 +19,18 @@ */ package org.sonar.server.computation.queue; +import org.sonar.server.computation.queue.report.CleanReportQueueListener; +import org.sonar.ce.queue.report.ReportFiles; import org.sonar.core.platform.Module; import org.sonar.server.computation.monitoring.CEQueueStatusImpl; import org.sonar.server.computation.monitoring.ComputeEngineQueueMonitor; -import org.sonar.server.computation.queue.report.CleanReportQueueListener; -import org.sonar.server.computation.queue.report.ReportFiles; public class CeQueueModule extends Module { @Override protected void configureModule() { add( // queue state - CeQueueImpl.class, + InternalCeQueueImpl.class, // queue monitoring CEQueueStatusImpl.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueue.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueue.java new file mode 100644 index 00000000000..b0526f4efa4 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueue.java @@ -0,0 +1,76 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.computation.queue; + +import com.google.common.base.Optional; +import javax.annotation.Nullable; +import org.sonar.ce.queue.CeQueue; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.db.DbSession; +import org.sonar.db.ce.CeActivityDto; +import org.sonar.db.ce.CeQueueDto; + +/** + * Queue of pending Compute Engine tasks. Both producer and consumer actions + * are implemented. + *

+ * This class is decoupled from the regular task type {@link org.sonar.db.ce.CeTaskTypes#REPORT}. + *

+ */ +public interface InternalCeQueue extends CeQueue { + + /** + * Peek the oldest task in status {@link org.sonar.db.ce.CeQueueDto.Status#PENDING}. + * The task status is changed to {@link org.sonar.db.ce.CeQueueDto.Status#IN_PROGRESS}. + * Does not return anything if the queue is paused (see {@link #isPeekPaused()}. + * + *

Only a single task can be peeked by project.

+ * + *

An unchecked exception may be thrown on technical errors (db connection, ...).

+ */ + Optional peek(); + + /** + * Removes all the tasks from the queue, whatever their status. They are marked + * as {@link CeActivityDto.Status#CANCELED} in past activity. + * This method can NOT be called when workers are being executed, as in progress + * tasks can't be killed. + * + * @return the number of canceled tasks + */ + int clear(); + + /** + * Removes a task from the queue and registers it to past activities. This method + * is called by Compute Engine workers when task is processed and can include an option {@link CeTaskResult} object. + * + * @throws IllegalStateException if the task does not exist in the queue + */ + void remove(CeTask task, CeActivityDto.Status status, @Nullable CeTaskResult taskResult); + + void cancel(DbSession dbSession, CeQueueDto ceQueueDto); + + void pausePeek(); + + void resumePeek(); + + boolean isPeekPaused(); +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueueImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueueImpl.java new file mode 100644 index 00000000000..d8b10f5c5d3 --- /dev/null +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/InternalCeQueueImpl.java @@ -0,0 +1,146 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.server.computation.queue; + +import com.google.common.base.Optional; +import java.util.concurrent.atomic.AtomicBoolean; +import javax.annotation.Nullable; +import org.sonar.api.server.ServerSide; +import org.sonar.api.utils.System2; +import org.sonar.ce.queue.CeQueueImpl; +import org.sonar.ce.queue.CeQueueListener; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.core.util.UuidFactory; +import org.sonar.db.DbClient; +import org.sonar.db.DbSession; +import org.sonar.db.ce.CeActivityDto; +import org.sonar.db.ce.CeQueueDto; +import org.sonar.ce.monitoring.CEQueueStatus; + +import static java.lang.String.format; + +@ServerSide +public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue { + + private final System2 system2; + private final DbClient dbClient; + private final CEQueueStatus queueStatus; + + // state + private AtomicBoolean peekPaused = new AtomicBoolean(false); + + public InternalCeQueueImpl(System2 system2, DbClient dbClient, UuidFactory uuidFactory, + CEQueueStatus queueStatus, CeQueueListener[] listeners) { + super(dbClient, uuidFactory, queueStatus, listeners); + this.system2 = system2; + this.dbClient = dbClient; + this.queueStatus = queueStatus; + } + + @Override + public Optional peek() { + if (peekPaused.get()) { + return Optional.absent(); + } + DbSession dbSession = dbClient.openSession(false); + try { + Optional dto = dbClient.ceQueueDao().peek(dbSession); + CeTask task = null; + if (dto.isPresent()) { + task = loadTask(dbSession, dto.get()); + queueStatus.addInProgress(); + } + return Optional.fromNullable(task); + + } finally { + dbClient.closeSession(dbSession); + } + } + + @Override + public int clear() { + return cancelAll(true); + } + + @Override + public void remove(CeTask task, CeActivityDto.Status status, CeTaskResult taskResult) { + DbSession dbSession = dbClient.openSession(false); + try { + Optional queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, task.getUuid()); + if (!queueDto.isPresent()) { + throw new IllegalStateException(format("Task does not exist anymore: %s", task)); + } + CeActivityDto activityDto = new CeActivityDto(queueDto.get()); + activityDto.setStatus(status); + updateQueueStatus(status, activityDto); + updateTaskResult(activityDto, taskResult); + remove(dbSession, task, queueDto.get(), activityDto); + + } finally { + dbClient.closeSession(dbSession); + } + } + + private static void updateTaskResult(CeActivityDto activityDto, @Nullable CeTaskResult taskResult) { + if (taskResult != null) { + Long snapshotId = taskResult.getSnapshotId(); + if (snapshotId != null) { + activityDto.setSnapshotId(snapshotId); + } + } + } + + private void updateQueueStatus(CeActivityDto.Status status, CeActivityDto activityDto) { + Long startedAt = activityDto.getStartedAt(); + if (startedAt == null) { + return; + } + activityDto.setExecutedAt(system2.now()); + long executionTime = activityDto.getExecutedAt() - startedAt; + activityDto.setExecutionTimeMs(executionTime); + if (status == CeActivityDto.Status.SUCCESS) { + queueStatus.addSuccess(executionTime); + } else { + queueStatus.addError(executionTime); + } + } + + @Override + public void cancel(DbSession dbSession, CeQueueDto ceQueueDto) { + cancelImpl(dbSession, ceQueueDto); + } + + @Override + public void pausePeek() { + this.peekPaused.set(true); + } + + @Override + public void resumePeek() { + this.peekPaused.set(false); + } + + @Override + public boolean isPeekPaused() { + return peekPaused.get(); + } + +} diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/PurgeCeActivities.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/PurgeCeActivities.java index a7df49284f5..690fc23759a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/PurgeCeActivities.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/PurgeCeActivities.java @@ -30,8 +30,8 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.ce.CeActivityDto; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; @ServerSide public class PurgeCeActivities implements ServerStartHandler { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/CleanReportQueueListener.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/CleanReportQueueListener.java index ceca86aedd0..e8a1d63c917 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/CleanReportQueueListener.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/report/CleanReportQueueListener.java @@ -19,9 +19,10 @@ */ package org.sonar.server.computation.queue.report; +import org.sonar.ce.queue.report.ReportFiles; import org.sonar.db.ce.CeActivityDto; -import org.sonar.server.computation.queue.CeQueueListener; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeQueueListener; +import org.sonar.ce.queue.CeTask; public class CleanReportQueueListener implements CeQueueListener { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ExtractReportStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ExtractReportStep.java index 26ebaba65a0..959926289ef 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ExtractReportStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ExtractReportStep.java @@ -26,8 +26,8 @@ import org.sonar.api.utils.TempFolder; import org.sonar.api.utils.ZipUtils; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.report.ReportFiles; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.report.ReportFiles; import org.sonar.server.computation.batch.MutableBatchReportDirectoryHolder; /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java index 53b7d7e106d..d34e2c627f5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStep.java @@ -23,7 +23,7 @@ import org.sonar.api.utils.MessageException; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.server.computation.analysis.MutableAnalysisMetadataHolder; import org.sonar.server.computation.batch.BatchReportReader; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import static java.lang.String.format; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PublishTaskResultStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PublishTaskResultStep.java index 7a52801b4a7..656d96759d2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PublishTaskResultStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PublishTaskResultStep.java @@ -22,7 +22,7 @@ package org.sonar.server.computation.step; import javax.annotation.concurrent.Immutable; import org.sonar.server.computation.component.DbIdsRepository; import org.sonar.server.computation.component.TreeRootHolder; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTaskResult; import org.sonar.server.computation.taskprocessor.MutableTaskResultHolder; public class PublishTaskResultStep implements ComputationStep { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepository.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepository.java index 42878bb65c8..a5936876517 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepository.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepository.java @@ -20,7 +20,8 @@ package org.sonar.server.computation.taskprocessor; import com.google.common.base.Optional; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.taskprocessor.CeTaskProcessor; public interface CeTaskProcessorRepository { diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImpl.java index 5451c765b8f..b014847989c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImpl.java @@ -29,7 +29,8 @@ import com.google.common.collect.Multimap; import java.util.Collection; import java.util.Map; import javax.annotation.Nonnull; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.FluentIterable.from; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallable.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallable.java index 4c367beffe1..2f5760f7ac5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallable.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallable.java @@ -20,8 +20,8 @@ package org.sonar.server.computation.taskprocessor; import java.util.concurrent.Callable; -import org.sonar.server.computation.queue.CeQueue; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeQueue; +import org.sonar.ce.queue.CeTask; /** * Marker interface of the runnable in charge of polling the {@link CeQueue} and executing {@link CeTask}. diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java index 835ac3d6a8c..b0c0e599b88 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java @@ -22,12 +22,14 @@ package org.sonar.server.computation.taskprocessor; import com.google.common.base.Optional; import org.sonar.api.utils.log.Logger; import org.sonar.api.utils.log.Loggers; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import org.sonar.core.util.logs.Profiler; import org.sonar.db.ce.CeActivityDto; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.queue.CeQueue; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.queue.CeQueue; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.server.computation.queue.InternalCeQueue; import static java.lang.String.format; @@ -35,11 +37,11 @@ public class CeWorkerCallableImpl implements CeWorkerCallable { private static final Logger LOG = Loggers.get(CeWorkerCallableImpl.class); - private final CeQueue queue; + private final InternalCeQueue queue; private final CeLogging ceLogging; private final CeTaskProcessorRepository taskProcessorRepository; - public CeWorkerCallableImpl(CeQueue queue, CeLogging ceLogging, CeTaskProcessorRepository taskProcessorRepository) { + public CeWorkerCallableImpl(InternalCeQueue queue, CeLogging ceLogging, CeTaskProcessorRepository taskProcessorRepository) { this.queue = queue; this.ceLogging = ceLogging; this.taskProcessorRepository = taskProcessorRepository; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolder.java index d27b9ec69d2..4b3674184d5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolder.java @@ -19,7 +19,7 @@ */ package org.sonar.server.computation.taskprocessor; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTaskResult; public interface MutableTaskResultHolder extends TaskResultHolder { /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImpl.java index 82121c9f78d..aa1ce365b71 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImpl.java @@ -20,7 +20,7 @@ package org.sonar.server.computation.taskprocessor; import javax.annotation.CheckForNull; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTaskResult; import static com.google.common.base.Preconditions.checkState; import static java.util.Objects.requireNonNull; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/TaskResultHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/TaskResultHolder.java index 905cdd6d490..793e00fa7e5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/TaskResultHolder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/TaskResultHolder.java @@ -19,7 +19,7 @@ */ package org.sonar.server.computation.taskprocessor; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTaskResult; public interface TaskResultHolder { /** diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/report/ReportTaskProcessor.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/report/ReportTaskProcessor.java index a940f3be5a9..22c5f350121 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/report/ReportTaskProcessor.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/report/ReportTaskProcessor.java @@ -26,10 +26,10 @@ import org.sonar.core.platform.ComponentContainer; import org.sonar.db.ce.CeTaskTypes; import org.sonar.server.computation.container.ComputeEngineContainer; import org.sonar.server.computation.container.ContainerFactory; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; import org.sonar.server.computation.step.ComputationStepExecutor; -import org.sonar.server.computation.taskprocessor.CeTaskProcessor; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import org.sonar.server.computation.taskprocessor.TaskResultHolder; import org.sonar.server.devcockpit.DevCockpitBridge; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java index e2984c15958..9a3b3ae3fe5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java @@ -35,7 +35,7 @@ import org.sonar.db.semaphore.SemaphoresImpl; import org.sonar.db.version.DatabaseVersion; import org.sonar.db.version.MigrationStepModule; import org.sonar.server.app.ProcessCommandWrapperImpl; -import org.sonar.server.computation.property.CePropertyDefinitions; +import org.sonar.ce.property.CePropertyDefinitions; import org.sonar.server.db.EmbeddedDatabaseFactory; import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.platform.DatabaseServerCompatibility; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index cf14654aaec..9aecf57ae57 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -30,6 +30,7 @@ import org.sonar.api.resources.ResourceTypes; import org.sonar.api.rules.AnnotationRuleParser; import org.sonar.api.rules.XMLRuleParser; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; +import org.sonar.ce.CeModule; import org.sonar.core.component.DefaultResourceTypes; import org.sonar.core.timemachine.Periods; import org.sonar.core.user.DefaultUserFinder; @@ -44,17 +45,13 @@ import org.sonar.server.activity.ws.ActivitiesWs; import org.sonar.server.activity.ws.ActivityMapping; import org.sonar.server.authentication.AuthenticationModule; import org.sonar.server.batch.BatchWsModule; +import org.sonar.server.ce.ws.CeWsModule; import org.sonar.server.component.ComponentCleanerService; import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentService; import org.sonar.server.component.DefaultComponentFinder; import org.sonar.server.component.DefaultRubyComponentService; import org.sonar.server.component.ws.ComponentsWsModule; -import org.sonar.server.computation.CeModule; -import org.sonar.server.computation.container.ReportProcessingModule; -import org.sonar.server.computation.queue.CeQueueModule; -import org.sonar.server.computation.taskprocessor.CeTaskProcessorModule; -import org.sonar.server.computation.ws.CeWsModule; import org.sonar.server.config.ws.PropertiesWs; import org.sonar.server.dashboard.template.GlobalDefaultDashboard; import org.sonar.server.dashboard.template.ProjectCustomDashboard; @@ -193,6 +190,7 @@ import org.sonar.server.plugins.ws.PluginsWs; import org.sonar.server.plugins.ws.UninstallAction; import org.sonar.server.plugins.ws.UpdatesAction; import org.sonar.server.project.ws.ProjectsWsModule; +import org.sonar.server.properties.ProjectSettingsFactory; import org.sonar.server.qualitygate.QgateProjectFinder; import org.sonar.server.qualitygate.QualityGates; import org.sonar.server.qualitygate.ws.CreateConditionAction; @@ -706,10 +704,9 @@ public class PlatformLevel4 extends PlatformLevel { // Compute engine (must be after Views and Developer Cockpit) CeModule.class, - CeQueueModule.class, - CeTaskProcessorModule.class, CeWsModule.class, - ReportProcessingModule.class, + + ProjectSettingsFactory.class, // UI GlobalNavigationAction.class, diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java index fe68d914ed8..3ad05d77909 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevelStartup.java @@ -20,7 +20,6 @@ package org.sonar.server.platform.platformlevel; import org.sonar.server.app.ProcessCommandWrapper; -import org.sonar.server.computation.queue.PurgeCeActivities; import org.sonar.server.issue.filter.RegisterIssueFilters; import org.sonar.server.platform.ServerLifecycleNotifier; import org.sonar.server.qualitygate.RegisterQualityGates; @@ -65,7 +64,6 @@ public class PlatformLevelStartup extends PlatformLevel { RegisterIssueFilters.class, RenameIssueWidgets.class, ServerLifecycleNotifier.class, - PurgeCeActivities.class, DisplayLogOnDeprecatedProjects.class, ClearRulesOverloadedDebt.class, FeedUsersLocalStartupTask.class diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java index 6880edf5605..31926da662c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java @@ -50,7 +50,7 @@ import org.sonar.db.dashboard.DashboardDto; import org.sonar.db.property.PropertyDto; import org.sonar.db.property.PropertyQuery; import org.sonar.server.component.ComponentFinder; -import org.sonar.server.computation.ws.ActivityAction; +import org.sonar.server.ce.ws.ActivityAction; import org.sonar.server.ui.ViewProxy; import org.sonar.server.ui.Views; import org.sonar.server.user.UserSession; diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/activity-example.json b/server/sonar-server/src/main/resources/org/sonar/server/ce/ws/activity-example.json similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/computation/ws/activity-example.json rename to server/sonar-server/src/main/resources/org/sonar/server/ce/ws/activity-example.json diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/component-example.json b/server/sonar-server/src/main/resources/org/sonar/server/ce/ws/component-example.json similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/computation/ws/component-example.json rename to server/sonar-server/src/main/resources/org/sonar/server/ce/ws/component-example.json diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/is_queue_empty-example.txt b/server/sonar-server/src/main/resources/org/sonar/server/ce/ws/is_queue_empty-example.txt similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/computation/ws/is_queue_empty-example.txt rename to server/sonar-server/src/main/resources/org/sonar/server/ce/ws/is_queue_empty-example.txt diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/logs-example.log b/server/sonar-server/src/main/resources/org/sonar/server/ce/ws/logs-example.log similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/computation/ws/logs-example.log rename to server/sonar-server/src/main/resources/org/sonar/server/ce/ws/logs-example.log diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/submit-example.json b/server/sonar-server/src/main/resources/org/sonar/server/ce/ws/submit-example.json similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/computation/ws/submit-example.json rename to server/sonar-server/src/main/resources/org/sonar/server/ce/ws/submit-example.json diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/task-example.json b/server/sonar-server/src/main/resources/org/sonar/server/ce/ws/task-example.json similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/computation/ws/task-example.json rename to server/sonar-server/src/main/resources/org/sonar/server/ce/ws/task-example.json diff --git a/server/sonar-server/src/main/resources/org/sonar/server/computation/ws/task_types-example.json b/server/sonar-server/src/main/resources/org/sonar/server/ce/ws/task_types-example.json similarity index 100% rename from server/sonar-server/src/main/resources/org/sonar/server/computation/ws/task_types-example.json rename to server/sonar-server/src/main/resources/org/sonar/server/ce/ws/task_types-example.json diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeFileAppenderFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/ce/log/CeFileAppenderFactoryTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/log/CeFileAppenderFactoryTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/log/CeFileAppenderFactoryTest.java index b45504019b9..e39e96ccf82 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeFileAppenderFactoryTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/log/CeFileAppenderFactoryTest.java @@ -17,7 +17,7 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.core.FileAppender; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLogAcceptFilterTest.java b/server/sonar-server/src/test/java/org/sonar/ce/log/CeLogAcceptFilterTest.java similarity index 93% rename from server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLogAcceptFilterTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/log/CeLogAcceptFilterTest.java index 308fdca7db7..87d9c6d2af6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLogAcceptFilterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/log/CeLogAcceptFilterTest.java @@ -17,13 +17,15 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; import org.apache.log4j.MDC; import org.junit.After; import org.junit.Test; +import org.sonar.ce.log.CeLogAcceptFilter; +import org.sonar.ce.log.CeLogging; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLogDenyFilterTest.java b/server/sonar-server/src/test/java/org/sonar/ce/log/CeLogDenyFilterTest.java similarity index 93% rename from server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLogDenyFilterTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/log/CeLogDenyFilterTest.java index c3db80fc13d..e11589258e1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLogDenyFilterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/log/CeLogDenyFilterTest.java @@ -17,13 +17,15 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; import org.apache.log4j.MDC; import org.junit.After; import org.junit.Test; +import org.sonar.ce.log.CeLogDenyFilter; +import org.sonar.ce.log.CeLogging; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLoggingTest.java b/server/sonar-server/src/test/java/org/sonar/ce/log/CeLoggingTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLoggingTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/log/CeLoggingTest.java index 7df4d130dc6..f0dbe0a13cf 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/log/CeLoggingTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/log/CeLoggingTest.java @@ -17,7 +17,7 @@ * 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.log; +package org.sonar.ce.log; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; @@ -41,15 +41,18 @@ import org.junit.rules.TemporaryFolder; import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.sonar.api.config.Settings; +import org.sonar.ce.log.CeLogAcceptFilter; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonar.process.LogbackHelper; import org.sonar.process.ProcessProperties; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static org.sonar.server.computation.log.CeLogging.MDC_LOG_PATH; +import static org.sonar.ce.log.CeLogging.MDC_LOG_PATH; public class CeLoggingTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/log/LogFileRefTest.java b/server/sonar-server/src/test/java/org/sonar/ce/log/LogFileRefTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/log/LogFileRefTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/log/LogFileRefTest.java index 9f23dce6e06..cbd908830b4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/log/LogFileRefTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/log/LogFileRefTest.java @@ -17,11 +17,12 @@ * 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.log; +package org.sonar.ce.log; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.sonar.ce.log.LogFileRef; import org.sonar.db.ce.CeTaskTypes; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/monitoring/CEQueueStatusImplConcurrentTest.java b/server/sonar-server/src/test/java/org/sonar/ce/monitoring/CEQueueStatusImplConcurrentTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/monitoring/CEQueueStatusImplConcurrentTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/monitoring/CEQueueStatusImplConcurrentTest.java index 5d919d38675..edaaf9cd3f8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/monitoring/CEQueueStatusImplConcurrentTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/monitoring/CEQueueStatusImplConcurrentTest.java @@ -17,7 +17,7 @@ * 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.monitoring; +package org.sonar.ce.monitoring; import java.util.ArrayList; import java.util.Collections; @@ -28,6 +28,7 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Test; +import org.sonar.server.computation.monitoring.CEQueueStatusImpl; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/CePropertyDefinitionsTest.java b/server/sonar-server/src/test/java/org/sonar/ce/property/CePropertyDefinitionsTest.java similarity index 92% rename from server/sonar-server/src/test/java/org/sonar/server/computation/CePropertyDefinitionsTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/property/CePropertyDefinitionsTest.java index 87a8005e649..bd21696a622 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/CePropertyDefinitionsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/property/CePropertyDefinitionsTest.java @@ -17,10 +17,9 @@ * 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; +package org.sonar.ce.property; import org.junit.Test; -import org.sonar.server.computation.property.CePropertyDefinitions; import org.sonar.test.TestUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java b/server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java new file mode 100644 index 00000000000..d18f19edac8 --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java @@ -0,0 +1,273 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.ce.queue; + +import com.google.common.base.Optional; +import java.util.List; +import javax.annotation.Nullable; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.sonar.api.utils.System2; +import org.sonar.api.utils.internal.TestSystem2; +import org.sonar.ce.monitoring.CEQueueStatus; +import org.sonar.server.computation.monitoring.CEQueueStatusImpl; +import org.sonar.core.util.UuidFactory; +import org.sonar.core.util.UuidFactoryImpl; +import org.sonar.db.DbSession; +import org.sonar.db.DbTester; +import org.sonar.db.ce.CeActivityDto; +import org.sonar.db.ce.CeQueueDto; +import org.sonar.db.ce.CeTaskTypes; +import org.sonar.db.component.ComponentDto; + +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.startsWith; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +public class CeQueueImplTest { + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + System2 system2 = new TestSystem2().setNow(1_450_000_000_000L); + + @Rule + public DbTester dbTester = DbTester.create(system2); + DbSession session = dbTester.getSession(); + + UuidFactory uuidFactory = UuidFactoryImpl.INSTANCE; + CEQueueStatus queueStatus = new CEQueueStatusImpl(); + CeQueueListener listener = mock(CeQueueListener.class); + CeQueue underTest = new CeQueueImpl(dbTester.getDbClient(), uuidFactory, queueStatus, new CeQueueListener[] {listener}); + + @Before + public void setUp() throws Exception { + queueStatus.initPendingCount(0); + } + + @Test + public void submit_returns_task_populated_from_CeTaskSubmit_and_creates_CeQueue_row() { + CeTaskSubmit taskSubmit = createTaskSubmit(CeTaskTypes.REPORT, "PROJECT_1", "rob"); + CeTask task = underTest.submit(taskSubmit); + + verifyCeTask(taskSubmit, task, null); + verifyCeQueueDtoForTaskSubmit(taskSubmit); + } + + @Test + public void submit_increments_receivedCount_of_QueueStatus() { + underTest.submit(createTaskSubmit(CeTaskTypes.REPORT, "PROJECT_1", "rob")); + + assertThat(queueStatus.getReceivedCount()).isEqualTo(1L); + + underTest.submit(createTaskSubmit(CeTaskTypes.REPORT, "PROJECT_2", "rob")); + + assertThat(queueStatus.getReceivedCount()).isEqualTo(2L); + } + + @Test + public void submit_populates_component_name_and_key_of_CeTask_if_component_exists() { + ComponentDto componentDto = insertComponent(newComponentDto("PROJECT_1")); + CeTaskSubmit taskSubmit = createTaskSubmit(CeTaskTypes.REPORT, componentDto.uuid(), null); + + CeTask task = underTest.submit(taskSubmit); + + verifyCeTask(taskSubmit, task, componentDto); + } + + @Test + public void submit_returns_task_without_component_info_when_submit_has_none() { + CeTaskSubmit taskSubmit = createTaskSubmit("not cpt related"); + + CeTask task = underTest.submit(taskSubmit); + + verifyCeTask(taskSubmit, task, null); + } + + @Test + public void submit_fails_with_ISE_if_paused() { + underTest.pauseSubmit(); + + expectedException.expect(IllegalStateException.class); + expectedException.expectMessage("Compute Engine does not currently accept new tasks"); + + submit(CeTaskTypes.REPORT, "PROJECT_1"); + } + + @Test + public void massSubmit_returns_tasks_for_each_CeTaskSubmit_populated_from_CeTaskSubmit_and_creates_CeQueue_row_for_each() { + CeTaskSubmit taskSubmit1 = createTaskSubmit(CeTaskTypes.REPORT, "PROJECT_1", "rob"); + CeTaskSubmit taskSubmit2 = createTaskSubmit("some type"); + + List tasks = underTest.massSubmit(asList(taskSubmit1, taskSubmit2)); + + assertThat(tasks).hasSize(2); + verifyCeTask(taskSubmit1, tasks.get(0), null); + verifyCeTask(taskSubmit2, tasks.get(1), null); + verifyCeQueueDtoForTaskSubmit(taskSubmit1); + verifyCeQueueDtoForTaskSubmit(taskSubmit2); + } + + @Test + public void massSubmit_populates_component_name_and_key_of_CeTask_if_component_exists() { + ComponentDto componentDto1 = insertComponent(newComponentDto("PROJECT_1")); + CeTaskSubmit taskSubmit1 = createTaskSubmit(CeTaskTypes.REPORT, componentDto1.uuid(), null); + CeTaskSubmit taskSubmit2 = createTaskSubmit("something", "non existing component uuid", null); + + List tasks = underTest.massSubmit(asList(taskSubmit1, taskSubmit2)); + + assertThat(tasks).hasSize(2); + verifyCeTask(taskSubmit1, tasks.get(0), componentDto1); + verifyCeTask(taskSubmit2, tasks.get(1), null); + } + + @Test + public void massSubmit_increments_receivedCount_of_QueueStatus() { + underTest.massSubmit(asList(createTaskSubmit("type 1"), createTaskSubmit("type 2"))); + + assertThat(queueStatus.getReceivedCount()).isEqualTo(2L); + + underTest.massSubmit(asList(createTaskSubmit("a"), createTaskSubmit("a"), createTaskSubmit("b"))); + + assertThat(queueStatus.getReceivedCount()).isEqualTo(5L); + } + + + @Test + public void cancel_pending() throws Exception { + CeTask task = submit(CeTaskTypes.REPORT, "PROJECT_1"); + + // ignore + boolean canceled = underTest.cancel("UNKNOWN"); + assertThat(canceled).isFalse(); + verifyZeroInteractions(listener); + + canceled = underTest.cancel(task.getUuid()); + assertThat(canceled).isTrue(); + Optional activity = dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), task.getUuid()); + assertThat(activity.isPresent()).isTrue(); + assertThat(activity.get().getStatus()).isEqualTo(CeActivityDto.Status.CANCELED); + verify(listener).onRemoved(task, CeActivityDto.Status.CANCELED); + } + + @Test + public void fail_to_cancel_if_in_progress() throws Exception { + expectedException.expect(IllegalStateException.class); + expectedException.expectMessage(startsWith("Task is in progress and can't be canceled")); + + CeTask task = submit(CeTaskTypes.REPORT, "PROJECT_1"); + + dbTester.getDbClient().ceQueueDao().peek(session); + + underTest.cancel(task.getUuid()); + } + + @Test + public void cancelAll_pendings_but_not_in_progress() throws Exception { + CeTask inProgressTask = submit(CeTaskTypes.REPORT, "PROJECT_1"); + CeTask pendingTask1 = submit(CeTaskTypes.REPORT, "PROJECT_2"); + CeTask pendingTask2 = submit(CeTaskTypes.REPORT, "PROJECT_3"); + + dbTester.getDbClient().ceQueueDao().peek(session); + + int canceledCount = underTest.cancelAll(); + assertThat(canceledCount).isEqualTo(2); + + Optional history = dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), pendingTask1.getUuid()); + assertThat(history.get().getStatus()).isEqualTo(CeActivityDto.Status.CANCELED); + history = dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), pendingTask2.getUuid()); + assertThat(history.get().getStatus()).isEqualTo(CeActivityDto.Status.CANCELED); + history = dbTester.getDbClient().ceActivityDao().selectByUuid(dbTester.getSession(), inProgressTask.getUuid()); + assertThat(history.isPresent()).isFalse(); + + verify(listener).onRemoved(pendingTask1, CeActivityDto.Status.CANCELED); + verify(listener).onRemoved(pendingTask2, CeActivityDto.Status.CANCELED); + } + + @Test + public void pause_and_resume_submits() throws Exception { + assertThat(underTest.isSubmitPaused()).isFalse(); + underTest.pauseSubmit(); + assertThat(underTest.isSubmitPaused()).isTrue(); + underTest.resumeSubmit(); + assertThat(underTest.isSubmitPaused()).isFalse(); + } + + private void verifyCeTask(CeTaskSubmit taskSubmit, CeTask task, @Nullable ComponentDto componentDto) { + assertThat(task.getUuid()).isEqualTo(taskSubmit.getUuid()); + assertThat(task.getComponentUuid()).isEqualTo(task.getComponentUuid()); + assertThat(task.getType()).isEqualTo(taskSubmit.getType()); + if (componentDto == null) { + assertThat(task.getComponentKey()).isNull(); + assertThat(task.getComponentName()).isNull(); + } else { + assertThat(task.getComponentKey()).isEqualTo(componentDto.key()); + assertThat(task.getComponentName()).isEqualTo(componentDto.name()); + } + assertThat(task.getSubmitterLogin()).isEqualTo(taskSubmit.getSubmitterLogin()); + } + + private void verifyCeQueueDtoForTaskSubmit(CeTaskSubmit taskSubmit) { + Optional queueDto = dbTester.getDbClient().ceQueueDao().selectByUuid(dbTester.getSession(), taskSubmit.getUuid()); + assertThat(queueDto.isPresent()).isTrue(); + assertThat(queueDto.get().getTaskType()).isEqualTo(taskSubmit.getType()); + assertThat(queueDto.get().getComponentUuid()).isEqualTo(taskSubmit.getComponentUuid()); + assertThat(queueDto.get().getSubmitterLogin()).isEqualTo(taskSubmit.getSubmitterLogin()); + assertThat(queueDto.get().getCreatedAt()).isEqualTo(1_450_000_000_000L); + } + + private static ComponentDto newComponentDto(String uuid) { + return new ComponentDto().setUuid(uuid).setName("name_" + uuid).setKey("key_" + uuid); + } + + private CeTask submit(String reportType, String componentUuid) { + return underTest.submit(createTaskSubmit(reportType, componentUuid, null)); + } + + private CeTaskSubmit createTaskSubmit(String type) { + return createTaskSubmit(type, null, null); + } + + private CeTaskSubmit createTaskSubmit(String type, @Nullable String componentUuid, @Nullable String submitterLogin) { + CeTaskSubmit.Builder submission = underTest.prepareSubmit(); + submission.setType(type); + submission.setComponentUuid(componentUuid); + submission.setSubmitterLogin(submitterLogin); + return submission.build(); + } + + private CeTaskResult newTaskResult(Long snapshotId) { + CeTaskResult taskResult = mock(CeTaskResult.class); + when(taskResult.getSnapshotId()).thenReturn(snapshotId); + return taskResult; + } + + private ComponentDto insertComponent(ComponentDto componentDto) { + dbTester.getDbClient().componentDao().insert(session, componentDto); + session.commit(); + return componentDto; + } +} diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeTaskTest.java b/server/sonar-server/src/test/java/org/sonar/ce/queue/CeTaskTest.java similarity index 98% rename from server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeTaskTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/queue/CeTaskTest.java index 9886a009208..f0759f53d72 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeTaskTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/queue/CeTaskTest.java @@ -17,7 +17,7 @@ * 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.queue; +package org.sonar.ce.queue; import org.junit.Test; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/report/ReportSubmitterTest.java b/server/sonar-server/src/test/java/org/sonar/ce/queue/report/ReportSubmitterTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/queue/report/ReportSubmitterTest.java rename to server/sonar-server/src/test/java/org/sonar/ce/queue/report/ReportSubmitterTest.java index c45201b9344..80ddfdc4f63 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/report/ReportSubmitterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/queue/report/ReportSubmitterTest.java @@ -17,7 +17,7 @@ * 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.queue.report; +package org.sonar.ce.queue.report; import org.apache.commons.io.IOUtils; import org.hamcrest.Description; @@ -30,9 +30,9 @@ import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; import org.sonar.server.component.ComponentService; import org.sonar.server.component.NewComponent; -import org.sonar.server.computation.queue.CeQueue; -import org.sonar.server.computation.queue.CeQueueImpl; -import org.sonar.server.computation.queue.CeTaskSubmit; +import org.sonar.ce.queue.CeQueue; +import org.sonar.ce.queue.CeQueueImpl; +import org.sonar.ce.queue.CeTaskSubmit; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.permission.PermissionService; import org.sonar.server.tester.UserSessionRule; diff --git a/server/sonar-server/src/test/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclarationTest.java b/server/sonar-server/src/test/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclarationTest.java new file mode 100644 index 00000000000..14035aa0bb7 --- /dev/null +++ b/server/sonar-server/src/test/java/org/sonar/ce/taskprocessor/ReportTaskProcessorDeclarationTest.java @@ -0,0 +1,48 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.ce.taskprocessor; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.sonar.ce.queue.CeTask; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +public class ReportTaskProcessorDeclarationTest { + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + private ReportTaskProcessorDeclaration underTest = new ReportTaskProcessorDeclaration(); + + @Test + public void getHandledCeTaskTypes_returns_REPORT() { + assertThat(underTest.getHandledCeTaskTypes()).containsOnly("REPORT"); + } + + @Test + public void process_throws_UOE() { + expectedException.expect(UnsupportedOperationException.class); + expectedException.expectMessage("process must not be called in WebServer"); + + underTest.process(mock(CeTask.class)); + } +} diff --git a/server/sonar-server/src/test/java/org/sonar/server/app/ServerProcessLoggingTest.java b/server/sonar-server/src/test/java/org/sonar/server/app/ServerProcessLoggingTest.java index 7fce78e110b..762a59bae01 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/app/ServerProcessLoggingTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/app/ServerProcessLoggingTest.java @@ -32,6 +32,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.sonar.ce.log.CeFileAppenderFactory; import org.sonar.process.LogbackHelper; import org.sonar.process.ProcessProperties; import org.sonar.process.Props; @@ -51,7 +52,7 @@ public class ServerProcessLoggingTest { /** * Path to data dir must be set for Compute Engine logging. - * @see org.sonar.server.computation.log.CeFileAppenderFactory + * @see CeFileAppenderFactory */ @Before public void setUp() throws IOException { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActivityActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java similarity index 98% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActivityActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java index 049725d1836..59b6d464533 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ActivityActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.computation.ws; +package org.sonar.server.ce.ws; import com.google.common.base.Optional; import com.google.common.base.Throwables; @@ -40,9 +40,9 @@ import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDbTester; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; -import org.sonar.server.computation.taskprocessor.CeTaskProcessor; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestRequest; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CancelActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CancelActionTest.java similarity index 96% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/CancelActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/CancelActionTest.java index 1e18687f998..22d25b9eb3d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CancelActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CancelActionTest.java @@ -17,14 +17,14 @@ * 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; +package org.sonar.server.ce.ws; import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; import org.sonar.db.DbTester; -import org.sonar.server.computation.queue.CeQueue; +import org.sonar.ce.queue.CeQueue; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CancelAllActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CancelAllActionTest.java similarity index 95% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/CancelAllActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/CancelAllActionTest.java index 37d826cec82..648bafc41ef 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CancelAllActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CancelAllActionTest.java @@ -17,14 +17,14 @@ * 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; +package org.sonar.server.ce.ws; import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; import org.sonar.db.DbTester; -import org.sonar.server.computation.queue.CeQueue; +import org.sonar.ce.queue.CeQueue; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsActionTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeWsModuleTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CeWsModuleTest.java similarity index 94% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeWsModuleTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/CeWsModuleTest.java index 5186c1a4f41..75eb84a98e0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeWsModuleTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CeWsModuleTest.java @@ -17,10 +17,11 @@ * 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; +package org.sonar.server.ce.ws; import org.junit.Test; import org.sonar.core.platform.ComponentContainer; +import org.sonar.server.ce.ws.CeWsModule; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CeWsTest.java similarity index 92% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeWsTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/CeWsTest.java index c8ccbda091c..1ec0618dbb5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/CeWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/CeWsTest.java @@ -17,12 +17,12 @@ * 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; +package org.sonar.server.ce.ws; import org.junit.Test; import org.mockito.Mockito; import org.sonar.api.server.ws.WebService; -import org.sonar.server.computation.queue.report.ReportSubmitter; +import org.sonar.ce.queue.report.ReportSubmitter; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComponentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComponentActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java index 1c97a73780d..ff27f0079b6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/ComponentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ComponentActionTest.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import com.google.common.base.Optional; import java.io.File; @@ -31,8 +31,8 @@ import org.sonar.db.DbTester; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonarqube.ws.MediaTypes; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestResponse; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/LogsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/LogsActionTest.java similarity index 96% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/LogsActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/LogsActionTest.java index 9fb08753d8e..ccdb4a9cd18 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/LogsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/LogsActionTest.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import com.google.common.base.Optional; import java.io.File; @@ -32,8 +32,8 @@ import org.sonar.api.web.UserRole; import org.sonar.db.DbTester; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonarqube.ws.MediaTypes; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/SubmitActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java similarity index 96% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/SubmitActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java index 0d82f814f0f..b34cb071f23 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/SubmitActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/SubmitActionTest.java @@ -17,15 +17,15 @@ * 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; +package org.sonar.server.ce.ws; import java.io.InputStream; import org.junit.Test; import org.mockito.Matchers; import org.sonar.core.util.Protobuf; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.report.ReportSubmitter; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.report.ReportSubmitter; import org.sonarqube.ws.MediaTypes; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java similarity index 98% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java index 18c3685d083..f0842056d78 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskActionTest.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import com.google.common.base.Optional; import java.io.File; @@ -33,8 +33,8 @@ import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentTesting; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskFormatterTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java similarity index 98% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskFormatterTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java index 15883c853d2..620b0e7dc55 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskFormatterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java @@ -17,7 +17,7 @@ * 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; +package org.sonar.server.ce.ws; import com.google.common.base.Optional; import java.io.IOException; @@ -34,8 +34,8 @@ import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonarqube.ws.WsCe; import static java.util.Arrays.asList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskTypesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskTypesActionTest.java similarity index 90% rename from server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskTypesActionTest.java rename to server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskTypesActionTest.java index 17062932b49..3757f1015fe 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ws/TaskTypesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskTypesActionTest.java @@ -18,14 +18,14 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.server.computation.ws; +package org.sonar.server.ce.ws; import com.google.common.collect.ImmutableSet; import java.util.Set; import org.junit.Test; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.CeTaskResult; -import org.sonar.server.computation.taskprocessor.CeTaskProcessor; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import org.sonar.server.ws.WsActionTester; import static org.sonar.test.JsonAssert.assertJson; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/PurgeCeActivitiesTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/PurgeCeActivitiesTest.java index bc59c911ead..7974b5c5534 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/PurgeCeActivitiesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/PurgeCeActivitiesTest.java @@ -27,8 +27,8 @@ import org.sonar.db.DbTester; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.log.LogFileRef; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.log.LogFileRef; import org.sonar.server.computation.queue.PurgeCeActivities; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/ReportFilesTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/ReportFilesTest.java index e63575f92ea..f4aee714587 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/ReportFilesTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/ReportFilesTest.java @@ -29,7 +29,7 @@ import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.sonar.api.config.Settings; import org.sonar.process.ProcessProperties; -import org.sonar.server.computation.queue.report.ReportFiles; +import org.sonar.ce.queue.report.ReportFiles; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulatorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulatorTest.java index caaa3890edc..0674fd77fee 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulatorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/container/ReportComputeEngineContainerPopulatorTest.java @@ -28,7 +28,7 @@ import java.util.Set; import javax.annotation.Nullable; import org.junit.Test; import org.sonar.core.platform.ComponentContainer; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import org.sonar.server.computation.step.ComputationStep; import org.sonar.server.computation.step.PersistComponentsStep; import org.sonar.server.computation.step.PersistDevelopersStep; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitorTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitorTest.java index 8ba7e634d3e..bca30441ecc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitorTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/monitoring/ComputeEngineQueueMonitorTest.java @@ -20,8 +20,9 @@ package org.sonar.server.computation.monitoring; import org.junit.Test; +import org.sonar.ce.monitoring.CEQueueStatus; import org.sonar.server.computation.configuration.CeConfiguration; -import org.sonar.server.computation.queue.CeQueueImpl; +import org.sonar.ce.queue.CeQueueImpl; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java index 50a82a6e7c8..7ea418c5748 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java @@ -27,11 +27,11 @@ import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; import org.sonar.api.platform.ServerUpgradeStatus; import org.sonar.api.utils.System2; +import org.sonar.ce.queue.report.ReportFiles; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.queue.report.ReportFiles; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; @@ -51,7 +51,7 @@ public class CeQueueCleanerTest { ServerUpgradeStatus serverUpgradeStatus = mock(ServerUpgradeStatus.class); ReportFiles reportFiles = mock(ReportFiles.class, Mockito.RETURNS_DEEP_STUBS); - CeQueueImpl queue = mock(CeQueueImpl.class); + InternalCeQueue queue = mock(InternalCeQueue.class); CeQueueCleaner underTest = new CeQueueCleaner(dbTester.getDbClient(), serverUpgradeStatus, reportFiles, queue); @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueInitializerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueInitializerTest.java index 98a93e18bec..41f42da6364 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueInitializerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueInitializerTest.java @@ -32,9 +32,9 @@ import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.monitoring.CEQueueStatus; +import org.sonar.ce.monitoring.CEQueueStatus; import org.sonar.server.computation.monitoring.CEQueueStatusImpl; -import org.sonar.server.computation.queue.report.ReportFiles; +import org.sonar.ce.queue.report.ReportFiles; import org.sonar.server.computation.taskprocessor.CeProcessingScheduler; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/InternalCeQueueImplTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueImplTest.java rename to server/sonar-server/src/test/java/org/sonar/server/computation/queue/InternalCeQueueImplTest.java index 69acc25acc4..8220ef23961 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/InternalCeQueueImplTest.java @@ -28,6 +28,12 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.sonar.api.utils.System2; import org.sonar.api.utils.internal.TestSystem2; +import org.sonar.ce.monitoring.CEQueueStatus; +import org.sonar.server.computation.monitoring.CEQueueStatusImpl; +import org.sonar.ce.queue.CeQueueListener; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.ce.queue.CeTaskSubmit; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryImpl; import org.sonar.db.DbSession; @@ -36,8 +42,6 @@ import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; -import org.sonar.server.computation.monitoring.CEQueueStatus; -import org.sonar.server.computation.monitoring.CEQueueStatusImpl; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; @@ -50,7 +54,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -public class CeQueueImplTest { +public class InternalCeQueueImplTest { @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -64,7 +68,7 @@ public class CeQueueImplTest { UuidFactory uuidFactory = UuidFactoryImpl.INSTANCE; CEQueueStatus queueStatus = new CEQueueStatusImpl(); CeQueueListener listener = mock(CeQueueListener.class); - CeQueue underTest = new CeQueueImpl(system2, dbTester.getDbClient(), uuidFactory, queueStatus, new CeQueueListener[] {listener}); + InternalCeQueue underTest = new InternalCeQueueImpl(system2, dbTester.getDbClient(), uuidFactory, queueStatus, new CeQueueListener[] {listener}); @Before public void setUp() throws Exception { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/report/CleanReportQueueListenerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/report/CleanReportQueueListenerTest.java index eb03752cb16..0c2991d48e5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/report/CleanReportQueueListenerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/report/CleanReportQueueListenerTest.java @@ -20,9 +20,10 @@ package org.sonar.server.computation.queue.report; import org.junit.Test; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.report.ReportFiles; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.queue.CeTask; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java index c767d044bd8..ae71f067071 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ComputationStepsTest.java @@ -29,7 +29,7 @@ import org.sonar.core.platform.ComponentContainer; import org.sonar.server.computation.container.ComputeEngineContainerImpl; import org.sonar.server.computation.container.ReportComputeEngineContainerPopulator; import org.sonar.server.computation.container.StepsExplorer; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import static com.google.common.collect.FluentIterable.from; import static com.google.common.collect.Sets.difference; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExtractReportStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExtractReportStepTest.java index d8d97166228..29246afb7c8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExtractReportStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ExtractReportStepTest.java @@ -33,8 +33,8 @@ import org.sonar.api.utils.log.LogTester; import org.sonar.api.utils.log.LoggerLevel; import org.sonar.db.ce.CeTaskTypes; import org.sonar.server.computation.batch.MutableBatchReportDirectoryHolder; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.report.ReportFiles; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.report.ReportFiles; import static org.mockito.Matchers.argThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStepTest.java index c1bab1e0875..dfcc110d6ff 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/LoadReportAnalysisMetadataHolderStepTest.java @@ -26,7 +26,7 @@ import org.sonar.api.utils.MessageException; import org.sonar.scanner.protocol.output.ScannerReport; import org.sonar.server.computation.analysis.MutableAnalysisMetadataHolderRule; import org.sonar.server.computation.batch.BatchReportReaderRule; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.ce.queue.CeTask; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImplTest.java index d3412b0882b..911a84e4411 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryImplTest.java @@ -24,8 +24,9 @@ import java.util.Set; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.guava.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryRule.java index 37596806480..2f745d28093 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryRule.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorRepositoryRule.java @@ -24,8 +24,9 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; import org.junit.rules.ExternalResource; -import org.sonar.server.computation.queue.CeTask; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTask; +import org.sonar.ce.queue.CeTaskResult; +import org.sonar.ce.taskprocessor.CeTaskProcessor; import static com.google.common.base.Preconditions.checkState; import static java.util.Objects.requireNonNull; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImplTest.java index f9d708ee838..a4648392c13 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImplTest.java @@ -24,12 +24,11 @@ import org.junit.Rule; import org.junit.Test; import org.mockito.InOrder; import org.mockito.Mockito; +import org.sonar.ce.log.CeLogging; +import org.sonar.ce.queue.CeTask; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.server.computation.log.CeLogging; -import org.sonar.server.computation.queue.CeQueue; -import org.sonar.server.computation.queue.CeQueueImpl; -import org.sonar.server.computation.queue.CeTask; +import org.sonar.server.computation.queue.InternalCeQueue; import org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +42,7 @@ public class CeWorkerCallableImplTest { @Rule public CeTaskProcessorRepositoryRule taskProcessorRepository = new CeTaskProcessorRepositoryRule(); - CeQueue queue = mock(CeQueueImpl.class); + InternalCeQueue queue = mock(InternalCeQueue.class); ReportTaskProcessor taskProcessor = mock(ReportTaskProcessor.class); CeLogging ceLogging = mock(CeLogging.class); CeWorkerCallable underTest = new CeWorkerCallableImpl(queue, ceLogging, taskProcessorRepository); diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImplTest.java index 5b9df2bde0f..221e2ed3305 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/MutableTaskResultHolderImplTest.java @@ -22,7 +22,7 @@ package org.sonar.server.computation.taskprocessor; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.sonar.server.computation.queue.CeTaskResult; +import org.sonar.ce.queue.CeTaskResult; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; -- 2.39.5