summaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vid-automation/src/main')
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIGetTenants.java36
-rw-r--r--vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java10
-rw-r--r--vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants.json2
-rw-r--r--vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json128
4 files changed, 37 insertions, 139 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);
}
diff --git a/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants.json b/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants.json
index 039d2d558..c3eca2e0a 100644
--- a/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants.json
+++ b/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants.json
@@ -1,5 +1,5 @@
{
- "service-type": "TYLER SILVIA",
+ "service-type": "<service-type>",
"resource-version": "1494001841964",
"relationship-list": {
"relationship": [
diff --git a/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json b/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json
deleted file mode 100644
index 8cd6d19a7..000000000
--- a/vid-automation/src/main/resources/presets_templates/PresetAAIGetTenants_service_type_vWINIFRED.json
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "service-type": "vWINIFRED",
- "resource-version": "1494001841964",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "tenant",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/AAIAIC25/tenants/tenant/092eb9e8e4b7412e8787dd091bc58e86",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "irma-aic"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "AAIAIC25"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "092eb9e8e4b7412e8787dd091bc58e86"
- }
- ],
- "related-to-property": [
- {
- "property-key": "tenant.tenant-name",
- "property-value": "USP-SIP-IC-24335-T-01"
- }
- ]
- },
- {
- "related-to": "tenant",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/bae71557c5bb4d5aac6743a4e5f1d054",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "irma-aic"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "hvf6"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "bae71557c5bb4d5aac6743a4e5f1d054"
- }
- ],
- "related-to-property": [
- {
- "property-key": "tenant.tenant-name",
- "property-value": "AIN Web Tool-15-D-testalexandria"
- }
- ]
- },
- {
- "related-to": "tenant",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/229bcdc6eaeb4ca59d55221141d01f8e",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "irma-aic"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "hvf6"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "229bcdc6eaeb4ca59d55221141d01f8e"
- }
- ],
- "related-to-property": [
- {
- "property-key": "tenant.tenant-name",
- "property-value": "AIN Web Tool-15-D-STTest2"
- }
- ]
- },
- {
- "related-to": "tenant",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/cb42a77ff45b48a8b8deb83bb64acc74",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "irma-aic"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "hvf6"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "cb42a77ff45b48a8b8deb83bb64acc74"
- }
- ],
- "related-to-property": [
- {
- "property-key": "tenant.tenant-name",
- "property-value": "ro-T11"
- }
- ]
- },
- {
- "related-to": "tenant",
- "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/hvf6/tenants/tenant/fa45ca53c80b492fa8be5477cd84fc2b",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "irma-aic"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "hvf6"
- },
- {
- "relationship-key": "tenant.tenant-id",
- "relationship-value": "fa45ca53c80b492fa8be5477cd84fc2b"
- }
- ],
- "related-to-property": [
- {
- "property-key": "tenant.tenant-name",
- "property-value": "ro-T112"
- }
- ]
- }
- ]
- }
-}