send unqiue request ids to MSO in async instantiation
[vid.git] / vid-automation / src / main / java / org / onap / simulator / presetGenerator / presets / BasePresets / BasePreset.java
1 package org.onap.simulator.presetGenerator.presets.BasePresets;
2
3 import java.util.HashMap;
4 import java.util.List;
5 import java.util.Map;
6 import org.onap.simulator.presetGenerator.presets.model.RegistrationRequest;
7 import org.springframework.http.HttpMethod;
8
9 /**
10  * Created by itzikliderman on 13/12/2017.
11  */
12 public abstract class BasePreset {
13
14     public static final String UUID_REGEX = "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}";
15
16     public RegistrationRequest generateScenario() {
17         Map<String, String> responseHeaders = new HashMap<>();
18         responseHeaders.put("Content-Type", getContentType());
19
20         return new RegistrationRequest(
21                 new RegistrationRequest.SimulatorRequest(getReqMethod(), getReqPath(), getQueryParams(), getRequestBody(), isStrictMatch(), getRequestHeaders()),
22                 new RegistrationRequest.SimulatorResponse(getResponseCode(), responseHeaders, getResponseBody(), getFile()),
23                 new RegistrationRequest.Misc(getNumberOfTimes(), getReplace()));
24     }
25
26     public Object getResponseBody() { return  null; };
27
28     public String getContentType() {
29         return "application/json";
30     }
31
32     public String getFile() {
33         return null;
34     }
35
36     public int getResponseCode() { return 200; }
37
38     public abstract HttpMethod getReqMethod();
39
40     public abstract String getReqPath();
41
42     public Object getRequestBody() {
43         return null;
44     }
45
46     public boolean isStrictMatch() {
47         return false;
48     }
49
50     public Map<String, List> getQueryParams() { return null; }
51
52     protected abstract String getRootPath();
53
54     protected Integer getNumberOfTimes() {return null;}
55
56     protected boolean getReplace()  {return true;}
57
58     public Map<String,String> getRequestHeaders() {
59         return new HashMap<>();
60     }
61 }