aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aaf/AAFGetUrlServicePreset.java
blob: c3914660e4ac14de6ea7efbb1c2f134aaa826a20 (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
package org.onap.simulator.presetGenerator.presets.aaf;

import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
import org.springframework.http.HttpMethod;
import vid.automation.test.services.SimulatorApi;

public class AAFGetUrlServicePreset extends BasePreset {
    @Override
    public HttpMethod getReqMethod() {
        return HttpMethod.GET;
    }

    @Override
    public String getReqPath() {
        return "/locate/" + regexAafServerName() + ":2.0";
    }

    private String regexAafServerName() {
        return "([a-z-]+\\.)*[a-z-]+";
    }

    @Override
    protected String getRootPath() {
        return "";
    }

    @Override
    public Object getResponseBody() {
        return ""
            + "{"
            + "  \"endpoint\": [{"
            + "      \"name\": \"aaf-service\","
            + "      \"major\": 2,"
            + "      \"minor\": 0,"
            + "      \"patch\": 19,"
            + "      \"pkg\": 21,"
            + "      \"latitude\": 38.627346,"
            + "      \"longitude\": -90.19377,"
            + "      \"protocol\": \"http\","
            + "      \"subprotocol\": [],"
            + "      \"port\": " + SimulatorApi.getSimulatedResponsesPort() + ","
            + "      \"hostname\": \"" + SimulatorApi.getSimulatorHost() + "\""
            + "    }"
            + "  ]"
            + "}"; 
    }
}