diff options
6 files changed, 20 insertions, 10 deletions
diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java index f4b6141f8..a88bb0231 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java @@ -76,7 +76,8 @@ public abstract class BasicSdncOperation extends BasicHttpOperation { * Starts the simulator. */ protected static void initBeforeClass() throws Exception { - Util.buildSdncSim(); + var testServer = Util.buildSdncSim(); + assertNotNull(testServer); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("restconf/operations/") .hostname("localhost").managed(true).port(Util.SDNCSIM_SERVER_PORT).build(); diff --git a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java index bfbacc697..f5408c410 100644 --- a/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java +++ b/models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java @@ -60,12 +60,13 @@ public final class Util { * * @throws InterruptedException if a thread is interrupted */ - public static void buildAaiSim() throws InterruptedException { + public static HttpServletServer buildAaiSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(AAISIM_SERVER_NAME, LOCALHOST, AAISIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", AaiSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); + return testServer; } /** @@ -87,12 +88,13 @@ public final class Util { * * @throws InterruptedException if a thread is interrupted */ - public static void buildSdncSim() throws InterruptedException { + public static HttpServletServer buildSdncSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(SDNCSIM_SERVER_NAME, LOCALHOST, SDNCSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", SdncSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); + return testServer; } @@ -101,12 +103,13 @@ public final class Util { * * @throws InterruptedException if a thread is interrupted */ - public static void buildSoSim() throws InterruptedException { + public static HttpServletServer buildSoSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(SOSIM_SERVER_NAME, LOCALHOST, SOSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", SoSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); + return testServer; } /** @@ -114,12 +117,13 @@ public final class Util { * * @throws InterruptedException if a thread is interrupted */ - public static void buildVfcSim() throws InterruptedException { + public static HttpServletServer buildVfcSim() throws InterruptedException { final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory() .build(VFCSIM_SERVER_NAME, LOCALHOST, VFCSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", VfcSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); + return testServer; } /** @@ -127,12 +131,13 @@ public final class Util { * * @throws InterruptedException if a thread is interrupted */ - public static void buildXacmlSim() throws InterruptedException { + public static HttpServletServer buildXacmlSim() throws InterruptedException { HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory().build(XACMLSIM_SERVER_NAME, LOCALHOST, XACMLSIM_SERVER_PORT, "/", false, true); testServer.addServletClass("/*", XacmlSimulatorJaxRs.class.getName()); testServer.waitedStart(5000); waitForServerToListen(testServer.getPort()); + return testServer; } /** diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java index d5d93e07f..a730d977d 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java @@ -42,7 +42,8 @@ public class AaiSimulatorTest { @BeforeClass public static void setUpSimulator() { try { - Util.buildAaiSim(); + var testServer = Util.buildAaiSim(); + assertNotNull(testServer); } catch (final Exception e) { fail(e.getMessage()); } diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java index 31b76270c..129f2841b 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java @@ -57,7 +57,8 @@ public class SoSimulatorTest { @BeforeClass public static void setUpSimulator() { try { - Util.buildSoSim(); + var testServer = Util.buildSoSim(); + assertNotNull(testServer); } catch (final Exception e) { fail(e.getMessage()); } diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java index dc48e75a1..643fadf22 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java @@ -43,7 +43,8 @@ public class VfcSimulatorTest { @BeforeClass public static void setUpSimulator() { try { - Util.buildVfcSim(); + var testServer = Util.buildVfcSim(); + assertNotNull(testServer); } catch (final Exception e) { fail(e.getMessage()); } diff --git a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java index e188edc77..417dcc9b3 100644 --- a/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java +++ b/models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java @@ -48,7 +48,8 @@ public class XacmlSimulatorTest { @BeforeClass public static void setupSimulator() { try { - org.onap.policy.simulators.Util.buildXacmlSim(); + var testServer = Util.buildXacmlSim(); + assertNotNull(testServer); } catch (Exception e) { fail(e.getMessage()); } |