diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-01-12 09:12:23 -0500 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2021-08-04 08:55:43 -0400 |
commit | 30106b39d2ac1bc206134cfcb8fc73eb1f29b923 (patch) | |
tree | be83e5d35925fdd87c39cba7607feaefc23c34b5 /bpmn/MSOCommonBPMN/src/test | |
parent | 872613eafe80034cca612bd93294286b3dbed4b1 (diff) |
Add new endpoint and macro for service upgrade
This enables upgrading an existing service instance by
updating its model UUID's in AAI and md-sal.
Issue-ID: SO-3636
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Change-Id: Ic5f067a1267053a61f46e2d9563ca4e4ac869bdf
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
2 files changed, 57 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 8961c996a8..b561055468 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -46,6 +46,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Assert; import org.junit.Rule; @@ -2984,6 +2985,31 @@ public class BBInputSetupTest { } @Test + public void testGetGBBMacroExistingServiceUpgrade() throws Exception { + String requestAction = "upgradeInstance"; + GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), + GeneralBuildingBlock.class); + ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), + ExecuteBuildingBlock.class); + RequestDetails requestDetails = mapper + .readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceUpgrade.json"), RequestDetails.class); + Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap(); + executeBB.setRequestDetails(requestDetails); + + doReturn(new Service()).when(SPY_bbInputSetupUtils) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + doReturn(new org.onap.aai.domain.yang.ServiceInstance()).when(SPY_bbInputSetupUtils) + .getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID)); + doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class)); + + SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, + executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null); + + verify(SPY_bbInputSetupUtils, times(1)) + .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); + } + + @Test public void testGetGBBMacroExistingServiceServiceinstancenotFoundInAai() throws Exception { ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceUpgrade.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceUpgrade.json new file mode 100644 index 0000000000..2a721ddd96 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_serviceUpgrade.json @@ -0,0 +1,31 @@ +{ + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "Sample Service Upgrade", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "TEST" + }, + "project": { + "projectName": "projectName" + }, + "subscriberInfo": { + "globalSubscriberId": "subscriberId" + }, + "requestInfo": { + "instanceName": "test_Service", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "aLaCarte": false, + "userParams": [] + } +} |