aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-automation/src/main/java')
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java
new file mode 100644
index 000000000..a979bae53
--- /dev/null
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java
@@ -0,0 +1,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
+ );
+ }
+
+}