aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-app-server/src/test/java/org
diff options
context:
space:
mode:
authorPatrikBuhr <patrik.buhr@est.tech>2019-08-12 12:28:01 +0000
committerPatrikBuhr <patrik.buhr@est.tech>2019-08-12 12:28:01 +0000
commitf60b5dd56a5cc287b6ad007e7dd22612fa547f4e (patch)
treeed8130dc6a3abe9be5fbd4a6d65c21d4876d8282 /datafile-app-server/src/test/java/org
parent60e9cb9b38ef2124c839a1877f50a4cb83973693 (diff)
DFC Housekeeping
Removed warnings. Improved code formatting Removed unused files Removed datafile_endpoints.json from the container Change-Id: I7334775be793cd9cb709ca1e031c620c2c1c2b3f Issue-ID: DCAEGEN2-1645 Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Diffstat (limited to 'datafile-app-server/src/test/java/org')
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/AppConfigTest.java34
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/ScheduleControllerTest.java14
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/StatusControllerTest.java6
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapWebClientTest.java12
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/JsonMessageParserTest.java20
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/DataRouterPublisherTest.java10
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollectorTest.java22
-rw-r--r--datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasksTest.java6
8 files changed, 63 insertions, 61 deletions
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/AppConfigTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/AppConfigTest.java
index f661dd0e..c20dc2f3 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/AppConfigTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/configuration/AppConfigTest.java
@@ -76,11 +76,11 @@ public class AppConfigTest {
public static final ImmutableDmaapConsumerConfiguration CORRECT_DMAAP_CONSUMER_CONFIG = //
new ImmutableDmaapConsumerConfiguration.Builder() //
.endpointUrl(
- "http://admin:admin@message-router.onap.svc.cluster.local:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12")
+ "http://dradmin:dradmin@localhost:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12")
.timeoutMs(-1) //
- .dmaapHostName("message-router.onap.svc.cluster.local") //
- .dmaapUserName("admin") //
- .dmaapUserPassword("admin") //
+ .dmaapHostName("localhost") //
+ .dmaapUserName("dradmin") //
+ .dmaapUserPassword("dradmin") //
.dmaapTopicName("events/unauthenticated.VES_NOTIFICATION_OUTPUT") //
.dmaapPortNumber(2222) //
.dmaapContentType("application/json") //
@@ -97,7 +97,7 @@ public class AppConfigTest {
public static final ConsumerConfiguration CORRECT_CONSUMER_CONFIG = ImmutableConsumerConfiguration.builder() //
.topicUrl(
- "http://admin:admin@message-router.onap.svc.cluster.local:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12")
+ "http://dradmin:dradmin@localhost:2222/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12")
.trustStorePath("trustStorePath") //
.trustStorePasswordPath("trustStorePasswordPath") //
.keyStorePath("keyStorePath") //
@@ -107,15 +107,16 @@ public class AppConfigTest {
private static final PublisherConfiguration CORRECT_PUBLISHER_CONFIG = //
ImmutablePublisherConfiguration.builder() //
- .publishUrl("https://message-router.onap.svc.cluster.local:3907/publish/1") //
- .logUrl("https://dmaap.example.com/feedlog/972").trustStorePath("trustStorePath") //
+ .publishUrl("https://localhost:3907/publish/1") //
+ .logUrl("https://localhost:3907/feedlog/1") //
+ .trustStorePath("trustStorePath") //
.trustStorePasswordPath("trustStorePasswordPath") //
.keyStorePath("keyStorePath") //
.keyStorePasswordPath("keyStorePasswordPath") //
.enableDmaapCertAuth(true) //
.changeIdentifier("PM_MEAS_FILES") //
- .userName("user") //
- .passWord("password") //
+ .userName("CYE9fl40") //
+ .passWord("izBJD8nLjawq0HMG") //
.build();
private static final ImmutableFtpesConfig CORRECT_FTPES_CONFIGURATION = //
@@ -128,13 +129,14 @@ public class AppConfigTest {
private static final ImmutableDmaapPublisherConfiguration CORRECT_DMAAP_PUBLISHER_CONFIG = //
new ImmutableDmaapPublisherConfiguration.Builder() //
- .endpointUrl("https://message-router.onap.svc.cluster.local:3907/publish/1").dmaapTopicName("/publish/1") //
- .dmaapUserPassword("password") //
+ .endpointUrl("https://localhost:3907/publish/1") //
+ .dmaapTopicName("/publish/1") //
+ .dmaapUserPassword("izBJD8nLjawq0HMG") //
.dmaapPortNumber(3907) //
.dmaapProtocol("https") //
.dmaapContentType("application/octet-stream") //
- .dmaapHostName("message-router.onap.svc.cluster.local") //
- .dmaapUserName("user") //
+ .dmaapHostName("localhost") //
+ .dmaapUserName("CYE9fl40") //
.trustStorePath("trustStorePath") //
.trustStorePasswordPath("trustStorePasswordPath") //
.keyStorePath("keyStorePath") //
@@ -256,7 +258,7 @@ public class AppConfigTest {
@Test
public void whenPeriodicConfigRefreshNoEnvironmentVariables() {
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(AppConfig.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(AppConfig.class);
Flux<AppConfig> task = appConfigUnderTest.createRefreshTask(context);
StepVerifier //
@@ -268,8 +270,7 @@ public class AppConfigTest {
}
@Test
- public void whenPeriodicConfigRefreshNoConsul() {
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(AppConfig.class);
+ public void whenPeriodicConfigRefreshNoConsul() {
EnvProperties props = properties();
doReturn(Mono.just(props)).when(appConfigUnderTest).getEnvironment(any(), any());
@@ -277,6 +278,7 @@ public class AppConfigTest {
Flux<JsonObject> err = Flux.error(new IOException());
doReturn(err).when(cbsClient).updates(any(), any(), any());
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(AppConfig.class);
Flux<AppConfig> task = appConfigUnderTest.createRefreshTask(context);
StepVerifier //
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/ScheduleControllerTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/ScheduleControllerTest.java
index 558eaf0e..345c411c 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/ScheduleControllerTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/ScheduleControllerTest.java
@@ -62,7 +62,7 @@ public class ScheduleControllerTest {
HttpHeaders httpHeaders = new HttpHeaders();
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduleController.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduleController.class);
Mono<ResponseEntity<String>> response = scheduleControllerUnderTest.startTasks(httpHeaders);
validateLogging(logAppender, "Start request");
@@ -80,10 +80,10 @@ public class ScheduleControllerTest {
HttpHeaders httpHeaders = new HttpHeaders();
// The following headers are set to create branch coverage in MappedDiagnosticContext:initializeTraceContext().
- httpHeaders.set(MdcVariables.X_ONAP_REQUEST_ID, "Onap request ID");
- httpHeaders.set(MdcVariables.X_INVOCATION_ID, "Invocation ID");
+ httpHeaders.set(MdcVariables.httpHeader(MdcVariables.REQUEST_ID), "Onap request ID");
+ httpHeaders.set(MdcVariables.httpHeader(MdcVariables.INVOCATION_ID), "Invocation ID");
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduleController.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduleController.class);
Mono<ResponseEntity<String>> response = scheduleControllerUnderTest.startTasks(httpHeaders);
validateLogging(logAppender, "Start request");
@@ -102,7 +102,7 @@ public class ScheduleControllerTest {
HttpHeaders httpHeaders = new HttpHeaders();
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduleController.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduleController.class);
Mono<ResponseEntity<String>> actualResponse = scheduleControllerUnderTest.stopTask(httpHeaders);
validateLogging(logAppender, "Stop request");
@@ -115,11 +115,11 @@ public class ScheduleControllerTest {
}
private void validateLogging(ListAppender<ILoggingEvent> logAppender, String infoMessage) {
- assertEquals(logAppender.list.get(0).getMarker().getName(), "ENTRY");
+ assertEquals("ENTRY", logAppender.list.get(0).getMarker().getName());
assertNotNull(logAppender.list.get(0).getMDCPropertyMap().get("InvocationID"));
assertNotNull(logAppender.list.get(0).getMDCPropertyMap().get("RequestID"));
assertTrue("Info missing in log", logAppender.list.toString().contains("[INFO] " + infoMessage));
- assertEquals(logAppender.list.get(1).getMarker().getName(), "EXIT");
+ assertEquals("EXIT", logAppender.list.get(1).getMarker().getName());
logAppender.stop();
}
}
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/StatusControllerTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/StatusControllerTest.java
index 55c796ab..998bb17f 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/StatusControllerTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/controllers/StatusControllerTest.java
@@ -60,7 +60,7 @@ public class StatusControllerTest {
public void heartbeat_success() {
HttpHeaders httpHeaders = new HttpHeaders();
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(StatusController.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(StatusController.class);
Mono<ResponseEntity<String>> result = controllerUnderTest.heartbeat(httpHeaders);
validateLogging(logAppender);
@@ -89,11 +89,11 @@ public class StatusControllerTest {
}
private void validateLogging(ListAppender<ILoggingEvent> logAppender) {
- assertEquals(logAppender.list.get(0).getMarker().getName(), "ENTRY");
+ assertEquals("ENTRY", logAppender.list.get(0).getMarker().getName());
assertNotNull(logAppender.list.get(0).getMDCPropertyMap().get("InvocationID"));
assertNotNull(logAppender.list.get(0).getMDCPropertyMap().get("RequestID"));
assertTrue("Info missing in log", logAppender.list.toString().contains("[INFO] Heartbeat request"));
- assertEquals(logAppender.list.get(1).getMarker().getName(), "EXIT");
+ assertEquals("EXIT", logAppender.list.get(1).getMarker().getName());
logAppender.stop();
}
}
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapWebClientTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapWebClientTest.java
index 499b2608..d4e060ff 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapWebClientTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/DmaapWebClientTest.java
@@ -72,13 +72,13 @@ class DmaapWebClientTest {
when(clientResponseMock.statusCode()).thenReturn(HttpStatus.OK);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DmaapWebClient.class, true);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DmaapWebClient.class, true);
Mono<ClientResponse> logResponse = dmaapWebClientUndetTest.logResponse(clientResponseMock);
assertEquals(clientResponseMock, logResponse.block());
- assertEquals(logAppender.list.get(0).getLevel(), Level.TRACE);
- assertEquals(logAppender.list.get(0).getFormattedMessage(), "Response Status 200 OK");
+ assertEquals(Level.TRACE, logAppender.list.get(0).getLevel());
+ assertEquals("Response Status 200 OK", logAppender.list.get(0).getFormattedMessage());
logAppender.stop();
}
@@ -93,14 +93,14 @@ class DmaapWebClientTest {
DmaapWebClient dmaapWebClientUndetTest = new DmaapWebClient();
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DmaapWebClient.class, true);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DmaapWebClient.class, true);
Mono<ClientRequest> logRequest = dmaapWebClientUndetTest.logRequest(clientRequesteMock);
assertEquals(clientRequesteMock, logRequest.block());
- assertEquals(logAppender.list.get(0).getLevel(), Level.TRACE);
+ assertEquals(Level.TRACE, logAppender.list.get(0).getLevel());
assertEquals("Request: GET http://test", logAppender.list.get(0).getFormattedMessage());
- assertEquals(logAppender.list.get(1).getLevel(), Level.TRACE);
+ assertEquals(Level.TRACE, logAppender.list.get(1).getLevel());
assertEquals("HTTP request headers: [header:\"value\"]", logAppender.list.get(1).getFormattedMessage());
logAppender.stop();
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/JsonMessageParserTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/JsonMessageParserTest.java
index cd18bfa2..cf0cfecf 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/JsonMessageParserTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/service/JsonMessageParserTest.java
@@ -203,7 +203,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectNextCount(0).verifyComplete();
@@ -235,7 +235,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectNextCount(0).verifyComplete();
@@ -320,7 +320,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectComplete().verify();
@@ -351,7 +351,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectNextCount(0).verifyComplete();
@@ -377,7 +377,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectNextCount(0).verifyComplete();
@@ -408,7 +408,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectNextCount(0).verifyComplete();
@@ -441,7 +441,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectNextCount(0).verifyComplete();
@@ -523,7 +523,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectComplete().verify();
@@ -542,7 +542,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectComplete().verify();
@@ -572,7 +572,7 @@ class JsonMessageParserTest {
Mockito.doReturn(Optional.of(jsonElement.getAsJsonObject())).when(jsonMessageParserUnderTest)
.getJsonObjectFromAnArray(jsonElement);
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(JsonMessageParser.class);
StepVerifier.create(jsonMessageParserUnderTest.getMessagesFromJson(Mono.just(jsonElement))).expectSubscription()
.expectNextCount(0).expectComplete().verify();
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/DataRouterPublisherTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/DataRouterPublisherTest.java
index fb369174..4a4c4e83 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/DataRouterPublisherTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/DataRouterPublisherTest.java
@@ -100,7 +100,7 @@ class DataRouterPublisherTest {
private static PublisherConfiguration publisherConfigurationMock = mock(PublisherConfiguration.class);
private static Map<String, String> context = new HashMap<>();
private static DataRouterPublisher publisherTaskUnderTestSpy;
- private static final Counters counters = new Counters();
+ private Counters counters;
@BeforeAll
public static void setUp() {
@@ -123,12 +123,12 @@ class DataRouterPublisherTest {
.changeIdentifier(CHANGE_IDENTIFIER) //
.build(); //
appConfig = mock(AppConfig.class);
- publisherTaskUnderTestSpy = spy(new DataRouterPublisher(appConfig, counters));
}
@BeforeEach
void setUpTest() {
- counters.clear();
+ counters = new Counters();
+ publisherTaskUnderTestSpy = spy(new DataRouterPublisher(appConfig, counters));
}
@Test
@@ -185,7 +185,7 @@ class DataRouterPublisherTest {
void whenPassedObjectFits_firstFailsWithExceptionThenSucceeds() throws Exception {
prepareMocksForTests(new DatafileTaskException("Error"), HttpStatus.OK.value());
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DataRouterPublisher.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DataRouterPublisher.class);
StepVerifier.create(publisherTaskUnderTestSpy.publishFile(filePublishInformation, 2, Duration.ofSeconds(0)))
.expectNext(filePublishInformation) //
.verifyComplete();
@@ -220,7 +220,7 @@ class DataRouterPublisherTest {
prepareMocksForTests(null, Integer.valueOf(HttpStatus.BAD_GATEWAY.value()),
Integer.valueOf((HttpStatus.BAD_GATEWAY.value())));
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DataRouterPublisher.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DataRouterPublisher.class);
StepVerifier.create(publisherTaskUnderTestSpy.publishFile(filePublishInformation, 1, Duration.ofSeconds(0)))
.expectErrorMessage("Retries exhausted: 1/1") //
.verify();
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollectorTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollectorTest.java
index 1ab97d4a..2534f645 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollectorTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/FileCollectorTest.java
@@ -96,7 +96,7 @@ public class FileCollectorTest {
private SftpClient sftpClientMock = mock(SftpClient.class);
private final Map<String, String> contextMap = new HashMap<>();
- private final Counters counters = new Counters();
+ private Counters counters;
private MessageMetaData createMessageMetaData() {
return ImmutableMessageMetaData.builder() //
@@ -153,7 +153,7 @@ public class FileCollectorTest {
@BeforeEach
void setUpTest() {
- counters.clear();
+ counters = new Counters();
}
@Test
@@ -175,8 +175,8 @@ public class FileCollectorTest {
verify(ftpsClientMock, times(1)).close();
verifyNoMoreInteractions(ftpsClientMock);
- assertEquals("collectedFiles should have been 1", counters.getNoOfCollectedFiles(), 1);
- assertEquals("failedFtpAttempts should have been 0", counters.getNoOfFailedFtpAttempts(), 0);
+ assertEquals("collectedFiles should have been 1", 1, counters.getNoOfCollectedFiles());
+ assertEquals("failedFtpAttempts should have been 0", 0, counters.getNoOfFailedFtpAttempts());
}
@Test
@@ -205,7 +205,7 @@ public class FileCollectorTest {
verify(sftpClientMock, times(2)).close();
verifyNoMoreInteractions(sftpClientMock);
- assertEquals("collectedFiles should have been 2", counters.getNoOfCollectedFiles(), 2);
+ assertEquals("collectedFiles should have been 2", 2, counters.getNoOfCollectedFiles());
}
@Test
@@ -223,8 +223,8 @@ public class FileCollectorTest {
verify(ftpsClientMock, times(4)).collectFile(REMOTE_FILE_LOCATION, LOCAL_FILE_LOCATION);
- assertEquals("collectedFiles should have been 0", counters.getNoOfCollectedFiles(), 0);
- assertEquals("failedFtpAttempts should have been 4", counters.getNoOfFailedFtpAttempts(), 4);
+ assertEquals("collectedFiles should have been 0", 0, counters.getNoOfCollectedFiles());
+ assertEquals("failedFtpAttempts should have been 4", 4, counters.getNoOfFailedFtpAttempts());
}
@Test
@@ -242,8 +242,8 @@ public class FileCollectorTest {
verify(ftpsClientMock, times(1)).collectFile(REMOTE_FILE_LOCATION, LOCAL_FILE_LOCATION);
- assertEquals("collectedFiles should have been 0", counters.getNoOfCollectedFiles(), 0);
- assertEquals("failedFtpAttempts should have been 1", counters.getNoOfFailedFtpAttempts(), 1);
+ assertEquals("collectedFiles should have been 0", 0, counters.getNoOfCollectedFiles());
+ assertEquals("failedFtpAttempts should have been 1", 1, counters.getNoOfFailedFtpAttempts());
}
@Test
@@ -264,7 +264,7 @@ public class FileCollectorTest {
verify(ftpsClientMock, times(2)).collectFile(REMOTE_FILE_LOCATION, LOCAL_FILE_LOCATION);
- assertEquals("collectedFiles should have been 1", counters.getNoOfCollectedFiles(), 1);
- assertEquals("failedFtpAttempts should have been 1", counters.getNoOfFailedFtpAttempts(), 1);
+ assertEquals("collectedFiles should have been 1", 1, counters.getNoOfCollectedFiles());
+ assertEquals("failedFtpAttempts should have been 1", 1, counters.getNoOfFailedFtpAttempts());
}
}
diff --git a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasksTest.java b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasksTest.java
index a0096b77..c77f5fc2 100644
--- a/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasksTest.java
+++ b/datafile-app-server/src/test/java/org/onap/dcaegen2/collectors/datafile/tasks/ScheduledTasksTest.java
@@ -290,7 +290,7 @@ public class ScheduledTasksTest {
Flux<FileReadyMessage> fileReadyMessages = fileReadyMessageFlux(noOfEvents, noOfFilesPerEvent, true);
doReturn(fileReadyMessages).when(consumerMock).getMessageRouterResponse();
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduledTasks.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduledTasks.class);
testedObject.executeDatafileMainTask();
await().untilAsserted(() -> assertEquals("currentNumberOfSubscriptions should have been 0", 0,
@@ -305,7 +305,7 @@ public class ScheduledTasksTest {
MDC.setContextMap(contextMap);
doReturn(Flux.error(new Exception("Failed"))).when(consumerMock).getMessageRouterResponse();
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduledTasks.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduledTasks.class);
StepVerifier //
.create(testedObject.createMainTask(contextMap)) //
.expectSubscription() //
@@ -417,7 +417,7 @@ public class ScheduledTasksTest {
.when(dataRouterMock) //
.publishFile(notNull(), anyLong(), notNull());
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduledTasks.class);
+ final ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ScheduledTasks.class);
StepVerifier //
.create(testedObject.createMainTask(contextMap)) //
.expectSubscription() //