diff options
author | Plummer, Brittany <brittany.plummer@att.com> | 2019-09-10 11:29:42 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-09-10 11:29:42 -0400 |
commit | 2ede5f09c9601d543f20d466a21e9e85c29eacc7 (patch) | |
tree | b9b0e7f777b87a390ce4fb9ba870c49aab382bcc /bpmn/MSOCommonBPMN/src/test | |
parent | 464d3ffa9c373f36747b10a03554d20dfa4a571b (diff) |
Integrate Logging Library
Updated SO to use ONAP provided filters and constants to meet logging
standards.
Removed redundant classes
Updated constant references
Issue-ID: SO-2301
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ia4e3c2b1a4dcb3881aa34d39885c8b2782880d64
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test')
4 files changed, 26 insertions, 25 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy index d7438f80f9..fda6b8e6e3 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.skyscreamer.jsonassert.JSONAssert import org.skyscreamer.jsonassert.JSONCompareMode import org.springframework.core.env.Environment @@ -127,7 +127,7 @@ class CatalogDbUtilsTest { private void mockGetResponseFromCatalogDb(String queryEndpoint) { Environment environmentMock = createEnvironmentMock() when(environmentMock.getProperty("mso.catalog.db.endpoint")).thenReturn("http://testUrl") - when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)).thenReturn(httpClientMock) + when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)).thenReturn(httpClientMock) Response responseMock = mock(Response.class) when(httpClientMock.get()).thenReturn(responseMock) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy index 837bc77f19..7abfcffb13 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy @@ -26,7 +26,7 @@ import org.junit.Test import org.onap.logging.ref.slf4j.ONAPLogConstants import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.http.HttpStatus import javax.ws.rs.core.MediaType @@ -53,7 +53,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) given(httpClient.get()).willReturn(expectedResponse) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient) // WHEN ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) @@ -75,7 +75,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) willThrow(new RuntimeException("error occurred")).given(httpClient).get() HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient) DelegateExecution delegateExecution = createDelegateExecution() DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() @@ -97,7 +97,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) willThrow(new RuntimeException("error occurred")).given(httpClient).post(BODY_PAYLOAD) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient) DelegateExecution delegateExecution = createDelegateExecution() DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() @@ -120,7 +120,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) given(httpClient.post(BODY_PAYLOAD)).willReturn(expectedResponse) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient) // WHEN ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java index 6a48558d11..6d5ce622d9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java @@ -33,10 +33,11 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; @RunWith(MockitoJUnitRunner.class) public class ExecuteBuildingBlockRainyDayUnitTest { @@ -57,7 +58,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest { @Before public void setup() { - exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC); + exception = new WorkflowException("Test exception", 7000, "", "", ONAPComponents.SDNC); noExtSystemErrorSourceException = new WorkflowException("Test exception without extsystemErrorSource", 7000, "", ""); @@ -75,7 +76,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest { execution.setVariable("isRollback", false); execution.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @@ -87,42 +88,42 @@ public class ExecuteBuildingBlockRainyDayUnitTest { execution.setVariable("isRollback", true); execution.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() { + public void updateExtSystemErrorSourceisRollbackONAPComponentsNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); execution.setVariable("isRollback", true); execution.setVariable("WorkflowException", noExtSystemErrorSourceException); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceTargetEntityNullTest() { + public void updateExtSystemErrorSourceONAPComponentsNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); execution.setVariable("isRollback", false); execution.setVariable("WorkflowException", noExtSystemErrorSourceException); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() { + public void updateExtSystemErrorSourceONAPComponentsisRollbackNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); executionNullisRollback.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java index b109ae258d..5baafbba67 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java @@ -39,7 +39,7 @@ import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; @RunWith(MockitoJUnitRunner.class) public class ExceptionBuilderUnitTest { @@ -67,12 +67,12 @@ public class ExceptionBuilderUnitTest { String expectedErrorMessage = "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message"; doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage, - TargetEntity.SDNC); + ONAPComponents.SDNC); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SDNC); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage, - TargetEntity.SDNC); + ONAPComponents.SDNC); } @Test @@ -80,12 +80,12 @@ public class ExceptionBuilderUnitTest { String expectedErrorMessage = "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message"; doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000, - expectedErrorMessage, TargetEntity.SDNC); + expectedErrorMessage, ONAPComponents.SDNC); - exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, ONAPComponents.SDNC); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000, - expectedErrorMessage, TargetEntity.SDNC); + expectedErrorMessage, ONAPComponents.SDNC); } @Test @@ -93,6 +93,6 @@ public class ExceptionBuilderUnitTest { doReturn("Process key").when(exceptionBuilder).getProcessKey(execution); thrown.expect(BpmnError.class); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC); } } |