aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiConsumerClient.java6
-rw-r--r--prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiProducerClient.java6
-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
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java6
-rw-r--r--prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java3
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java11
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java10
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java11
17 files changed, 109 insertions, 4 deletions
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiConsumerClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiConsumerClient.java
index 0a00048b..7c86d0e3 100644
--- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiConsumerClient.java
+++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiConsumerClient.java
@@ -53,9 +53,9 @@ public class AaiConsumerClient {
private final Map<String, String> aaiHeaders;
/**
- * AAI client for consuming data.
+ * A{@literal &}AI client for consuming data from A{@literal &}AI.
*
- * @param aaiClientConfiguration - client config
+ * @param aaiClientConfiguration - A{@literal &}AI client config
*/
public AaiConsumerClient(AaiClientConfiguration aaiClientConfiguration) {
closeableHttpClient = new AaiClientImpl(aaiClientConfiguration).getAaiHttpClient();
@@ -67,7 +67,7 @@ public class AaiConsumerClient {
}
/**
- * Function which call http client for getting object from AAI.
+ * Function which call http client for getting object from A{@literal &}AI.
*
* @param consumerDmaapModel - helper object for uri generation
* @return - status code of operation
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiProducerClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiProducerClient.java
index f4301f6b..0c3f5803 100644
--- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiProducerClient.java
+++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/AaiProducerClient.java
@@ -58,7 +58,11 @@ public class AaiProducerClient implements AaiExtendedHttpClient {
private final String aaiUserName;
private final String aaiUserPassword;
-
+ /**
+ * A{@literal &}AI client for publishing data to A{@literal &}AI.
+ *
+ * @param aaiClientConfiguration - confiuration for A{@literal &}AI
+ */
public AaiProducerClient(AaiClientConfiguration aaiClientConfiguration) {
closeableHttpClient = new AaiClientImpl(aaiClientConfiguration).getAaiHttpClient();
aaiHost = aaiClientConfiguration.aaiHost();
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() {
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java
index 9e5a73da..66a0a998 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java
@@ -30,6 +30,12 @@ public class CommonFunctions {
private CommonFunctions() {
}
+ /**
+ * Method for serialization object by GSON.
+ *
+ * @param consumerDmaapModel - object which will be serialized
+ * @return string from serialization
+ */
public static String createJsonBody(ConsumerDmaapModel consumerDmaapModel) {
GsonBuilder gsonBuilder = new GsonBuilder();
ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java
index 76f51749..569a7a7c 100644
--- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java
+++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java
@@ -26,6 +26,9 @@ public class ConsumerDmaapModelForUnitTest implements ConsumerDmaapModel {
private final String ipv4;
private final String ipv6;
+ /**
+ * Class for testing serialization of ConsumerDmaapModel.
+ */
public ConsumerDmaapModelForUnitTest() {
this.pnfName = "NOKnhfsadhff";
this.ipv4 = "256.22.33.155";
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java
index b0cca3f3..4317da44 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/DMaaPReactiveWebClient.java
@@ -41,6 +41,12 @@ public class DMaaPReactiveWebClient {
private String dmaaPUserName;
private String dmaaPUserPassword;
+ /**
+ * Creating DMaaPReactiveWebClient passing to them basic DMaaPConfig.
+ *
+ * @param dmaapCustomConfig - configuration object
+ * @return DMaaPReactiveWebClient
+ */
public DMaaPReactiveWebClient fromConfiguration(DmaapCustomConfig dmaapCustomConfig) {
this.dmaaPUserName = dmaapCustomConfig.dmaapUserName();
this.dmaaPUserPassword = dmaapCustomConfig.dmaapUserPassword();
@@ -48,6 +54,11 @@ public class DMaaPReactiveWebClient {
return this;
}
+ /**
+ * Construct Reactive WebClient with appropriate settings.
+ *
+ * @return WebClient
+ */
public WebClient build() {
return WebClient.builder()
.defaultHeader(HttpHeaders.CONTENT_TYPE, dmaaPContentType)
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
index af54bf3b..46699275 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/consumer/DMaaPConsumerReactiveHttpClient.java
@@ -45,6 +45,11 @@ public class DMaaPConsumerReactiveHttpClient {
private final String consumerGroup;
private final String consumerId;
+ /**
+ * Constructor of DMaaPConsumerReactiveHttpClient.
+ *
+ * @param consumerConfiguration - DMaaP consumer configuration object
+ */
public DMaaPConsumerReactiveHttpClient(DmaapConsumerConfiguration consumerConfiguration) {
this.dmaapHostName = consumerConfiguration.dmaapHostName();
this.dmaapProtocol = consumerConfiguration.dmaapProtocol();
@@ -54,6 +59,11 @@ public class DMaaPConsumerReactiveHttpClient {
this.consumerId = consumerConfiguration.consumerId();
}
+ /**
+ * Function for calling DMaaP HTTP consumer - consuming messages from Kafka/DMaaP from topic.
+ *
+ * @return reactive response from DMaaP in string format
+ */
public Mono<String> getDMaaPConsumerResponse() {
try {
return webClient
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
index 0bc78d43..8be69cdc 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPProducerReactiveHttpClient.java
@@ -45,6 +45,11 @@ public class DMaaPProducerReactiveHttpClient {
private final String dmaapProtocol;
private final String dmaapTopicName;
+ /**
+ * Constructor DMaaPProducerReactiveHttpClient.
+ *
+ * @param dmaapPublisherConfiguration - DMaaP producer configuration object
+ */
public DMaaPProducerReactiveHttpClient(DmaapPublisherConfiguration dmaapPublisherConfiguration) {
this.dmaapHostName = dmaapPublisherConfiguration.dmaapHostName();
this.dmaapProtocol = dmaapPublisherConfiguration.dmaapProtocol();
@@ -52,6 +57,12 @@ public class DMaaPProducerReactiveHttpClient {
this.dmaapTopicName = dmaapPublisherConfiguration.dmaapTopicName();
}
+ /**
+ * Function for calling DMaaP HTTP producer - post request to DMaaP.
+ *
+ * @param consumerDmaapModelMono - object which will be sended to DMaaP
+ * @return status code of operation
+ */
public Mono<String> getDMaaPProducerResponse(Mono<ConsumerDmaapModel> consumerDmaapModelMono) {
try {
return webClient