aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java2
-rw-r--r--datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java16
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/CloudConfigParserTest.java4
-rw-r--r--datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctions.java6
-rw-r--r--datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/consumer/DmaapConsumerReactiveHttpClient.java4
5 files changed, 13 insertions, 19 deletions
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java
index 512a2178..c42749cf 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/configuration/SchedulerConfig.java
@@ -44,7 +44,7 @@ public class SchedulerConfig extends DatafileAppConfig {
private static final int SCHEDULING_DELAY_FOR_DATAFILE_COLLECTOR_TASKS = 10;
private static final int SCHEDULING_REQUEST_FOR_CONFIGURATION_DELAY = 5;
- private static volatile List<ScheduledFuture> scheduledFutureList = new ArrayList<ScheduledFuture>();
+ private static volatile List<ScheduledFuture> scheduledFutureList = new ArrayList<>();
private final TaskScheduler taskScheduler;
private final ScheduledTasks scheduledTask;
diff --git a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
index 7226dfa8..619ccc11 100644
--- a/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
+++ b/datafile-app-server/src/main/java/org/onap/dcaegen2/collectors/datafile/service/DmaapConsumerJsonParser.java
@@ -167,19 +167,17 @@ public class DmaapConsumerJsonParser {
private boolean isNotificationFieldsHeaderNotEmpty(String changeIdentifier, String changeType,
String notificationFieldsVersion) {
- return ((changeIdentifier != null && !changeIdentifier.isEmpty())
- && (changeType != null && !changeType.isEmpty())
- && (notificationFieldsVersion != null && !notificationFieldsVersion.isEmpty()));
+ return isStringIsNotNullAndNotEmpty(changeIdentifier) && isStringIsNotNullAndNotEmpty(changeType)
+ && isStringIsNotNullAndNotEmpty(notificationFieldsVersion);
}
private boolean isFileFormatFieldsNotEmpty(String fileFormatVersion, String fileFormatType) {
- return ((fileFormatVersion != null && !fileFormatVersion.isEmpty())
- && (fileFormatType != null && !fileFormatType.isEmpty()));
+ return isStringIsNotNullAndNotEmpty(fileFormatVersion) && isStringIsNotNullAndNotEmpty(fileFormatType);
}
private boolean isNameAndLocationAndCompressionNotEmpty(String name, String location, String compression) {
- return (name != null && !name.isEmpty()) && (location != null && !location.isEmpty())
- && (compression != null && !compression.isEmpty());
+ return isStringIsNotNullAndNotEmpty(name) && isStringIsNotNullAndNotEmpty(location) &&
+ isStringIsNotNullAndNotEmpty(compression);
}
private boolean containsHeader(JsonObject jsonObject) {
@@ -189,4 +187,8 @@ public class DmaapConsumerJsonParser {
private boolean containsHeader(JsonObject jsonObject, String topHeader, String header) {
return jsonObject.has(topHeader) && jsonObject.getAsJsonObject(topHeader).has(header);
}
+
+ private boolean isStringIsNotNullAndNotEmpty(String string) {
+ return string != null && !string.isEmpty();
+ }
}
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/CloudConfigParserTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/CloudConfigParserTest.java
index a4f098be..60968c05 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/CloudConfigParserTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/CloudConfigParserTest.java
@@ -31,7 +31,7 @@ import org.onap.dcaegen2.collectors.datafile.config.ImmutableDmaapPublisherConfi
class CloudConfigParserTest {
- private static final String correctJson =
+ private static final String CORRECT_JSON =
"{\"dmaap.dmaapProducerConfiguration.dmaapTopicName\": \"/events/unauthenticated.VES_NOTIFICATION_OUTPUT\", "
+ "\"dmaap.dmaapConsumerConfiguration.timeoutMS\": -1,"
+ " \"dmaap.dmaapConsumerConfiguration.dmaapHostName\": \"message-router.onap.svc.cluster.local\","
@@ -78,7 +78,7 @@ class CloudConfigParserTest {
.build();
private CloudConfigParser cloudConfigParser = new CloudConfigParser(
- new Gson().fromJson(correctJson, JsonObject.class));
+ new Gson().fromJson(CORRECT_JSON, JsonObject.class));
@Test
diff --git a/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctions.java b/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctions.java
index d7bcbe4b..e02476a5 100644
--- a/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctions.java
+++ b/datafile-commons/src/main/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctions.java
@@ -21,17 +21,11 @@ package org.onap.dcaegen2.collectors.datafile.model;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
public class CommonFunctions {
- private static final Logger logger = LoggerFactory.getLogger(CommonFunctions.class);
-
private static Gson gson = new GsonBuilder().create();
-
private CommonFunctions() {}
public static String createJsonBody(ConsumerDmaapModel consumerDmaapModel) {
diff --git a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/consumer/DmaapConsumerReactiveHttpClient.java b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/consumer/DmaapConsumerReactiveHttpClient.java
index f32b22c4..c4bf1611 100644
--- a/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/consumer/DmaapConsumerReactiveHttpClient.java
+++ b/datafile-dmaap-client/src/main/java/org/onap/dcaegen2/collectors/datafile/service/consumer/DmaapConsumerReactiveHttpClient.java
@@ -70,9 +70,7 @@ public class DmaapConsumerReactiveHttpClient {
}
private Consumer<HttpHeaders> getHeaders() {
- return httpHeaders -> {
- httpHeaders.set(HttpHeaders.CONTENT_TYPE, contentType);
- };
+ return httpHeaders -> httpHeaders.set(HttpHeaders.CONTENT_TYPE, contentType);
}
private String createRequestPath() {