@@ -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 |
@@ -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 |
@@ -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); | |||
} | |||
} |
@@ -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<E> implements AppenderFactory<E> { | |||
/** | |||
* @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<E> buildAppender(Context context, String discriminatingValue) { |
@@ -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; |
@@ -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; |
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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 { | |||
@@ -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!"); | |||
} | |||
} |
@@ -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; |
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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<CeTask> massSubmit(Collection<CeTaskSubmit> 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()}. | |||
* | |||
* <p>Only a single task can be peeked by project.</p> | |||
* | |||
* <p>An unchecked exception may be thrown on technical errors (db connection, ...).</p> | |||
*/ | |||
Optional<CeTask> 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(); | |||
} |
@@ -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<CeTask> peek() { | |||
if (peekPaused.get()) { | |||
return Optional.absent(); | |||
} | |||
DbSession dbSession = dbClient.openSession(false); | |||
try { | |||
Optional<CeQueueDto> 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<CeQueueDto> 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<CeQueueDto> 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<CeQueueDto, CeTask> { | |||
private final Map<String, ComponentDto> componentDtoByUuid; | |||
@@ -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; | |||
@@ -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; |
@@ -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 { | |||
/** |
@@ -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; |
@@ -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; |
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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 |
@@ -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<String> HANDLED_TYPES = Collections.singleton(CeTaskTypes.REPORT); | |||
@Override | |||
public Set<String> getHandledCeTaskTypes() { | |||
return HANDLED_TYPES; | |||
} | |||
@Override | |||
public CeTaskResult process(CeTask task) { | |||
throw new UnsupportedOperationException("process must not be called in WebServer"); | |||
} | |||
} |
@@ -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; |
@@ -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; | |||
/** |
@@ -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; |
@@ -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 { |
@@ -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 { |
@@ -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; | |||
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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; |
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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; |
@@ -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; |
@@ -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; | |||
@@ -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); | |||
} | |||
} |
@@ -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 { | |||
/** |
@@ -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}. |
@@ -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 { |
@@ -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 { |
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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 { |
@@ -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; |
@@ -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; | |||
/** |
@@ -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, |
@@ -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. | |||
* <p> | |||
* This class is decoupled from the regular task type {@link org.sonar.db.ce.CeTaskTypes#REPORT}. | |||
* </p> | |||
*/ | |||
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()}. | |||
* | |||
* <p>Only a single task can be peeked by project.</p> | |||
* | |||
* <p>An unchecked exception may be thrown on technical errors (db connection, ...).</p> | |||
*/ | |||
Optional<CeTask> 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(); | |||
} |
@@ -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<CeTask> peek() { | |||
if (peekPaused.get()) { | |||
return Optional.absent(); | |||
} | |||
DbSession dbSession = dbClient.openSession(false); | |||
try { | |||
Optional<CeQueueDto> 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<CeQueueDto> 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(); | |||
} | |||
} |
@@ -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 { |
@@ -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 { | |||
@@ -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; | |||
/** |
@@ -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; | |||
@@ -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 { |
@@ -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 { | |||
@@ -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; |
@@ -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}. |
@@ -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; |
@@ -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 { | |||
/** |
@@ -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; |
@@ -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 { | |||
/** |
@@ -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; | |||
@@ -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; |
@@ -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, |
@@ -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 |
@@ -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; |
@@ -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; |
@@ -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; | |||
@@ -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; | |||
@@ -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 { | |||
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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<CeTask> 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<CeTask> 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<CeActivityDto> 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<CeActivityDto> 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<CeQueueDto> 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; | |||
} | |||
} |
@@ -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; | |||
@@ -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; |
@@ -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)); | |||
} | |||
} |
@@ -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 { |
@@ -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; |
@@ -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; |
@@ -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; |
@@ -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; | |||
@@ -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; |
@@ -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; |