diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks')
7 files changed, 45 insertions, 43 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index f1fd23fe82..f10b503ed3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -65,7 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo; import org.onap.so.client.sniro.beans.SniroManagerRequest; import org.onap.so.client.sniro.beans.SubscriberInfo; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -162,14 +162,14 @@ public class SniroHomingV2 { } catch (BpmnError e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(), - TargetEntity.SNIRO); + ONAPComponents.SNIRO); } catch (BadResponseException e) { logger.error(EXCEPTION_OCCURRED, e); - exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO); + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO); } catch (Exception e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, - "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO); + "Internal Error - occurred while preparing sniro request: " + e.getMessage(), ONAPComponents.SO); } } @@ -214,15 +214,15 @@ public class SniroHomingV2 { } catch (BpmnError e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(), - TargetEntity.SNIRO); + ONAPComponents.SNIRO); } catch (BadResponseException e) { logger.error(EXCEPTION_OCCURRED, e); - exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO); + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO); } catch (Exception e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(), - TargetEntity.SO); + ONAPComponents.SO); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java index e9d33f46ab..2705d00d6b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java @@ -38,11 +38,12 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.NetworkAdapterResources; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.onap.so.utils.Components; @Component public class NetworkAdapterRestV1 { @@ -94,7 +95,7 @@ public class NetworkAdapterRestV1 { throw new Exception("No Network Request was created. networkAdapterRequest was null."); } } catch (Exception ex) { - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } @@ -139,7 +140,7 @@ public class NetworkAdapterRestV1 { } } catch (Exception e) { logger.error("Error in Openstack Adapter callback", e); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), Components.OPENSTACK); } } @@ -152,7 +153,7 @@ public class NetworkAdapterRestV1 { public void handleTimeOutException(DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Error timed out waiting on Openstack Async-Response", TargetEntity.SO); + "Error timed out waiting on Openstack Async-Response", ONAPComponents.SO); } public void handleSyncError(DelegateExecution execution) { @@ -160,6 +161,6 @@ public class NetworkAdapterRestV1 { String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE); String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = " + responseString; - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, Components.OPENSTACK); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 080d6d34b1..192cb3fc90 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -32,7 +32,7 @@ import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.SDNCVnfResources; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,13 +80,13 @@ public class SDNCQueryTasks { } catch (BadResponseException ex) { logger.error("Exception occurred", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } @@ -121,9 +121,9 @@ public class SDNCQueryTasks { } catch (BadResponseException ex) { logger.error("Exception occurred for BadResponse ", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); @@ -158,18 +158,18 @@ public class SDNCQueryTasks { // module id, then we should throw // the error as normal if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO); } } catch (BadResponseException ex) { logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java index 03714db943..3383fde0a8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java @@ -37,7 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCRequest; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -80,19 +80,19 @@ public class SDNCRequestTasks { } catch (PathNotFoundException e) { logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO); + "Recieved invalid response from SDNC, unable to read message content.", ONAPComponents.SO); } catch (MapperException e) { logger.error("Failed to map SDNC object to JSON prior to POST.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO); + "Failed to map SDNC object to JSON prior to POST.", ONAPComponents.SO); } catch (BadResponseException e) { logger.error("Did not receive a successful response from SDNC.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(), - TargetEntity.SDNC); + ONAPComponents.SDNC); } catch (HttpClientErrorException e) { logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.", - TargetEntity.SO); + ONAPComponents.SO); } } @@ -123,17 +123,17 @@ public class SDNCRequestTasks { } } catch (SDNCErrorResponseException e) { logger.error("SDNC error response - " + e.getMessage()); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC); } catch (Exception e) { logger.error("Error processing SDNC callback", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback", - TargetEntity.SO); + ONAPComponents.SO); } } public void handleTimeOutException(DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Error timed out waiting on SDNC Async-Response", TargetEntity.SO); + "Error timed out waiting on SDNC Async-Response", ONAPComponents.SO); } protected boolean convertIndicatorToBoolean(String finalMessageIndicator) { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java index 8aea2d2650..3994208d23 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java @@ -39,7 +39,8 @@ import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; +import org.onap.logging.filter.base.ONAPComponents; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; @@ -113,7 +114,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest { delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString()); doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException( - any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class)); + any(DelegateExecution.class), anyInt(), any(String.class), any(ONAPComponents.class)); try { networkAdapterRestV1Tasks.processCallback(delegateExecution); @@ -122,6 +123,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest { } assertNull(delegateExecution.getVariable("updateNetworkResponse")); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000), - eq("test error message"), eq(TargetEntity.OPENSTACK)); + eq("test error message"), eq(Components.OPENSTACK)); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java index 0ba9237aaf..e158925568 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java @@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.BadResponseException; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.logging.filter.base.ONAPComponents; public class SDNCQueryTasksTest extends BaseTaskTest { @InjectMocks @@ -65,7 +65,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { vfModule = setVfModule(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException( - any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class)); + any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(ONAPComponentsList.class)); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); @@ -98,7 +98,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModule(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -109,7 +109,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModule(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test @@ -133,7 +133,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVnf(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -144,7 +144,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVnf(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test @@ -169,7 +169,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -180,7 +180,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java index 0fc33fe5ce..e435909f59 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java @@ -49,7 +49,7 @@ import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.w3c.dom.Document; import org.xml.sax.InputSource; import com.fasterxml.jackson.core.JsonParseException; |