summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src
diff options
context:
space:
mode:
Diffstat (limited to 'prh-app-server/src')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java33
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java5
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java32
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java63
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/TomcatHttpConfig.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java3
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/ScheduleController.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AaiNotFoundException.java (renamed from prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java)7
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapEmptyResponseException.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapNotFoundException.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/PrhTaskException.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTask.java (renamed from prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTask.java)14
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskImpl.java (renamed from prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTaskImpl.java)31
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTask.java (renamed from prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTask.java)11
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java (renamed from prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java)33
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java11
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java3
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java11
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java20
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java57
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/ScheduledXmlContextITest.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java)25
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/ServiceMockProvider.java45
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/junit5/mockito/MockitoExtension.java)13
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java133
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskImplTest.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTaskImplTest.java)49
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskSpy.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTaskSpy.java)18
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java)53
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskSpy.java)23
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java39
-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.java1
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java9
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java3
36 files changed, 433 insertions, 325 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java
index 0cc12d41..21dcf81e 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh;
import org.springframework.boot.SpringApplication;
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
index f24dd177..e10c51d0 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
@@ -17,15 +17,22 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.configuration;
+import java.util.Optional;
+
import java.util.function.Predicate;
-import org.onap.dcaegen2.services.prh.config.*;
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
-import java.util.Optional;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/9/18
@@ -63,8 +70,8 @@ public class AppConfig extends PrhAppConfig {
@Value("${dmaap.dmaapConsumerConfiguration.consumerGroup:}")
public String consumerGroup;
- @Value("${dmaap.dmaapConsumerConfiguration.timeoutMS:}")
- public Integer consumerTimeoutMS;
+ @Value("${dmaap.dmaapConsumerConfiguration.timeoutMs:}")
+ public Integer consumerTimeoutMs;
@Value("${dmaap.dmaapConsumerConfiguration.message-limit:}")
public Integer consumerMessageLimit;
@@ -105,8 +112,8 @@ public class AppConfig extends PrhAppConfig {
@Value("${aai.aaiClientConfiguration.aaiUserPassword:}")
public String aaiUserPassword;
- @Value("${aai.aaiClientConfiguration.aaiIgnoreSSLCertificateErrors:}")
- public Boolean aaiIgnoreSSLCertificateErrors;
+ @Value("${aai.aaiClientConfiguration.aaiIgnoreSslCertificateErrors:}")
+ public Boolean aaiIgnoreSslCertificateErrors;
@Value("${aai.aaiClientConfiguration.aaiBasePath:}")
public String aaiBasePath;
@@ -141,8 +148,8 @@ public class AppConfig extends PrhAppConfig {
.messageLimit(
Optional.ofNullable(consumerMessageLimit).filter(p -> !p.toString().isEmpty())
.orElse(dmaapConsumerConfiguration.messageLimit()))
- .timeoutMS(Optional.ofNullable(consumerTimeoutMS).filter(p -> !p.toString().isEmpty())
- .orElse(dmaapConsumerConfiguration.timeoutMS()))
+ .timeoutMs(Optional.ofNullable(consumerTimeoutMs).filter(p -> !p.toString().isEmpty())
+ .orElse(dmaapConsumerConfiguration.timeoutMs()))
.consumerGroup(Optional.ofNullable(consumerGroup).filter(isEmpty.negate())
.orElse(dmaapConsumerConfiguration.consumerGroup()))
.consumerId(Optional.ofNullable(consumerId).filter(isEmpty.negate())
@@ -151,15 +158,15 @@ public class AppConfig extends PrhAppConfig {
}
@Override
- public AAIClientConfiguration getAAIClientConfiguration() {
- return new ImmutableAAIClientConfiguration.Builder()
+ public AaiClientConfiguration getAaiClientConfiguration() {
+ return new ImmutableAaiClientConfiguration.Builder()
.aaiHost(Optional.ofNullable(aaiHost).filter(isEmpty.negate()).orElse(aaiClientConfiguration.aaiHost()))
.aaiHostPortNumber(
Optional.ofNullable(aaiHostPortNumber).filter(p -> !p.toString().isEmpty())
.orElse(aaiClientConfiguration.aaiHostPortNumber()))
- .aaiIgnoreSSLCertificateErrors(
- Optional.ofNullable(aaiIgnoreSSLCertificateErrors).filter(p -> !p.toString().isEmpty())
- .orElse(aaiClientConfiguration.aaiIgnoreSSLCertificateErrors()))
+ .aaiIgnoreSslCertificateErrors(
+ Optional.ofNullable(aaiIgnoreSslCertificateErrors).filter(p -> !p.toString().isEmpty())
+ .orElse(aaiClientConfiguration.aaiIgnoreSslCertificateErrors()))
.aaiProtocol(
Optional.ofNullable(aaiProtocol).filter(isEmpty.negate()).orElse(aaiClientConfiguration.aaiProtocol()))
.aaiUserName(
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java
index f3b1b557..776ece6c 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/Config.java
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.configuration;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
@@ -30,7 +31,7 @@ public interface Config {
DmaapConsumerConfiguration getDmaapConsumerConfiguration();
- AAIClientConfiguration getAAIClientConfiguration();
+ AaiClientConfiguration getAaiClientConfiguration();
DmaapPublisherConfiguration getDmaapPublisherConfiguration();
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
index ab850044..a6ed3146 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
@@ -17,10 +17,27 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.configuration;
-import com.google.gson.*;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.google.gson.JsonSyntaxException;
+import com.google.gson.TypeAdapterFactory;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import java.util.ServiceLoader;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
import org.slf4j.Logger;
@@ -29,11 +46,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.io.*;
-import java.util.ServiceLoader;
-
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/9/18
*/
@@ -51,7 +63,7 @@ public abstract class PrhAppConfig implements Config {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
- AAIClientConfiguration aaiClientConfiguration;
+ AaiClientConfiguration aaiClientConfiguration;
DmaapConsumerConfiguration dmaapConsumerConfiguration;
@@ -67,7 +79,7 @@ public abstract class PrhAppConfig implements Config {
}
@Override
- public AAIClientConfiguration getAAIClientConfiguration() {
+ public AaiClientConfiguration getAaiClientConfiguration() {
return aaiClientConfiguration;
}
@@ -89,7 +101,7 @@ public abstract class PrhAppConfig implements Config {
jsonObject = rootElement.getAsJsonObject();
aaiClientConfiguration = deserializeType(gsonBuilder,
jsonObject.getAsJsonObject(CONFIG).getAsJsonObject(AAI).getAsJsonObject(AAI_CONFIG),
- AAIClientConfiguration.class);
+ AaiClientConfiguration.class);
dmaapConsumerConfiguration = deserializeType(gsonBuilder,
jsonObject.getAsJsonObject(CONFIG).getAsJsonObject(DMAAP).getAsJsonObject(DMAAP_CONSUMER),
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 a650fe85..2eb2903d 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.configuration;
import io.swagger.annotations.ApiOperation;
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 cb598226..b28fb407 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.configuration;
import org.springframework.context.annotation.Bean;
@@ -38,40 +39,40 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Profile("prod")
public class SwaggerConfig extends WebMvcConfigurationSupport {
- private static final String PACKAGE_PATH = "org.onap.dcaegen2.services.prh";
- private static final String API_TITLE = "PRH app server";
- private static final String DESCRIPTION = "This page lists all the rest apis for PRH app server.";
- private static final String VERSION = "1.0";
- private static final String RESOURCES_PATH = "classpath:/META-INF/resources/";
- private static final String WEBJARS_PATH = RESOURCES_PATH + "webjars/";
- private static final String SWAGGER_UI = "swagger-ui.html";
- private static final String WEBJARS = "/webjars/**";
+ private static final String PACKAGE_PATH = "org.onap.dcaegen2.services.prh";
+ private static final String API_TITLE = "PRH app server";
+ private static final String DESCRIPTION = "This page lists all the rest apis for PRH app server.";
+ private static final String VERSION = "1.0";
+ private static final String RESOURCES_PATH = "classpath:/META-INF/resources/";
+ private static final String WEBJARS_PATH = RESOURCES_PATH + "webjars/";
+ private static final String SWAGGER_UI = "swagger-ui.html";
+ private static final String WEBJARS = "/webjars/**";
- @Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2)
- .apiInfo(apiInfo())
- .select()
- .apis(RequestHandlerSelectors.basePackage(PACKAGE_PATH))
- .paths(PathSelectors.any())
- .build();
- }
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .apiInfo(apiInfo())
+ .select()
+ .apis(RequestHandlerSelectors.basePackage(PACKAGE_PATH))
+ .paths(PathSelectors.any())
+ .build();
+ }
- private ApiInfo apiInfo() {
- return new ApiInfoBuilder()
- .title(API_TITLE)
- .description(DESCRIPTION)
- .version(VERSION)
- .build();
- }
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title(API_TITLE)
+ .description(DESCRIPTION)
+ .version(VERSION)
+ .build();
+ }
- @Override
- protected void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler(SWAGGER_UI)
- .addResourceLocations(RESOURCES_PATH);
+ @Override
+ protected void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler(SWAGGER_UI)
+ .addResourceLocations(RESOURCES_PATH);
- registry.addResourceHandler(WEBJARS)
- .addResourceLocations(WEBJARS_PATH);
- }
+ registry.addResourceHandler(WEBJARS)
+ .addResourceLocations(WEBJARS_PATH);
+ }
} \ No newline at end of file
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 0e9d7fe6..27227251 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.configuration;
import org.apache.catalina.connector.Connector;
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 989c6fb2..ae5f2277 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.controllers;
import io.swagger.annotations.Api;
@@ -48,7 +49,7 @@ public class HeartbeatController {
@ApiResponse(code = 401, message = "You are not authorized to view the resource"),
@ApiResponse(code = 403, message = "Accessing the resource you were trying to reach is forbidden"),
@ApiResponse(code = 404, message = "The resource you were trying to reach is not found")
- }
+ }
)
public Mono<ResponseEntity<String>> heartbeat() {
logger.trace("Receiving heartbeat request");
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 418d7667..270fa584 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.controllers;
import io.swagger.annotations.Api;
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AaiNotFoundException.java
index a01abc56..9cefd891 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AAINotFoundException.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/AaiNotFoundException.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -17,14 +17,15 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.exceptions;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/23/18
*/
-public class AAINotFoundException extends PrhTaskException {
+public class AaiNotFoundException extends PrhTaskException {
- public AAINotFoundException(String message) {
+ public AaiNotFoundException(String message) {
super(message);
}
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapEmptyResponseException.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapEmptyResponseException.java
index e83a96e2..9e3b3c1a 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapEmptyResponseException.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapEmptyResponseException.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.exceptions;
/**
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapNotFoundException.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapNotFoundException.java
index af22284f..8394916d 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapNotFoundException.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/DmaapNotFoundException.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.exceptions;
/**
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/PrhTaskException.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/PrhTaskException.java
index 45597d05..4d543f4c 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/PrhTaskException.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/exceptions/PrhTaskException.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.exceptions;
/**
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTask.java
index 1bb28504..959dc9cd 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTask.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -21,15 +21,15 @@
package org.onap.dcaegen2.services.prh.tasks;
import java.util.Optional;
-import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException;
+import org.onap.dcaegen2.services.prh.exceptions.AaiNotFoundException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.AAIConsumerClient;
+import org.onap.dcaegen2.services.prh.service.AaiConsumerClient;
-public abstract class AAIConsumerTask {
+public abstract class AaiConsumerTask {
- abstract Optional<String> consume(ConsumerDmaapModel message) throws AAINotFoundException;
+ abstract Optional<String> consume(ConsumerDmaapModel message) throws AaiNotFoundException;
- abstract AAIConsumerClient resolveClient();
+ abstract AaiConsumerClient resolveClient();
- protected abstract String execute(ConsumerDmaapModel consumerDmaapModel) throws AAINotFoundException;
+ protected abstract String execute(ConsumerDmaapModel consumerDmaapModel) throws AaiNotFoundException;
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskImpl.java
index c545a1be..63d1e0da 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskImpl.java
@@ -17,60 +17,61 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import java.io.IOException;
import java.util.Optional;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
import org.onap.dcaegen2.services.prh.configuration.Config;
-import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException;
+import org.onap.dcaegen2.services.prh.exceptions.AaiNotFoundException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.AAIConsumerClient;
+import org.onap.dcaegen2.services.prh.service.AaiConsumerClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
-public class AAIConsumerTaskImpl extends AAIConsumerTask {
+public class AaiConsumerTaskImpl extends AaiConsumerTask {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final Config prhAppConfig;
- private AAIConsumerClient aaiConsumerClient;
+ private AaiConsumerClient aaiConsumerClient;
@Autowired
- public AAIConsumerTaskImpl(AppConfig prhAppConfig) {
+ public AaiConsumerTaskImpl(AppConfig prhAppConfig) {
this.prhAppConfig = prhAppConfig;
}
@Override
- Optional<String> consume(ConsumerDmaapModel consumerDmaapModel) throws AAINotFoundException {
+ Optional<String> consume(ConsumerDmaapModel consumerDmaapModel) throws AaiNotFoundException {
logger.trace("Method called with arg {}", consumerDmaapModel);
try {
return aaiConsumerClient.getHttpResponse(consumerDmaapModel);
} catch (IOException e) {
logger.warn("Get request not successful", e);
- throw new AAINotFoundException("Get request not successful");
+ throw new AaiNotFoundException("Get request not successful");
}
}
@Override
- public String execute(ConsumerDmaapModel consumerDmaapModel) throws AAINotFoundException {
+ public String execute(ConsumerDmaapModel consumerDmaapModel) throws AaiNotFoundException {
consumerDmaapModel = Optional.ofNullable(consumerDmaapModel)
- .orElseThrow(() -> new AAINotFoundException("Invoked null object to AAI task"));
+ .orElseThrow(() -> new AaiNotFoundException("Invoked null object to AAI task"));
logger.trace("Method called with arg {}", consumerDmaapModel);
aaiConsumerClient = resolveClient();
- return consume(consumerDmaapModel).orElseThrow(() -> new AAINotFoundException("Null response code"));
+ return consume(consumerDmaapModel).orElseThrow(() -> new AaiNotFoundException("Null response code"));
}
- protected AAIClientConfiguration resolveConfiguration() {
- return prhAppConfig.getAAIClientConfiguration();
+ protected AaiClientConfiguration resolveConfiguration() {
+ return prhAppConfig.getAaiClientConfiguration();
}
@Override
- AAIConsumerClient resolveClient() {
- return Optional.ofNullable(aaiConsumerClient).orElseGet(() -> new AAIConsumerClient(resolveConfiguration()));
+ AaiConsumerClient resolveClient() {
+ return Optional.ofNullable(aaiConsumerClient).orElseGet(() -> new AaiConsumerClient(resolveConfiguration()));
}
}
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 4a763ef3..abd4fc45 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
@@ -17,21 +17,22 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
-import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException;
+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.AAIProducerClient;
+import org.onap.dcaegen2.services.prh.service.AaiProducerClient;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18
*/
-public abstract class AAIProducerTask {
+public abstract class AaiProducerTask {
- abstract ConsumerDmaapModel publish(ConsumerDmaapModel message) throws AAINotFoundException;
+ abstract ConsumerDmaapModel publish(ConsumerDmaapModel message) throws AaiNotFoundException;
- abstract AAIProducerClient resolveClient();
+ abstract AaiProducerClient resolveClient();
protected abstract ConsumerDmaapModel execute(ConsumerDmaapModel consumerDmaapModel) throws PrhTaskException;
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
index b12fb5bb..124a5c63 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
@@ -17,17 +17,18 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import java.net.URISyntaxException;
import java.util.Optional;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
import org.onap.dcaegen2.services.prh.configuration.Config;
-import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException;
+import org.onap.dcaegen2.services.prh.exceptions.AaiNotFoundException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.model.utils.HttpUtils;
-import org.onap.dcaegen2.services.prh.service.AAIProducerClient;
+import org.onap.dcaegen2.services.prh.service.AaiProducerClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,47 +38,47 @@ import org.springframework.stereotype.Component;
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18
*/
@Component
-public class AAIProducerTaskImpl extends
- AAIProducerTask {
+public class AaiProducerTaskImpl extends
+ AaiProducerTask {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final Config prhAppConfig;
- private AAIProducerClient aaiProducerClient;
+ private AaiProducerClient aaiProducerClient;
@Autowired
- public AAIProducerTaskImpl(AppConfig prhAppConfig) {
+ public AaiProducerTaskImpl(AppConfig prhAppConfig) {
this.prhAppConfig = prhAppConfig;
}
@Override
- ConsumerDmaapModel publish(ConsumerDmaapModel consumerDmaapModel) throws AAINotFoundException {
+ ConsumerDmaapModel publish(ConsumerDmaapModel consumerDmaapModel) throws AaiNotFoundException {
logger.info("Sending PNF model to AAI {}", consumerDmaapModel);
try {
return aaiProducerClient.getHttpResponse(consumerDmaapModel)
.filter(HttpUtils::isSuccessfulResponseCode).map(response -> consumerDmaapModel).orElseThrow(() ->
- new AAINotFoundException("Incorrect response code for continuation of tasks workflow"));
+ new AaiNotFoundException("Incorrect response code for continuation of tasks workflow"));
} catch (URISyntaxException e) {
logger.warn("Patch request not successful", e);
- throw new AAINotFoundException("Patch request not successful");
+ throw new AaiNotFoundException("Patch request not successful");
}
}
@Override
- public ConsumerDmaapModel execute(ConsumerDmaapModel consumerDmaapModel) throws AAINotFoundException {
+ public ConsumerDmaapModel execute(ConsumerDmaapModel consumerDmaapModel) throws AaiNotFoundException {
consumerDmaapModel = Optional.ofNullable(consumerDmaapModel)
- .orElseThrow(() -> new AAINotFoundException("Invoked null object to AAI task"));
+ .orElseThrow(() -> new AaiNotFoundException("Invoked null object to AAI task"));
logger.trace("Method called with arg {}", consumerDmaapModel);
aaiProducerClient = resolveClient();
return publish(consumerDmaapModel);
}
- protected AAIClientConfiguration resolveConfiguration() {
- return prhAppConfig.getAAIClientConfiguration();
+ protected AaiClientConfiguration resolveConfiguration() {
+ return prhAppConfig.getAaiClientConfiguration();
}
@Override
- AAIProducerClient resolveClient() {
- return Optional.ofNullable(aaiProducerClient).orElseGet(() -> new AAIProducerClient(resolveConfiguration()));
+ AaiProducerClient resolveClient() {
+ return Optional.ofNullable(aaiProducerClient).orElseGet(() -> new AaiProducerClient(resolveConfiguration()));
}
} \ No newline at end of file
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
index 93c287b4..a912ca9e 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
index 45709aa2..812c04e1 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
@@ -40,7 +41,7 @@ public class DmaapConsumerTaskImpl extends DmaapConsumerTask {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final Config prhAppConfig;
private DmaapConsumerJsonParser dmaapConsumerJsonParser;
- private DMaaPConsumerReactiveHttpClient dMaaPConsumerReactiveHttpClient;
+ private DMaaPConsumerReactiveHttpClient dmaaPConsumerReactiveHttpClient;
@Autowired
public DmaapConsumerTaskImpl(AppConfig prhAppConfig) {
@@ -61,9 +62,9 @@ public class DmaapConsumerTaskImpl extends DmaapConsumerTask {
@Override
public Mono<ConsumerDmaapModel> execute(String object) {
- dMaaPConsumerReactiveHttpClient = resolveClient();
+ dmaaPConsumerReactiveHttpClient = resolveClient();
logger.trace("Method called with arg {}", object);
- return consume((dMaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse()));
+ return consume((dmaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse()));
}
@Override
@@ -78,8 +79,8 @@ public class DmaapConsumerTaskImpl extends DmaapConsumerTask {
@Override
DMaaPConsumerReactiveHttpClient resolveClient() {
- return dMaaPConsumerReactiveHttpClient == null
+ return dmaaPConsumerReactiveHttpClient == null
? new DMaaPConsumerReactiveHttpClient(resolveConfiguration()).createDMaaPWebClient(buildWebClient())
- : dMaaPConsumerReactiveHttpClient;
+ : dmaaPConsumerReactiveHttpClient;
}
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java
index f559683d..9a5813d1 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTask.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
index 673e00f3..4949faa7 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import java.util.Optional;
@@ -40,7 +41,7 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final Config prhAppConfig;
- private DMaaPProducerReactiveHttpClient dMaaPProducerReactiveHttpClient;
+ private DMaaPProducerReactiveHttpClient dmaapProducerReactiveHttpClient;
@Autowired
public DmaapPublisherTaskImpl(AppConfig prhAppConfig) {
@@ -51,14 +52,14 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
Mono<String> publish(Mono<ConsumerDmaapModel> consumerDmaapModel) {
logger.info("Publishing on DMaaP topic {} object {}", resolveConfiguration().dmaapTopicName(),
consumerDmaapModel);
- return dMaaPProducerReactiveHttpClient.getDMaaPProducerResponse(consumerDmaapModel);
+ return dmaapProducerReactiveHttpClient.getDMaaPProducerResponse(consumerDmaapModel);
}
@Override
public Mono<String> execute(Mono<ConsumerDmaapModel> consumerDmaapModel) throws DmaapNotFoundException {
consumerDmaapModel = Optional.ofNullable(consumerDmaapModel)
.orElseThrow(() -> new DmaapNotFoundException("Invoked null object to DMaaP task"));
- dMaaPProducerReactiveHttpClient = resolveClient();
+ dmaapProducerReactiveHttpClient = resolveClient();
logger.trace("Method called with arg {}", consumerDmaapModel);
return publish(consumerDmaapModel);
}
@@ -70,8 +71,8 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
@Override
DMaaPProducerReactiveHttpClient resolveClient() {
- return dMaaPProducerReactiveHttpClient == null
+ return dmaapProducerReactiveHttpClient == null
? new DMaaPProducerReactiveHttpClient(resolveConfiguration()).createDMaaPWebClient(buildWebClient())
- : dMaaPProducerReactiveHttpClient;
+ : dmaapProducerReactiveHttpClient;
}
} \ No newline at end of file
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 365552b7..26b9e6e7 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
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import java.util.Optional;
@@ -41,11 +42,11 @@ public class ScheduledTasks {
private final DmaapConsumerTask dmaapConsumerTask;
private final DmaapPublisherTask dmaapProducerTask;
- private final AAIProducerTask aaiProducerTask;
+ private final AaiProducerTask aaiProducerTask;
@Autowired
public ScheduledTasks(DmaapConsumerTask dmaapConsumerTask, DmaapPublisherTask dmaapPublisherTask,
- AAIProducerTask aaiPublisherTask) {
+ AaiProducerTask aaiPublisherTask) {
this.dmaapConsumerTask = dmaapConsumerTask;
this.dmaapProducerTask = dmaapPublisherTask;
this.aaiProducerTask = aaiPublisherTask;
@@ -56,8 +57,8 @@ public class ScheduledTasks {
Mono<String> dmaapProducerResponse = Mono.fromCallable(consumeFromDMaaPMessage())
.doOnError(DmaapEmptyResponseException.class, error -> logger.warn("Nothing to consume from DMaaP"))
- .map(this::publishToAAIConfiguration)
- .flatMap(this::publishToDMaaPConfiguration)
+ .map(this::publishToAaiConfiguration)
+ .flatMap(this::publishToDmaapConfiguration)
.subscribeOn(Schedulers.elastic());
dmaapProducerResponse.subscribe(this::onSuccess, this::onError, this::onComplete);
@@ -78,14 +79,13 @@ public class ScheduledTasks {
}
private Callable<Mono<ConsumerDmaapModel>> consumeFromDMaaPMessage() {
- return () ->
- {
+ return () -> {
dmaapConsumerTask.initConfigs();
return dmaapConsumerTask.execute("");
};
}
- private Mono<ConsumerDmaapModel> publishToAAIConfiguration(Mono<ConsumerDmaapModel> monoDMaaPModel) {
+ private Mono<ConsumerDmaapModel> publishToAaiConfiguration(Mono<ConsumerDmaapModel> monoDMaaPModel) {
return monoDMaaPModel.flatMap(dmaapModel -> {
try {
return Mono.just(aaiProducerTask.execute(dmaapModel));
@@ -95,9 +95,9 @@ public class ScheduledTasks {
});
}
- private Mono<String> publishToDMaaPConfiguration(Mono<ConsumerDmaapModel> monoAAIModel) {
+ private Mono<String> publishToDmaapConfiguration(Mono<ConsumerDmaapModel> monoAaiModel) {
try {
- return dmaapProducerTask.execute(monoAAIModel);
+ return dmaapProducerTask.execute(monoAaiModel);
} catch (PrhTaskException e) {
return Mono.error(e);
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
index 44a52e6c..71c996bd 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PNF-REGISTRATION-HANDLER
* ================================================================================
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.configuration;
import static org.mockito.ArgumentMatchers.any;
@@ -39,7 +40,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.dcaegen2.services.prh.IT.junit5.mockito.MockitoExtension;
+import org.onap.dcaegen2.services.prh.integration.junit5.mockito.MockitoExtension;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/9/18
@@ -48,8 +49,30 @@ import org.onap.dcaegen2.services.prh.IT.junit5.mockito.MockitoExtension;
class PrhAppConfigTest {
private static final String PRH_ENDPOINTS = "prh_endpoints.json";
- private static final String jsonString = "{\"configs\":{\"aai\":{\"aaiClientConfiguration\":{\"aaiHost\":\"localhost\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSSLCertificateErrors\":true,\"aaiProtocol\":\"https\",\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\",\"aaiBasePath\":\"/aai/v11\",\"aaiPnfPath\":\"/network/pnfs/pnf\",\"aaiHeaders\":{\"X-FromAppId\":\"prh\",\"X-TransactionId\":\"9999\",\"Accept\":\"application/json\",\"Real-Time\":\"true\",\"Authorization\":\"Basic QUFJOkFBSQ==\"}}},\"dmaap\":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\",\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2222,\"dmaapProtocol\":\"http\",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\",\"messageLimit\":1000,\"timeoutMS\":1000},\"dmaapProducerConfiguration\":{\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2223,\"dmaapProtocol\":\"http\",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\"}}}}";
- private static final String incorrectJsonString = "{\"configs\":{\"aai\":{\"aaiClientConfiguration\":{\"aaiHost\":\"localhost\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSSLCertificateErrors\":true,\"aaiProtocol\":\"https\",\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\",\"aaiBasePath\":\"/aai/v11\",\"aaiPnfPath\":\"/network/pnfs/pnf\",\"aaiHeaders\":{\"X-FromAppId\":\"prh\",\"X-TransactionId\":\"9999\",\"Accept\":\"application/json\",\"Real-Time\":\"true\",\"Authorization\":\"Basic QUFJOkFBSQ==\"}}},\"dmaap\":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\",\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2222,\"dmaapProtocol\":\"http\",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\",\"messageLimit\":1000,\"timeoutMS\":1000},\"dmaapProducerConfiguration\":{\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2223,\"dmaapProtocol\":\"http\",\"dmaaptopicName\":\"temp\",\"dmaapuserName\":\"admin\",\"dmaapuserPassword\":\"admin\"}}}}";
+ private static final String jsonString = "{\"configs\":{\"aai\":{\"aaiClientConfiguration\":{\"aaiHost\":"
+ + "\"localhost\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSslCertificateErrors\":true,\"aaiProtocol\":"
+ + "\"https\",\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\",\"aaiBasePath\":\"/aai/v11\","
+ + "\"aaiPnfPath\":\"/network/pnfs/pnf\",\"aaiHeaders\":{\"X-FromAppId\":\"prh\",\"X-TransactionId\":\"9999\","
+ + "\"Accept\":\"application/json\",\"Real-Time\":\"true\",\"Authorization\":\"Basic QUFJOkFBSQ==\"}}},"
+ + "\"dmaap\":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\","
+ + "\"dmaapContentType\":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2222,"
+ + "\"dmaapProtocol\":\"http\",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\""
+ + ":\"admin\",\"messageLimit\":1000,\"timeoutMs\":1000},\"dmaapProducerConfiguration\":{\"dmaapContentType\":"
+ + "\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2223,\"dmaapProtocol\":\"http\","
+ + "\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\"}}}}";
+
+ private static final String incorrectJsonString = "{\"configs\":{\"aai\":{\"aaiClientConfiguration\":{\"aaiHost\":"
+ + "\"localhost\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSslCertificateErrors\":true,\"aaiProtocol\":\"https\","
+ + "\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\",\"aaiBasePath\":\"/aai/v11\",\"aaiPnfPath\":"
+ + "\"/network/pnfs/pnf\",\"aaiHeaders\":{\"X-FromAppId\":\"prh\",\"X-TransactionId\":\"9999\",\"Accept\":"
+ + "\"application/json\",\"Real-Time\":\"true\",\"Authorization\":\"Basic QUFJOkFBSQ==\"}}},\"dmaap\""
+ + ":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\",\"dmaapContentType\""
+ + ":\"application/json\",\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2222,\"dmaapProtocol\":\"http\""
+ + ",\"dmaapTopicName\":\"temp\",\"dmaapUserName\":\"admin\",\"dmaapUserPassword\":\"admin\",\"messageLimit\""
+ + ":1000,\"timeoutMs\":1000},\"dmaapProducerConfiguration\":{\"dmaapContentType\":\"application/json\","
+ + "\"dmaapHostName\":\"localhost\",\"dmaapPortNumber\":2223,\"dmaapProtocol\":\"http\",\"dmaaptopicName\""
+ + ":\"temp\",\"dmaapuserName\":\"admin\",\"dmaapuserPassword\":\"admin\"}}}}";
+
private static PrhAppConfig prhAppConfig;
private static AppConfig appConfig;
@@ -57,13 +80,13 @@ class PrhAppConfigTest {
.requireNonNull(PrhAppConfigTest.class.getClassLoader().getResource(PRH_ENDPOINTS)).getFile();
@BeforeEach
- public void setUp() {
+ void setUp() {
prhAppConfig = spy(PrhAppConfig.class);
appConfig = spy(new AppConfig());
}
@Test
- public void whenApplicationWasStarted_FilePathIsSet() {
+ void whenApplicationWasStarted_FilePathIsSet() {
//
// When
//
@@ -77,7 +100,7 @@ class PrhAppConfigTest {
}
@Test
- public void whenTheConfigurationFits_GetAaiAndDmaapObjectRepresentationConfiguration()
+ void whenTheConfigurationFits_GetAaiAndDmaapObjectRepresentationConfiguration()
throws IOException {
//
// Given
@@ -92,13 +115,13 @@ class PrhAppConfigTest {
prhAppConfig.initFileStreamReader();
appConfig.dmaapConsumerConfiguration = prhAppConfig.getDmaapConsumerConfiguration();
appConfig.dmaapPublisherConfiguration = prhAppConfig.getDmaapPublisherConfiguration();
- appConfig.aaiClientConfiguration = prhAppConfig.getAAIClientConfiguration();
+ appConfig.aaiClientConfiguration = prhAppConfig.getAaiClientConfiguration();
//
// Then
//
verify(prhAppConfig, times(1)).setFilepath(anyString());
verify(prhAppConfig, times(1)).initFileStreamReader();
- Assertions.assertNotNull(prhAppConfig.getAAIClientConfiguration());
+ Assertions.assertNotNull(prhAppConfig.getAaiClientConfiguration());
Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration());
Assertions.assertNotNull(prhAppConfig.getDmaapPublisherConfiguration());
Assertions
@@ -106,12 +129,12 @@ class PrhAppConfigTest {
Assertions
.assertEquals(appConfig.getDmaapConsumerConfiguration(), prhAppConfig.getDmaapConsumerConfiguration());
Assertions
- .assertEquals(appConfig.getAAIClientConfiguration(), prhAppConfig.getAAIClientConfiguration());
+ .assertEquals(appConfig.getAaiClientConfiguration(), prhAppConfig.getAaiClientConfiguration());
}
@Test
- public void whenFileIsNotExist_ThrowIOException() {
+ void whenFileIsNotExist_ThrowIoException() {
//
// Given
//
@@ -126,14 +149,14 @@ class PrhAppConfigTest {
//
verify(prhAppConfig, times(1)).setFilepath(anyString());
verify(prhAppConfig, times(1)).initFileStreamReader();
- Assertions.assertNull(prhAppConfig.getAAIClientConfiguration());
+ Assertions.assertNull(prhAppConfig.getAaiClientConfiguration());
Assertions.assertNull(prhAppConfig.getDmaapConsumerConfiguration());
Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration());
}
@Test
- public void whenFileIsExistsButJsonIsIncorrect() throws IOException {
+ void whenFileIsExistsButJsonIsIncorrect() throws IOException {
//
// Given
//
@@ -151,7 +174,7 @@ class PrhAppConfigTest {
//
verify(prhAppConfig, times(1)).setFilepath(anyString());
verify(prhAppConfig, times(1)).initFileStreamReader();
- Assertions.assertNotNull(prhAppConfig.getAAIClientConfiguration());
+ Assertions.assertNotNull(prhAppConfig.getAaiClientConfiguration());
Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration());
Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration());
@@ -159,7 +182,7 @@ class PrhAppConfigTest {
@Test
- public void whenTheConfigurationFits_ButRootElementIsNotAJsonObject()
+ void whenTheConfigurationFits_ButRootElementIsNotAJsonObject()
throws IOException {
// Given
InputStream inputStream = new ByteArrayInputStream((jsonString.getBytes(
@@ -173,12 +196,12 @@ class PrhAppConfigTest {
prhAppConfig.initFileStreamReader();
appConfig.dmaapConsumerConfiguration = prhAppConfig.getDmaapConsumerConfiguration();
appConfig.dmaapPublisherConfiguration = prhAppConfig.getDmaapPublisherConfiguration();
- appConfig.aaiClientConfiguration = prhAppConfig.getAAIClientConfiguration();
+ appConfig.aaiClientConfiguration = prhAppConfig.getAaiClientConfiguration();
// Then
verify(prhAppConfig, times(1)).setFilepath(anyString());
verify(prhAppConfig, times(1)).initFileStreamReader();
- Assertions.assertNull(prhAppConfig.getAAIClientConfiguration());
+ Assertions.assertNull(prhAppConfig.getAaiClientConfiguration());
Assertions.assertNull(prhAppConfig.getDmaapConsumerConfiguration());
Assertions.assertNull(prhAppConfig.getDmaapPublisherConfiguration());
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/ScheduledXmlContextITest.java
index 95e00809..3d1d79fe 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/ScheduledXmlContextITest.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
@@ -17,10 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcaegen2.services.prh.IT;
+
+package org.onap.dcaegen2.services.prh.integration;
import static org.mockito.Mockito.atLeast;
-import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.util.concurrent.Executors;
@@ -28,12 +28,9 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.IT.junit5.mockito.MockitoExtension;
-import org.onap.dcaegen2.services.prh.configuration.PrhAppConfig;
+import org.onap.dcaegen2.services.prh.integration.junit5.mockito.MockitoExtension;
import org.onap.dcaegen2.services.prh.tasks.ScheduledTasks;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
@@ -66,18 +63,4 @@ class ScheduledXmlContextITest extends AbstractTestNGSpringContextTests {
}
}
-@Configuration
-class ServiceMockProvider {
-
- @Bean
- public PrhAppConfig getPrhAppConfig() {
- return mock(PrhAppConfig.class);
- }
-
- @Bean
- public ConsumerDmaapModel getRequestDetails() {
- return mock(ConsumerDmaapModel.class);
- }
-}
-
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/ServiceMockProvider.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/ServiceMockProvider.java
new file mode 100644
index 00000000..2660e3e5
--- /dev/null
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/ServiceMockProvider.java
@@ -0,0 +1,45 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PROJECT
+ * ================================================================================
+ * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.services.prh.integration;
+
+import static org.mockito.Mockito.mock;
+
+import org.onap.dcaegen2.services.prh.configuration.PrhAppConfig;
+import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/10/18
+ */
+@Configuration
+class ServiceMockProvider {
+
+ @Bean
+ public PrhAppConfig getPrhAppConfig() {
+ return mock(PrhAppConfig.class);
+ }
+
+ @Bean
+ public ConsumerDmaapModel getRequestDetails() {
+ return mock(ConsumerDmaapModel.class);
+ }
+}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/junit5/mockito/MockitoExtension.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java
index c1e2d752..5c19186b 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/junit5/mockito/MockitoExtension.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
@@ -17,7 +17,8 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcaegen2.services.prh.IT.junit5.mockito;
+
+package org.onap.dcaegen2.services.prh.integration.junit5.mockito;
import static org.mockito.Mockito.mock;
@@ -29,15 +30,15 @@ import org.junit.jupiter.api.extension.ExtensionContext.Store;
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.api.extension.ParameterResolver;
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
-import org.mockito.MockitoAnnotations;
import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/27/18
*
- * {@code MockitoExtension} showcases the {@link TestInstancePostProcessor} and {@link ParameterResolver} extension APIs
- * of JUnit 5 by providing dependency injection support at the field level and at the method parameter level via Mockito
- * 2.x's {@link Mock @Mock} annotation.
+ * {@code MockitoExtension } showcases the {@link TestInstancePostProcessor} and {@link ParameterResolver} extension
+ * APIs of JUnit 5 by providing dependency injection support at the field level and at the method parameter level
+ * viaMockito 2.x's {@link Mock @Mock} annotation.
*/
public class MockitoExtension implements TestInstancePostProcessor, ParameterResolver {
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
index ba01abfb..cc2a593f 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java
@@ -43,26 +43,28 @@ class DmaapConsumerJsonParserTest {
void whenPassingCorrectJson_validationNotThrowingAnException() {
//given
String message =
- "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\""
- + ":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
- + "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\","
+ + "\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\""
+ + ":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
- + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3},"
- + "\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,"
- + "\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":\"10.16.123.234\","
- + "\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":\"QTFCOC540002E\","
- + "\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":\"Nokia\"}}}]";
+ + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":"
+ + "3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400"
+ + ",\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":"
+ + "\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":"
+ + "\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":"
+ + "\"Nokia\"}}}]";
String parsed =
"{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\""
+ ":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
+ "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
- + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3},"
- + "\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,"
- + "\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":\"10.16.123.234\","
- + "\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":\"QTFCOC540002E\","
- + "\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":\"Nokia\"}}}";
+ + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":"
+ + "3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":"
+ + "1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":"
+ + "\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":"
+ + "\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":"
+ + "\"Nokia\"}}}";
ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234")
.ipv6("0:0:0:0:0:FFFF:0A10:7BEA")
.pnfName("NOKQTFCOC540002E").build();
@@ -79,12 +81,12 @@ class DmaapConsumerJsonParserTest {
}
@Test
- void whenPassingCorrectJsonWithoutIPV4_validationNotThrowingAnException() {
+ void whenPassingCorrectJsonWithoutIpv4_validationNotThrowingAnException() {
//given
String message =
- "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\""
- + ":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
- + "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\","
+ + "\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":"
+ + "{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
+ "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3}"
+ ",\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,"
@@ -103,9 +105,6 @@ class DmaapConsumerJsonParserTest {
+ "\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":\"QTFCOC540002E\",\"pnfSoftwareVersion\""
+ ":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":\"Nokia\"}}}";
- ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("")
- .ipv6("0:0:0:0:0:FFFF:0A10:7BEA")
- .pnfName("NOKQTFCOC540002E").build();
//when
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
@@ -115,17 +114,20 @@ class DmaapConsumerJsonParserTest {
ConsumerDmaapModel consumerDmaapModel = dmaapConsumerJsonParser.getJsonObject(Mono.just((message)))
.block();
//then
+ ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("")
+ .ipv6("0:0:0:0:0:FFFF:0A10:7BEA")
+ .pnfName("NOKQTFCOC540002E").build();
Assertions.assertNotNull(consumerDmaapModel);
Assertions.assertEquals(expectedObject, consumerDmaapModel);
}
@Test
- void whenPassingCorrectJsonWihoutIPV6_validationNotThrowingAnException() {
+ void whenPassingCorrectJsonWihoutIpv6_validationNotThrowingAnException() {
//given
String message =
- "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\""
- + ":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
- + "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\","
+ + "\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":"
+ + "{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
+ "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,"
+ "\"version\":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate"
@@ -158,11 +160,11 @@ class DmaapConsumerJsonParserTest {
}
@Test
- void whenPassingCorrectJsonWihoutIPV4andIPV6_validationThrowingAnException() {
+ void whenPassingCorrectJsonWihoutIpv4andIpv6_validationThrowingAnException() {
String message =
- "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\""
- + ":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
- + "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\","
+ + "\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":"
+ + "{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
+ "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\""
+ ":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\""
@@ -199,10 +201,11 @@ class DmaapConsumerJsonParserTest {
.when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement);
String incorrectMessage =
"[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\""
- + ",\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
- + "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\",\"priority\""
- + ":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":\"<<SerialNumber>>\","
- + "\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3}}}]";
+ + ",\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":"
+ + "{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ + "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
+ + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3"
+ + "}}}]";
StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(incorrectMessage)))
.expectSubscription().expectError(DmaapNotFoundException.class).verify();
}
@@ -211,13 +214,13 @@ class DmaapConsumerJsonParserTest {
void whenPassingJsonWithoutPnfSerialNumberOrPnfVendorName_validationThrowingAnException() {
String parsed = "{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":"
+ "\"<<SerialNumber>>-reg\",\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\""
- + "internalHeaderFields\":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\""
- + ":\"5DU\",\"priority\":\"Normal\",reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":\""
- + "<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",startEpochMicrosec\":1519837825682,\"version\":3},"
- + "\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,"
- + "\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":"
- + "\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSoftwareVersion\":\"v4.5.0.1\","
- + "\"pnfType\":\"AirScale\"}}}";
+ + "internalHeaderFields\":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\","
+ + "\"nfcNamingCode\":\"5DU\",\"priority\":\"Normal\",reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,"
+ + "\"sourceId\":\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",startEpochMicrosec\":1519837825682,\""
+ + "version\":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\""
+ + ":1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":"
+ + "\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSoftwareVersion\":"
+ + "\"v4.5.0.1\",\"pnfType\":\"AirScale\"}}}";
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject()))
@@ -225,43 +228,45 @@ class DmaapConsumerJsonParserTest {
String jsonWithoutPnfVendorAndSerialNumber =
"[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":"
+ "\"<<SerialNumber>>-reg\",\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\""
- + "internalHeaderFields\":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\""
- + ":\"5DU\",\"priority\":\"Normal\",reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":\""
- + "<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",startEpochMicrosec\":1519837825682,\"version\":3},"
- + "\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,"
- + "\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":"
- + "\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSoftwareVersion\":\"v4.5.0.1\","
- + "\"pnfType\":\"AirScale\"}}}]";
+ + "internalHeaderFields\":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\","
+ + "\"nfcNamingCode\":\"5DU\",\"priority\":\"Normal\",reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,"
+ + "\"sourceId\":\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",startEpochMicrosec\":1519837825682,"
+ + "\"version\":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\","
+ + "\"pnfLastServiceDate\":1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\","
+ + "\"pnfOamIpv4Address\":\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
+ + "\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\"}}}]";
StepVerifier
.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutPnfVendorAndSerialNumber)))
.expectSubscription().expectError(DmaapNotFoundException.class).verify();
}
@Test
- void whenPassingJsonWithoutIPInformation_validationThrowingAnException() {
+ void whenPassingJsonWithoutIpInformation_validationThrowingAnException() {
String parsed =
- "{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\":"
- + "\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},\"lastEpochMicrosec\""
- + ":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\",\"priority\":\"Normal\","
- + "\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":\"<<SerialNumber>>\",\"sourceName\":"
- + "\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3},\"otherFields\":{\"otherFieldsVersion\":1,"
- + "\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":"
- + "\"AJ02\",\"pnfSerialNumber\":\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\","
- + "\"pnfVendorName\":\"Nokia\"}}}";
+ "{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\","
+ + "\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\""
+ + ":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ + "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
+ + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\""
+ + ":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":"
+ + "1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":"
+ + "\"AJ02\",\"pnfSerialNumber\":\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":"
+ + "\"AirScale\"," + "\"pnfVendorName\":\"Nokia\"}}}";
DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser());
JsonElement jsonElement = new JsonParser().parse(parsed);
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject()))
.when(dmaapConsumerJsonParser).getJsonObjectFromAnArray(jsonElement);
- String jsonWithoutIPInformation =
- "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\":"
- + "\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},\"lastEpochMicrosec\""
- + ":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\",\"priority\":\"Normal\","
- + "\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":\"<<SerialNumber>>\",\"sourceName\":"
- + "\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3},\"otherFields\":{\"otherFieldsVersion\":1,"
- + "\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":"
- + "\"AJ02\",\"pnfSerialNumber\":\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\","
+ String jsonWithoutIpInformation =
+ "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\","
+ + "\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\""
+ + ":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ + "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
+ + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\""
+ + ":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\""
+ + ":1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfSerialNumber\""
+ + ":\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\","
+ "\"pnfVendorName\":\"Nokia\"}}}]";
- StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutIPInformation)))
+ StepVerifier.create(dmaapConsumerJsonParser.getJsonObject(Mono.just(jsonWithoutIpInformation)))
.expectSubscription().expectError(DmaapNotFoundException.class).verify();
}
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskImplTest.java
index 570cb2a0..8af562b2 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIConsumerTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiConsumerTaskImplTest.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import static org.mockito.ArgumentMatchers.any;
@@ -34,22 +35,22 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableAAIClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
-import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException;
+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.model.ImmutableConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.service.AAIConsumerClient;
+import org.onap.dcaegen2.services.prh.service.AaiConsumerClient;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 5/17/18
*/
-class AAIConsumerTaskImplTest {
+class AaiConsumerTaskImplTest {
private static ConsumerDmaapModel consumerDmaapModel;
- private static AAIConsumerTaskImpl aaiConsumerTask;
+ private static AaiConsumerTaskImpl aaiConsumerTask;
private static final String AAI_HOST = "/aai/v12/network/pnfs/pnf/NOKQTFCOC540002E";
private static final Integer PORT = 1234;
@@ -58,19 +59,19 @@ class AAIConsumerTaskImplTest {
private static final String BASE_PATH = "/aai/v12";
private static final String PNF_PATH = "/network/pnfs/pnf";
- private static AAIClientConfiguration aaiClientConfiguration;
- private static AAIConsumerClient aaiConsumerClient;
+ private static AaiClientConfiguration aaiClientConfiguration;
+ private static AaiConsumerClient aaiConsumerClient;
private static AppConfig appConfig;
@BeforeAll
- public static void setUp() {
- aaiClientConfiguration = new ImmutableAAIClientConfiguration.Builder()
+ static void setUp() {
+ aaiClientConfiguration = new ImmutableAaiClientConfiguration.Builder()
.aaiHost(AAI_HOST)
.aaiHostPortNumber(PORT)
.aaiProtocol(PROTOCOL)
.aaiUserName(USER_NAME_PASSWORD)
.aaiUserPassword(USER_NAME_PASSWORD)
- .aaiIgnoreSSLCertificateErrors(true)
+ .aaiIgnoreSslCertificateErrors(true)
.aaiBasePath(BASE_PATH)
.aaiPnfPath(PNF_PATH)
.build();
@@ -82,10 +83,10 @@ class AAIConsumerTaskImplTest {
}
@Test
- public void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
+ void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
//given/when
- when(appConfig.getAAIClientConfiguration()).thenReturn(aaiClientConfiguration);
- aaiConsumerTask = new AAIConsumerTaskImpl(appConfig);
+ when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
+ aaiConsumerTask = new AaiConsumerTaskImpl(appConfig);
Executable executableCode = () -> aaiConsumerTask.execute(null);
//then
Assertions
@@ -94,9 +95,9 @@ class AAIConsumerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_ReturnsCorrectStatus() throws PrhTaskException, IOException {
+ void whenPassedObjectFits_ReturnsCorrectStatus() throws PrhTaskException, IOException {
//given/when
- getAAIConsumerTask_WhenMockingHttpResponseCode("200", false);
+ getAaiConsumerTask_WhenMockingHttpResponseCode("200", false);
String response = aaiConsumerTask.execute(consumerDmaapModel);
//then
@@ -106,9 +107,9 @@ class AAIConsumerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_butIncorrectResponseReturns() throws IOException, AAINotFoundException {
+ void whenPassedObjectFits_butIncorrectResponseReturns() throws IOException, AaiNotFoundException {
//given/when
- getAAIConsumerTask_WhenMockingHttpResponseCode("400", false);
+ getAaiConsumerTask_WhenMockingHttpResponseCode("400", false);
String response = aaiConsumerTask.execute(consumerDmaapModel);
//then
@@ -118,9 +119,9 @@ class AAIConsumerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_ThrowsIOExceptionAndHandleIt() throws IOException {
+ void whenPassedObjectFits_ThrowsIoExceptionAndHandleIt() throws IOException {
//given/when
- getAAIConsumerTask_WhenMockingHttpResponseCode(null, true);
+ getAaiConsumerTask_WhenMockingHttpResponseCode(null, true);
Executable executableCode = () -> aaiConsumerTask.execute(any(ConsumerDmaapModel.class));
Assertions
.assertThrows(PrhTaskException.class, executableCode, "HttpClient throws IOException");
@@ -130,16 +131,16 @@ class AAIConsumerTaskImplTest {
}
- private static void getAAIConsumerTask_WhenMockingHttpResponseCode(String httpResponseCode, boolean throwsException)
+ private static void getAaiConsumerTask_WhenMockingHttpResponseCode(String httpResponseCode, boolean throwsException)
throws IOException {
- aaiConsumerClient = mock(AAIConsumerClient.class);
+ aaiConsumerClient = mock(AaiConsumerClient.class);
if (throwsException) {
when(aaiConsumerClient.getHttpResponse(consumerDmaapModel)).thenThrow(IOException.class);
} else {
when(aaiConsumerClient.getHttpResponse(consumerDmaapModel)).thenReturn(Optional.of(httpResponseCode));
}
- when(appConfig.getAAIClientConfiguration()).thenReturn(aaiClientConfiguration);
- aaiConsumerTask = spy(new AAIConsumerTaskImpl(appConfig));
+ when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
+ aaiConsumerTask = spy(new AaiConsumerTaskImpl(appConfig));
when(aaiConsumerTask.resolveConfiguration()).thenReturn(aaiClientConfiguration);
doReturn(aaiConsumerClient).when(aaiConsumerTask).resolveClient();
}
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 e2b81373..5106269e 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
@@ -17,26 +17,28 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
-import static org.mockito.Mockito.*;
-
-
@Configuration
-public class AAIConsumerTaskSpy {
+public class AaiConsumerTaskSpy {
@Bean
@Primary
- public AAIConsumerTask registerSimpleAAIPublisherTask() {
+ public AaiConsumerTask registerSimpleAaiPublisherTask() {
AppConfig appConfig = mock(AppConfig.class);
- when(appConfig.getAAIClientConfiguration()).thenReturn(mock(AAIClientConfiguration.class));
- return spy(new AAIConsumerTaskImpl(appConfig));
+ when(appConfig.getAaiClientConfiguration()).thenReturn(mock(AaiClientConfiguration.class));
+ return spy(new AaiConsumerTaskImpl(appConfig));
}
} \ No newline at end of file
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java
index 70da39b7..5e60bf0f 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AAIProducerTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java
@@ -36,19 +36,22 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
-import org.onap.dcaegen2.services.prh.config.ImmutableAAIClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
+
+import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+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.model.ImmutableConsumerDmaapModel;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
-import org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException;
-import org.onap.dcaegen2.services.prh.service.AAIProducerClient;
+
+import org.onap.dcaegen2.services.prh.service.AaiProducerClient;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 5/14/18
*/
-class AAIProducerTaskImplTest {
+class AaiProducerTaskImplTest {
private static final String AAI_HOST = "/aai/v11/network/pnfs/pnf/NOKQTFCOC540002E";
@@ -59,20 +62,20 @@ class AAIProducerTaskImplTest {
private static final String PNF_PATH = "/network/pnfs/pnf";
private static ConsumerDmaapModel consumerDmaapModel;
- private static AAIProducerTaskImpl aaiProducerTask;
- private static AAIClientConfiguration aaiClientConfiguration;
- private static AAIProducerClient aaiProducerClient;
+ private static AaiProducerTaskImpl aaiProducerTask;
+ private static AaiClientConfiguration aaiClientConfiguration;
+ private static AaiProducerClient aaiProducerClient;
private static AppConfig appConfig;
@BeforeAll
- public static void setUp() {
- aaiClientConfiguration = new ImmutableAAIClientConfiguration.Builder()
+ static void setUp() {
+ aaiClientConfiguration = new ImmutableAaiClientConfiguration.Builder()
.aaiHost(AAI_HOST)
.aaiHostPortNumber(PORT)
.aaiProtocol(PROTOCOL)
.aaiUserName(USER_NAME_PASSWORD)
.aaiUserPassword(USER_NAME_PASSWORD)
- .aaiIgnoreSSLCertificateErrors(true)
+ .aaiIgnoreSslCertificateErrors(true)
.aaiBasePath(BASE_PATH)
.aaiPnfPath(PNF_PATH)
.build();
@@ -84,10 +87,10 @@ class AAIProducerTaskImplTest {
}
@Test
- public void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
+ void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
//given/when/
- when(appConfig.getAAIClientConfiguration()).thenReturn(aaiClientConfiguration);
- aaiProducerTask = new AAIProducerTaskImpl(appConfig);
+ when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
+ aaiProducerTask = new AaiProducerTaskImpl(appConfig);
Executable executableCode = () -> aaiProducerTask.execute(null);
//then
@@ -96,9 +99,9 @@ class AAIProducerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_ReturnsCorrectStatus() throws AAINotFoundException, URISyntaxException {
+ void whenPassedObjectFits_ReturnsCorrectStatus() throws AaiNotFoundException, URISyntaxException {
//given/when
- getAAIProducerTask_whenMockingResponseObject(200, false);
+ getAaiProducerTask_whenMockingResponseObject(200, false);
ConsumerDmaapModel response = aaiProducerTask.execute(consumerDmaapModel);
//then
@@ -110,9 +113,9 @@ class AAIProducerTaskImplTest {
@Test
- public void whenPassedObjectFits_butIncorrectResponseReturns() throws IOException, URISyntaxException {
+ void whenPassedObjectFits_butIncorrectResponseReturns() throws URISyntaxException {
//given/when
- getAAIProducerTask_whenMockingResponseObject(400, false);
+ getAaiProducerTask_whenMockingResponseObject(400, false);
Executable executableCode = () -> aaiProducerTask.execute(consumerDmaapModel);
Assertions
.assertThrows(PrhTaskException.class, executableCode, "Incorrect status code in response message");
@@ -122,9 +125,9 @@ class AAIProducerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_butHTTPClientThrowsIOExceptionHandleIt() throws URISyntaxException {
+ void whenPassedObjectFits_butHttpClientThrowsIoExceptionHandleIt() throws URISyntaxException {
//given/when
- getAAIProducerTask_whenMockingResponseObject(0, true);
+ getAaiProducerTask_whenMockingResponseObject(0, true);
Executable executableCode = () -> aaiProducerTask.execute(consumerDmaapModel);
Assertions
@@ -135,17 +138,17 @@ class AAIProducerTaskImplTest {
}
- private static void getAAIProducerTask_whenMockingResponseObject(int statusCode, boolean throwsException)
+ private static void getAaiProducerTask_whenMockingResponseObject(int statusCode, boolean throwsException)
throws URISyntaxException {
//given
- aaiProducerClient = mock(AAIProducerClient.class);
+ aaiProducerClient = mock(AaiProducerClient.class);
if (throwsException) {
when(aaiProducerClient.getHttpResponse(consumerDmaapModel)).thenThrow(URISyntaxException.class);
} else {
when(aaiProducerClient.getHttpResponse(consumerDmaapModel)).thenReturn(Optional.of(statusCode));
}
- when(appConfig.getAAIClientConfiguration()).thenReturn(aaiClientConfiguration);
- aaiProducerTask = spy(new AAIProducerTaskImpl(appConfig));
+ when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
+ aaiProducerTask = spy(new AaiProducerTaskImpl(appConfig));
when(aaiProducerTask.resolveConfiguration()).thenReturn(aaiClientConfiguration);
doReturn(aaiProducerClient).when(aaiProducerTask).resolveClient();
}
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 762a251d..3a66bd47 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
@@ -17,31 +17,34 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
-import org.onap.dcaegen2.services.prh.config.AAIClientConfiguration;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
-import org.onap.dcaegen2.services.prh.service.AAIProducerClient;
+import org.onap.dcaegen2.services.prh.service.AaiProducerClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
-import static org.mockito.Mockito.*;
-
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/13/18
*/
@Configuration
-public class AAIPublisherTaskSpy {
+public class AaiPublisherTaskSpy {
@Bean
@Primary
- public AAIProducerTask registerSimpleAAIPublisherTask() {
+ public AaiProducerTask registerSimpleAaiPublisherTask() {
AppConfig appConfig = spy(AppConfig.class);
- doReturn(mock(AAIClientConfiguration.class)).when(appConfig).getAAIClientConfiguration();
- AAIProducerTaskImpl aaiProducerTask = spy(new AAIProducerTaskImpl(appConfig));
- AAIProducerClient aaiProducerClient = mock(AAIProducerClient.class);
- doReturn(mock(AAIClientConfiguration.class)).when(aaiProducerTask).resolveConfiguration();
+ doReturn(mock(AaiClientConfiguration.class)).when(appConfig).getAaiClientConfiguration();
+ AaiProducerTaskImpl aaiProducerTask = spy(new AaiProducerTaskImpl(appConfig));
+ AaiProducerClient aaiProducerClient = mock(AaiProducerClient.class);
+ doReturn(mock(AaiClientConfiguration.class)).when(aaiProducerTask).resolveConfiguration();
doReturn(aaiProducerClient).when(aaiProducerTask).resolveClient();
return aaiProducerTask;
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
index b903fc90..6baa7463 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -30,7 +31,6 @@ import static org.mockito.Mockito.when;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import java.util.Optional;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -38,7 +38,6 @@ import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
import org.onap.dcaegen2.services.prh.exceptions.DmaapEmptyResponseException;
-import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.service.DmaapConsumerJsonParser;
@@ -60,40 +59,42 @@ class DmaapConsumerTaskImplTest {
private static String parsed;
@BeforeAll
- public static void setUp() {
+ static void setUp() {
dmaapConsumerConfiguration = new ImmutableDmaapConsumerConfiguration.Builder().consumerGroup("OpenDCAE-c12")
.consumerId("c12").dmaapContentType("application/json").dmaapHostName("54.45.33.2").dmaapPortNumber(1234)
.dmaapProtocol("https").dmaapUserName("PRH").dmaapUserPassword("PRH")
- .dmaapTopicName("unauthenticated.SEC_OTHER_OUTPUT").timeoutMS(-1).messageLimit(-1).build();
+ .dmaapTopicName("unauthenticated.SEC_OTHER_OUTPUT").timeoutMs(-1).messageLimit(-1).build();
consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234")
.ipv6("0:0:0:0:0:FFFF:0A10:7BEA")
.pnfName("NOKQTFCOC540002E").build();
appConfig = mock(AppConfig.class);
message =
- "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\""
- + ":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
- + "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "[{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\","
+ + "\"eventName\":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\""
+ + ":{},\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
- + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3},"
- + "\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,"
- + "\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":\"10.16.123.234\","
- + "\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":\"QTFCOC540002E\","
- + "\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":\"Nokia\"}}}]";
+ + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\""
+ + ":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":"
+ + "1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":"
+ + "\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":"
+ + "\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":"
+ + "\"Nokia\"}}}]";
parsed =
"{\"event\":{\"commonEventHeader\":{\"domain\":\"other\",\"eventId\":\"<<SerialNumber>>-reg\",\"eventName\""
+ ":\"pnfRegistration_5GDU\",\"eventType\":\"pnfRegistration\",\"internalHeaderFields\":{},"
+ "\"lastEpochMicrosec\":1519837825682,\"nfNamingCode\":\"5GRAN\",\"nfcNamingCode\":\"5DU\","
+ "\"priority\":\"Normal\",\"reportingEntityName\":\"5GRAN_DU\",\"sequence\":0,\"sourceId\":"
- + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,\"version\":3},"
- + "\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\",\"pnfLastServiceDate\":1517206400,"
- + "\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\",\"pnfOamIpv4Address\":\"10.16.123.234\","
- + "\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\",\"pnfSerialNumber\":\"QTFCOC540002E\","
- + "\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\",\"pnfVendorName\":\"Nokia\"}}}";
+ + "\"<<SerialNumber>>\",\"sourceName\":\"5GRAN_DU\",\"startEpochMicrosec\":1519837825682,"
+ + "\"version\":3},\"otherFields\":{\"otherFieldsVersion\":1,\"pnfFamily\":\"BBU\","
+ + "\"pnfLastServiceDate\":1517206400,\"pnfManufactureDate\":1516406400,\"pnfModelNumber\":\"AJ02\","
+ + "\"pnfOamIpv4Address\":\"10.16.123.234\",\"pnfOamIpv6Address\":\"0:0:0:0:0:FFFF:0A10:7BEA\","
+ + "\"pnfSerialNumber\":\"QTFCOC540002E\",\"pnfSoftwareVersion\":\"v4.5.0.1\",\"pnfType\":\"AirScale\","
+ + "\"pnfVendorName\":\"Nokia\"}}}";
}
@Test
- public void whenPassedObjectDoesntFit_DoesNotThrowPrhTaskException() throws PrhTaskException {
+ void whenPassedObjectDoesntFit_DoesNotThrowPrhTaskException() {
//given
prepareMocksForDmaapConsumer(Optional.empty());
@@ -105,7 +106,7 @@ class DmaapConsumerTaskImplTest {
}
@Test
- public void whenPassedObjectFits_ReturnsCorrectResponse() throws PrhTaskException {
+ void whenPassedObjectFits_ReturnsCorrectResponse() {
//given
prepareMocksForDmaapConsumer(Optional.of(message));
//when
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 97c75ce0..2d83b2de 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import static org.mockito.Mockito.doReturn;
@@ -42,10 +43,10 @@ public class DmaapConsumerTaskSpy {
AppConfig appConfig = spy(AppConfig.class);
doReturn(mock(DmaapConsumerConfiguration.class)).when(appConfig).getDmaapConsumerConfiguration();
DmaapConsumerTaskImpl dmaapConsumerTask = spy(new DmaapConsumerTaskImpl(appConfig));
- DMaaPConsumerReactiveHttpClient DMaaPConsumerReactiveHttpClient = mock(
+ DMaaPConsumerReactiveHttpClient dmaapConsumerReactiveHttpClient = mock(
DMaaPConsumerReactiveHttpClient.class);
doReturn(mock(DmaapConsumerConfiguration.class)).when(dmaapConsumerTask).resolveConfiguration();
- doReturn(DMaaPConsumerReactiveHttpClient).when(dmaapConsumerTask).resolveClient();
+ doReturn(dmaapConsumerReactiveHttpClient).when(dmaapConsumerTask).resolveClient();
return dmaapConsumerTask;
}
}
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 ceb0ed81..622ab621 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
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import static org.mockito.Mockito.doReturn;
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java
index 25d1fff6..e0419e8f 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -56,7 +57,7 @@ class DmaapPublisherTaskImplTest {
private static DmaapPublisherConfiguration dmaapPublisherConfiguration;
@BeforeAll
- public static void setUp() {
+ static void setUp() {
dmaapPublisherConfiguration = new ImmutableDmaapPublisherConfiguration.Builder()
.dmaapContentType("application/json").dmaapHostName("54.45.33.2").dmaapPortNumber(1234)
.dmaapProtocol("https").dmaapUserName("PRH").dmaapUserPassword("PRH")
@@ -68,7 +69,7 @@ class DmaapPublisherTaskImplTest {
}
@Test
- public void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
+ void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
//given
when(appConfig.getDmaapPublisherConfiguration()).thenReturn(dmaapPublisherConfiguration);
dmaapPublisherTask = new DmaapPublisherTaskImpl(appConfig);
@@ -81,7 +82,7 @@ class DmaapPublisherTaskImplTest {
}
@Test
- public void whenPassedObjectFits_ReturnsCorrectStatus() throws PrhTaskException {
+ void whenPassedObjectFits_ReturnsCorrectStatus() throws PrhTaskException {
//given
prepareMocksForTests(HttpStatus.OK.value());
@@ -97,7 +98,7 @@ class DmaapPublisherTaskImplTest {
@Test
- public void whenPassedObjectFits_butIncorrectResponseReturns() throws DmaapNotFoundException {
+ void whenPassedObjectFits_butIncorrectResponseReturns() throws DmaapNotFoundException {
//given
prepareMocksForTests(HttpStatus.UNAUTHORIZED.value());
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java
index 2bff9e02..28692af3 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.dcaegen2.services.prh.tasks;
import static org.mockito.Mockito.spy;
@@ -39,7 +40,7 @@ public class ScheduleControllerSpy {
private DmaapPublisherTask dmaapPublisherTaskImplSpy;
@Autowired
- private AAIProducerTask aaiPublisherTaskImplSpy;
+ private AaiProducerTask aaiPublisherTaskImplSpy;
@Bean
@Primary