diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-03-05 16:56:09 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-03-06 10:29:49 -0500 |
commit | a339f93a736c9503888d05e47d79b173229042fc (patch) | |
tree | 4b8f1f89e2d20e4f251422f8538bbe5fdb920bbd /bpmn/MSOCommonBPMN/src/test | |
parent | 91426ec9f221e288ea3f54fa62030e6f17420b90 (diff) |
improvements to audit inventory feature
Adjust test data to add tenant mapping
Remove unused unit test already renamed
Update logic, to pass hostname not pservername
remove unused file that has been refactored
Add project to ignore, remove class
Address issues in comments on pull request
Remove logging that is not needed, used
UPdate BPMN to use Boolean Value, change timings
Adjust BPMN to not hit deadlock scenario
put error message in execution before checking rollback
- removed extra code for vnf resource processing found in onap
environment.
Fix improper use of inclusive gateway causing deadlock
Fix flakey unit tests from ONAP
Remove qualifier on bean, as it breaks callbacks
Adjust pom version of external camunda client
Fix polling timers to be more reasonable
Updated Junit test for delete vf module in onap.
Changed auditInventoryNeeded variable to a boolean to prevent
bpmn from erroring out in the event this variable is not found
on the execution.
Update logic to support writing of self link
Change-Id: I2f784a0a58a09f303775282c9be6019031668570
Issue-ID: SO-1597
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
6 files changed, 49 insertions, 4 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 3cb7b241dc..7e4afb7a12 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -50,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; @@ -604,6 +605,23 @@ public class BBInputSetupMapperLayerTest { assertThat(actual, sameBeanAs(expected)); } + + @Test + public void testMapTenant() { + Tenant expected = new Tenant(); + expected.setTenantId("tenantId"); + expected.setTenantName("tenantName"); + expected.setTenantContext("tenantContext"); + + org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant(); + aaiTenant.setTenantId("tenantId"); + aaiTenant.setTenantName("tenantName"); + aaiTenant.setTenantContext("tenantContext"); + + Tenant actual = bbInputSetupMapperLayer.mapTenant(aaiTenant); + + assertThat(actual, sameBeanAs(expected)); + } @Test public void testMapCloudRegionWithNullCheck() { 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 cea8fc3cc2..d7c681b938 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 @@ -787,7 +787,9 @@ public class BBInputSetupTest { ServiceInstance serviceInstance = mapper.readValue( new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), ServiceInstance.class); - + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + cloudConfiguration.setTenantId("tenantId"); + requestDetails.setCloudConfiguration(cloudConfiguration); OrchestrationContext orchestrationContext = new OrchestrationContext(); orchestrationContext.setIsRollbackEnabled(false); @@ -808,17 +810,30 @@ public class BBInputSetupTest { customer.setSubscriberName("subscriberName"); customer.setSubscriberType("subscriberType"); customer.setServiceSubscription(serviceSubscription); + + org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant tenant = new org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant(); + tenant.setTenantContext("tenantContext"); + tenant.setTenantId("tenantId"); + tenant.setTenantName("tenantName"); org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); + org.onap.aai.domain.yang.Tenants aaiTenants = Mockito.mock(org.onap.aai.domain.yang.Tenants.class); + org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant(); + aaiTenant.setTenantId("tenantId"); + List<org.onap.aai.domain.yang.Tenant> tenants = new ArrayList<>(); + tenants.add(aaiTenant); String requestAction = "createInstance"; - + doReturn(uriKeys).when(SPY_bbInputSetupUtils).getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); doReturn(customer).when(SPY_bbInputSetup).mapCustomer(uriKeys.get("global-customer-id"),uriKeys.get("service-type")); doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails); doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails); doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion); + doReturn(tenant).when(bbInputSetupMapperLayer).mapTenant(aaiTenant); + doReturn(aaiTenants).when(aaiCloudRegion).getTenants(); + doReturn(tenants).when(aaiTenants).getTenant(); GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index ae1af8f960..d1d66ae28d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -181,10 +181,10 @@ public class BBInputSetupUtilsTest { expected.get().setCloudRegionId("lcpCloudRegionId"); doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.CloudRegion.class, AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), - cloudConfig.getLcpCloudRegionId())); + cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO)); AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), - cloudConfig.getLcpCloudRegionId()); + cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO); bbInputSetupUtils.getCloudRegion(cloudConfig); verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json index a53ed4dfde..fe33308d78 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json @@ -16,6 +16,8 @@ "cloudRegion": { "lcp-cloud-region-id" : "myRegionId", "cloud-owner": "CloudOwner" + }, + "tenant": { }, "userInput": null, "customer": { diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json index 5eb9a26901..b18cad0620 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json @@ -44,6 +44,11 @@ "tenant-id": "tenantId", "complex": "complexName" }, + "tenant": { + "tenant-name": "tenantName", + "tenant-context": "tenantContext", + "tenant-id": "tenantId" + }, "userInput": null, "customer": { "global-customer-id": "globalCustomerId", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json index 5ac07c6546..f07f060b06 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json @@ -55,6 +55,11 @@ "complex": "complexName" }, "userInput": null, + "tenant": { + "tenant-id": "tenantId", + "tenant-name": "tenantName", + "tenant-context": "tenantContext" + }, "customer": { "global-customer-id": "globalCustomerId", "subscriber-name": "subscriberName", |