diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-09-22 20:04:28 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-09-23 12:48:51 +0300 |
commit | 9a2cd4170c33326dc6a0829675fa4cef231efdd9 (patch) | |
tree | 06b2ec4c6d9722e1a1ebf52f60cd632f35f40ebb /vid-automation | |
parent | 5a824bbfbe95afd3b1fbaae8c029a8b4c5ad5401 (diff) |
Change-management: provide and use scheduler's fields through vm.scheduleWorkflow()
In addition, show error message when no Portal-frame. Use the dumped
data to revive ChangeManagementTest tests by capturing the error's
payload.
Issue-ID: VID-397
Change-Id: I978bf537c43b0e3933e82c761c60cd067ab2cf27
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-automation')
-rw-r--r-- | vid-automation/src/main/java/vid/automation/test/test/ChangeManagementTest.java | 79 |
1 files changed, 76 insertions, 3 deletions
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 4da713a74..ed0180dd9 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 @@ -1,11 +1,14 @@ package vid.automation.test.test; +import static java.util.Collections.emptyMap; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.everyItem; import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.collection.IsEmptyCollection.empty; @@ -15,6 +18,7 @@ import static org.onap.vid.api.BaseApiTest.getResourceAsString; import static vid.automation.test.infra.Features.FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.primitives.Ints; import java.sql.Connection; @@ -23,8 +27,10 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.Arrays; 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; import org.onap.sdc.ci.tests.datatypes.UserCredentials; @@ -60,6 +66,7 @@ import vid.automation.test.utils.DB_CONFIG; public class ChangeManagementTest extends VidBaseTestCase { public static final String SCHEDULED_ID = "0b87fe60-50b0-4bac-a0a7-49e951b0ba9e"; + private final String SCHEDULE_ERROR_PREFIX = "Portal not found. Cannot send: "; @Test public void testLeftPanelChangeManagementButton() { @@ -484,10 +491,33 @@ public class ChangeManagementTest extends VidBaseTestCase { }; } - // Deleted testVidToMsoCallbackDataWithInPlaceSWUpdate test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid. + @Test(dataProvider = "dataForUpdateWorkflowPartialWithInPlace") + public void testVidToMsoCallbackDataWithInPlaceSWUpdate(String operationsTimeout, String existingSwVersion, String newSwVersion) { + openAndFill1stScreenWithWorkflowVNFInPlaceSoftwareUpdate(); + fillVNFInPlace3Fields(operationsTimeout, existingSwVersion, newSwVersion); + + assertThatVidToPortalCallbackDataIsOk(VNF_DATA_WITH_IN_PLACE.workflowName, ImmutableMap.of( + "existingSoftwareVersion", existingSwVersion, + "newSoftwareVersion", newSwVersion, + "operationTimeout", operationsTimeout + )); + } + + @Test + public void testUploadConfigUpdateFile() { + String fileName = "configuration_file.csv"; + updateConfigFile(fileName); + Assert.assertEquals(Get.byId(Constants.ChangeManagement.newModalConfigUpdateInputId + "-label").getText(), fileName); + Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled()); + assertThatVidToPortalCallbackDataIsOk("VNF Config Update", ImmutableMap.of( + "configUpdateFile", + "{\"request-parameters\":{\"vm\":[{\"vnfc\":[" + + "{\"vnfc-name\":\"ibcx0001vm001dbg001\",\"vnfc-function-code\":\"dbg\"}],\"vm-name\":\"ibcx0001vm001\"}," + + "{\"vnfc\":[{\"vnfc-name\":\"ibcx0001vm002dbg001\"}],\"vm-name\":\"ibcx0001vm002\"}]},\"configuration-parameters\":{\"node0_hostname\":\"dbtx0001vm001\"}}" + )); + } - // Deleted testUploadConfigUpdateFile test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid. @FeatureTogglingTest(value = Features.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH, flagActive = false) @Test public void testUploadConfigUpdateNonCsvFile() { @@ -516,7 +546,14 @@ public class ChangeManagementTest extends VidBaseTestCase { }; } - // Deleted testVidToMsoCallbackData test. It was using assertThatVidToMsoCallbackDataIsOk which is no longer valid. + @Test + public void testVidToMsoCallbackData() { + String workflow = "Replace"; + + openAndFill1stScreen(VNF_DATA_WITH_IN_PLACE.vnfName, VNF_DATA_WITH_IN_PLACE.vnfTargetVersion, workflow); + + assertThatVidToPortalCallbackDataIsOk(workflow, emptyMap()); + } private void assertThatVidToMsoCallbackDataIsOk(String workflow, String payload) { Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled()); @@ -537,6 +574,42 @@ public class ChangeManagementTest extends VidBaseTestCase { Click.byId(Constants.generalCancelButtonId); } + private void assertThatVidToPortalCallbackDataIsOk(String workflowName, Map<String, String> workflowParams) { + Assert.assertTrue(Get.byId(Constants.generalSubmitButtonId).isEnabled()); + Click.byId(Constants.generalSubmitButtonId); + + String errorMessage = GeneralUIUtils.getWebElementByTestID("error-message", 2).getText(); + + String modelInvariantId = "72e465fe-71b1-4e7b-b5ed-9496118ff7a8"; + String vnfInstanceId = "8e5e3ba1-3fe6-4d86-966e-f9f03dab4855"; + + assertThat(errorMessage, startsWith(SCHEDULE_ERROR_PREFIX)); + assertThat(errorMessage.replace(SCHEDULE_ERROR_PREFIX, ""), jsonEquals( + ImmutableMap.of( + "widgetName", "Portal-Common-Scheduler", + "widgetParameter", "", + "widgetData", ImmutableMap.builder() + .put("vnfNames", ImmutableList.of(ImmutableMap.of( + "id", vnfInstanceId, + "invariant-id", modelInvariantId + ))) + .put("workflowParameters", emptyMap()) + .put("subscriberId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + .put("fromVNFVersion", "" + "76e908e0-5201-44d2-a3e2-9e6128d05820" + "") + .put("workflow", "" + workflowName + "") + .put("policyYN", "Y") + .put("sniroYN", "Y") + .put("testApi", "VNF_API") + .put("vnfType", "vMobileDNS") + .putAll(workflowParams) + .build() + ) + ).when(Option.IGNORING_EXTRA_FIELDS)); + + + Click.byId(Constants.generalCancelButtonId); + } + @Test(enabled = false) public void testUpdateWorkflowNow() { |