1 package org.onap.simulator.presetGenerator.presets.BasePresets;
3 import java.util.HashMap;
6 import org.onap.simulator.presetGenerator.presets.model.RegistrationRequest;
7 import org.springframework.http.HttpMethod;
10 * Created by itzikliderman on 13/12/2017.
12 public abstract class BasePreset {
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}";
16 public RegistrationRequest generateScenario() {
17 Map<String, String> responseHeaders = new HashMap<>();
18 responseHeaders.put("Content-Type", getContentType());
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()));
26 public Object getResponseBody() { return null; };
28 public String getContentType() {
29 return "application/json";
32 public String getFile() {
36 public int getResponseCode() { return 200; }
38 public abstract HttpMethod getReqMethod();
40 public abstract String getReqPath();
42 public Object getRequestBody() {
46 public boolean isStrictMatch() {
50 public Map<String, List> getQueryParams() { return null; }
52 protected abstract String getRootPath();
54 protected Integer getNumberOfTimes() {return null;}
56 protected boolean getReplace() {return true;}
58 public Map<String,String> getRequestHeaders() {
59 return new HashMap<>();