From a339f93a736c9503888d05e47d79b173229042fc Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Tue, 5 Mar 2019 16:56:09 -0500 Subject: 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) --- .../tasks/BBInputSetupMapperLayerTest.java | 18 ++++++++++++++++++ .../servicedecomposition/tasks/BBInputSetupTest.java | 19 +++++++++++++++++-- .../tasks/BBInputSetupUtilsTest.java | 4 ++-- 3 files changed, 37 insertions(+), 4 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/test/java/org') 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 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); -- cgit 1.2.3-korg