From 76a13e484dac0f4d5c80a10e8efeb540e52092ba Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Thu, 23 Aug 2018 09:06:09 -0400 Subject: Do not serialize AAIResultWrapper fixed a broken building block bpmn test removed serialization of result wrapper Change-Id: I24a9b325e5543cb11b0dee4ae3a1e6957469e87a Issue-ID: SO-894 Signed-off-by: Benjamin, Max (mb388a) --- .../subprocess/BuildingBlock/CreateNetworkBB.bpmn | 31 +++-------- .../BuildingBlock/UnassignNetworkBB.bpmn | 31 +++-------- .../subprocess/BuildingBlock/UpdateNetworkBB.bpmn | 61 ++++++++-------------- .../bpmn/subprocess/CreateNetworkBBTest.java | 4 +- .../bpmn/subprocess/CreateVolumeGroupBBTest.java | 2 - .../bpmn/subprocess/UnassignNetworkBBTest.java | 4 +- .../bpmn/subprocess/UpdateNetworkBBTest.java | 6 +-- .../infrastructure/aai/tasks/AAIQueryTasks.java | 44 +++++----------- 8 files changed, 60 insertions(+), 123 deletions(-) diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn index b91e2df8f7..0d2d829b6b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1maepy7 @@ -31,11 +31,7 @@ - - SequenceFlow_1maepy7 - SequenceFlow_06rq9pi - - + SequenceFlow_03ebe6c @@ -56,10 +52,9 @@ - SequenceFlow_06rq9pi + SequenceFlow_1maepy7 SequenceFlow_03ebe6c - @@ -121,14 +116,11 @@ - - - - + - + @@ -177,20 +169,13 @@ - + - - - - - - - - + - + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn index 208e41f174..fb250fc03f 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0zaz9o2 @@ -11,7 +11,7 @@ SequenceFlow_0csh9dc - + @@ -19,15 +19,10 @@ SequenceFlow_0csh9dc - SequenceFlow_1gd5h4c + SequenceFlow_0zaz9o2 SequenceFlow_0mxe1a7 - - - SequenceFlow_0zaz9o2 - SequenceFlow_1gd5h4c - SequenceFlow_0mxe1a7 @@ -37,9 +32,9 @@ - + - + @@ -52,10 +47,10 @@ - - + + - + @@ -85,16 +80,6 @@ - - - - - - - - - - diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn index 9f431212b1..daf0358683 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_074w2et @@ -14,20 +14,15 @@ - - SequenceFlow_1trqq6d - SequenceFlow_03janqs - SequenceFlow_1trqq6d - + - SequenceFlow_03janqs + SequenceFlow_1trqq6d SequenceFlow_1io4cl7 - SequenceFlow_1io4cl7 SequenceFlow_16fm47t @@ -107,32 +102,22 @@ - - - - + - + - - + + - + - - - - - - - @@ -167,42 +152,42 @@ - + - + - - + + - + - + - - + + - + - + - + - + - - + + - + diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java index cb3ab32884..13f8a6f812 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java @@ -36,7 +36,7 @@ public class CreateNetworkBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB",variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "QueryNetworkById_ServiceTask", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent"); assertThat(pi).isEnded(); } @@ -47,7 +47,7 @@ public class CreateNetworkBBTest extends BaseBPMNTest{ ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("createNetwork_startEvent","QueryNetworkById_ServiceTask") + .hasPassedInOrder("createNetwork_startEvent") .hasNotPassed("End Flow"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java index eb372fb6a7..57388efc2e 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java @@ -61,8 +61,6 @@ public class CreateVolumeGroupBBTest extends BaseBPMNTest{ .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter") .hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); assertThat(pi).isEnded(); - assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") - .hasNotPassed("Vnf_Adapter", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java index fd95e00031..b6f7cbeb48 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java @@ -36,7 +36,7 @@ public class UnassignNetworkBBTest extends BaseBPMNTest { public void sunnyDayAssignNetwork_Test() throws InterruptedException { ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB",variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_GetL3NetworkById","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","Task_DeleteNetwork","End_UnassignNetworkBB"); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","Task_DeleteNetwork","End_UnassignNetworkBB"); assertThat(pi).isEnded(); } @@ -46,7 +46,7 @@ public class UnassignNetworkBBTest extends BaseBPMNTest { ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("Start_UnassignNetworkBB", "Task_GetL3NetworkById", "Task_VfModuleRelatioship") + .hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship") .hasNotPassed("End_UnassignNetworkBB"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java index 853f713bd1..9fff0eb458 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java @@ -38,7 +38,7 @@ public class UpdateNetworkBBTest extends BaseBPMNTest { assertThat(processInstance).isNotNull(); assertThat(processInstance).isStarted().hasPassedInOrder( "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", - "QueryNetworkAAI", "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", + "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End"); assertThat(processInstance).isEnded(); } @@ -49,8 +49,8 @@ public class UpdateNetworkBBTest extends BaseBPMNTest { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); assertThat(processInstance).isStarted().hasPassedInOrder( - "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", - "QueryNetworkAAI", "QueryVpnBindingAAI") + "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", + "QueryVpnBindingAAI") .hasNotPassed("QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End"); assertThat(processInstance).isEnded(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java index beffa25249..0079b351f2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java @@ -49,7 +49,6 @@ import org.springframework.stereotype.Component; public class AAIQueryTasks { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIQueryTasks.class); - private static final String NETWORK_RESULT_WRAPPER_KEY = "l3NetworkAAIResultWrapper"; private static final String ERROR_MSG = "No relationships were returned from AAIResultWrapper.getRelationships()"; @Autowired private ExtractPojosForBB extractPojosForBB; @@ -58,23 +57,6 @@ public class AAIQueryTasks { @Autowired private AAINetworkResources aaiNetworkResources; private static final ModelMapper modelMapper = new ModelMapper(); - - /** - * BPMN access method to query L3Network object in AAI by it's Id - * - * @param execution - * @throws Exception - */ - public void getNetworkWrapperById(BuildingBlockExecution execution) { - try { - L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, - execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); - execution.setVariable(NETWORK_RESULT_WRAPPER_KEY, aaiResultWrapper); - } catch (Exception ex) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } /** * BPMN access method to query data for VPN bindings from the AAI result wrapper. @@ -85,9 +67,9 @@ public class AAIQueryTasks { public void queryNetworkVpnBinding(BuildingBlockExecution execution) { try { - org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - - AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional networkRelationships = aaiResultWrapper.getRelationships(); if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); @@ -120,7 +102,9 @@ public class AAIQueryTasks { public void getNetworkVpnBinding(BuildingBlockExecution execution) { try { - AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest"); Optional networkRelationships = aaiResultWrapper.getRelationships(); @@ -174,9 +158,9 @@ public class AAIQueryTasks { */ public void queryNetworkPolicy(BuildingBlockExecution execution) { try { - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - - AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional networkRelationships = aaiResultWrapper.getRelationships(); if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); @@ -187,7 +171,7 @@ public class AAIQueryTasks { for(AAIResourceUri netPolicyUri : netPoliciesUriList) { Optional oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri); if(oNetPolicy.isPresent()) { - l3Network.getNetworkPolicies().add(modelMapper.map(oNetPolicy.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy.class)); + l3network.getNetworkPolicies().add(modelMapper.map(oNetPolicy.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy.class)); } } } @@ -205,9 +189,9 @@ public class AAIQueryTasks { */ public void queryNetworkTableRef(BuildingBlockExecution execution) { try { - L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID)); - - AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY); + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); Optional networkRelationships = aaiResultWrapper.getRelationships(); if (!networkRelationships.isPresent()) { throw (new Exception(ERROR_MSG)); @@ -219,7 +203,7 @@ public class AAIQueryTasks { Optional oRouteTableReference = aaiNetworkResources.getRouteTable(routeTableUri); if(oRouteTableReference.isPresent()) { org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference mappedRouteTableReference = modelMapper.map(oRouteTableReference.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference.class); - l3Network.getContrailNetworkRouteTableReferences().add(mappedRouteTableReference); + l3network.getContrailNetworkRouteTableReferences().add(mappedRouteTableReference); } } } -- cgit 1.2.3-korg