You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2021/01/14 12:26:24 UTC

[camel-kafka-connector] 07/14: Do fail the AWS S3 test on I/O error while reading the files

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git

commit bfa8e7cdea2466bcefde9ea20df823122ff57542
Author: Otavio Rodolfo Piske <op...@redhat.com>
AuthorDate: Wed Jan 13 15:14:35 2021 +0100

    Do fail the AWS S3 test on I/O error while reading the files
---
 .../aws/v2/s3/source/CamelSourceAWSS3ITCase.java              | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java
index 4169816..bae5c77 100644
--- a/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java
+++ b/tests/itests-aws-v2/src/test/java/org/apache/camel/kafkaconnector/aws/v2/s3/source/CamelSourceAWSS3ITCase.java
@@ -176,6 +176,10 @@ public class CamelSourceAWSS3ITCase extends AbstractKafkaTest {
         LOG.debug("Putting S3 objects");
 
         File[] files = path.listFiles();
+        if (files == null) {
+            fail("Either I/O error or the path used is not a directory");
+        }
+
         expect = files.length;
 
         if (files.length == 0) {
@@ -297,7 +301,12 @@ public class CamelSourceAWSS3ITCase extends AbstractKafkaTest {
 
         runTest(connectorPropertyFactory, () -> sendFilesFromPath(path));
 
-        assertEquals(path.list().length, received, "Didn't process the expected amount of messages");
+        String[] files = path.list();
+        if (files == null) {
+            fail("Either I/O error or the path used is not a directory");
+        }
+
+        assertEquals(files.length, received, "Didn't process the expected amount of messages");
     }
 
 }