From d85e766c5538de762820132ac723d928f5a9bf89 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 21 Sep 2018 09:31:25 -0400 Subject: new sonar issues in drools-applications Don't return null lists from AAI. Transient TargetLock. Extract aai.url, et. al., constants. Don't allocate extra unneeded variable. Re-order fields in xacml attributes. Extract "vserver" constant from simulator. Replace thread sleep with join. Change-Id: Iee1bd182862632af1f131cca5db5b526f5865b9f Issue-ID: POLICY-1129 Signed-off-by: Jim Hahn --- .../java/org/onap/policy/vfc/TestVfcManager.java | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'controlloop/common/model-impl/vfc/src') diff --git a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java index 9913d39b8..7e4bda81d 100644 --- a/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java +++ b/controlloop/common/model-impl/vfc/src/test/java/org/onap/policy/vfc/TestVfcManager.java @@ -189,9 +189,7 @@ public class TestVfcManager { anyString())) .thenThrow(new RuntimeException("OzException")); - while (managerThread.isAlive()) { - Thread.sleep(100); - } + managerThread.join(); PolicyEngine.manager.getEnvironment().remove("vfc.password"); PolicyEngine.manager.getEnvironment().remove("vfc.username"); @@ -214,9 +212,7 @@ public class TestVfcManager { eq("Dorothy"), eq("Null"), anyMap(), anyString(), anyString())) .thenReturn(null); - while (managerThread.isAlive()) { - Thread.sleep(100); - } + managerThread.join(); PolicyEngine.manager.getEnvironment().remove("vfc.password"); PolicyEngine.manager.getEnvironment().remove("vfc.username"); @@ -239,9 +235,7 @@ public class TestVfcManager { eq("Dorothy"), eq("Error0"), anyMap(), anyString(), anyString())) .thenReturn(httpResponseErr); - while (managerThread.isAlive()) { - Thread.sleep(100); - } + managerThread.join(); PolicyEngine.manager.getEnvironment().remove("vfc.password"); PolicyEngine.manager.getEnvironment().remove("vfc.username"); @@ -264,9 +258,7 @@ public class TestVfcManager { eq("Dorothy"), eq("OK"), anyMap(), anyString(), anyString())) .thenReturn(httpResponseBadResponse); - while (managerThread.isAlive()) { - Thread.sleep(100); - } + managerThread.join(); PolicyEngine.manager.getEnvironment().remove("vfc.password"); PolicyEngine.manager.getEnvironment().remove("vfc.username"); @@ -292,9 +284,7 @@ public class TestVfcManager { when(mockedRestManager.get(endsWith("1234"), eq("Dorothy"), eq("OK"), anyMap())) .thenReturn(httpResponseGetOk); - while (managerThread.isAlive()) { - Thread.sleep(100); - } + managerThread.join(); PolicyEngine.manager.getEnvironment().remove("vfc.password"); PolicyEngine.manager.getEnvironment().remove("vfc.username"); -- cgit 1.2.3-korg