From b6b7bef8bdcad15af01ac88a038dd763ce59f68f Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 11 Apr 2017 13:30:42 +0200 Subject: [MSO-8] Update the maven dependency Update the maven depenency for sdc-distribution-client to cooperate with the sdc changes. Change-Id: I2da936e5c40cb68c7181bb78307192dd5655b5dc Signed-off-by: xg353y --- .../mso/bpmn/common/scripts/AaiUtilTest.groovy | 318 ++++ .../common/scripts/CommonExceptionUtilTest.groovy | 201 +++ .../common/scripts/CompleteMsoProcessTest.groovy | 219 +++ .../bpmn/common/scripts/ExceptionUtilTest.groovy | 190 +++ .../bpmn/common/scripts/FalloutHandlerTest.groovy | 311 ++++ .../mso/bpmn/common/scripts/MsoGroovyTest.groovy | 72 + .../mso/bpmn/common/scripts/MsoUtilsTest.groovy | 233 +++ .../mso/bpmn/common/scripts/SDNCAdapterTest.groovy | 948 +++++++++++ .../mso/bpmn/common/scripts/VidUtilsTest.groovy | 972 +++++++++++ .../org/openecomp/mso/bpmn/common/BPMNUtil.java | 214 +++ .../mso/bpmn/common/CompleteMsoProcessTest.java | 207 +++ .../bpmn/common/ConfirmVolumeGroupNameTest.java | 133 ++ .../bpmn/common/ConfirmVolumeGroupTenantTest.java | 91 + .../mso/bpmn/common/CreateAAIVfModuleTest.java | 277 +++ .../common/CreateAAIVfModuleVolumeGroupTest.java | 136 ++ .../mso/bpmn/common/DeleteAAIVfModuleTest.java | 643 +++++++ .../mso/bpmn/common/FalloutHandlerTest.java | 226 +++ .../mso/bpmn/common/GenericDeleteServiceTest.java | 279 +++ .../mso/bpmn/common/GenericDeleteVnfTest.java | 221 +++ .../mso/bpmn/common/GenericGetServiceTest.java | 505 ++++++ .../mso/bpmn/common/GenericGetVnfTest.java | 191 +++ .../mso/bpmn/common/GenericPutVnfTest.java | 182 ++ .../bpmn/common/PrepareUpdateAAIVfModuleTest.java | 208 +++ .../mso/bpmn/common/SDNCAdapterCallbackRule.java | 64 + .../mso/bpmn/common/SDNCAdapterV1Test.java | 389 +++++ .../mso/bpmn/common/UpdateAAIGenericVnfTest.java | 171 ++ .../mso/bpmn/common/UpdateAAIVfModuleTest.java | 137 ++ .../mso/bpmn/common/VnfAdapterRestV1Test.java | 389 +++++ .../mso/bpmn/common/WorkflowAsyncResourceTest.java | 96 ++ .../mso/bpmn/common/WorkflowContextHolderTest.java | 97 ++ .../openecomp/mso/bpmn/common/WorkflowTest.java | 1796 ++++++++++++++++++++ .../mso/bpmn/common/WorkflowTestTransformer.java | 21 + .../sdncCreateNetworkTopologySim500Response.xml | 25 + ...CreateNetworkTopologySimResponse_noExtraTag.xml | 17 + .../__files/CRTGVNF_queryAAIResponseVolume.xml | 22 + .../CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml | 22 + ...IVE_CAMUNDA_HISTORY-Default Store Procedure.sql | 140 ++ ...OLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql | 210 +++ .../Archive/drop_mariadb_engine_7.5.6.sql | 76 + .../Archive/mariadb_engine_7.5_patch_7.5.6.sql | 222 +++ .../Cleanup/create_mariadb_camunda7.5.6_ee.sql | 1127 ++++++++++++ .../upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql | 602 +++++++ .../sdncCreateNetworkTopologySimResponse.xml | 19 + ..._genericQueryByInstanceName_AAIResponse_200.xml | 13 + ...enericQueryByInstanceName_AAIResponse_Fault.xml | 15 + .../CreateVfModuleVolumeGroup_VID_request.json | 74 + .../__files/CreateVfModule_VID_request.json | 64 + .../test/resources/__files/Database/DBAdapter.xml | 1 + .../__files/Database/DBUpdateResponse.xml | 4 + .../sdncDeleteNetworkTopologySimResponse.xml | 19 + .../__files/DeleteVfModule_VID_request.json | 50 + .../__files/GENDSI_getServiceInstanceResponse.xml | 35 + .../GenericFlows/getGenericVnfByNameResponse.xml | 23 + .../__files/GenericFlows/getGenericVnfResponse.xml | 90 + .../getGenericVnfResponse_hasRelationships.xml | 90 + .../__files/GenericFlows/getSIUrlById.xml | 6 + .../__files/GenericFlows/getSIUrlByName.xml | 6 + .../__files/GenericFlows/getServiceInstance.xml | 30 + .../GenericFlows/getServiceSubscription.xml | 34 + .../__files/GenericFlows/getVceByNameResponse.xml | 97 ++ .../__files/GenericFlows/getVceResponse.xml | 97 ++ ...ance_PutServiceInstance_AAIResponse_Success.xml | 11 + .../__files/GenericPutServiceInstance/aaiFault.xml | 15 + .../SDNCAdapterV1/sdncadapterworkflowrequest.xml | 32 + .../sdncadaptercallbackrequest.xml | 350 ++++ .../UpdateNetworkV2/updateNetworkResponse_400.xml | 6 + .../UpdateNetworkV2/updateNetworkResponse_500.xml | 78 + .../updateNetworkResponse_Success.xml | 24 + .../updateNetwork_queryInstance_Success.xml | 4 + ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + .../sdncUpdateNetworkTopologySim500Response.xml | 25 + .../sdncUpdateNetworkTopologySimResponse.xml | 19 + .../AddNetworkPolicy_AAIResponse_Success.xml | 21 + .../CreateAAIVfModuleVolumeGroupRequest.xml | 6 + .../VfModularity/DoUpdateVfModuleRequest.xml | 29 + .../resources/__files/VfModularity/GenericVnf.xml | 38 + .../PrepareUpdateAAIVfModuleRequest.xml | 5 + .../QueryNetworkPolicy_AAIResponse_Success.xml | 21 + .../VfModularity/SDNCTopologyActivateCallback.xml | 13 + .../VfModularity/SDNCTopologyAssignCallback.xml | 13 + .../SDNCTopologyChangeAssignCallback.xml | 13 + .../VfModularity/SDNCTopologyQueryCallback.xml | 315 ++++ .../SDNCTopologyQueryCallbackVfModule.xml | 141 ++ .../VfModularity/StandardSDNCSynchResponse.xml | 5 + .../VfModularity/UpdateAAIGenericVnfRequest.xml | 5 + .../VfModularity/UpdateAAIVfModuleRequest.xml | 10 + .../__files/VfModularity/UpdateVfModuleRequest.xml | 35 + .../VfModularity/VNFAdapterRestCreateCallback.xml | 55 + .../VfModularity/VNFAdapterRestUpdateCallback.xml | 16 + .../VNFAdapterRestVolumeGroupCallback.xml | 15 + .../__files/VfModularity/VfModule-lukewarm.xml | 10 + .../__files/VfModularity/VfModule-new.xml | 9 + .../__files/VfModularity/VfModule-supercool.xml | 27 + .../resources/__files/VfModularity/VolumeGroup.xml | 25 + .../resources/__files/aai-volume-group-id-info.xml | 28 + .../src/test/resources/__files/aaiFault.xml | 15 + .../vnfAdapterMocks/vnfCreateSimResponse.xml | 29 + .../vnfAdapterMocks/vnfDeleteSimResponse.xml | 11 + .../vnfAdapterMocks/vnfQuerySimResponse.xml | 20 + .../vnfAdapterMocks/vnfRollbackSimResponse.xml | 11 + .../src/test/resources/camunda.cfg.xml | 61 + .../src/test/resources/logging.properties | 2 + .../src/test/resources/mso.bpmn.properties | 3 + .../src/test/resources/mso.bpmn.urn.properties | 86 + .../test/resources/sdncCallbackErrorResponse.xml | 1 + .../src/test/resources/sdncDeleteResponse.xml | 212 +++ .../test/resources/sdncadaptercallbackrequest.xml | 342 ++++ .../sdncadaptercallbackrequest_404CallBack.xml | 13 + .../sdncadaptercallbackrequestdata-nonfinal.text | 42 + .../resources/sdncadaptercallbackrequestdata.text | 42 + .../resources/sdncadapterworkflowrequest-act.xml | 33 + .../test/resources/sdncadapterworkflowrequest.xml | 32 + .../src/test/resources/testAsyncResource.bpmn | 81 + .../resources/vnfAdapter/vnfUpdateSimResponse.xml | 22 + 116 files changed, 15957 insertions(+) create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/logging.properties create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml (limited to 'bpmn/MSOCommonBPMN/src/test') diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy new file mode 100644 index 0000000..7d698f8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy @@ -0,0 +1,318 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.openecomp.mso.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.openecomp.mso.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + +@RunWith(MockitoJUnitRunner.class) +class AaiUtilTest extends MsoGroovyTest { + + @Test + public void testGetVersionDefault() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('8', version) + } + + @Test + public void testGetVersionResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('7', version) + } + + @Test + public void testGetVersionFlowSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_custom_CreateAAIVfModule_aai_version")).thenReturn('6') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('6', version) + } + + @Test(expected=java.lang.Exception.class) + public void testGetVersionNotDefined() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + } + + @Test + public void testGetUriDefaultVersion() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetUriFlowAndResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_CreateAAIVfModule_aai_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v6/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetNetworkGenericVnfEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint) + } + + @Test + public void testGetNetworkGenericVnfUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution) + assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri) + } + + @Test + public void testGetNetworkVpnBindingUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn('/aai/v8/network/vpn-bindings/vpn-binding') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution) + assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri) + } + + @Test + public void testGetNetworkPolicyUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn('/aai/v8/network/network-policies/network-policy') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkPolicyUri(mockExecution) + assertEquals('/aai/v8/network/network-policies/network-policy', uri) + } + + @Test + public void testGetNetworkTableReferencesUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_route_table_reference_uri")).thenReturn('/aai/v8/network/route-table-references/route-table-reference') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution) + assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri) + } + + @Test + public void testGetNetworkVceUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vce_uri")).thenReturn('/aai/v8/network/vces/vce') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVceUri(mockExecution) + assertEquals('/aai/v8/network/vces/vce', uri) + } + + @Test + public void testGetNetworkL3NetworkUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetBusinessCustomerUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_customer_uri")).thenReturn('/aai/v8/business/customers/customer') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getBusinessCustomerUri(mockExecution) + assertEquals('/aai/v8/business/customers/customer', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureVolumeGroupUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_volume_group_uri")).thenReturn('/aai/v8/cloud-infrastructure/volume-groups/volume-group') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureVolumeGroupUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/volume-groups/volume-group', uri) + } + + @Test + public void testGetCloudInfrastructureTenantUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_tenant_uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri) + } + + @Test + public void testGetSearchNodesQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryUri(mockExecution) + assertEquals('/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchNodesQueryEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchGenericQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_query_uri")).thenReturn('/aai/v8/search/generic-query') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchGenericQueryUri(mockExecution) + assertEquals('/aai/v8/search/generic-query', uri) + } + + @Test + public void testGetNamespaceFromUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v6', ns) + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy new file mode 100644 index 0000000..abb3697 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy @@ -0,0 +1,201 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts + +import org.junit.Assert +import org.junit.Ignore +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.CommonExceptionUtil; +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + +class CommonExceptionUtilTest { + + def aotsFault =""" + xml:space + String + http://csi.att.com + + + + 400 + bad stuff + + + String + *** ERROR *** + String + String + String + String + + String + String + + String + String + String + String + + + + + + String + *** ERROR *** + String + String + String + String + String + String + String + + +""" + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + @Ignore + public void testMapAAIExceptionTCommonException() { + + + + String restFault = """ + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + + """ + def errorString = """ + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + +""" as String + + + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + CommonExceptionUtil util = new CommonExceptionUtil() + Assert.assertEquals(errorString, util.mapAAIExceptionTCommonException(restFault, mockExecution)) + } + + + + + @Test + public void testBuildException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + + CommonExceptionUtil util = new CommonExceptionUtil() + String msg = "Bad request" + String errorString = """ + + SVC2000 + The following service error occurred: %1. Error code is %2. + var1 + var2 + +""" + Assert.assertEquals(errorString, util.buildException(msg, mockExecution)) + } + + @Test + public void testMapAOTSExecptionToCommonException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + + CommonExceptionUtil util = new CommonExceptionUtil() + String errorString = """ + + SVC2000 + The following service error occurred: %1. Error code is %2. + Received error from AOTS: bad stuff + 400 + +""" + Assert.assertEquals(errorString, util.mapAOTSExecptionToCommonException(aotsFault, mockExecution)) + } + + + @Test + public void testParseError() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + String errorString = "The following service error occurred: %1. Error code is %2." + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_errTxt")).thenReturn(errorString) + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + CommonExceptionUtil util = new CommonExceptionUtil() + + Assert.assertEquals("The following service error occurred: var1. Error code is var2.", util.parseError(mockExecution)) +} + + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy new file mode 100644 index 0000000..cd70fa9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy @@ -0,0 +1,219 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts + +import org.junit.runner.RunWith; +import static org.junit.Assert.* +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.core.WorkflowException + + +@RunWith(MockitoJUnitRunner.class) +class CompleteMsoProcessTest { + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String completeMsoProcessRequest = """ + + + uCPE1020_STUW105_5002 + Layer3ServiceActivateRequest + COMPLETE + OMX + http://localhost:28090/CCD/StatusNotification + 10205000 + 1 + + UCPELayer3ServiceActivateV1 + + """ + + + private String completeMsoProcessResponse = """ + BPEL UCPELayer3ServiceActivateV1 completed +""" + + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoProcessRequest) + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.preProcessRequest(mockExecution) + + /* Initialize all the process request variables in this block */ + verify(mockExecution).setVariable("prefix","CMSO_") + //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + verify(mockExecution).setVariable("CMSO_request_id","") + verify(mockExecution).setVariable("CMSO_notification-url","") + verify(mockExecution).setVariable("CMSO_mso-bpel-name","") + verify(mockExecution).setVariable("CMSO_request_action","") + + verify(mockExecution).setVariable("CMSO_notification-url-Ok", false) + verify(mockExecution).setVariable("CMSO_request_id-Ok", false) + + //updateRequest Adapter process variables + verify(mockExecution).setVariable("CMSO_updateRequestResponse", "") + verify(mockExecution).setVariable("CMSO_updateRequestResponseCode", "") + verify(mockExecution).setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") + + //Set DB adapter variables here + verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload", "") + verify(mockExecution).setVariable("CMSO_updateInfraRequestDBPayload", "") + verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") + + //Auth variables + verify(mockExecution).setVariable("BasicAuthHeaderValue","") + + //Response variables + verify(mockExecution).setVariable("CompletionHandlerResponse","") + verify(mockExecution).setVariable("CMSO_ErrorResponse", null) + verify(mockExecution).setVariable("CMSO_ResponseCode", "") + + verify(mockExecution).setVariable("CMSO_notification-url-Ok",true) + verify(mockExecution).setVariable("CMSO_request_id-Ok",true) + verify(mockExecution).setVariable("CMSO_notification-url","http://localhost:28090/CCD/StatusNotification") + verify(mockExecution).setVariable("CMSO_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("CMSO_request_action","Layer3ServiceActivateRequest") + verify(mockExecution).setVariable("CMSO_source","OMX") + + } + + @Test + public void testpostProcessResponse(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("UCPELayer3ServiceActivateV1") + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.postProcessResponse(mockExecution) + + verify(mockExecution).setVariable("CompleteMsoProcessResponse", completeMsoProcessResponse) + verify(mockExecution).setVariable("CMSO_ResponseCode","200") + } + + private String updateDBStatusToSuccessPayload = """ + + + + + testReqId + BPEL + COMPLETED + + + + """ + + @Test + public void testupdateDBStatusToSuccessPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.updateDBStatusToSuccessPayload(mockExecution) + + verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload",updateDBStatusToSuccessPayload) + } + + private String setUpdateDBstatustoSuccessPayload = """ + + + + + testReqId + BPEL + Resource Completed Successfully + COMPLETE + 100 + + + + """ + + @Test + public void testsetUpdateDBstatustoSuccessPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL") + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution) + + verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload",setUpdateDBstatustoSuccessPayload) + } + + private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> + BPEL BPEL-NAME FAILED +""" + +/* + private String msoCompletionResponse = """ + BPEL BPEL-NAME FAILED +""" +*/ + @Test + public void testbuildDataError(){ + + boolean thrown = false; + String msg = "Some-Message"; + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL-NAME") + when(mockExecution.getVariable("testProcessKey")).thenReturn("CompleteMsoProcess") + + WorkflowException exception = new WorkflowException("CompleteMsoProcess", 500, msg); + + try{ + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.buildDataError(mockExecution, msg) + } + catch (BpmnError e){ + thrown = true; + } + + + verify(mockExecution).setVariable("CompleteMsoProcessResponse",msoCompletionResponse) + // Can't seem to figure out how to verify the exception and have spent way too much time on fixing this test case! + //verify(mockExecution).setVariable("WorkflowException",exception) + assertTrue(thrown); + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy new file mode 100644 index 0000000..98bbe71 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy @@ -0,0 +1,190 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts + +import org.junit.Assert +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + +import org.junit.Ignore; + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + + + +class ExceptionUtilTest { + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testErrorMessageDetails() { + + + + String restFault = """ + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + + """ + def errorString = """ + Received error from A&AI (Error writing output performing PUTcustomer on SubName01 (msg=Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]) (ec=ERR.5.4.5105)) + 5000 + """ as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals(errorString, util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) + } + + + @Test + public void testErrorMessage() { + String restFault = """ + + 500 + HTTP method: GET Internal Server Error + + """ + def errorString = """ + Received error from A&AI (HTTP method: GET Internal Server Error) + 5000 + """ as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ErrorResponse")).thenReturn("HTTP method: GET Internal Server Error") + + ExceptionUtil util = new ExceptionUtil() + String msg = "HTTP method: GET Internal Server Error" + Assert.assertEquals(errorString, util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) + } + + @Test + public void testBadResponseErrorMessage() { + String restFault = "asfafasfasfd" + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ErrorResponse")).thenReturn(null) + ExceptionUtil util = new ExceptionUtil() + String expected = ""+ + "\n Received error from A&AI ()"+ + "\n 5000"+ + "\n "; + Assert.assertEquals(expected,util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) + } + + @Test + public void testMapErrorCode5010(){ + String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5010",util.MapErrorCode(msg)) + } + + @Test + public void testMapErrorCode5020(){ + String msg = "Connection timed out" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5020",util.MapErrorCode(msg)) + } + + @Test + public void testMapCategoryToErrorCode5100 () { + String errorCategory = "OPENSTACK" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals('5100', util.MapCategoryToErrorCode(errorCategory)) + } + + @Test + public void testMapCategoryToErrorCode5110 () { + String errorCategory = "IO" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals('5110', util.MapCategoryToErrorCode(errorCategory)) + } + + @Test + public void testMapCategoryToErrorCode7020 () { + String errorCategory = "USERDATA" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals('7020', util.MapCategoryToErrorCode(errorCategory)) + } + + @Test + @Ignore + public void testMapAdapterExecptionToWorkflowException_UserDataErrorMessage () { + String response = """USERDATACloud Site [CHCGILNE001] not found""" as String + String expected = """WorkflowException[processKey=ExceptionUtil,errorCode=7020,errorMessage=Received error from Tenant Adapter: Cloud Site [CHCGILNE001] not found]""" as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("testProcessKey")).thenReturn("ExceptionUtil") + + ExceptionUtil util = new ExceptionUtil() + String actual = util.MapAdapterExecptionToWorkflowException(response, mockExecution, "Tenant Adapter") + + verify(mockExecution).setVariable("WorkflowException",expected) + } + + @Test + @Ignore + public void testMapAdapterExecptionToWorkflowException_IOErrorMessage () { + String response = """IO[TokenAuth] Connect to test.aic.cip.att.com:5000 [test.aic.cip.att.com/300.200.100.100] failed: Connection refused""" as String + String expected = """WorkflowException[processKey=ExceptionUtil,errorCode=5110,errorMessage=Could not communicate with Platform Orchestrator]""" as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("testProcessKey")).thenReturn("ExceptionUtil") + + ExceptionUtil util = new ExceptionUtil() + String actual = util.MapAdapterExecptionToWorkflowException(response, mockExecution, "Tenant Adapter") + + verify(mockExecution).setVariable("WorkflowException",expected) + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy new file mode 100644 index 0000000..7f691ca --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy @@ -0,0 +1,311 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts + +import org.junit.runner.RunWith; +import static org.mockito.Mockito.* +import static org.junit.Assert.*; + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor; +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.MsoUtils; +import org.openecomp.mso.bpmn.common.scripts.FalloutHandler; + +@RunWith(MockitoJUnitRunner.class) +class FalloutHandlerTest { + + public MsoUtils utils = new MsoUtils() + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String falloutHandlerRequest = """ + + + uCPE1020_STUW105_5002 + Layer3ServiceActivateRequest + CANCEL + OMX + 10205000 + 1 + + + Some Error Message - Fallout Handler + Some Error Code - Fallout Handler + Some Source System Error Code- Fallout Handler + + + """ + + private String falloutHandlerResponse = """ + Fallout Handler Failed +""" + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.preProcessRequest(mockExecution) + + /* Initialize all the process request variables in this block */ + verify(mockExecution).setVariable("prefix","FH_") + //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + + //These variables are form the input Message to the BPMN + verify(mockExecution).setVariable("FH_request_id","") + verify(mockExecution).setVariable("FH_request_action","") + verify(mockExecution).setVariable("FH_notification-url","") + verify(mockExecution).setVariable("FH_mso-bpel-name","") + verify(mockExecution).setVariable("FH_ErrorCode", "") + verify(mockExecution).setVariable("FH_ErrorMessage", "") + + verify(mockExecution).setVariable("FH_notification-url-Ok", false) + verify(mockExecution).setVariable("FH_request_id-Ok", false) + + //These variables are for Get Mso Aai Password Adapter + verify(mockExecution).setVariable("FH_deliveryStatus", true) + + //update Response Status to pending ...Adapter variables + verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null) + verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null) + + //update Request Gamma ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "") + verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null) + verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null) + + //update Request Infra ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "") + verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null) + verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null) + + //assign False to success variable + verify(mockExecution).setVariable("FH_success", true) + + //Set notify status to Failed variable + verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS") + + //Set DB update variable + verify(mockExecution).setVariable("FH_updateRequestPayload", "") + verify(mockExecution).setVariable("FH_updateRequestResponse", null) + verify(mockExecution).setVariable("FH_updateRequestResponseCode", null) + + //Auth variables + verify(mockExecution).setVariable("BasicAuthHeaderValue","") + + //Response variables + verify(mockExecution).setVariable("FalloutHandlerResponse","") + verify(mockExecution).setVariable("FH_ErrorResponse", null) + verify(mockExecution).setVariable("FH_ResponseCode", "") + + verify(mockExecution).setVariable("FH_request_id-Ok",true) + verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest") + verify(mockExecution).setVariable("FH_source","OMX") + verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") + verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") + + } + + @Test + public void testpostProcessResponse(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("FH_success")).thenReturn(false) + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.postProcessResponse(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(1) + + assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + + verify(mockExecution).setVariable("FH_ResponseCode","500") + } + + private String updateRequestPayload = """ + + + + + testReqId + BPEL + ErrorMessage + ErrorCode + FAILED + NotifyStatus + + + + """ + + @Test + public void testupdateRequestPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestInfraPayload = """ + + + + + testReqId + BPEL + ErrorMessage + FAILED + 100 + + + + """ + + @Test + public void testupdateRequestInfraPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestInfraPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestGammaPayload = """ + + + + + testReqId + BPEL + ErrorMessage + ErrorCode + FAILED + + + + """ + + @Test + public void testupdateRequestGammaPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestGammaPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + + String updateResponseStatusPayload = """ + + + + + testReqId + BPEL + SENDING_FINAL_NOTIFY + + + + """ + + @Test + public void testupdateResponseStatusPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateResponseStatusPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(0) + + assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy new file mode 100644 index 0000000..174ca65 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts + +import static org.mockito.Mockito.* + +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + +abstract class MsoGroovyTest { + + protected ExecutionEntity setupMock(String procName) { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn(procName) + + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + + return mockExecution + } + + protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + + ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) + RepositoryService repositoryService = mock(RepositoryService.class) + ProcessDefinition processDefinition = mock(ProcessDefinition.class) + + when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) + when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) + when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) + when(processDefinition.getKey()).thenReturn(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + return mockExecution + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy new file mode 100644 index 0000000..8e109bb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy @@ -0,0 +1,233 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts + +// JUnit 4 +import org.junit.Test +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; + +import static groovy.test.GroovyAssert.shouldFail +import static groovy.test.GroovyAssert.assertTrue +import static groovy.test.GroovyAssert.assertEquals + +import org.openecomp.mso.bpmn.common.scripts.MsoUtils; +import org.apache.commons.lang3.* + + +class MsoUtilsTest { + + def utils = new MsoUtils() + def origXmlResponse = null + // Expected rebuilds + def expected_buildElements = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.1628" + def expected_rebuildDhcp = "YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4" + def expected_rebuildFirewallLite = "YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44" + def expected_rebuildInternetEvcAccess = "8Mbpsds" + def expected_rebuildInternetServiceChangeDetails = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" + def expected_rebuildL2Home = "AS/VLXM/003717//SWMultiPointMTSNJA4LCP1" + def expected_rebuildNat = "Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1" + def expected_rebuildPat = "NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6" + def expected_rebuildStaticRoutes = "255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" + def expected_rebuildUcpeVmsServiceInformation = "AVPN1Active2StandbyhostnameactivecodeOOB11ZZJUNIPERMODEL11111122HYJUNIPERMODEL222222" + def expected_rebuildVrLan = "noneprimary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.672812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::28YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" + def expected_rebuildVrLanInterfacePartial = "primary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.67281192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::2812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" + + @Before + public void setUp() { + def responseAsString = getFile("sdncadaptercallbackrequest.xml") + def varrequestData=utils.getNodeText(responseAsString,"RequestData") + //def varResponseListData = StringEscapeUtils.unescapeXml(varrequestData) + def varResponseListData = varrequestData.replace("&", "&") + origXmlResponse = utils.getNodeXml(varResponseListData, "layer3-service-list").drop(38).trim() + + } + + @Test + public void testBuildL2Home() { + def rebuildL2Home = utils.buildL2HomingInformation(origXmlResponse) + println " rebuildL2Home: " + println " actual - " + rebuildL2Home + println " expected - " + expected_rebuildL2Home + assertEquals("rebuildL2Home - expected vs actual", expected_rebuildL2Home, rebuildL2Home) + } + + @Test + public void testBuildInternetEvcAccess() { + def rebuildInternetEvcAccess = utils.buildInternetEvcAccessInformation(origXmlResponse) + println " rebuildInternetEvcAccess: " + println " actual - " + rebuildInternetEvcAccess + println " expected - " + expected_rebuildInternetEvcAccess + assertEquals("rebuildInternetEvcAccess - expected vs actual", expected_rebuildInternetEvcAccess, rebuildInternetEvcAccess) + } + + @Test + public void testBuildInternetServiceChangeDetails() { + def rebuildInternetServiceChangeDetails = utils.buildInternetServiceChangeDetails(origXmlResponse) + println " rebuildInternetServiceChangeDetails: " + println " actual - " + rebuildInternetServiceChangeDetails + println " expected - " + expected_rebuildInternetServiceChangeDetails + assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetails, rebuildInternetServiceChangeDetails) + } + + // Coming v100 + @Test + @Ignore + public void testBuildUcpeVmsServiceInformation() { + def rebuildUcpeVmsServiceInformation = utils.buildUcpeVmsServiceInformation(origXmlResponse) + println " rebuildUcpeVmsServiceInformation: " + println " actual - " + rebuildUcpeVmsServiceInformation + println " expected - " + expected_rebuildUcpeVmsServiceInformation + assertEquals("rebuildUcpeVmsServiceInformation - expected vs actual", expected_rebuildUcpeVmsServiceInformation, rebuildUcpeVmsServiceInformation) + } + + @Test + public void testBuildElements() { + // testing utility codes: buildElements() & buildElementsUnblunded() + def internetServiceChangeDetails = utils.getNodeXml(origXmlResponse, "internet-service-change-details").drop(38).trim() + def buildElements = '' + buildElements = "" + buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") + buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") + def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] + buildElements += utils.buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") + buildElements += "" + println " buildElements: " + println " actual - " + buildElements + println " expected - " + expected_buildElements + assertEquals("buildElements - expected vs actual", expected_buildElements, buildElements) + } + + @Test + public void testBuildVrLan() { + def rebuildVrLan = utils.buildVrLan(origXmlResponse) + println " rebuildVrLans: " + println " actual - " + rebuildVrLan + println " expected - " + expected_rebuildVrLan + assertEquals("rebuildVrLan - expected vs actual", expected_rebuildVrLan, rebuildVrLan) + } + + @Test + public void testBuildVrLanInterfacePartial() { + def rebuildVrLanInterfacePartial = utils.buildVrLanInterfacePartial(origXmlResponse) + println " rebuildVrLanInterfacePartial: " + println " actual - " + rebuildVrLanInterfacePartial + println " expected - " + expected_rebuildVrLanInterfacePartial + assertEquals("rebuildVrLanInterfacePartial - expected vs actual", expected_rebuildVrLanInterfacePartial, rebuildVrLanInterfacePartial) + } + + @Test + public void testBuildDhcp() { + def rebuildDhcp = utils.buildDhcp(origXmlResponse) + println " rebuildDhcp: " + println " actual - " + rebuildDhcp + println " expected - " + expected_rebuildDhcp + assertEquals("rebuildDhcp - expected vs actual", expected_rebuildDhcp, rebuildDhcp) + } + + @Test + public void testBuildPat() { + def rebuildPat = utils.buildPat(origXmlResponse) + println " rebuildPat: " + println " actual - " + rebuildPat + println " expected - " + expected_rebuildPat + assertEquals("rebuildPat - expected vs actual", expected_rebuildPat, rebuildPat) + } + + @Test + public void testBuildNat() { + def rebuildNat = utils.buildNat(origXmlResponse) + println " rebuildNat: " + println " actual - " + rebuildNat + println " expected - " + expected_rebuildNat + assertEquals("rebuildNat - expected vs actual", expected_rebuildNat, rebuildNat) + } + + @Test + public void testBuildFirewallLite() { + def rebuildFirewallLite = utils.buildFirewallLite(origXmlResponse) + println " rebuildFirewallLite: " + println " actual - " + rebuildFirewallLite + println " expected - " + expected_rebuildFirewallLite + assertEquals("rebuildFirewallLite - expected vs actual", expected_rebuildFirewallLite, rebuildFirewallLite) + } + + @Test + public void testBuildStaticRoutes() { + def rebuildStaticRoutes = utils.buildStaticRoutes(origXmlResponse) + println " rebuildStaticRoutes: " + println " actual - " + rebuildStaticRoutes + println " expected - " + expected_rebuildStaticRoutes + assertEquals("rebuildStaticRoutes - expected vs actual", expected_rebuildStaticRoutes, rebuildStaticRoutes) + } + + @Test + public void testGetBasicAuth(){ + def encodedAuth = utils.getBasicAuth("3E3CFA7BE2F6107AAD4AAA65F8976690","07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("Basic bXlTdHJpbmc=", encodedAuth) + } + + @Test + public void testEncrypt(){ + def encrypted = utils.encrypt("myString","07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("3E3CFA7BE2F6107AAD4AAA65F8976690", encrypted) + + //use to get value for urn properties + //println(utils.encrypt("password")) + } + + @Test + public void testDecrypt(){ + def decrypted = utils.decrypt("3E3CFA7BE2F6107AAD4AAA65F8976690", "07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("myString", decrypted) + } + + @Test + public void testGetPBGFList(){ + def responseAsString = getFile("sdncDeleteResponse.xml") + def nodes = utils.getPBGFList("true", responseAsString) + //assertEquals(2, nodes.size()) + while(!nodes.empty){ + def myBGFXML = nodes.remove(0) + def myBGF= new XmlSlurper().parseText(myBGFXML) + println "borderElmtId: " + myBGF.'border-element-id' + println "vlanid: " + myBGF.'vlan-id' +"\n" + } + } + + public String getFile(String fileName) { + def SLASH = File.separator + def pathBase = ' ' + def fileAsString = '' + try { + pathBase = new File(".").getCanonicalPath() + //println "pathBase " + pathBase + "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}" + fileAsString = new File(pathBase, "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}").getText() + } catch (Exception ex) { + println " *** getFile error: " + ex.getStackTrace() + } finally { + return fileAsString + } + } + + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy new file mode 100644 index 0000000..f71e4d2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy @@ -0,0 +1,948 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts; + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapter; + +import org.openecomp.mso.bpmn.mock.FileUtil + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterTest { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + System.setProperty("jboss.qualified.host.name","myhost.att.com") + } + + + def workflowResponse = """ + + + testRequestId + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + +""" + + String sdncAdapterRequest = """ + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + query + services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET + http://myhost.att.com:28080/mso/sdncAdapterCallbackServiceImpl + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + GetLayer3ServiceDetailsRequest + OMX + + + SDN-ETHERNET-INTERNET + PD/VLXM/003717//SW_INTERNET + + +""" + +def sdncAdapterResponse = """ + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + + +""" + +def workflowErrorResponse = """ + Received error from SDN-C: Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + 5300 + 404 + """ + +def workflowErrorResponse1 = """ + Invalid Callback Response from SDNC Adapter + 5300 + """ + +def enhancedCallbackRequestData = + """ + FK/VLXM/003717//SW_INTERNET + + service-configuration-operation + activate + synccomplete + N + Layer3ServiceActivateRequest + SUPP + 2015-04-28T21:32:11.386Z + + + + ds + 8 + Mbps + + + + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.1 + 192.168.1.15 + 28 + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.2 + 192.168.1.15 + 28 + + + 255.255.252.3 + 192.168.1.15 + 28 + + + + N + Y + N + + 192.168.1.7 + + + 192.168.1.8 + + + 1.1.1.1 + 28 + + 192.168.1.5 + + 2.2.2.1 + + 192.168.1.6 + + 192.155.2.3 + + + 1.1.1.2 + 28 + + 192.168.1.6 + + 2.2.2.2 + + 192.168.1.7 + + 192.155.2.4 + + Y + + 1:5 + + + 1:6 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + + N + Y + + 0.0.0.1 + 1 + Y + + 1 + + + 1 + + + + 0.0.0.2 + 2 + Y + + 2 + + + 2 + + + + : + 0 + Y + + 3 + + + 3 + + + + : + 1 + Y + + 4 + + + 4 + + + + + + 192.168.1.44 + 192.168.1.5 + 0 + + Y + N + + 192.168.1.45 + 192.168.1.6 + 28 + + + + Y + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + + + 0.0.0.1 + 0.0.0.1 + 0.0.0.1 + + + primary + 162.200.3.144 + 64 + 2001:1890:12e3:2da:: + 2620:0:10d0:f:ffff:ffff:ffff:fffe + 24 + 10.192.27.254 + + + 1 + 192.168.1.2 + 192.168.1.1 + 28 + + + 1 + 192.168.1.72 + 192.168.1.71 + 28 + + + 1 + 192.168.1.68 + 192.168.1.67 + 28 + + + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:3da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:4da:: + 28 + + + + none + + + + AVPN + + 1 + Active + + + 2 + Standby + + + + hostname + activecode + OOB + + + + 1 + 1 + ZZ + JUNIPER + MODEL1 + 1 + 1 + 1 + 1 + 1 + + + 2 + 2 + HY + JUNIPER + MODEL2 + 2 + 2 + 2 + 2 + 2 + + + + + Layer3ServiceActivateRequest + 4281555 + 155415ab-b4a7-4382-b4c6-d17d9sm42855 + https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws + OMX + 1 + + + activate + https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify + 5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760 + + + MultiPoint + MTSNJA4LCP1 + AS/VLXM/003717//SW + + + FK/VLXM/003717//SW_INTERNET + ST E2E Test42855_1300004281555 + SDN-ETHERNET-INTERNET + + + 10 + Kbps + + 1 + 192.168.1.15 + 192.168.1.15 + 28 + + + 2 + 192.168.1.16 + 192.168.1.16 + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + + + +""" + +def sdncAdapterResponseEmpty = +""" + +""" + +def sdncAdapterResponseError = +""" + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + +""" + + + @Test + public void testPreProcessRequest() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl") + when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn("true") + when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCA_") + verify(mockExecution).setVariable("sdncAdapterResponse","") + verify(mockExecution).setVariable("asynchronousResponseTimeout",false) + verify(mockExecution).setVariable("continueListening",false) + verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("serviceConfigActivate",false) + verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false) + verify(mockExecution).setVariable("source","") + verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest) + } + + @Test + public void testProcessResponse() + { + String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + +// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() +// debugger.printInvocations(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse) + verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_404() + { + String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution, times(1)).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_InvalidCallback() + { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("

