diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test')
5 files changed, 16 insertions, 14 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java index 98da27dcc5..b4e2d96348 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/AuditDataTest.java @@ -18,6 +18,7 @@ package org.openecomp.sdc.logging.api; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; import org.junit.Test; @@ -38,7 +39,7 @@ public class AuditDataTest { final String responseDescription = "Response-Description"; final String ipAddress = "DUMMY.IP.ADDRESS"; - AuditData data = AuditData.builder().startTime(start).endTime(end).statusCode(StatusCode.COMPLETE) + AuditData data = AuditData.builder().startTime(start).endTime(end).statusCode(COMPLETE) .responseCode(responseCode).responseDescription(responseDescription) .clientIpAddress(ipAddress).build(); @@ -47,7 +48,7 @@ public class AuditDataTest { assertEquals(start, data.getStartTime()); assertEquals(responseCode, data.getResponseCode()); assertEquals(responseDescription, data.getResponseDescription()); - assertEquals(StatusCode.COMPLETE, data.getStatusCode()); + assertEquals(COMPLETE, data.getStatusCode()); } @Test diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java index 6f860af60a..e6998f35e8 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/LoggerFactoryTest.java @@ -71,7 +71,7 @@ public class LoggerFactoryTest { logger.warn(""); logger.info(""); logger.debug(""); - logger.audit(null); + logger.auditExit(null); logger.metrics(MetricsData.builder().build()); } } diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java index 43f913ecab..9c9aa81bc7 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/api/MetricsDataTest.java @@ -18,6 +18,7 @@ package org.openecomp.sdc.logging.api; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus.COMPLETE; import org.junit.Test; @@ -40,7 +41,7 @@ public class MetricsDataTest { final String targetEntity = "Metrics-Target-Entity"; final String targetVirtualEntity = "Metrics-Target-Virtual-Entity"; - MetricsData data = MetricsData.builder().startTime(start).endTime(end).statusCode(StatusCode.COMPLETE) + MetricsData data = MetricsData.builder().startTime(start).endTime(end).statusCode(COMPLETE) .responseCode(responseCode).responseDescription(responseDescription) .clientIpAddress(ipAddress).targetEntity(targetEntity) .targetVirtualEntity(targetVirtualEntity).build(); @@ -50,7 +51,7 @@ public class MetricsDataTest { assertEquals(start, data.getStartTime()); assertEquals(responseCode, data.getResponseCode()); assertEquals(responseDescription, data.getResponseDescription()); - assertEquals(StatusCode.COMPLETE, data.getStatusCode()); + assertEquals(COMPLETE, data.getStatusCode()); assertEquals(targetEntity, data.getTargetEntity()); assertEquals(targetVirtualEntity, data.getTargetVirtualEntity()); diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java index 1bd13a9dfd..36c0957069 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/AuditTrackerTest.java @@ -27,9 +27,9 @@ import static org.mockito.Mockito.when; import javax.servlet.http.HttpServletRequest; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.onap.logging.ref.slf4j.ONAPLogConstants.ResponseStatus; import org.openecomp.sdc.logging.api.AuditData; import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.StatusCode; /** * Test initialization and of audit tracker and log invocation. @@ -73,7 +73,7 @@ public class AuditTrackerTest { tracker.preRequest(mock(HttpServletRequest.class)); tracker.postRequest(mock(RequestProcessingResult.class)); - verify(logger, never()).audit(any(AuditData.class)); + verify(logger, never()).auditExit(any(AuditData.class)); } @Test @@ -87,7 +87,7 @@ public class AuditTrackerTest { tracker.postRequest(mock(RequestProcessingResult.class)); ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class); - verify(logger).audit(auditDataCaptor.capture()); + verify(logger).auditExit(auditDataCaptor.capture()); assertTrue(auditDataCaptor.getValue().getEndTime() > 0); } @@ -104,7 +104,7 @@ public class AuditTrackerTest { tracker.postRequest(result); ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class); - verify(logger).audit(auditDataCaptor.capture()); + verify(logger).auditExit(auditDataCaptor.capture()); AuditData capturedAuditData = auditDataCaptor.getValue(); assertEquals(Integer.toString(result.getStatus()), capturedAuditData.getResponseCode()); @@ -127,7 +127,7 @@ public class AuditTrackerTest { tracker.postRequest(mock(RequestProcessingResult.class)); ArgumentCaptor<AuditData> auditDataCaptor = ArgumentCaptor.forClass(AuditData.class); - verify(logger).audit(auditDataCaptor.capture()); + verify(logger).auditExit(auditDataCaptor.capture()); AuditData capturedAuditData = auditDataCaptor.getValue(); assertEquals(address, capturedAuditData.getClientIpAddress()); @@ -141,8 +141,8 @@ public class AuditTrackerTest { } @Override - public StatusCode getStatusCode() { - return StatusCode.ERROR; + public ResponseStatus getStatusCode() { + return ResponseStatus.ERROR; } @Override diff --git a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java index 59c690d763..f1066c447b 100644 --- a/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java +++ b/openecomp-be/lib/openecomp-sdc-logging-lib/openecomp-sdc-logging-api/src/test/java/org/openecomp/sdc/logging/servlet/ContextTrackerTest.java @@ -119,7 +119,7 @@ public class ContextTrackerTest { } @Test - public void partnerNameAbsentWhenNotGiven() { + public void partnerNameIsUnknownWhenNotGiven() { mockStatic(LoggingContext.class); @@ -131,7 +131,7 @@ public class ContextTrackerTest { LoggingContext.put(contextDataCaptor.capture()); - assertNull(contextDataCaptor.getValue().getPartnerName()); + assertEquals(contextDataCaptor.getValue().getPartnerName(), "UNKNOWN"); } @Test |