From 6bf1aa0b408e0e4201d9002ca5c13095b98e7e46 Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Tue, 10 Jul 2018 11:52:12 +0100 Subject: Adding executor integration tests Change-Id: I292315164fbfb3650f6d21ede6edb264a7fd8ee3 Issue-ID: POLICY-865 Signed-off-by: waqas.ikram --- .../onap/policy/apex/context/test/locking/ConcurrentContext.java | 2 ++ .../policy/apex/context/test/locking/ConcurrentContextJVM.java | 2 ++ .../java/org/onap/policy/apex/context/test/utils/Constants.java | 9 +++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'context/context-test-utils/src') diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java index a400bc79a..b62364e9d 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java @@ -113,6 +113,8 @@ public class ConcurrentContext { executorService.awaitTermination(10, TimeUnit.MINUTES); } catch (final InterruptedException interruptedException) { LOGGER.error("Exception while waiting for threads to finish", interruptedException); + // restore the interrupt status + Thread.currentThread().interrupt(); } LOGGER.info("Shutting down now ..."); diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java index b76b00840..e2a6b0da0 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java @@ -119,6 +119,8 @@ public final class ConcurrentContextJVM { executorService.awaitTermination(10, TimeUnit.MINUTES); } catch (final InterruptedException interruptedException) { LOGGER.error("Exception while waiting for threads to finish", interruptedException); + // restore the interrupt status + Thread.currentThread().interrupt(); } LOGGER.debug("threads finished, end value is {}", lTypeAlbum.get("testValue")); diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java index ac1e951d5..2bf304ec8 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/utils/Constants.java @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + package org.onap.policy.apex.context.test.utils; import java.util.TimeZone; @@ -51,8 +52,12 @@ public class Constants { public static final String TEST_POLICY_CONTEXT_ITEM = TestPolicyContextItem.class.getName(); public static final TimeZone TIME_ZONE = TimeZone.getTimeZone("Europe/Dublin"); - public static AxArtifactKey[] USED_ARTIFACT_STACK_ARRAY = {new AxArtifactKey("testC-top", VERSION), - new AxArtifactKey("testC-next", VERSION), new AxArtifactKey("testC-bot", VERSION)}; + private static final AxArtifactKey KEY = new AxArtifactKey("testC-top", VERSION); + private static final AxArtifactKey KEY3 = new AxArtifactKey("testC-bot", VERSION); + private static final AxArtifactKey KEY2 = new AxArtifactKey("testC-next", VERSION); + + private static final AxArtifactKey[] AX_ARTIFACT_KEYS = {KEY, KEY2, KEY3}; + public static final AxArtifactKey[] USED_ARTIFACT_STACK_ARRAY = AX_ARTIFACT_KEYS; private Constants() {} -- cgit 1.2.3-korg