summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/test
diff options
context:
space:
mode:
authorGuangrongFu <fu.guangrong@zte.com.cn>2022-03-02 21:00:36 +0800
committerGuangrongFu <fu.guangrong@zte.com.cn>2022-03-02 21:00:36 +0800
commitecf54e8ad1182aa14b5f942160e1834725a432f9 (patch)
tree063920ac285f7279609c6c405b115e4f03e614d5 /rulemgt/src/test
parentc211beead420cf96019ef19bac2d207dede95004 (diff)
bugfix - fixed the healthcheck problem
Issue-ID: HOLMES-512 Signed-off-by: GuangrongFu <fu.guangrong@zte.com.cn> Change-Id: Ice381df0b40853815b2f7e2bd8ab70af304629c1
Diffstat (limited to 'rulemgt/src/test')
-rw-r--r--rulemgt/src/test/java/org/onap/holmes/rulemgt/InitializerTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/InitializerTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/InitializerTest.java
index 120aba2..f658d35 100644
--- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/InitializerTest.java
+++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/InitializerTest.java
@@ -26,6 +26,8 @@ import org.powermock.core.classloader.annotations.SuppressStaticInitializationFo
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.internal.WhiteboxImpl;
+import java.util.concurrent.TimeUnit;
+
@RunWith(PowerMockRunner.class)
@PrepareForTest(MicroServiceConfig.class)
@SuppressStaticInitializationFor("org.onap.holmes.common.utils.CommonUtils")
@@ -45,8 +47,21 @@ public class InitializerTest {
PowerMock.replayAll();
+ setReadyFlagAfter(3);
+
WhiteboxImpl.invokeMethod(initializer, "init");
PowerMock.verifyAll();
}
+
+ private void setReadyFlagAfter(final int second) {
+ new Thread(() -> {
+ try {
+ TimeUnit.SECONDS.sleep(second);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ Initializer.setReadyForMsbReg(true);
+ }).start();
+ }
} \ No newline at end of file