From d070fcda2258da7dde32bd56f6d62a6d03742617 Mon Sep 17 00:00:00 2001 From: GuangrongFu Date: Thu, 3 Mar 2022 11:34:32 +0800 Subject: bugfix - fixed the healthcheck problem Issue-ID: HOLMES-512 Signed-off-by: GuangrongFu Change-Id: I95891f918b0abb2ea74caf8f1d39aed92c80624c --- .../java/org/onap/holmes/engine/InitializerTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'engine-d/src/test/java/org/onap') diff --git a/engine-d/src/test/java/org/onap/holmes/engine/InitializerTest.java b/engine-d/src/test/java/org/onap/holmes/engine/InitializerTest.java index d6d0b67..788c3ae 100644 --- a/engine-d/src/test/java/org/onap/holmes/engine/InitializerTest.java +++ b/engine-d/src/test/java/org/onap/holmes/engine/InitializerTest.java @@ -25,6 +25,8 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.internal.WhiteboxImpl; +import java.util.concurrent.TimeUnit; + @RunWith(PowerMockRunner.class) @PrepareForTest(MicroServiceConfig.class) public class InitializerTest { @@ -43,8 +45,23 @@ public class InitializerTest { PowerMock.replayAll(); + setReadyFlagAfter(3); + WhiteboxImpl.invokeMethod(initializer, "init"); + TimeUnit.SECONDS.sleep(6); + 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 -- cgit 1.2.3-korg