aboutsummaryrefslogtreecommitdiffstats
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/org/onap/portal/history/HistoryApplication.java (renamed from app/src/main/java/org/onap/portal/history/PortalHistoryApplication.java)8
-rw-r--r--app/src/main/java/org/onap/portal/history/configuration/HistoryConfig.java (renamed from app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java)4
-rw-r--r--app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java11
-rw-r--r--app/src/main/java/org/onap/portal/history/controller/ActionsController.java14
-rw-r--r--app/src/main/java/org/onap/portal/history/util/Logger.java6
-rw-r--r--app/src/main/resources/application-local.yml8
-rw-r--r--app/src/main/resources/application.yml18
-rw-r--r--app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java4
-rw-r--r--app/src/test/java/org/onap/portal/history/actions/ActionsControllerIntegrationTest.java2
-rw-r--r--app/src/test/resources/application.yml3
10 files changed, 39 insertions, 39 deletions
diff --git a/app/src/main/java/org/onap/portal/history/PortalHistoryApplication.java b/app/src/main/java/org/onap/portal/history/HistoryApplication.java
index 0e712f2..21c3c4b 100644
--- a/app/src/main/java/org/onap/portal/history/PortalHistoryApplication.java
+++ b/app/src/main/java/org/onap/portal/history/HistoryApplication.java
@@ -25,15 +25,15 @@
package org.onap.portal.history;
-import org.onap.portal.history.configuration.PortalHistoryConfig;
+import org.onap.portal.history.configuration.HistoryConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
-@EnableConfigurationProperties(PortalHistoryConfig.class)
+@EnableConfigurationProperties(HistoryConfig.class)
@SpringBootApplication
-public class PortalHistoryApplication {
+public class HistoryApplication {
public static void main(String[] args) {
- SpringApplication.run(PortalHistoryApplication.class, args);
+ SpringApplication.run(HistoryApplication.class, args);
}
}
diff --git a/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java b/app/src/main/java/org/onap/portal/history/configuration/HistoryConfig.java
index 9a42214..f70a9d4 100644
--- a/app/src/main/java/org/onap/portal/history/configuration/PortalHistoryConfig.java
+++ b/app/src/main/java/org/onap/portal/history/configuration/HistoryConfig.java
@@ -27,8 +27,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import jakarta.validation.constraints.NotBlank;
@Data
-@ConfigurationProperties("portal-history")
-public class PortalHistoryConfig {
+@ConfigurationProperties("history")
+public class HistoryConfig {
@NotBlank
private final Integer saveInterval;
diff --git a/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java b/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java
index 2295a5f..88531af 100644
--- a/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java
+++ b/app/src/main/java/org/onap/portal/history/configuration/SchedulerConfig.java
@@ -23,7 +23,6 @@ package org.onap.portal.history.configuration;
import org.onap.portal.history.services.ActionsService;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -34,20 +33,20 @@ import org.springframework.stereotype.Component;
public class SchedulerConfig {
private final ActionsService actionsService;
- private final PortalHistoryConfig portalHistoryConfig;
+ private final HistoryConfig historyConfig;
- public SchedulerConfig(ActionsService actionsService, PortalHistoryConfig portalHistoryConfig){
+ public SchedulerConfig(ActionsService actionsService, HistoryConfig historyConfig){
this.actionsService = actionsService;
- this.portalHistoryConfig = portalHistoryConfig;
+ this.historyConfig = historyConfig;
}
/**
* This method will be trigger by Spring Boot scheduler.
* The cron execution time is configured in the application properties as well as the save interval.
*/
- @Scheduled(cron="${portal-history.delete-interval}")
+ @Scheduled(cron="${history.delete-interval}")
public void runDeleteActions(){
- actionsService.deleteActions(portalHistoryConfig.getSaveInterval());
+ actionsService.deleteActions(historyConfig.getSaveInterval());
log.info("Delete actions in scheduled job");
}
}
diff --git a/app/src/main/java/org/onap/portal/history/controller/ActionsController.java b/app/src/main/java/org/onap/portal/history/controller/ActionsController.java
index 8339d65..ce781f5 100644
--- a/app/src/main/java/org/onap/portal/history/controller/ActionsController.java
+++ b/app/src/main/java/org/onap/portal/history/controller/ActionsController.java
@@ -23,7 +23,7 @@ package org.onap.portal.history.controller;
import java.util.Optional;
-import org.onap.portal.history.configuration.PortalHistoryConfig;
+import org.onap.portal.history.configuration.HistoryConfig;
import org.onap.portal.history.openapi.api.ActionsApi;
import org.onap.portal.history.openapi.model.ActionResponse;
import org.onap.portal.history.openapi.model.ActionsListResponse;
@@ -40,11 +40,11 @@ import reactor.core.publisher.Mono;
public class ActionsController implements ActionsApi {
private final ActionsService actionsService;
- private final PortalHistoryConfig portalHistoryConfig;
+ private final HistoryConfig historyConfig;
- public ActionsController(ActionsService actionsService, PortalHistoryConfig portalHistoryConfig){
+ public ActionsController(ActionsService actionsService, HistoryConfig historyConfig){
this.actionsService = actionsService;
- this.portalHistoryConfig = portalHistoryConfig;
+ this.historyConfig = historyConfig;
}
@Override
@@ -52,7 +52,7 @@ public class ActionsController implements ActionsApi {
return IdTokenExchange
.validateUserId(userId, exchange, xRequestId)
- .then(createActionRequest.flatMap(action -> actionsService.createActions(userId, action, portalHistoryConfig.getSaveInterval(), xRequestId)))
+ .then(createActionRequest.flatMap(action -> actionsService.createActions(userId, action, historyConfig.getSaveInterval(), xRequestId)))
.map(ResponseEntity::ok);
}
@@ -70,7 +70,7 @@ public class ActionsController implements ActionsApi {
return IdTokenExchange
.validateUserId(userId, exchange, xRequestId)
- .then(actionsService.getActions(userId, page.orElse(1), pageSize.orElse(10), showLastHours.orElse(portalHistoryConfig.getSaveInterval()), portalHistoryConfig.getSaveInterval(), xRequestId))
+ .then(actionsService.getActions(userId, page.orElse(1), pageSize.orElse(10), showLastHours.orElse(historyConfig.getSaveInterval()), historyConfig.getSaveInterval(), xRequestId))
.map(ResponseEntity::ok);
}
@@ -78,7 +78,7 @@ public class ActionsController implements ActionsApi {
public Mono<ResponseEntity<ActionsListResponse>> listActions(String xRequestId, Optional<Integer> page, Optional<Integer> pageSize, Optional<Integer> showLastHours, ServerWebExchange exchange) {
return actionsService
- .listActions(page.orElse(1), pageSize.orElse(10), showLastHours.orElse(portalHistoryConfig.getSaveInterval()), portalHistoryConfig.getSaveInterval(), xRequestId)
+ .listActions(page.orElse(1), pageSize.orElse(10), showLastHours.orElse(historyConfig.getSaveInterval()), historyConfig.getSaveInterval(), xRequestId)
.map(ResponseEntity::ok);
}
}
diff --git a/app/src/main/java/org/onap/portal/history/util/Logger.java b/app/src/main/java/org/onap/portal/history/util/Logger.java
index 01b159c..c072c16 100644
--- a/app/src/main/java/org/onap/portal/history/util/Logger.java
+++ b/app/src/main/java/org/onap/portal/history/util/Logger.java
@@ -40,7 +40,7 @@ public class Logger {
* @param path which is called be the request
*/
public static void requestLog(String xRequestId, HttpMethod methode, URI path) {
- log.info("Portal-history - request - X-Request-Id {} {} {}", xRequestId, methode, path);
+ log.info("History - request - X-Request-Id {} {} {}", xRequestId, methode, path);
}
/**
@@ -49,7 +49,7 @@ public class Logger {
* @param code http status of the response
*/
public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) {
- log.info("Portal-history - response - X-Request-Id {} {}", xRequestId, httpStatusCode);
+ log.info("History - response - X-Request-Id {} {}", xRequestId, httpStatusCode);
}
/**
@@ -60,6 +60,6 @@ public class Logger {
*/
public static void errorLog(String xRequestId, String msg, String id) {
log.info(
- "Portal-history - error - X-Request-Id {} {} {} not found", xRequestId, msg, id);
+ "History - error - X-Request-Id {} {} {} not found", xRequestId, msg, id);
}
}
diff --git a/app/src/main/resources/application-local.yml b/app/src/main/resources/application-local.yml
index a908c1b..fcb5c19 100644
--- a/app/src/main/resources/application-local.yml
+++ b/app/src/main/resources/application-local.yml
@@ -1,6 +1,6 @@
server:
- port: 9002
- address: 0.0.0.0
+ port: 9002
+ address: 0.0.0.0
spring:
jackson:
@@ -14,13 +14,13 @@ spring:
jwk-set-uri: http://localhost:8080/auth/realms/ONAP/protocol/openid-connect/certs #Keycloak Endpoint
data:
mongodb:
- database: portal_history
+ database: history
host: localhost
port: 27017
username: root
password: password
-portal-history:
+history:
save-interval: 72
delete-interval: 0 * * * * *
diff --git a/app/src/main/resources/application.yml b/app/src/main/resources/application.yml
index 3bfd624..2b004ce 100644
--- a/app/src/main/resources/application.yml
+++ b/app/src/main/resources/application.yml
@@ -1,8 +1,10 @@
server:
- port: 9002
- address: 0.0.0.0
+ port: 9002
+ address: 0.0.0.0
spring:
+ application:
+ name: history
jackson:
serialization:
# needed for serializing objects of type object
@@ -14,13 +16,13 @@ spring:
jwk-set-uri: ${KEYCLOAK_URL}/auth/realms/${KEYCLOAK_REALM}/protocol/openid-connect/certs #Keycloak Endpoint
data:
mongodb:
- database: ${PORTALHISTORY_DATABASE}
- host: ${PORTALHISTORY_HOST}
- port: ${PORTALHISTORY_PORT}
- username: ${PORTALHISTORY_USERNAME}
- password: ${PORTALHISTORY_PASSWORD}
+ database: ${HISTORY_DATABASE}
+ host: ${HISTORY_HOST}
+ port: ${HISTORY_PORT}
+ username: ${HISTORY_USERNAME}
+ password: ${HISTORY_PASSWORD}
-portal-history:
+history:
save-interval: 72
delete-interval: 0 0 * * * *
diff --git a/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java b/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java
index 866ce33..feee00c 100644
--- a/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/history/BaseIntegrationTest.java
@@ -55,10 +55,10 @@ public abstract class BaseIntegrationTest {
// }
@LocalServerPort protected int port;
- @Value("${portal-history.realm}")
+ @Value("${history.realm}")
protected String realm;
- @Value("${portal-history.delete-interval}")
+ @Value("${history.delete-interval}")
protected String deleteInterval;
@Autowired protected ObjectMapper objectMapper;
diff --git a/app/src/test/java/org/onap/portal/history/actions/ActionsControllerIntegrationTest.java b/app/src/test/java/org/onap/portal/history/actions/ActionsControllerIntegrationTest.java
index c5fa17b..feab695 100644
--- a/app/src/test/java/org/onap/portal/history/actions/ActionsControllerIntegrationTest.java
+++ b/app/src/test/java/org/onap/portal/history/actions/ActionsControllerIntegrationTest.java
@@ -60,7 +60,7 @@ class ActionsControllerIntegrationTest extends BaseIntegrationTest {
@Autowired
private ActionsRepository repository;
- // @Value("${portal-history.save-interval}")
+ // @Value("${history.save-interval}")
protected Integer saveInterval = 72;
@BeforeEach
diff --git a/app/src/test/resources/application.yml b/app/src/test/resources/application.yml
index df38a79..db0d057 100644
--- a/app/src/test/resources/application.yml
+++ b/app/src/test/resources/application.yml
@@ -19,7 +19,7 @@ de:
embedded:
version: 5.0.15
-portal-history:
+history:
realm: ONAP
save-interval: 72
delete-interval: '0 0 0 1 1 *'
@@ -38,4 +38,3 @@ management:
enabled: true
java:
enabled: true
-