Create common logging and clients-base modules 86/141586/2
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Fri, 25 Jul 2025 09:53:37 +0000 (11:53 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Fri, 25 Jul 2025 11:44:40 +0000 (13:44 +0200)
- move logging related classes from common/common into a common/logging module
- move rest client related classes from common/common into a common/clients-base module

Issue-ID: SO-4209
Change-Id: I5bd601eecf5ec24b8f12e54d737ec07fb08e55b5
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
59 files changed:
adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java
asdc-controller/src/test/resources/application-test.yaml
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceConfiguration.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/VnfmAdapterCreateVnfTaskConfiguration.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/cnfm/tasks/CnfmHttpServiceConfigurationTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java
common/clients-base/pom.xml [new file with mode: 0644]
common/clients-base/src/main/java/org/onap/so/client/AddCacheHeaders.java [moved from common/common/src/main/java/org/onap/so/client/AddCacheHeaders.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/BaseClient.java [moved from common/common/src/main/java/org/onap/so/client/BaseClient.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/CacheFactory.java [moved from common/common/src/main/java/org/onap/so/client/CacheFactory.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/CacheProperties.java [moved from common/common/src/main/java/org/onap/so/client/CacheProperties.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/CommonObjectMapperProvider.java [moved from common/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java with 98% similarity]
common/clients-base/src/main/java/org/onap/so/client/DefaultProperties.java [moved from common/common/src/main/java/org/onap/so/client/DefaultProperties.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/HttpClient.java [moved from common/common/src/main/java/org/onap/so/client/HttpClient.java with 96% similarity]
common/clients-base/src/main/java/org/onap/so/client/HttpClientFactory.java [moved from common/common/src/main/java/org/onap/so/client/HttpClientFactory.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/KeyStoreLoader.java [moved from common/common/src/main/java/org/onap/so/client/KeyStoreLoader.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/PreconditionFailedException.java [moved from common/common/src/main/java/org/onap/so/client/PreconditionFailedException.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/ResponseExceptionMapper.java [moved from common/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java [moved from common/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/RestClient.java [moved from common/common/src/main/java/org/onap/so/client/RestClient.java with 99% similarity]
common/clients-base/src/main/java/org/onap/so/client/RestClientSSL.java [moved from common/common/src/main/java/org/onap/so/client/RestClientSSL.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/RestProperties.java [moved from common/common/src/main/java/org/onap/so/client/RestProperties.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/RestPropertiesLoader.java [moved from common/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/RestRequest.java [moved from common/common/src/main/java/org/onap/so/client/RestRequest.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/client/RestTemplateConfig.java [moved from common/common/src/main/java/org/onap/so/client/RestTemplateConfig.java with 97% similarity]
common/clients-base/src/main/java/org/onap/so/configuration/BasicHttpHeadersProvider.java [moved from common/common/src/main/java/org/onap/so/configuration/rest/BasicHttpHeadersProvider.java with 97% similarity]
common/clients-base/src/main/java/org/onap/so/configuration/HttpClientConnectionConfiguration.java [moved from common/common/src/main/java/org/onap/so/configuration/rest/HttpClientConnectionConfiguration.java with 98% similarity]
common/clients-base/src/main/java/org/onap/so/configuration/HttpComponentsClientConfiguration.java [moved from common/common/src/main/java/org/onap/so/configuration/rest/HttpComponentsClientConfiguration.java with 98% similarity]
common/clients-base/src/main/java/org/onap/so/configuration/HttpHeadersProvider.java [moved from common/common/src/main/java/org/onap/so/configuration/rest/HttpHeadersProvider.java with 96% similarity]
common/clients-base/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java [moved from common/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java [moved from common/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java [moved from common/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java with 100% similarity]
common/clients-base/src/main/java/org/onap/so/utils/CryptoUtils.java [new file with mode: 0644]
common/clients-base/src/test/java/org/onap/so/client/AddCacheHeadersTest.java [new file with mode: 0644]
common/clients-base/src/test/java/org/onap/so/configuration/BasicHttpHeadersProviderTest.java [moved from common/common/src/test/java/org/onap/so/configuration/rest/BasicHttpHeadersProviderTest.java with 90% similarity]
common/clients-base/src/test/java/org/onap/so/configuration/HttpComponentsClientConfigurationTest.java [moved from common/common/src/test/java/org/onap/so/configuration/rest/HttpComponentsClientConfigurationTest.java with 97% similarity]
common/clients-base/src/test/java/org/onap/so/logging/MaskLogStatementsTest.java [moved from common/common/src/test/java/org/onap/so/logging/MaskLogStatementsTest.java with 100% similarity]
common/common/pom.xml
common/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
common/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java
common/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
common/common/src/main/java/org/onap/so/utils/CryptoUtils.java
common/common/src/main/java/org/onap/so/utils/UUIDChecker.java
common/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
common/logger/pom.xml [new file with mode: 0644]
common/logger/src/main/java/org/onap/so/logger/HttpHeadersConstants.java [moved from common/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java with 99% similarity]
common/logger/src/main/java/org/onap/so/logger/LogConstants.java [moved from common/common/src/main/java/org/onap/so/logger/LogConstants.java with 99% similarity]
common/logger/src/main/java/org/onap/so/logger/LoggerStartupListener.java [moved from common/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java with 100% similarity]
common/logger/src/main/java/org/onap/so/logger/LoggingAnchor.java [moved from common/common/src/main/java/org/onap/so/logger/LoggingAnchor.java with 100% similarity]
common/logger/src/main/java/org/onap/so/logger/MaskLogStatements.java [moved from common/common/src/main/java/org/onap/so/logger/MaskLogStatements.java with 85% similarity]
common/logger/src/main/java/org/onap/so/logger/MdcConstants.java [moved from common/common/src/main/java/org/onap/so/logger/MdcConstants.java with 99% similarity]
common/logger/src/main/java/org/onap/so/logger/MessageEnum.java [moved from common/common/src/main/java/org/onap/so/logger/MessageEnum.java with 99% similarity]
common/logger/src/test/java/org/onap/so/logger/LoggerStartupListenerTest.java [new file with mode: 0644]
common/logger/src/test/java/org/onap/so/logger/MaskLogStatementsTest.java [new file with mode: 0644]
common/pom.xml
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryCommonObjectMapperProvider.java
graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryRestClient.java

index 38f7a0c..a547501 100644 (file)
@@ -29,7 +29,7 @@ import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.ssl.SSLContextBuilder;
 import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.configuration.HttpHeadersProvider;
 import org.onap.so.rest.service.HttpRestServiceProvider;
 import org.onap.so.rest.service.HttpRestServiceProviderImpl;
 import org.slf4j.Logger;
index 838a67d..3f956b5 100644 (file)
@@ -21,7 +21,7 @@
 package org.onap.so.adapters.vevnfm.provider;
 
 import org.apache.logging.log4j.util.Strings;
-import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.BasicHttpHeadersProvider;
 
 public class AuthorizationHeadersProvider extends BasicHttpHeadersProvider {
 
index 1a2e385..4dd2123 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -33,7 +33,7 @@ import org.springframework.context.annotation.Profile;
 @Profile("test")
 @ComponentScan(
         basePackages = {"org.onap.so.asdc", "org.onap.so.security", "org.onap.so.rest.service",
-                "org.onap.so.configuration.rest", "org.onap.so.client"},
+                "org.onap.so.configuration", "org.onap.so.client"},
         excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
                 @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
                 @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class)})
index e1fbe1c..21d5fdf 100644 (file)
@@ -10,9 +10,9 @@ spring:
     jdbc-url: jdbc:mariadb://localhost:3307/catalogdb
     username: root
     password: password
-    driver-class-name: org.mariadb.jdbc.Driver    
+    driver-class-name: org.mariadb.jdbc.Driver
     initialization-mode: always
-  jpa:   
+  jpa:
     generate-ddl: false
     show-sql: true
     hibernate:
@@ -22,17 +22,19 @@ spring:
     database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
   security:
     usercredentials:
-    -  
+    -
       username: test
       password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
-      role: Asdc-Client        
+      role: Asdc-Client
+  sleuth:
+    enabled: false
 
 mariaDB4j:
-  dataDir: 
+  dataDir:
   port: 3307
   databaseName: catalogdb
   databaseName2: requestdb
-        
+
 request:
   datasource:
     jdbc-url: jdbc:mariadb://localhost:3307/requestdb
@@ -54,19 +56,19 @@ management:
     export:
       prometheus:
         enabled: true # Whether exporting of metrics to Prometheus is enabled.
-        step: 1m # Step size (i.e. reporting frequency) to use.  
+        step: 1m # Step size (i.e. reporting frequency) to use.
 
 mso:
   adapters:
     requestDb:
       auth: Basic YnBlbDptc28tZGItMTUwNyE=
-      endpoint: http://localhost:8081  
+      endpoint: http://localhost:8081
   logPath: logs
   catalog:
     db:
       spring:
         endpoint: "http://localhost:"
-  camundaURL: http://localhost:${wiremock.server.port}/        
+  camundaURL: http://localhost:${wiremock.server.port}/
   db:
     auth: Basic YnBlbDptc28tZGItMTUwNyE=
   site-name: siteName
@@ -82,7 +84,7 @@ mso:
       pollingTimeout: 30
       relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
       activateServerTLSAuth: false
-      keyStorePassword:  
+      keyStorePassword:
       keyStorePath:
       watchDogTimeout: 1
       isFilterInEmptyResources: true
@@ -103,4 +105,3 @@ mso:
 
 sdc:
   endpoint: http://localhost:${wiremock.server.port}
-  
\ No newline at end of file
index 1028c28..4466bb2 100644 (file)
@@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.adapter.cnfm.tasks;
 
 import javax.ws.rs.core.MediaType;
 import org.onap.logging.filter.spring.SpringClientPayloadFilter;
-import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
+import org.onap.so.configuration.HttpComponentsClientConfiguration;
 import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
 import org.onap.so.rest.service.HttpRestServiceProvider;
 import org.onap.so.rest.service.HttpRestServiceProviderImpl;
index fc3d6ab..1210a75 100644 (file)
@@ -33,8 +33,8 @@ import org.apache.http.client.HttpClient;
 import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.ssl.SSLContextBuilder;
-import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.configuration.BasicHttpHeadersProvider;
+import org.onap.so.configuration.HttpHeadersProvider;
 import org.onap.so.rest.service.HttpRestServiceProvider;
 import org.onap.so.rest.service.HttpRestServiceProviderImpl;
 import org.slf4j.Logger;
@@ -52,7 +52,7 @@ import org.springframework.web.client.RestTemplate;
 /**
  * Provides {@link org.onap.so.rest.service.VnfmAdapterServiceProvider} configuration for
  * {@link VnfmAdapterCreateVnfTask}
- * 
+ *
  * @author waqas.ikram@est.tech
  */
 @Configuration
index 4832597..e21f233 100644 (file)
@@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
+import org.onap.so.configuration.HttpComponentsClientConfiguration;
 import org.onap.so.rest.service.HttpRestServiceProvider;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 
index 2ff0d1d..541dc9e 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -23,6 +23,7 @@ package org.onap.so.client.policy;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import org.junit.Test;
+import org.onap.so.client.CommonObjectMapperProvider;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.MapperFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/common/clients-base/pom.xml b/common/clients-base/pom.xml
new file mode 100644 (file)
index 0000000..44be628
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" ?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.onap.so</groupId>
+    <artifactId>common</artifactId>
+    <version>1.16.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>clients-base</artifactId>
+  <properties>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>org.onap.so</groupId>
+      <artifactId>logger</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.cache</groupId>
+      <artifactId>cache-api</artifactId>
+      <version>1.1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.javatuples</groupId>
+      <artifactId>javatuples</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
+      <groupId>net.jodah</groupId>
+      <artifactId>failsafe</artifactId>
+      <version>2.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-junit-jupiter</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.projectlombok</groupId>
+      <artifactId>lombok</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>3.1.2</version>
+          <configuration>
+            <systemPropertyVariables>
+              <so.log.level>DEBUG</so.log.level>
+            </systemPropertyVariables>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
@@ -20,7 +20,6 @@
 
 package org.onap.so.client;
 
-import static org.apache.commons.lang3.StringUtils.isNotBlank;
 import java.net.URL;
 import java.util.Optional;
 import javax.ws.rs.core.MultivaluedMap;
@@ -59,7 +58,7 @@ public class HttpClient extends RestClient {
 
     /**
      * Adds a basic authentication header to the request.
-     * 
+     *
      * @param auth the encrypted credentials
      * @param key the key for decrypting the credentials
      */
@@ -74,7 +73,7 @@ public class HttpClient extends RestClient {
 
     /**
      * Adds an additional header to the header map
-     * 
+     *
      * @param encoded basic auth value
      */
     public void addAdditionalHeader(String name, String value) {
@@ -101,4 +100,8 @@ public class HttpClient extends RestClient {
         }
     }
 
+    private static boolean isNotBlank(String str) {
+        return str != null && !str.trim().isEmpty();
+    }
+
 }
@@ -49,7 +49,6 @@ import org.javatuples.Pair;
 import org.onap.logging.filter.base.MDCSetup;
 import org.onap.logging.filter.base.ONAPComponentsList;
 import org.onap.logging.filter.base.PayloadLoggingClientFilter;
-import org.onap.so.client.policy.CommonObjectMapperProvider;
 import org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter;
 import org.onap.so.utils.CryptoUtils;
 import org.slf4j.Logger;
@@ -170,7 +169,7 @@ public abstract class RestClient {
 
     /**
      * Adds a basic authentication header to the request.
-     * 
+     *
      * @param auth the encrypted credentials
      * @param key the key for decrypting the credentials
      */
@@ -21,7 +21,7 @@
 package org.onap.so.client;
 
 import org.onap.logging.filter.spring.SpringClientPayloadFilter;
-import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
+import org.onap.so.configuration.HttpComponentsClientConfiguration;
 import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.so.configuration.rest;
+package org.onap.so.configuration;
 
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.so.configuration.rest;
+package org.onap.so.configuration;
 
 import java.util.concurrent.TimeUnit;
 import org.springframework.beans.factory.annotation.Value;
@@ -26,7 +26,7 @@ import org.springframework.stereotype.Service;
 
 /**
  * This class is used configure the parameters needed for {@link org.apache.http.impl.client.CloseableHttpClient}
- * 
+ *
  * @author waqas.ikram@est.tech
  */
 @Service
@@ -5,20 +5,20 @@
  * 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.configuration.rest;
+package org.onap.so.configuration;
 
 import java.util.concurrent.TimeUnit;
 import org.apache.http.client.config.RequestConfig;
@@ -33,7 +33,7 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 
 /**
  * Allow user to configure {@link org.apache.http.client.HttpClient}
- * 
+ *
  * @author waqas.ikram@est.tech
  */
 @Configuration
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.so.configuration.rest;
+package org.onap.so.configuration;
 
 import org.springframework.http.HttpHeaders;
 
 /**
  * Providers {@link org.springframework.http.HttpHeaders} for HTTP requests
- * 
+ *
  * @author waqas.ikram@est.tech
  *
  */
diff --git a/common/clients-base/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/clients-base/src/main/java/org/onap/so/utils/CryptoUtils.java
new file mode 100644 (file)
index 0000000..e7bfe43
--- /dev/null
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.utils;
+
+
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.crypto.Cipher;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.GeneralSecurityException;
+import java.security.SecureRandom;
+import java.util.Arrays;
+
+
+/**
+ * CryptoUtils adapted from RTTP client.
+ *
+ */
+public final class CryptoUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(CryptoUtils.class);
+
+
+    private static final String AES = "AES";
+    private static final String CLOUD_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
+    private static final int GCM_TAG_LENGTH = 16;
+    private static final int GCM_IV_LENGTH = 12;
+    private static final String AES_GCM_NO_PADDING = "AES/GCM/NoPadding";
+
+    /**
+     * encrypt a value and generate a keyfile if the keyfile is not found then a new one is created
+     *
+     * @throws GeneralSecurityException
+     */
+    public static String encrypt(String value, String keyString) throws GeneralSecurityException {
+        SecretKeySpec sks = getSecretKeySpec(keyString);
+        Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
+        byte[] initVector = new byte[GCM_IV_LENGTH];
+        (new SecureRandom()).nextBytes(initVector);
+        GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * java.lang.Byte.SIZE, initVector);
+        cipher.init(Cipher.ENCRYPT_MODE, sks, spec);
+        byte[] encoded = value.getBytes(java.nio.charset.StandardCharsets.UTF_8);
+        byte[] cipherText = new byte[initVector.length + cipher.getOutputSize(encoded.length)];
+        System.arraycopy(initVector, 0, cipherText, 0, initVector.length);
+        cipher.doFinal(encoded, 0, encoded.length, cipherText, initVector.length);
+        return byteArrayToHexString(cipherText);
+    }
+
+    /**
+     * decrypt a value
+     *
+     * @throws GeneralSecurityException
+     */
+    public static String decrypt(String message, String keyString) throws GeneralSecurityException {
+        if (message.equals(System.getenv("PLAINTEXTPASSWORD")))
+            return message;
+        SecretKeySpec sks = getSecretKeySpec(keyString);
+        byte[] cipherText = hexStringToByteArray(message);
+        Cipher cipher = Cipher.getInstance(AES_GCM_NO_PADDING);
+        byte[] initVector = Arrays.copyOfRange(cipherText, 0, GCM_IV_LENGTH);
+        GCMParameterSpec spec = new GCMParameterSpec(GCM_TAG_LENGTH * java.lang.Byte.SIZE, initVector);
+        cipher.init(Cipher.DECRYPT_MODE, sks, spec);
+        byte[] plaintext = cipher.doFinal(cipherText, GCM_IV_LENGTH, cipherText.length - GCM_IV_LENGTH);
+        return new String(plaintext);
+    }
+
+    public static String encryptCloudConfigPassword(String message) {
+        try {
+            return CryptoUtils.encrypt(message, CLOUD_KEY);
+        } catch (GeneralSecurityException e) {
+            logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+                    ErrorCode.BusinessProcessError.getValue(), "Exception in encryptPassword ", e);
+            return null;
+        }
+    }
+
+    public static String decryptCloudConfigPassword(String message) {
+        try {
+            return CryptoUtils.decrypt(message, CLOUD_KEY);
+        } catch (GeneralSecurityException e) {
+            logger.error(LoggingAnchor.THREE, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
+                    ErrorCode.BusinessProcessError.getValue(), "Exception in encryptPassword ", e);
+            return null;
+        }
+    }
+
+    private static SecretKeySpec getSecretKeySpec(String keyString) {
+        byte[] key = hexStringToByteArray(keyString);
+        return new SecretKeySpec(key, AES);
+    }
+
+    public static String byteArrayToHexString(byte[] b) {
+        StringBuilder sb = new StringBuilder(b.length * 2);
+        for (byte aB : b) {
+            int v = aB & 0xff;
+            if (v < 16) {
+                sb.append('0');
+            }
+            sb.append(Integer.toHexString(v));
+        }
+        return sb.toString().toUpperCase();
+    }
+
+    private static byte[] hexStringToByteArray(String s) {
+        byte[] b = new byte[s.length() / 2];
+        for (int i = 0; i < b.length; i++) {
+            int index = i * 2;
+            int v = Integer.parseInt(s.substring(index, index + 2), 16);
+            b[i] = (byte) v;
+        }
+        return b;
+    }
+}
diff --git a/common/clients-base/src/test/java/org/onap/so/client/AddCacheHeadersTest.java b/common/clients-base/src/test/java/org/onap/so/client/AddCacheHeadersTest.java
new file mode 100644 (file)
index 0000000..ee7ae61
--- /dev/null
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright © 2025 Deutsche Telekom AG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.mockito.Mockito.when;
+import java.util.Collections;
+import java.util.List;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.core.MultivaluedHashMap;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import lombok.SneakyThrows;
+
+@ExtendWith(MockitoExtension.class)
+public class AddCacheHeadersTest {
+
+    @Mock
+    ClientRequestContext request;
+
+    @Mock
+    ClientResponseContext response;
+
+    private final AddCacheHeaders addCacheHeaders = new AddCacheHeaders(new CachePropertiesImpl());
+
+    @Test
+    @SneakyThrows
+    public void thatCacheHeaderIsAddedForGet() {
+        MultivaluedHashMap<String, String> headers = new MultivaluedHashMap<>();
+        when(request.getMethod()).thenReturn("GET");
+        when(response.getHeaders()).thenReturn(headers);
+
+        addCacheHeaders.filter(request, response);
+        assertTrue(headers.containsKey("Cache-Control"));
+        assertEquals(Collections.singletonList("public, max-age=" + (new CachePropertiesImpl().getMaxAge() / 1000)),
+                headers.get("Cache-Control"));
+    }
+
+    @Test
+    @SneakyThrows
+    public void thatCacheHeaderIsNotOverwrittenForGet() {
+        MultivaluedHashMap<String, String> headers = new MultivaluedHashMap<>();
+        List<String> expected = Collections.singletonList("foo");
+        headers.put("Cache-Control", expected);
+        when(request.getMethod()).thenReturn("GET");
+        when(response.getHeaders()).thenReturn(headers);
+
+        addCacheHeaders.filter(request, response);
+        assertTrue(headers.containsKey("Cache-Control"));
+        assertEquals(expected, headers.get("Cache-Control"));
+    }
+
+    @Test
+    @SneakyThrows
+    public void thatCacheHeaderIsNotAddedForOtherMethods() {
+        MultivaluedHashMap<String, String> headers = new MultivaluedHashMap<>();
+        when(request.getMethod()).thenReturn("PUT");
+
+        addCacheHeaders.filter(request, response);
+        assertFalse(headers.containsKey("Cache-Control"));
+    }
+
+    class CachePropertiesImpl implements CacheProperties {
+
+        @Override
+        public String getCacheName() {
+            return "test-cache";
+        }
+
+        @Override
+        public Long getMaxAge() {
+            return 5 * 60 * 1000L;
+        }
+
+    }
+}
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.so.configuration.rest;
+package org.onap.so.configuration;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
+import static org.onap.so.configuration.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
 import java.util.Arrays;
 import org.junit.Test;
+import org.onap.so.configuration.BasicHttpHeadersProvider;
+import org.onap.so.configuration.HttpHeadersProvider;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 
index f38fcc8..718bfae 100644 (file)
     <logback.version>1.2.13</logback.version>
   </properties>
   <dependencies>
+    <dependency>
+      <groupId>org.onap.so</groupId>
+      <artifactId>logger</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.onap.so</groupId>
+      <artifactId>clients-base</artifactId>
+      <version>${project.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
       <groupId>org.springframework.retry</groupId>
       <artifactId>spring-retry</artifactId>
     </dependency>
-    <dependency>
-      <groupId>net.jodah</groupId>
-      <artifactId>failsafe</artifactId>
-      <version>2.0.1</version>
-    </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
       <version>${grpc.version}</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.javatuples</groupId>
-      <artifactId>javatuples</artifactId>
-      <version>1.2</version>
-    </dependency>
     <dependency>
       <groupId>org.camunda.bpm</groupId>
       <artifactId>camunda-external-task-client</artifactId>
       <artifactId>jaxb-impl</artifactId>
       <version>2.3.0</version>
     </dependency>
-    <dependency>
-      <groupId>javax.cache</groupId>
-      <artifactId>cache-api</artifactId>
-      <version>1.1.0</version>
-    </dependency>
     <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-starter-sleuth</artifactId>
index 3bac3dc..1d2d892 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -27,8 +27,8 @@ import javax.ws.rs.core.MultivaluedMap;
 import org.apache.commons.codec.binary.Base64;
 import org.javatuples.Pair;
 import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.client.CommonObjectMapperProvider;
 import org.onap.so.client.RestClient;
-import org.onap.so.client.policy.CommonObjectMapperProvider;
 import org.onap.so.client.policy.JettisonStyleMapperProvider;
 import org.onap.so.utils.CryptoUtils;
 
index 34b1213..0eed8b1 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -20,6 +20,7 @@
 
 package org.onap.so.client.policy;
 
+import org.onap.so.client.CommonObjectMapperProvider;
 import org.springframework.stereotype.Component;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.databind.DeserializationFeature;
index 04dd0bb..489db5b 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.onap.so.rest.service;
 
-import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.configuration.HttpHeadersProvider;
 import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
 import org.onap.so.rest.exceptions.InvalidRestRequestException;
 import org.onap.so.rest.exceptions.RestProcessingException;
@@ -58,7 +58,7 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
     }
 
     /**
-     * 
+     *
      * @deprecated this constructor is deprecated in favor of using {@link HttpRestServiceProviderImpl(RestTemplate
      *             restTemplate, HttpHeaders defaultHttpHeaders)}
      */
index eecee4c..e7bfe43 100644 (file)
@@ -9,9 +9,9 @@
  * 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.
@@ -23,8 +23,8 @@
 package org.onap.so.utils;
 
 
-import org.onap.so.logger.LoggingAnchor;
 import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
 import org.onap.so.logger.MessageEnum;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -38,7 +38,7 @@ import java.util.Arrays;
 
 /**
  * CryptoUtils adapted from RTTP client.
- * 
+ *
  */
 public final class CryptoUtils {
 
@@ -53,7 +53,7 @@ public final class CryptoUtils {
 
     /**
      * encrypt a value and generate a keyfile if the keyfile is not found then a new one is created
-     * 
+     *
      * @throws GeneralSecurityException
      */
     public static String encrypt(String value, String keyString) throws GeneralSecurityException {
@@ -72,7 +72,7 @@ public final class CryptoUtils {
 
     /**
      * decrypt a value
-     * 
+     *
      * @throws GeneralSecurityException
      */
     public static String decrypt(String message, String keyString) throws GeneralSecurityException {
index 30fc92b..b2b76b5 100644 (file)
@@ -10,9 +10,9 @@
  * 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.
index 3ae644b..79fdbf9 100644 (file)
@@ -9,9 +9,9 @@
  * 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.
@@ -32,10 +32,10 @@ import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.sax.SAXSource;
-import org.onap.so.logger.LoggingAnchor;
 import org.onap.so.exceptions.MarshallerException;
-import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
 import org.onap.so.logger.MessageEnum;
+import org.onap.logging.filter.base.ErrorCode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.InputSource;
diff --git a/common/logger/pom.xml b/common/logger/pom.xml
new file mode 100644 (file)
index 0000000..8c20344
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" ?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.onap.so</groupId>
+    <artifactId>common</artifactId>
+    <version>1.16.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>logger</artifactId>
+  <properties>
+  </properties>
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-junit-jupiter</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.projectlombok</groupId>
+      <artifactId>lombok</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+      </plugin>
+    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>3.1.2</version>
+          <configuration>
+            <systemPropertyVariables>
+              <so.log.level>DEBUG</so.log.level>
+            </systemPropertyVariables>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.jacoco</groupId>
+          <artifactId>jacoco-maven-plugin</artifactId>
+          <configuration>
+            <excludes>
+              <!-- ideally these would just be grouped under a .entities package
+                   but that would change the imports everywhere these are used -->
+              <exclude>org/onap/so/logger/HttpHeadersConstants</exclude>
+              <exclude>org/onap/so/logger/LogConstants</exclude>
+              <exclude>org/onap/so/logger/LoggingAnchor</exclude>
+              <exclude>org/onap/so/logger/MdcConstants</exclude>
+              <exclude>org/onap/so/logger/MessageEnum</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
@@ -7,9 +7,9 @@
  * 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.
@@ -7,9 +7,9 @@
  * 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.
@@ -15,8 +15,8 @@ public class MaskLogStatements extends PatternLayout {
     private String patternsProperty;
     private String maskChar = "*";
     private Optional<Pattern> pattern = Optional.empty();
-    private static final Pattern authPattern =
-            Pattern.compile("Authorization(?:\\:|=)\\s?(?:\"|\\[)(?:Basic|Bearer) (.*?)(?:\"|\\])");
+    private static final String authPatternString = "Authorization[: ]+(?:Bearer|Basic)\\s(\\S+)";
+    private static final Pattern authPattern = Pattern.compile(authPatternString);
     private static final Pattern openstackPattern = Pattern.compile("\"password\"\\s?:\\s?\"(.*?)\"");
 
     public String getPatternsProperty() {
@@ -46,7 +46,8 @@ public class MaskLogStatements extends PatternLayout {
     @Override
     public String doLayout(ILoggingEvent event) {
 
-        final StringBuilder message = new StringBuilder(super.doLayout(event));
+        // final StringBuilder message = new StringBuilder(super.doLayout(event));
+        final StringBuilder message = new StringBuilder(event.getFormattedMessage());
         List<Pattern> patterns = new ArrayList<>(getPatterns());
         if (pattern.isPresent()) {
             patterns.add(pattern.get());
@@ -7,9 +7,9 @@
  * 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.
@@ -7,9 +7,9 @@
  * 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.
diff --git a/common/logger/src/test/java/org/onap/so/logger/LoggerStartupListenerTest.java b/common/logger/src/test/java/org/onap/so/logger/LoggerStartupListenerTest.java
new file mode 100644 (file)
index 0000000..8d079da
--- /dev/null
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright © 2025 Deutsche Telekom AG Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.logger;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
+import java.net.UnknownHostException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import ch.qos.logback.core.Context;
+
+@ExtendWith(MockitoExtension.class)
+public class LoggerStartupListenerTest {
+
+    private LoggerStartupListener loggerStartupListener;
+
+    @Mock
+    private Context context;
+
+    @BeforeEach
+    public void setUp() {
+        loggerStartupListener = new LoggerStartupListener();
+        loggerStartupListener.setContext(context);
+    }
+
+    @Test
+    public void thatServerNameIsSetOnStartup() throws UnknownHostException {
+        loggerStartupListener.start();
+
+        verify(context).putProperty(eq("server.name"), anyString());
+        assertTrue(loggerStartupListener.isStarted());
+    }
+}
diff --git a/common/logger/src/test/java/org/onap/so/logger/MaskLogStatementsTest.java b/common/logger/src/test/java/org/onap/so/logger/MaskLogStatementsTest.java
new file mode 100644 (file)
index 0000000..a203252
--- /dev/null
@@ -0,0 +1,31 @@
+package org.onap.so.logger;
+
+import static org.junit.jupiter.api.Assertions.*;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
+import ch.qos.logback.classic.spi.LoggingEvent;
+
+@ExtendWith(MockitoExtension.class)
+public class MaskLogStatementsTest {
+
+    private MaskLogStatements maskLogStatements;
+
+    @BeforeEach
+    public void setUp() {
+        maskLogStatements = new MaskLogStatements();
+    }
+
+    @Test
+    public void testDoLayoutShouldMaskAuthorizationToken() {
+        String logMessage = "Authorization: Bearer mySecretToken123";
+
+        LoggingEvent loggingEvent = new LoggingEvent();
+        loggingEvent.setMessage(logMessage);
+
+        String maskedMessage = maskLogStatements.doLayout(loggingEvent);
+
+        assertEquals("Authorization: Bearer ****************", maskedMessage);
+    }
+}
index 871c952..7ee498c 100644 (file)
@@ -9,6 +9,8 @@
   <artifactId>common</artifactId>
   <packaging>pom</packaging>
   <modules>
+    <module>logger</module>
+    <module>clients-base</module>
     <module>common</module>
   </modules>
 </project>
index a780d79..d81847c 100644 (file)
@@ -20,7 +20,7 @@
 
 package org.onap.aaiclient.client.graphinventory;
 
-import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.client.CommonObjectMapperProvider;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.databind.AnnotationIntrospector;
index d02274c..2c1d6bc 100644 (file)
@@ -34,7 +34,8 @@ import org.onap.so.client.CacheFactory;
 import org.onap.so.client.ResponseExceptionMapper;
 import org.onap.so.client.RestClientSSL;
 import org.onap.so.client.RestProperties;
-import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.client.CommonObjectMapperProvider;
+import org.onap.so.objects.audit.AAIObjectAudit;
 
 public abstract class GraphInventoryRestClient extends RestClientSSL {