Fix Simulator Builders

Simulator Builders have to return a HttpServletServer Object
because are used by drools-applications.

Issue-ID: POLICY-4814
Change-Id: If3dbe5db437464d291c7b3e14183159aa6b35cbb
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
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 f4b6141..a88bb02 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 @@
      * 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 bfbacc6..f5408c4 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 @@
      *
      * @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 @@
      *
      * @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 @@
      *
      * @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 @@
      *
      * @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 @@
      *
      * @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 d5d93e0..a730d97 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 @@
     @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 31b7627..129f284 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 @@
     @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 dc48e75..643fadf 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 @@
     @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 e188edc..417dcc9 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 @@
     @BeforeClass
     public static void setupSimulator() {
         try {
-            org.onap.policy.simulators.Util.buildXacmlSim();
+            var testServer = Util.buildXacmlSim();
+            assertNotNull(testServer);
         } catch (Exception e) {
             fail(e.getMessage());
         }