diff options
author | Amichai Hemli <ah0398@intl.att.com> | 2019-08-29 15:37:50 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-29 15:37:50 +0000 |
commit | 3d175558e53176c4e7dbea9475ea4b8fbfeb249a (patch) | |
tree | 0340ccd5ccf11072da4f01f511973d21f5972abe | |
parent | bdd1d2c30961d6b7e3e8777e3659dce7d32da61f (diff) | |
parent | 955722b6ddf8ddeab3d1904f5514a5be9226a59f (diff) |
Merge "edit of macro services in new view edit screen"
8 files changed, 210 insertions, 152 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java index c9c2649ae..d35c8df9c 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/parser/VidNotionsBuilder.java @@ -170,16 +170,15 @@ public class VidNotionsBuilder { return VidNotions.InstantiationUI.SERVICE_WITH_VNF_GROUPING; } - if (featureManager.isActive(Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI) && - featureManager.isActive(Features.FLAG_1908_RESUME_MACRO_SERVICE) && - isServiceWithCollectionResource(serviceModel)) { - return VidNotions.InstantiationUI.SERVICE_WITH_COLLECTION_RESOURCE; + if (featureManager.isActive(Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT) && + isMacro(serviceModel) && + !isTransportService(csarHelper) && + //till new view/edit would support fabric service activation + !hasFabricConfiguration(csarHelper)) { + return VidNotions.InstantiationUI.MACRO_SERVICE; } if (featureManager.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)) { - if (isMacro(serviceModel) && !isMacroExcludedFromAsyncFlow(serviceModel)) { - return VidNotions.InstantiationUI.MACRO_SERVICE; - } VidNotions.InstantiationUI instantiationUISuggestion = suggestInstantiationUI(csarHelper, serviceModel); if (instantiationUISuggestion!=VidNotions.InstantiationUI.LEGACY) { return instantiationUISuggestion; diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java index bc3c6c8ec..f8eaabfda 100644 --- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java +++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java @@ -70,6 +70,7 @@ public enum Features implements Feature { FLAG_1908_RELEASE_TENANT_ISOLATION, FLAG_1908_A_LA_CARTE_VNF_NEW_INSTANTIATION_UI, FLAG_FLASH_REPLACE_VF_MODULE, + FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT, FLAG_PNP_INSTANTIATION, FLAG_HANDLE_SO_WORKFLOWS, FLAG_CREATE_ERROR_REPORTS diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java index edaf7125f..edf7d0862 100644 --- a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java @@ -20,8 +20,31 @@ package org.onap.vid.asdc.parser; +import static java.util.Collections.emptyList; +import static java.util.Collections.emptyMap; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.onap.vid.model.VidNotions.InstantiationType; +import static org.onap.vid.model.VidNotions.InstantiationUI; +import static org.onap.vid.model.VidNotions.ModelCategory; +import static org.testng.AssertJUnit.assertEquals; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.function.BiConsumer; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; import org.mockito.InjectMocks; @@ -33,7 +56,12 @@ import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.elements.Metadata; -import org.onap.vid.model.*; +import org.onap.vid.model.CR; +import org.onap.vid.model.Network; +import org.onap.vid.model.Node; +import org.onap.vid.model.Service; +import org.onap.vid.model.ServiceModel; +import org.onap.vid.model.VidNotions; import org.onap.vid.properties.Features; import org.onap.vid.testUtils.TestUtils; import org.testng.annotations.AfterMethod; @@ -42,24 +70,6 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import org.togglz.core.manager.FeatureManager; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.*; -import java.util.function.BiConsumer; - -import static java.util.Collections.emptyList; -import static java.util.Collections.emptyMap; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasProperty; -import static org.hamcrest.Matchers.is; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.onap.vid.model.VidNotions.*; -import static org.testng.AssertJUnit.assertEquals; - public class VidNotionsBuilderTest { @InjectMocks @@ -226,42 +236,6 @@ public class VidNotionsBuilderTest { } @DataProvider - public static Object[][] macroToViewEditDataProvider() { - return new Object[][] { - {"macro service + not excluded + needed flags are open", true, false, true, InstantiationUI.MACRO_SERVICE}, - {"not macro service", false, true, true, InstantiationUI.LEGACY}, - {"macro that shall be excluded because it has pnf", true, true, true, InstantiationUI.LEGACY}, - {"macro service + FLAG_1902_NEW_VIEW_EDIT off", true, false, false, InstantiationUI.LEGACY}, - }; - } - - @Test(dataProvider="macroToViewEditDataProvider") - public void whenServiceIsMacro_viewEditIsRight( - String testDescription, - boolean isMacro, - boolean isExcluded, - boolean isFlag1902NewViewEdit, - InstantiationUI expectedViewEditUi) { - - initServiceModelAndscarHelperWithMocks(); - - //mock for is Macro - String instantiationType = isMacro ? ToscaParserImpl2.Constants.MACRO : ToscaParserImpl2.Constants.A_LA_CARTE; - Service service = mock(Service.class); - when(serviceModel.getService()).thenReturn(service); - when(service.getInstantiationType()).thenReturn(instantiationType); - when(featureManagerMock.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)).thenReturn(isFlag1902NewViewEdit); - - //mock for isExcluded - if (isExcluded) { - when(serviceModel.getPnfs()).thenReturn(ImmutableMap.of("a", mock(Node.class))); - } - - InstantiationUI result = vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel); - assertEquals(expectedViewEditUi, result); - } - - @DataProvider public static Object[][] instantiationUIToViewEditDataProvider() { return new Object[][] { {"network cloud(5G) service + needed flags are open", true, true, InstantiationUI.NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS}, @@ -391,30 +365,6 @@ public class VidNotionsBuilderTest { assertEquals(InstantiationType.Macro, vidNotions.getInstantiationType()); } - @DataProvider - public static Object[][] givenCollectionResourceServiceDataProvider() { - return new Object[][]{ - {false, true, InstantiationUI.LEGACY}, - {true, false, InstantiationUI.LEGACY}, - {true, true, InstantiationUI.SERVICE_WITH_COLLECTION_RESOURCE} - }; - } - - @Test(dataProvider = "givenCollectionResourceServiceDataProvider") - public void givenCollectionResourceService_whenSuggestViewEdit_thenResultAccordingFeatureFlag( - boolean crFlag, boolean resumeFlag, VidNotions.InstantiationUI expectedViewEditUi) { - - //mock service with CR - ServiceModel mockServiceModel = mock(ServiceModel.class); - when(mockServiceModel.getCollectionResources()).thenReturn(ImmutableMap.of("a", mock(CR.class))); - - //mock feature flags - when(featureManagerMock.isActive(Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI)).thenReturn(crFlag); - when(featureManagerMock.isActive(Features.FLAG_1908_RESUME_MACRO_SERVICE)).thenReturn(resumeFlag); - - assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestViewEditUI(mock(ISdcCsarHelper.class), mockServiceModel)); - } - @Test public void whenServiceModelIsNull_thenInstantiationTypeIsClientConfig() { assertEquals( InstantiationType.ClientConfig, vidNotionsBuilder.suggestInstantiationType(null, ModelCategory.OTHER)); @@ -507,4 +457,31 @@ public class VidNotionsBuilderTest { public void hasFabricConfiguration(String desc, boolean shouldHaveFabricConfiguration, ISdcCsarHelper csarHelper) { assertThat(desc, vidNotionsBuilder.hasFabricConfiguration(csarHelper), is(shouldHaveFabricConfiguration)); } -}
\ No newline at end of file + + @DataProvider + public static Object[][] macroTransportDataProvider() { + return new Object[][]{ + {"transport service flag is open", true, true, true, InstantiationUI.LEGACY}, + {"macro service flag is open", true, false, true, InstantiationUI.MACRO_SERVICE}, + {"macro service flag is closed", false, true, true, InstantiationUI.LEGACY}, + {"transport service flag is closed", false, false, true, InstantiationUI.LEGACY}, + {"not a macro service", true, false, false, InstantiationUI.LEGACY} + }; + } + + @Test (dataProvider = "macroTransportDataProvider") + public void viewEditMacroService_transportOrNotTransport(String desc, boolean flagActive, boolean isTransport, boolean isMacro, InstantiationUI expectedViewEditUi) { + initServiceModelAndscarHelperWithMocks(); + Service service = mock(Service.class); + + String instantiationType = isMacro ? ToscaParserImpl2.Constants.MACRO : ToscaParserImpl2.Constants.A_LA_CARTE; + when(serviceModel.getService()).thenReturn(service); + when(service.getInstantiationType()).thenReturn(instantiationType); + when(featureManagerMock.isActive(Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT)).thenReturn(flagActive); + when(featureManagerMock.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)).thenReturn(false); + when(csarHelper.getServiceMetadata()).thenReturn(new Metadata(isTransport ? ImmutableMap.of(ToscaParserImpl2.Constants.SERVICE_TYPE, "TRANSPORT") : emptyMap() + )); + + assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel)); + } +} diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java index 2cc790f02..059500cd5 100644 --- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java +++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java @@ -41,7 +41,8 @@ public enum Features implements Feature { FLAG_1908_RESUME_MACRO_SERVICE, FLAG_1908_RELEASE_TENANT_ISOLATION, FLAG_1908_VNF_FC_NEW_INSTANTIATION_UI, - FLAG_HANDLE_SO_WORKFLOWS + FLAG_HANDLE_SO_WORKFLOWS, + FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT, ; public boolean isActive() { diff --git a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java index 7e9dac406..d7903ceef 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/NewServiceInstanceTest.java @@ -1,19 +1,75 @@ package vid.automation.test.test; //import com.automation.common.report_portal_integration.annotations.Step; + +import static junit.framework.TestCase.assertNull; +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.PRESET_SOME_LEGACY_REGION_TO_ATT_AIC; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.DEFAULT_SERVICE_INSTANCE_ID; +import static org.testng.Assert.assertEquals; +import static org.testng.AssertJUnit.assertTrue; +import static vid.automation.test.infra.Features.FLAG_1902_VNF_GROUPING; +import static vid.automation.test.infra.Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.Features.FLAG_1908_INFRASTRUCTURE_VPN; +import static vid.automation.test.infra.Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT; +import static vid.automation.test.infra.Features.FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.Features.FLAG_5G_IN_NEW_INSTANTIATION_UI; +import static vid.automation.test.infra.Features.FLAG_ENABLE_WEBPACK_MODERN_UI; +import static vid.automation.test.infra.ModelInfo.aLaCarteNetworkProvider5G; +import static vid.automation.test.infra.ModelInfo.aLaCarteVnfGroupingService; +import static vid.automation.test.infra.ModelInfo.collectionResourceService; +import static vid.automation.test.infra.ModelInfo.infrastructureVpnService; +import static vid.automation.test.infra.ModelInfo.macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetails; +import static vid.automation.test.infra.ModelInfo.macroSriovNoDynamicFieldsEcompNamingFalseFullModelDetailsVnfEcompNamingFalse; +import static vid.automation.test.infra.ModelInfo.macroSriovWithDynamicFieldsEcompNamingFalsePartialModelDetailsVnfEcompNamingFalse; +import static vid.automation.test.infra.ModelInfo.macroSriovWithDynamicFieldsEcompNamingTruePartialModelDetails; +import static vid.automation.test.infra.ModelInfo.pasqualeVmxVpeBvService488Annotations; +import static vid.automation.test.infra.ModelInfo.transportWithPnfsService; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; +import static vid.automation.test.test.ALaCarteflowTest.AIC; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; import org.apache.commons.lang3.mutable.MutableInt; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.hamcrest.Matchers; -import org.onap.simulator.presetGenerator.presets.aai.*; -import org.onap.simulator.presetGenerator.presets.mso.*; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.ResponseDetails; -import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; import org.onap.sdc.ci.tests.datatypes.UserCredentials; import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetL3NetworksByCloudRegionSpecificState; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetVpnsByType; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaCarte5G; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceAlacarte5GServiceWithNetwork; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesEcompNamingFalse; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGet5GServiceInstanceAndNetwork.ResponseDetails; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; +import org.onap.simulator.presetGenerator.presets.mso.PresetMsoCreateMacroCommonPre1806; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebElement; @@ -24,38 +80,27 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.Constants.BrowseASDC.NewServicePopup; -import vid.automation.test.infra.*; +import vid.automation.test.infra.Click; +import vid.automation.test.infra.FeatureTogglingTest; +import vid.automation.test.infra.Features; +import vid.automation.test.infra.Get; +import vid.automation.test.infra.Input; +import vid.automation.test.infra.ModelInfo; +import vid.automation.test.infra.SelectOption; +import vid.automation.test.infra.Wait; import vid.automation.test.model.Service; import vid.automation.test.model.User; -import vid.automation.test.sections.*; +import vid.automation.test.sections.BrowseASDCPage; +import vid.automation.test.sections.DrawingBoardPage; +import vid.automation.test.sections.InstantiationStatusPage; +import vid.automation.test.sections.SideMenu; +import vid.automation.test.sections.VidBasePage; import vid.automation.test.services.AsyncJobsService; import vid.automation.test.services.ServicesService; import vid.automation.test.services.SimulatorApi; import vid.automation.test.test.NewServiceInstanceTest.ServiceData.IS_GENERATED_NAMING; import vid.automation.test.utils.ReadFile; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -import static junit.framework.TestCase.assertNull; -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.hamcrest.CoreMatchers.startsWith; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.PRESET_SOME_LEGACY_REGION_TO_ATT_AIC; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.DEFAULT_SERVICE_INSTANCE_ID; -import static org.testng.Assert.assertEquals; -import static org.testng.AssertJUnit.assertTrue; -import static vid.automation.test.infra.Features.*; -import static vid.automation.test.infra.ModelInfo.*; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; -import static vid.automation.test.test.ALaCarteflowTest.AIC; - @FeatureTogglingTest(FLAG_ENABLE_WEBPACK_MODERN_UI) public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { @@ -663,10 +708,9 @@ public class NewServiceInstanceTest extends CreateInstanceDialogBaseTest { //@Step("verify open view edit") private void verifyOpenViewEdit(String serviceInstanceName) { boolean[] openEnabled = {true, false, false}; - String[] statuses = {COMPLETED, IN_PROGRESS, PENDING}; ImmutableList.of(0, 1, 2).forEach(i -> { String actualInstanceName = getActualInstanceName(serviceInstanceName, i); - if (Features.FLAG_1902_NEW_VIEW_EDIT.isActive()) { + if (Features.FLAG_1902_NEW_VIEW_EDIT.isActive() || FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT.isActive()) { InstantiationStatusPage.verifyOpenNewViewEdit(actualInstanceName, openEnabled[i], "EDIT"); } else { diff --git a/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java b/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java index 76cc7a44b..40af6f8a1 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/ViewEditWithDrawingBoardTest.java @@ -1,15 +1,40 @@ package vid.automation.test.test; +import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.defaultPlacement; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; +import static vid.automation.test.Constants.DrawingBoard.CONTEXT_MENU_BUTTON_HEADER; +import static vid.automation.test.Constants.DrawingBoard.CONTEXT_MENU_HEADER_RESUME_ITEM; +import static vid.automation.test.infra.ModelInfo.aLaCarteVnfGroupingService; +import static vid.automation.test.infra.ModelInfo.collectionResourceForResume; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMultimap; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; -import org.onap.simulator.presetGenerator.presets.aai.*; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIFilterServiceInstanceById; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetServicesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGetSpecificService; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsWithoutInstancesGetSpecificService; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIModelsByInvariantIdGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIModelsByInvariantIdGetForServiceWithCR; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet; import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet; -import org.onap.simulator.presetGenerator.presets.mso.*; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteInstanceGroup; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsGetByServiceInstanceId; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOResumeRequest; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet; import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet; -import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; import org.testng.annotations.Test; import vid.automation.test.Constants; import vid.automation.test.infra.Click; @@ -19,23 +44,9 @@ import vid.automation.test.infra.ModelInfo; import vid.automation.test.sections.DrawingBoardPage; import vid.automation.test.services.SimulatorApi; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIStandardQueryGet.defaultPlacement; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME; -import static vid.automation.test.Constants.DrawingBoard.CONTEXT_MENU_BUTTON_HEADER; -import static vid.automation.test.Constants.DrawingBoard.CONTEXT_MENU_HEADER_RESUME_ITEM; -import static vid.automation.test.infra.ModelInfo.aLaCarteVnfGroupingService; -import static vid.automation.test.infra.ModelInfo.collectionResourceForResume; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; - public class ViewEditWithDrawingBoardTest extends VidBaseTestCase { private static final String MSO_COMPLETE_STATUS = "COMPLETE"; - private static final String COMPLETED = "COMPLETED"; private String vnfGroupInstanceId; private String serviceInstanceToDeleteName; private String vnf1Name; @@ -77,7 +88,7 @@ public class ViewEditWithDrawingBoardTest extends VidBaseTestCase { GeneralUIUtils.ultimateWait(); DrawingBoardPage drawingBoardPage = new DrawingBoardPage(); - drawingBoardPage.goToIframe(); + DrawingBoardPage.goToIframe(); GeneralUIUtils.ultimateWait(); action.run(); GeneralUIUtils.ultimateWait(); @@ -173,7 +184,7 @@ public class ViewEditWithDrawingBoardTest extends VidBaseTestCase { ); } - @FeatureTogglingTest({Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI, Features.FLAG_1908_RESUME_MACRO_SERVICE}) + @FeatureTogglingTest({Features.FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT, Features.FLAG_1908_RESUME_MACRO_SERVICE}) @Test public void testResumeServiceInstanceWithCollectionResource() { diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java index 8201bcfa0..04dbbc0c5 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java @@ -1,5 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.vid.api; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; +import static net.javacrumbs.jsonunit.JsonMatchers.jsonStringEquals; +import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNot.not; +import static org.testng.Assert.assertFalse; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; +import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; +import static vid.automation.test.services.SimulatorApi.registerExpectation; +import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; +import static vid.automation.test.utils.ReadFile.loadResourceAsString; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; @@ -14,19 +47,6 @@ import org.testng.annotations.Test; import vid.automation.test.infra.FeatureTogglingTest; import vid.automation.test.infra.Features; -import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals; -import static net.javacrumbs.jsonunit.JsonMatchers.jsonStringEquals; -import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNot.not; -import static org.testng.Assert.assertFalse; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND; -import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; -import static vid.automation.test.services.SimulatorApi.registerExpectation; -import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets; -import static vid.automation.test.utils.ReadFile.loadResourceAsString; - public class SdcApiTest extends BaseApiTest { private static final String SDC_GET_SERVICE_MODEL = "/rest/models/services/"; @@ -93,7 +113,9 @@ public class SdcApiTest extends BaseApiTest { ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MACRO_INSTANTIATION_TYPE_UUID), String.class); Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); String macroInstantiationTypeExpectedResponse = loadResourceAsString(MACRO_INSTANTIATION_TYPE_EXPECTED_RESPONSE); - assertThat("The response is in the format of JSON", response.getBody(), is(jsonStringEquals(turnOffInstantiationUI(macroInstantiationTypeExpectedResponse)))); + assertThat(response.getBody(), jsonEquals(macroInstantiationTypeExpectedResponse) + .when(IGNORING_ARRAY_ORDER) + .whenIgnoringPaths("service.vidNotions.viewEditUI")); } @@ -112,7 +134,9 @@ public class SdcApiTest extends BaseApiTest { ResponseEntity<String> response = restTemplate.getForEntity(buildUri(SDC_GET_SERVICE_MODEL + MACRO_INSTANTIATION_TYPE_UUID), String.class); Assert.assertEquals(response.getStatusCode(), HttpStatus.OK); String macroInstantiationTypeExpectedResponse = loadResourceAsString(MACRO_INSTANTIATION_TYPE_EXPECTED_RESPONSE); - assertThat("The response is in the format of JSON", response.getBody(), is(jsonStringEquals(turnOffInstantiationUI(macroInstantiationTypeExpectedResponse)))); + assertThat(response.getBody(), jsonEquals(macroInstantiationTypeExpectedResponse) + .when(IGNORING_ARRAY_ORDER) + .whenIgnoringPaths("service.vidNotions.viewEditUI")); } @Test diff --git a/vid-automation/src/test/resources/features.properties b/vid-automation/src/test/resources/features.properties index 7ab0785b1..7c5f0e470 100644 --- a/vid-automation/src/test/resources/features.properties +++ b/vid-automation/src/test/resources/features.properties @@ -31,3 +31,4 @@ FLAG_1906_COMPONENT_INFO = false FLAG_1906_INSTANTIATION_API_USER_VALIDATION = true FLAG_1908_RESUME_MACRO_SERVICE=true FLAG_1908_RELEASE_TENANT_ISOLATION=true +FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT=true |