blob: a979bae532c5545fffa967afa25e6f507c476e83 (
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
|
package org.onap.simulator.presetGenerator.presets.aai;
import com.google.common.collect.ImmutableMap;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
import org.springframework.http.HttpMethod;
public abstract class PresetBaseAAICustomQuery extends BaseAAIPreset {
private final String requestBodyStart;
private final String requestBodyQuery;
private final FORMAT format;
public enum FORMAT {
RESOURCE, SIMPLE;
public String value() {
return this.name().toLowerCase();
}
}
public PresetBaseAAICustomQuery(FORMAT format, String requestBodyStart, String requestBodyQuery) {
this.format = format;
this.requestBodyStart = requestBodyStart;
this.requestBodyQuery = requestBodyQuery;
}
@Override
public HttpMethod getReqMethod() {
return HttpMethod.PUT;
}
@Override
public String getReqPath() {
return getRootPath() + "/query";
}
@Override
public Map<String, List> getQueryParams() {
return ImmutableMap.of(
"format", Collections.singletonList(format.value())
);
}
@Override
public Object getRequestBody() {
return ImmutableMap.of(
"start", new String[] {requestBodyStart},
"query", requestBodyQuery
);
}
}
|