diff options
31 files changed, 660 insertions, 339 deletions
diff --git a/adapters/mso-adapter-utils/src/test/resources/logback-test.xml b/adapters/mso-adapter-utils/src/test/resources/logback-test.xml index 3873b2c509..ca600b5bd2 100644 --- a/adapters/mso-adapter-utils/src/test/resources/logback-test.xml +++ b/adapters/mso-adapter-utils/src/test/resources/logback-test.xml @@ -18,35 +18,35 @@ ============LICENSE_END========================================================= --> -<configuration > - - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern> - </encoder> - </appender> +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n + </pattern> + </encoder> + </appender> - <logger name="com.att.eelf.audit" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <logger name="com.att.eelf.audit" level="info" 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" /> - </logger> - - <root level="info"> - <appender-ref ref="STDOUT" /> - </root> - + </logger> + + <logger name="com.att.eelf.metrics" level="info" 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" /> + </logger> + + <logger name="org.reflections" level="ERROR" /> + + <root level="info"> + <appender-ref ref="STDOUT" /> + </root> + </configuration> diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml index 97a4503190..7c795eedab 100644 --- a/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml +++ b/adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml @@ -1,46 +1,47 @@ <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> - - <appender name="test" class="org.onap.so.adapters.catalogdb.catalogrest.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="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"> - <appender-ref ref="STDOUT" /> - </logger> - <logger name="org.hibernate" level="DEBUG" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <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> + <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> + + <appender name="test" class="org.onap.so.adapters.catalogdb.catalogrest.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="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"> + <appender-ref ref="STDOUT" /> + </logger> + <logger name="org.hibernate" level="DEBUG" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="ch.vorburger" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.reflections" level="ERROR" /> + + <root level="WARN"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </root> </configuration>
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java index 4636a91d5c..b9e86b0169 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java @@ -2,13 +2,16 @@ package org.onap.so.adapters.tasks.orchestration; import java.io.ByteArrayInputStream; import java.io.StringReader; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.Optional; +import javax.xml.XMLConstants; import javax.xml.bind.JAXB; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.ws.Holder; +import org.apache.commons.lang3.StringUtils; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; import org.onap.so.adapters.network.MsoNetworkAdapterImpl; @@ -24,6 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.w3c.dom.Document; @Component public class RollbackService extends ExternalTaskUtils { @@ -110,14 +114,16 @@ public class RollbackService extends ExternalTaskUtils { } } - protected Optional<String> findRequestType(String xmlString) { + protected Optional<String> findRequestType(final String xmlString) { try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - org.w3c.dom.Document doc; - doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8"))); + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, StringUtils.EMPTY); + + final DocumentBuilder builder = factory.newDocumentBuilder(); + final Document doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8))); return Optional.of(doc.getDocumentElement().getNodeName()); - } catch (Exception e) { + } catch (final Exception e) { logger.error("Error Finding Request Type", e); return Optional.empty(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java index 9b2badd1e7..4fc42633fc 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java @@ -24,14 +24,17 @@ package org.onap.so.adapters.tasks.orchestration; import java.io.ByteArrayInputStream; import java.io.StringReader; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import javax.xml.XMLConstants; import javax.xml.bind.JAXB; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.ws.Holder; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.mutable.MutableBoolean; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; @@ -59,6 +62,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.w3c.dom.Document; @Component public class StackService extends ExternalTaskUtils { @@ -342,14 +346,16 @@ public class StackService extends ExternalTaskUtils { } - protected Optional<String> findRequestType(String xmlString) { + protected Optional<String> findRequestType(final String xmlString) { try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - org.w3c.dom.Document doc; - doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8"))); + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, StringUtils.EMPTY); + + final DocumentBuilder builder = factory.newDocumentBuilder(); + final Document doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8))); return Optional.of(doc.getDocumentElement().getNodeName()); - } catch (Exception e) { + } catch (final Exception e) { logger.error("Error Finding Request Type", e); return Optional.empty(); } diff --git a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml index 8bfa6d83c3..a2cf7dba07 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml +++ b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml @@ -18,8 +18,8 @@ ============LICENSE_END========================================================= --> -<configuration > - +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level @@ -28,19 +28,18 @@ </encoder> </appender> + <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> - <logger name="com.woorea.openstack" level="${so.log.level:-DEBUG}" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - + <logger name="org.reflections" level="ERROR" /> - <root level="WARN"> - <appender-ref ref="STDOUT" /> - </root> + <root level="WARN"> + <appender-ref ref="STDOUT" /> + </root> </configuration> 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 a63bd27378..c676d7fd8d 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,48 +1,48 @@ <configuration> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</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="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"> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n + </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="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> </logger> - - - <logger name="ch.vorburger" level="WARN" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.hibernate" level="DEBUG" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - - <root level="WARN"> - <appender-ref ref="STDOUT" /> - <appender-ref ref="test" /> - </root> + <logger name="org.flywaydb" level="DEBUG" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + + <logger name="ch.vorburger" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.hibernate" level="DEBUG" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.reflections" level="ERROR" /> + + <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/test/resources/logback-test.xml b/adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml index 3a3e57ac9d..0b44f79a66 100644 --- a/adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml +++ b/adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml @@ -18,8 +18,8 @@ ============LICENSE_END========================================================= --> -<configuration > - +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level @@ -29,24 +29,25 @@ </appender> - <logger name="com.att.eelf.audit" level="INFO" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.metrics" level="INFO" additivity="false"> + <logger name="com.att.eelf.audit" level="INFO" additivity="false"> <appender-ref ref="STDOUT" /> - </logger> + </logger> - <logger name="com.att.eelf.error" level="WARN" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> + <logger name="com.att.eelf.metrics" level="INFO" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> - <root level="WARN"> - <appender-ref ref="STDOUT" /> - </root> + <logger name="com.att.eelf.error" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.reflections" level="ERROR" /> + <root level="WARN"> + <appender-ref ref="STDOUT" /> + </root> </configuration> diff --git a/adapters/so-appc-orchestrator/src/test/resources/logback-test.xml b/adapters/so-appc-orchestrator/src/test/resources/logback-test.xml index 8a9e705ca6..eaf5a9cde2 100644 --- a/adapters/so-appc-orchestrator/src/test/resources/logback-test.xml +++ b/adapters/so-appc-orchestrator/src/test/resources/logback-test.xml @@ -1,31 +1,32 @@ <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 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> + + <logger name="com.att.eelf.error" level="trace" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.onap" level="${so.log.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:-WARN}" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <root level="WARN"> - <appender-ref ref="STDOUT" /> - </root> - + </logger> + + <logger name="org.reflections" level="ERROR" /> + + <root level="WARN"> + <appender-ref ref="STDOUT" /> + </root> + </configuration>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/logback-test.xml b/asdc-controller/src/test/resources/logback-test.xml index d74de50d60..75b252358d 100644 --- a/asdc-controller/src/test/resources/logback-test.xml +++ b/asdc-controller/src/test/resources/logback-test.xml @@ -1,7 +1,5 @@ <configuration> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level @@ -23,17 +21,17 @@ </logger> <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - + <appender-ref ref="STDOUT" /> + </logger> <logger name="ch.vorburger" level="WARN" additivity="false"> <appender-ref ref="STDOUT" /> </logger> + <logger name="org.reflections" level="ERROR" /> + <root level="WARN"> <appender-ref ref="STDOUT" /> </root> - </configuration>
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml index 9088d1a844..90f73dc419 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml @@ -24,7 +24,7 @@ <root level="WARN"> <appender-ref ref="STDOUT" /> </root> - + <logger name="org.reflections" level="ERROR" /> <logger name="wiremock.org" level="ERROR" /> </configuration>
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java index 58238c8ff6..79a4c54e23 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/xml/XmlTool.java @@ -224,7 +224,7 @@ public final class XmlTool { * @return the contents of the modified XML document as a String or null/empty if the modification failed. * @throws IOException, TransformerException, ParserConfigurationException, SAXException */ - public static Optional<String> modifyElement(String xml, String elementTag, String newValue) + public static Optional<String> modifyElement(final String xml, final String elementTag, final String newValue) throws IOException, TransformerException, ParserConfigurationException, SAXException { if (xml == null || xml.isEmpty()) { @@ -232,15 +232,15 @@ public final class XmlTool { return Optional.empty(); } - DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); dbFactory.setNamespaceAware(true); dbFactory.setFeature("http://xml.org/sax/features/external-general-entities", false); dbFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); - DocumentBuilder db = dbFactory.newDocumentBuilder(); - InputSource source = new InputSource(new StringReader(xml)); - Document doc = db.parse(source); + final DocumentBuilder db = dbFactory.newDocumentBuilder(); + final InputSource source = new InputSource(new StringReader(xml)); + final Document doc = db.parse(source); - Node modNode = doc.getElementsByTagName(elementTag).item(0); + final Node modNode = doc.getElementsByTagName(elementTag).item(0); if (modNode == null) { // did not find the specified element to be modified, return empty // System.out.println("Did not find element tag " + elementTag + " in XML"); @@ -249,9 +249,12 @@ public final class XmlTool { modNode.setTextContent(newValue); } - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - StringWriter writer = new StringWriter(); + final TransformerFactory transformerFactory = TransformerFactory.newInstance(); + transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY); + transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, StringUtils.EMPTY); + + final Transformer transformer = transformerFactory.newTransformer(); + final StringWriter writer = new StringWriter(); transformer.transform(new DOMSource(doc), new StreamResult(writer)); // return the modified String representation of the XML return Optional.of(writer.toString().trim()); diff --git a/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml index 02ac437db6..20b0dce748 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml +++ b/bpmn/MSOCoreBPMN/src/test/resources/logback-test.xml @@ -18,33 +18,34 @@ ============LICENSE_END========================================================= --> -<configuration > - - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern> - </encoder> - </appender> +<configuration> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n + </pattern> + </encoder> + </appender> - <logger name="com.att.eelf.audit" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <logger name="com.att.eelf.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> - <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" /> - </logger> - <root level="info"> - <appender-ref ref="STDOUT" /> - </root> - + <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" /> + </logger> + + <logger name="org.reflections" level="ERROR" /> + + <root level="info"> + <appender-ref ref="STDOUT" /> + </root> </configuration> diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml index c080bc90f8..c0b24d9680 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml @@ -27,5 +27,6 @@ </root> <logger name="wiremock.org" level="DEBUG" /> + <logger name="org.reflections" level="ERROR" /> </configuration>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml index 38a2ef6ef5..7a8d2a122c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml @@ -1,7 +1,5 @@ <configuration> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level @@ -10,7 +8,6 @@ </encoder> </appender> - <logger name="com.att.ecomp.audit" level="info" additivity="false"> <appender-ref ref="STDOUT" /> </logger> @@ -26,19 +23,19 @@ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> <appender-ref ref="STDOUT" /> </logger> - <logger name="ch.vorburger" level="WARN" additivity="false"> <appender-ref ref="STDOUT" /> </logger> - - <logger name="AUDIT" level="info" additivity="true"> + + <logger name="AUDIT" level="info" additivity="true"> <appender-ref ref="STDOUT" /> </logger> + <logger name="org.reflections" level="ERROR" /> + <root level="WARN"> <appender-ref ref="STDOUT" /> </root> - </configuration>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml index 3b0bdb252f..6fbf09ec4a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/logback-test.xml @@ -45,6 +45,8 @@ <logger name="AUDIT" level="info" additivity="true"> <appender-ref ref="STDOUT"/> </logger> + + <logger name="org.reflections" level="ERROR" /> <!-- suppress the amount of org.apache.tomcat.util.net.NioEndpoint log--> <logger name="org.apache.tomcat" level="WARN" /> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImpl.java index 8e6e8678ed..7c6473f79d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImpl.java @@ -2,12 +2,15 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks; import java.io.ByteArrayInputStream; import java.io.StringReader; +import java.nio.charset.StandardCharsets; import java.util.Optional; +import javax.xml.XMLConstants; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import org.apache.commons.lang3.StringUtils; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkResponse; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; @@ -22,6 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.w3c.dom.Document; @Component public class NetworkAdapterImpl { @@ -80,14 +84,16 @@ public class NetworkAdapterImpl { return unmarshaller.unmarshal(reader); } - protected Optional<String> findResponseType(String xmlString) { + protected Optional<String> findResponseType(final String xmlString) { try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - org.w3c.dom.Document doc; - doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8"))); + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, StringUtils.EMPTY); + factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, StringUtils.EMPTY); + + final DocumentBuilder builder = factory.newDocumentBuilder(); + final Document doc = builder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8))); return Optional.of(doc.getDocumentElement().getNodeName()); - } catch (Exception e) { + } catch (final Exception e) { logger.error("Error Finding Response Type", e); return Optional.empty(); } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/logback-test.xml b/bpmn/so-bpmn-tasks/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..bb4aee6e05 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/logback-test.xml @@ -0,0 +1,36 @@ +<!-- + ============LICENSE_START======================================================= + ONAP - SO + ================================================================================ + Copyright (C) 2021 Nordix Foundation. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<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="org.reflections" level="ERROR" /> + <logger name="org.onap" level="DEBUG" /> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> diff --git a/common/pom.xml b/common/pom.xml index f42033b152..a6e8a79f56 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -15,6 +15,7 @@ <protobuf.version>3.10.0</protobuf.version> <grpc.netty.version>4.1.30.Final</grpc.netty.version> <ccsdk.version>1.1.2</ccsdk.version> + <spring-cloud-sleuth.version>2.0.2.RELEASE</spring-cloud-sleuth.version> </properties> <dependencies> <dependency> @@ -300,6 +301,10 @@ <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-sleuth</artifactId> + </dependency> </dependencies> <dependencyManagement> <dependencies> @@ -310,6 +315,13 @@ <type>pom</type> <scope>import</scope> </dependency> + <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-sleuth</artifactId> + <version>${spring-cloud-sleuth.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> </dependencies> </dependencyManagement> <build> diff --git a/common/src/main/java/org/onap/so/security/HttpHeaderForwarderConfig.java b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderConfig.java new file mode 100644 index 0000000000..6340b1c6fb --- /dev/null +++ b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderConfig.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Orange. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.security; + +import java.util.ArrayList; +import java.util.List; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.util.CollectionUtils; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * @author Sheel Bajpai (sheel.bajpai@orange.com) + * + */ +@Configuration +@Profile("serviceMesh") +class HttpHeaderForwarderConfig implements WebMvcConfigurer { + @Bean + public RestTemplate restTemplate() { + RestTemplate restTemplate = new RestTemplate(); + + List<ClientHttpRequestInterceptor> interceptors = restTemplate.getInterceptors(); + if (CollectionUtils.isEmpty(interceptors)) + interceptors = new ArrayList<>(); + + interceptors.add(new HttpHeaderForwarderRequestInterceptor()); + restTemplate.setInterceptors(interceptors); + return restTemplate; + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(new HttpHeaderForwarderHandlerInterceptor()); + } +} diff --git a/common/src/main/java/org/onap/so/security/HttpHeaderForwarderHandlerInterceptor.java b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderHandlerInterceptor.java new file mode 100644 index 0000000000..da01e5e1cf --- /dev/null +++ b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderHandlerInterceptor.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Orange. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.security; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import com.google.common.collect.ImmutableSet; + +/** + * @author Sheel Bajpai (sheel.bajpai@orange.com) + * + */ + +public class HttpHeaderForwarderHandlerInterceptor extends HandlerInterceptorAdapter { + + private static final ThreadLocal<Map<String, List<String>>> HEADERS_THREAD_LOCAL = new ThreadLocal<>(); + + private static final Set<String> FORWARDED_HEADER_NAMES = ImmutableSet.of("authorization", "x-request-id", + "x-b3-traceid", "x-b3-spanid", "x-b3-parentspanid", "x-b3-sampled", "x-b3-flags", "x-ot-span-context"); + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) + throws Exception { + + Map<String, List<String>> headerMap = Collections.list(request.getHeaderNames()).stream() + .map(String::toLowerCase).filter(FORWARDED_HEADER_NAMES::contains) + .collect(Collectors.toMap(Function.identity(), h -> Collections.list(request.getHeaders(h)))); + + HEADERS_THREAD_LOCAL.set(headerMap); + return super.preHandle(request, response, handler); + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, + ModelAndView modelAndView) throws Exception { + HEADERS_THREAD_LOCAL.remove(); + } + + static Map<String, List<String>> getHeaders() { + return HEADERS_THREAD_LOCAL.get(); + } + +} diff --git a/common/src/main/java/org/onap/so/security/HttpHeaderForwarderRequestInterceptor.java b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderRequestInterceptor.java new file mode 100644 index 0000000000..18a3f3deda --- /dev/null +++ b/common/src/main/java/org/onap/so/security/HttpHeaderForwarderRequestInterceptor.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Orange. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.so.security; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; + +/** + * @author Sheel Bajpai (sheel.bajpai@orange.com) + * + */ + +public class HttpHeaderForwarderRequestInterceptor implements ClientHttpRequestInterceptor { + + @Override + public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) + throws IOException { + + Map<String, List<String>> headerMap = HttpHeaderForwarderHandlerInterceptor.getHeaders(); + if (headerMap != null && !headerMap.isEmpty()) + request.getHeaders().putAll(HttpHeaderForwarderHandlerInterceptor.getHeaders()); + return execution.execute(request, body); + } + +} diff --git a/common/src/main/java/org/onap/so/security/SoNoAuthWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/SoNoAuthWebSecurityConfigurerAdapter.java index b3e4842bbd..4a112b9687 100644 --- a/common/src/main/java/org/onap/so/security/SoNoAuthWebSecurityConfigurerAdapter.java +++ b/common/src/main/java/org/onap/so/security/SoNoAuthWebSecurityConfigurerAdapter.java @@ -34,7 +34,7 @@ import org.springframework.security.web.firewall.StrictHttpFirewall; @EnableWebSecurity @Configuration @Order(2) -@Profile({"aaf", "test"}) +@Profile({"aaf", "test", "serviceMesh"}) public class SoNoAuthWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { @Override public void configure(final WebSecurity web) throws Exception { diff --git a/common/src/test/resources/logback-test.xml b/common/src/test/resources/logback-test.xml index 3c5f259817..d0714bbc35 100644 --- a/common/src/test/resources/logback-test.xml +++ b/common/src/test/resources/logback-test.xml @@ -68,6 +68,8 @@ <logger name="org.reflections" level="ERROR" additivity="false"> <appender-ref ref="STDOUT" /> </logger> + + <logger name="org.reflections" level="ERROR" /> <root level="WARN"> <appender-ref ref="STDOUT" /> diff --git a/cxf-logging/src/test/resources/logback-test.xml b/cxf-logging/src/test/resources/logback-test.xml index 772eeabeb6..28dd35fab6 100644 --- a/cxf-logging/src/test/resources/logback-test.xml +++ b/cxf-logging/src/test/resources/logback-test.xml @@ -65,6 +65,7 @@ <appender-ref ref="STDOUT" /> </logger> + <logger name="org.reflections" level="ERROR" /> <root level="WARN"> <appender-ref ref="STDOUT" /> diff --git a/graph-inventory/aai-client/src/test/resources/logback-test.xml b/graph-inventory/aai-client/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..bb4aee6e05 --- /dev/null +++ b/graph-inventory/aai-client/src/test/resources/logback-test.xml @@ -0,0 +1,36 @@ +<!-- + ============LICENSE_START======================================================= + ONAP - SO + ================================================================================ + Copyright (C) 2021 Nordix Foundation. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<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="org.reflections" level="ERROR" /> + <logger name="org.onap" level="DEBUG" /> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml index 5e6b88c039..23d31d0237 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/logback-test.xml @@ -1,41 +1,38 @@ <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> - <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender" /> - - - <logger name="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="ERROR" 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="com.att" level="${so.log.level:-DEBUG}" - additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - <root level="WARN"> - <appender-ref ref="STDOUT" /> - </root> - - <logger name="wiremock.org" level="ERROR" /> - + <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> + <appender name="test" class="org.onap.so.apihandlerinfra.TestAppender" /> + + + <logger name="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="ERROR" 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="com.att" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + <root level="WARN"> + <appender-ref ref="STDOUT" /> + </root> + + <logger name="wiremock.org" level="ERROR" /> + <logger name="org.reflections" level="ERROR" /> </configuration> diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml index 1951484752..868583dc03 100644 --- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml @@ -1,46 +1,46 @@ -<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"> +<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> + + <logger name="com.att.eelf.error" level="trace" 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" /> - </logger> - <root level="debug"> - <appender-ref ref="STDOUT" /> - </root> - - <!-- Spring related loggers --> - <logger name="org.springframework" level="WARN" /> - <logger name="org.springframework.beans" level="WARN" /> - <logger name="org.springframework.web" level="WARN" /> - <logger name="com.blog.spring.jms" level="WARN" /> - - <logger name="org.hibernate" level="WARN" /> - - - <!-- Tomcat related loggers --> - <logger name="org.apache.tomcat.util.digester.Digester" level="WARN" /> - <logger name="org.apache.tomcat.util.modeler.modules.*" level="WARN" /> - <logger name="org.apache.tomcat.util.IntrospectionUtils" level="WARN" /> - <logger name="org.apache.catalina.loader.WebappClassLoaderBase" level="WARN" /> - <logger name="wiremock.org.eclipse.jetty" level="WARN" /> + </logger> + + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + <root level="debug"> + <appender-ref ref="STDOUT" /> + </root> + + <logger name="org.reflections" level="ERROR" /> + <!-- Spring related loggers --> + <logger name="org.springframework" level="WARN" /> + <logger name="org.springframework.beans" level="WARN" /> + <logger name="org.springframework.web" level="WARN" /> + <logger name="com.blog.spring.jms" level="WARN" /> + + <logger name="org.hibernate" level="WARN" /> + + + <!-- Tomcat related loggers --> + <logger name="org.apache.tomcat.util.digester.Digester" level="WARN" /> + <logger name="org.apache.tomcat.util.modeler.modules.*" level="WARN" /> + <logger name="org.apache.tomcat.util.IntrospectionUtils" level="WARN" /> + <logger name="org.apache.catalina.loader.WebappClassLoaderBase" level="WARN" /> + <logger name="wiremock.org.eclipse.jetty" level="WARN" /> </configuration>
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml b/mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml index 1951484752..607cbe9da1 100644 --- a/mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml +++ b/mso-api-handlers/mso-requests-db/src/test/resources/logback-test.xml @@ -27,6 +27,8 @@ <appender-ref ref="STDOUT" /> </root> + <logger name="org.reflections" level="ERROR" /> + <!-- Spring related loggers --> <logger name="org.springframework" level="WARN" /> <logger name="org.springframework.beans" level="WARN" /> diff --git a/mso-catalog-db/src/test/resources/logback-test.xml b/mso-catalog-db/src/test/resources/logback-test.xml index 1407ad0080..88f5f9a9a7 100644 --- a/mso-catalog-db/src/test/resources/logback-test.xml +++ b/mso-catalog-db/src/test/resources/logback-test.xml @@ -18,33 +18,36 @@ ============LICENSE_END========================================================= --> -<configuration > +<configuration> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern> - </encoder> - </appender> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n + </pattern> + </encoder> + </appender> - <logger name="com.att.eelf.audit" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <logger name="com.att.eelf.audit" level="info" additivity="false"> <appender-ref ref="STDOUT" /> - </logger> + </logger> - <logger name="com.att.eelf.error" level="trace" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="org.onap" level="DEBUG" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - <root level="info"> - <appender-ref ref="STDOUT" /> - </root> - + <logger name="com.att.eelf.metrics" level="info" 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="DEBUG" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.reflections" level="ERROR" /> + + <root level="info"> + <appender-ref ref="STDOUT" /> + </root> </configuration> diff --git a/so-sdn-clients/src/test/resources/logback-test.xml b/so-sdn-clients/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..bb4aee6e05 --- /dev/null +++ b/so-sdn-clients/src/test/resources/logback-test.xml @@ -0,0 +1,36 @@ +<!-- + ============LICENSE_START======================================================= + ONAP - SO + ================================================================================ + Copyright (C) 2021 Nordix Foundation. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<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="org.reflections" level="ERROR" /> + <logger name="org.onap" level="DEBUG" /> + + <root level="INFO"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> diff --git a/so-simulator/src/test/resources/log4j.properties b/so-simulator/src/test/resources/log4j.properties index bbf07d9f49..b6e146aa24 100644 --- a/so-simulator/src/test/resources/log4j.properties +++ b/so-simulator/src/test/resources/log4j.properties @@ -5,8 +5,10 @@ log4j.rootLogger=INFO, out log4j.logger.com.consol.citrus=DEBUG log4j.logger.org.springframework=INFO +log4j.logger.org.reflections=ERROR # CONSOLE appender not used by default log4j.appender.out=org.apache.log4j.ConsoleAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout log4j.appender.out.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5.5p %20.20c{2}| %m%n + |