662677e8339883b6d50569eb3168262b9aae5966
[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 RegistrationRequest generateScenario() {
15         Map<String, String> responseHeaders = new HashMap<>();
16         responseHeaders.put("Content-Type", getContentType());
17
18         return new RegistrationRequest(
19                 new RegistrationRequest.SimulatorRequest(getReqMethod(), getReqPath(), getQueryParams(), getRequestBody(), isStrictMatch(), getRequestHeaders()),
20                 new RegistrationRequest.SimulatorResponse(getResponseCode(), responseHeaders, getResponseBody(), getFile()),
21                 new RegistrationRequest.Misc(getNumberOfTimes(), getReplace()));
22     }
23
24     public Object getResponseBody() { return  null; };
25
26     public String getContentType() {
27         return "application/json";
28     }
29
30     public String getFile() {
31         return null;
32     }
33
34     public int getResponseCode() { return 200; }
35
36     public abstract HttpMethod getReqMethod();
37
38     public abstract String getReqPath();
39
40     public Object getRequestBody() {
41         return null;
42     }
43
44     public boolean isStrictMatch() {
45         return false;
46     }
47
48     public Map<String, List> getQueryParams() { return null; }
49
50     protected abstract String getRootPath();
51
52     protected Integer getNumberOfTimes() {return null;}
53
54     protected boolean getReplace()  {return true;}
55
56     public Map<String,String> getRequestHeaders() {
57         return new HashMap<>();
58     }
59 }