Preparing simulator for INT-607
[integration.git] / test / mocks / pnfsimulator / src / main / java / org / onap / pnfsimulator / message / MessageProvider.java
index 94f5fc1..b21eed4 100644 (file)
@@ -1,27 +1,8 @@
-/*-
- * ============LICENSE_START=======================================================
- * org.onap.integration
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
 package org.onap.pnfsimulator.message;
 
 import static org.onap.pnfsimulator.message.MessageConstants.COMMON_EVENT_HEADER;
 import static org.onap.pnfsimulator.message.MessageConstants.DOMAIN;
+import static org.onap.pnfsimulator.message.MessageConstants.EVENT;
 import static org.onap.pnfsimulator.message.MessageConstants.EVENT_ID;
 import static org.onap.pnfsimulator.message.MessageConstants.EVENT_TYPE;
 import static org.onap.pnfsimulator.message.MessageConstants.INTERNAL_HEADER_FIELDS;
@@ -35,29 +16,20 @@ import static org.onap.pnfsimulator.message.MessageConstants.PRIORITY;
 import static org.onap.pnfsimulator.message.MessageConstants.SEQUENCE;
 import static org.onap.pnfsimulator.message.MessageConstants.START_EPOCH_MICROSEC;
 import static org.onap.pnfsimulator.message.MessageConstants.VERSION;
-import static org.onap.pnfsimulator.message.MessageConstants.EVENT;
 
 import java.util.Map;
 import java.util.UUID;
-
-import com.google.common.base.Preconditions;
 import org.json.JSONObject;
 
 public class MessageProvider {
 
-    private static MessageProvider instance;
+    public JSONObject createMessage(JSONObject params) {
 
-    public static MessageProvider getInstance() {
-        if (instance == null) {
-            instance = new MessageProvider();
+        if (params == null) {
+            throw new IllegalArgumentException("Params object cannot be null");
         }
-        return instance;
-    }
-
-    public JSONObject createMessage(JSONObject params) {
 
-        Preconditions.checkArgument(params != null, "Params object cannot be null");
-         Map<String, Object> paramsMap = params.toMap();
+        Map<String, Object> paramsMap = params.toMap();
         JSONObject root = new JSONObject();
         JSONObject commonEventHeader = generateConstantCommonEventHeader();
         JSONObject otherFields = generateConstantOtherFields();
@@ -74,7 +46,6 @@ public class MessageProvider {
         JSONObject event = new JSONObject();
         event.put(COMMON_EVENT_HEADER, commonEventHeader);
         event.put(OTHER_FIELDS, otherFields);
-
         root.put(EVENT, event);
         return root;
     }
@@ -93,7 +64,6 @@ public class MessageProvider {
         commonEventHeader.put(START_EPOCH_MICROSEC, timestamp);
         commonEventHeader.put(INTERNAL_HEADER_FIELDS, new JSONObject());
         commonEventHeader.put(VERSION, 3);
-        commonEventHeader.put("functionalRole", "test_rola");
 
         return commonEventHeader;
     }