From 3816ace5fa0030366383252b7f76fdb8476b3f86 Mon Sep 17 00:00:00 2001 From: Asif Sohail Mohammed Date: Fri, 27 May 2022 15:55:08 -0700 Subject: [PATCH] Removed unused mocks from S3Source tests Signed-off-by: Asif Sohail Mohammed --- .../dataprepper/plugins/source/SqsWorker.java | 14 -------------- .../plugins/source/S3SourceTest.java | 17 ----------------- 2 files changed, 31 deletions(-) diff --git a/data-prepper-plugins/s3-source/src/main/java/com/amazon/dataprepper/plugins/source/SqsWorker.java b/data-prepper-plugins/s3-source/src/main/java/com/amazon/dataprepper/plugins/source/SqsWorker.java index 5194220358..51a52a0947 100644 --- a/data-prepper-plugins/s3-source/src/main/java/com/amazon/dataprepper/plugins/source/SqsWorker.java +++ b/data-prepper-plugins/s3-source/src/main/java/com/amazon/dataprepper/plugins/source/SqsWorker.java @@ -64,20 +64,6 @@ public void run() { } } - -// try { -// ReceiveMessageRequest receiveMessageRequest = ReceiveMessageRequest.builder() -// .queueUrl(sqsOptions.getSqsUrl()) -// .maxNumberOfMessages(sqsOptions.getMaximumMessages()) -// .visibilityTimeout((int) sqsOptions.getVisibilityTimeout().getSeconds()) -// .waitTimeSeconds((int) sqsOptions.getWaitTime().getSeconds()) -// .build(); -// -// messages.addAll(sqsClient.receiveMessage(receiveMessageRequest).messages()); -// } catch (SqsException e) { -// LOG.error("Error reading from SQS: {}", e.awsErrorDetails().errorMessage()); -// } - // read each message as S3 event message List s3EventNotificationRecords = messages.stream() .map(this::convertS3EventMessages) diff --git a/data-prepper-plugins/s3-source/src/test/java/com/amazon/dataprepper/plugins/source/S3SourceTest.java b/data-prepper-plugins/s3-source/src/test/java/com/amazon/dataprepper/plugins/source/S3SourceTest.java index 99a00b3869..0b8b200433 100644 --- a/data-prepper-plugins/s3-source/src/test/java/com/amazon/dataprepper/plugins/source/S3SourceTest.java +++ b/data-prepper-plugins/s3-source/src/test/java/com/amazon/dataprepper/plugins/source/S3SourceTest.java @@ -31,8 +31,6 @@ class S3SourceTest { private BlockingBuffer> testBuffer; private PluginMetrics pluginMetrics; private S3SourceConfig s3SourceConfig; - private AwsAuthenticationOptions awsAuthenticationOptions; - private SqsOptions sqsOptions; @BeforeEach @@ -40,22 +38,7 @@ void setUp() { testBuffer = getBuffer(); pluginMetrics = PluginMetrics.fromNames(PLUGIN_NAME, TEST_PIPELINE_NAME); - awsAuthenticationOptions = mock(AwsAuthenticationOptions.class); - when(awsAuthenticationOptions.getAwsRegion()).thenReturn("us-east-1"); - when(awsAuthenticationOptions.getAwsStsRoleArn()).thenReturn(null); - - sqsOptions = mock(SqsOptions.class); - when(sqsOptions.getMaximumMessages()).thenReturn(10); - when(sqsOptions.getSqsUrl()).thenReturn("https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue"); - when(sqsOptions.getThreadCount()).thenReturn(1); - when(sqsOptions.getPollDelay()).thenReturn(Duration.ofSeconds(10)); - when(sqsOptions.getVisibilityTimeout()).thenReturn(Duration.ofSeconds(10)); - when(sqsOptions.getWaitTime()).thenReturn(Duration.ofSeconds(10)); - s3SourceConfig = mock(S3SourceConfig.class); - when(s3SourceConfig.getNotificationType()).thenReturn(NotificationTypeOption.SQS); - when(s3SourceConfig.getAWSAuthentication()).thenReturn(awsAuthenticationOptions); - when(s3SourceConfig.getSqsOptions()).thenReturn(sqsOptions); s3Source = new S3Source(pluginMetrics, s3SourceConfig); }