db41b951888de45936d07959a4d1d61c7349f34a
[vid.git] / vid-automation / src / main / java / org / onap / simulator / presetGenerator / presets / aai / PresetAAIGetSubDetailsGet.java
1 package org.onap.simulator.presetGenerator.presets.aai;
2
3 import static vid.automation.test.utils.ReadFile.loadResourceAsString;
4
5 import com.google.common.collect.ImmutableMap;
6 import java.util.Collections;
7 import java.util.List;
8 import java.util.Map;
9 import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
10 import org.springframework.http.HttpMethod;
11
12 public class PresetAAIGetSubDetailsGet extends BaseAAIPreset {
13     private String subscriberId;
14     private String responseBody;
15
16     private static final String baseResponseBody = loadResourceAsString("presets_templates/PresetAAIGetSubDetailsGet.json");
17     private static final String GLOBAL_CUSTOMER_ID = "GLOBAL_CUSTOMER_ID";
18     private static final String ORCH_STATUS = "<ORCH_STATUS>";
19
20     public PresetAAIGetSubDetailsGet(String subscriberId) {
21         this.subscriberId = subscriberId == null ? "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" : subscriberId;
22         this.responseBody = baseResponseBody.replace(GLOBAL_CUSTOMER_ID, this.subscriberId);
23     }
24
25     public PresetAAIGetSubDetailsGet(String subscriberId, String orchStatus) {
26         this.subscriberId = subscriberId == null ? "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" : subscriberId;
27         this.responseBody = baseResponseBody.replace(GLOBAL_CUSTOMER_ID, this.subscriberId);
28         this.responseBody = this.responseBody.replace("\"subscriber-name\":\"Emanuel\"", "\"subscriber-name\":\"SILVIA ROBBINS\"");
29         this.responseBody = this.responseBody.replaceAll(ORCH_STATUS, orchStatus);
30     }
31
32     @Override
33     public Map<String, List> getQueryParams() {
34         return ImmutableMap.of("depth",  Collections.singletonList("2"));
35     }
36
37     @Override
38     public Object getResponseBody() {
39         return responseBody;
40     }
41
42     @Override
43     public HttpMethod getReqMethod() {
44         return HttpMethod.GET;
45     }
46
47     @Override
48     public String getReqPath() {
49         return getRootPath() + "/business/customers/customer/" + getSubscriberId();
50     }
51
52     public String getSubscriberId() {
53         return subscriberId;
54     }
55 }