diff options
author | Sara Weiss <sara.weiss@intl.att.com> | 2019-10-06 08:59:07 +0300 |
---|---|---|
committer | Sara Weiss <sara.weiss@intl.att.com> | 2019-10-06 11:08:31 +0300 |
commit | 54b4b3366fb23feae188bbe0a9a7b49eebea2692 (patch) | |
tree | d562b0634b6e1b97c0e4fefbd76dbd27e33355c0 /vid-automation/src/main/java | |
parent | 39b185a11e5978991eedd4763415eed51b7c9462 (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')
2 files changed, 36 insertions, 10 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; } - - } diff --git a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java index 7c577cabf..d9c771b6f 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java @@ -23,6 +23,7 @@ import com.aventstack.extentreports.Status; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.primitives.Ints; + import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; @@ -33,6 +34,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; + import net.javacrumbs.jsonunit.core.Option; import org.json.JSONException; import org.junit.Assert; @@ -223,7 +225,7 @@ public class ChangeManagementTest extends VidBaseTestCase { , "changeManagement/mso_get_change_managements_scaleout.json" ); SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), APPEND); - if(FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG.isActive()){ + if (FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG.isActive()) { String AAI_VNFS_FOR_CHANGE_MANAGEMENT_JSON_BY_PARAMS = "registration_to_simulator/changeManagement/get_vnf_data_by_globalid_and_service_type_with_modelVer.json"; String globalCustomerId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; String serviceType = "vRichardson"; @@ -246,9 +248,9 @@ public class ChangeManagementTest extends VidBaseTestCase { if (Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH.isActive()) { SimulatorApi.registerExpectationFromPreset(new PresetAAIGetTenants( - VNF_DATA_WITH_IN_PLACE.subscriberId, - VNF_DATA_WITH_IN_PLACE.serviceType, - "presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json"), SimulatorApi.RegistrationStrategy.APPEND); + VNF_DATA_WITH_IN_PLACE.subscriberId, + VNF_DATA_WITH_IN_PLACE.serviceType), + SimulatorApi.RegistrationStrategy.APPEND); } |