aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/pnfsimulator/src/main
diff options
context:
space:
mode:
authormicdzied <michal.1.dziedzic@nokia.com>2018-08-17 09:58:00 +0200
committermicdzied <michal.1.dziedzic@nokia.com>2018-08-20 13:16:22 +0200
commitb22e45d0fdaae3d35e0e0be3b452ebd2e53ed782 (patch)
tree038589ee2b89e392f323211cd8eadc241af9abc4 /test/mocks/pnfsimulator/src/main
parent67de9d49b88e5801afd3f0bf2a62b3495720864c (diff)
update according to new schema
Change-Id: I7fbe1b765be33e3c7734786cd77625360a0e1f92 Issue-ID: INT-628 Signed-off-by: micdzied <michal.1.dziedzic@nokia.com>
Diffstat (limited to 'test/mocks/pnfsimulator/src/main')
-rw-r--r--test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java13
-rw-r--r--test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java16
-rw-r--r--test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java9
3 files changed, 21 insertions, 17 deletions
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
index 0d158534d..ca639173f 100644
--- a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
+++ b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/JSONObjectFactory.java
@@ -18,15 +18,16 @@ final class JSONObjectFactory {
commonEventHeader.put(START_EPOCH_MICROSEC, timestamp);
commonEventHeader.put(INTERNAL_HEADER_FIELDS, new JSONObject());
commonEventHeader.put(VERSION, VERSION_NUMBER);
+ commonEventHeader.put(VES_EVENT_LISTENER_VERSION, VES_EVENT_LISTENER_VERSION_NUMBER);
return commonEventHeader;
}
- static JSONObject generateConstantOtherFields() {
- JSONObject otherFields = new JSONObject();
- otherFields.put(OTHER_FIELDS_VERSION, OTHER_FIELDS_VERSION_VALUE);
- otherFields.put(PNF_LAST_SERVICE_DATE, System.currentTimeMillis());
- otherFields.put(PNF_MANUFACTURE_DATE, System.currentTimeMillis());
- return otherFields;
+ static JSONObject generatePnfRegistrationFields() {
+ JSONObject pnfRegistrationFields = new JSONObject();
+ pnfRegistrationFields.put(PNF_REGISTRATION_FIELDS_VERSION, PNF_REGISTRATION_FIELDS_VERSION_VALUE);
+ pnfRegistrationFields.put(PNF_LAST_SERVICE_DATE, String.valueOf(System.currentTimeMillis()));
+ pnfRegistrationFields.put(PNF_MANUFACTURE_DATE, String.valueOf(System.currentTimeMillis()));
+ return pnfRegistrationFields;
}
static String generateEventId() {
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java
index fd47520f4..459469a34 100644
--- a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java
+++ b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageConstants.java
@@ -14,9 +14,10 @@ public final class MessageConstants {
static final String START_EPOCH_MICROSEC = "startEpochMicrosec";
static final String INTERNAL_HEADER_FIELDS = "internalHeaderFields";
static final String VERSION = "version";
- static final String OTHER_FIELDS_VERSION = "otherFieldsVersion";
- static final String PNF_LAST_SERVICE_DATE = "pnfLastServiceDate";
- static final String PNF_MANUFACTURE_DATE = "pnfManufactureDate";
+ static final String PNF_REGISTRATION_FIELDS_VERSION = "pnfRegistrationFieldsVersion";
+ static final String PNF_LAST_SERVICE_DATE = "lastServiceDate";
+ static final String PNF_MANUFACTURE_DATE = "manufactureDate";
+ static final String VES_EVENT_LISTENER_VERSION = "vesEventListenerVersion";
// mandatory used in json file, but not in java logic
//public static final String PNF_OAM_IPV4_ADDRESS = "pnfOamIpv4Address";
@@ -26,18 +27,19 @@ public final class MessageConstants {
public static final String VES_SERVER_URL = "vesServerUrl";
public static final String TEST_DURATION = "testDuration";
public static final String MESSAGE_INTERVAL = "messageInterval";
- static final String PNF_PREFIX = "pnf";
+ static final String PNF_PREFIX = "pnf_";
static final String COMMON_EVENT_HEADER = "commonEventHeader";
- static final String OTHER_FIELDS = "otherFields";
+ static final String PNF_REGISTRATION_FIELDS = "pnfRegistrationFields";
//===============================================================
//constant values
static final String PNF_REGISTRATION ="pnfRegistration";
static final String PRIORITY_NORMAL = "Normal";
- static final float VERSION_NUMBER = 3.0f;
+ static final String VERSION_NUMBER = "4.0.1";
+ static final String VES_EVENT_LISTENER_VERSION_NUMBER = "7.0.1";
+ static final String PNF_REGISTRATION_FIELDS_VERSION_VALUE = "2.0";
static final int SEQUENCE_NUMBER = 0;
- static final int OTHER_FIELDS_VERSION_VALUE = 1;
private MessageConstants() {
}
diff --git a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
index 0c0b4b681..8c7ec91dd 100644
--- a/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
+++ b/test/mocks/pnfsimulator/src/main/java/org/onap/pnfsimulator/message/MessageProvider.java
@@ -2,8 +2,9 @@ package org.onap.pnfsimulator.message;
import static org.onap.pnfsimulator.message.MessageConstants.COMMON_EVENT_HEADER;
import static org.onap.pnfsimulator.message.MessageConstants.EVENT;
-import static org.onap.pnfsimulator.message.MessageConstants.OTHER_FIELDS;
import static org.onap.pnfsimulator.message.MessageConstants.PNF_PREFIX;
+import static org.onap.pnfsimulator.message.MessageConstants.PNF_REGISTRATION_FIELDS;
+
import java.util.Map;
import org.json.JSONObject;
@@ -18,12 +19,12 @@ public class MessageProvider {
Map<String, Object> paramsMap = params.toMap();
JSONObject root = new JSONObject();
JSONObject commonEventHeader = JSONObjectFactory.generateConstantCommonEventHeader();
- JSONObject otherFields = JSONObjectFactory.generateConstantOtherFields();
+ JSONObject pnfRegistrationFields = JSONObjectFactory.generatePnfRegistrationFields();
paramsMap.forEach((key, value) -> {
if (key.startsWith(PNF_PREFIX)) {
- otherFields.put(key, value);
+ pnfRegistrationFields.put(key.substring(PNF_PREFIX.length()), value);
} else {
commonEventHeader.put(key, value);
}
@@ -31,7 +32,7 @@ public class MessageProvider {
JSONObject event = new JSONObject();
event.put(COMMON_EVENT_HEADER, commonEventHeader);
- event.put(OTHER_FIELDS, otherFields);
+ event.put(PNF_REGISTRATION_FIELDS, pnfRegistrationFields);
root.put(EVENT, event);
return root;
}