Skip to content

Commit

Permalink
Fix another test
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed May 28, 2019
1 parent 052e859 commit 971794b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,20 @@ public static void queue(ScanOnDemandTask task) {
*
*/
protected void startQueue() {
PluginImpl instance = PluginImpl.getInstance();
if (executor == null) {
logger.debug("Starting the sending thread pool.");
executor = new ThreadPoolExecutor(
PluginImpl.getInstance().getSodVariables().getMinimumSodWorkerThreads(),
PluginImpl.getInstance().getSodVariables().getMinimumSodWorkerThreads(),
PluginImpl.getInstance().getSodVariables().getSodThreadKeepAliveTime(), TimeUnit.MINUTES,
new LinkedBlockingQueue<Runnable>());
instance.getSodVariables().getMinimumSodWorkerThreads(),
instance.getSodVariables().getMinimumSodWorkerThreads(),
instance.getSodVariables().getSodThreadKeepAliveTime(), TimeUnit.MINUTES,
new LinkedBlockingQueue<>());
executor.allowCoreThreadTimeOut(true);
executor.prestartCoreThread();
logger.info("SendQueue started! Current pool size: {}", executor.getPoolSize());
}
executor.setMaximumPoolSize(PluginImpl.getInstance().getSodVariables().getMaximumSodWorkerThreads());
executor.setCorePoolSize(PluginImpl.getInstance().getSodVariables().getSodCorePoolNumberOfThreads());
executor.setMaximumPoolSize(instance.getSodVariables().getMaximumSodWorkerThreads());
executor.setCorePoolSize(instance.getSodVariables().getSodCorePoolNumberOfThreads());
logger.debug("SendQueue running. Current pool size: {}. Current Queue size: {}",
executor.getPoolSize(), getQueueSize());
logger.debug("Nr of active pool-threads: {}", executor.getActiveCount());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.concurrent.TimeUnit;

import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
Expand All @@ -66,6 +67,11 @@ public class ScanOnDemandBaseActionTest {
@Rule
public JenkinsRule j = new JenkinsRule();

@Before
public void setup() {
PluginImpl.getInstance().setSodVariables(new ScanOnDemandVariables());
}

private static final String TO_PRINT = "ERROR";
/**
* Tests for performScanMethod by passing failed build.
Expand Down

0 comments on commit 971794b

Please sign in to comment.