Service Unavailable

") + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void postProcessResponse() + { + + String SDNCAdapterCallbackRequest = + """ + + + 3bb02798-b344-4d28-9bca-1f029954d1c9 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.infra.aic.att.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist ] + +""" + + String sdncAdapterResponse = + """ + + + 3bb02798-b344-4d28-9bca-1f029954d1c9 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.infra.aic.att.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist ] + + +""" + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy new file mode 100644 index 0000000..645fbe6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy @@ -0,0 +1,972 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common.scripts; + +import static org.mockito.Mockito.* + +import org.openecomp.mso.bpmn.common.scripts.VidUtils; +import org.openecomp.mso.bpmn.core.WorkflowException + +import groovy.json.JsonSlurper + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.runtime.Execution; + +import static org.junit.Assert.*; + +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; +import org.junit.Before; +import org.junit.Test; + +@RunWith(MockitoJUnitRunner.class) + +class VidUtilsTest { + + def vfModuleReqJson = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationId": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "relatedInstance": { + "instanceId": "123456", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "SERVICE_MODEL_NAME", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "skask", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "skask", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelCustomizationName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "vnfName", + "value": "STMTN5MMSC20" + }, + { + "name": "tenantId", + "value": "vpe-tenant-123" + }, + { + "name": "aicCloudRegion", + "value": "MDTWNJ21" + }, + { + "name": "isAvpnService", + "value": "true" + }, + { + "name": "asn", + "value": "asn-1234" + }, + { + "name": "releaseForAero", + "value": "release-for-aero-something" + }, + { + "name": "aicClli", + "value": "MTJWNJA4LCP" + }, + { + "name": "svcProviderPartNumber", + "value": "svc-provide-number-1234" + } + ] + } + } +} +""" + def bpmnReq1 = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} +""" + + def vidUtilResp1 = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + + + + STMTN5MMSC20 + US1117MTSNJVBR0246 + + pcrf-capacity + skask + slowburn + created + MDTWNJ21 + slcp3-esx-az01 + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + +""" + + def bpmnReq2 = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ] + } +} +""" + + def bpmnReqJsonVolumeSuppressRollbackTrue = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ] + } +} +""" + +def bpmnReqJsonVolumeSuppressRollbackFalse = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ] + } +} +""" + +def bpmnReqJsonVolumeSuppressRollbackNone = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ] + } +} +""" + + def bpmnReqJsonVfModuleSuppressRollbackTrue = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + +def bpmnReqJsonVfModuleSuppressRollbackFalse = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": false +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + +def bpmnReqJsonVfModuleSuppressRollbackNone = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID" +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + def vidUtilResp2 = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + true + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureFalse = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + false + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureTrue = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + true + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureEmpty = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + + + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureFalse = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + false + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1 + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureTrue = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + true + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1 + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureEmpty = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1 + + + +""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + @Test + public void test() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReq1) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + print xmlReq + assertEquals(vidUtilResp1, xmlReq) + } + + //@Test + public void testVfModule() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(vfModuleReqJson) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(null, reqMap, "CREATE_VF_MODULE", "test-service-instance-id-123") + print xmlReq + assertTrue(true) + } + + @Test + public void testNoRequestParams() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReq2) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilResp2, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackTrue() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackTrue) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureFalse, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackFalse() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackFalse) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureTrue, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackNone() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackNone) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureEmpty, xmlReq) + } + + @Test + public void testVfModuleRollbackTrue() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackTrue) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureFalse, xmlReq) + } + + @Test + public void testVfModuleRollbackFalse() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackFalse) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureTrue, xmlReq) + } + + @Test + public void testVfModuleRollbackNone() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackNone) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureEmpty, xmlReq) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java new file mode 100644 index 0000000..4e2b1e1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java @@ -0,0 +1,214 @@ +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.spy; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.Response; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.history.HistoricProcessInstance; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Set of utility methods used for Unit testing + * + */ +public class BPMNUtil { + + public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertProcessInstanceFinished(processEngineServices, pID); + HistoricVariableInstance responseData = processEngineServices.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(pID) + .variableName(name) + .singleResult(); + + if (responseData != null) { + return (responseData.getValue() != null ? responseData.getValue().toString(): null); + } + return null; + } + + @SuppressWarnings("unchecked") + public static T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertProcessInstanceFinished(processEngineServices, pID); + Object responseData = processEngineServices.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(pID) + .variableName(name) + .singleResult() + .getValue(); + return (T) responseData; + } + + + public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { + assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + + public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count()); + } + + private static String getProcessInstanceId( + ProcessEngineServices processEngineServices, String processDefinitionID) { + List historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list(); + String pID = null; + for (HistoricProcessInstance hInstance: historyList) { + if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) { + pID = hInstance.getId(); + break; + } + } + return pID; + } + + public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { + return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false; + } + + + private static void buildVariable(String key, String value, Map variableValueType) { + Map host = new HashMap(); + host.put("value", value); + host.put("type", "String"); + variableValueType.put(key, host); + } + + public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map variables) { + WorkflowResource workflowResource = new WorkflowResource(); + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap(); + for (String key : variables.keySet()) { + buildVariable(key, variables.get(key), variableValueType); + } + buildVariable("mso-service-request-timeout","600", variableValueType); + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineServices); + Response response = workflowResource.startProcessInstanceByKey( + processKey, variableMap); + WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); + return workflowResponse; + } + + //Check the runtime service to see whether the process is completed + public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException { + // Don't wait forever + long waitTime = 120000; + long endTime = System.currentTimeMillis() + waitTime; + + while (true) { + if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) { + break; + } + + if (System.currentTimeMillis() >= endTime) { + fail("Process " + pid + " did not finish in " + waitTime + "ms"); + } + + Thread.sleep(200); + } + } + + /** + * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object + * @param processEngineServices + * @param processKey + * @param variables + * @return + * @throws InterruptedException + */ + public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map variables) throws InterruptedException { + ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables); + pthread.start(); + BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey); + String pid = getProcessInstanceId(processEngineServices, processKey); + //Caution: If there is a problem with workflow, this may wait for ever + while (true) { + pid = getProcessInstanceId(processEngineServices, processKey); + if (!isProcessInstanceFinished(processEngineServices,pid)) { + Thread.sleep(200); + } else{ + break; + } + } + //need to retrieve for second time ? + pid = getProcessInstanceId(processEngineServices, processKey); + waitForWorkflowToFinish(processEngineServices, pid); + return pthread.workflowResponse; + } + + /** + * Execute workflow using async resource + * @param processEngineServices + * @param processKey + * @param asyncResponse + * @param variables + */ + private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, AsynchronousResponse asyncResponse, Map variables) { + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap(); + for (String key : variables.keySet()) { + buildVariable(key, variables.get(key), variableValueType); + } + buildVariable("mso-service-request-timeout","600", variableValueType); + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineServices); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap); + } + + /** + * Helper class which executes workflow in a thread + * + */ + static class ProcessThread extends Thread { + + public WorkflowResponse workflowResponse = null; + public String processKey; + public AsynchronousResponse asyncResponse = spy(AsynchronousResponse.class); + public boolean started; + public ProcessEngineServices processEngineServices; + public Map variables; + + public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map variables) { + this.processKey = processKey; + this.processEngineServices = processEngineServices; + this.variables = variables; + } + + public void run() { + started = true; + doAnswer(new Answer() { + public Void answer(InvocationOnMock invocation) { + Response response = (Response) invocation.getArguments()[0]; + workflowResponse = (WorkflowResponse) response.getEntity(); + return null; + } + }).when(asyncResponse).setResponse(any(Response.class)); + executeAsyncFlow(processEngineServices, processKey, asyncResponse, variables); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java new file mode 100644 index 0000000..5cd59f3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Unit test for CompleteMsoProcess.bpmn. + */ +public class CompleteMsoProcessTest extends WorkflowTest { + + private void executeFlow(String inputRequestFile) throws InterruptedException { + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile); + Map variables = new HashMap(); + variables.put("CompleteMsoProcessRequest",inputRequestFile); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CompleteMsoProcess", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNotificationurl_200() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Ignore // BROKEN TEST + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNotificationurl_500() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("500", CMSO_ResponseCode); + Assert.assertFalse((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNoNotificationurl() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNoNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + public String gMsoCompletionRequestWithNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } + + + + public String gMsoCompletionRequestWithNoNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } + + public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } + + public String gMsoCompletionRequestWithNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java new file mode 100644 index 0000000..5b10b8b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java @@ -0,0 +1,133 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; + +/** + * Unit test cases for ConfirmVolumeGroupName.bpmn + */ +public class ConfirmVolumeGroupNameTest extends WorkflowTest { + /** + * Sunny day scenario. + * + * @throws Exception + */ + @Test + @Deployment(resources = { + "subprocess/ConfirmVolumeGroupName.bpmn" + }) + public void sunnyDay() throws Exception { + + logStart(); + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + + System.out.println("Before starting process"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME"); + variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21"); + System.out.println("after setting variables"); + runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); + String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); + + assertEquals("200", responseCode); + System.out.println(response); + logEnd(); + } + + /** + * Rainy day scenario - nonexisting volume group id. + * + * @throws Exception + */ + @Test + @Deployment(resources = { + "subprocess/ConfirmVolumeGroupName.bpmn" + }) + public void rainyDayNoVolumeGroupId() throws Exception { + + logStart(); + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + + System.out.println("Before starting process"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + System.out.println("after setting variables"); + runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); + String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); + + assertEquals("404", responseCode); + System.out.println(response); + + logEnd(); + } + + /** + * Rainy day scenario - volume group name does not match the name in AAI + * + * + * @throws Exception + */ + @Test + @Deployment(resources = { + "subprocess/ConfirmVolumeGroupName.bpmn" + }) + public void rainyDayNameDoesNotMatch() throws Exception { + + logStart(); + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + + System.out.println("Before starting process"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME"); + System.out.println("after setting variables"); + runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); + String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); + + assertEquals("404", responseCode); + System.out.println(response); + + logEnd(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java new file mode 100644 index 0000000..e62742d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java @@ -0,0 +1,91 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Please describe the ConfirmVolumeGroupTenantTest.java class + * + */ +public class ConfirmVolumeGroupTenantTest extends WorkflowTest { + + @Test + @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"}) + public void testRemoveLayer3Service_success() throws Exception{ + MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml"); + + Map variables = new HashMap(); + setVariables(variables); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); + String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); + String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "volumeHeatStackId"); + + assertEquals("Response", "true", actualNameMatch); + assertEquals("Response", "true", actualIdMatch); + assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse); + } + + @Test + @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"}) + public void testRemoveLayer3Service_idsNotMatch() throws Exception{ + MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml"); + + Map variables = new HashMap(); + setVariables(variables); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); + String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); + String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "WorkflowException"); + + assertEquals("Response", "true", actualNameMatch); + assertEquals("Response", "false", actualIdMatch); + assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant]", actualResponse); + + } + + private void setVariables(Map variables) { + variables.put("isDebugLogEnabled", "true"); + variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("aicCloudRegion", "MDTWNJ21"); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java new file mode 100644 index 0000000..b41d2d2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java @@ -0,0 +1,277 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; + +/** + * Unit test for CreateAAIVfModule.bpmn. + */ +public class CreateAAIVfModuleTest extends WorkflowTest { + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateGenericVnfSuccess_200() { + + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC22"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + Assert.assertEquals("201", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateVfModuleSuccess_200() { + // create Add-on VF Module for existing Generic VNF + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + Assert.assertEquals("201", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestQueryGenericVnfFailure_5000() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC23"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateDupGenericVnfFailure_1002() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC21"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateDupVfModuleFailure_1002() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateGenericVnfFailure_5000() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC22"); + variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); + variables.put("vfModuleModelName", "PCRF::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateGenericVnfFailure_1002() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); + variables.put("vfModuleModelName", "PCRF::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateVfModuleFailure_5000() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); + variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + public static void MockAAICreateGenericVnf(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .withRequestBody(containing("00000000-0000-0000-0000-000000000000")) + .willReturn(aResponse() + .withStatus(201))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .withRequestBody(containing("99999999-9999-9999-9999-999999999999")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + } + + // start of mocks used locally and by other VF Module unit tests + public static void MockAAIVfModulePUT(boolean isCreate){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) + .withRequestBody(containing("MMSC")) + .willReturn(aResponse() + .withStatus(isCreate ? 201 : 200))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*")) + .withRequestBody(containing("PCRF")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721")) + .willReturn(aResponse() + .withStatus(200))); + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java new file mode 100644 index 0000000..f1a2d7b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn. + */ +public class CreateAAIVfModuleVolumeGroupTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" + }) + public void happyPath() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2); + MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java new file mode 100644 index 0000000..0136b67 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java @@ -0,0 +1,643 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; + +/** + * Unit test for DeleteAAIVfModule.bpmn. + */ +public class DeleteAAIVfModuleTest extends WorkflowTest { + private static final String EOL = "\n"; + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteGenericVnfSuccess_200() { + // delete the Base Module and Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c721 STMTN5MMSC21 973ed047-d251-4fb9-bf1a-65b8949e0a73 STMTN5MMSC21-MMSC::module-0-0 "); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode"); + Assert.assertEquals("200", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleSuccess_200() { + // delete Add-on Vf Module for existing Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode"); + Assert.assertEquals("200", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestQueryGenericVnfFailure_5000() { + // query Generic Vnf failure (non-404) with A&AI + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c723" + EOL + + " STMTN5MMSC23" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a71" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestQueryGenericVnfFailure_1002() { + // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404) + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c722" + EOL + + " STMTN5MMSC22" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a72" + EOL + + " STMTN5MMSC22-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteGenericVnfFailure_5000() { + // A&AI failure (non-200) when attempting to delete a Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + + " STMTN5MMSC18" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " STMTN5MMSC18-MMSC::module-0-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleFailure_5000() { + // A&AI failure (non-200) when attempting to delete a Vf Module + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + + " STMTN5MMSC19" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " STMTN5MMSC19-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleFailure_1002_1() { + // failure attempting to delete Base Module when not the last Vf Module + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleFailure_1002_2() { + // failure attempting to delete a Vf Module that does not exist (A&AI returns 404) + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76 + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c720 STMTN5MMSC20 973ed047-d251-4fb9-bf1a-65b8949e0a76 STMTN5MMSC20-MMSC::module-2-0 "); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id")); + System.out.println(exception.getErrorMessage()); + } + + // Start of VF Modularization A&AI mocks + + public static void MockAAIGenericVnfSearch(){ + String body; + + // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " 2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + // The following stubs are for DeleteAAIVfModule + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "text/xml") + .withBody("Generic VNF Not Found"))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000020" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000074" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000075" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + + " STMTN5MMSC19" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000019" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " STMTN5MMSC19-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000076" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " STMTN5MMSC19-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000077" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + + " STMTN5MMSC18" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000018" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " STMTN5MMSC18-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000078" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + + body = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(body))); + } + public static void MockAAIDeleteGenericVnf(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + } + + public static void MockAAIDeleteVfModule(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078")) + .willReturn(aResponse() + .withStatus(200))); + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml"))); + + stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*")) + .willReturn(aResponse() + .withStatus(200))); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java new file mode 100644 index 0000000..7732075 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java @@ -0,0 +1,226 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Unit test for FalloutHandler.bpmn. + */ +public class FalloutHandlerTest extends WorkflowTest { + private void setupMocks() { + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody("Notified"))); + } + + private void executeFlow(String inputRequestFile) throws InterruptedException { + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + + //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile); + Map variables = new HashMap(); + variables.put("FalloutHandlerRequest",inputRequestFile); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "FalloutHandler", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + System.out.println("ENDED TEST: " + method); + } + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNotificationurl_200() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNotificationurl()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " http://localhost:28090/CCD/StatusNotification" + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + + } + + + + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNoNotificationurl() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNoNotificationurl()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNoNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " www.att.com" + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java new file mode 100644 index 0000000..e83a644 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java @@ -0,0 +1,279 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + + + +/** + * Please describe the GenericDeleteServiceTest.java class + * + */ +public class GenericDeleteServiceTest extends WorkflowTest { + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_serviceInstance() throws Exception{ + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + } + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_serviceSubscription() throws Exception{ + + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_instanceNoResourceVersion() throws Exception { + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceSubscription.xml"); + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_subscriptionNoResourceVersion() throws Exception{ + MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204); + + Map variables = new HashMap(); + setVariablesSubscription(variables, null, "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_get404Response() throws Exception{ + + MockGetServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("false", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_subscriptionGetEmpty200() throws Exception{ + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 200); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("false", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_delete404Response() throws Exception{ + + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GENDSI_getServiceInstanceResponse.xml"); + MockDeleteServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("false", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_error_invalidVariables() throws Exception{ + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "1234"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]"; + + assertEquals("false", foundIndicator); + assertEquals("false", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(expectedResponse, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_error_getBadAAIResponse() throws Exception{ + + MockGetServiceInstance_500("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "aaiFault.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=SVC3002Error writing output performing %1 on %2 (msg=%3) (ec=%4)PUTcustomerSubName01Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]ERR.5.4.5105" + "\n" + + "]"; + + assertEquals("false", foundIndicator); + assertEquals("false", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(expectedResponse, workflowException); + } + + + private void setVariablesInstance(Map variables, String siId, String globalCustId, String serviceType, String reVersion) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENDS_serviceInstanceId", siId); + variables.put("GENDS_globalCustomerId",globalCustId); + variables.put("GENDS_serviceType", serviceType); + variables.put("GENDS_resourceVersion", reVersion); + variables.put("GENDS_type", "service-instance"); + } + + private void setVariablesSubscription(Map variables, String siId, String globalCustId, String serviceType, String reVersion) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENDS_serviceInstanceId", siId); + variables.put("GENDS_globalCustomerId",globalCustId); + variables.put("GENDS_serviceType", serviceType); + variables.put("GENDS_resourceVersion", reVersion); + variables.put("GENDS_type", "service-subscription"); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java new file mode 100644 index 0000000..dd3fd73 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java @@ -0,0 +1,221 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVce; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Please describe the GenericDeleteVnfTest.java class + * + */ +public class GenericDeleteVnfTest extends WorkflowTest { + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnf() throws Exception{ + MockDeleteGenericVnf("testVnfId123", "testReVer123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_vce() throws Exception{ + MockDeleteVce("testVnfId123", "testReVer123", 204); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "vce", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnfNoResourceVersion() throws Exception{ + + MockGetGenericVnfById("/testVnfId123", "GenericFlows/getGenericVnfByNameResponse.xml", 200); + MockDeleteGenericVnf("testVnfId123", "testReVer123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "false", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_vceNoResourceVersion() throws Exception{ + MockDeleteVce("testVnfId123", "testReVer123", 204); + MockGetVceById("testVnfId123", "GenericFlows/getVceResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "vce", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "false", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnf404() throws Exception{ + MockDeleteGenericVnf("testVnfId123", "testReVer123", 404); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "false", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_vce404() throws Exception{ + MockDeleteVce("testVnfId123", "testReVer123", 404); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "vce", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "false", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnfNoResourceVersion404() throws Exception{ + MockGetGenericVnfById_404("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "false", "false", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_error_missingVariables() throws Exception{ + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]"); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_error_genericVnf500() throws Exception{ + + MockDeleteGenericVnf_500("testVnfId123", "testReVer123"); + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Received a bad response from AAI]"); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_error_genericVnf412() throws Exception{ + MockDeleteGenericVnf("testVnfId123", "testReVer123", 412); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=412,errorMessage=Delete Vnf Received a resource-version Mismatch Error Response from AAI]"); + + } + + private void assertVariables(String exSuccessIndicator, String exFound, String exRVProvided, String exWorkflowException) { + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_FoundIndicator"); + String rvProvided = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_resourceVersionProvided"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "WorkflowException"); + + assertEquals(exSuccessIndicator, successIndicator); + assertEquals(exFound, found); + assertEquals(exRVProvided, rvProvided); + assertEquals(exWorkflowException, workflowException); + } + + private void setVariables(Map variables, String vnfId, String type, String resourceVer) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENDV_vnfId", vnfId); + variables.put("GENDV_type", type); + variables.put("GENDV_resourceVersion", resourceVer); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java new file mode 100644 index 0000000..2af42db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java @@ -0,0 +1,505 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + + +/** + * Unit Test for the GenericGetService Sub Flow + */ +public class GenericGetServiceTest extends WorkflowTest { + + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance() throws Exception{ + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceSubscription() throws Exception{ + + MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_byName() throws Exception{ + + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, null, "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_byId() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_404Response() throws Exception{ + + MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceSubscription404() throws Exception{ + MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", 404); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceByName404() throws Exception{ + + MockNodeQueryServiceInstanceByName_404("1604-MVM-26"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "", "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("404", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceById404() throws Exception{ + + MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("404", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{ + + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", " "); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{ + MockNodeQueryServiceInstanceByName("1604-MVM-26", ""); + + Map variables = new HashMap(); + setVariablesInstance(variables, "", "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", ""); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{ + + Map variables = new HashMap(); + setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{ + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.]"; + + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{ + + MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{ + + MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("500", siUrlResponseCode); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{ + + MockNodeQueryServiceInstanceByName_500("1604-MVM-26"); + + Map variables = new HashMap(); + setVariablesInstance(variables, null, "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("500", siUrlResponseCode); + assertEquals(expectedWorkflowException, workflowException); + } + + + private void setVariablesInstance(Map variables, String siId, String siName, String globalCustId, String serviceType) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGS_serviceInstanceId", siId); + variables.put("GENGS_serviceInstanceName", siName); + variables.put("GENGS_globalCustomerId",globalCustId); + variables.put("GENGS_serviceType", serviceType); + variables.put("GENGS_type", "service-instance"); + } + + private void setVariablesSubscription(Map variables, String siId, String siName, String globalCustId, String serviceType) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGS_serviceInstanceId", siId); + variables.put("GENGS_serviceInstanceName", siName); + variables.put("GENGS_globalCustomerId",globalCustId); + variables.put("GENGS_serviceType", serviceType); + variables.put("GENGS_type", "service-subscription"); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java new file mode 100644 index 0000000..80105bb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java @@ -0,0 +1,191 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByNameWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVceByNameWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Please describe the GenericGetVnfTest.java class + * + */ +public class GenericGetVnfTest extends WorkflowTest { + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_genericVnf() throws Exception{ + MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_vce() throws Exception{ + MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "testVnfName123", "vce"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_genericVnfByName() throws Exception{ + MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "", "testVnfName123", "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_vceByName() throws Exception{ + MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, null, "testVnfName123", "vce"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Ignore // BROKEN TEST (previously ignored) + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_error_genericVnf500() throws Exception{ + + MockGetGenericVnfById_500("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Incoming VnfId and VnfName are null. VnfId or VnfName is required!]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", byName); + + assertEquals(expectedWorkflowException, workflowException); + } + + private void setVariables(Map variables, String vnfId, String vnfName, String type) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGV_vnfId", vnfId); + variables.put("GENGV_vnfName",vnfName); + variables.put("GENGV_type", type); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java new file mode 100644 index 0000000..248cb97 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java @@ -0,0 +1,182 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVce; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Please describe the GenericPutVnf.java class + * + */ +public class GenericPutVnfTest extends WorkflowTest { + + private String genericVnfPayload = "testId"; + private String vcePayload = "testId"; + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_success_genericVnf() throws Exception{ + + MockPutGenericVnf("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_success_vce() throws Exception{ + + MockPutVce("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", vcePayload, "vce"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_missingType() throws Exception{ + + MockPutGenericVnf("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_missingPayload() throws Exception{ + + MockPutGenericVnf("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_404() throws Exception{ + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=404,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_400() throws Exception{ + + MockPutGenericVnf("/testVnfId123", 400); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=400,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + + + } + + private void setVariables(Map variables, String vnfId, String payload, String type) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENPV_vnfId", vnfId); + variables.put("GENPV_vnfPayload",payload); + variables.put("GENPV_type", type); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java new file mode 100644 index 0000000..cb5f722 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java @@ -0,0 +1,208 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit tests for PrepareUpdateAAIVfModule.bpmn. + */ +public class PrepareUpdateAAIVfModuleTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void happyPath() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId"); + System.out.println("Ouput heat-stack-id:" + heatStackId); + Assert.assertEquals("slowburn", heatStackId); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById_404("skask[?]depth=1"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode"); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + + logEnd(); + } + + /** + * Test the case where the validation of the VF Module fails. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void failValidation1() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration")); + + logEnd(); + } + + /** + * Test the case where the validation of the VF Module fails. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void failValidation2() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module")); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java new file mode 100644 index 0000000..f3c3b84 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java @@ -0,0 +1,64 @@ +package org.openecomp.mso.bpmn.common; + +import javax.xml.ws.Endpoint; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; + +/** + * A JUnit rule that starts the SDNC Adapter Callback Service before + * every test, and tears it down after every test. Example: + *
+ *     @Rule
+ *     public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
+ *         new SDNCAdapterCallbackRule(processEngineRule);
+ * 
+ */ +public class SDNCAdapterCallbackRule implements TestRule { + public static final String DEFAULT_ENDPOINT_URL = + "http://localhost:28080/mso/SDNCAdapterCallbackService"; + + private final ProcessEngineServices processEngineServices; + private final String endpointUrl; + + public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) { + this(processEngineServices, DEFAULT_ENDPOINT_URL); + } + + public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices, + String endpointUrl) { + this.processEngineServices = processEngineServices; + this.endpointUrl = endpointUrl; + } + + @Override + public Statement apply(final Statement baseStmt, Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + Endpoint endpoint = null; + + try { + SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl(); + sdncCallbackService.setProcessEngineServices4junit(processEngineServices); + + System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); + System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true"); + + System.out.println("Publishing Endpoint - " + endpointUrl); + endpoint = Endpoint.publish(endpointUrl, sdncCallbackService); + + baseStmt.evaluate(); + } finally { + if (endpoint != null) { + System.out.println("Stopping Endpoint - " + endpointUrl); + endpoint.stop(); + } + } + } + }; + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java new file mode 100644 index 0000000..b0e1dc9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java @@ -0,0 +1,389 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.core.Response; + +import org.camunda.bpm.engine.MismatchingMessageCorrelationException; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl.SDNCAdapterExceptionResponse; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit test cases for SDNCAdapterV1.bpmn + */ +public class SDNCAdapterV1Test extends WorkflowTest { + + private String sdncAdapterWorkflowRequest; + private String sdncAdapterWorkflowRequestAct; + private String sdncAdapterCallbackRequestData; + private String sdncAdapterCallbackRequestDataNonfinal; + + public SDNCAdapterV1Test() throws IOException { + sdncAdapterWorkflowRequest = FileUtil.readResourceFile("sdncadapterworkflowrequest.xml"); + sdncAdapterWorkflowRequestAct = FileUtil.readResourceFile("sdncadapterworkflowrequest-act.xml"); + sdncAdapterCallbackRequestData = FileUtil.readResourceFile("sdncadaptercallbackrequestdata.text"); + sdncAdapterCallbackRequestDataNonfinal = FileUtil.readResourceFile("sdncadaptercallbackrequestdata-nonfinal.text"); + } + + /** + * End-to-End flow - Unit test for SDNCAdapterV1.bpmn + * - String input & String response + */ + + private WorkflowResponse invokeFlow(String workflowRequest) { + + MapvalueMap = new HashMap(); + valueMap.put("value", workflowRequest); + Map variables = new HashMap(); + variables.put("sdncAdapterWorkflowRequest", valueMap); + + Map valueMap2 = new HashMap(); + valueMap2.put("value", "true"); + variables.put("isDebugLogEnabled", valueMap2); + + VariableMapImpl varMap = new VariableMapImpl(); + varMap.put("variables", variables); + + //System.out.println("Invoking the flow"); + + WorkflowResource workflowResource = new WorkflowResource(); + workflowResource.setProcessEngineServices4junit(processEngineRule); + + Response response = workflowResource.startProcessInstanceByKey("sdncAdapter", varMap); + WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); + + //String pid = workflowResponse.getProcessInstanceID(); + //System.out.println("Back from executing process instance with pid=" + pid); + return workflowResponse; + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void sunnyDay() throws InterruptedException { + + mockSDNCAdapter(200); + + //System.out.println("SDNCAdapter sunny day flow Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + assertProcessInstanceNotFinished(pid); + + System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceFinished(pid); + + //System.out.println("SDNCAdapter sunny day flow Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void nonFinalWithTimeout() throws InterruptedException { + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBAdapter.xml"); + + //System.out.println("SDNCAdapter interim status processing flow Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + assertProcessInstanceNotFinished(pid); + + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceNotFinished(pid); + + checkForTimeout(pid); + + assertEquals(true, (Boolean) (getVariable(pid, "continueListening"))); + + + //System.out.println("SDNCAdapter interim status processing flow Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void nonFinalThenFinal() throws InterruptedException { + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBAdapter.xml"); + + //System.out.println("SDNCAdapter non-final then final processing flow Started!"); + + // Start the flow + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + assertProcessInstanceNotFinished(pid); + + // Inject a "non-final" SDNC Adapter asynchronous callback message + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceNotFinished(pid); + assertEquals(true, (Boolean) (getVariable(pid, "continueListening"))); + + // Inject a "final" SDNC Adapter asynchronous callback message + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); + sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceFinished(pid); + assertEquals(false, (Boolean) (getVariable(pid, "continueListening"))); + + //System.out.println("SDNCAdapter non-final then final processing flow Completed!"); + } + + + + private void waitForExecutionToStart(String processDefintion, int count) throws InterruptedException { + //System.out.println(processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count()); + while (processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count() != count) { + Thread.sleep(200); + } + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void badCorrelationIdTest() throws InterruptedException { + + mockSDNCAdapter(200); + + //System.out.println("SDNCAdapter bad RequestId test Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + assertProcessInstanceNotFinished(pid); + + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String badRequestId = "This is not the RequestId that was used"; + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(badRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertTrue(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertTrue(((SDNCAdapterExceptionResponse) sdncAdapterResponse).getException() instanceof MismatchingMessageCorrelationException); + assertProcessInstanceNotFinished(pid); + + //System.out.println("SDNCAdapter bad RequestId test Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void badSynchronousResponse() throws IOException, InterruptedException { + + mockSDNCAdapter(404); + + //System.out.println("SDNCAdapter bad synchronous response flow Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + while (thread.isAlive()) { + Thread.sleep(200); + } + WorkflowResponse response = thread.workflowResponse; + Assert.assertNotNull(response); + Assert.assertEquals("404 error", response.getMessageCode(),7000); +// assertProcessInstanceFinished(response.getProcessInstanceID()); + //System.out.println("SDNCAdapter bad synchronous response flow Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void sdncNotFound() throws IOException, InterruptedException { + mockSDNCAdapter(200); + mockSDNCAdapter("/sdncAdapterMock/404", 400, "sdncCallbackErrorResponse.xml"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("404"); + callbackHeader.setResponseMessage("Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.]"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertProcessInstanceFinished(pid); + assertNotNull(sdncAdapterResponse); + //TODO query history to see SDNCA_ResponseCode, SDNCA_ErrorResponse + //System.out.println("SDNCAdapter SDNC Notfound test Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void asynchronousMessageTimeout() throws IOException, InterruptedException { + mockSDNCAdapter(200); + //System.out.println("SDNCAdapter asynchronous message timeout flow Started!"); + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + checkForTimeout(getPid()); + } + + private void checkForTimeout(String pid) throws InterruptedException { + + assertProcessInstanceNotFinished(pid); + + ProcessEngineConfigurationImpl processEngineConfiguration = + (ProcessEngineConfigurationImpl) processEngineRule.getProcessEngine().getProcessEngineConfiguration(); + assertTrue(processEngineConfiguration.getJobExecutor().isActive()); + + Job timerJob = processEngineRule.getManagementService().createJobQuery().processInstanceId(pid).singleResult(); + assertNotNull(timerJob); + + processEngineRule.getManagementService().executeJob(timerJob.getId()); + + assertProcessInstanceFinished(pid); + + //System.out.println("SDNCAdapter asynchronous message timeout flow Completed!"); + } + + class ProcessExecutionThread extends Thread { + + private String workflowRequest; + private WorkflowResponse workflowResponse; + + public ProcessExecutionThread(String workflowRequest) { + this.workflowRequest = workflowRequest; + } + + public void run() { + workflowResponse = invokeFlow(workflowRequest); + workflowResponse.getProcessInstanceID(); + } + } + + private String getPid() { + return processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().list().get(0).getId(); + } + + private Object getVariable(String pid, String variableName) { + try { + return + processEngineRule + .getHistoryService() + .createHistoricVariableInstanceQuery() + .processInstanceId(pid).variableName(variableName) + .singleResult() + .getValue(); + } catch(Exception ex) { + return null; + } + } + + private void assertProcessInstanceFinished(String pid) { + assertEquals(1, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + + private void assertProcessInstanceNotFinished(String pid) { + assertEquals(0, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java new file mode 100644 index 0000000..4ae7620 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit tests for UpdateAAIGenericVnf bpmn. + */ +public class UpdateAAIGenericVnfTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void happyPath() throws IOException { + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf("/skask", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void personaMismatch() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + System.out.println("Workflow Exception: " + workflowException); + Assert.assertNotNull(workflowException); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + + MockGetGenericVnfById_404("skask[?]depth=1"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf_Bad("skask", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java new file mode 100644 index 0000000..8691ae8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java @@ -0,0 +1,137 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit tests for UpdateAAIVfModuleTest.bpmn. + */ +public class UpdateAAIVfModuleTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIVfModule.bpmn" + }) + public void happyPath() throws IOException { + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml"); + MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIVfModule.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIVfModule.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool"); + MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java new file mode 100644 index 0000000..d2b0e27 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java @@ -0,0 +1,389 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; + +/** + * Unit tests for VnfAdapterRestV1. + */ +public class VnfAdapterRestV1Test extends WorkflowTest { + + private static final String EOL = "\n"; + + private final CallbackSet callbacks = new CallbackSet(); + + private final String CREATE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleName" + EOL + + " vfModuleId" + EOL + + " vnfType" + EOL + + " vnfVersion" + EOL + + " vfModuleType" + EOL + + " volumeGroupId" + EOL + + " volumeGroupStackId" + EOL + + " baseVfModuleId" + EOL + + " baseVfModuleStackId" + EOL + + " true" + EOL + + " false" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String UPDATE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleName" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " vnfType" + EOL + + " vnfVersion" + EOL + + " vfModuleType" + EOL + + " volumeGroupId" + EOL + + " volumeGroupStackId" + EOL + + " baseVfModuleId" + EOL + + " baseVfModuleStackId" + EOL + + " true" + EOL + + " false" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String DELETE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String ROLLBACK_VF_MODULE_REQUEST = + "" + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + " true" + EOL + + " " + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " true" + EOL + + " " + EOL + + "" + EOL; + + public VnfAdapterRestV1Test() throws IOException { + callbacks.put("createVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " tenantId" + EOL + + " cloudSiteId" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " messageId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("updateVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("deleteVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " true" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("rollbackVfModule", + "" + EOL + + " {{MESSAGE-ID}}" + EOL + + " true" + EOL + + "" + EOL); + + callbacks.put("vfModuleException", + "" + EOL + + " message" + EOL + + " category" + EOL + + " false" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testCreateVfModuleSuccess() throws Exception { + logStart(); + + mockVNFPost("", 202, "vnfId"); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "createVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testUpdateVfModuleSuccess() throws Exception { + logStart(); + + mockVNFPut("/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "updateVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testDeleteVfModuleSuccess() throws Exception { + logStart(); + + mockVNFDelete("vnfId", "/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "deleteVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testRollbackVfModuleSuccess() throws Exception { + logStart(); + + mockVNFRollbackDelete("/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "rollbackVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testCreateVfModuleException() throws Exception { + logStart(); + + mockVNFPost("", 202, "vnfId"); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "vfModuleException"); + waitForProcessEnd(businessKey, 10000); + + WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + assertNotNull(wfe); + System.out.println(wfe.toString()); + + String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java new file mode 100644 index 0000000..4ac885f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +public class WorkflowAsyncResourceTest extends WorkflowTest { + + @Test + @Deployment(resources = { "testAsyncResource.bpmn" }) + public void asyncRequestSuccess() throws InterruptedException { + //it can be any request which asynchronously processed by the workflow + String request = " SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 "; + + Map variables = new HashMap(); + variables.put("testAsyncRequestMsg", request); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("mso-service-request-timeout", "5"); + + WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables); + assertEquals("Received the request, the process is getting executed, request message SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 ", workflowResponse.getResponse()); + assertEquals(200, workflowResponse.getMessageCode()); + } + + private void executeWorkflow(String request, String requestId, AsynchronousResponse asyncResponse, String processKey) { + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap(); + + Map requestMsg = new HashMap(); + requestMsg.put("value", request); + requestMsg.put("type", "String"); + + Map msorequestId = new HashMap(); + msorequestId.put("type", "String"); + msorequestId.put("value",requestId); + + Map timeout = new HashMap(); + timeout.put("type", "String"); + timeout.put("value","5"); + + variableValueType.put("testAsyncRequestMsg", requestMsg); + variableValueType.put("mso-request-id", msorequestId); + variableValueType.put("mso-service-request-timeout", timeout); + + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineRule); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap); + } + + class ProcessThread extends Thread { + + public WorkflowResponse workflowResponse; + public String requestId; + public String processKey; + public AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); + public String request; + public boolean started; + public void run() { + started = true; + executeWorkflow(request, requestId, asyncResponse, processKey); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java new file mode 100644 index 0000000..bff193f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import java.util.UUID; + +import javax.ws.rs.core.Response; + +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContext; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +public class WorkflowContextHolderTest { + + private WorkflowContext createContext(AsynchronousResponse asyncResponse) { + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + String requestId = UUID.randomUUID().toString(); + WorkflowContext workflowContext = new WorkflowContext("testAsyncProcess", + requestId, asyncResponse, 1000L); + contextHolder.put(workflowContext); + return workflowContext; + } + + @Test + @Ignore // BROKEN TEST (previously ignored) + public void testContextExpiry() throws InterruptedException { + + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); + WorkflowContext workflowContext = createContext(asyncResponse); + String requestId = workflowContext.getRequestId(); + WorkflowContext context1 = contextHolder.getWorkflowContext(requestId); + + Assert.assertNotNull(context1); + Assert.assertEquals(requestId, context1.getRequestId()); + Assert.assertEquals(workflowContext.getProcessKey(), context1.getProcessKey()); + Assert.assertEquals(workflowContext.getStartTime(), context1.getStartTime()); + + Thread.sleep(1000); + //context should not be available after a second + WorkflowContext context2 = contextHolder.getWorkflowContext(requestId); + Assert.assertNull(context2); + } + + @Test + public void testProcessCallback() { + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); + WorkflowContext workflowContext = createContext(asyncResponse); + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setMessage("Success"); + callbackResponse.setResponse("Successfully processed request"); + callbackResponse.setStatusCode(200); + + Response response = contextHolder.processCallback("testAsyncProcess", + "process-instance-id", workflowContext.getRequestId(), + callbackResponse); + WorkflowResponse response1 = (WorkflowResponse) response.getEntity(); + Assert.assertNotNull(response1.getMessage()); + Assert.assertEquals(200,response1.getMessageCode()); + Assert.assertEquals("Success", response1.getMessage()); + Assert.assertEquals("Successfully processed request", response1.getResponse()); + verify(asyncResponse).setResponse(any(Response.class)); + + WorkflowContext context1 = contextHolder.getWorkflowContext(workflowContext.getRequestId()); + Assert.assertNull(context1); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java new file mode 100644 index 0000000..c475213 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java @@ -0,0 +1,1796 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.ws.rs.core.Response; +import javax.xml.bind.JAXBException; +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.history.HistoricProcessInstance; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.test.ProcessEngineRule; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.custommonkey.xmlunit.DetailedDiff; +import org.custommonkey.xmlunit.XMLUnit; +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.junit.Before; +import org.junit.Rule; +import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory; +import org.openecomp.mso.bpmn.common.adapter.vnf.MsoRequest; +import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; +import org.openecomp.mso.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.core.CamundaDBSetup; +import org.openecomp.mso.bpmn.core.PropertyConfigurationSetup; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + + + +/** + * A base class for Workflow tests. + *

+ * WireMock response transformers may be specified by declaring public + * static fields with the @WorkflowTestTransformer annotation. For example: + *

+ *     @WorkflowTestTransformer
+ *     public static final ResponseTransformer sdncAdapterMockTransformer =
+ *         new SDNCAdapterMockTransformer();
+ * 
+ */ +public class WorkflowTest { + @Rule + public final ProcessEngineRule processEngineRule = new ProcessEngineRule(); + + @Rule + public final WireMockRule wireMockRule; + + /** + * Constructor. + */ + public WorkflowTest() throws RuntimeException { + // Process WorkflowTestTransformer annotations + List transformerList = new ArrayList(); + + for (Field field : getClass().getFields()) { + WorkflowTestTransformer annotation = (WorkflowTestTransformer) + field.getAnnotation(WorkflowTestTransformer.class); + + if (annotation == null) { + continue; + } + + if (!Modifier.isStatic(field.getModifiers())) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " has a @WorkflowTestTransformer " + + " annotation but it is not declared static"); + } + + ResponseTransformer transformer; + + try { + transformer = (ResponseTransformer) field.get(null); + } catch (IllegalAccessException e) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " is not accessible", e); + } catch (ClassCastException e) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " is not a ResponseTransformer", e); + } + + if (transformer == null) { + continue; + } + + transformerList.add(transformer); + } + + ResponseTransformer[] transformerArray = + transformerList.toArray(new ResponseTransformer[transformerList.size()]); + + wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig() + .port(28090).extensions(transformerArray)); + } + + @Before + public void testSetup() throws Exception { + CamundaDBSetup.configure(); + PropertyConfigurationSetup.init(); + } + + /** + * The current request ID. Normally set when an "invoke" method is called. + */ + protected volatile String msoRequestId = null; + + /** + * The current service instance ID. Normally set when an "invoke" method + * is called. + */ + protected volatile String msoServiceInstanceId = null; + + /** + * Logs a test start method. + */ + protected void logStart() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + String method = st[2].getMethodName(); + System.out.println("STARTED TEST: " + method); + } + + /** + * Logs a test end method. + */ + protected void logEnd() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + String method = st[2].getMethodName(); + System.out.println("ENDED TEST: " + method); + } + + /** + * Invokes a subprocess. + * @param processKey the process key + * @param businessKey a unique key that will identify the process instance + * @param injectedVariables variables to inject into the process + */ + protected void invokeSubProcess(String processKey, String businessKey, + Map injectedVariables) { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + System.out.println("JVM args = " + arguments); + + msoRequestId = (String) injectedVariables.get("mso-request-id"); + + if (msoRequestId == null) { + String msg = "mso-request-id variable was not provided"; + System.out.println(msg); + fail(msg); + } + + // Note: some scenarios don't have a service-instance-id, may be null + msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables); + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @return a TestAsyncResponse object associated with the test + */ + protected TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request) { + return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null); + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @return a TestAsyncResponse object associated with the test + */ + public TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request, + Map injectedVariables) { + + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + System.out.println("JVM args = " + arguments); + + Map variables = createVariables(schemaVersion, businessKey, + request, injectedVariables, false); + VariableMapImpl variableMapImpl = createVariableMapImpl(variables); + + System.out.println("Sending " + request + " to " + processKey + " process"); + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + workflowResource.setProcessEngineServices4junit(processEngineRule); + + TestAsyncResponse asyncResponse = new TestAsyncResponse(); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl); + return asyncResponse; + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @param serviceInstantiationModel indicates whether this method is being + * invoked for a flow that is designed using the service instantiation model + * @return a TestAsyncResponse object associated with the test + */ + protected TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request, + Map injectedVariables, boolean serviceInstantiationModel) { + + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + System.out.println("JVM args = " + arguments); + + Map variables = createVariables(schemaVersion, businessKey, + request, injectedVariables, serviceInstantiationModel); + VariableMapImpl variableMapImpl = createVariableMapImpl(variables); + + System.out.println("Sending " + request + " to " + processKey + " process"); + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + workflowResource.setProcessEngineServices4junit(processEngineRule); + + TestAsyncResponse asyncResponse = new TestAsyncResponse(); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl); + return asyncResponse; + } + + /** + * Private helper method that creates a variable map for a request. + * Errors are handled with junit assertions and will cause the test to fail. + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @param serviceInstantiationModel indicates whether this method is being + * invoked for a flow that is designed using the service instantiation model + * @return a variable map + */ + private Map createVariables(String schemaVersion, + String businessKey, String request, Map injectedVariables, + boolean serviceInstantiationModel) { + + Map variables = new HashMap(); + + // These variables may be overridded by injected variables. + variables.put("mso-service-request-timeout", "180"); + variables.put("isDebugLogEnabled", "true"); + + // These variables may not be overridded by injected variables. + String[] notAllowed = new String[] { + "mso-schema-version", + "mso-business-key", + "bpmnRequest", + "mso-request-id", + "mso-service-instance-id" + }; + + if (injectedVariables != null) { + for (String key : injectedVariables.keySet()) { + for (String var : notAllowed) { + if (var.equals(key)) { + String msg = "Cannot specify " + var + " in injected variables"; + System.out.println(msg); + fail(msg); + } + } + + variables.put(key, injectedVariables.get(key)); + } + } + + variables.put("mso-schema-version", schemaVersion); + variables.put("mso-business-key", businessKey); + variables.put("bpmnRequest", request); + + if (serviceInstantiationModel) { + + /* + * The request ID and the service instance ID are generated for flows + * that follow the service instantiation model unless "requestId" and + * "serviceInstanceId" are injected variables. + */ + + try { + msoRequestId = (String) injectedVariables.get("requestId"); + variables.put("mso-request-id", msoRequestId); + msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId"); + variables.put("mso-service-instance-id", msoServiceInstanceId); + } + catch(Exception e) { + } + if (msoRequestId == null || msoRequestId.trim().equals("")) { + System.out.println("No requestId element in injectedVariables"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + } + if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) { + System.out.println("No seviceInstanceId element in injectedVariables"); + variables.put("mso-service-instance-id", UUID.randomUUID().toString()); + } + + } else { + msoRequestId = getXMLTextElement(request, "request-id"); + + if (msoRequestId == null) { + //check in injected variables + try { + msoRequestId = (String) injectedVariables.get("requestId"); + } + catch(Exception e) { + } + if (msoRequestId == null || msoRequestId.trim().equals("")) { + String msg = "No request-id element in " + request; + System.out.println(msg); + fail(msg); + } + } + + variables.put("mso-request-id", msoRequestId); + + // Note: some request types don't have a service-instance-id + msoServiceInstanceId = getXMLTextElement(request, "service-instance-id"); + + if (msoServiceInstanceId != null) { + variables.put("mso-service-instance-id", msoServiceInstanceId); + } + } + + return variables; + } + + /** + * Private helper method that creates a camunda VariableMapImpl from a simple + * variable map. + * @param variables the simple variable map + * @return a VariableMap + */ + private VariableMapImpl createVariableMapImpl(Map variables) { + Map wrappedVariables = new HashMap(); + + for (String key : variables.keySet()) { + Object value = variables.get(key); + wrappedVariables.put(key, wrapVariableValue(value)); + } + + VariableMapImpl variableMapImpl = new VariableMapImpl(); + variableMapImpl.put("variables", wrappedVariables); + return variableMapImpl; + } + + /** + * Private helper method that wraps a variable value for inclusion in a + * camunda VariableMapImpl. + * @param value the variable value + * @return the wrapped variable + */ + private Map wrapVariableValue(Object value) { + HashMap valueMap = new HashMap(); + valueMap.put("value", value); + return valueMap; + } + + /** + * Receives a response from an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param businessKey the process business key + * @param asyncResponse the TestAsyncResponse object associated with the test + * @param timeout the timeout in milliseconds + * @return the WorkflowResponse + */ + public WorkflowResponse receiveResponse(String businessKey, + TestAsyncResponse asyncResponse, long timeout) { + System.out.println("Waiting " + timeout + "ms for process with business key " + businessKey + + " to send a response"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + while (now <= endTime) { + Response response = asyncResponse.getResponse(); + + if (response != null) { + System.out.println("Received a response from process with business key " + businessKey); + + Object entity = response.getEntity(); + + if (!(entity instanceof WorkflowResponse)) { + String msg = "Response entity is " + + (entity == null ? "null" : entity.getClass().getName()) + + ", expected WorkflowResponse"; + System.out.println(msg); + fail(msg); + return null; // unreachable + } + + return (WorkflowResponse) entity; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for a response from process with business key " + + businessKey; + System.out.println(msg); + fail(msg); + return null; // unreachable + } + + now = System.currentTimeMillis(); + } + + String msg = "No response received from process with business key " + businessKey + + " within " + timeout + "ms"; + System.out.println(msg); + fail("Process with business key " + businessKey + " did not end within 10000ms"); + return null; // unreachable + } + + /** + * Runs a program to inject SDNC callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     reserve, assign, delete:ERR
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' SDNC request"; + System.out.println(msg); + fail(msg); + } + } else if ("ERR".equals(modifier)) { + content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}"; + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectSDNCRestCallback(content, 10000)) { + fail("Failed to inject SDNC '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject SDNC events into the test environment. + * A program is essentially just a list of keys that identify event data + * to be injected, in sequence. An example program: + *
+	 *     event1, event2
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * Defaults the Event Type to "SDNCAEvent" for backward compatibility. + * @param callbacks an object containing event data for the program + * @param program the program to execute + */ + protected void injectSDNCEvents(CallbackSet callbacks, String program) { + injectSDNCEvents(callbacks, program, "SDNCAEvent"); + } + + /** + * Runs a program to inject SDNC events into the test environment. + * A program is essentially just a list of keys that identify event data + * to be injected, in sequence. An example program: + *
+	 *     event1, event2
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing event data for the program + * @param program the program to execute + * @param eventType (i.e. "SDNCAEvent", "SNIROResponse", etc.) + */ + protected void injectSDNCEvents(CallbackSet callbacks, String program, String eventType) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No SDNC event callback defined for '" + action + "'"; + System.out.println(msg); + fail(msg); + } + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectWorkflowMessage(eventType, content, 10000)) { + fail("Failed to inject SDNC '" + action + "' event"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' event"); + } + } + } + + /** + * Runs a program to inject SDNC callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     reserve, assign, delete:ERR
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + public void injectSDNCCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + int respCode = 200; + String respMsg = "OK"; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' SDNC request"; + System.out.println(msg); + fail(msg); + } + + respCode = 200; + respMsg = "OK"; + } else if ("ERR".equals(modifier)) { + content = "((REQUEST-ID))500SIMULATED ERROR FROM SDNC ADAPTER"; + respCode = 500; + respMsg = "SERVER ERROR"; + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectSDNCCallback(respCode, respMsg, content, 10000)) { + fail("Failed to inject SDNC '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject VNF adapter REST callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     create, rollback
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + public void injectVNFRestCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' VNF REST request"; + System.out.println(msg); + fail(msg); + } + } else if ("ERR".equals(modifier)) { + content = "SIMULATED ERROR FROM VNF ADAPTER"; + } else { + String msg = "Invalid VNF REST program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectVnfAdapterRestCallback(content, 10000)) { + fail("Failed to inject VNF REST '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of VNF REST '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject VNF callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
+	 *     createVnf, deleteVnf
+	 * 
+ * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectVNFCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' VNF request"; + System.out.println(msg); + fail(msg); + } + + } else if ("ERR".equals(modifier)) { + String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } else { + String msg = "Invalid VNF program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + boolean injected = false; + + if (content.contains("createVnfNotification")) { + injected = injectCreateVNFCallback(content, 10000); + } else if (content.contains("deleteVnfNotification")) { + injected = injectDeleteVNFCallback(content, 10000); + } else if (content.contains("updateVnfNotification")) { + injected = injectUpdateVNFCallback(content, 10000); + } + + if (!injected) { + String msg = "Failed to inject VNF '" + action + "' callback"; + System.out.println(msg); + fail(msg); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of VNF '" + action + "' callback"); + } + } + } + + /** + * Waits for the number of running processes with the specified process + * definition key to equal a particular count. + * @param processKey the process definition key + * @param count the desired count + * @param timeout the timeout in milliseconds + */ + public void waitForRunningProcessCount(String processKey, int count, long timeout) { + System.out.println("Waiting " + timeout + "ms for there to be " + count + " " + + processKey + " instances"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + int last = -1; + + while (now <= endTime) { + int actual = processEngineRule.getRuntimeService() + .createProcessInstanceQuery() + .processDefinitionKey(processKey) + .list().size(); + + if (actual != last) { + System.out.println("There are now " + actual + " " + + processKey + " instances"); + last = actual; + } + + if (actual == count) { + return; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for there to be " + count + " " + + processKey + " instances"; + System.out.println(msg); + fail(msg); + } + + now = System.currentTimeMillis(); + } + + String msg = "Timed out waiting for there to be " + count + " " + + processKey + " instances"; + System.out.println(msg); + fail(msg); + } + + /** + * Waits for the specified process variable to be set. + * @param processKey the process definition key + * @param variable the variable name + * @param timeout the timeout in milliseconds + * @return the variable value, or null if it cannot be obtained + * in the specified time + */ + protected Object getProcessVariable(String processKey, String variable, + long timeout) { + + System.out.println("Waiting " + timeout + "ms for " + + processKey + "." + variable + " to be set"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + ProcessInstance processInstance = null; + Object value = null; + + while (value == null) { + if (now > endTime) { + if (processInstance == null) { + System.out.println("Timed out waiting for " + + processKey + " to start"); + } else { + System.out.println("Timed out waiting for " + + processKey + "[" + processInstance.getId() + + "]." + variable + " to be set"); + } + + return null; + } + + if (processInstance == null) { + processInstance = processEngineRule.getRuntimeService() + .createProcessInstanceQuery() + .processDefinitionKey(processKey) + .singleResult(); + } + + if (processInstance != null) { + value = processEngineRule.getRuntimeService() + .getVariable(processInstance.getId(), variable); + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + System.out.println("Interrupted waiting for " + + processKey + "." + variable + " to be set"); + return null; + } + + now = System.currentTimeMillis(); + } + + System.out.println(processKey + "[" + + processInstance.getId() + "]." + variable + "=" + + value); + + return value; + } + + /** + * Injects a single SDNC adapter callback request. The specified callback data + * may contain the placeholder string ((REQUEST-ID)) which is replaced with + * the actual SDNC request ID. Note: this is not the requestId in the original + * MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectSDNCRestCallback(String content, long timeout) { + String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1", + "SDNCAResponse_CORRELATOR", timeout); + + if (sdncRequestId == null) { + return false; + } + + content = content.replace("((REQUEST-ID))", sdncRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", sdncRequestId); + + System.out.println("Injecting SDNC adapter callback"); + WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); + workflowMessageResource.setProcessEngineServices4junit(processEngineRule); + Response response = workflowMessageResource.deliver("SDNCAResponse", sdncRequestId, content); + System.out.println("Workflow response to SDNC adapter callback: " + response); + return true; + } + + /** + * Injects a single SDNC adapter callback request. The specified callback data + * may contain the placeholder string ((REQUEST-ID)) which is replaced with + * the actual SDNC request ID. Note: this is not the requestId in the original + * MSO request. + * @param content the content of the callback + * @param respCode the response code (normally 200) + * @param respMsg the response message (normally "OK") + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectSDNCCallback(int respCode, String respMsg, + String content, long timeout) { + + String sdncRequestId = (String) getProcessVariable("sdncAdapter", + "SDNCA_requestId", timeout); + + if (sdncRequestId == null) { + return false; + } + + content = content.replace("((REQUEST-ID))", sdncRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", sdncRequestId); + + System.out.println("Injecting SDNC adapter callback"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(sdncRequestId); + callbackHeader.setResponseCode(String.valueOf(respCode)); + callbackHeader.setResponseMessage(respMsg); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(content); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + System.out.println("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); + + return true; + } + + /** + * Injects a single VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. Note: this is not the requestId in the original + * MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectVnfAdapterRestCallback(String content, long timeout) { + String messageId = (String) getProcessVariable("vnfAdapterRestV1", + "VNFAResponse_CORRELATOR", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + System.out.println("Injecting VNF adapter callback"); + WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); + workflowMessageResource.setProcessEngineServices4junit(processEngineRule); + Response response = workflowMessageResource.deliver("VNFAResponse", messageId, content); + System.out.println("Workflow response to VNF adapter callback: " + response); + return true; + } + + /** + * Injects a Create VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectCreateVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterCreateV1", + "VNFC_messageId", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + if(content.contains("((REQUEST-ID))")){ + content = content.replace("((REQUEST-ID))", msoRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", msoRequestId); + } + + System.out.println("Injecting VNF adapter callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + CreateVnfNotification createVnfNotification = new CreateVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:createVnfNotification/tns:completed/text()"); + createVnfNotification.setCompleted("true".equals(completed)); + + String vnfId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:vnfId/text()"); + createVnfNotification.setVnfId(vnfId); + + NodeList entries = (NodeList) xpathTool.evaluate( + "/tns:createVnfNotification/tns:outputs/tns:entry", + XPathConstants.NODESET); + + CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs(); + + for (int i = 0; i < entries.getLength(); i++) { + Node node = entries.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element entry = (Element) node; + String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); + String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); + outputs.add(key, value); + } + } + + createVnfNotification.setOutputs(outputs); + + VnfRollback rollback = new VnfRollback(); + + String cloudSiteId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()"); + rollback.setCloudSiteId(cloudSiteId); + + String requestId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); + String serviceInstanceId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); + + if (requestId != null || serviceInstanceId != null) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestId); + msoRequest.setServiceInstanceId(serviceInstanceId); + rollback.setMsoRequest(msoRequest); + } + + String tenantCreated = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()"); + rollback.setTenantCreated("true".equals(tenantCreated)); + + String tenantId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()"); + rollback.setTenantId(tenantId); + + String vnfCreated = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()"); + rollback.setVnfCreated("true".equals(vnfCreated)); + + String rollbackVnfId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()"); + rollback.setVnfId(rollbackVnfId); + + createVnfNotification.setRollback(rollback); + + } catch (Exception e) { + System.out.println("Failed to unmarshal VNF callback content:"); + System.out.println(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + notifyService.setProcessEngineServices4junit(processEngineRule); + + notifyService.createVnfNotification( + messageId, + createVnfNotification.isCompleted(), + createVnfNotification.getException(), + createVnfNotification.getErrorMessage(), + createVnfNotification.getVnfId(), + createVnfNotification.getOutputs(), + createVnfNotification.getRollback()); + + return true; + } + + /** + * Injects a Delete VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectDeleteVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterDeleteV1", + "VNFDEL_uuid", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + System.out.println("Injecting VNF adapter delete callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:deleteVnfNotification/tns:completed/text()"); + deleteVnfNotification.setCompleted("true".equals(completed)); + // if notification failure, set the exception and error message + if (deleteVnfNotification.isCompleted() == false) { + deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL); + deleteVnfNotification.setErrorMessage(xpathTool.evaluate( + "/tns:deleteVnfNotification/tns:errorMessage/text()")) ; + } + + } catch (Exception e) { + System.out.println("Failed to unmarshal VNF Delete callback content:"); + System.out.println(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + notifyService.setProcessEngineServices4junit(processEngineRule); + + notifyService.deleteVnfNotification( + messageId, + deleteVnfNotification.isCompleted(), + deleteVnfNotification.getException(), + deleteVnfNotification.getErrorMessage()); + + return true; + } + + /** + * Injects a Update VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectUpdateVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterUpdate", + "VNFU_messageId", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + content = content.replace("((REQUEST-ID))", msoRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", msoRequestId); + + System.out.println("Injecting VNF adapter callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:completed/text()"); + updateVnfNotification.setCompleted("true".equals(completed)); + + NodeList entries = (NodeList) xpathTool.evaluate( + "/tns:updateVnfNotification/tns:outputs/tns:entry", + XPathConstants.NODESET); + + UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs(); + + for (int i = 0; i < entries.getLength(); i++) { + Node node = entries.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element entry = (Element) node; + String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); + String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); + outputs.add(key, value); + } + } + + updateVnfNotification.setOutputs(outputs); + + VnfRollback rollback = new VnfRollback(); + + String cloudSiteId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); + rollback.setCloudSiteId(cloudSiteId); + + String requestId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); + String serviceInstanceId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); + + if (requestId != null || serviceInstanceId != null) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestId); + msoRequest.setServiceInstanceId(serviceInstanceId); + rollback.setMsoRequest(msoRequest); + } + + String tenantCreated = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()"); + rollback.setTenantCreated("true".equals(tenantCreated)); + + String tenantId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()"); + rollback.setTenantId(tenantId); + + String vnfCreated = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()"); + rollback.setVnfCreated("true".equals(vnfCreated)); + + String rollbackVnfId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()"); + rollback.setVnfId(rollbackVnfId); + + updateVnfNotification.setRollback(rollback); + + } catch (Exception e) { + System.out.println("Failed to unmarshal VNF callback content:"); + System.out.println(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + notifyService.setProcessEngineServices4junit(processEngineRule); + + notifyService.updateVnfNotification( + messageId, + updateVnfNotification.isCompleted(), + updateVnfNotification.getException(), + updateVnfNotification.getErrorMessage(), + updateVnfNotification.getOutputs(), + updateVnfNotification.getRollback()); + + return true; + } + + /** + * Injects a workflow message. The specified callback data may contain the + * placeholder string ((CORRELATOR)) which is replaced with the actual + * correlator value. + * @param content the message type + * @param content the message content + * @param timeout the timeout in milliseconds + * @return true if the event could be injected, false otherwise + */ + protected boolean injectWorkflowMessage(String messageType, String content, long timeout) { + String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", + messageType + "_CORRELATOR", timeout); + + if (correlator == null) { + return false; + } + + content = content.replace("((CORRELATOR))", correlator); + + System.out.println("Injecting " + messageType + " message"); + WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); + workflowMessageResource.setProcessEngineServices4junit(processEngineRule); + Response response = workflowMessageResource.deliver(messageType, correlator, content); + System.out.println("Workflow response to " + messageType + " message: " + response); + return true; + } + + /** + * Wait for the process to end. + * @param businessKey the process business key + * @param timeout the amount of time to wait, in milliseconds + */ + public void waitForProcessEnd(String businessKey, long timeout) { + System.out.println("Waiting " + timeout + "ms for process with business key " + + businessKey + " to end"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + while (now <= endTime) { + if (isProcessEnded(businessKey)) { + System.out.println("Process with business key " + businessKey + " has ended"); + return; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for process with business key " + + businessKey + " to end"; + System.out.println(msg); + fail(msg); + } + + now = System.currentTimeMillis(); + } + + String msg = "Process with business key " + businessKey + + " did not end within " + timeout + "ms"; + System.out.println(msg); + fail(msg); + } + + /** + * Verifies that the specified historic process variable has the specified value. + * If the variable does not have the specified value, the test is failed. + * @param businessKey the process business key + * @param variable the variable name + * @param value the expected variable value + */ + public void checkVariable(String businessKey, String variable, Object value) { + if (!isProcessEnded(businessKey)) { + fail("Cannot get historic variable " + variable + " because process with business key " + + businessKey + " has not ended"); + } + + Object variableValue = getVariableFromHistory(businessKey, variable); + assertEquals(value, variableValue); + } + + /** + * Checks to see if the specified process is ended. + * @param businessKey the process business Key + * @return true if the process is ended + */ + protected boolean isProcessEnded(String businessKey) { + HistoricProcessInstance processInstance = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult(); + return processInstance != null && processInstance.getEndTime() != null; + } + + /** + * Gets a variable value from a historical process instance. + * @param businessKey the process business key + * @param variableName the variable name + * @return the variable value, or null if the variable could not be + * obtained + */ + public Object getVariableFromHistory(String businessKey, String variableName) { + try { + HistoricProcessInstance processInstance = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult(); + + if (processInstance == null) { + return null; + } + + HistoricVariableInstance v = processEngineRule.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + System.out.println("Error retrieving variable " + variableName + + " from historical process with business key " + businessKey + ": " + e); + return null; + } + } + + /** + * Gets the value of a subflow variable from the specified subflow's + * historical process instance. + * + * @param subflowName - the name of the subflow that contains the variable + * @param variableName the variable name + * + * @return the variable value, or null if the variable could not be obtained + * + */ + protected Object getVariableFromSubflowHistory(String subflowName, String variableName) { + try { + List processInstanceList = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); + + Collections.sort(processInstanceList, new Comparator() { + public int compare(HistoricProcessInstance m1, HistoricProcessInstance m2) { + return m1.getStartTime().compareTo(m2.getStartTime()); + } + }); + + HistoricProcessInstance processInstance = processInstanceList.get(0); + + if (processInstanceList == null) { + return null; + } + + HistoricVariableInstance v = processEngineRule.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + System.out.println("Error retrieving variable " + variableName + + " from sub flow: " + subflowName + ", Exception is: " + e); + return null; + } + } + + /** + * Gets the value of a subflow variable from the subflow's + * historical process x instance. + * + * @param subflowName - the name of the subflow that contains the variable + * @param variableName the variable name + * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow) + * + * @return the variable value, or null if the variable could not be obtained + */ + protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) { + try { + List processInstanceList = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); + + Collections.sort(processInstanceList, new Comparator() { + public int compare(HistoricProcessInstance m1, HistoricProcessInstance m2) { + return m1.getStartTime().compareTo(m2.getStartTime()); + } + }); + + HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex); + + if (processInstanceList == null) { + return null; + } + + HistoricVariableInstance v = processEngineRule.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + System.out.println("Error retrieving variable " + variableName + + " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e); + return null; + } + } + + + /** + * Extracts text from an XML element. This method is not namespace aware + * (namespaces are ignored). The first matching element is selected. + * @param xml the XML document or fragment + * @param tag the desired element, e.g. "" + * @return the element text, or null if the element was not found + */ + protected String getXMLTextElement(String xml, String tag) { + xml = removeXMLNamespaces(xml); + + if (!tag.startsWith("<")) { + tag = "<" + tag + ">"; + } + + int start = xml.indexOf(tag); + + if (start == -1) { + return null; + } + + int end = xml.indexOf('<', start + tag.length()); + + if (end == -1) { + return null; + } + + return xml.substring(start + tag.length(), end); + } + + /** + * Removes namespace definitions and prefixes from XML, if any. + */ + private String removeXMLNamespaces(String xml) { + // remove xmlns declaration + xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); + + // remove opening tag prefix + xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); + + // remove closing tags prefix + xml = xml.replaceAll("()", "$1$3"); + + // remove extra spaces left when xmlns declarations are removed + xml = xml.replaceAll("\\s+>", ">"); + + return xml; + } + + /** + * Asserts that two XML documents are semantically equivalent. Differences + * in whitespace or in namespace usage do not affect the comparison. + * @param expected the expected XML + * @param actual the XML to test + * @throws SAXException + * @throws IOException + */ + public static void assertXMLEquals(String expected, String actual) + throws SAXException, IOException { + XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual)); + List allDifferences = diff.getAllDifferences(); + assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size()); + } + + /** + * A test implementation of AsynchronousResponse. + */ + public class TestAsyncResponse implements AsynchronousResponse { + Response response = null; + + /** + * {@inheritDoc} + */ + @Override + public synchronized void setResponse(Response response) { + this.response = response; + } + + /** + * Gets the response. + * @return the response, or null if none has been produced yet + */ + public synchronized Response getResponse() { + return response; + } + } + + /** + * An object that contains callback data for a "program". + */ + public class CallbackSet { + private final Map map = new HashMap(); + + /** + * Add callback data to the set. + * @param action the action with which the data is associated + * @param content the callback data + */ + public void put(String action, String content) { + map.put(action, content); + } + + /** + * Retrieve callback data from the set. + * @param action the action with which the data is associated + * @return the callback data, or null if there is none for the specified operation + */ + public String get(String action) { + return map.get(action); + } + } + + /** + * A tool for evaluating XPath expressions. + */ + protected class XPathTool { + private final DocumentBuilderFactory factory; + private final SimpleNamespaceContext context = new SimpleNamespaceContext(); + private final XPath xpath = XPathFactory.newInstance().newXPath(); + private String xml = null; + private Document doc = null; + + /** + * Constructor. + */ + public XPathTool() { + factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + xpath.setNamespaceContext(context); + } + + /** + * Adds a namespace. + * @param prefix the namespace prefix + * @param uri the namespace uri + */ + public synchronized void addNamespace(String prefix, String uri) { + context.add(prefix, uri); + } + + /** + * Sets the XML content to be operated on. + * @param xml the XML content + */ + public synchronized void setXML(String xml) { + this.xml = xml; + this.doc = null; + } + + /** + * Returns the document object. + * @return the document object, or null if XML has not been set + * @throws SAXException + * @throws IOException + * @throws ParserConfigurationException + */ + public synchronized Document getDocument() + throws ParserConfigurationException, IOException, SAXException { + if (xml == null) { + return null; + } + + buildDocument(); + return doc; + } + + /** + * Evaluates the specified XPath expression and returns a string result. + * This method throws exceptions on error. + * @param expression the expression + * @return the result object + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + * @throws XPathExpressionException on error + */ + public synchronized String evaluate(String expression) + throws ParserConfigurationException, SAXException, + IOException, XPathExpressionException { + return (String) evaluate(expression, XPathConstants.STRING); + } + + /** + * Evaluates the specified XPath expression. + * This method throws exceptions on error. + * @param expression the expression + * @param returnType the return type + * @return the result object + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + * @throws XPathExpressionException on error + */ + public synchronized Object evaluate(String expression, QName returnType) + throws ParserConfigurationException, SAXException, + IOException, XPathExpressionException { + + buildDocument(); + XPathExpression expr = xpath.compile(expression); + return expr.evaluate(doc, returnType); + } + + /** + * Private helper method that builds the document object. + * Assumes the calling method is synchronized. + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + */ + private void buildDocument() throws ParserConfigurationException, + IOException, SAXException { + if (doc == null) { + if (xml == null) { + throw new IOException("XML input is null"); + } + + DocumentBuilder builder = factory.newDocumentBuilder(); + InputSource source = new InputSource(new StringReader(xml)); + doc = builder.parse(source); + } + } + } + + /** + * A NamespaceContext class based on a Map. + */ + private class SimpleNamespaceContext implements NamespaceContext { + private Map prefixMap = new HashMap(); + private Map uriMap = new HashMap(); + + public synchronized void add(String prefix, String uri) { + prefixMap.put(prefix, uri); + uriMap.put(uri, prefix); + } + + @Override + public synchronized String getNamespaceURI(String prefix) { + return prefixMap.get(prefix); + } + + @Override + public Iterator getPrefixes(String uri) { + List list = new ArrayList(); + String prefix = uriMap.get(uri); + if (prefix != null) { + list.add(prefix); + } + return list.iterator(); + } + + @Override + public String getPrefix(String uri) { + return uriMap.get(uri); + } + } + + /** + * A VnfNotify XPathTool. + */ + protected class VnfNotifyXPathTool extends XPathTool { + public VnfNotifyXPathTool() { + addNamespace("tns", "http://org.openecomp.mso/vnfNotify"); + } + } + + /** + * Helper class to make it easier to create this type. + */ + private static class CreateVnfNotificationOutputs + extends org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs { + public void add(String key, String value) { + Entry entry = new Entry(); + entry.setKey(key); + entry.setValue(value); + getEntry().add(entry); + } + } + + /** + * Helper class to make it easier to create this type. + */ + private static class UpdateVnfNotificationOutputs + extends org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs { + public void add(String key, String value) { + Entry entry = new Entry(); + entry.setKey(key); + entry.setValue(value); + getEntry().add(entry); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java new file mode 100644 index 0000000..4aa6fbe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java @@ -0,0 +1,21 @@ +package org.openecomp.mso.bpmn.common; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Allows a subclass of WorkflowTest to specify one or more WireMock + * response transformers. A transformer must be declared as a public + * static field in the subclass. For example: + *
+ *     @WorkflowTestTransformer
+ *     public static final ResponseTransformer sdncAdapterMockTransformer =
+ *         new SDNCAdapterMockTransformer();
+ * 
+ */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface WorkflowTestTransformer { +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml new file mode 100644 index 0000000..2cf94b2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml @@ -0,0 +1,25 @@ + + + + + + + + testRequestId + 200 + OK + + <output + xmlns="com:att:sdnctl:vnf"><response-code>500</response-code><response-message>'Error + retrieving l3-network with network-id=' + + $network-topology-operation-input.network-request-information.network-id + + 'from + AnAI'</response-message><ack-final-indicator>Y</ack-final-indicator><svc-request-id>006927ca-f5a3-47fd-880c-dfcbcd81a093</svc-request-id></output> + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml new file mode 100644 index 0000000..57dc2d6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml @@ -0,0 +1,17 @@ + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml new file mode 100644 index 0000000..52d2b01 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml @@ -0,0 +1,22 @@ + + a8399879-31b3-4973-be26-0a0cbe776b58 + MoG_CinderVolumes_2 + MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 + VmogSvc/moge2e2 + Active + 1458839419 + + + tenant + https://aai-app-e2e.test.att.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + tenant.tenant-name + MOG-25208-D-01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml new file mode 100644 index 0000000..79e7d84 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml @@ -0,0 +1,22 @@ + + a8399879-31b3-4973-be26-0a0cbe776b58 + MoG_CinderVolumes_2 + MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 + VmogSvc/moge2e2 + Active + 1458839419 + + + tenant + https://aai-app-e2e.test.att.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 83464847234ee8937416c65507d267 + + + tenant.tenant-name + MOG-25208-D-01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql new file mode 100644 index 0000000..67c139e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql @@ -0,0 +1,140 @@ +/* +Camunda Version: 7.5.4-ee; MariaDB tested +Date: 11.30.2016 +Balaji Mudipalli, AJSC Camunda Team + +DOC.: +-------------------------------------------------------------------------------------- +Create ARCHIVE_CAMUNDA_HISTORY StoreProcedure -function for archiving of history camunda tables. +*/ + +/* uncomment below statement and run for your db, e.g. : use camundabpmn; + */ +-- use ; +use camundabpmn; +DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; + +DELIMITER // + +CREATE PROCEDURE ARCHIVE_CAMUNDA_HISTORY(IN IN_periodInDays INT, IN IN_maxProcessInstances INT) +MODIFIES SQL DATA + +BEGIN + DECLARE P_hiTableCount INT; + DECLARE P_executionId BIGINT; + DECLARE P_piProcessed DOUBLE; + DECLARE P_baProcessed DOUBLE; + DECLARE P_startDate DATE; + DECLARE P_executionDuration double; + + DECLARE not_found INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found = 1; + + /* START TRANSACTION */ + set P_startDate = sysdate(); + set P_executionId = NextVal('STAT_EXECUTION_SEQ'); + + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_executionId value is ',P_executionId); + + DELETE FROM TMP_ARCHIVING_PROCINST; + DELETE FROM TMP_ARCHIVING_BYTEARRAY; + -- temp table -- + DELETE FROM TMPLOGTABLE; + + + /* 1. Set Default Value for Max Pi's */ + IF IN_maxProcessInstances = 0 THEN SET IN_maxProcessInstances = 1000; END IF; + IF IN_maxProcessInstances > 1000 THEN SET IN_maxProcessInstances = 1000; END IF; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('IN_maxProcessInstances value is: ',IN_maxProcessInstances); + + /* 2. Fill TMP_ARCHIVING_PROCINST with candidates: */ + IF IN_maxProcessInstances = 0 THEN /* all */ + INSERT INTO TMP_ARCHIVING_PROCINST + SELECT hi.PROC_INST_ID_, hi.END_TIME_ + FROM ACT_HI_PROCINST hi + WHERE hi.END_TIME_ IS NOT NULL + AND hi.END_TIME_ <= ( DATE_SUB(SYSDATE(), INTERVAL IN_periodInDays DAY)); + + ELSE /* limit: IN_maxProcessInstances */ + INSERT INTO TMP_ARCHIVING_PROCINST + (PROC_INST_ID_, END_TIME_) ( + SELECT hi2.PROC_INST_ID_, hi2.END_TIME_ + FROM ACT_HI_PROCINST hi2 + WHERE hi2.END_TIME_ IS NOT NULL + AND hi2.END_TIME_ <= ( DATE_SUB(SYSDATE(), INTERVAL IN_periodInDays DAY)) + ) LIMIT IN_maxProcessInstances; + END IF; + + /* 3. Check PI's im TEMP if any found, ready for ACHIVING */ + select count(*) INTO P_piProcessed FROM TMP_ARCHIVING_PROCINST; + + IF P_piProcessed = 0 THEN + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_piProcessed value is: ',P_piProcessed); + ROLLBACK; + /* 4. Move data from history to archive (insert to archive and delete in history) */ + ELSE + SELECT COUNT(*)+1 INTO P_hiTableCount FROM camunda_hi_tables; + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_hiTableCount value is ',P_hiTableCount); + SET @i = 1; + WHILE @i < P_hiTableCount + DO + SELECT TableName_ INTO @P_tableName FROM camunda_hi_tables WHERE id_ = @i; + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_tableName: ', @P_tableName); + + Set @P_archiveTableName = Concat('ARCHIVE_',IFNULL(@P_tableName, '')); + INSERT INTO TMPLOGTABLE SELECT CONCAT('@P_archiveTableName: ', @P_archiveTableName); + + SET @query1 = CONCAT('INSERT INTO ', @P_archiveTableName , + ' SELECT hi3.*, ',P_executionId, ', NOW() FROM ', @P_tableName,' hi3 + WHERE hi3.PROC_INST_ID_ in ( SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST)'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('@query1: ', @query1); + + PREPARE stmt1 FROM @query1; + EXECUTE stmt1; + DEALLOCATE PREPARE stmt1; + + SET @query2 = CONCAT ('DELETE ACT FROM ',@P_tableName,' ACT INNER JOIN TMP_ARCHIVING_PROCINST TMP ON ACT.PROC_INST_ID_ = TMP.PROC_INST_ID_'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('@query2: ', @query2); + + PREPARE stmt2 FROM @query2; + EXECUTE stmt2; + DEALLOCATE PREPARE stmt2; + + SET @i = @i+1; + END WHILE; + /* select bytearray_ids */ + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_VARINST archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_DETAIL archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + /* 5. Check Bytearrays im TEMP if any found, ready for ACHIVING */ + select count(*) INTO P_baProcessed FROM TMP_ARCHIVING_BYTEARRAY; + + /* INSERT */ + INSERT INTO ARCHIVE_ACT_GE_BYTEARRAY + SELECT hi4.*, P_executionId, NOW() FROM ACT_GE_BYTEARRAY hi4 + WHERE hi4.ID_ in ( SELECT BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); + + /* DELETE */ + DELETE FROM ACT_GE_BYTEARRAY WHERE ID_ in (select BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); + + /* COMMIT TRANSACTION */ + COMMIT; + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_executionId is ', P_executionId); + + set P_executionDuration = DATEDIFF(sysdate(), P_startDate); + + INSERT INTO TMPLOGTABLE SELECT CONCAT('SP success and P_executionDuration is ', ifnull((round(P_executionDuration*24*60*60, 1)), ''), ' sec.'); + END IF; + + END; +// + +DELIMITER ; \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql new file mode 100644 index 0000000..f3ba294 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql @@ -0,0 +1,210 @@ +/* +Camunda Version: 7.5.4-ee; MariaDB tested +Date: 11.30.2016 +Balaji Mudipalli, AJSC Camunda Team + +DOC.: +-------------------------------------------------------------------------------------- +Create ROLLB_ARCHIVE_CAMUNDA_HISTORY StoreProcedure for ROLLBACK (RESTORE) +of archived Camunda history tables. +*/ + +/* uncomment below statement and run for your db, e.g. : use camundabpmn; + */ +-- use ; +use camundabpmn; + +DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; + +DELIMITER // +CREATE PROCEDURE ROLLB_ARCHIVE_CAMUNDA_HISTORY(IN IN_executionId_from INT, + IN IN_executionId_til INT, + IN IN_maxProcessInstances INT) +MODIFIES SQL DATA + +BEGIN + DECLARE P_hiTableCount INT; + DECLARE P_piProcessed DOUBLE; + DECLARE P_baProcessed DOUBLE; + DECLARE P_query VARCHAR(600); + DECLARE P_startDate DATETIME; + DECLARE P_executionDuration DOUBLE; + DECLARE P_result NVARCHAR(400); +DECLARE not_found INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found = 1; + + + /* START TRANSACTION */ + SET P_startDate = sysdate(); + DELETE FROM TMPLOGTABLE; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: START EXECUTION: ' , ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , + '; PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , + '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , + '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); + + /* 1. Truncate TMP_ARCHIVING_PROCINST */ + + DELETE FROM TMP_ARCHIVING_PROCINST; + DELETE FROM TMP_ARCHIVING_BYTEARRAY; + + /* 2. Fill TMP_ARCHIVING_PROCINST with candidates: */ + IF IN_executionId_til = -1 THEN /* IN_executionId_from only */ + SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID = ' , IFNULL(IN_executionId_from, '')); + + ELSEIF IN_executionId_til = 0 THEN /* all from IN_executionId_from */ + SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID >= ' , IFNULL(IN_executionId_from, '')); + + ELSE /* between IN_executionId_from AND IN_executionId_til */ + SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID between ', IFNULL(IN_executionId_from, '') , ' AND ' , IFNULL(IN_executionId_til, '')); + END IF; + + IF IN_maxProcessInstances = 0 THEN /* all */ + + SET @P_query1 = CONCAT('INSERT INTO TMP_ARCHIVING_PROCINST ', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' SELECT PROC_INST_ID_, END_TIME_ FROM ARCHIVE_ACT_HI_PROCINST ', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' ', Ifnull(P_query, '')); + + ELSE /* limit: IN_maxProcessInstances */ + SET @P_query1 = CONCAT('INSERT INTO TMP_ARCHIVING_PROCINST ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' (PROC_INST_ID_, END_TIME_ ) ( ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' SELECT PROC_INST_ID_, END_TIME_ FROM ARCHIVE_ACT_HI_PROCINST ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' ', Ifnull(P_query, '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ') LIMIT ', IFNULL(IN_maxProcessInstances, '')); + END IF; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /fill temp table with PI candidates/ ' , Ifnull(P_query, '')); + + PREPARE stmt1 FROM @P_query1; + EXECUTE stmt1; + DEALLOCATE PREPARE stmt1; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('.... rows inserted into TMP_ARCHIVING_PROCINST: ' , IFNULL((ROW_COUNT()), '')); + + /* 3. Fill TMP_ARCHIVING_BYTEARRAYS with candidates: */ + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_VARINST archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_DETAIL archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + select count(*) INTO P_baProcessed FROM TMP_ARCHIVING_BYTEARRAY; + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ', IFNULL(P_baProcessed, '') ,' ByteArray candidates for rollback found!' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + + /* 4. Check PI's im TEMP ready for ROLLBACK */ + select count(*) INTO P_piProcessed FROM TMP_ARCHIVING_PROCINST; + + IF P_piProcessed = 0 THEN /* no candidates found */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: NO ProcessInstance-Candidates for archive-Rollback found! '); + INSERT INTO TMPLOGTABLE SELECT CONCAT('Try TA-ROLLBACK ...'); + ROLLBACK; /*-- TMP_ARCHIVING_PROCINST un-Delete */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('TA-ROLLBACK DONE! ...' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + SET P_result = CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: NO ProcessInstance candidates for archive-Rollback found!', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' Used PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , + '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , + '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); + + INSERT INTO TMPLOGTABLE SELECT CONCAT(P_result); + + ELSE + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ', IFNULL(P_piProcessed, '') ,' ProcessInstance candidates for Rollback found!'); + + /* LOOP over tables */ + SELECT COUNT(*)+1 INTO P_hiTableCount FROM camunda_hi_tables; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_hiTableCount value is ',P_hiTableCount); + + SET @i = 1; + + WHILE @i < P_hiTableCount + DO + SELECT TableName_ INTO @P_tableName FROM camunda_hi_tables WHERE id_ = @i; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ####### Start restore from: ARCHIVE_' , IFNULL(@P_tableName, '') ,' ...'); + + SET @P_tableFields = CONCAT(''); + + select GROUP_CONCAT(column_name order by ordinal_position) + INTO @P_tableFields + from information_schema.columns + where table_schema = (select DATABASE()) AND TABLE_NAME = @P_tableName; + + /* INSERT */ + SET @P_query2 = CONCAT('INSERT INTO ', IFNULL(@P_tableName, '') , + ' SELECT ' , @P_tableFields, + ' FROM ARCHIVE_' , IFNULL(@P_tableName, '') , + ' WHERE PROC_INST_ID_ in ( SELECT tmp.PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST tmp)'); + + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /copy back to history table/ ' , Ifnull(@P_query2, '')); + + PREPARE stmt2 FROM @P_query2; + EXECUTE stmt2; + DEALLOCATE PREPARE stmt2; + + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows inserted: ' , IFNULL((ROW_COUNT()), '')); + + /* DELETE */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: Delete in Archive: ARCHIVE_' , IFNULL(@P_tableName, '') ,' ...'); + /* SET @P_query3 = CONCAT(' DELETE FROM ARCHIVE_' , IFNULL(@P_tableName, '') , ' WHERE PROC_INST_ID_ in (select PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST)'); */ + SET @P_query3 = CONCAT('DELETE ARCH FROM ARCHIVE_' , IFNULL(@P_tableName, '') , + ' ARCH INNER JOIN TMP_ARCHIVING_PROCINST TMP ON ARCH.PROC_INST_ID_ = TMP.PROC_INST_ID_'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): ' , Ifnull(@P_query3, '')); + PREPARE stmt3 FROM @P_query3; + EXECUTE stmt3; + DEALLOCATE PREPARE stmt3; + + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows deleted: ' , IFNULL((ROW_COUNT()), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + SET @i = @i+1; + END WHILE; + + /* INSERT */ + SET @P_tableFields2 = CONCAT(''); /* reset, becouse had some problems with double columns */ + /* fetch table column names into P_tableFields : */ + select GROUP_CONCAT(COLUMN_NAME order by ordinal_position) + INTO @P_tableFields2 + from information_schema.columns + where table_schema = (select DATABASE()) AND TABLE_NAME = 'ACT_GE_BYTEARRAY'; + + SET @P_query4 = CONCAT('INSERT INTO ACT_GE_BYTEARRAY ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' SELECT ' , IFNULL(@P_tableFields2, '') ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' FROM ARCHIVE_ACT_GE_BYTEARRAY' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' WHERE ID_ in ( SELECT tmp.BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY tmp)'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /copy back to history table/ ' , Ifnull(@P_query4, '')); + PREPARE stmt4 FROM @P_query4; + EXECUTE stmt4; + DEALLOCATE PREPARE stmt4; + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows inserted: ' , IFNULL((ROW_COUNT()), '')); + + /* DELETE */ + /* DELETE FROM ARCHIVE_ACT_GE_BYTEARRAY WHERE ID_ in (select BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); */ + DELETE AAGB FROM ARCHIVE_ACT_GE_BYTEARRAY AAGB INNER JOIN TMP_ARCHIVING_BYTEARRAY TMP_B ON AAGB.ID_ = TMP_B.BYTEARRAY_ID_; + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows deleted: ' , IFNULL((ROW_COUNT()), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + /* COMMIT TRANSACTION */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: PIs processed: ' , IFNULL(P_piProcessed, '')) ; + COMMIT; + INSERT INTO TMPLOGTABLE SELECT CONCAT('TA-COMMIT DONE!' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + SET P_executionDuration = DATEDIFF(sysdate(), P_startDate); + + SET P_result = CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: EXECUTED (commited) successfully! ' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , '; Duration: ' , ifnull((round(P_executionDuration*24*60*60, 1)), ''), ' sec.' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '') , + ' PIs processed: ' , IFNULL(P_piProcessed, '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' Used PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , + '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , + '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); + + INSERT INTO TMPLOGTABLE SELECT CONCAT(P_result); + END IF; + END; +// + +DELIMITER ; diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql new file mode 100644 index 0000000..10e9930 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql @@ -0,0 +1,76 @@ +-- Fix for https://itrack.web.att.com/browse/AJSCCMDA-90 -- +use camundabpmn; +/* +Drop a archive tables +*/ +/*-- TMP_ARCHIVING_PROCINST */ +DROP TABLE IF EXISTS TMP_ARCHIVING_PROCINST; + +/*-- TMP_ARCHIVING_BYTEARRAY */ +DROP TABLE IF EXISTS TMP_ARCHIVING_BYTEARRAY; + +/*-- TMP LOG TABLE */ +DROP TABLE IF EXISTS TMPLOGTABLE; + +/* -- Camunda Hi Tables --*/ +DROP TABLE IF EXISTS Camunda_Hi_Tables; + +/* drop own extentions columns: +alter table ARCHIVE_ACT_HI_PROCINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ACTINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_TASKINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_VARINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_DETAIL DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_COMMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ATTACHMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_OP_LOG DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_INCIDENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +*/ + +/*--#1 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_PROCINST; +/*--#2 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ACTINST; +/*--#3 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_TASKINST; +/*--#4 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_VARINST; +/*--#5 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_DETAIL; +/*--#6 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_COMMENT; +/*--#7 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ATTACHMENT; +/*--#8 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_OP_LOG; +/*--#9 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_INCIDENT; +/*--#10 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_GE_BYTEARRAY; + +/* drop PL SQL procedures: */ +DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; +DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; + +/*-- Sequence */ +-- as sequence drop doesn't work automatically in MariaDB, use this procedure to drop sequence + DROP PROCEDURE IF EXISTS DropSequence; + + DELIMITER // + + CREATE PROCEDURE DropSequence (vname VARCHAR(30)) + BEGIN + -- Drop the sequence + DELETE FROM _sequences WHERE name = vname; + END + // + DELIMITER ; + +-- use the above procedure to drop sequence +CALL DropSequence('STAT_EXECUTION_SEQ'); + +/*-- To Drop the MariaDB specific user defined procedures and functions */ +DROP FUNCTION IF EXISTS NextVal; +DROP PROCEDURE IF EXISTS CreateSequence; +DROP PROCEDURE IF EXISTS DropSequence; +DROP TABLE IF EXISTS _sequences; \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql new file mode 100644 index 0000000..8c7faa0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql @@ -0,0 +1,222 @@ +-- Fix for https://itrack.web.att.com/browse/AJSCCMDA-90 -- +use camundabpmn; +/* + 1. Add some Camunda Indexes to history schema part (for Archiving) +*/ +create INDEX IF NOT EXISTS IDX_ACT_HI_TASKINST_PIID ON ACT_HI_TASKINST (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_COMMENT_PIID ON ACT_HI_COMMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ATTACHMENT_PIID ON ACT_HI_ATTACHMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_OP_LOG_PIID ON ACT_HI_OP_LOG (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_INCIDENT_PIID ON ACT_HI_INCIDENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ACTINST_PIID ON ACT_HI_ACTINST(PROC_INST_ID_); + + +/* + 2. Create Archiving Tables in current schema +*/ + +/*-- TMP_ARCHIVING_PROCINST */ +CREATE TABLE TMP_ARCHIVING_PROCINST +( PROC_INST_ID_ varchar(64) not null, + END_TIME_ datetime(3) +); +CREATE INDEX AI_TMP_ARCH_PROCINST_PI_ID ON TMP_ARCHIVING_PROCINST(PROC_INST_ID_); + +/*-- TMP_ARCHIVING_BYTEARRAY */ +CREATE TABLE TMP_ARCHIVING_BYTEARRAY +( BYTEARRAY_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) +); +CREATE INDEX AI_TMP_ARCH_BYTEARRAY_BAID ON TMP_ARCHIVING_BYTEARRAY(BYTEARRAY_ID_); + + +/*--#1 ARCHIVE_ACT_HI_PROCINST; */ +create TABLE ARCHIVE_ACT_HI_PROCINST +AS ( select * from ACT_HI_PROCINST where 1=0); + +create index AI_HI_PROCINST_END_TIME on ARCHIVE_ACT_HI_PROCINST(END_TIME_); +ALTER TABLE ARCHIVE_ACT_HI_PROCINST ADD CONSTRAINT ARCHIVE_ACT_HI_PROCINST_UQ UNIQUE ( PROC_INST_ID_); + +/*--#2 ARCHIVE_ACT_HI_ACTINST; */ +create TABLE ARCHIVE_ACT_HI_ACTINST +AS ( select * from ACT_HI_ACTINST where 1=0); + +create index AI_HI_ACTINST_PROC_INST_ID on ARCHIVE_ACT_HI_ACTINST(PROC_INST_ID_); +create index AI_HI_ACTINST_END_TIME on ARCHIVE_ACT_HI_ACTINST(END_TIME_); + +/*--#3 ARCHIVE_ACT_HI_TASKINST; */ +create TABLE ARCHIVE_ACT_HI_TASKINST +AS ( select * from ACT_HI_TASKINST where 1=0); + +create index AI_HI_TASKINST_PROC_INST_ID on ARCHIVE_ACT_HI_TASKINST(PROC_INST_ID_); +create index AI_HI_TASKINST_END_TIME on ARCHIVE_ACT_HI_TASKINST(END_TIME_); + +/*--#4 ARCHIVE_ACT_HI_VARINST; */ +create TABLE ARCHIVE_ACT_HI_VARINST +AS ( select * from ACT_HI_VARINST where 1=0); + +create index AI_HI_VARINST_PROC_INST_ID on ARCHIVE_ACT_HI_VARINST(PROC_INST_ID_); + +/*--#5 ARCHIVE_ACT_HI_DETAIL; */ +create TABLE ARCHIVE_ACT_HI_DETAIL +AS ( select * from ACT_HI_DETAIL where 1=0); + +create index AI_HI_DETAIL_PROC_INST_ID on ARCHIVE_ACT_HI_DETAIL(PROC_INST_ID_); +create index AI_HI_DETAIL_TIME on ARCHIVE_ACT_HI_DETAIL(TIME_); + +/*--#6 ARCHIVE_ACT_HI_COMMENT; */ +create TABLE ARCHIVE_ACT_HI_COMMENT +AS ( select * from ACT_HI_COMMENT where 1=0); + +create index AI_HI_COMMENT_PROC_INST_ID on ARCHIVE_ACT_HI_COMMENT(PROC_INST_ID_); +create index AI_HI_COMMENT_TIME on ARCHIVE_ACT_HI_COMMENT(TIME_); + +/*--#7 ARCHIVE_ACT_HI_ATTACHMENT; */ +create TABLE ARCHIVE_ACT_HI_ATTACHMENT +AS ( select * from ACT_HI_ATTACHMENT where 1=0); + +create index AI_HI_ATTACHMENT_PROC_INST_ID on ARCHIVE_ACT_HI_ATTACHMENT(PROC_INST_ID_); + +/*--#8 ARCHIVE_ACT_HI_OP_LOG; */ +create TABLE ARCHIVE_ACT_HI_OP_LOG +AS ( select * from ACT_HI_OP_LOG where 1=0); + +create index AI_HI_OP_LOG_PROC_INST_ID on ARCHIVE_ACT_HI_OP_LOG(PROC_INST_ID_); +create index AI_HI_OP_LOG_TIMESTAMP on ARCHIVE_ACT_HI_OP_LOG(TIMESTAMP_); + +/*--#9 ARCHIVE_ACT_HI_INCIDENT; */ +create TABLE ARCHIVE_ACT_HI_INCIDENT +AS ( select * from ACT_HI_INCIDENT where 1=0); + +create index AI_HI_INCIDENT_PROC_INST_ID on ARCHIVE_ACT_HI_INCIDENT(PROC_INST_ID_); + +/*--#10 ARCHIVE_ACT_GE_BYTEARRAY; */ +create TABLE ARCHIVE_ACT_GE_BYTEARRAY +AS ( select * from ACT_GE_BYTEARRAY where 1=0); + +create index AI_GE_BYTEARRAY_ID_ on ARCHIVE_ACT_GE_BYTEARRAY(ID_); + +/* ----------------------------------------------------------------------------- +Extend a ARCHIVE: Table by two attributes: STAT_EXECUTION_ID, STAT_EXECUTION_TS +*/ + +/* +--TEMPLATE: +alter table ARCHIVE_%TableName% + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_%TableName%_EXE_ID ON ARCHIVE_%TableName%(STAT_EXECUTION_ID); +*/ + + +/*--#1 ACT_HI_PROCINST */ +alter table ARCHIVE_ACT_HI_PROCINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_PROCINST_EXE_ID ON ARCHIVE_ACT_HI_PROCINST(STAT_EXECUTION_ID); + +/*--#2 ACT_HI_ACTINST */ +alter table ARCHIVE_ACT_HI_ACTINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ACTINST_EXE_ID ON ARCHIVE_ACT_HI_ACTINST(STAT_EXECUTION_ID); + +/*--#3 ACT_HI_TASKINST */ +alter table ARCHIVE_ACT_HI_TASKINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_TASKINST_EXE_ID ON ARCHIVE_ACT_HI_TASKINST(STAT_EXECUTION_ID); + +/*--#4 ACT_HI_VARINST */ +alter table ARCHIVE_ACT_HI_VARINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_VARINST_EXE_ID ON ARCHIVE_ACT_HI_VARINST(STAT_EXECUTION_ID); + +/*--#5 ACT_HI_DETAIL */ +alter table ARCHIVE_ACT_HI_DETAIL + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_DETAIL_EXE_ID ON ARCHIVE_ACT_HI_DETAIL(STAT_EXECUTION_ID); + +/*--#6 ACT_HI_COMMENT */ +alter table ARCHIVE_ACT_HI_COMMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_COMMENT_EXE_ID ON ARCHIVE_ACT_HI_COMMENT(STAT_EXECUTION_ID); + +/*--#7 ACT_HI_ATTACHMENT */ +alter table ARCHIVE_ACT_HI_ATTACHMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ATTACHMENT_EXE_ID ON ARCHIVE_ACT_HI_ATTACHMENT(STAT_EXECUTION_ID); + +/*--#8 ACT_HI_OP_LOG */ +alter table ARCHIVE_ACT_HI_OP_LOG + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_OP_LOG_EXE_ID ON ARCHIVE_ACT_HI_OP_LOG(STAT_EXECUTION_ID); + +/*--#9 ACT_HI_INCIDENT */ +alter table ARCHIVE_ACT_HI_INCIDENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_INCIDENT_EXE_ID ON ARCHIVE_ACT_HI_INCIDENT(STAT_EXECUTION_ID); + +/*--#10 ACT_GE_BYTEARRAY */ +alter table ARCHIVE_ACT_GE_BYTEARRAY + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_GE_BYTEARRAY_EXE_ID ON ARCHIVE_ACT_GE_BYTEARRAY(STAT_EXECUTION_ID); + + +/* -- Next Val as a user defined function needed only in MariaDB--*/ +DROP FUNCTION IF EXISTS NextVal; + DELIMITER // + CREATE FUNCTION NextVal (vname VARCHAR(30)) + RETURNS INT + BEGIN + -- Retrieve and update in single statement + UPDATE _sequences + SET next = next + 1 + WHERE name = vname; + + RETURN (SELECT next FROM _sequences LIMIT 1); + END + // + DELIMITER ; + +/* -- History tables for use in archive procedure, there is no array type in MariaDB --*/ +Create Table Camunda_Hi_Tables (id_ MEDIUMINT NOT NULL AUTO_INCREMENT, + TableName_ varchar(80) NOT NULL, + PRIMARY KEY (id_)); + +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_PROCINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ACTINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_TASKINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_VARINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_DETAIL'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_COMMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ATTACHMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_OP_LOG'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_INCIDENT'); + +/*-- log table --*/ +CREATE TABLE TMPLOGTABLE (LogMessage Varchar(700)); + + +/* -- Below user defined functions and procedures needed only in MariaDB, they are in-built in Oracle --*/ +/*-- Create a sequence SP */ +DROP PROCEDURE IF EXISTS CreateSequence; + DELIMITER // + CREATE PROCEDURE CreateSequence (name VARCHAR(30), start INT, inc INT) + BEGIN + -- Create a table to store sequences + CREATE TABLE IF NOT EXISTS _sequences + ( + name VARCHAR(70) NOT NULL UNIQUE, + next INT NOT NULL, + inc INT NOT NULL + ); + + -- Add the new sequence + INSERT INTO _sequences VALUES (name, start, inc); + END + // + DELIMITER ; + +/*-------------------------------------------------------------------------------------------------- + Add Meta to Archive + -------------------------------------------------------------------------------------------------- */ + +/* Create STAT_EXECUTION_SEQ: each Archive Entry has a same Execution ID during one Archiving Run */ +CALL CreateSequence('STAT_EXECUTION_SEQ', 1, 1); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql new file mode 100644 index 0000000..bf866b4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql @@ -0,0 +1,1127 @@ + +# Start of Statements added for MSO +DROP DATABASE IF EXISTS `camundabpmn`; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `camundabpmn` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `camundabpmn`; + +# DROP USER IF EXISTS 'camunda'; +#delete from mysql.user where User='camunda'; +#CREATE USER 'camunda'; +#GRANT ALL on camundabpmn.* to 'camunda' identified by 'camunda123' with GRANT OPTION; +FLUSH PRIVILEGES; +# End of Statements added for MSO + + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +insert into ACT_GE_PROPERTY +values ('schema.version', 'fox', 1); + +insert into ACT_GE_PROPERTY +values ('schema.history', 'create(fox)', 1); + +insert into ACT_GE_PROPERTY +values ('next.dbid', '1', 1); + +insert into ACT_GE_PROPERTY +values ('deployment.lock', '0', 1); + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp(3), + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp(3) NULL, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ TINYINT, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + VAR_SCOPE_ varchar(64) not null, + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(64), + CONFIGURATION_ varchar(255), + CREATED_ timestamp(3) not null, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp(3) not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(64), + PERMS_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ LONGTEXT not null, + PROPERTIES_ LONGTEXT, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp(3) not null, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + LOCK_EXP_TIME_ timestamp(3) NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); +create index ACT_IDX_METER_LOG on ACT_RU_METER_LOG(NAME_,TIMESTAMP_); +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); +-- create case definition table -- +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case execution table -- +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); + +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(255), + REV_ integer, + TIME_ datetime(3) not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ datetime(3) not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp(3) not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp(3) not null, + END_TIME_ timestamp(3) null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp(3) NULL, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); + +create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); + +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); + +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ datetime(3) not null, + CLOSE_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime(3) not null, + COLLECT_VALUE_ double, + USER_ID_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64) NOT NULL, + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- identity file entries + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ LONGBLOB, + PARENT_ID_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +CREATE TABLE `mso_urn_mapping` ( +`NAME_` VARCHAR(64) NOT NULL COLLATE 'utf8_bin', +`VALUE_` VARCHAR(300) NULL DEFAULT NULL COLLATE 'utf8_bin', +`REV_` INT(11) NULL DEFAULT NULL +) +COLLATE='latin1_swedish_ci' +ENGINE=InnoDB +; + +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:rollback', 'true', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('aai:endpoint', 'http://localhost:28090', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:tenant:endpoint', 'http://localhost:28090/tenantAdapterMock', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:sdnc:endpoint', 'http://localhost:28090/sdncAdapterMock', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:workflow:sdncadapter:callback', 'http://localhost:28080/mso/SDNCAdapterCallbackService', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout', 'PT5M', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model', 'http://com/att/svc/mis/firewall-lite-gui', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model:version', '2015-05-15', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout:firewall:minutes', '20', 1); + + +-- add indexes on PROC_DEF_KEY_ columns in history tables CAM-6679 +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql new file mode 100644 index 0000000..8e118eb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql @@ -0,0 +1,602 @@ +-- mariadb_engine_7.3.7_to_7.5.5 upgrade -- + +-- mysql_engine_7.3_to_7.4 +-- metrics -- +USE `camundabpmn`; + +ALTER TABLE ACT_RU_METER_LOG + ADD REPORTER_ varchar(255); + +-- job prioritization -- + +ALTER TABLE ACT_RU_JOB + ADD PRIORITY_ bigint NOT NULL + DEFAULT 0; + +ALTER TABLE ACT_RU_JOBDEF + ADD JOB_PRIORITY_ bigint; + +ALTER TABLE ACT_HI_JOB_LOG + ADD JOB_PRIORITY_ bigint NOT NULL + DEFAULT 0; + +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create unique constraint on ACT_RE_DECISION_DEF -- +alter table ACT_RE_DECISION_DEF + add constraint ACT_UNIQ_DECISION_DEF + unique (KEY_,VERSION_); + +-- case sentry part source -- + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD SOURCE_ varchar(255); + +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime not null, + COLLECT_VALUE_ double, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64) NOT NULL, + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create indexes for historic decision tables +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- add grant authorization for group camunda-admin: +INSERT INTO + ACT_RU_AUTHORIZATION (ID_, TYPE_, GROUP_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_, REV_) +VALUES + ('camunda-admin-grant-decision-definition', 1, 'camunda-admin', 10, '*', 2147483647, 1); + +-- external tasks -- + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + LOCK_EXP_TIME_ timestamp NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); + +-- deployment -- + +ALTER TABLE ACT_RE_DEPLOYMENT + ADD SOURCE_ varchar(255); + +ALTER TABLE ACT_HI_OP_LOG + ADD DEPLOYMENT_ID_ varchar(64); + +-- job suspension state + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN SUSPENSION_STATE_ integer + DEFAULT 1; + + -- relevant for jobs created in Camunda 7.0 +UPDATE ACT_RU_JOB + SET SUSPENSION_STATE_ = 1 + WHERE SUSPENSION_STATE_ IS NULL; + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN SUSPENSION_STATE_ integer + NOT NULL DEFAULT 1; + + +-- mariadb_engine_7.4_patch_7.4.5_to_7.4.6 +-- INCREASE process def key column size https://app.camunda.com/jira/browse/CAM-4328 -- +alter table ACT_RU_JOB + MODIFY COLUMN PROCESS_DEF_KEY_ varchar(255); + +-- mariadb_engine_7.4_to_7.5 +-- set datetime precision -- + +ALTER TABLE ACT_HI_CASEINST + MODIFY COLUMN CREATE_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_CASEINST + MODIFY COLUMN CLOSE_TIME_ datetime(3); + +ALTER TABLE ACT_HI_CASEACTINST + MODIFY COLUMN CREATE_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_CASEACTINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_DECINST + MODIFY COLUMN EVAL_TIME_ datetime(3) not null; + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN DUE_DATE_ datetime(3); + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN FOLLOW_UP_DATE_ datetime(3); + +ALTER TABLE ACT_HI_PROCINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_PROCINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_ACTINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_ACTINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN DUE_DATE_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN FOLLOW_UP_DATE_ datetime(3); + +ALTER TABLE ACT_HI_DETAIL + MODIFY COLUMN TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_COMMENT + MODIFY COLUMN TIME_ datetime(3) not null; + +-- set timestamp precision -- + +ALTER TABLE ACT_RE_DEPLOYMENT + MODIFY COLUMN DEPLOY_TIME_ timestamp(3); + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN LOCK_EXP_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN DUEDATE_ timestamp(3) NULL; + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN CREATE_TIME_ timestamp(3); + +ALTER TABLE ACT_RU_EVENT_SUBSCR + MODIFY COLUMN CREATED_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_INCIDENT + MODIFY COLUMN INCIDENT_TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_METER_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_EXT_TASK + MODIFY COLUMN LOCK_EXP_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_HI_OP_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_INCIDENT + MODIFY COLUMN CREATE_TIME_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_INCIDENT + MODIFY COLUMN END_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_HI_JOB_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_JOB_LOG + MODIFY COLUMN JOB_DUEDATE_ timestamp(3) NULL; + +-- semantic version -- + +ALTER TABLE ACT_RE_PROCDEF + ADD VERSION_TAG_ varchar(64); + +create index ACT_IDX_PROCDEF_VER_TAG on ACT_RE_PROCDEF(VERSION_TAG_); + +-- tenant id -- + +ALTER TABLE ACT_RE_DEPLOYMENT + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); + +ALTER TABLE ACT_RE_PROCDEF + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RE_PROCDEF + DROP INDEX ACT_UNIQ_PROCDEF; + +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); + +ALTER TABLE ACT_RU_EXECUTION + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); + +ALTER TABLE ACT_RU_TASK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); + +ALTER TABLE ACT_RU_VARIABLE + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); + +ALTER TABLE ACT_RU_EVENT_SUBSCR + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); + +ALTER TABLE ACT_RU_JOB + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); + +ALTER TABLE ACT_RU_JOBDEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +ALTER TABLE ACT_RU_INCIDENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RU_IDENTITYLINK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); + +ALTER TABLE ACT_RU_EXT_TASK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); + +ALTER TABLE ACT_RE_DECISION_DEF + DROP INDEX ACT_UNIQ_DECISION_DEF; + +ALTER TABLE ACT_RE_DECISION_DEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); + +ALTER TABLE ACT_RE_CASE_DEF + DROP INDEX ACT_UNIQ_CASE_DEF; + +ALTER TABLE ACT_RE_CASE_DEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); + +ALTER TABLE ACT_GE_BYTEARRAY + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RU_CASE_EXECUTION + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD TENANT_ID_ varchar(64); + +-- user on historic decision instance -- + +ALTER TABLE ACT_HI_DECINST + ADD USER_ID_ varchar(255); + +-- tenant id on history -- + +ALTER TABLE ACT_HI_PROCINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); + +ALTER TABLE ACT_HI_ACTINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); + +ALTER TABLE ACT_HI_TASKINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); + +ALTER TABLE ACT_HI_VARINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); + +ALTER TABLE ACT_HI_DETAIL + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); + +ALTER TABLE ACT_HI_INCIDENT + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); + +ALTER TABLE ACT_HI_JOB_LOG + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); + +ALTER TABLE ACT_HI_COMMENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_ATTACHMENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_OP_LOG + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DEC_IN + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DEC_OUT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DECINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); + +ALTER TABLE ACT_HI_CASEINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); + +ALTER TABLE ACT_HI_CASEACTINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); + +-- AUTHORIZATION -- + +-- add grant authorizations for group camunda-admin: +INSERT INTO + ACT_RU_AUTHORIZATION (ID_, TYPE_, GROUP_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_, REV_) +VALUES + ('camunda-admin-grant-tenant', 1, 'camunda-admin', 11, '*', 2147483647, 1), + ('camunda-admin-grant-tenant-membership', 1, 'camunda-admin', 12, '*', 2147483647, 1), + ('camunda-admin-grant-batch', 1, 'camunda-admin', 13, '*', 2147483647, 1); + +-- tenant table + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +-- BATCH -- + +-- remove not null from job definition table -- +alter table ACT_RU_JOBDEF + modify PROC_DEF_ID_ varchar(64), + modify PROC_DEF_KEY_ varchar(255), + modify ACT_ID_ varchar(255); + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); + +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- TASK PRIORITY -- + +ALTER TABLE ACT_RU_EXT_TASK + ADD PRIORITY_ bigint NOT NULL DEFAULT 0; + +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); + +-- HI OP PROC INDECIES -- + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); + +-- JOB_DEF_ID_ on INCIDENTS -- +ALTER TABLE ACT_RU_INCIDENT + ADD JOB_DEF_ID_ varchar(64); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +ALTER TABLE ACT_HI_INCIDENT + ADD JOB_DEF_ID_ varchar(64); + +-- BATCH_ID_ on ACT_HI_OP_LOG -- +ALTER TABLE ACT_HI_OP_LOG + ADD BATCH_ID_ varchar(64); + + -- add indexes on PROC_DEF_KEY_ columns in history tables CAM-6679 +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml new file mode 100644 index 0000000..40bb93b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml @@ -0,0 +1,19 @@ + + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml new file mode 100644 index 0000000..742ec13 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml @@ -0,0 +1,13 @@ + + + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + gg0e927b-6087-5574-9ef8-c5e4d5847db5 + V1.0 + vMOG-AKRON-1234 + 1462561835 + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml new file mode 100644 index 0000000..f33255b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml @@ -0,0 +1,15 @@ + + + + + SVC3000 + Invalid input performing %1 on %2 (msg=%3) (ec=%4) + + PUT customer + global-customer-id=global_subscriber_id + Uniqueness constraint violated:Conflicting Key and Alternate-Key values passed for add of nodeType = customer + ERR.5.4.6117 + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json new file mode 100644 index 0000000..c3064fe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json @@ -0,0 +1,74 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "78987", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json new file mode 100644 index 0000000..a18ce57 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json @@ -0,0 +1,64 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1", +"modelCustomizationId": "ee6478e5-ea33-3346-ac12-ab121484a3fe" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml new file mode 100644 index 0000000..5a36d74 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml @@ -0,0 +1 @@ +Notified \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml new file mode 100644 index 0000000..7c30f75 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml new file mode 100644 index 0000000..cb5d000 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml @@ -0,0 +1,19 @@ + + + + + + + + 19174929-3809-49ca-89eb-17f84a035389 + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json new file mode 100644 index 0000000..c75c32d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json @@ -0,0 +1,50 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelNameVersionId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "00000000-0000-0000-0000-000000000000", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml new file mode 100644 index 0000000..4aeac5c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml @@ -0,0 +1,35 @@ + + SDN-ETHERNET-INTERNET + 1234 + + + MIS/1604/0026/SW_INTERNET + + + cvlan-tag + https://aai-ext1.test.att.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.att.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml new file mode 100644 index 0000000..a397e5b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml @@ -0,0 +1,23 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + testReVer123 + + + nothing + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml new file mode 100644 index 0000000..3227a03 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml new file mode 100644 index 0000000..3227a03 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.att.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml new file mode 100644 index 0000000..28ce8ef --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.att.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml new file mode 100644 index 0000000..28ce8ef --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.att.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml new file mode 100644 index 0000000..5ffdda2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.att.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.att.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml new file mode 100644 index 0000000..41815d4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml @@ -0,0 +1,34 @@ + + SDN-ETHERNET-INTERNET + 1234 + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.att.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.att.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml new file mode 100644 index 0000000..a83e06e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml @@ -0,0 +1,97 @@ + + 1936628a-d22f-4943-8587-a57bab2ece7a + testVnfName123 + US0112SLCP1VBRT076 + esx-vce + NVTPROV + created + 0000020 + slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d + + VPESAT-mtanjrsv126 + 135.21.249.160 + + + slcp1476vbc.vpe + e7568706-a2a9-45f8-aef8-95a0e2910953 + dvspg-VCE_VPE-slcp1476vbc + Internet + dvspg-VCE_VPE-slcp1476vbc + 0000020 + dvs-slcp1-01 + created + dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 + + + + 3012 + 0000020 + + + + + slcp1476vbc.ipag + 3477ddb6-b925-4971-ab62-c84b69634c49 + dvspg-IPAG_VCE-slcp1476vbc + Customer + dvspg-IPAG_VCE-slcp1476vbc + dvs-slcp1-01 + 0000020 + created + dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 + + + + 2003 + 0000020 + + + + + + + service-instance + https://aai-ext1.test.att.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ + + service-instance.service-instance-id + SDNC/VLXM/0112001//SW_INTERNET + + + service-subscription.service-type + SDN-ETHERNET-INTERNET + + + customer.global-customer-id + 011216-1602-SDNC001 + + + + vserver + https://aai-ext1.test.att.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ + + vserver.vserver-id + ecab47d5-3450-4507-ada9-2b3c58485c51 + + + tenant.tenant-id + 3d5f3fe23821416fac2b69af65248c74 + + + + complex + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ + + complex.physical-location-id + MDTWNJ21A4 + + + + availability-zone + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ + + availability-zone.availability-zone-name + slcp1-esx-az01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml new file mode 100644 index 0000000..a83e06e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml @@ -0,0 +1,97 @@ + + 1936628a-d22f-4943-8587-a57bab2ece7a + testVnfName123 + US0112SLCP1VBRT076 + esx-vce + NVTPROV + created + 0000020 + slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d + + VPESAT-mtanjrsv126 + 135.21.249.160 + + + slcp1476vbc.vpe + e7568706-a2a9-45f8-aef8-95a0e2910953 + dvspg-VCE_VPE-slcp1476vbc + Internet + dvspg-VCE_VPE-slcp1476vbc + 0000020 + dvs-slcp1-01 + created + dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 + + + + 3012 + 0000020 + + + + + slcp1476vbc.ipag + 3477ddb6-b925-4971-ab62-c84b69634c49 + dvspg-IPAG_VCE-slcp1476vbc + Customer + dvspg-IPAG_VCE-slcp1476vbc + dvs-slcp1-01 + 0000020 + created + dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 + + + + 2003 + 0000020 + + + + + + + service-instance + https://aai-ext1.test.att.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ + + service-instance.service-instance-id + SDNC/VLXM/0112001//SW_INTERNET + + + service-subscription.service-type + SDN-ETHERNET-INTERNET + + + customer.global-customer-id + 011216-1602-SDNC001 + + + + vserver + https://aai-ext1.test.att.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ + + vserver.vserver-id + ecab47d5-3450-4507-ada9-2b3c58485c51 + + + tenant.tenant-id + 3d5f3fe23821416fac2b69af65248c74 + + + + complex + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ + + complex.physical-location-id + MDTWNJ21A4 + + + + availability-zone + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ + + availability-zone.availability-zone-name + slcp1-esx-az01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml new file mode 100644 index 0000000..eedbda9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml new file mode 100644 index 0000000..66ed8f5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml @@ -0,0 +1,15 @@ + + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml new file mode 100644 index 0000000..f71f529 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml @@ -0,0 +1,32 @@ + + + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + query + services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET + http://127.0.0.1:28080/camunda/services/SDNCAdapterCallback + + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + GetLayer3ServiceDetailsRequest + OMX + + + SDN-ETHERNET-INTERNET + PD/VLXM/003717//SW_INTERNET + + + + + 1 + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml new file mode 100644 index 0000000..b720047 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml @@ -0,0 +1,350 @@ + + + + + + + testRequestId + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml new file mode 100644 index 0000000..a5640b2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml @@ -0,0 +1,6 @@ + + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml new file mode 100644 index 0000000..c67e980 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml @@ -0,0 +1,78 @@ + + + JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report + + + + +

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

+
+

+ JBWEB000309: type + JBWEB000066: Exception report +

+

+ JBWEB000068: message + java.lang.NullPointerException +

+

+ JBWEB000069: description + JBWEB000145: The server encountered an internal error that + prevented it from fulfilling this request. +

+

+ JBWEB000070: exception +

org.jboss.resteasy.spi.UnhandledException:
+					java.lang.NullPointerException
+					org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
+					org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
+					org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
+					org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+					org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+					javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+					org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
+				
+

+

+ JBWEB000071: root cause +

java.lang.NullPointerException
+					org.openecomp.mso.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+					org.openecomp.mso.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+					sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+					sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+					sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+					java.lang.reflect.Method.invoke(Method.java:606)
+					org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
+					org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
+					org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
+					org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
+					org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+					org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+					javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+					org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
+				
+

+

+ JBWEB000072: note + JBWEB000073: The full stack trace of the root cause is available + in the JBoss Web/7.2.2.Final-redhat-1 logs. +

+
+

JBoss Web/7.2.2.Final-redhat-1

+ + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml new file mode 100644 index 0000000..7a00744 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml @@ -0,0 +1,24 @@ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml new file mode 100644 index 0000000..a7ac309 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.att.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000..d8d10db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -0,0 +1,73 @@ + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.att.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.att.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.att.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.att.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000..292b5e8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000..910f701 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml new file mode 100644 index 0000000..2cf94b2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml @@ -0,0 +1,25 @@ + + + + + + + + testRequestId + 200 + OK + + <output + xmlns="com:att:sdnctl:vnf"><response-code>500</response-code><response-message>'Error + retrieving l3-network with network-id=' + + $network-topology-operation-input.network-request-information.network-id + + 'from + AnAI'</response-message><ack-final-indicator>Y</ack-final-indicator><svc-request-id>006927ca-f5a3-47fd-880c-dfcbcd81a093</svc-request-id></output> + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml new file mode 100644 index 0000000..40bb93b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml @@ -0,0 +1,19 @@ + + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000..d968bcc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + fqdn123 + slowburn + 145878989 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml new file mode 100644 index 0000000..2126ae7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml @@ -0,0 +1,6 @@ + + skask + lukewarm + pdk1 + 78987 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml new file mode 100644 index 0000000..d041565 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -0,0 +1,29 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml new file mode 100644 index 0000000..60f3d01 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -0,0 +1,38 @@ + + skask + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000..65f235c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml @@ -0,0 +1,5 @@ + + skask + supercool + pending-delete + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000..0442afc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 195159195 + 14567890 + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml new file mode 100644 index 0000000..4cab6c6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml new file mode 100644 index 0000000..7d3d0e5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml new file mode 100644 index 0000000..7d3d0e5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000..b143e3b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -0,0 +1,315 @@ + + + bd1b3789-6474-4935-94b2-90b656e035d0 + + bd1b3789-6474-4935-94b2-90b656e035d0 + + 9ddf628a-9eca-430e-8974-22d520a31be1 + assign + https://msojra.infra.aic.att.net:8443/adapters/rest/SDNCNotify + + + notsurewecare + bd1b3789-6474-4935-94b2-90b656e035d0 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + PendingCreate + + + VNN1CA52LCP + ZVNNMOGX01_base + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1::module-0 + + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + ps + + ZVNN1MOGX01MPS001 + + + ZVNN1MOGX01MPS002 + + + ZVNN1MOGX01MPS003 + + + ZVNN1MOGX01MPS004 + + 4 + + mog_cor_B + + 107.224.36.251 + + + 107.224.36.252 + + + 107.224.36.253 + + + 107.224.36.254 + + N + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + N + + + + oam + + ZVNN1MOGX01OAM001 + + + ZVNN1MOGX01OAM002 + + 2 + + mog_oam + + 107.239.167.252 + + + 107.239.167.251 + + N + + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + + pd + + ZVNN1MOGX01MPD001 + + + ZVNN1MOGX01MPD002 + + 2 + + mog_dmz + + 107.225.25.253 + + + 107.225.25.254 + + N + 107.225.254.253 + + + mog_oam + + 107.239.167.254 + + + 107.239.167.253 + + N + 107.239.167.249 + + + mog_exn + + 107.224.46.253 + + + 107.224.46.254 + + N + 107.224.46.252 + + + mog_cor_B + + 107.224.36.247 + + + 107.224.36.248 + + N + 107.224.41.252 + + + mog_gn + + 107.224.41.253 + + + 107.224.41.254 + + N + 107.224.41.252 + + + mog_cor_A + + 107.224.38.253 + + + 107.224.38.254 + + N + + + + sm + + ZVNN1MOGX01MSM001 + + + ZVNN1MOGX01MSM002 + + + ZVNN1MOGX01MSM003 + + + ZVNN1MOGX01MSM004 + + 4 + + mog_cor_B + + 107.224.36.243 + + + 107.224.36.244 + + + 107.224.36.245 + + + 107.224.36.246 + + N + + + + + ZVNNMOGX01_base + SDN-MOBILITY + ZVNN1MOGX01 - VF AUG 1::module-0 + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + + + + 9ddf628a-9eca-430e-8974-22d520a31be1 + + PORTAL + VNFActivateRequest + + + + 200 + Y + synccomplete + 2016-08-05T16:15:19.398Z + vnf-topology-operation + VNFActivateRequest + assign + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml new file mode 100644 index 0000000..c9f9cf3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -0,0 +1,141 @@ + + + 28455973-1ee5-4ad1-8d35-c4732679743a + + 200 + Y + synccomplete + 2016-06-08T19:44:59.138Z + vnf-topology-operation + VNFActivateRequest + assign + + + 28455973-1ee5-4ad1-8d35-c4732679743 + + notsurewecare + 28455973-1ee5-4ad1-8d35-c4732679743a + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + http://mtanjv9moja01-eth1-0.aic.cip.att.com:28080/adapters/rest/SDNCNotify + assign + + + AAIAIC25 + MSOTEST06-vSAMP3::base::module-0 + 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 + Test/vSAMP3 1 + MSOTEST06 + 4ae1d3446a4c48b2bec44b6cfba06d68 + 28455973-1ee5-4ad1-8d35-c4732679743a + vSAMP3::base::module-0 + + + PendingCreate + + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + int_imbl + 680b7453-0ec4-4d96-b355-280d981d418f + Nimbus-25193-T-Willows2_int_imbl_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 + + 775607fb-e16a-45ef-94a7-82fba0d16eec + 640d07fb-e16a-45ef-94a7-82fba0d169bf + + filter1 + + + filter2 + + + + sgi_protected + f9039ce9-e3cf-4716-b2d1-ec7912178ea4 + Nimbus-25193-T-Willows2_sgi_protected_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 + b9999ce9-e3cf-4716-b2d1-ec791217678c + + bf11bba8-b971-4ab5-8281-215b3fedcd3c + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + nova + + + + MSOTEST06-vSAMP3::base::module-0 + SDN-MOBILITY + vSAMP3::base::module-0 + Test/vSAMP3 1 + MSOTEST06 + + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + + SoapUI-bns-vf-base-vSAMP3-9001 + VNFActivateRequest + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml new file mode 100644 index 0000000..919ff2c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml new file mode 100644 index 0000000..3e7c650 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml @@ -0,0 +1,5 @@ + + skask + introvert + 3.14 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000..8a69040 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml @@ -0,0 +1,10 @@ + + skask + supercool + slowburn + complete + 78987 + introvert + 3.14 + myhost.appl.com + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml new file mode 100644 index 0000000..966ca50 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml @@ -0,0 +1,35 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml new file mode 100644 index 0000000..49ecd0b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml @@ -0,0 +1,55 @@ + + skask + supercool + slowburn + true + + + key1 + value1 + + + key2 + value2 + + +server1_private_ip +192.168.28.3 + + +contrail-service-instance-fqdn +default-domain:MSOTest:MsoNW-RA + + +policyKey1_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN1 + + +policyKey2_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN2 + + +oam_management_v6_address +2000:abc:bce:1111 + + +oam_management_v4_address +127.0.0.1 + + + + skask + supercool + slowburn + true + tenantId + cloudSiteId + + requestId + serviceInstanceId + + {{MESSAGE-ID}} + + {{MESSAGE-ID}} + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml new file mode 100644 index 0000000..c602dd9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml @@ -0,0 +1,16 @@ + + skask + supercool + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml new file mode 100644 index 0000000..830d2e2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml @@ -0,0 +1,15 @@ + + 78987 + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml new file mode 100644 index 0000000..ad3c359 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -0,0 +1,10 @@ + + lukewarm + PCRF::module-1 + slowburn + pending-create + true + 330-90 + introvert + 2.0 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml new file mode 100644 index 0000000..eba91a7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -0,0 +1,9 @@ + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + pending-create + 330-90 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml new file mode 100644 index 0000000..6d365f7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -0,0 +1,27 @@ + + supercool + PCRF::module-2 + fastburn + pending-create + false + 330-89 + introvert + 2.0 + + + volume-group + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + volume-group.volume-group-id + 78987 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml new file mode 100644 index 0000000..241e5e3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -0,0 +1,25 @@ + + 78987 + Volume_2 + slowburn + pcrf-capacity + Active + 0000020 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + MDTWNJ21 + + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml new file mode 100644 index 0000000..37c5155 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml @@ -0,0 +1,28 @@ + + + VOLUME_GROUP_ID_1 + VOLUME_GROUP_ID_1_NAME + heat-stack-id + vnf-type + OK + 1 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + tenant.tenant-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml new file mode 100644 index 0000000..66ed8f5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml @@ -0,0 +1,15 @@ + + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml new file mode 100644 index 0000000..7b5d22a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml @@ -0,0 +1,29 @@ + + + + + + edab9ec7-6cf8-47cf-b58c-9ba4ef5d3f70 + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + + + server_ip + 135.21.249.178 + + + + MTSNJA4LCP1 + + 1512_1120-BB11-1 + BB11/VLXM/003717//SW_INTERNET + + false + e25ac2f1e73d46428de81a6130a6fdad + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml new file mode 100644 index 0000000..a4b0bec --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml @@ -0,0 +1,11 @@ + + + + + + f5e42814-72c0-4422-b840-e14e757a709b + true + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml new file mode 100644 index 0000000..3b99363 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml @@ -0,0 +1,20 @@ + + + + + + b1a82ce6-7f5c-45fd-9273-acaf88fc2222 + true + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + ACTIVE + + + server_ip + 135.21.249.144 + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml new file mode 100644 index 0000000..4fd0b62 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml @@ -0,0 +1,11 @@ + + + + + + b1a82ce6-7f5c-45fd-9273-acaf88fc2137 + true + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml new file mode 100644 index 0000000..c94e32e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logging.properties b/bpmn/MSOCommonBPMN/src/test/resources/logging.properties new file mode 100644 index 0000000..4941c55 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/logging.properties @@ -0,0 +1,2 @@ +#register SLF4JBridgeHandler as handler for the j.u.l. root logger +handlers = org.slf4j.bridge.SLF4JBridgeHandler diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties new file mode 100644 index 0000000..f800d00 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties @@ -0,0 +1,3 @@ +# Default BPMN properties for unit tests + +URNMapping.FileSystemLoading.Enabled=true \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties new file mode 100644 index 0000000..f1a8222 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties @@ -0,0 +1,86 @@ +# Default URN Mappings for unit tests + +mso.rollback=true + +canopi.auth=757A94191D685FD2092AC1490730A4FC +csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest +csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification +mso.csi.pwd=4EA237303511EFBBC37F17A351562131 +mso.csi.usrname=mso +mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 + +mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess + +mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter +mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC + +mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter +mso.adapters.network.rest.endpoint=http://localhost:28090/networks/NetworkAdapter + +mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC +mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B +mso.po.timeout=PT60S + +aai.auth=757A94191D685FD2092AC1490730A4FC + +mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter +mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc +mso.adapters.sdnc.timeout=PT60S +mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui +mso.sdnc.firewall.yang.model.version=2015-05-15 +mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B +mso.sdnc.timeout.firewall.minutes=20 +mso.callbackRetryAttempts=5 +mso.sdnc.timeout=PT10S +mso.sdnc.timeout.ucpe.async.hours=120 +mso.sdnc.timeout.ucpe.async.minutes=5 +mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage +mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService + +mso.catalog.db.endpoint=http://localhost:28090/ + +mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock +mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync +mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter +mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/v1/vnfs +mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1 +mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.createvce.delay.seconds=1 +mso.infra.customer.id=testCustIdInfra + +aai.endpoint=http://localhost:28090 + +# AAI version mappings + +# Example to override default version for a resource: +#mso.workflow.default.aai.vce.version=6 +#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce + +mso.workflow.global.default.aai.version=8 +mso.workflow.default.aai.cloud-region.version=9 +mso.workflow.default.aai.generic-vnf.version=9 + +mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic +mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer +mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query +mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf +mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network +mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy +mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query +mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference +mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant +mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce +mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding + + +log.debug.CompleteMsoProcess=true +log.debug.CreateNetworkInstanceInfra=true +log.debug.CreateServiceInstanceInfra=true +log.debug.DeleteNetworkInstanceInfra=true +log.debug.FalloutHandler=true +log.debug.GenericGetService=true +log.debug.sdncAdapter=true +log.debug.UpdateNetworkInstanceInfra=true +log.debug.VnfAdapterRestV1=true \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml new file mode 100644 index 0000000..df3a4c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml @@ -0,0 +1 @@ +1a152f97-566e-4f22-b17b-761f807bfedc404Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.] \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml new file mode 100644 index 0000000..d656d04 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml @@ -0,0 +1,212 @@ + + + + + + Y + SK-2016-10-22-001 + + + SUCCESS + ERROR + + + 15001417 + + ALPRTR2 + 1.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 2 + + + ALPRTR1 + 1.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 1 + + + + 15001418 + + SANRTR1 + 2.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 1 + + + SANRTR2 + 2.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 2 + + + ATT-COLLABORATE + DISABLE + custid-888 + SII-2016-10-22-001 + CUSTOMER + 100668 + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml new file mode 100644 index 0000000..89e4fef --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml @@ -0,0 +1,342 @@ + + + 2f7d1b38-2b78-4ef2-8ad6-1552d88620fa + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>FOUR SEASONS HEATING & COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml new file mode 100644 index 0000000..5808444 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml @@ -0,0 +1,13 @@ + + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text new file mode 100644 index 0000000..fa90fa3 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text @@ -0,0 +1,42 @@ + <output xmlns="com:att:sdnctl:l3api"><ack-final-indicator>N</ack-final-indicator></output> + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <source>mysrc</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>http://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>clli</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + </service-data> + </layer3-service-list> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text new file mode 100644 index 0000000..816bef9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text @@ -0,0 +1,42 @@ + <output xmlns="com:att:sdnctl:l3api"><ack-final-indicator>Y</ack-final-indicator></output> + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>clli</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>test HEATING & COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + </service-data> + </layer3-service-list> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml new file mode 100644 index 0000000..231898a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml @@ -0,0 +1,33 @@ + + + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + activate + service-configuration-operation + http://127.0.0.1:28080/camunda/services/SDNCAdapterCallback + + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + Layer3ServiceActivate + OMX + + + mysvctype + PD/VLXM/003717//SW_INTERNET + + + + + 1 + 2 + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml new file mode 100644 index 0000000..f71f529 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml @@ -0,0 +1,32 @@ + + + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + query + services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET + http://127.0.0.1:28080/camunda/services/SDNCAdapterCallback + + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + GetLayer3ServiceDetailsRequest + OMX + + + SDN-ETHERNET-INTERNET + PD/VLXM/003717//SW_INTERNET + + + + + 1 + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn new file mode 100644 index 0000000..e5498e4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn @@ -0,0 +1,81 @@ + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_9 + + + + SequenceFlow_9 + SequenceFlow_11 + + + + + SequenceFlow_11 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml new file mode 100644 index 0000000..4e7c4ee --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml @@ -0,0 +1,22 @@ + + + + + + testRequestId + true + + MTSNJA4LCP1 + + 1512_1120-BB11-1 + BB11/VLXM/003717//SW_INTERNET + + false + e25ac2f1e73d46428de81a6130a6fdad + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + + + + \ No newline at end of file -- cgit 1.2.3-korg