summaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org
diff options
context:
space:
mode:
authorSara Weiss <sara.weiss@intl.att.com>2019-10-06 08:59:07 +0300
committerSara Weiss <sara.weiss@intl.att.com>2019-10-06 11:08:31 +0300
commit54b4b3366fb23feae188bbe0a9a7b49eebea2692 (patch)
treed562b0634b6e1b97c0e4fefbd76dbd27e33355c0 /vid-automation/src/main/java/org
parent39b185a11e5978991eedd4763415eed51b7c9462 (diff)
change management integration with reduce flag
Issue-ID: VID-596 Signed-off-by: Sara Weiss <sara.weiss@intl.att.com> Change-Id: I3b9df53ae4b58b3abe672b3871b75a68fda79fc9 Signed-off-by: Sara Weiss <sara.weiss@intl.att.com>
Diffstat (limited to 'vid-automation/src/main/java/org')
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java
index 0808eaba6..575a8888e 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java
@@ -1,5 +1,6 @@
package org.onap.simulator.presetGenerator.presets.aai;
+import org.apache.commons.lang3.StringUtils;
import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset;
import org.springframework.http.HttpMethod;
@@ -9,21 +10,46 @@ public class PresetAAIGetTenants extends BaseAAIPreset {
private final String subscriberId;
private final String serviceType;
private String responseBody;
+ private static final String responseBodyResourceDefault = "presets_templates/PresetAAIGetTenants.json";
public PresetAAIGetTenants(String subscriberId, String serviceType, String responseBodyResource) {
this.subscriberId = subscriberId;
this.serviceType = serviceType;
- this.responseBody = loadResourceAsString(responseBodyResource);
+ this.responseBody = loadResponseBody(responseBodyResource);
}
public PresetAAIGetTenants() {
this(
- "e433710f-9217-458d-a79d-1c7aff376d89",
- "TYLER SILVIA",
- "presets_templates/PresetAAIGetTenants.json"
+ "e433710f-9217-458d-a79d-1c7aff376d89",
+ "TYLER SILVIA",
+ responseBodyResourceDefault
);
}
+ public PresetAAIGetTenants(String subscriberId, String serviceType) {
+ this(
+ subscriberId,
+ serviceType,
+ responseBodyResourceDefault
+ );
+ }
+
+ private String loadResponseBody(String responseBodyResource) {
+
+ String responseBody = loadResourceAsString(responseBodyResource);
+
+ if (StringUtils.equals(responseBodyResource, responseBodyResourceDefault)) {
+ responseBody = setServiceTypeInTheResponse(responseBody);
+ }
+
+ return responseBody;
+ }
+
+ private String setServiceTypeInTheResponse(String resourceBodyAsString) {
+ final String serviceTypePlaceHolder = "<service-type>";
+ return resourceBodyAsString.replace(serviceTypePlaceHolder, this.serviceType);
+ }
+
@Override
public Object getResponseBody() {
return responseBody;
@@ -38,6 +64,4 @@ public class PresetAAIGetTenants extends BaseAAIPreset {
public String getReqPath() {
return getRootPath() + "/business/customers/customer/" + this.subscriberId + "/service-subscriptions/service-subscription/" + this.serviceType;
}
-
-
}