From b92b1f86492d1fb0e546ef5124116abdf2d07dc9 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Thu, 30 Aug 2018 19:06:46 -0400 Subject: 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) --- .../org/onap/so/adapters/sdnc/CXFConfiguration.java | 18 ++++++++++++++---- .../test/java/org/onap/so/adapters/sdnc/BaseTest.java | 3 +-- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'adapters/mso-sdnc-adapter') 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 { -- cgit 1.2.3-korg