Consistently use the preferences name in the preferences code base 53/135753/4
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 16 Aug 2023 07:15:07 +0000 (07:15 +0000)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 16 Aug 2023 08:19:43 +0000 (08:19 +0000)
- rename package name from org.onap.portal.prefs to org.onap.portalng.preferences
- replace all other occurences of portal-prefs with preferences

Other:
- remove Sonarqube plugin

Issue-ID: PORTALNG-39
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Change-Id: Iced79a26460d988c5b22eb5fcac86d350528a1a2

25 files changed:
README.md
app/build.gradle
app/src/main/java/org/onap/portalng/preferences/PreferencesApplication.java [moved from app/src/main/java/org/onap/portal/prefs/PortalPrefsApplication.java with 77% similarity]
app/src/main/java/org/onap/portalng/preferences/configuration/BeansConfig.java [moved from app/src/main/java/org/onap/portal/prefs/configuration/BeansConfig.java with 94% similarity]
app/src/main/java/org/onap/portalng/preferences/configuration/LogInterceptor.java [moved from app/src/main/java/org/onap/portal/prefs/configuration/LogInterceptor.java with 95% similarity]
app/src/main/java/org/onap/portalng/preferences/configuration/PreferencesConfig.java [moved from app/src/main/java/org/onap/portal/prefs/configuration/PortalPrefsConfig.java with 87% similarity]
app/src/main/java/org/onap/portalng/preferences/configuration/SecurityConfig.java [moved from app/src/main/java/org/onap/portal/prefs/configuration/SecurityConfig.java with 97% similarity]
app/src/main/java/org/onap/portalng/preferences/controller/PreferencesController.java [moved from app/src/main/java/org/onap/portal/prefs/controller/PreferencesController.java with 85% similarity]
app/src/main/java/org/onap/portalng/preferences/entities/PreferencesDto.java [moved from app/src/main/java/org/onap/portal/prefs/entities/PreferencesDto.java with 95% similarity]
app/src/main/java/org/onap/portalng/preferences/exception/ProblemException.java [moved from app/src/main/java/org/onap/portal/prefs/exception/ProblemException.java with 94% similarity]
app/src/main/java/org/onap/portalng/preferences/repository/PreferencesRepository.java [moved from app/src/main/java/org/onap/portal/prefs/repository/PreferencesRepository.java with 88% similarity]
app/src/main/java/org/onap/portalng/preferences/services/PreferencesService.java [moved from app/src/main/java/org/onap/portal/prefs/services/PreferencesService.java with 85% similarity]
app/src/main/java/org/onap/portalng/preferences/util/IdTokenExchange.java [moved from app/src/main/java/org/onap/portal/prefs/util/IdTokenExchange.java with 98% similarity]
app/src/main/java/org/onap/portalng/preferences/util/Logger.java [moved from app/src/main/java/org/onap/portal/prefs/util/Logger.java with 76% similarity]
app/src/main/resources/application-local.yml
app/src/main/resources/application.yml
app/src/test/java/org/onap/portalng/preferences/BaseIntegrationTest.java [moved from app/src/test/java/org/onap/portal/prefs/BaseIntegrationTest.java with 95% similarity]
app/src/test/java/org/onap/portalng/preferences/TokenGenerator.java [moved from app/src/test/java/org/onap/portal/prefs/TokenGenerator.java with 98% similarity]
app/src/test/java/org/onap/portalng/preferences/actuator/ActuatorIntegrationTest.java [moved from app/src/test/java/org/onap/portal/prefs/actuator/ActuatorIntegrationTest.java with 93% similarity]
app/src/test/java/org/onap/portalng/preferences/preferences/PreferencesControllerIntegrationTest.java [moved from app/src/test/java/org/onap/portal/prefs/preferences/PreferencesControllerIntegrationTest.java with 96% similarity]
app/src/test/resources/application.yml
openapi/build.gradle
renovate.json [deleted file]
settings.gradle
version

