diff options
23 files changed, 371 insertions, 232 deletions
diff --git a/features.properties.md b/features.properties.md index 2823c662e..e8dbeccb4 100644 --- a/features.properties.md +++ b/features.properties.md @@ -173,3 +173,7 @@ * FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE Let the user set the order of resource instantiation while using drawing board (new view edit) for a-la-carte instantiation. + +* FLAG_SHOW_ORCHESTRATION_TYPE + enables showing/hiding (true/false) column with orchestration type in Service Model browser. + The types are fetched from aai.
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java index f2f6ca50a..099f2449b 100644 --- a/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java +++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java @@ -32,6 +32,7 @@ public class ModelVer { private String distributionStatus; private String resourceVersion; private String modelDescription; + private String orchestrationType; @@ -89,4 +90,12 @@ public class ModelVer { this.modelDescription = modelDescription; } + public String getOrchestrationType() { + return orchestrationType; + } + + @JsonAlias("orchestration-type") + public void setOrchestrationType(String orchestrationType) { + this.orchestrationType = orchestrationType; + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java index ca151a731..0d37fb39e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java +++ b/vid-app-common/src/main/java/org/onap/vid/asdc/beans/Service.java @@ -23,88 +23,59 @@ package org.onap.vid.asdc.beans; import java.util.Collection; import java.util.UUID; -/** - * The Class Service. - */ public class Service { - /** - * The Enum DistributionStatus. - */ public enum DistributionStatus { - /** The distribution not approved. */ DISTRIBUTION_NOT_APPROVED, - /** The distribution approved. */ DISTRIBUTION_APPROVED, - /** The distributed. */ DISTRIBUTED, - /** The distribution rejected. */ DISTRIBUTION_REJECTED, - /** The destributed for tenant isolation. */ DISTRIBUTION_COMPLETE_OK } - /** - * The Enum LifecycleState. - */ public enum LifecycleState { - /** The not certified checkout. */ NOT_CERTIFIED_CHECKOUT, - /** The not certified checkin. */ NOT_CERTIFIED_CHECKIN, - /** The ready for certification. */ READY_FOR_CERTIFICATION, - /** The certification in progress. */ CERTIFICATION_IN_PROGRESS, - /** The certified. */ CERTIFIED } - /** The uuid. */ private String uuid; - /** The invariant UUID. */ private String invariantUUID; - /** The name. */ private String name; - /** The version. */ private String version; - /** The tosca model URL. */ private String toscaModelURL; - /** The category. */ private String category; - /** The lifecycle state. */ private Service.LifecycleState lifecycleState; - /** The last updater user uid. */ private String lastUpdaterUserId; - /** The last updater full name. */ private String lastUpdaterFullName; - /** The distribution status. */ private String distributionStatus; - /** The artifacts. */ private Collection<Artifact> artifacts; - /** The resources. */ private Collection<SubResource> resources; + + private String orchestrationType; public static class ServiceBuilder { @@ -118,6 +89,7 @@ public class Service { private String distributionStatus; private Collection<Artifact> artifacts; private Collection<SubResource> resources; + private String orchestrationType; public ServiceBuilder setUuid(String uuid) { this.uuid = uuid; @@ -169,253 +141,131 @@ public class Service { return this; } + public ServiceBuilder setOrchestrationType(String orchestrationType) { + this.orchestrationType = orchestrationType; + return this; + } + public Service build() { return new Service(this); } } - /** - * Gets the uuid. - * - * @return the uuid - */ public String getUuid() { return uuid; } - /** - * Gets the invariant UUID. - * - * @return the invariant UUID - */ public String getInvariantUUID() { return invariantUUID; } - /** - * Gets the name. - * - * @return the name - */ public String getName() { return name; } - /** - * Gets the version. - * - * @return the version - */ public String getVersion() { return version; } - /** - * Gets the tosca model URL. - * - * @return the tosca model URL - */ public String getToscaModelURL() { return toscaModelURL; } - /** - * Gets the category. - * - * @return the category - */ public String getCategory() { return category; } - /** - * Gets the lifecycle state. - * - * @return the lifecycle state - */ public Service.LifecycleState getLifecycleState() { return lifecycleState; } - /** - * Gets the last updater user uid. - * - * @return the last updater user uid - */ public String getLastUpdaterUserId() { return lastUpdaterUserId; } - /** - * Gets the last updater full name. - * - * @return the last updater full name - */ public String getLastUpdaterFullName() { return lastUpdaterFullName; } - /** - * Gets the distribution status. - * - * @return the distribution status - */ public String getDistributionStatus() { return distributionStatus; } - /** - * Gets the artifacts. - * - * @return the artifacts - */ public Collection<Artifact> getArtifacts() { return artifacts; } - /** - * Gets the resources. - * - * @return the resources - */ public Collection<SubResource> getResources() { return resources; } - /** - * Sets the uuid. - * - * @param uuid the new uuid - */ + public String getOrchestrationType() { + return orchestrationType; + } + public void setUuid(String uuid) { this.uuid = uuid; } - /** - * Sets the invariant UUID. - * - * @param invariantUUID the new invariant UUID - */ public void setInvariantUUID(String invariantUUID) { this.invariantUUID = invariantUUID; } - /** - * Sets the name. - * - * @param name the new name - */ public void setName(String name) { this.name = name; } - /** - * Sets the version. - * - * @param version the new version - */ public void setVersion(String version) { this.version = version; } - /** - * Sets the tosca model URL. - * - * @param toscaModelURL the new tosca model URL - */ public void setToscaModelURL(String toscaModelURL) { this.toscaModelURL = toscaModelURL; } - /** - * Sets the category. - * - * @param category the new category - */ public void setCategory(String category) { this.category = category; } - /** - * Sets the lifecycle state. - * - * @param lifecycleState the new lifecycle state - */ public void setLifecycleState(Service.LifecycleState lifecycleState) { this.lifecycleState = lifecycleState; } - /** - * Sets the last updater user uid. - * - * @param lastUpdaterUserId the new last updater user uid - */ public void set(String lastUpdaterUserId) { this.lastUpdaterUserId = lastUpdaterUserId; } - /** - * Sets the last updater full name. - * - * @param lastUpdaterFullName the new last updater full name - */ public void setLastUpdaterFullName(String lastUpdaterFullName) { this.lastUpdaterFullName = lastUpdaterFullName; } - /** - * Sets the distribution status. - * - * @param distributionStatus the new distribution status - */ public void setDistributionStatus(String distributionStatus) { this.distributionStatus = distributionStatus; } - /** - * Sets the artifacts. - * - * @param artifacts the new artifacts - */ public void setArtifacts(Collection<Artifact> artifacts) { this.artifacts = artifacts; } - /** - * Sets the resources. - * - * @param resources the new resources - */ public void setResources(Collection<SubResource> resources) { this.resources = resources; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ + public void setOrchestrationType(String orchestrationType) { + this.orchestrationType = orchestrationType; + } + @Override public String toString() { return uuid; } - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { return UUID.fromString(getUuid()).hashCode(); } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(Object o) { if (o == this) @@ -442,5 +292,6 @@ public class Service { this.distributionStatus = serviceBuilder.distributionStatus; this.artifacts = serviceBuilder.artifacts; this.resources = serviceBuilder.resources; + this.orchestrationType = serviceBuilder.orchestrationType; } } diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt index ac5c2751c..df97f89f8 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ResourceCommand.kt @@ -427,14 +427,17 @@ abstract class ResourceCommand( protected fun pushChildrenJobsToBroker(children:Collection<BaseResource>, dataForChild: Map<String, Any>, jobType: JobType?=null): List<String> { - var counter = 0; - return children - .map {Pair(it, counter++)} + return setPositionWhereIsMissing(children) .map { jobAdapter.createChildJob(jobType ?: it.first.jobType, it.first, sharedData, dataForChild, it.second) } .map { jobsBrokerService.add(it) } .map { it.toString() } } + protected fun setPositionWhereIsMissing(children: Collection<BaseResource>): List<Pair<BaseResource, Int>> { + var orderingPosition = children.map{ defaultIfNull(it.position, 0) }.max() ?: 0 + return children + .map {Pair(it, it.position ?: ++orderingPosition)} + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java index 82b2fd3d8..5e19dad46 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/rest/MsoRestClientNew.java @@ -43,6 +43,7 @@ import org.onap.vid.changeManagement.MsoRequestDetails; import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.changeManagement.WorkflowRequestDetail; import org.onap.vid.client.SyncRestClient; +import org.onap.vid.logging.Headers; import org.onap.vid.model.RequestReferencesContainer; import org.onap.vid.model.SOWorkflowList; import org.onap.vid.mso.MsoInterface; @@ -537,6 +538,7 @@ public class MsoRestClientNew implements MsoInterface { String requestIdValue = Logging.extractOrGenerateRequestId(); map.put(SystemProperties.ECOMP_REQUEST_ID, requestIdValue); map.put(ONAP_REQUEST_ID_HEADER_KEY, requestIdValue); + map.put(Headers.INVOCATION_ID.getHeaderName(), Headers.INVOCATION_ID.getHeaderValue()); return map; } 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 7384c97e2..a3343d36b 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 @@ -74,6 +74,7 @@ public enum Features implements Feature { FLAG_PNP_INSTANTIATION, FLAG_HANDLE_SO_WORKFLOWS, FLAG_CREATE_ERROR_REPORTS, + FLAG_SHOW_ORCHESTRATION_TYPE, FLAG_DISABLE_HOMING, FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG, FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT, diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java index b6404fa68..984812103 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java @@ -137,7 +137,9 @@ public class AaiServiceImpl implements AaiService { .setToscaModelURL(null) .setLifecycleState(null) .setArtifacts(null) - .setResources(null).build(); + .setResources(null) + .setOrchestrationType(modelVer.getOrchestrationType()) + .build(); diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties index db2ff8e97..d4910bf25 100644 --- a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties +++ b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties @@ -36,3 +36,4 @@ FLAG_DISABLE_HOMING = true FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH=false FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG = false FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE = false +FLAG_SHOW_ORCHESTRATION_TYPE = false diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties index d1ce91f44..709de9566 100644 --- a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties +++ b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties @@ -15,6 +15,7 @@ FLAG_1810_AAI_LOCAL_CACHE = true FLAG_EXP_USE_DEFAULT_HOST_NAME_VERIFIER = false FLAG_HANDLE_SO_WORKFLOWS = true FLAG_CREATE_ERROR_REPORTS = true +FLAG_SHOW_ORCHESTRATION_TYPE = false # Modern UI (Drawing-Board; View/Edit) # - - - - - - - - - - - - - - - - - - diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js index f76d4786f..3575c382d 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js @@ -264,6 +264,7 @@ appDS2 FLAG_1908_RELEASE_TENANT_ISOLATION: "FLAG_1908_RELEASE_TENANT_ISOLATION", FLAG_FLASH_REPLACE_VF_MODULE: "FLAG_FLASH_REPLACE_VF_MODULE", FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT: "FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT", + FLAG_SHOW_ORCHESTRATION_TYPE: "FLAG_SHOW_ORCHESTRATION_TYPE", } }; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js index 9cb905038..b29680f9d 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js @@ -89,6 +89,10 @@ });
};
+ $scope.isShowOrchestrationType = function() {
+ return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ORCHESTRATION_TYPE);
+ };
+
var wholeData=[];
$scope.filterDataWithHigherVersion = function(serviceData){
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm index 4570a0b08..06fc7f67b 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm @@ -48,6 +48,7 @@ <tr>
<th att-table-header key="action">Action</th>
<th att-table-header key="uuid">UUID</th>
+ <th ng-if="isShowOrchestrationType()" att-table-header key="orchestrationType">Orchestration Type</th>
<th att-table-header key="invariantUUID">Invariant UUID</th>
<th att-table-header default-sort="A" key="name">Name</th>
<th att-table-header key="version">Version</th>
@@ -62,6 +63,7 @@ <tr class="sdcServiceModel" data-tests-id="Browse_SDC_Service_Models-uuid-{{service['uuid']}}">
<td class="deploy" att-table-body ><button class="deploy-service-class" type=button data-tests-id="deploy-{{service['uuid']}}" ng-click="deployService(service)" att-button btn-type="{{deployButtonType}}" size="small">Deploy</button></td>
<td class="uuid" att-table-body ng-bind="service['uuid']"></td>
+ <td ng-if="isShowOrchestrationType()" class="orchestrationType" att-table-body ng-bind="service['orchestrationType']"></td>
<td class="invariantUUID" att-table-body data-tests-id="Invariant-{{service['invariantUUID']}}" ng-bind="service['invariantUUID']"></td>
<td class="name" att-table-body ng-bind="service['name']"></td>
<td class="version" att-table-body ng-bind="service['version']"></td>
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java index 9501614b7..986f5d0f5 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java @@ -20,8 +20,45 @@ package org.onap.vid.job.command; +import static java.util.Collections.emptyList; +import static org.mockito.AdditionalAnswers.returnsFirstArg; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.RETURNS_MOCKS; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.onap.vid.job.command.ResourceCommandKt.ACTION_PHASE; +import static org.onap.vid.job.command.ResourceCommandKt.INTERNAL_STATE; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createGroup; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createMember; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createNetwork; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createService; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createVfModule; +import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.createVnf; +import static org.onap.vid.model.Action.Create; +import static org.onap.vid.model.Action.Delete; +import static org.onap.vid.model.Action.None; +import static org.onap.vid.model.Action.Resume; +import static org.onap.vid.model.Action.values; +import static org.onap.vid.utils.Logging.getMethodCallerName; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.ws.rs.ProcessingException; +import kotlin.Pair; import org.jetbrains.annotations.NotNull; import org.onap.vid.exceptions.AbortingException; import org.onap.vid.exceptions.GenericUncheckedException; @@ -32,32 +69,19 @@ import org.onap.vid.job.JobsBrokerService; import org.onap.vid.job.NextCommand; import org.onap.vid.job.impl.JobSharedData; import org.onap.vid.model.Action; -import org.onap.vid.model.serviceInstantiation.*; +import org.onap.vid.model.serviceInstantiation.BaseResource; +import org.onap.vid.model.serviceInstantiation.InstanceGroup; +import org.onap.vid.model.serviceInstantiation.InstanceGroupMember; +import org.onap.vid.model.serviceInstantiation.Network; +import org.onap.vid.model.serviceInstantiation.ServiceInstantiation; +import org.onap.vid.model.serviceInstantiation.VfModule; +import org.onap.vid.model.serviceInstantiation.Vnf; import org.onap.vid.mso.RestMsoImplementation; import org.onap.vid.mso.model.ModelInfo; import org.springframework.http.HttpMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import javax.ws.rs.ProcessingException; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static java.util.Collections.emptyList; -import static org.mockito.AdditionalAnswers.returnsFirstArg; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; -import static org.onap.vid.job.command.ResourceCommandKt.ACTION_PHASE; -import static org.onap.vid.job.command.ResourceCommandKt.INTERNAL_STATE; -import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.*; -import static org.onap.vid.model.Action.*; -import static org.onap.vid.utils.Logging.getMethodCallerName; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertFalse; - public class ResourceCommandTest { public static class MockCommand extends ResourceCommand { @@ -503,4 +527,30 @@ public class ResourceCommandTest { assertEquals(expectedNextStatus, nextCommand.getStatus()); } + @DataProvider + public static Object[][] resourcePosition() { + return new Object[][]{ + {1, 2, 3, ImmutableList.of(1,2,3)}, + {null, 1, 100, ImmutableList.of(101,1,100)}, + {null, null, null, ImmutableList.of(1,2,3)}, + {1,2,2, ImmutableList.of(1,2,2)} + }; + } + + @Test(dataProvider = "resourcePosition") + public void sortChildren_sortAccordingToPosition(Integer firstPosition, Integer secondPosition, Integer thirdPosition, List<Integer> expectedPositions){ + BaseResource mockedRequest1 = mock(BaseResource.class); + when(mockedRequest1.getPosition()).thenReturn(firstPosition); + BaseResource mockedRequest2 = mock(BaseResource.class); + when(mockedRequest2.getPosition()).thenReturn(secondPosition); + BaseResource mockedRequest3 = mock(BaseResource.class); + when(mockedRequest3.getPosition()).thenReturn(thirdPosition); + + MockCommand underTest = new MockCommand(InternalState.CREATING_CHILDREN, Create, Job.JobStatus.IN_PROGRESS); + List<Pair<BaseResource, Integer>> sortedList = underTest.setPositionWhereIsMissing(ImmutableList.of(mockedRequest1, mockedRequest2, mockedRequest3)); + + assertEquals(sortedList.get(0).getSecond(),expectedPositions.get(0)); + assertEquals(sortedList.get(1).getSecond(),expectedPositions.get(1)); + assertEquals(sortedList.get(2).getSecond(),expectedPositions.get(2)); + } } diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java index 787ff608d..992325049 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java @@ -143,9 +143,14 @@ public class ServiceInProgressStatusCommandTest { UUID uuid = UUID.randomUUID(); String userId = "mockedUserID"; String testApi = "VNF_API"; + + // Create components setPosition in order to verify on the creation order on createChildJob + Network network = createNetwork(Create); + network.setPosition(0); Vnf vnf1 = createVnf(emptyList(), Create); + vnf1.setPosition(1); Vnf vnf2 = createVnf(emptyList(), Create); - Network network = createNetwork(Create); + vnf2.setPosition(2); ServiceInstantiation serviceInstantiation = createService( ImmutableList.of(vnf1, vnf2), ImmutableList.of(network), diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java index 414bcf4ac..422443510 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java @@ -20,6 +20,7 @@ package org.onap.vid.mso.rest; +import static org.apache.commons.io.IOUtils.toInputStream; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase; import static org.hamcrest.CoreMatchers.is; @@ -32,9 +33,18 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.matchesPattern; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; +import io.joshworks.restclient.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -53,10 +63,12 @@ import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.aai.util.AAIRestInterface; import org.onap.vid.aai.util.HttpsAuthClient; import org.onap.vid.aai.util.ServletRequestHelper; import org.onap.vid.aai.util.SystemPropertyHelper; +import org.onap.vid.client.SyncRestClient; import org.onap.vid.controller.filter.PromiseRequestIdFilter; import org.onap.vid.logging.Headers; import org.onap.vid.mso.MsoProperties; @@ -82,6 +94,8 @@ public class OutgoingRequestHeadersTest { @InjectMocks private RestMsoImplementation restMsoImplementation; + private MsoRestClientNew msoRestClientNew; + @Mock private SystemPropertyHelper systemPropertyHelper; @@ -97,6 +111,9 @@ public class OutgoingRequestHeadersTest { @Mock private Logging loggingService; + @Mock + SyncRestClient syncRestClient; + @InjectMocks private AAIRestInterface aaiRestInterface; @@ -108,6 +125,9 @@ public class OutgoingRequestHeadersTest { MockitoAnnotations.initMocks(this); when(servletRequestHelper.extractOrGenerateRequestId()).thenAnswer(invocation -> UUID.randomUUID().toString()); when(systemPropertiesWrapper.getProperty(MsoProperties.MSO_PASSWORD)).thenReturn("OBF:1vub1ua51uh81ugi1u9d1vuz"); + when(systemPropertiesWrapper.getProperty(SystemProperties.APP_DISPLAY_NAME)).thenReturn("vid"); + //the ctor of MsoRestClientNew require the above lines as preconditions + msoRestClientNew = new MsoRestClientNew(syncRestClient, "baseUrl",systemPropertiesWrapper); } @BeforeMethod @@ -136,9 +156,9 @@ public class OutgoingRequestHeadersTest { f.accept(restMsoImplementation); Invocation.Builder fakeBuilder = mocks.getFakeBuilder(); - Object requestIdValue = verifyXEcompRequestIdHeaderWasAdded(fakeBuilder); + String requestIdValue = verifyXEcompRequestIdHeaderWasAdded(fakeBuilder); assertEquals(requestIdValue, captureHeaderKeyAndReturnItsValue(fakeBuilder, "X-ONAP-RequestID")); - Object invocationId1 = assertRequestHeaderIsUUID(fakeBuilder, "X-InvocationID"); + String invocationId1 = assertRequestHeaderIsUUID(fakeBuilder, "X-InvocationID"); assertThat((String) captureHeaderKeyAndReturnItsValue(fakeBuilder, "Authorization"), startsWith("Basic ")); verifyXOnapPartnerNameHeaderWasAdded(fakeBuilder); @@ -152,7 +172,7 @@ public class OutgoingRequestHeadersTest { Invocation.Builder fakeBuilder2 = mocks2.getFakeBuilder(); //then - Object requestIdValue2 = verifyXEcompRequestIdHeaderWasAdded(fakeBuilder2); + String requestIdValue2 = verifyXEcompRequestIdHeaderWasAdded(fakeBuilder2); assertEquals(requestIdValue, requestIdValue2); Object invocationId2 = assertRequestHeaderIsUUID(fakeBuilder2, "X-InvocationID"); @@ -170,6 +190,62 @@ public class OutgoingRequestHeadersTest { } @DataProvider + public Object[][] msoRestClientNewMethods() { + return Stream.<ThrowingConsumer<MsoRestClientNew>>of( + client -> client.createInstance(new Object(), "/any path") + ).map(l -> ImmutableList.of(l).toArray()).collect(Collectors.toList()).toArray(new Object[][]{}); + } + + @Test(dataProvider = "msoRestClientNewMethods") + public void msoRestClientNewHeadersTest(Consumer<MsoRestClientNew> f) throws Exception { + Map[] captor = setMocksForMsoRestClientNew(); + + f.accept(msoRestClientNew); + Map headers = captor[0]; + + String ecompRequestId = assertRequestHeaderIsUUID(headers, "X-ECOMP-RequestID"); + String onapRequestID = assertRequestHeaderIsUUID(headers, "X-ONAP-RequestID"); + assertEquals(ecompRequestId, onapRequestID); + + + String invocationId1 = assertRequestHeaderIsUUID(headers, "X-InvocationID"); + assertThat((String) headers.get("Authorization"), startsWith("Basic ")); + assertThat(headers.get("X-ONAP-PartnerName"), is("VID.VID")); + + //validate requestId is same in next call but invocationId is different + + //given + captor = setMocksForMsoRestClientNew(); + + //when + f.accept(msoRestClientNew); + headers = captor[0]; + + //then + assertEquals(headers.get("X-ONAP-RequestID"), onapRequestID); + String invocationId2 = assertRequestHeaderIsUUID(headers, "X-InvocationID"); + assertNotEquals(invocationId1, invocationId2); + + } + + private Map[] setMocksForMsoRestClientNew() { + reset(syncRestClient); + HttpResponse<String> httpResponse = mock(HttpResponse.class); + String expectedResponse = "myResponse"; + when(httpResponse.getStatus()).thenReturn(202); + when(httpResponse.getBody()).thenReturn(expectedResponse); + when(httpResponse.getRawBody()).thenReturn(toInputStream(expectedResponse, StandardCharsets.UTF_8)); + final Map[] headersCapture = new Map[1]; + when(syncRestClient.post(anyString(), anyMap(), any(), eq(String.class))).thenAnswer( + invocation -> { + headersCapture[0] = (Map)invocation.getArguments()[1]; + return httpResponse; + }); + + return headersCapture; + } + + @DataProvider public Object[][] aaiMethods() { return Stream.<ThrowingConsumer<AAIRestInterface>>of( @@ -201,17 +277,25 @@ public class OutgoingRequestHeadersTest { // // } - private Object verifyXEcompRequestIdHeaderWasAdded(Invocation.Builder fakeBuilder) { + private String verifyXEcompRequestIdHeaderWasAdded(Invocation.Builder fakeBuilder) { final String requestIdHeader = "x-ecomp-requestid"; return assertRequestHeaderIsUUID(fakeBuilder, requestIdHeader); } - private Object assertRequestHeaderIsUUID(Invocation.Builder fakeBuilder, String headerName) { + private String assertRequestHeaderIsUUID(Invocation.Builder fakeBuilder, String headerName) { Object headerValue = captureHeaderKeyAndReturnItsValue(fakeBuilder, headerName); + return assertRequestHeaderIsUUID(headerName, headerValue); + } + + private String assertRequestHeaderIsUUID(Map headers, String headerName) { + return assertRequestHeaderIsUUID(headerName, headers.get(headerName)); + } + + private String assertRequestHeaderIsUUID(String headerName, Object headerValue) { final String uuidRegex = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; assertThat("header '" + headerName + "' should be a uuid", headerValue, allOf(instanceOf(String.class), hasToString(matchesPattern(uuidRegex)))); - return headerValue; + return (String)headerValue; } private void verifyXOnapPartnerNameHeaderWasAdded(Invocation.Builder fakeBuilder) { diff --git a/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java index 40546e967..20c9d1443 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java @@ -21,8 +21,52 @@ package org.onap.vid.services; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.stream.Collectors.toList; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.both; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.mockito.Mockito.when; +import static org.onap.vid.job.Job.JobStatus.COMPLETED; +import static org.onap.vid.job.Job.JobStatus.COMPLETED_WITH_ERRORS; +import static org.onap.vid.job.Job.JobStatus.COMPLETED_WITH_NO_ACTION; +import static org.onap.vid.job.Job.JobStatus.CREATING; +import static org.onap.vid.job.Job.JobStatus.FAILED; +import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS; +import static org.onap.vid.job.Job.JobStatus.PAUSE; +import static org.onap.vid.job.Job.JobStatus.PENDING; +import static org.onap.vid.job.Job.JobStatus.PENDING_RESOURCE; +import static org.onap.vid.job.Job.JobStatus.RESOURCE_IN_PROGRESS; +import static org.onap.vid.job.Job.JobStatus.STOPPED; +import static org.onap.vid.testUtils.TestUtils.generateRandomAlphaNumeric; +import static org.onap.vid.utils.Streams.not; +import static org.testng.Assert.assertNotNull; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertFalse; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import java.lang.reflect.Method; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentSkipListSet; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeoutException; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; +import javax.inject.Inject; import org.apache.commons.lang.RandomStringUtils; import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; @@ -37,20 +81,21 @@ import org.mockito.MockitoAnnotations; import org.onap.portalsdk.core.domain.support.DomainVo; import org.onap.portalsdk.core.service.DataAccessService; import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.vid.config.DataSourceConfig; +import org.onap.vid.config.JobAdapterConfig; import org.onap.vid.exceptions.GenericUncheckedException; import org.onap.vid.exceptions.OperationNotAllowedException; import org.onap.vid.job.Job; import org.onap.vid.job.JobAdapter; +import org.onap.vid.job.JobAdapter.AsyncJobRequest; import org.onap.vid.job.JobType; import org.onap.vid.job.JobsBrokerService; import org.onap.vid.job.command.JobCommandFactoryTest; import org.onap.vid.job.impl.JobDaoImpl; import org.onap.vid.job.impl.JobSchedulerInitializer; +import org.onap.vid.job.impl.JobSharedData; import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl; -import org.onap.vid.services.VersionService; import org.onap.vid.utils.DaoUtils; -import org.onap.vid.config.DataSourceConfig; -import org.onap.vid.config.JobAdapterConfig; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.testng.Assert; @@ -59,31 +104,6 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import javax.inject.Inject; -import java.lang.reflect.Method; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.*; -import java.util.concurrent.*; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static java.util.stream.Collectors.toList; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.both; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.mockito.Mockito.when; -import static org.onap.vid.job.Job.JobStatus.*; -import static org.onap.vid.utils.Streams.not; -import static org.onap.vid.testUtils.TestUtils.generateRandomAlphaNumeric; -import static org.testng.Assert.assertNotNull; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertFalse; - @ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, JobAdapterConfig.class}) public class JobsBrokerServiceTest extends AbstractTestNGSpringContextTests { @@ -944,4 +964,40 @@ public class JobsBrokerServiceTest extends AbstractTestNGSpringContextTests { broker.delete(new UUID(111, 111)); } + public static class MockAsyncRequest implements AsyncJobRequest { + public String value; + + public MockAsyncRequest() {} + + public MockAsyncRequest(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + } + + @Test + public void twoJobsWithSamePosition_bothJobsArePulled(){ + UUID uuid = UUID.randomUUID(); + int positionInBulk = RandomUtils.nextInt(); + String userId = "userId"; + + Optional<Job> firstPulledJob = createAddAndPullJob(uuid, positionInBulk, userId, "first value"); + Optional<Job> secondPulledJob = createAddAndPullJob(uuid, positionInBulk, userId, "second value"); + + MockAsyncRequest firstValue = (MockAsyncRequest) firstPulledJob.get().getSharedData().getRequest(); + MockAsyncRequest secondValue = (MockAsyncRequest) secondPulledJob.get().getSharedData().getRequest(); + assertThat(ImmutableList.of(firstValue.value, secondValue.value), + containsInAnyOrder("first value", "second value")); + } + + private Optional<Job> createAddAndPullJob(UUID uuid, int positionInBulk, String userId, String s) { + JobDaoImpl job1 = createNewJob(positionInBulk, uuid, userId, CREATING, null, + LocalDateTime.now().minusSeconds(1), false); + job1.setSharedData(new JobSharedData(null, userId, new MockAsyncRequest(s), "testApi")); + broker.add(job1); + return broker.pull(CREATING, userId); + } } diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java index 180685282..5ffd24253 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetAAIServiceDesignAndCreationPut.java @@ -208,6 +208,7 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { " {" + " \"model-version-id\": \"0903e1c0-8e03-4936-b5c2-260653b96413\"," + " \"model-name\": \"action-data\"," + + " \"orchestration-type\": \"a la carte\"," + " \"model-version\": \"1.0\"," + " \"model-description\": \"honor immunity exile prong below misshapen\"," + " \"resource-version\": \"4076846985447\"" + @@ -226,6 +227,7 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { " {" + " \"model-version-id\": \"666a06ee-4b57-46df-bacf-908da8f10c3f\"," + " \"model-name\": \"multicast-configuration\"," + + " \"orchestration-type\": \"a la carte\"," + " \"model-version\": \"1.0\"," + " \"model-description\": \"python bullwhip appointment computation ambidextrous heaving\"," + " \"resource-version\": \"1500136282691\"" + @@ -244,6 +246,7 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { " {" + " \"model-version-id\": \"20c4431c-246d-11e7-93ae-92361f002671\"," + " \"model-name\": \"vSAMP10aDEV::base::module-0\"," + + " \"orchestration-type\": \"a la carte\"," + " \"model-version\": \"2\"," + " \"model-description\": \"MSO aLaCarte VF vSAMP10aDEV Base\"," + " \"resource-version\": \"1492627634300\"" + @@ -262,6 +265,7 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { " {" + " \"model-version-id\": \"797a6c41-0f80-4d35-a288-3920c4e06baa\"," + " \"model-name\": \"CONTRAIL30_L2NODHCP\"," + + " \"orchestration-type\": \"macro\"," + " \"model-version\": \"1.0\"," + " \"model-description\": \"contrail 3.0.x L2 network for AIC 3.x sites (and No DHCP).\"," + " \"resource-version\": \"1492814035003\"," + @@ -307,6 +311,7 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { " {" + " \"model-version-id\": \"f1bde010-cc5f-4765-941f-75f15b24f9fc\"," + " \"model-name\": \"BkVmxAv061917..base_vPE_AV..module-0\"," + + " \"orchestration-type\": \"macro\"," + " \"model-version\": \"2\"," + " \"resource-version\": \"1497897268769\"," + " \"relationship-list\": {" + @@ -351,6 +356,7 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { " {" + " \"model-version-id\": \"ipe-resource-id-ps-02\"," + " \"model-name\": \"abc\"," + + " \"orchestration-type\": \"macro\"," + " \"model-version\": \"v1.0\"," + " \"resource-version\": \"1493389520357\"," + " \"relationship-list\": {" + @@ -395,6 +401,7 @@ public class PresetAAIServiceDesignAndCreationPut extends BaseAAIPreset { " {" + " \"model-version-id\": \"lmoser410-connector-model-version-id\"," + " \"model-name\": \"connector\"," + + " \"orchestration-type\": \"macro\"," + " \"model-version\": \"v1.0\"," + " \"resource-version\": \"1493389444766\"" + " }" + 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 6a15d8961..312c3fd99 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 @@ -50,6 +50,7 @@ public enum Features implements Feature { FLAG_PNP_INSTANTIATION, FLAG_HANDLE_SO_WORKFLOWS, FLAG_CREATE_ERROR_REPORTS, + FLAG_SHOW_ORCHESTRATION_TYPE, FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT, FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG, FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH, diff --git a/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java b/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java index febbe6e83..de69e0047 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/BrowseASDCPage.java @@ -37,7 +37,7 @@ public class BrowseASDCPage extends VidBasePage { } public int countCurrentRowsInTable(){ - List<WebElement> rowsInTable = Get.byClass("alt-row"); + List<WebElement> rowsInTable = Get.byClass("sdcServiceModel"); return rowsInTable.size(); } diff --git a/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java b/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java index 7290204d6..43dd68f06 100644 --- a/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java +++ b/vid-automation/src/main/java/vid/automation/test/sections/VidBasePage.java @@ -4,10 +4,7 @@ import com.aventstack.extentreports.Status; import org.junit.Assert; import org.onap.sdc.ci.tests.execute.setup.ExtentTestActions; import org.onap.sdc.ci.tests.utilities.GeneralUIUtils; -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; +import org.openqa.selenium.*; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import vid.automation.test.Constants; @@ -113,6 +110,17 @@ public class VidBasePage { return this; } + public boolean isModelWithGivenServiceUUIDVisible(String serviceUUID) { + String elementTestId = Constants.DEPLOY_BUTTON_TESTS_ID_PREFIX + serviceUUID; + try { + GeneralUIUtils.getWebElementByTestID(elementTestId, 10); + GeneralUIUtils.ultimateWait(); + } catch (TimeoutException te) { + return false; + } + return true; + } + public void screenshotDeployDialog(String serviceUUID) { try { GeneralUIUtils.ultimateWait(); diff --git a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java index f082044fd..eb08c1f2a 100644 --- a/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java +++ b/vid-automation/src/main/java/vid/automation/test/test/BrowseASDCTest.java @@ -31,8 +31,9 @@ import java.util.List; import static org.hamcrest.MatcherAssert.assertThat; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; -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_SHOW_ORCHESTRATION_TYPE; +import static vid.automation.test.infra.Features.FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI; import static vid.automation.test.infra.ModelInfo.*; @@ -479,4 +480,39 @@ public class BrowseASDCTest extends CreateInstanceDialogBaseTest { assertFalse(Exists.tagNameInAnotherElement(serviceModelsTbody, "tr"), "Table should be empty on empty results"); resetGetServicesCache(); } + + private static final String[] macroModelsIds = { + "f1bde010-cc5f-4765-941f-75f15b24f9fc", + "lmoser410-connector-model-version-id", + "ipe-resource-id-ps-02", + "797a6c41-0f80-4d35-a288-3920c4e06baa", + }; + private static final String[] alacarteModelsIds = { + "0903e1c0-8e03-4936-b5c2-260653b96413", + "666a06ee-4b57-46df-bacf-908da8f10c3f", + "20c4431c-246d-11e7-93ae-92361f002671", + }; + + @DataProvider + public static Object[][] filterOrchestrationType() { + return new Object[][]{{"a la carte", 3, alacarteModelsIds},{"macro", 4, macroModelsIds}}; + } + + @Test(dataProvider = "filterOrchestrationType") + @FeatureTogglingTest(FLAG_SHOW_ORCHESTRATION_TYPE) + public void browseSdcModel_filterModelsWithOrchestrationType_alacarte( + String orchestrationType,int numberOfOccurrence, String[] expectedModelsIds) { + resetGetServicesCache(); + SimulatorApi.clearAll(); + BrowseASDCPage browseAsdcPage = registerSimulatorAndGoToBrowseSDC(); + GeneralUIUtils.ultimateWait(); + assertThat(browseAsdcPage.countCurrentRowsInTable(),(Matchers.greaterThan(numberOfOccurrence))); + browseAsdcPage.fillFilterText(orchestrationType); + Assert.assertEquals(browseAsdcPage.countCurrentRowsInTable(),numberOfOccurrence); + for(String id : expectedModelsIds) { + Assert.assertTrue(browseAsdcPage.isModelWithGivenServiceUUIDVisible(id)); + } + browseAsdcPage.fillFilterText(""); + } + } diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java index 69267fd4d..6709771a5 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java @@ -99,6 +99,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + + " \"orchestrationType\": null,\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + " }, {\n" + @@ -112,6 +113,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_ERROR\",\n" + + " \"orchestrationType\": null,\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + " }, {\n" + @@ -124,6 +126,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lifecycleState\": null,\n" + " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + + " \"orchestrationType\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + @@ -138,6 +141,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + + " \"orchestrationType\": null,\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + " }, {\n" + @@ -151,6 +155,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + + " \"orchestrationType\": null,\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + " }, {\n" + @@ -163,6 +168,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lifecycleState\": null,\n" + " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + + " \"orchestrationType\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + @@ -176,6 +182,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lifecycleState\": null,\n" + " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + + " \"orchestrationType\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + @@ -189,6 +196,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lifecycleState\": null,\n" + " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + + " \"orchestrationType\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + @@ -202,6 +210,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lifecycleState\": null,\n" + " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + + " \"orchestrationType\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + @@ -215,6 +224,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lifecycleState\": null,\n" + " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + + " \"orchestrationType\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + @@ -228,6 +238,7 @@ public class AaiApiTest extends BaseApiAaiTest { " \"lifecycleState\": null,\n" + " \"lastUpdaterUserId\": null,\n" + " \"lastUpdaterFullName\": null,\n" + + " \"orchestrationType\": null,\n" + " \"distributionStatus\": \"DISTRIBUTION_COMPLETE_OK\",\n" + " \"artifacts\": null,\n" + " \"resources\": null\n" + diff --git a/vid-automation/src/test/resources/features.properties b/vid-automation/src/test/resources/features.properties index 796c8be8d..63b9fc61b 100644 --- a/vid-automation/src/test/resources/features.properties +++ b/vid-automation/src/test/resources/features.properties @@ -35,4 +35,4 @@ FLAG_1908_MACRO_NOT_TRANSPORT_NEW_VIEW_EDIT = true FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH = false FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG = true FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE = false - +FLAG_SHOW_ORCHESTRATION_TYPE = false |