summaryrefslogtreecommitdiffstats
path: root/prh-app-server
diff options
context:
space:
mode:
Diffstat (limited to 'prh-app-server')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java10
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java4
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/TomcatHttpConfig.java5
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java5
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java6
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java10
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskSpy.java5
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java5
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java5
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java5
10 files changed, 60 insertions, 0 deletions
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/configuration/SchedulerConfig.java
index 2eb2903d..f792c0ae 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/configuration/SchedulerConfig.java
@@ -53,6 +53,11 @@ public class SchedulerConfig extends PrhAppConfig {
this.scheduledTask = scheduledTask;
}
+ /**
+ * Function which have to stop tasks execution.
+ *
+ * @return response entity about status of cancellation operation
+ */
@ApiOperation(value = "Get response on stopping task execution")
public synchronized Mono<ResponseEntity<String>> getResponseFromCancellationOfTasks() {
scheduledFutureList.forEach(x -> x.cancel(false));
@@ -62,6 +67,11 @@ public class SchedulerConfig extends PrhAppConfig {
);
}
+ /**
+ * Function for starting scheduling PRH workflow.
+ *
+ * @return status of operation execution: true - started, false - not started
+ */
@PostConstruct
@ApiOperation(value = "Start task if possible")
public synchronized boolean tryToStartTask() {
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java
index b28fb407..10bf2755 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java
@@ -48,6 +48,10 @@ public class SwaggerConfig extends WebMvcConfigurationSupport {
private static final String SWAGGER_UI = "swagger-ui.html";
private static final String WEBJARS = "/webjars/**";
+ /**
+ * Swagger configuration function for hosting it next to spring http website.
+ * @return Docket
+ */
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/TomcatHttpConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/TomcatHttpConfig.java
index 27227251..d9b4ac52 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/TomcatHttpConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/TomcatHttpConfig.java
@@ -32,6 +32,11 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class TomcatHttpConfig {
+ /**
+ * Class for setting up hosting PRH on http/https.
+ *
+ * @return ServletWebServerFactory
+ */
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java
index ae5f2277..0135ef76 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java
@@ -42,6 +42,11 @@ public class HeartbeatController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ /**
+ * Endpoint for checking that PRH is alive.
+ *
+ * @return HTTP Status Code
+ */
@RequestMapping(value = "heartbeat", method = RequestMethod.GET)
@ApiOperation(value = "Returns liveness of PRH service")
@ApiResponses(value = {
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
index 255a7eb1..e46c97a5 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java
@@ -44,6 +44,12 @@ public class DmaapConsumerJsonParser {
private static final String PNF_VENDOR_NAME = "pnfVendorName";
private static final String PNF_SERIAL_NUMBER = "pnfSerialNumber";
+ /**
+ * Extract info from string and create @see {@link org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel}.
+ *
+ * @param monoMessage - results from DMaaP
+ * @return reactive DMaaPModel
+ */
public Mono<ConsumerDmaapModel> getJsonObject(Mono<String> monoMessage) {
return monoMessage
.flatMap(this::getJsonParserMessage)
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
index 26b9e6e7..e00a606d 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
@@ -44,6 +44,13 @@ public class ScheduledTasks {
private final DmaapPublisherTask dmaapProducerTask;
private final AaiProducerTask aaiProducerTask;
+ /**
+ * Constructor for tasks registration in PRHWorkflow.
+ *
+ * @param dmaapConsumerTask - fist task
+ * @param dmaapPublisherTask - third task
+ * @param aaiPublisherTask - second task
+ */
@Autowired
public ScheduledTasks(DmaapConsumerTask dmaapConsumerTask, DmaapPublisherTask dmaapPublisherTask,
AaiProducerTask aaiPublisherTask) {
@@ -52,6 +59,9 @@ public class ScheduledTasks {
this.aaiProducerTask = aaiPublisherTask;
}
+ /**
+ * Main function for scheduling prhWorkflow.
+ */
public void scheduleMainPrhEventTask() {
logger.trace("Execution of tasks was registered");
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskSpy.java
index 5106269e..28af4494 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskSpy.java
@@ -34,6 +34,11 @@ import org.springframework.context.annotation.Primary;
@Configuration
public class AaiConsumerTaskSpy {
+ /**
+ * Mocking bean for tests.
+ *
+ * @return A&AI ConsumerTask spy
+ */
@Bean
@Primary
public AaiConsumerTask registerSimpleAaiPublisherTask() {
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java
index 3a66bd47..9b0292b8 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java
@@ -37,6 +37,11 @@ import org.springframework.context.annotation.Primary;
@Configuration
public class AaiPublisherTaskSpy {
+ /**
+ * Mocking bean for tests.
+ *
+ * @return A&AI ProducerTask spy
+ */
@Bean
@Primary
public AaiProducerTask registerSimpleAaiPublisherTask() {
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java
index 2d83b2de..5f73dbe1 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java
@@ -37,6 +37,11 @@ import org.springframework.context.annotation.Primary;
@Configuration
public class DmaapConsumerTaskSpy {
+ /**
+ * Mocking bean for tests.
+ *
+ * @return DMaaP ConsumerTask spy
+ */
@Bean
@Primary
public DmaapConsumerTask registerSimpleDmaapConsumerTask() {
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java
index 622ab621..01851dc1 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java
@@ -37,6 +37,11 @@ import org.springframework.context.annotation.Primary;
@Configuration
public class DmaapProducerTaskSpy {
+ /**
+ * Mocking bean for tests.
+ *
+ * @return DMaaP PublisherTask spy
+ */
@Bean
@Primary
public DmaapPublisherTask registerSimpleDmaapPublisherTask() {