* when previous one had nothing to do.
*/
long getQueuePollingDelay();
+
+ /**
+ * Delay before running job that cancels worn out tasks for the first time (in minutes).
+ */
+ long getCancelWornOutsInitialDelay();
+
+ /**
+ * Delay between the end of a run and the start of the next one of the job that cancels worn out CE tasks (in minutes).
+ */
+ long getCancelWornOutsDelay();
}
*/
package org.sonar.ce.configuration;
-import com.google.common.annotations.VisibleForTesting;
import org.picocontainer.Startable;
import org.sonar.api.config.Settings;
import org.sonar.api.utils.MessageException;
private static final Logger LOG = Loggers.get(CeConfigurationImpl.class);
- @VisibleForTesting
- protected static final int DEFAULT_WORKER_COUNT = 1;
+ private static final int DEFAULT_WORKER_COUNT = 1;
// 2 seconds
- @VisibleForTesting
- protected static final long DEFAULT_QUEUE_POLLING_DELAY = 2 * 1000L;
+ private static final long DEFAULT_QUEUE_POLLING_DELAY = 2 * 1000L;
+ // 1 minute
+ private static final long CANCEL_WORN_OUTS_INITIAL_DELAY = 1;
+ // 10 minutes
+ private static final long CANCEL_WORN_OUTS_DELAY = 10;
private final int workerCount;
public long getQueuePollingDelay() {
return DEFAULT_QUEUE_POLLING_DELAY;
}
+
+ @Override
+ public long getCancelWornOutsInitialDelay() {
+ return CANCEL_WORN_OUTS_INITIAL_DELAY;
+ }
+
+ @Override
+ public long getCancelWornOutsDelay() {
+ return CANCEL_WORN_OUTS_DELAY;
+ }
}
private Settings settings = new MapSettings();
@Test
- public void getWorkCount_returns_1_when_worker_property_is_not_defined() {
+ public void getWorkerCount_returns_1_when_worker_property_is_not_defined() {
assertThat(new CeConfigurationImpl(settings).getWorkerCount()).isEqualTo(1);
}
@Test
- public void getWorkCount_returns_1_when_worker_property_is_empty() {
+ public void getWorkerCount_returns_1_when_worker_property_is_empty() {
settings.setProperty(CE_WORKERS_COUNT_PROPERTY, "");
assertThat(new CeConfigurationImpl(settings).getWorkerCount()).isEqualTo(1);
}
@Test
- public void getWorkCount_returns_1_when_worker_property_is_space_chars() {
+ public void getWorkerCount_returns_1_when_worker_property_is_space_chars() {
settings.setProperty(CE_WORKERS_COUNT_PROPERTY, " \n ");
assertThat(new CeConfigurationImpl(settings).getWorkerCount()).isEqualTo(1);
}
@Test
- public void getWorkCount_returns_1_when_worker_property_is_1() {
+ public void getWorkerCount_returns_1_when_worker_property_is_1() {
settings.setProperty(CE_WORKERS_COUNT_PROPERTY, 1);
assertThat(new CeConfigurationImpl(settings).getWorkerCount()).isEqualTo(1);
}
@Test
- public void getWorkCount_returns_value_when_worker_property_is_integer_greater_than_1() {
+ public void getWorkerCount_returns_value_when_worker_property_is_integer_greater_than_1() {
int value = abs(new Random().nextInt()) + 2;
settings.setProperty(CE_WORKERS_COUNT_PROPERTY, value);
private void expectMessageException(int value) {
expectedException.expect(MessageException.class);
expectedException.expectMessage("value '" + value + "' of property " + CE_WORKERS_COUNT_PROPERTY + " is invalid. " +
- "It must an integer strictly greater than 0");
+ "It must an integer strictly greater than 0");
+ }
+
+ @Test
+ public void getCancelWornOutsInitialDelay_returns_1() {
+ assertThat(new CeConfigurationImpl(settings).getCancelWornOutsInitialDelay())
+ .isEqualTo(1L);
+ }
+
+ @Test
+ public void getCancelWornOutsDelay_returns_10() {
+ assertThat(new CeConfigurationImpl(settings).getCancelWornOutsDelay())
+ .isEqualTo(10L);
}
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.ce.cleaning;
+
+import java.util.concurrent.ScheduledExecutorService;
+
+public interface CeCleaningExecutorService extends ScheduledExecutorService {
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.ce.cleaning;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import org.sonar.server.util.AbstractStoppableScheduledExecutorServiceImpl;
+
+public class CeCleaningExecutorServiceImpl
+ extends AbstractStoppableScheduledExecutorServiceImpl<ScheduledExecutorService>
+ implements CeCleaningExecutorService {
+
+ public CeCleaningExecutorServiceImpl() {
+ super(Executors.newSingleThreadScheduledExecutor(
+ new ThreadFactoryBuilder()
+ .setDaemon(false)
+ .setNameFormat("CE_cleaning-%d")
+ .build()));
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.ce.cleaning;
+
+import org.sonar.core.platform.Module;
+
+public class CeCleaningModule extends Module {
+ @Override
+ protected void configureModule() {
+ add(
+ CeCleaningExecutorServiceImpl.class,
+ CeCleaningSchedulerImpl.class);
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.ce.cleaning;
+
+public interface CeCleaningScheduler {
+ void startScheduling();
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.ce.cleaning;
+
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+import org.sonar.ce.configuration.CeConfiguration;
+import org.sonar.ce.queue.InternalCeQueue;
+
+import static java.util.concurrent.TimeUnit.MINUTES;
+
+public class CeCleaningSchedulerImpl implements CeCleaningScheduler {
+ private static final Logger LOG = Loggers.get(CeCleaningSchedulerImpl.class);
+
+ private final CeCleaningExecutorService executorService;
+ private final CeConfiguration ceConfiguration;
+ private final InternalCeQueue internalCeQueue;
+
+ public CeCleaningSchedulerImpl(CeCleaningExecutorService executorService, CeConfiguration ceConfiguration, InternalCeQueue internalCeQueue) {
+ this.executorService = executorService;
+ this.internalCeQueue = internalCeQueue;
+ this.ceConfiguration = ceConfiguration;
+ }
+
+ @Override
+ public void startScheduling() {
+ executorService.scheduleWithFixedDelay(this::cancelWornOuts,
+ ceConfiguration.getCancelWornOutsInitialDelay(),
+ ceConfiguration.getCancelWornOutsDelay(),
+ MINUTES);
+ }
+
+ private void cancelWornOuts() {
+ try {
+ LOG.info("Deleting any worn out task");
+ internalCeQueue.cancelWornOuts();
+ } catch (Exception e) {
+ LOG.warn("Failed to cancel worn out tasks", e);
+ }
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.ce.cleaning;
+
+import javax.annotation.ParametersAreNonnullByDefault;
import org.sonar.ce.CeHttpModule;
import org.sonar.ce.CeQueueModule;
import org.sonar.ce.CeTaskCommonsModule;
+import org.sonar.ce.cleaning.CeCleaningModule;
import org.sonar.ce.db.ReadOnlyPropertiesDao;
import org.sonar.ce.log.CeProcessLogging;
import org.sonar.ce.platform.ComputeEngineExtensionInstaller;
InternalPropertiesImpl.class,
ProjectSettingsFactory.class,
+
+ // cleaning
+ CeCleaningModule.class
};
}
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.platform.Server;
import org.sonar.api.platform.ServerStartHandler;
+import org.sonar.ce.cleaning.CeCleaningScheduler;
import org.sonar.ce.taskprocessor.CeProcessingScheduler;
/**
@ComputeEngineSide
public class CeQueueInitializer implements ServerStartHandler {
- private final CeProcessingScheduler scheduler;
+ private final CeProcessingScheduler processingScheduler;
+ private final CeCleaningScheduler cleaningScheduler;
private boolean done = false;
- public CeQueueInitializer(CeProcessingScheduler scheduler) {
- this.scheduler = scheduler;
+ public CeQueueInitializer(CeProcessingScheduler processingScheduler, CeCleaningScheduler cleaningScheduler) {
+ this.processingScheduler = processingScheduler;
+ this.cleaningScheduler = cleaningScheduler;
}
@Override
}
private void initCe() {
- scheduler.startScheduling();
+ processingScheduler.startScheduling();
+ cleaningScheduler.startScheduling();
}
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.ce.cleaning;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.junit.Test;
+import org.sonar.ce.configuration.CeConfiguration;
+import org.sonar.ce.queue.InternalCeQueue;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class CeCleaningSchedulerImplTest {
+ @Test
+ public void startScheduling_does_not_fail_if_cancelWornOuts_send_even_an_Exception() {
+ InternalCeQueue mockedInternalCeQueue = mock(InternalCeQueue.class);
+ CeCleaningSchedulerImpl underTest = new CeCleaningSchedulerImpl(new CeCleaningAdapter() {
+ @Override
+ public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
+ // synchronously execute command
+ command.run();
+ return null;
+ }
+ }, mockCeConfiguration(1, 10), mockedInternalCeQueue);
+ doThrow(new IllegalArgumentException("faking unchecked exception thrown by cancelWornOuts")).when(mockedInternalCeQueue).cancelWornOuts();
+
+ underTest.startScheduling();
+
+ verify(mockedInternalCeQueue).cancelWornOuts();
+ }
+
+ @Test
+ public void startScheduling_fails_if_cancelWornOuts_send_even_an_Error() {
+ InternalCeQueue mockedInternalCeQueue = mock(InternalCeQueue.class);
+ CeCleaningSchedulerImpl underTest = new CeCleaningSchedulerImpl(new CeCleaningAdapter() {
+ @Override
+ public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
+ // synchronously execute command
+ command.run();
+ return null;
+ }
+ }, mockCeConfiguration(1, 10), mockedInternalCeQueue);
+ Error expected = new Error("faking Error thrown by cancelWornOuts");
+ doThrow(expected).when(mockedInternalCeQueue).cancelWornOuts();
+
+ try {
+ underTest.startScheduling();
+ fail("the error should have been thrown");
+ } catch (Error e) {
+ assertThat(e).isSameAs(expected);
+ }
+ }
+
+ @Test
+ public void startScheduling_calls_cancelWornOuts_of_internalCeQueue_at_fixed_rate_with_value_from_CeConfiguration() {
+ InternalCeQueue mockedInternalCeQueue = mock(InternalCeQueue.class);
+ long initialDelay = 10L;
+ long delay = 20L;
+ CeConfiguration mockedCeConfiguration = mockCeConfiguration(initialDelay, delay);
+ CeCleaningAdapter executorService = new CeCleaningAdapter() {
+ @Override
+ public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initDelay, long period, TimeUnit unit) {
+ assertThat(initDelay).isEqualTo(initialDelay);
+ assertThat(period).isEqualTo(delay);
+ assertThat(unit).isEqualTo(TimeUnit.MINUTES);
+ // synchronously execute command
+ command.run();
+ return null;
+ }
+ };
+ CeCleaningSchedulerImpl underTest = new CeCleaningSchedulerImpl(executorService, mockedCeConfiguration, mockedInternalCeQueue);
+
+ underTest.startScheduling();
+
+ verify(mockedInternalCeQueue).cancelWornOuts();
+ }
+
+ private CeConfiguration mockCeConfiguration(long initialDelay, long delay) {
+ CeConfiguration mockedCeConfiguration = mock(CeConfiguration.class);
+ when(mockedCeConfiguration.getCancelWornOutsInitialDelay()).thenReturn(initialDelay);
+ when(mockedCeConfiguration.getCancelWornOutsDelay()).thenReturn(delay);
+ return mockedCeConfiguration;
+ }
+
+ /**
+ * Implementation of {@link CeCleaningExecutorService} which throws {@link UnsupportedOperationException} for every
+ * method.
+ */
+ private static class CeCleaningAdapter implements CeCleaningExecutorService {
+
+ @Override
+ public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void shutdown() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public List<Runnable> shutdownNow() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T> Future<T> submit(Callable<T> task) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T> Future<T> submit(Runnable task, T result) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public Future<?> submit(Runnable task) {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
+ throw createUnsupportedOperationException();
+ }
+
+ @Override
+ public void execute(Runnable command) {
+ throw createUnsupportedOperationException();
+ }
+
+ private UnsupportedOperationException createUnsupportedOperationException() {
+ return new UnsupportedOperationException("Unexpected call");
+ }
+ }
+}
* Mutable implementation of {@link CeConfiguration} as {@link org.junit.Rule}.
*/
public class CeConfigurationRule extends ExternalResource implements CeConfiguration {
- private int workerCount = CeConfigurationImpl.DEFAULT_WORKER_COUNT;
- private long queuePollingDelay = CeConfigurationImpl.DEFAULT_QUEUE_POLLING_DELAY;
+ private int workerCount = 1;
+ private long queuePollingDelay = 2 * 1000L;
+ private long cancelWornOutsInitialDelay = 1L;
+ private long cancelWornOutsDelay = 10L;
@Override
public int getWorkerCount() {
checkArgument(queuePollingDelay > 0, "Queue polling delay must be >= 0");
this.queuePollingDelay = queuePollingDelay;
}
+
+ @Override
+ public long getCancelWornOutsInitialDelay() {
+ return cancelWornOutsInitialDelay;
+ }
+
+ public void setCancelWornOutsInitialDelay(long cancelWornOutsInitialDelay) {
+ checkArgument(cancelWornOutsInitialDelay > 0, "cancel worn-outs polling initial delay must be >= 1");
+ this.cancelWornOutsInitialDelay = cancelWornOutsInitialDelay;
+ }
+
+ @Override
+ public long getCancelWornOutsDelay() {
+ return cancelWornOutsDelay;
+ }
+
+ public void setCancelWornOutsDelay(long cancelWornOutsDelay) {
+ checkArgument(cancelWornOutsDelay > 0, "cancel worn-outs polling delay must be >= 1");
+ this.cancelWornOutsDelay = cancelWornOutsDelay;
+ }
}
+ 3 // content of CeTaskCommonsModule
+ 4 // content of ProjectAnalysisTaskModule
+ 4 // content of CeTaskProcessorModule
+ + 3 // CeCleaningModule + its content
);
assertThat(picoContainer.getParent().getComponentAdapters()).hasSize(
CONTAINER_ITSELF
import java.io.IOException;
import org.junit.Test;
import org.sonar.api.platform.Server;
+import org.sonar.ce.cleaning.CeCleaningScheduler;
import org.sonar.ce.taskprocessor.CeProcessingScheduler;
import static org.mockito.Mockito.mock;
public class CeQueueInitializerTest {
private Server server = mock(Server.class);
- private CeProcessingScheduler scheduler = mock(CeProcessingScheduler.class);
- private CeQueueInitializer underTest = new CeQueueInitializer(scheduler);
+ private CeProcessingScheduler processingScheduler = mock(CeProcessingScheduler.class);
+ private CeCleaningScheduler cleaningScheduler = mock(CeCleaningScheduler.class);
+ private CeQueueInitializer underTest = new CeQueueInitializer(processingScheduler, cleaningScheduler);
@Test
public void clean_queue_then_start_scheduler_of_workers() throws IOException {
underTest.onServerStart(server);
- verify(scheduler).startScheduling();
+ verify(processingScheduler).startScheduling();
+ verify(cleaningScheduler).startScheduling();
}
@Test
public void onServerStart_has_no_effect_if_called_twice_to_support_medium_test_doing_startup_tasks_multiple_times() {
-
underTest.onServerStart(server);
-
- reset(scheduler);
+ reset(processingScheduler, cleaningScheduler);
underTest.onServerStart(server);
- verifyZeroInteractions(scheduler);
+ verifyZeroInteractions(processingScheduler, cleaningScheduler);
}
}
public long getQueuePollingDelay() {
throw new UnsupportedOperationException("getQueuePollingDelay is not implemented");
}
+
+ @Override
+ public long getCancelWornOutsInitialDelay() {
+ throw new UnsupportedOperationException("getCancelWornOutsInitialDelay is not implemented");
+ }
+
+ @Override
+ public long getCancelWornOutsDelay() {
+ throw new UnsupportedOperationException("getCancelWornOutsDelay is not implemented");
+ }
}
@CheckForNull