diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-08-30 19:06:46 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2018-08-31 10:35:31 -0400 |
commit | b92b1f86492d1fb0e546ef5124116abdf2d07dc9 (patch) | |
tree | f57ba276175711fd1a180ee7978d5ab464220711 | |
parent | 138f17fce465cdabb928525983323319162f20d2 (diff) |
Update Logging
Add CXF interceptor for SOAP based logging
Clean up extra logging statements
Add UT to ensure MDC properly populated
Change package name on Jax-RS Filter to be more accurate
Issue-ID: SO-947
Change-Id: I3a2afc58de3bf370675658ce3d19cf899b90def7
Change-Id: I3a2afc58de3bf370675658ce3d19cf899b90def7
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
69 files changed, 718 insertions, 341 deletions
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index 566eef7b2f..b0687edc62 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -81,7 +81,7 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> - <artifactId>mso-catalog-db</artifactId> + <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> </dependency> <dependency> @@ -92,7 +92,6 @@ <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> @@ -104,7 +103,6 @@ <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> - <version>1.15</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -116,5 +114,20 @@ <artifactId>h2</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-bindings-soap</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>${cxf.version}</version> + </dependency> </dependencies> </project> diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java index c9a0a1d8c6..abb0a10af5 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java @@ -25,7 +25,7 @@ import java.util.HashMap; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.cloud.Application; +import org.onap.so.TestApplication; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoIOException; @@ -46,7 +46,7 @@ import com.woorea.openstack.heat.model.CreateStackParam; * */ @RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) +@SpringBootTest(classes = TestApplication.class) @ActiveProfiles("test") @Ignore public class MsoHeatUtilsTest extends MsoCommonUtils { diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java index d676bcab3a..95e4352e05 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.BaseTest; -import org.onap.so.cloud.Application; import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.cloud.authentication.models.RackspaceAuthentication; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java index f069e9f61f..1884b3243a 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java @@ -21,16 +21,10 @@ package org.onap.so.config; import static org.junit.Assert.assertEquals; - import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.BaseTest; -import org.onap.so.cloud.Application; import org.onap.so.config.beans.PoConfig; +import org.onap.so.BaseTest; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; public class PoConfigTest extends BaseTest { diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java index 94715f1599..ac194ccee2 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java @@ -22,7 +22,6 @@ package org.onap.so.openstack.beans; import org.junit.Test; import org.onap.so.BaseTest; - import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.impl.PojoClassFactory; import com.openpojo.validation.Validator; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index b304cba93f..6517122475 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -37,7 +37,6 @@ import com.woorea.openstack.heat.model.CreateStackParam; import org.apache.http.HttpStatus; import org.junit.Assert; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.StubOpenStack; import org.onap.so.adapters.vdu.CloudInfo; import org.onap.so.adapters.vdu.PluginAction; @@ -48,6 +47,7 @@ import org.onap.so.adapters.vdu.VduModelInfo; import org.onap.so.adapters.vdu.VduStateType; import org.onap.so.adapters.vdu.VduStatus; import org.onap.so.cloud.CloudConfig; +import org.onap.so.BaseTest; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java index 92f7738c62..5100407633 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java @@ -23,8 +23,8 @@ package org.onap.so.openstack.utils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.StubOpenStack; +import org.onap.so.BaseTest; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java index 0442d4d635..f679e1f776 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java @@ -23,8 +23,8 @@ package org.onap.so.openstack.utils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.StubOpenStack; +import org.onap.so.BaseTest; import org.onap.so.openstack.beans.NetworkInfo; import org.onap.so.openstack.exceptions.MsoException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index df5f3fac73..3329510a83 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -162,11 +162,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>janino</groupId> - <artifactId>janino</artifactId> - <version>2.5.15</version> - </dependency> - <dependency> <groupId>uk.co.blackpepper.bowman</groupId> <artifactId>bowman-client</artifactId> <version>0.3.0</version> 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 ce98b74fab..9709c4af45 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 @@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client"}) +@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client","org.onap.so.logging.jaxrs.filter"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") @EntityScan("org.onap.so.db.catalog.beans") public class CatalogDBApplication { 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 dcd668f2c8..ff162c862e 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 @@ -25,7 +25,7 @@ import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.context.annotation.Configuration; import io.swagger.jaxrs.config.BeanConfig; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java index d29818614d..4bab988e3c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java @@ -46,6 +46,8 @@ import org.onap.so.adapters.vnf.VolumeAdapterRest; import org.onap.so.adapters.vnf.VolumeAdapterRestV2; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -85,6 +87,11 @@ public class CXFConfiguration { @Autowired private JettisonStyleMapperProvider jettisonStyleObjectMapper; + @Autowired + private SOAPLoggingInInterceptor soapInInterceptor; + + @Autowired + private SOAPLoggingOutInterceptor soapOutInterceptor; @Bean(name=Bus.DEFAULT_BUS_ID) public SpringBus springBus() { @@ -107,6 +114,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterImpl); endpoint.publish("/NetworkAdapter"); endpoint.setWsdlLocation("NetworkAdapter.wsdl"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } @@ -115,6 +125,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterAsyncImpl); endpoint.publish("/NetworkAdapterAsync"); endpoint.setWsdlLocation("NetworkAdapterAsync.wsdl"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } @@ -126,6 +139,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), tenantAdapterImpl); endpoint.publish("/TenantAdapter"); endpoint.setWsdlLocation("TenantAdapter.wsdl"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } @@ -139,6 +155,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterImpl); endpoint.publish("/VnfAdapter"); endpoint.setWsdlLocation("VnfAdapter.wsdl"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } @@ -147,6 +166,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl); endpoint.publish("/VnfAsyncAdapter"); endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } @@ -155,6 +177,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfCloudifyAdapterImpl); endpoint.publish("/VnfCloudifyAdapterImpl"); endpoint.setWsdlLocation("VnfCloudifyAdapterImpl.wsdl"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index d0eae88c9e..92a9df1071 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -23,10 +23,8 @@ package org.onap.so.adapters.requestsdb; import java.sql.Timestamp; - import javax.jws.WebService; import javax.transaction.Transactional; - import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationStatus; @@ -37,7 +35,6 @@ import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; import org.onap.so.db.request.data.repository.SiteStatusRepository; -import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; import org.onap.so.utils.UUIDChecker; @@ -48,13 +45,7 @@ import org.springframework.stereotype.Component; @WebService(serviceName = "RequestsDbAdapter", endpointInterface = "org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter", targetNamespace = "http://org.onap.so/requestsdb") @Component @Primary -public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { - - private static final String SUCCESSFUL = "Successful"; - - private static final String GET_INFRA_REQUEST = "Get Infra request"; - - private static final String ERROR = "Error "; +public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoRequestsDbAdapterImpl.class); @@ -76,8 +67,6 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { RequestStatusType requestStatus, String progress, String vnfOutputs, String serviceInstanceId, String networkId, String vnfId, String vfModuleId, String volumeGroupId, String serviceInstanceName, String configurationId, String configurationName, String vfModuleName) throws MsoRequestsDbException { - MsoLogger.setLogContext(requestId, serviceInstanceId); - long startTime = System.currentTimeMillis(); try { InfraActiveRequests request = infraActive.findOneByRequestIdOrClientRequestId(requestId, requestId); if (request == null) { @@ -132,15 +121,11 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } request.setLastModifiedBy(lastModifiedBy); infraActive.save(request); - } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; - logger.error(ERROR + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); - throw new MsoRequestsDbException(error, e); + logger.error(error, e); + throw new MsoRequestsDbException(error, MsoLogger.ErrorCode.BusinessProcesssError, e); } - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); - } private void setProgress(String progress, InfraActiveRequests request) { @@ -153,15 +138,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { @Override @Transactional - public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException { - long startTime = System.currentTimeMillis(); - MsoLogger.setLogContext(requestId, null); - + public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException { logger.debug("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId); - InfraActiveRequests request = null; try { - request = infraActive.findOneByRequestIdOrClientRequestId(requestId, requestId); if (request == null) { String error = "Entity not found. Unable to retrieve MSO Infra Requests DB for Request ID " + requestId; @@ -169,11 +149,9 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; - logger.error(ERROR + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); - throw new MsoRequestsDbException(error, e); + logger.error(error,e); + throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError , e); } - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); return request; } @@ -188,18 +166,14 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { @Transactional public boolean getSiteStatus(String siteName) { UUIDChecker.generateUUID(logger); - long startTime = System.currentTimeMillis(); SiteStatus siteStatus; logger.debug("Request database - get Site Status with Site name:" + siteName); - siteStatus = siteRepo.findOneBySiteName(siteName); if (siteStatus == null) { // if not exist in DB, it means the site is not disabled, thus // return true - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); return true; - } else { - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); + } else { return siteStatus.getStatus(); } } @@ -226,9 +200,8 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { if (operStatus == null) { String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId; - MsoRequestsDbException e = new MsoRequestsDbException(error); - logger.error(ERROR+ MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); - throw e; + logger.error(error); + throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError); } operStatus.setUserId(userId); diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java index a7e9cab6ba..0404c10760 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java @@ -28,6 +28,8 @@ import org.apache.cxf.jaxrs.swagger.Swagger2Feature; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -43,8 +45,12 @@ public class CXFConfiguration { @Autowired private MsoRequestsDbAdapter requestDbAdapterImpl; - - + @Autowired + private SOAPLoggingInInterceptor soapInInterceptor; + + @Autowired + private SOAPLoggingOutInterceptor soapOutInterceptor; + @Bean public ServletRegistrationBean cxfServlet() { @@ -58,7 +64,10 @@ public class CXFConfiguration { LoggingFeature logFeature = new LoggingFeature(); logFeature.setPrettyLogging(true); logFeature.initialize(bus); - endpoint.getFeatures().add(logFeature); + endpoint.getFeatures().add(logFeature); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java index 660761143e..e6d736d2ad 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java @@ -23,6 +23,8 @@ package org.onap.so.adapters.requestsdb.exceptions; import javax.xml.ws.WebFault; +import org.onap.so.exceptions.MSOException; +import org.onap.so.logger.MsoLogger.ErrorCode; /** * This class simply extends Exception (without addition additional functionality) @@ -31,32 +33,41 @@ import javax.xml.ws.WebFault; * */ @WebFault (name="MsoRequestsDbException", faultBean="org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://org.onap.so/requestsdb") -public class MsoRequestsDbException extends Exception { - - private static final long serialVersionUID = 1L; - - private MsoRequestsDbExceptionBean faultInfo; - - public MsoRequestsDbException (String msg) { - super(msg); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbException (Throwable e) { - super(e); - faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); - } - - public MsoRequestsDbException (String msg, Throwable e) { - super (msg, e); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbExceptionBean getFaultInfo() { - return faultInfo; - } - - public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { - this.faultInfo = faultInfo; - } +public class MsoRequestsDbException extends MSOException { + + private static final long serialVersionUID = 1L; + + private MsoRequestsDbExceptionBean faultInfo; + + + public MsoRequestsDbException (String msg) { + super(msg); + faultInfo = new MsoRequestsDbExceptionBean (msg); + } + + public MsoRequestsDbException (Throwable e) { + super(e); + faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); + } + + public MsoRequestsDbException (String msg, Throwable e) { + super (msg, e); + faultInfo = new MsoRequestsDbExceptionBean (msg); + } + + public MsoRequestsDbException(String msg, ErrorCode errorCode) { + super(msg,errorCode.getValue()); + } + + public MsoRequestsDbException(String msg, ErrorCode errorCode, Throwable t) { + super(msg,errorCode.getValue(), t); + } + + public MsoRequestsDbExceptionBean getFaultInfo() { + return faultInfo; + } + + public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { + this.faultInfo = faultInfo; + } } diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java index 58eb0085ad..11f8ff0c36 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java @@ -8,6 +8,7 @@ import org.junit.runner.RunWith; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -39,6 +40,9 @@ public class InfraActiveRequestsRepositoryCustomControllerTest { @LocalServerPort private int port; + + @Value("${mso.adapters.requestDb.auth}") + private String msoAdaptersAuth; private String createURLWithPort(String uri) { return "http://localhost:" + port + uri; @@ -82,6 +86,7 @@ public class InfraActiveRequestsRepositoryCustomControllerTest { headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); + headers.set("Authorization", msoAdaptersAuth); infraActiveRequests = new InfraActiveRequests(); @@ -181,12 +186,13 @@ public class InfraActiveRequestsRepositoryCustomControllerTest { @Test public void checkVnfIdStatusTest() { - HttpEntity<List<String>> entityList = new HttpEntity("", headers); + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("/infraActiveRequests" + "/checkVnfIdStatus/" + infraActiveRequests.getOperationalEnvId())); + HttpEntity<String> entity = new HttpEntity(HttpEntity.EMPTY, headers); ResponseEntity<InfraActiveRequests> response = restTemplate.exchange( builder.toUriString(), - HttpMethod.GET, HttpEntity.EMPTY, InfraActiveRequests.class); + HttpMethod.GET,entity , InfraActiveRequests.class); infraActiveRequestsResponse = response.getBody(); diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java index 4d00421e6c..9ac0cce841 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java @@ -23,15 +23,20 @@ package org.onap.so.adapters.requestsdb.adapters; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.List; - +import java.util.Map; +import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; +import org.onap.so.adapters.requestsdb.application.TestAppender; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter; import org.onap.so.adapters.requestsdb.RequestStatusType; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; @@ -41,12 +46,17 @@ import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.db.request.beans.ResourceOperationStatus; import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Bean; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import ch.qos.logback.classic.spi.ILoggingEvent; @RunWith(SpringRunner.class) @SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -55,8 +65,7 @@ public class MSORequestDBImplTest { @LocalServerPort private int port; - - @Autowired + private MsoRequestsDbAdapter dbAdapter; @Autowired @@ -71,6 +80,16 @@ public class MSORequestDBImplTest { public InfraActiveRequests setupTestEntities() { return buildTestRequest(); } + + @Before + public void before(){ + JaxWsProxyFactoryBean jaxWsProxyFactory = new JaxWsProxyFactoryBean(); + jaxWsProxyFactory.setServiceClass(MsoRequestsDbAdapter.class); + jaxWsProxyFactory.setAddress("http://localhost:" + port + "/services/RequestsDbAdapter"); + jaxWsProxyFactory.setUsername("bpel"); + jaxWsProxyFactory.setPassword("password1$"); + dbAdapter = (MsoRequestsDbAdapter) jaxWsProxyFactory.create(); + } private InfraActiveRequests buildTestRequest() { InfraActiveRequests testRequest= new InfraActiveRequests(); @@ -94,11 +113,9 @@ public class MSORequestDBImplTest { return testRequest; } - - - @Test public void getByRequestId() throws MsoRequestsDbException { + InfraActiveRequests testRequest = setupTestEntities(); // Given String requestId = "00032ab7-3fb3-42e5-965d-8ea592502017"; @@ -121,10 +138,8 @@ public class MSORequestDBImplTest { try { dbAdapter.getInfraRequest(requestId); fail("Expected MsoRequestsDbException to be thrown"); - } catch (MsoRequestsDbException e) { - assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); } catch (Exception e) { - fail("Expected MsoRequestsDbException to be thrown, unknown exception thrown"); + assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); } } @@ -230,11 +245,9 @@ public class MSORequestDBImplTest { null, null, null); - fail("Expected MsoRequestsDbException to be thrown"); - } catch (MsoRequestsDbException e) { - assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); + fail("Expected MsoRequestsDbException to be thrown"); } catch (Exception e) { - fail("Expected MsoRequestsDbException to be thrown, unknown exception thrown"); + assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); } } @@ -328,6 +341,7 @@ public class MSORequestDBImplTest { @Test public void updateServiceOperation_Not_Found() throws MsoRequestsDbException{ + TestAppender.events.clear(); String serviceId = "badserviceId"; String operationId = "operationid"; String operation = "newOperationType"; @@ -349,12 +363,35 @@ public class MSORequestDBImplTest { updatedOperationStatus.setProgress(progress); updatedOperationStatus.setReason(reason); updatedOperationStatus.setOperationContent(operationContent); - - thrown.expect(MsoRequestsDbException.class); - thrown.expectMessage("Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId); - - dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId, - result, operationContent, progress, reason); + + try { + dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId, + result, operationContent, progress, reason); + fail("Expected MsoRequestsDbException to be thrown"); + } catch (Exception e) { + assertEquals("Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId,e.getMessage()); + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor") && + logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("500",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("ERROR",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } + } } @@ -423,6 +460,7 @@ public class MSORequestDBImplTest { @Test public void updateResourceOperationStatus() throws MsoRequestsDbException{ + TestAppender.events.clear(); String resourceTemplateUUID = "template1"; String serviceId = "serviceId"; String operationId = "operationId"; @@ -454,6 +492,28 @@ public class MSORequestDBImplTest { ResourceOperationStatus actualResource = dbAdapter.getResourceOperationStatus(serviceId, operationId,"template1"); assertThat(actualResource, sameBeanAs(expectedResource)); + + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); + assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor") && + logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals(null,mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/application/TestAppender.java index bc04b09588..0da1fd7565 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/application/TestAppender.java @@ -18,21 +18,20 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.adapters.requestsdb.application; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import java.util.ArrayList; +import java.util.List; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; -@SpringBootApplication(scanBasePackages = { "org.onap"}) -@EnableJpaRepositories({"org.onap.so.db.catalog.data.repository", "org.onap.so.db.request.data.repository"}) -@EntityScan({"org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans"}) -public class Application { - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - System.getProperties().setProperty("mso.db", "MARIADB"); - System.getProperties().setProperty("server.name", "Springboot"); - } + +public class TestAppender extends AppenderBase<ILoggingEvent> { + public static List<ILoggingEvent> events = new ArrayList<>(); + + @Override + public void append(ILoggingEvent loggingEvent) { + events.add(loggingEvent); + } } diff --git a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml index 49582ec513..165b6675dc 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml +++ b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml @@ -1,5 +1,7 @@ # will be used as entry in DB to say SITE OFF/ON for healthcheck - +security: + basic: + enabled: false server: port: 8080 tomcat: @@ -8,7 +10,7 @@ ssl-enable: false mso: adapters: requestDb: - auth: Basic YnBlbDptc28tZGItMTUwNyE= + auth: Basic YnBlbDpwYXNzd29yZDEk endpoint: http://localhost:8081 logPath: logs site-name: localSite @@ -34,8 +36,8 @@ spring: security: usercredentials: - - username: test - password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' role: BPEL-Client mariaDB4j: dataDir: diff --git a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml index 54fa1cdd65..d1596cd374 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml +++ b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml @@ -1,33 +1,55 @@ <configuration> - - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern> - </encoder> - </appender> - - - <logger name="com.att.ecomp.audit" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> + <property name="p_lvl" value="%level"/> + <property name="p_log" value="%logger"/> + <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_thr" value="%thread"/> + <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> + + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>${pattern}</pattern> + </encoder> + </appender> + + <appender name="test" + class="org.onap.so.adapters.requestsdb.application.TestAppender" /> + + <logger name="com.att.ecomp.audit" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.error" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> - <logger name="com.att.eelf.error" level="trace" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> </logger> - <logger name="org.flywaydb" level="DEBUG" additivity="false"> + + <logger name="org.flywaydb" level="DEBUG" additivity="false"> <appender-ref ref="STDOUT" /> </logger> - <root level="WARN"> - <appender-ref ref="STDOUT" /> - </root> - + + + <logger name="ch.vorburger" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + + <root level="WARN"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </root> + + </configuration>
\ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java index 4a50fb32e3..f6fd8d5f0d 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java @@ -33,7 +33,9 @@ import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse; import org.onap.so.logger.MsoLogger; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -63,6 +65,11 @@ public class CXFConfiguration { @Autowired private SNIROResponse sniroResponse; + @Autowired + private SOAPLoggingInInterceptor soapInInterceptor; + + @Autowired + private SOAPLoggingOutInterceptor soapOutInterceptor; @Autowired private ObjectMapper mapper; @@ -85,9 +92,12 @@ public class CXFConfiguration { @Bean public Endpoint sndcAdapter() { - EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterPortImpl); - endpoint.publish("/SDNCAdapter"); - return endpoint; + EndpointImpl wsdlEndpoint = new EndpointImpl(bus, sdncAdapterPortImpl); + wsdlEndpoint.getInInterceptors().add(soapInInterceptor); + wsdlEndpoint.getOutInterceptors().add(soapOutInterceptor); + wsdlEndpoint.getOutFaultInterceptors().add(soapOutInterceptor); + wsdlEndpoint.publish("/SDNCAdapter"); + return wsdlEndpoint; } diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java index 29a1db89aa..9716bb624a 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java @@ -24,7 +24,6 @@ import org.junit.After; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.onap.so.cloud.Application; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -33,7 +32,7 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = SDNCAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @AutoConfigureWireMock(port = 0) public abstract class BaseTest { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java index 3034cbcac3..031bc2edc5 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java @@ -32,7 +32,7 @@ import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.vfc.rest.HealthCheckHandler; import org.onap.so.adapters.vfc.rest.VfcAdapterRest; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java index 70191311b2..5da47c973e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java @@ -22,8 +22,8 @@ package org.onap.so.bpmn.common.recipe; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.core.domain.ModelInfo; +import org.onap.so.BaseTest; public class ResourceInputTest extends BaseTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java index 5f90f1e827..634e0a6c9b 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java @@ -30,7 +30,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.onap.so.BaseTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.servicedecomposition.bbobjects.*; @@ -38,6 +37,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.BaseTest; public class ExtractPojosForBBTest extends BaseTest{ ExtractPojosForBB extractPojos = new ExtractPojosForBB(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index 5e2275015b..79cb33b7c4 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -28,13 +28,13 @@ import static org.mockito.Mockito.doThrow; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.BaseTest; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java index 3a4d6a0cc9..c8e1266b90 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java @@ -44,7 +44,6 @@ import javax.ws.rs.core.Response.Status; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.BaseTest; - import junitparams.JUnitParamsRunner; import junitparams.Parameters; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java index 8d33a08c7a..6fad47d8bb 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java @@ -38,9 +38,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.Status; -import org.onap.so.BaseTest; import org.onap.so.bpmn.appc.payload.PayloadClient; - +import org.onap.so.BaseTest; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java index 7fabb2ac0e..0aeb3a2a04 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java @@ -33,7 +33,6 @@ import org.onap.appc.client.lcm.model.ActionIdentifiers; import org.onap.appc.client.lcm.model.CheckLockInput; import org.onap.appc.client.lcm.model.Status; import org.onap.so.BaseTest; - import java.util.Properties; import java.util.UUID; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java index 5ef26b34ee..b388d8ba0a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java @@ -25,9 +25,8 @@ import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.appc.client.lcm.model.Status; -import org.onap.so.BaseTest; import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; - +import org.onap.so.BaseTest; import junitparams.JUnitParamsRunner; import junitparams.Parameters; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java index 35586cc29e..dbf2eb75fd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java @@ -32,9 +32,9 @@ import java.io.IOException; import org.apache.http.HttpStatus; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean; import org.onap.so.client.exception.MapperException; +import org.onap.so.BaseTest; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index 9ada85fa38..d1013e7541 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -24,8 +24,8 @@ import static org.junit.Assert.assertEquals; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.BaseTest; public class ExceptionBuilderTest extends BaseTest { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java index 8231c2f529..08c92d33f0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java @@ -36,9 +36,9 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.client.RestPropertiesLoader; import org.onap.so.client.aai.AAIProperties; +import org.onap.so.BaseTest; public class ThreadedReadTest { @Test diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index 8fe7ebe93a..7721588570 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -37,7 +37,9 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; import org.onap.so.logger.MsoLogger; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -76,6 +78,12 @@ public class CXFConfiguration { @Autowired private VnfAdapterNotify vnfAdapterNotifyServiceImpl; + @Autowired + private SOAPLoggingInInterceptor soapInInterceptor; + + @Autowired + private SOAPLoggingOutInterceptor soapOutInterceptor; + @Bean public ServletRegistrationBean cxfServlet() { return new ServletRegistrationBean(new CXFServlet(), "/mso/*"); @@ -85,6 +93,9 @@ public class CXFConfiguration { public Endpoint vnfAdapterCallback() { EndpointImpl endpoint = new EndpointImpl(bus, vnfAdapterNotifyServiceImpl); endpoint.publish("/VNFAdaptercallback"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } @@ -92,6 +103,9 @@ public class CXFConfiguration { public Endpoint sndcAdapterCallback() { EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl); endpoint.publish("/SDNCAdapterCallbackService"); + endpoint.getInInterceptors().add(soapInInterceptor); + endpoint.getOutInterceptors().add(soapOutInterceptor); + endpoint.getOutFaultInterceptors().add(soapOutInterceptor); return endpoint; } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java index 9843a95342..884c2ac9c6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader; import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java index c05d42c420..d4496d3a55 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java @@ -28,9 +28,9 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.buildingblock.SniroHomingV2; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.BaseTest; import org.springframework.boot.test.mock.mockito.MockBean; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java index bed591500a..4626615e6f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java @@ -41,7 +41,6 @@ import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.onap.so.BaseTest; import org.onap.so.bpmn.mock.FileUtil; import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -55,7 +54,7 @@ import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.sniro.beans.SniroManagerRequest; - +import org.onap.so.BaseTest; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java index 207b9f3f98..352eb20630 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java @@ -30,7 +30,6 @@ import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.adapters.nwrest.CreateNetworkError; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; @@ -45,6 +44,7 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse; import org.onap.so.adapters.nwrest.UpdateNetworkError; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.BaseTest; import org.onap.so.openstack.beans.NetworkRollback; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java index 85f787faa7..f7ad5f5ff4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java @@ -31,7 +31,6 @@ import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; @@ -43,7 +42,7 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest; import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; import org.onap.so.adapters.vnfrest.VfModuleRollback; - +import org.onap.so.BaseTest; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java index b356b21de4..e3d849f925 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java @@ -33,7 +33,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.so.BaseTest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; @@ -43,6 +42,7 @@ import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse; import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.client.adapter.rest.AdapterRestClient; +import org.onap.so.BaseTest; @RunWith(MockitoJUnitRunner.class) diff --git a/common/pom.xml b/common/pom.xml index dccebb216f..ca2c20df7a 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -98,7 +98,16 @@ <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-client</artifactId> <version>${cxf.version}</version> - <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-bindings-soap</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>${cxf.version}</version> </dependency> <dependency> <groupId>com.shazam</groupId> @@ -154,7 +163,17 @@ <artifactId>spring-security-web</artifactId> <version>5.0.5.RELEASE</version> </dependency> - + <dependency> + <groupId>org.onap.logging-analytics</groupId> + <artifactId>logging-slf4j</artifactId> + <version>1.2.2-SNAPSHOT</version> + <exclusions> + <exclusion> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> <build> <resources> diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java index 0f4bbea03c..cb8e1f0a91 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -50,7 +50,7 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.policy.CommonObjectMapperProvider; import org.onap.so.client.policy.LoggingFilter; import org.onap.so.logger.MsoLogger; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsClientLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsClientLogging; import org.onap.so.utils.CryptoUtils; import org.onap.so.utils.TargetEntity; import org.slf4j.MDC; diff --git a/common/src/main/java/org/onap/so/exceptions/MSOException.java b/common/src/main/java/org/onap/so/exceptions/MSOException.java new file mode 100644 index 0000000000..c4be075cf0 --- /dev/null +++ b/common/src/main/java/org/onap/so/exceptions/MSOException.java @@ -0,0 +1,36 @@ +package org.onap.so.exceptions; + + +public class MSOException extends Exception{ + /** + * + */ + private static final long serialVersionUID = 4563920496855255206L; + private Integer errorCode; + + public MSOException(String msg){ + super(msg); + } + + public MSOException (Throwable e) { + super(e); + } + + public MSOException (String msg, Throwable e) { + super (msg, e); + } + + public MSOException(String msg, int errorCode){ + super(msg); + this.errorCode=errorCode; + } + + public MSOException(String msg, int errorCode, Throwable t){ + super(msg,t); + this.errorCode=errorCode; + } + + public Integer getErrorCode(){ + return errorCode; + } +} diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java index e4cac067ba..3ef01f5216 100644 --- a/common/src/main/java/org/onap/so/logger/MsoLogger.java +++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java @@ -60,13 +60,26 @@ public class MsoLogger { public static final String RESPONSECODE = "ResponseCode"; public static final String RESPONSEDESC = "ResponseDesc"; public static final String FQDN = "ServerFQDN"; + public static final String ENTRY_TIMESTAMP = "EntryTimestamp"; + public static final String CLIENT_IPADDRESS = "EntryTimestamp"; - public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; + //HTTP Headers + public static final String HEADER_FROM_APP_ID = "X-FromAppId"; + public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName"; + public static final String HEADER_REQUEST_ID = "X-RequestId"; + public static final String TRANSACTION_ID = "X-TransactionID"; + public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; + public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; + public static final String CLIENT_ID = "X-ClientID"; + public static final String INVOCATION_ID_HEADER = "X-InvocationID"; + //Default values for not found + public static final String UNKNOWN_PARTNER = "UnknownPartner"; + + public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName"; - public static final String SERVER_IP = "ServerIPAddress"; - + public static final String SERVER_IP = "ServerIPAddress"; public static final String REMOTE_HOST = "RemoteHost"; public static final String ALERT_SEVERITY = "AlertSeverity"; @@ -77,16 +90,15 @@ public class MsoLogger { public static final String CAT_LOG_LEVEL = "CategoryLogLevel"; public static final String AUDI_CAT_LOG_LEVEL = "AuditCategoryLogLevel"; - //For getting an identity of calling application - public static final String HEADER_FROM_APP_ID = "X-FromAppId"; - public static final String FROM_APP_ID = "FromAppId"; - public static final String HEADER_REQUEST_ID = "X-RequestId"; - public static final String TRANSACTION_ID = "X-TransactionID"; - public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; - public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; + + + public static final String PARTNER_NAME = "PartnerName"; + - public static final String CLIENT_ID = "X-ClientID"; - public static final String INVOCATION_ID_HEADER = "X-InvocationID"; + + + + // Audit/Metric log specific public static final String BEGINTIME = "BeginTimestamp"; diff --git a/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java new file mode 100644 index 0000000000..9aed537668 --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java @@ -0,0 +1,96 @@ +package org.onap.so.logging.cxf.interceptor; + + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.xml.namespace.QName; +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.Phase; +import org.apache.cxf.service.model.MessageInfo; +import org.apache.cxf.service.model.OperationInfo; +import org.apache.cxf.transport.http.AbstractHTTPDestination; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.MDCSetup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor{ + + protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingInInterceptor.class); + + @Autowired + MDCSetup mdcSetup; + + public SOAPLoggingInInterceptor() { + super(Phase.READ); + } + + @Override + public void handleMessage(SoapMessage message) throws Fault { + try { + + Map<String, List<String>> headers = (Map<String,List<String>>) message.get(Message.PROTOCOL_HEADERS); + HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST); + request.getRemoteAddr(); + + setRequestId(headers); + setInvocationId(headers); + setServiceName(message); + setMDCPartnerName(headers); + mdcSetup.setServerFQDN(); + mdcSetup.setClientIPAddress(request); + mdcSetup.setInstanceUUID(); + mdcSetup.setEntryTimeStamp(); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS"); + logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); + } catch (Exception e) { + logger.warn("Error in incoming SOAP Message Inteceptor", e); + } + } + + private void setServiceName(SoapMessage message) { + String requestURI = (String) message.get(Message.REQUEST_URI); + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, requestURI); + } + + //CXF Appears to flatten headers to lower case + private void setMDCPartnerName(Map<String, List<String>> headers){ + String partnerName=getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(),""); + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName); + } + + private void setInvocationId(Map<String, List<String>> headers) { + String invocationId=getValueOrDefault(headers, ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase(),UUID.randomUUID().toString()); + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); + } + + private void setRequestId(Map<String, List<String>> headers) { + String requestId=getValueOrDefault(headers, ONAPLogConstants.Headers.REQUEST_ID.toLowerCase(),UUID.randomUUID().toString()); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId); + } + + private String getValueOrDefault(Map<String, List<String>> headers, String headerName, String defaultValue){ + String headerValue; + List<String> headerList=headers.get(headerName); + if(headerList != null && !headerList.isEmpty()){ + headerValue= headerList.get(0); + if(headerValue == null || headerValue.isEmpty()) + headerValue = defaultValue; + }else + headerValue = defaultValue; + return headerValue; + } + +} diff --git a/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java new file mode 100644 index 0000000000..c50e505cd8 --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java @@ -0,0 +1,63 @@ +package org.onap.so.logging.cxf.interceptor; + + +import java.util.Collections; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.xml.namespace.QName; +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.Phase; +import org.apache.cxf.service.model.MessageInfo; +import org.apache.cxf.service.model.OperationInfo; +import org.apache.cxf.transport.http.AbstractHTTPDestination; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.exceptions.MSOException; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.MDCSetup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor{ + + private static final String _500 = "500"; + + protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingOutInterceptor.class); + + @Autowired + MDCSetup mdcSetup; + + public SOAPLoggingOutInterceptor() { + super(Phase.WRITE); + } + + @Override + public void handleMessage(SoapMessage message) throws Fault { + try { + Exception ex = message.getContent(Exception.class); + if (ex == null) { + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.COMPLETED.toString()); + }else{ + int responseCode = 0; + responseCode = (int) message.get(Message.RESPONSE_CODE); + if(responseCode != 0 ) + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseCode)); + else + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, _500); + + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); + } + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + } catch (Exception e) { + logger.warn("Error in incoming SOAP Message Inteceptor", e); + } + } +} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java index 2888cbf3a1..2cb375bed8 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.logging.jaxrs.filter.jersey; +package org.onap.so.logging.jaxrs.filter; import org.apache.commons.io.IOUtils; diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java index d278a5f761..7d02136860 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java @@ -18,19 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.logging.jaxrs.filter.jersey; +package org.onap.so.logging.jaxrs.filter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Type; -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.Locale; import java.util.UUID; - import javax.annotation.Priority; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.container.ContainerRequestContext; @@ -44,7 +39,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Providers; -import org.onap.so.logger.MsoLogger; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -56,120 +51,65 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Provider @Component public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerResponseFilter { - - protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class); + + protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class); @Context private HttpServletRequest httpServletRequest; @Context private Providers providers; - + @Autowired - ObjectMapper objectMapper; + private MDCSetup mdcSetup; @Override - public void filter(ContainerRequestContext containerRequest) { - + public void filter(ContainerRequestContext containerRequest) { try { - String clientID = null; - //check headers for request id MultivaluedMap<String, String> headers = containerRequest.getHeaders(); - String requestId = findRequestId(headers); - containerRequest.setProperty("requestId", requestId); - if(headers.containsKey(MsoLogger.CLIENT_ID)){ - clientID = headers.getFirst(MsoLogger.CLIENT_ID); - }else{ - clientID = "UNKNOWN"; - headers.add(MsoLogger.CLIENT_ID, clientID); - } - - String remoteIpAddress = ""; - if (httpServletRequest != null) { - remoteIpAddress = httpServletRequest.getRemoteAddr(); - } - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - - String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID ); - if(partnerName == null || partnerName.isEmpty()) - partnerName="UNKNOWN"; - - MDC.put(MsoLogger.REQUEST_ID,requestId); - MDC.put(MsoLogger.INVOCATION_ID,requestId); - MDC.put(MsoLogger.FROM_APP_ID,partnerName); - MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath()); - MDC.put(MsoLogger.INVOCATION_ID, findInvocationId(headers)); - MDC.put(MsoLogger.STATUSCODE, MsoLogger.INPROGRESS); - MDC.put(MsoLogger.BEGINTIME, formatter.format(instant)); - MDC.put(MsoLogger.PARTNERNAME,partnerName); - MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress)); - MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis())); - logger.debug(MsoLogger.ENTRY, "Entering."); + setRequestId(headers); + containerRequest.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + setInvocationId(headers); + setServiceName(containerRequest); + setMDCPartnerName(headers); + mdcSetup.setServerFQDN(); + mdcSetup.setClientIPAddress(httpServletRequest); + mdcSetup.setInstanceUUID(); + mdcSetup.setEntryTimeStamp(); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS"); + logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); } catch (Exception e) { logger.warn("Error in incoming JAX-RS Inteceptor", e); } } - - private String findRequestId(MultivaluedMap<String, String> headers) { - String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID ); - if(requestId == null || requestId.isEmpty()){ - if(headers.containsKey(MsoLogger.ONAP_REQUEST_ID)){ - requestId = headers.getFirst(MsoLogger.ONAP_REQUEST_ID); - }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){ - requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID); - }else{ - requestId = UUID.randomUUID().toString(); - } - } - return requestId; - } - - private String findInvocationId(MultivaluedMap<String, String> headers) { - String invocationId = (String) headers.getFirst(MsoLogger.INVOCATION_ID_HEADER ); - if(invocationId == null || invocationId.isEmpty()) - invocationId =UUID.randomUUID().toString(); - return invocationId; - } - @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { try { - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - String startTime= MDC.get(MsoLogger.STARTTIME); - long elapsedTime; - try { - elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime); - }catch(NumberFormatException e){ - elapsedTime = 0; - } - String statusCode; - if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ - statusCode=MsoLogger.COMPLETE; - }else{ - statusCode= MsoLogger.StatusCode.ERROR.toString(); - } - - MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext)); - MDC.put(MsoLogger.STATUSCODE, statusCode); - MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus())); - MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime)); - MDC.put(MsoLogger.ENDTIME,formatter.format(instant)); - logger.debug(MsoLogger.EXIT, "Exiting."); + setResponseStatusCode(responseContext); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,payloadMessage(responseContext)); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE,String.valueOf(responseContext.getStatus())); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting."); + MDC.clear(); } catch ( Exception e) { + MDC.clear(); logger.warn("Error in outgoing JAX-RS Inteceptor", e); } + } + + private void setResponseStatusCode(ContainerResponseContext responseContext) { + String statusCode; + if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ + statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString(); + }else{ + statusCode= ONAPLogConstants.ResponseStatus.ERROR.toString(); + } + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); } private String payloadMessage(ContainerResponseContext responseContext) throws IOException { - String message = new String(); + String message = ""; if (responseContext.hasEntity()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Class<?> entityClass = responseContext.getEntityClass(); @@ -192,4 +132,38 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo } return message; } + + + private void setRequestId(MultivaluedMap<String, String> headers){ + String requestId=headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID); + if(requestId == null || requestId.isEmpty()) + requestId = UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId); + } + + private void setInvocationId(MultivaluedMap<String, String> headers){ + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, findInvocationId(headers)); + } + + private void setMDCPartnerName(MultivaluedMap<String, String> headers){ + String partnerName=headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME); + if(partnerName == null || partnerName.isEmpty()) + partnerName = ""; + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName); + } + + private String findInvocationId(MultivaluedMap<String, String> headers) { + String invocationId = headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID); + if(invocationId == null || invocationId.isEmpty()) + invocationId =UUID.randomUUID().toString(); + return invocationId; + } + + private void setServiceName(ContainerRequestContext containerRequest){ + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, containerRequest.getUriInfo().getPath()); + } + + + + } diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java new file mode 100644 index 0000000000..3c04fa1a8e --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java @@ -0,0 +1,51 @@ +package org.onap.so.logging.jaxrs.filter; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.UUID; +import javax.servlet.http.HttpServletRequest; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; + +@Component +public class MDCSetup { + + protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class); + + private static final String INSTANCE_UUID = UUID.randomUUID().toString(); + + public void setInstanceUUID(){ + MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID); + } + + public void setServerFQDN(){ + String serverFQDN = ""; + InetAddress addr= null; + try { + addr = InetAddress.getLocalHost(); + serverFQDN = addr.toString(); + } catch (UnknownHostException e) { + logger.warn("Cannot Resolve Host Name"); + serverFQDN = ""; + } + MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN); + } + + public void setClientIPAddress(HttpServletRequest httpServletRequest){ + String remoteIpAddress = ""; + if (httpServletRequest != null) { + remoteIpAddress = httpServletRequest.getRemoteAddr(); + } + MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress); + } + + public void setEntryTimeStamp() { + MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + } +}
\ No newline at end of file diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java index 0477c9a429..6af7a916d0 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.logging.jaxrs.filter.jersey; +package org.onap.so.logging.jaxrs.filter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index b1963f1f4c..0743a2d2c5 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -130,6 +130,20 @@ <groupId>org.onap.so</groupId> <artifactId>common</artifactId> <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-bindings-soap</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java index 1700e121f0..e6bbc4de4a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java @@ -29,7 +29,7 @@ import org.onap.so.apihandler.filters.RequestUriFilter; import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration; import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.onap.so.web.exceptions.RuntimeExceptionMapper; import org.springframework.context.annotation.Configuration; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java index c16f7bb9ef..b09bbae0ad 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java @@ -76,8 +76,8 @@ public class CreateEcompOperationalEnvironment { requestDb.updateInfraFailureCompletion(e.getMessage(), requestId, request.getOperationalEnvironmentId()); throw validateException; } - //Update request database - requestDb.updateInfraSuccessCompletion("SUCCESSFULLY Created ECOMP OperationalEnvironment.", requestId, request.getOperationalEnvironmentId()); + //Update request database + requestDb.updateInfraSuccessCompletion("SUCCESSFULLY Created ECOMP OperationalEnvironment.", requestId, request.getOperationalEnvironmentId()); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 5b37d772c6..76f4bb08a2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -29,6 +29,7 @@ import com.github.tomakehurst.wiremock.http.Fault; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -1934,7 +1935,7 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void invalidRequestId() throws IOException { String illegalRequestId = "1234"; - headers.set("X-ECOMP-RequestID", illegalRequestId); + headers.set(ONAPLogConstants.Headers.REQUEST_ID, illegalRequestId); uri = servInstanceuri + "v5/serviceInstances"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index 0ace9d5445..585eff23c4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertThat; - +import java.util.UUID; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.http.HttpStatus; @@ -107,22 +107,23 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ .errorInfo(errorLoggerInfo).build(); InfraActiveRequests iar = new InfraActiveRequests(); - iar.setRequestId("123"); + String uuid = UUID.randomUUID().toString(); + iar.setRequestId(uuid); iar.setOperationalEnvName("myOpEnv"); iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/123")) + stubFor(get(urlPathEqualTo("/infraActiveRequests/"+uuid)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/infraActiveRequests/")) - .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message: empty")) + .withRequestBody(containing("{\"requestId\":\""+uuid+ "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message:")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); try { - createEcompOpEn.execute("123", getCloudOrchestrationRequest()); + createEcompOpEn.execute(uuid, getCloudOrchestrationRequest()); }catch(ApiException e){ assertThat(e, sameBeanAs((ApiException) expectedException).ignoring("cause")); } diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml index 7f86cbad1a..cd4f25eadd 100644 --- a/mso-catalog-db/pom.xml +++ b/mso-catalog-db/pom.xml @@ -52,6 +52,20 @@ <groupId>org.onap.so</groupId> <artifactId>common</artifactId> <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-bindings-soap</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index a0e2409023..ac21f5f8f7 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -46,7 +46,7 @@ import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; -import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter; +import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.client.BufferingClientHttpRequestFactory; diff --git a/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java index 6e6db11c45..5a5dc70029 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java @@ -1,4 +1,4 @@ -package org.onap.so; +package org.onap.so.db.catalog; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java index 7a9fc19fcb..73f1ef49fa 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.OrchestrationAction; import org.onap.so.db.catalog.beans.ResourceType; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java index f793fd79e3..bc34883ad3 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java @@ -26,7 +26,6 @@ import static org.junit.Assert.assertTrue; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.data.repository.ControllerSelectionReferenceRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java index 60f8de6c2e..147de51c67 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so; +package org.onap.so.db.catalog; import ch.vorburger.exec.ManagedProcessException; import ch.vorburger.mariadb4j.DBConfigurationBuilder; import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java index 55c5c8351b..456c826d19 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java index 52cac88402..b6aa408185 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.OrchestrationAction; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java index 0ecaa5fbba..ffa56a9ce3 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java @@ -26,7 +26,6 @@ import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/TestApplication.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java index 6ee88e407d..0226b86739 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/TestApplication.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so; +package org.onap.so.db.catalog; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -26,9 +26,9 @@ import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Profile; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(scanBasePackages = { "org.onap"}) +@SpringBootApplication(scanBasePackages = { "org.onap.so.db.catalog"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") -@EntityScan("org.onap.so.db.catalog.beans") +@EntityScan("org.onap.so.db.catalog") @Profile("test") public class TestApplication { private static final String LOGS_DIR = "logs_dir"; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java index 44e7a03855..1f13bd946a 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java @@ -26,7 +26,6 @@ import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.data.repository.VFModuleRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java index 5a0770ead6..37a43aa529 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java @@ -2,7 +2,7 @@ package org.onap.so.db.catalog.data.repository; import org.junit.Assert; import org.junit.Test; -import org.onap.so.BaseTest; +import org.onap.so.db.catalog.BaseTest; import org.onap.so.db.catalog.beans.CloudSite; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java index 21f95a7727..db62759406 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java @@ -2,7 +2,7 @@ package org.onap.so.db.catalog.data.repository; import org.junit.Assert; import org.junit.Test; -import org.onap.so.BaseTest; +import org.onap.so.db.catalog.BaseTest; import org.onap.so.db.catalog.beans.CloudifyManager; import org.springframework.beans.factory.annotation.Autowired; diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml index df6d92163b..8f541d628c 100644 --- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -28,9 +28,6 @@ <property name="errorPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> - <property name="debugPattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg%n" /> - <property name="auditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" /> @@ -48,24 +45,6 @@ \t%thread \t%n" /> - <appender name="SANE" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logs_dir:-.}/${saneLogName}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logs_dir:-.}/${saneLogName}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - - - <maxFileSize>${maxFileSize}</maxFileSize> - <maxHistory>${maxHistory}</maxHistory> - <totalSizeCap>${totalSizeCap}</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${defaultPattern}</pattern> - </encoder> - </appender> - <appender name="Audit" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${logs_dir:-.}/${auditLogName}.log</file> @@ -147,7 +126,7 @@ <totalSizeCap>${totalSizeCap}</totalSizeCap> </rollingPolicy> <encoder> - <pattern>${debugPattern}</pattern> + <pattern>${defaultPattern}</pattern> </encoder> </appender> @@ -170,7 +149,7 @@ <logger name="org.apache.wire" level="DEBUG" /> <logger name="org.onap" level="DEBUG" /> <logger name="com.att.ecomp" level="DEBUG" /> - <logger name="org.apache.cxf.interceptor" level="DEBUG" /> + <logger name="org.apache.cxf" level="INFO" /> <logger name="AUDIT" level="INFO" additivity="false"> <appender-ref ref="asyncAudit" /> |