index 15bc29d..c5d9c05 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Portal-prefs
+# Preferences
 This microservice manages the user specific config for the `portal-ui` frontend application. It is a Spring Boot application that is build upon a MongoDB and Webflux.
 
 ## Build
@@ -29,14 +29,14 @@ To start the service execute the `run.sh` in the development folder:
 development/run.sh
 ```
 
-Example request against the portal-prefs service can be run in your preferred IDE with the `request.http` file from the development folder.
+Example request against the preferences service can be run in your preferred IDE with the `request.http` file from the development folder.
 
 You can access the Keycloak UI via browser.  
 URL: http://localhost:8080  
 **username:** admin  
 **password:** password  
 
-To stop the portal-prefs service, Keycloak and the databases run:
+To stop the preferences service, Keycloak and the databases run:
 ```sh
 development/stop.sh
 ```
index 1d51c30..28e6384 100644 (file)
@@ -5,7 +5,6 @@ plugins {
        id 'io.spring.dependency-management'
        id 'org.springframework.boot'
        id 'jacoco'
-       id 'org.sonarqube'
        id 'com.gorylenko.gradle-git-properties'
 }
 
@@ -15,7 +14,7 @@ sourceCompatibility = '17'
 targetCompatibility = '17'
 
 application {
-    mainClass = 'org.onap.portal.prefs.PortalPrefsApplication'
+    mainClass = 'org.onap.portalng.preferences.PreferencesApplication'
 }
 
 configurations {
@@ -81,13 +80,6 @@ jacocoTestReport {
        }
 }
 
-sonarqube {
-       properties {
-               property "sonar.projectKey", "tnap.SONAR.portal.portal-prefs"
-               property "sonar.projectName", "portal-prefs"
-       }
-}
-
 configurations.implementation.setCanBeResolved(true)
 
 // avoid generating X.X.X-plain.jar
@@ -98,10 +90,10 @@ jar {
 springBoot {
        buildInfo {
                properties {
-                       artifact = "onap-portal-prefs"
+                       artifact = "onap-portal-ng-preferences"
                        version = rootProject.file('version').text.trim()
-                       group = "org.onap"
-                       name = "Portal user preferences service"
+                       group = "org.onap.portalng"
+                       name = "Portal-ng user preferences service"
                }
        }
 }
  *
  */
 
-package org.onap.portal.prefs;
+package org.onap.portalng.preferences;
 
-import org.onap.portal.prefs.configuration.PortalPrefsConfig;
+import org.onap.portalng.preferences.configuration.PreferencesConfig;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 
-@EnableConfigurationProperties(PortalPrefsConfig.class)
+@EnableConfigurationProperties(PreferencesConfig.class)
 @SpringBootApplication
-public class PortalPrefsApplication {
+public class PreferencesApplication {
 
        public static void main(String[] args) {
-               SpringApplication.run(PortalPrefsApplication.class, args);
+               SpringApplication.run(PreferencesApplication.class, args);
        }
 
 }
@@ -19,7 +19,7 @@
  *
  */
 
-package org.onap.portal.prefs.configuration;
+package org.onap.portalng.preferences.configuration;
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -19,9 +19,9 @@
  *
  */
 
-package org.onap.portal.prefs.configuration;
+package org.onap.portalng.preferences.configuration;
 
-import org.onap.portal.prefs.util.Logger;
+import org.onap.portalng.preferences.util.Logger;
 import org.springframework.stereotype.Component;
 import org.springframework.web.filter.reactive.ServerWebExchangeContextFilter;
 import org.springframework.web.server.ServerWebExchange;
@@ -19,7 +19,7 @@
  *
  */
 
-package org.onap.portal.prefs.configuration;
+package org.onap.portalng.preferences.configuration;
 
 import org.springframework.boot.context.properties.ConfigurationProperties;
 
@@ -27,8 +27,8 @@ import jakarta.validation.constraints.NotBlank;
 import lombok.Data;
 
 @Data
-@ConfigurationProperties("portal-prefs")
-public class PortalPrefsConfig {
+@ConfigurationProperties("preferences")
+public class PreferencesConfig {
 
     @NotBlank
     private final String realm;
@@ -19,7 +19,7 @@
  *
  */
 
-package org.onap.portal.prefs.configuration;
+package org.onap.portalng.preferences.configuration;
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
  *
  */
 
-package org.onap.portal.prefs.controller;
-import org.onap.portal.prefs.exception.ProblemException;
-import org.onap.portal.prefs.openapi.api.PreferencesApi;
-import org.onap.portal.prefs.openapi.model.Preferences;
-import org.onap.portal.prefs.services.PreferencesService;
-import org.onap.portal.prefs.util.IdTokenExchange;
-import org.onap.portal.prefs.util.Logger;
+package org.onap.portalng.preferences.controller;
+import org.onap.portalng.preferences.exception.ProblemException;
+import org.onap.portalng.preferences.openapi.api.PreferencesApi;
+import org.onap.portalng.preferences.openapi.model.Preferences;
+import org.onap.portalng.preferences.services.PreferencesService;
+import org.onap.portalng.preferences.util.IdTokenExchange;
+import org.onap.portalng.preferences.util.Logger;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.RestController;
@@ -51,7 +51,7 @@ public class PreferencesController implements PreferencesApi {
         preferencesService.getPreferences(userid)
           .map(ResponseEntity::ok))
           .onErrorResume(ProblemException.class, ex -> {
-              Logger.errorLog(xRequestId,"user preferences", null, "portal-prefs" );
+              Logger.errorLog(xRequestId,"user preferences", null, "preferences" );
               return Mono.error(ex);
           })
       .onErrorReturn(new ResponseEntity<>(HttpStatus.BAD_REQUEST));
@@ -70,7 +70,7 @@ public class PreferencesController implements PreferencesApi {
             .savePreferences(xRequestId, userid, pref)))
             .map( ResponseEntity::ok)
         .onErrorResume(ProblemException.class, ex -> {
-          Logger.errorLog(xRequestId,"user preferences", null, "portal-prefs" );
+          Logger.errorLog(xRequestId,"user preferences", null, "preferences" );
           return Mono.error(ex);
         })
     .onErrorReturn(new ResponseEntity<>(HttpStatus.BAD_REQUEST));
@@ -19,7 +19,7 @@
  *
  */
 
-package org.onap.portal.prefs.exception;
+package org.onap.portalng.preferences.exception;
 
 import lombok.AllArgsConstructor;
 import lombok.Builder;
@@ -33,7 +33,7 @@ import org.zalando.problem.StatusType;
 
 import java.net.URI;
 
-/** The default portal-prefs exception */
+/** The default preferences exception */
 @Data
 @Builder
 @AllArgsConstructor
@@ -19,9 +19,9 @@
  *
  */
 
-package org.onap.portal.prefs.repository;
+package org.onap.portalng.preferences.repository;
 
-import org.onap.portal.prefs.entities.PreferencesDto;
+import org.onap.portalng.preferences.entities.PreferencesDto;
 import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
 
 public interface PreferencesRepository extends ReactiveMongoRepository<PreferencesDto, String> {
  *
  */
 
-package org.onap.portal.prefs.services;
+package org.onap.portalng.preferences.services;
 
-import org.onap.portal.prefs.entities.PreferencesDto;
-import org.onap.portal.prefs.exception.ProblemException;
-import org.onap.portal.prefs.openapi.model.Preferences;
-import org.onap.portal.prefs.repository.PreferencesRepository;
-import org.onap.portal.prefs.util.Logger;
+import org.onap.portalng.preferences.entities.PreferencesDto;
+import org.onap.portalng.preferences.exception.ProblemException;
+import org.onap.portalng.preferences.openapi.model.Preferences;
+import org.onap.portalng.preferences.repository.PreferencesRepository;
+import org.onap.portalng.preferences.util.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -54,7 +54,7 @@ public class PreferencesService {
       .save(preferencesDto)
       .map(this::toPreferences)  
       .onErrorResume(ProblemException.class, ex -> {
-        Logger.errorLog(xRequestId,"user prefrences", userId, "portal-prefs" );
+        Logger.errorLog(xRequestId,"user prefrences", userId, "preferences" );
         return Mono.error(ex);
       });
 
@@ -19,7 +19,7 @@
  *
  */
 
-package org.onap.portal.prefs.util;
+package org.onap.portalng.preferences.util;
 
 import java.net.URI;
 
@@ -34,22 +34,22 @@ public class Logger {
   private Logger(){}
 
   public static void requestLog(String xRequestId, HttpMethod methode, URI path) {
-    log.info("Portal-prefs - request - X-Request-Id {} {} {}", xRequestId, methode, path);
+    log.info("Preferences - request - X-Request-Id {} {} {}", xRequestId, methode, path);
   }
 
   public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) {
-    log.info("Portal-prefs - response - X-Request-Id {} {}", xRequestId, httpStatusCode);
+    log.info("Preferences - response - X-Request-Id {} {}", xRequestId, httpStatusCode);
   }
 
   public static void errorLog(String xRequestId, String msg, String id, String app) {
     log.info(
-        "Portal-prefs - error - X-Request-Id {} {} {} not found in {}", xRequestId, msg, id, app);
+        "Preferences - error - X-Request-Id {} {} {} not found in {}", xRequestId, msg, id, app);
   }
 
   public static void errorLog(
       String xRequestId, String msg, String id, String app, String errorDetails) {
     log.info(
-        "Portal-prefs - error - X-Request-Id {} {} {} not found in {} error message: {}",
+        "Preferences - error - X-Request-Id {} {} {} not found in {} error message: {}",
         xRequestId,
         msg,
         id,
index 71fe8db..1ca695e 100644 (file)
@@ -14,13 +14,13 @@ spring:
           jwk-set-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/certs #Keycloak Endpoint
   data:
     mongodb:
-      database: portal_prefs
+      database: portal_preferences
       host: localhost
       port: 27017
       username: root
       password: password
 
-portal-prefs:
+preferences:
     realm: ONAP
 
 management:
index eb5b313..c7afccb 100644 (file)
@@ -14,15 +14,14 @@ spring:
           jwk-set-uri: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_REALM}/protocol/openid-connect/certs #Keycloak Endpoint
   data:
     mongodb:
-      database: ${PORTALPREFS_DATABASE}
-      host: ${PORTALPREFS_HOST}
-      port: ${PORTALPREFS_PORT}
-      username: ${PORTALPREFS_USERNAME}
-      password: ${PORTALPREFS_PASSWORD}
+      database: ${PREFERENCES_DATABASE}
+      host: ${PREFERENCES_HOST}
+      port: ${PREFERENCES_PORT}
+      username: ${PREFERENCES_USERNAME}
+      password: ${PREFERENCES_PASSWORD}
 
-portal-prefs:
+preferences:
     realm: ${KEYCLOAK_REALM}
-
 management:
   endpoints:
     web:
  *
  */
 
-package org.onap.portal.prefs;
+package org.onap.portalng.preferences;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.tomakehurst.wiremock.client.WireMock;
 import com.nimbusds.jose.jwk.JWKSet;
-import org.onap.portal.prefs.util.IdTokenExchange;
-import org.onap.portal.prefs.configuration.PortalPrefsConfig;
+import org.onap.portalng.preferences.util.IdTokenExchange;
+import org.onap.portalng.preferences.configuration.PreferencesConfig;
 import io.restassured.RestAssured;
 import io.restassured.filter.log.RequestLoggingFilter;
 import io.restassured.filter.log.ResponseLoggingFilter;
@@ -48,12 +48,12 @@ import java.util.UUID;
 public abstract class BaseIntegrationTest {
 
   @LocalServerPort protected int port;
-  @Value("${portal-prefs.realm}")
+  @Value("${preferences.realm}")
   protected String realm;
 
   @Autowired protected ObjectMapper objectMapper;
   @Autowired private TokenGenerator tokenGenerator;
-  @Autowired protected PortalPrefsConfig portalPrefsConfig;
+  @Autowired protected PreferencesConfig preferencesConfig;
 
   @BeforeAll
   public static void setup() {
  *
  */
 
-package org.onap.portal.prefs.actuator;
+package org.onap.portalng.preferences.actuator;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.onap.portal.prefs.BaseIntegrationTest;
+import org.onap.portalng.preferences.BaseIntegrationTest;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.availability.ApplicationAvailability;
  *
  */
 
-package org.onap.portal.prefs.preferences;
+package org.onap.portalng.preferences.preferences;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.junit.jupiter.api.Test;
-import org.onap.portal.prefs.BaseIntegrationTest;
-import org.onap.portal.prefs.openapi.model.Preferences;
-import org.onap.portal.prefs.services.PreferencesService;
+import org.onap.portalng.preferences.BaseIntegrationTest;
+import org.onap.portalng.preferences.openapi.model.Preferences;
+import org.onap.portalng.preferences.services.PreferencesService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
index bdfadf4..ace8c84 100644 (file)
@@ -19,7 +19,7 @@ spring:
         jwt:
           jwk-set-uri: http://localhost:${wiremock.server.port}/auth/realms/ONAP/protocol/openid-connect/certs #Keycloak Endpoint
 
-portal-prefs:
+preferences:
   realm: ONAP
 
 management:
index 7b7775a..fc5e1dc 100644 (file)
@@ -41,9 +41,9 @@ openApiGenerate {
     generateApiDocumentation = false
     generateModelTests = false
     generateModelDocumentation = false
-    invokerPackage = "org.onap.portal.prefs.openapi"
-    apiPackage = "org.onap.portal.prefs.openapi.api"
-    modelPackage = "org.onap.portal.prefs.openapi.model"
+    invokerPackage = "org.onap.portalng.preferences.openapi"
+    apiPackage = "org.onap.portalng.preferences.openapi.api"
+    modelPackage = "org.onap.portalng.preferences.openapi.model"
 }
 
 compileJava {
diff --git a/renovate.json b/renovate.json
deleted file mode 100644 (file)
index 39a2b6e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
-  "extends": [
-    "config:base"
-  ]
-}
index 1c146af..632c8ef 100644 (file)
@@ -2,9 +2,8 @@
 pluginManagement {
     // https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_version_management
     plugins {
-        id 'io.spring.dependency-management' version '1.0.13.RELEASE'
+        id 'io.spring.dependency-management' version '1.1.2'
         id 'org.springframework.boot' version '3.1.2'
-        id 'org.sonarqube' version '3.4.0.2513'
         id 'com.github.hierynomus.license' version '0.16.1'
         id 'com.gorylenko.gradle-git-properties' version '2.4.1'
         id 'org.openapi.generator' version '7.0.0-beta'
@@ -12,9 +11,7 @@ pluginManagement {
     // https://docs.gradle.org/current/userguide/plugins.html#sec:custom_plugin_repositories
     repositories {
         mavenCentral()
-        maven {
-            url "https://plugins.gradle.org/m2/"
-        }
+        gradlePluginPortal()
     }
 }
 
@@ -37,7 +34,7 @@ pluginManagement {
 //     }
 // }
 
-rootProject.name = 'portal-prefs'
+rootProject.name = 'preferences'
 
 include 'openapi'
 include 'app'
diff --git a/version b/version
index 6e8bf73..17e51c3 100644 (file)
--- a/version
+++ b/version
@@ -1 +1 @@
-0.1.0
+0.1.1