aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java')
-rw-r--r--test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java58
1 files changed, 29 insertions, 29 deletions
diff --git a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java
index 2f166b26f..7f33e179d 100644
--- a/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java
+++ b/test/mocks/pnfsimulator/src/test/java/org/onap/pnfsimulator/simulator/TestMessages.java
@@ -20,35 +20,34 @@
package org.onap.pnfsimulator.simulator;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Optional;
import org.json.JSONObject;
final class TestMessages {
- static final JSONObject VALID_SIMULATOR_PARAMS = new JSONObject(
- "{\n" +
- " \"vesServerUrl\": \"http://10.42.111.42:8080/eventListener/v5\",\n" +
- " \"testDuration\": \"10\",\n" +
- " \"messageInterval\": \"1\"\n" +
- "}");
+ static final JSONObject VALID_SIMULATOR_PARAMS = new JSONObject(getContent("validSimulatorParams.json"));
+ static final JSONObject VALID_COMMON_EVENT_HEADER_PARAMS = new JSONObject(getContent("validCommonEventHeaderParams.json"));
+ static final Optional<JSONObject> VALID_PNF_REGISTRATION_PARAMS = Optional.ofNullable(new JSONObject(getContent("validPnfRegistrationParams.json")));
+
+ private static String getContent(String fileName){
+ try {
+ String pathAsString = TestMessages.class.getResource(fileName).getPath();
+ Path path = Paths.get(pathAsString);
+ StringBuilder stringBuilder = new StringBuilder();
+ Files.readAllLines(path).forEach(line -> {
+ stringBuilder.append(line);
+ });
+ return stringBuilder.toString();
+ } catch (IOException e) {
+ throw new RuntimeException(String.format("Cannot read JSON file %s",fileName));
+ }
- static final JSONObject VALID_MESSAGE_PARAMS = new JSONObject(
- "{\n"
- + " \"pnf_serialNumber\": \"6061ZW3\",\n"
- + " \"pnf_vendorName\": \"Nokia\",\n"
- + " \"pnf_oamV4IpAddress\": \"val3\",\n"
- + " \"pnf_oamV6IpAddress\": \"val4\",\n"
- + " \"pnf_unitFamily\": \"BBU\",\n"
- + " \"pnf_modelNumber\": \"val6\",\n"
- + " \"pnf_softwareVersion\": \"val7\",\n"
- + " \"pnf_unitType\": \"val8\",\n"
- + " \"eventName\": \"pnfRegistration_Nokia_5gDu\",\n"
- + " \"nfNamingCode\": \"gNB\",\n"
- + " \"nfcNamingCode\": \"oam\",\n"
- + " \"sourceName\": \"NOK6061ZW3\",\n"
- + " \"sourceId\": \"val13\",\n"
- + " \"reportingEntityName\": \"NOK6061ZW3\"\n"
- + " }");
+ }
static final JSONObject INVALID_SIMULATOR_PARAMS = new JSONObject(
"{\n" +
@@ -57,7 +56,7 @@ final class TestMessages {
"}");
- static final JSONObject INVALID_MESSAGE_PARAMS_1 = new JSONObject(
+ static final Optional<JSONObject> INVALID_MESSAGE_PARAMS_1 = Optional.ofNullable(new JSONObject(
"{\n" +
" \"pnfSerialNumber\": \"val1\",\n" +
" \"pnfVendorName\": \"val2\",\n" +
@@ -71,9 +70,9 @@ final class TestMessages {
" \"sourceName\": \"val12\",\n" +
" \"sourceId\": \"val13\",\n" +
" \"reportingEntityName\": \"val14\"\n" +
- "}");
+ "}"));
- static final JSONObject INVALID_MESSAGE_PARAMS_2 = new JSONObject(
+ static final Optional<JSONObject> INVALID_MESSAGE_PARAMS_2 = Optional.ofNullable(new JSONObject(
"{\n" +
" \"pnfVendorName\": \"val2\",\n" +
" \"pnfOamIpv4Address\": \"val3\",\n" +
@@ -88,9 +87,9 @@ final class TestMessages {
" \"sourceName\": \"val12\",\n" +
" \"sourceId\": \"val13\",\n" +
" \"reportingEntityName\": \"val14\"\n" +
- "}");
+ "}"));
- static final JSONObject INVALID_MESSAGE_PARAMS_3 = new JSONObject(
+ static final Optional<JSONObject> INVALID_MESSAGE_PARAMS_3 = Optional.ofNullable(new JSONObject(
"{\n" +
" \"pnfSerialNumber\": \"val1\",\n" +
" \"pnfOamIpv4Address\": \"val3\",\n" +
@@ -104,7 +103,8 @@ final class TestMessages {
" \"sourceName\": \"val12\",\n" +
" \"sourceId\": \"val13\",\n" +
" \"reportingEntityName\": \"val14\"\n" +
- "}");
+ "}"));
+
private TestMessages() {
}