aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-08-30 15:19:32 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2023-08-30 15:04:51 +0000
commit568108055e1c8fcd1bccacc515056f4f434f27b9 (patch)
treed46c6e50250de4be8dd2cab2515b1e57a66ad4a2
parentf302b69e3af1779b77142f20110947d4d189f298 (diff)
Fix Simulator Buildersjava-17
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>
-rw-r--r--models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java3
-rw-r--r--models-interactions/model-simulators/src/main/java/org/onap/policy/simulators/Util.java15
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/AaiSimulatorTest.java3
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/SoSimulatorTest.java3
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/VfcSimulatorTest.java3
-rw-r--r--models-interactions/model-simulators/src/test/java/org/onap/policy/simulators/XacmlSimulatorTest.java3
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());
}