diff options
author | 2019-09-10 18:14:41 +0000 | |
---|---|---|
committer | 2019-09-10 18:28:15 +0000 | |
commit | 390e0476092c59676406512f8ce8cdda5dfdd328 (patch) | |
tree | 56ce27080712c844059103c9663ce7da86467d1e /reference/logging-filter/logging-filter-base/src/test | |
parent | cce9554c9771c0227edc17181c2011d28a9c052b (diff) |
updating logging filters
maximize re-use in logging filter classes
Issue-ID: LOG-1125
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
Change-Id: I063d57635fe56a60d97945873d0c7b64852182a5
Diffstat (limited to 'reference/logging-filter/logging-filter-base/src/test')
9 files changed, 64 insertions, 137 deletions
diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AbstractFilterTest.java index 1687c19..cfa74ad 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MDCSetupTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AbstractFilterTest.java @@ -32,35 +32,24 @@ import javax.ws.rs.core.MultivaluedMap; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.logging.filter.base.Constants; -import org.onap.logging.filter.base.MDCSetup; -import org.onap.logging.filter.base.ONAPComponents; -import org.onap.logging.filter.base.SimpleHashMap; -import org.onap.logging.filter.base.SimpleJaxrsHeadersMap; -import org.onap.logging.filter.base.SimpleMap; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; @RunWith(MockitoJUnitRunner.class) -public class MDCSetupTest { +public class AbstractFilterTest extends AbstractFilter { @Mock private HttpServletRequest httpServletRequest; - @Spy - @InjectMocks - private MDCSetup mdcSetup = new MDCSetup(); - private String requestId = "4d31fe02-4918-4975-942f-fe51a44e6a9b"; private String invocationId = "4d31fe02-4918-4975-942f-fe51a44e6a9a"; @After public void tearDown() { MDC.clear(); + System.clearProperty("partnerName"); } @Test @@ -69,7 +58,7 @@ public class MDCSetupTest { MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z"); MDC.put(ONAPLogConstants.MDCs.LOG_TIMESTAMP, "2019-06-18T02:09:06.342Z"); - mdcSetup.setElapsedTime(); + setElapsedTime(); assertEquals(expected, MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME)); } @@ -79,7 +68,7 @@ public class MDCSetupTest { MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, "2019-06-18T02:09:06.024Z"); MDC.put(ONAPLogConstants.MDCs.LOG_TIMESTAMP, "2019-06-18T02:09:06.342Z"); - mdcSetup.setElapsedTimeInvokeTimestamp(); + setElapsedTimeInvokeTimestamp(); assertEquals(expected, MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME)); } @@ -87,7 +76,7 @@ public class MDCSetupTest { public void setRequestIdTest() { HashMap<String, String> headers = new HashMap<>(); headers.put(ONAPLogConstants.Headers.REQUEST_ID, requestId); - String fetchedRequestId = mdcSetup.getRequestId(new SimpleHashMap(headers)); + String fetchedRequestId = getRequestId(new SimpleHashMap(headers)); assertEquals(requestId, fetchedRequestId); } @@ -95,7 +84,7 @@ public class MDCSetupTest { public void setRequestIdRequestIdHeaderTest() { HashMap<String, String> headers = new HashMap<>(); headers.put(Constants.HttpHeaders.HEADER_REQUEST_ID, requestId); - String fetchedRequestId = mdcSetup.getRequestId(new SimpleHashMap(headers)); + String fetchedRequestId = getRequestId(new SimpleHashMap(headers)); assertEquals(requestId, fetchedRequestId); } @@ -103,7 +92,7 @@ public class MDCSetupTest { public void setRequestIdTransactionIdHeaderTest() { HashMap<String, String> headers = new HashMap<>(); headers.put(Constants.HttpHeaders.TRANSACTION_ID, requestId); - String fetchedRequestId = mdcSetup.getRequestId(new SimpleHashMap(headers)); + String fetchedRequestId = getRequestId(new SimpleHashMap(headers)); assertEquals(requestId, fetchedRequestId); } @@ -111,14 +100,14 @@ public class MDCSetupTest { public void setRequestIdEcompRequestIdHeaderTest() { HashMap<String, String> headers = new HashMap<>(); headers.put(Constants.HttpHeaders.ECOMP_REQUEST_ID, requestId); - String fetchedRequestId = mdcSetup.getRequestId(new SimpleHashMap(headers)); + String fetchedRequestId = getRequestId(new SimpleHashMap(headers)); assertEquals(requestId, fetchedRequestId); } @Test public void setRequestIdNoHeaderTest() { HashMap<String, String> headers = new HashMap<>(); - String fetchedRequestId = mdcSetup.getRequestId(new SimpleHashMap(headers)); + String fetchedRequestId = getRequestId(new SimpleHashMap(headers)); assertNotNull(fetchedRequestId); } @@ -126,40 +115,40 @@ public class MDCSetupTest { public void setInvocationIdTest() { HashMap<String, String> headers = new HashMap<>(); headers.put(ONAPLogConstants.Headers.INVOCATION_ID, invocationId); - mdcSetup.setInvocationId(new SimpleHashMap(headers)); + setInvocationId(new SimpleHashMap(headers)); assertEquals(invocationId, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); } @Test public void setInvocationIdNoHeaderTest() { HashMap<String, String> headers = new HashMap<>(); - mdcSetup.setInvocationId(new SimpleHashMap(headers)); + setInvocationId(new SimpleHashMap(headers)); assertNotNull(MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); } @Test public void setInvovationIdFromMDCTest() { MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, "7b77143c-9b50-410c-ac2f-05758a68e3e8"); - mdcSetup.setInvocationIdFromMDC(); + setInvocationIdFromMDC(); assertEquals("7b77143c-9b50-410c-ac2f-05758a68e3e8", MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); } @Test public void setInvocationIdFromMDCNoInvocationIdTest() { - mdcSetup.setInvocationIdFromMDC(); + setInvocationIdFromMDC(); // InvocationId is set to a random UUID assertNotNull(MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); } @Test public void setResponseStatusCodeTest() { - mdcSetup.setResponseStatusCode(200); + setResponseStatusCode(200); assertEquals("COMPLETE", MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); } @Test public void setResponseStatusCodeErrorTest() { - mdcSetup.setResponseStatusCode(400); + setResponseStatusCode(400); assertEquals("ERROR", MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); assertEquals("400", MDC.get(ONAPLogConstants.MDCs.ERROR_CODE)); assertEquals("Bad Request", MDC.get(ONAPLogConstants.MDCs.ERROR_DESC)); @@ -177,7 +166,7 @@ public class MDCSetupTest { MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, "SDNC"); MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, "2019-06-18T02:09:06.024Z"); - mdcSetup.clearClientMDCs(); + clearClientMDCs(); assertNull(MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION)); assertNull(MDC.get(ONAPLogConstants.MDCs.ERROR_CODE)); @@ -191,13 +180,13 @@ public class MDCSetupTest { @Test public void setTargetEntityTest() { - mdcSetup.setTargetEntity(ONAPComponents.SO); + setTargetEntity(ONAPComponents.SO); assertEquals("SO", MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY)); } @Test public void setResponseDescriptionTest() { - mdcSetup.setResponseDescription(502); + setResponseDescription(502); assertEquals("Bad Gateway", MDC.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION)); } @@ -207,7 +196,7 @@ public class MDCSetupTest { headerMap.putSingle(ONAPLogConstants.Headers.PARTNER_NAME, "SO"); SimpleMap headers = new SimpleJaxrsHeadersMap(headerMap); - mdcSetup.setMDCPartnerName(headers); + setMDCPartnerName(headers); assertEquals("SO", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); } @@ -218,7 +207,7 @@ public class MDCSetupTest { headerMap.putSingle(HttpHeaders.USER_AGENT, "Apache-HttpClient/4.5.8 (Java/1.8.0_191)"); SimpleMap headers = new SimpleJaxrsHeadersMap(headerMap); - mdcSetup.setMDCPartnerName(headers); + setMDCPartnerName(headers); assertEquals("Apache-HttpClient/4.5.8 (Java/1.8.0_191)", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); } @@ -229,7 +218,7 @@ public class MDCSetupTest { headerMap.putSingle(Constants.HttpHeaders.CLIENT_ID, "SO"); SimpleMap headers = new SimpleJaxrsHeadersMap(headerMap); - mdcSetup.setMDCPartnerName(headers); + setMDCPartnerName(headers); assertEquals("SO", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); } @@ -239,14 +228,14 @@ public class MDCSetupTest { MultivaluedMap<String, String> headerMap = new MultivaluedHashMap<>(); SimpleMap headers = new SimpleJaxrsHeadersMap(headerMap); - mdcSetup.setMDCPartnerName(headers); + setMDCPartnerName(headers); assertEquals("UNKNOWN", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); } @Test public void setServerFQDNTest() { - mdcSetup.setServerFQDN(); + setServerFQDN(); assertNotNull(MDC.get(ONAPLogConstants.MDCs.SERVER_IP_ADDRESS)); assertNotNull(MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN)); } @@ -254,7 +243,7 @@ public class MDCSetupTest { @Test public void setClientIPAddressTest() { when(httpServletRequest.getHeader("X-Forwarded-For")).thenReturn("127.0.0.2"); - mdcSetup.setClientIPAddress(httpServletRequest); + setClientIPAddress(httpServletRequest); assertEquals("127.0.0.2", MDC.get(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS)); } @@ -262,45 +251,51 @@ public class MDCSetupTest { @Test public void setClientIPAddressNoHeaderTest() { when(httpServletRequest.getRemoteAddr()).thenReturn("127.0.0.1"); - mdcSetup.setClientIPAddress(httpServletRequest); + setClientIPAddress(httpServletRequest); assertEquals("127.0.0.1", MDC.get(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS)); } @Test public void setClientIPAddressNullTest() { - mdcSetup.setClientIPAddress(null); + setClientIPAddress(null); assertEquals("", MDC.get(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS)); } @Test public void setEntryTimeStampTest() { - mdcSetup.setEntryTimeStamp(); + setEntryTimeStamp(); assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); } @Test public void setLogTimestampTest() { - mdcSetup.setLogTimestamp(); + setLogTimestamp(); assertNotNull(MDC.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP)); } @Test public void setInstanceIDTest() { - mdcSetup.setInstanceID(); + setInstanceID(); assertNotNull(MDC.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); } @Test - public void setServiceNameTest() { - String requestUri = "onap/so/serviceInstances"; - when(httpServletRequest.getRequestURI()).thenReturn(requestUri); - mdcSetup.setServiceName(httpServletRequest); + public void getPropertyTest() { + System.setProperty("partnerName", "partnerName"); - assertEquals("onap/so/serviceInstances", MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + String partnerName = getProperty("partnerName"); + assertEquals("partnerName", partnerName); } + + @Test + public void getPropertyNullTest() { + String partnerName = getProperty("partner"); + assertEquals("UNKNOWN", partnerName); + } + } diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java index af80b19..119bdf1 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogContainerFilterTest.java @@ -21,11 +21,11 @@ package org.onap.logging.filter.base; import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; import org.junit.After; import org.junit.Test; @@ -34,14 +34,14 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.logging.filter.base.AuditLogContainerFilter; -import org.onap.logging.filter.base.MDCSetup; -import org.onap.logging.filter.base.SimpleMap; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; @RunWith(MockitoJUnitRunner.class) public class AuditLogContainerFilterTest { + protected static final Logger logger = LoggerFactory.getLogger(AbstractMetricLogFilter.class); @Mock private ContainerRequestContext containerRequest; @@ -50,9 +50,6 @@ public class AuditLogContainerFilterTest { private ContainerResponseContext containerResponse; @Mock - private MDCSetup mdcSetup; - - @Mock private UriInfo uriInfo; @Spy @@ -64,11 +61,14 @@ public class AuditLogContainerFilterTest { MDC.clear(); } + @Test public void filterTest() { - when(mdcSetup.getRequestId(any(SimpleMap.class))).thenReturn("e3b08fa3-535f-4c1b-8228-91318d2bb4ee"); + MultivaluedMap<String, String> headerMap = new MultivaluedHashMap<>(); + headerMap.putSingle(ONAPLogConstants.Headers.REQUEST_ID, "e3b08fa3-535f-4c1b-8228-91318d2bb4ee"); + when(containerRequest.getHeaders()).thenReturn(headerMap); when(uriInfo.getPath()).thenReturn("onap/so/serviceInstances"); - doReturn(uriInfo).when(containerRequest).getUriInfo(); + when(containerRequest.getUriInfo()).thenReturn(uriInfo); auditLogContainerFilter.filter(containerRequest); assertEquals("e3b08fa3-535f-4c1b-8228-91318d2bb4ee", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java index 1a0d0ef..f2a8218 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/AuditLogServletFilterTest.java @@ -21,7 +21,7 @@ package org.onap.logging.filter.base; import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; +import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.when; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; @@ -34,9 +34,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.logging.filter.base.AuditLogServletFilter; -import org.onap.logging.filter.base.MDCSetup; -import org.onap.logging.filter.base.SimpleMap; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; @@ -50,9 +47,6 @@ public class AuditLogServletFilterTest { private ServletResponse response; @Mock - private MDCSetup mdcSetup; - - @Mock private HttpServletRequest servletRequest; @Mock @@ -69,11 +63,10 @@ public class AuditLogServletFilterTest { @Test public void preTest() { - when(mdcSetup.getRequestId(any(SimpleMap.class))).thenReturn("e3b08fa3-535f-4c1b-8228-91318d2bb4ee"); when(servletRequest.getRequestURI()).thenReturn("onap/so/serviceInstances"); - auditLogServletFilter.pre(servletRequest, mdcSetup); + auditLogServletFilter.pre(servletRequest); - assertEquals("e3b08fa3-535f-4c1b-8228-91318d2bb4ee", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertEquals("onap/so/serviceInstances", MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME)); assertEquals("INPROGRESS", MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); } @@ -85,4 +78,5 @@ public class AuditLogServletFilterTest { assertEquals(200, responseCode); } + } diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java index 4f8d16d..4d1f102 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/LoggingContainerFilterTest.java @@ -24,8 +24,6 @@ import static org.junit.Assert.assertEquals; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import org.junit.Test; -import org.onap.logging.filter.base.SimpleJaxrsHeadersMap; -import org.onap.logging.filter.base.SimpleMap; import org.onap.logging.ref.slf4j.ONAPLogConstants; public class LoggingContainerFilterTest { diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java index 9a9f883..ed217aa 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java @@ -23,9 +23,11 @@ package org.onap.logging.filter.base; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; import java.net.URI; import java.net.URISyntaxException; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; @@ -36,18 +38,11 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.logging.filter.base.Constants; -import org.onap.logging.filter.base.MDCSetup; -import org.onap.logging.filter.base.MetricLogClientFilter; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.MDC; @RunWith(MockitoJUnitRunner.class) public class MetricLogClientFilterTest { - - @Mock - private MDCSetup mdcSetup; - @Mock private ClientRequestContext clientRequest; @@ -64,10 +59,9 @@ public class MetricLogClientFilterTest { public void setupHeadersTest() { MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, "8819bfb4-69d2-43fc-b0d6-81d2690533ea"); MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>(); - when(clientRequest.getHeaders()).thenReturn(headers); - doReturn("0a908a5d-e774-4558-96ff-6edcbba65483").when(metricLogClientFilter).extractRequestID(clientRequest); + doReturn("0a908a5d-e774-4558-96ff-6edcbba65483").when(metricLogClientFilter).extractRequestID(); - metricLogClientFilter.setupHeaders(clientRequest); + metricLogClientFilter.setupHeaders(clientRequest, headers); assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID)); assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(Constants.HttpHeaders.HEADER_REQUEST_ID)); @@ -80,6 +74,7 @@ public class MetricLogClientFilterTest { @Test public void setupMDCTest() throws URISyntaxException { + // TODO ingest change from upstream MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, "SO"); URI uri = new URI("onap/so/serviceInstances"); doReturn(uri).when(clientRequest).getUri(); @@ -110,15 +105,15 @@ public class MetricLogClientFilterTest { @Test public void extractRequestIDTest() { MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, "0a908a5d-e774-4558-96ff-6edcbba65483"); - String requestId = metricLogClientFilter.extractRequestID(clientRequest); + String requestId = metricLogClientFilter.extractRequestID(); assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", requestId); } @Test public void extractRequestIDNullTest() throws URISyntaxException { - URI uri = new URI("onap/so/serviceInstances"); - doReturn(uri).when(clientRequest).getUri(); - String requestId = metricLogClientFilter.extractRequestID(clientRequest); + MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, + ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + String requestId = metricLogClientFilter.extractRequestID(); assertNotNull(requestId); assertNotNull(ONAPLogConstants.MDCs.LOG_TIMESTAMP); assertNotNull(ONAPLogConstants.MDCs.ELAPSED_TIME); diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java index 5156516..0290784 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/PayloadLoggingClientFilterTest.java @@ -33,8 +33,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.logging.filter.base.Constants; -import org.onap.logging.filter.base.PayloadLoggingClientFilter; @RunWith(MockitoJUnitRunner.class) public class PayloadLoggingClientFilterTest { diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/PropertyUtilTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/PropertyUtilTest.java deleted file mode 100644 index 4ec14bc..0000000 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/PropertyUtilTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - Logging - * ================================================================================ - * Copyright (C) 2019 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.onap.logging.filter.base; - -import static org.junit.Assert.assertEquals; -import org.junit.After; -import org.junit.Test; -import org.onap.logging.filter.base.PropertyUtil; - -public class PropertyUtilTest { - - private PropertyUtil propertyUtil = new PropertyUtil(); - - @After - public void tearDown() { - System.clearProperty("partnerName"); - } - - @Test - public void getPropertyTest() { - System.setProperty("partnerName", "partnerName"); - - String partnerName = propertyUtil.getProperty("partnerName"); - assertEquals("partnerName", partnerName); - } - - @Test - public void getPropertyNullTest() { - String partnerName = propertyUtil.getProperty("partner"); - assertEquals("UNKNOWN", partnerName); - } -} diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java index a1c5f9b..e2c5da9 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleJaxrsHeadersMapTest.java @@ -24,8 +24,6 @@ import static org.junit.Assert.assertEquals; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; import org.junit.Test; -import org.onap.logging.filter.base.SimpleJaxrsHeadersMap; -import org.onap.logging.filter.base.SimpleMap; import org.onap.logging.ref.slf4j.ONAPLogConstants; public class SimpleJaxrsHeadersMapTest { diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java index f1e6af8..fff6776 100644 --- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java +++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/SimpleServletHeadersMapTest.java @@ -29,7 +29,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.logging.filter.base.SimpleServletHeadersMap; @RunWith(MockitoJUnitRunner.class) public class SimpleServletHeadersMapTest { |