aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/pnfsimulator/src/main/java
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-08-20 15:58:27 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-20 15:58:27 +0000
commit0dd554bbe4cde92dff217fd4220007cd4b32ff04 (patch)
tree90ccfb477de34f14c27db6790d92c99186ae19ca /test/mocks/pnfsimulator/src/main/java
parentb0fdf2ab78735a23c6779f84658bbde5840f9601 (diff)
parentb22e45d0fdaae3d35e0e0be3b452ebd2e53ed782 (diff)
Merge "update according to new schema"
Diffstat (limited to 'test/mocks/pnfsimulator/src/main/java')
-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 1547f9e24..fd2b95af1 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
@@ -38,15 +38,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 18a753fb6..7861d5f9c 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
@@ -34,9 +34,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";
@@ -46,18 +47,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 e3b2b9cf0..7c3bf9ef8 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
@@ -22,8 +22,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;
@@ -38,12 +39,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);
}
@@ -51,7 +52,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;
}