aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BasePreset.java
blob: 662677e8339883b6d50569eb3168262b9aae5966 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package org.onap.simulator.presetGenerator.presets.BasePresets;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.onap.simulator.presetGenerator.presets.model.RegistrationRequest;
import org.springframework.http.HttpMethod;

/**
 * Created by itzikliderman on 13/12/2017.
 */
public abstract class BasePreset {

    public RegistrationRequest generateScenario() {
        Map<String, String> responseHeaders = new HashMap<>();
        responseHeaders.put("Content-Type", getContentType());

        return new RegistrationRequest(
                new RegistrationRequest.SimulatorRequest(getReqMethod(), getReqPath(), getQueryParams(), getRequestBody(), isStrictMatch(), getRequestHeaders()),
                new RegistrationRequest.SimulatorResponse(getResponseCode(), responseHeaders, getResponseBody(), getFile()),
                new RegistrationRequest.Misc(getNumberOfTimes(), getReplace()));
    }

    public Object getResponseBody() { return  null; };

    public String getContentType() {
        return "application/json";
    }

    public String getFile() {
        return null;
    }

    public int getResponseCode() { return 200; }

    public abstract HttpMethod getReqMethod();

    public abstract String getReqPath();

    public Object getRequestBody() {
        return null;
    }

    public boolean isStrictMatch() {
        return false;
    }

    public Map<String, List> getQueryParams() { return null; }

    protected abstract String getRootPath();

    protected Integer getNumberOfTimes() {return null;}

    protected boolean getReplace()  {return true;}

    public Map<String,String> getRequestHeaders() {
        return new HashMap<>();
    }
}