From cc99c1785390c6ca9f40bb0d6d2b42ee55f38941 Mon Sep 17 00:00:00 2001 From: Joss Armstrong Date: Wed, 6 Feb 2019 21:53:57 +0000 Subject: New test class for QueueManager Increase test coverage from 8% to 84% Issue-ID: APPC-1396 Change-Id: I82fa20559e37fa387dbc7efa0bc24ba93139a973 Signed-off-by: Joss Armstrong --- .../appc/executionqueue/impl/QueueManager.java | 32 +++++++++------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'appc-dispatcher/appc-dispatcher-common/execution-queue-management-lib/src/main') 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 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(); - } } -- cgit 1.2.3-korg