Skip to content

Commit

Permalink
Removed unused mocks from S3Source tests
Browse files Browse the repository at this point in the history
Signed-off-by: Asif Sohail Mohammed <nsifmoh@amazon.com>
  • Loading branch information
asifsmohammed committed May 27, 2022
1 parent 824eee3 commit 3816ace
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<S3EventNotification.S3EventNotificationRecord> s3EventNotificationRecords = messages.stream()
.map(this::convertS3EventMessages)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,14 @@ class S3SourceTest {
private BlockingBuffer<Record<Event>> testBuffer;
private PluginMetrics pluginMetrics;
private S3SourceConfig s3SourceConfig;
private AwsAuthenticationOptions awsAuthenticationOptions;
private SqsOptions sqsOptions;


@BeforeEach
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);
}
Expand Down

0 comments on commit 3816ace

Please sign in to comment.