diff options
author | Joss Armstrong <joss.armstrong@ericsson.com> | 2019-02-06 21:53:57 +0000 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2019-02-07 18:26:49 +0000 |
commit | cc99c1785390c6ca9f40bb0d6d2b42ee55f38941 (patch) | |
tree | d0e189116acdcef16bf6ee21b7eaea88307c771a /appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main | |
parent | b6509fd1f339a8166c4b2c8a28f6dd7b6f867a60 (diff) |
New test class for QueueManager
Increase test coverage from 8% to 84%
Issue-ID: APPC-1396
Change-Id: I82fa20559e37fa387dbc7efa0bc24ba93139a973
Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main')
-rw-r--r-- | appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/onap/appc/executionqueue/impl/QueueManager.java | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/onap/appc/executionqueue/impl/QueueManager.java b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/onap/appc/executionqueue/impl/QueueManager.java index 8bad66bea..579f5d1b1 100644 --- a/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/onap/appc/executionqueue/impl/QueueManager.java +++ b/appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main/java/org/onap/appc/executionqueue/impl/QueueManager.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications Copyright (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,27 +25,24 @@ package org.onap.appc.executionqueue.impl; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import org.onap.appc.executionqueue.MessageExpirationListener; -import org.onap.appc.executionqueue.helper.Util; -import org.onap.appc.executionqueue.impl.object.QueueMessage; - import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import org.onap.appc.executionqueue.helper.Util; +import org.onap.appc.executionqueue.impl.object.QueueMessage; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; public class QueueManager { private final EELFLogger logger = EELFManager.getInstance().getLogger(QueueManager.class); private ExecutorService messageExecutor; - private LinkedBlockingQueue<QueueMessage> queue; - private int max_thread_size; - private int max_queue_size; + private int maxThreadSize; + private int maxQueueSize; private Util executionQueueUtil; public QueueManager() { @@ -54,14 +53,14 @@ public class QueueManager { * Initialization method used by blueprint */ public void init() { - max_thread_size = executionQueueUtil.getThreadPoolSize(); - max_queue_size = executionQueueUtil.getExecutionQueueSize(); + maxThreadSize = executionQueueUtil.getThreadPoolSize(); + maxQueueSize = executionQueueUtil.getExecutionQueueSize(); messageExecutor = new ThreadPoolExecutor( - max_thread_size, - max_thread_size, + maxThreadSize, + maxThreadSize, 0L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue(max_queue_size), + new LinkedBlockingQueue(maxQueueSize), executionQueueUtil.getThreadFactory(true, "appc-dispatcher"), new ThreadPoolExecutor.AbortPolicy()); } @@ -108,9 +107,4 @@ public class QueueManager { return isEnqueued; } - - private boolean messageExpired(QueueMessage queueMessage) { - return queueMessage.getExpirationTime() != null && - queueMessage.getExpirationTime().getTime() < System.currentTimeMillis(); - } } |