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 /adapters/mso-catalog-db-adapter | |
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 'adapters/mso-catalog-db-adapter')
4 files changed, 25 insertions, 20 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java index aa19aed515..6fb65ca87e 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java @@ -28,7 +28,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client", "org.onap.so.logging.jaxrs.filter", "org.onap.so.logging.spring.interceptor", "org.onap.so.client", - "org.onap.so.configuration", "org.onap.so.db"}) + "org.onap.so.configuration", "org.onap.so.db", "org.onap.logging.filter"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") @EntityScan("org.onap.so.db.catalog.beans") @EnableScheduling diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java index b43447f5c4..699347015b 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java @@ -23,10 +23,12 @@ package org.onap.so.adapters.catalogdb; import javax.annotation.PostConstruct; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; +import org.onap.logging.filter.base.Constants; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest; import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl; import org.onap.so.adapters.catalogdb.rest.VnfRestImpl; -import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; import org.springframework.context.annotation.Configuration; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.jaxrs.listing.ApiListingResource; @@ -38,10 +40,11 @@ public class JerseyConfiguration extends ResourceConfig { @PostConstruct public void setUp() { + System.setProperty(Constants.Property.PARTNER_NAME, ONAPComponents.CATALOG_DB.toString()); register(CatalogDbAdapterRest.class); register(ApiListingResource.class); register(SwaggerSerializers.class); - register(JaxRsFilterLogging.class); + register(SOAuditLogContainerFilter.class); register(ServiceRestImpl.class); register(VnfRestImpl.class); BeanConfig beanConfig = new BeanConfig(); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java index 4dabb58f7d..ff0f8dc432 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java @@ -21,14 +21,16 @@ package org.onap.so.adapters.catalogdb; -import org.onap.so.logging.spring.interceptor.LoggingInterceptor; +import org.onap.logging.filter.spring.LoggingInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.handler.MappedInterceptor; @Configuration +@ComponentScan(basePackages = {"org.onap.logging.filter"}) public class WebMvcConfig extends WebMvcConfigurerAdapter { @Autowired diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index 145ba50583..e1cca8901e 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -22,13 +22,13 @@ package org.onap.so.adapters.catalogdb.catalogrest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.onap.so.logger.MdcConstants.ENDTIME; -import static org.onap.so.logger.MdcConstants.INVOCATION_ID; -import static org.onap.so.logger.MdcConstants.PARTNERNAME; -import static org.onap.so.logger.MdcConstants.RESPONSECODE; -import static org.onap.so.logger.MdcConstants.RESPONSEDESC; -import static org.onap.so.logger.MdcConstants.SERVICE_NAME; -import static org.onap.so.logger.MdcConstants.STATUSCODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE; +import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME; import java.io.IOException; import java.util.Map; import javax.ws.rs.core.MediaType; @@ -815,27 +815,27 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker().getName().equals("ENTRY")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); + assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); assertEquals("v2/vfModules", mdc.get(SERVICE_NAME)); - assertEquals("INPROGRESS", mdc.get(STATUSCODE)); - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") + assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE)); + } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") && logEvent.getMarker().getName().equals("EXIT")) { Map<String, String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(ENDTIME)); + assertNotNull(mdc.get(LOG_TIMESTAMP)); assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("500", mdc.get(RESPONSECODE)); - assertEquals("UNKNOWN", mdc.get(PARTNERNAME)); + assertEquals("500", mdc.get(RESPONSE_CODE)); + assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); assertEquals("v2/vfModules", mdc.get(SERVICE_NAME)); - assertEquals("ERROR", mdc.get(STATUSCODE)); - assertNotNull(mdc.get(RESPONSEDESC)); + assertEquals("ERROR", mdc.get(RESPONSE_STATUS_CODE)); + assertNotNull(mdc.get(RESPONSE_DESCRIPTION)); } } |