summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'prh-app-server/src/main')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java2
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java12
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java4
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java (renamed from prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java)15
4 files changed, 17 insertions, 16 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
index 1e1e0491..c9667ed6 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
@@ -65,7 +65,7 @@ public class CloudConfiguration extends AppConfig {
this.prhConfigurationProvider = prhConfigurationProvider;
}
- protected void runTask() {
+ public void runTask() {
Flux.defer(() -> EnvironmentProcessor.evaluate(systemEnvironment))
.subscribeOn(Schedulers.parallel())
.subscribe(this::parsingConfigSuccess, this::parsingConfigError);
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
index 9386b9e8..aa913654 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java
@@ -22,7 +22,7 @@ package org.onap.dcaegen2.services.prh.controllers;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import org.onap.dcaegen2.services.prh.configuration.SchedulerConfig;
+import org.onap.dcaegen2.services.prh.tasks.ScheduledTasksRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,25 +42,25 @@ public class ScheduleController {
private static final Logger LOGGER = LoggerFactory.getLogger(ScheduleController.class);
- private final SchedulerConfig schedulerConfig;
+ private final ScheduledTasksRunner scheduledTasksRunner;
@Autowired
- public ScheduleController(SchedulerConfig schedulerConfig) {
- this.schedulerConfig = schedulerConfig;
+ public ScheduleController(ScheduledTasksRunner scheduledTasksRunner) {
+ this.scheduledTasksRunner = scheduledTasksRunner;
}
@RequestMapping(value = "start", method = RequestMethod.GET)
@ApiOperation(value = "Start scheduling worker request")
public Mono<ResponseEntity<String>> startTasks() {
LOGGER.trace("Receiving start scheduling worker request");
- return Mono.fromSupplier(schedulerConfig::tryToStartTask).map(this::createStartTaskResponse);
+ return Mono.fromSupplier(scheduledTasksRunner::tryToStartTask).map(this::createStartTaskResponse);
}
@RequestMapping(value = "stopPrh", method = RequestMethod.GET)
@ApiOperation(value = "Receiving stop scheduling worker request")
public Mono<ResponseEntity<String>> stopTask() {
LOGGER.trace("Receiving stop scheduling worker request");
- return schedulerConfig.getResponseFromCancellationOfTasks();
+ return scheduledTasksRunner.getResponseFromCancellationOfTasks();
}
@ApiOperation(value = "Sends success or error response on starting task execution")
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java
index 54a8ad89..711d808f 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java
@@ -25,7 +25,7 @@ import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.exceptions.AaiNotFoundException;
import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.AaiReactiveWebClient;
+import org.onap.dcaegen2.services.prh.service.AaiReactiveWebClientFactory;
import org.onap.dcaegen2.services.prh.service.producer.AaiProducerReactiveHttpClient;
import org.onap.dcaegen2.services.prh.ssl.SslFactory;
import org.springframework.web.reactive.function.client.WebClient;
@@ -47,6 +47,6 @@ public abstract class AaiProducerTask {
throws PrhTaskException, SSLException;
WebClient buildWebClient() throws SSLException {
- return new AaiReactiveWebClient(new SslFactory(), resolveConfiguration()).build();
+ return new AaiReactiveWebClientFactory(new SslFactory(), resolveConfiguration()).build();
}
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java
index 76ba5ec6..956ffead 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.dcaegen2.services.prh.configuration;
+package org.onap.dcaegen2.services.prh.tasks;
import io.swagger.annotations.ApiOperation;
import java.time.Duration;
@@ -27,7 +27,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import javax.annotation.PostConstruct;
-import org.onap.dcaegen2.services.prh.tasks.ScheduledTasks;
+
+import org.onap.dcaegen2.services.prh.configuration.CloudConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
@@ -46,11 +47,11 @@ import reactor.core.publisher.Mono;
*/
@Configuration
@EnableScheduling
-public class SchedulerConfig {
+public class ScheduledTasksRunner {
private static final int SCHEDULING_DELAY_FOR_PRH_TASKS = 10;
private static final int SCHEDULING_REQUEST_FOR_CONFIGURATION_DELAY = 5;
- private static final Logger LOGGER = LoggerFactory.getLogger(SchedulerConfig.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ScheduledTasksRunner.class);
private static final Marker ENTRY = MarkerFactory.getMarker("ENTRY");
private static volatile List<ScheduledFuture> scheduledPrhTaskFutureList = new ArrayList<>();
@@ -59,9 +60,9 @@ public class SchedulerConfig {
private final CloudConfiguration cloudConfiguration;
@Autowired
- public SchedulerConfig(TaskScheduler taskScheduler,
- ScheduledTasks scheduledTask,
- CloudConfiguration cloudConfiguration) {
+ public ScheduledTasksRunner(TaskScheduler taskScheduler,
+ ScheduledTasks scheduledTask,
+ CloudConfiguration cloudConfiguration) {
this.taskScheduler = taskScheduler;
this.scheduledTask = scheduledTask;
this.cloudConfiguration = cloudConfiguration;