diff --git a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/MultiLangRecordProcessorFactory.java b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/MultiLangRecordProcessorFactory.java index a1c01c51..c4aab958 100644 --- a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/MultiLangRecordProcessorFactory.java +++ b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/MultiLangRecordProcessorFactory.java @@ -19,7 +19,6 @@ import java.util.concurrent.ExecutorService; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; -import software.amazon.kinesis.coordinator.KinesisClientLibConfiguration; import software.amazon.kinesis.multilang.config.MultiLangDaemonConfiguration; import software.amazon.kinesis.processor.ShardRecordProcessorFactory; import software.amazon.kinesis.processor.ShardRecordProcessor; diff --git a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AWSCredentialsProviderPropertyValueDecoder.java b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AWSCredentialsProviderPropertyValueDecoder.java index da3db4fb..97fa975e 100644 --- a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AWSCredentialsProviderPropertyValueDecoder.java +++ b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/AWSCredentialsProviderPropertyValueDecoder.java @@ -22,8 +22,6 @@ import java.util.List; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.AWSCredentialsProviderChain; import lombok.extern.slf4j.Slf4j; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain; /** * Get AWSCredentialsProvider property. diff --git a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/BuilderDynaBean.java b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/BuilderDynaBean.java index 2e5502cd..2035695c 100644 --- a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/BuilderDynaBean.java +++ b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/BuilderDynaBean.java @@ -20,7 +20,6 @@ import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.function.Function; -import java.util.function.Supplier; import lombok.Getter; import org.apache.commons.beanutils.ConvertUtilsBean; @@ -150,7 +149,6 @@ public class BuilderDynaBean implements DynaBean { } else { return expected.cast(dynaBeanCreateSupport.build()); } - } private void validateResolvedEmptyHandler() { diff --git a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfigurator.java b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfigurator.java index c95d0853..5e2ddb1d 100644 --- a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfigurator.java +++ b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfigurator.java @@ -25,7 +25,6 @@ import org.apache.commons.beanutils.ConvertUtilsBean; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.Validate; import software.amazon.awssdk.arns.Arn; -import software.amazon.awssdk.regions.Region; import software.amazon.kinesis.common.StreamIdentifier; /** @@ -42,7 +41,6 @@ public class KinesisClientLibConfigurator { private final BeanUtilsBean utilsBean; private final MultiLangDaemonConfiguration configuration; - /** * Constructor. */ @@ -78,7 +76,6 @@ public class KinesisClientLibConfigurator { //Parse out the stream Name from the Arn (and/or override existing value for Stream Name) final String streamNameFromArn = streamArnObj.resource().resource(); configuration.setStreamName(streamNameFromArn); - } Validate.notBlank(configuration.getStreamName(), "Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); @@ -109,5 +106,4 @@ public class KinesisClientLibConfigurator { return getConfiguration(properties); } - -} \ No newline at end of file +} diff --git a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/MultiLangDaemonConfiguration.java b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/MultiLangDaemonConfiguration.java index 7a7f2e79..d8f58741 100644 --- a/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/MultiLangDaemonConfiguration.java +++ b/amazon-kinesis-client-multilang/src/main/java/software/amazon/kinesis/multilang/config/MultiLangDaemonConfiguration.java @@ -158,7 +158,6 @@ public class MultiLangDaemonConfiguration { metricsEnabledDimensions = new HashSet<>(Arrays.asList(dimensions)); } - private RetrievalMode retrievalMode = RetrievalMode.DEFAULT; private final FanoutConfigBean fanoutConfig = new FanoutConfigBean(); @@ -170,7 +169,6 @@ public class MultiLangDaemonConfiguration { private long shutdownGraceMillis; private Integer timeoutInSeconds; - private final BuilderDynaBean kinesisCredentialsProvider; public void setAWSCredentialsProvider(String providerString) { diff --git a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MessageWriterTest.java b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MessageWriterTest.java index c997c193..588f6140 100644 --- a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MessageWriterTest.java +++ b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MessageWriterTest.java @@ -51,8 +51,6 @@ public class MessageWriterTest { @Rule public final ExpectedException thrown = ExpectedException.none(); - // ExecutorService executor; - @Before public void setup() { stream = Mockito.mock(OutputStream.class); diff --git a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangProtocolTest.java b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangProtocolTest.java index d385b2f9..5320aec5 100644 --- a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangProtocolTest.java +++ b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangProtocolTest.java @@ -103,7 +103,7 @@ public class MultiLangProtocolTest { } @Test - public void initializeTest() throws InterruptedException, ExecutionException { + public void testInitialize() { when(messageWriter .writeInitializeMessage(argThat(Matchers.withInit(InitializationInput.builder() .shardId(shardId).build())))).thenReturn(buildFuture(true)); @@ -113,7 +113,7 @@ public class MultiLangProtocolTest { } @Test - public void processRecordsTest() throws InterruptedException, ExecutionException { + public void testProcessRecords() { when(messageWriter.writeProcessRecordsMessage(any(ProcessRecordsInput.class))).thenReturn(buildFuture(true)); when(messageReader.getNextMessageFromSTDOUT()).thenReturn(buildFuture( new StatusMessage("processRecords"), Message.class)); @@ -128,7 +128,6 @@ public class MultiLangProtocolTest { when(messageReader.getNextMessageFromSTDOUT()).thenReturn(buildFuture(new StatusMessage(LeaseLostMessage.ACTION), Message.class)); assertThat(protocol.leaseLost(LeaseLostInput.builder().build()), equalTo(true)); - } @Test @@ -174,7 +173,7 @@ public class MultiLangProtocolTest { } @Test - public void processRecordsWithCheckpointsTest() throws InterruptedException, ExecutionException, + public void testProcessRecordsWithCheckpoints() throws KinesisClientLibDependencyException, InvalidStateException, ThrottlingException, ShutdownException { when(messageWriter.writeProcessRecordsMessage(any(ProcessRecordsInput.class))).thenReturn(buildFuture(true)); @@ -203,7 +202,7 @@ public class MultiLangProtocolTest { } @Test - public void processRecordsWithABadCheckpointTest() throws InterruptedException, ExecutionException { + public void testProcessRecordsWithABadCheckpoint() { when(messageWriter.writeProcessRecordsMessage(any(ProcessRecordsInput.class))).thenReturn(buildFuture(true)); when(messageWriter.writeCheckpointMessageWithError(anyString(), anyLong(), any(Throwable.class))).thenReturn(buildFuture(false)); when(messageReader.getNextMessageFromSTDOUT()).thenAnswer(buildMessageAnswers(new ArrayList() { diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/leases/MultiStreamLease.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/leases/MultiStreamLease.java index c8811354..c79cc458 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/leases/MultiStreamLease.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/leases/MultiStreamLease.java @@ -23,8 +23,6 @@ import lombok.Setter; import lombok.experimental.Accessors; import org.apache.commons.lang3.Validate; -import java.util.Objects; - import static com.google.common.base.Verify.verifyNotNull; @Setter diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/metrics/MetricDatumWithKey.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/metrics/MetricDatumWithKey.java index da83675f..e94c8730 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/metrics/MetricDatumWithKey.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/metrics/MetricDatumWithKey.java @@ -15,7 +15,6 @@ package software.amazon.kinesis.metrics; import lombok.AllArgsConstructor; -import lombok.Data; import lombok.Setter; import lombok.experimental.Accessors; import software.amazon.awssdk.services.cloudwatch.model.MetricDatum; @@ -29,11 +28,11 @@ import java.util.Objects; * @param is a class that stores information about a MetricDatum. This is useful * to compare MetricDatums, aggregate similar MetricDatums or store information about a datum * that may be relevant to the user (i.e. MetricName, CustomerId, TimeStamp, etc). - * + * * Example: - * + * * Let SampleMetricKey be a KeyType that takes in the time in which the datum was created. - * + * * MetricDatumWithKey sampleDatumWithKey = new MetricDatumWithKey(new * SampleMetricKey(System.currentTimeMillis()), datum) */ diff --git a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java index ca4ce12d..7177211f 100644 --- a/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java +++ b/amazon-kinesis-client/src/main/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisher.java @@ -27,14 +27,12 @@ import org.reactivestreams.Subscriber; import org.reactivestreams.Subscription; import software.amazon.awssdk.core.async.SdkPublisher; import software.amazon.awssdk.services.kinesis.KinesisAsyncClient; -import software.amazon.awssdk.services.kinesis.model.ChildShard; import software.amazon.awssdk.services.kinesis.model.ResourceNotFoundException; import software.amazon.awssdk.services.kinesis.model.SubscribeToShardEvent; import software.amazon.awssdk.services.kinesis.model.SubscribeToShardEventStream; import software.amazon.awssdk.services.kinesis.model.SubscribeToShardRequest; import software.amazon.awssdk.services.kinesis.model.SubscribeToShardResponse; import software.amazon.awssdk.services.kinesis.model.SubscribeToShardResponseHandler; -import software.amazon.awssdk.utils.CollectionUtils; import software.amazon.awssdk.utils.Either; import software.amazon.kinesis.annotations.KinesisClientInternalApi; import software.amazon.kinesis.common.InitialPositionInStreamExtended; @@ -117,7 +115,6 @@ public class FanOutRecordsPublisher implements RecordsPublisher { this.currentSequenceNumber = extendedSequenceNumber.sequenceNumber(); this.isFirstConnection = true; } - } @Override @@ -276,7 +273,6 @@ public class FanOutRecordsPublisher implements RecordsPublisher { SubscriptionShutdownEvent(Runnable subscriptionShutdownAction, String eventIdentifier) { this(subscriptionShutdownAction, eventIdentifier, null); } - } private boolean hasValidSubscriber() { diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/checkpoint/InMemoryCheckpointer.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/checkpoint/InMemoryCheckpointer.java index a2d83568..2a93e83d 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/checkpoint/InMemoryCheckpointer.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/checkpoint/InMemoryCheckpointer.java @@ -17,7 +17,6 @@ package software.amazon.kinesis.checkpoint; import java.util.HashMap; import java.util.Map; -import software.amazon.kinesis.exceptions.KinesisClientLibException; import software.amazon.kinesis.processor.Checkpointer; import software.amazon.kinesis.retrieval.kpl.ExtendedSequenceNumber; diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/config/KCLAppConfig.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/config/KCLAppConfig.java index b67efa10..5365ca4f 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/config/KCLAppConfig.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/config/KCLAppConfig.java @@ -29,7 +29,6 @@ import java.io.IOException; import java.net.Inet4Address; import java.net.URISyntaxException; import java.net.UnknownHostException; -import java.util.Optional; /** * Default configuration for a producer or consumer used in integration tests. @@ -81,7 +80,6 @@ public abstract class KCLAppConfig { } public final KinesisAsyncClient buildAsyncKinesisClient() throws URISyntaxException, IOException { - if (kinesisAsyncClient == null) { // Setup H2 client config. final NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder() diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/GracefulShutdownCoordinatorTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/GracefulShutdownCoordinatorTest.java index 84dcaa9c..44c7272c 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/GracefulShutdownCoordinatorTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/GracefulShutdownCoordinatorTest.java @@ -15,12 +15,10 @@ package software.amazon.kinesis.coordinator; import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyLong; import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/WorkerTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/WorkerTest.java index 17cad629..ec076e8d 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/WorkerTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/coordinator/WorkerTest.java @@ -14,8 +14,6 @@ */ package software.amazon.kinesis.coordinator; -import java.util.concurrent.ThreadPoolExecutor; - /** * Unit tests of Worker. */ diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/LeaseIntegrationBillingModePayPerRequestTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/LeaseIntegrationBillingModePayPerRequestTest.java index 9f7735f9..128d347a 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/LeaseIntegrationBillingModePayPerRequestTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/LeaseIntegrationBillingModePayPerRequestTest.java @@ -15,16 +15,8 @@ package software.amazon.kinesis.leases; import lombok.extern.slf4j.Slf4j; -import org.junit.Rule; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; -import org.mockito.Mock; -import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; -import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient; import software.amazon.awssdk.services.dynamodb.model.BillingMode; import software.amazon.kinesis.leases.dynamodb.DynamoDBLeaseRefresher; -import software.amazon.kinesis.leases.dynamodb.DynamoDBLeaseSerializer; -import software.amazon.kinesis.leases.dynamodb.TableCreatorCallback; @Slf4j public class LeaseIntegrationBillingModePayPerRequestTest extends LeaseIntegrationTest { diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/ShardInfoTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/ShardInfoTest.java index 276f6c25..4ccafe52 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/ShardInfoTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/ShardInfoTest.java @@ -26,11 +26,9 @@ import java.util.List; import java.util.Set; import java.util.UUID; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import software.amazon.kinesis.leases.ShardInfo; import software.amazon.kinesis.retrieval.kpl.ExtendedSequenceNumber; public class ShardInfoTest { diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseCoordinatorIntegrationTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseCoordinatorIntegrationTest.java index d89c010e..05d4ba74 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseCoordinatorIntegrationTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseCoordinatorIntegrationTest.java @@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseRefresherTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseRefresherTest.java index 643cc99c..102a9f17 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseRefresherTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseRefresherTest.java @@ -26,7 +26,6 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -158,7 +157,6 @@ public class DynamoDBLeaseRefresherTest { verify(mockScanFuture, times(2)).get(anyLong(), any(TimeUnit.class)); verify(dynamoDbClient, times(2)).scan(any(ScanRequest.class)); - } @Test diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseTakerIntegrationTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseTakerIntegrationTest.java index 475f1940..772aa542 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseTakerIntegrationTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/leases/dynamodb/DynamoDBLeaseTakerIntegrationTest.java @@ -15,9 +15,7 @@ package software.amazon.kinesis.leases.dynamodb; import java.util.Collection; -import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -153,7 +151,6 @@ public class DynamoDBLeaseTakerIntegrationTest extends LeaseIntegrationTest { assertThat(addedLeases.values().containsAll(allLeases), equalTo(true)); } - /** * Sets the leaseDurationMillis to 0, ensuring a get request to update the existing lease after computing * leases to take diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/BlockOnParentShardTaskTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/BlockOnParentShardTaskTest.java index 06a72230..61473833 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/BlockOnParentShardTaskTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/BlockOnParentShardTaskTest.java @@ -22,7 +22,6 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import org.junit.Before; import org.junit.Test; @@ -43,7 +42,7 @@ public class BlockOnParentShardTaskTest { private final String shardId = "shardId-97"; private final String streamId = "123:stream:146"; private final String concurrencyToken = "testToken"; - private final List emptyParentShardIds = new ArrayList(); + private final List emptyParentShardIds = new ArrayList<>(); private ShardInfo shardInfo; @Before @@ -77,7 +76,6 @@ public class BlockOnParentShardTaskTest { @Test public final void testCallShouldNotThrowBlockedOnParentWhenParentsHaveFinished() throws DependencyException, InvalidStateException, ProvisionedThroughputException { - ShardInfo shardInfo = null; BlockOnParentShardTask task = null; String parent1ShardId = "shardId-1"; @@ -118,7 +116,6 @@ public class BlockOnParentShardTaskTest { @Test public final void testCallShouldNotThrowBlockedOnParentWhenParentsHaveFinishedMultiStream() throws DependencyException, InvalidStateException, ProvisionedThroughputException { - ShardInfo shardInfo = null; BlockOnParentShardTask task = null; String parent1LeaseKey = streamId + ":" + "shardId-1"; @@ -162,7 +159,6 @@ public class BlockOnParentShardTaskTest { @Test public final void testCallWhenParentsHaveNotFinished() throws DependencyException, InvalidStateException, ProvisionedThroughputException { - ShardInfo shardInfo = null; BlockOnParentShardTask task = null; String parent1ShardId = "shardId-1"; diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriberTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriberTest.java index 09ba6ec9..4299c163 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriberTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/lifecycle/ShardConsumerSubscriberTest.java @@ -35,7 +35,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import java.util.Optional; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -173,7 +172,6 @@ public class ShardConsumerSubscriberTest { assertThat(subscriber.getAndResetDispatchFailure(), nullValue()); verify(shardConsumer, times(20)).handleInput(argThat(eqProcessRecordsInput(processRecordsInput)), any(Subscription.class)); - } @Test @@ -293,12 +291,10 @@ public class ShardConsumerSubscriberTest { assertThat(received.size(), equalTo(recordsPublisher.responses.size())); Stream.iterate(0, i -> i + 1).limit(received.size()).forEach(i -> assertThat(received.get(i), eqProcessRecordsInput(recordsPublisher.responses.get(i).recordsRetrieved.processRecordsInput()))); - } @Test public void restartAfterRequestTimerExpiresWhenNotGettingRecordsAfterInitialization() throws Exception { - executorService = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder() .setNameFormat("test-" + testName.getMethodName() + "-%04d").setDaemon(true).build()); @@ -347,12 +343,10 @@ public class ShardConsumerSubscriberTest { assertThat(received.size(), equalTo(recordsPublisher.responses.size())); Stream.iterate(0, i -> i + 1).limit(received.size()).forEach(i -> assertThat(received.get(i), eqProcessRecordsInput(recordsPublisher.responses.get(i).recordsRetrieved.processRecordsInput()))); - } @Test public void restartAfterRequestTimerExpiresWhenInitialTaskExecutionIsRejected() throws Exception { - executorService = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder() .setNameFormat("test-" + testName.getMethodName() + "-%04d").setDaemon(true).build()); @@ -405,7 +399,6 @@ public class ShardConsumerSubscriberTest { assertThat(received.size(), equalTo(recordsPublisher.responses.size())); Stream.iterate(0, i -> i + 1).limit(received.size()).forEach(i -> assertThat(received.get(i), eqProcessRecordsInput(recordsPublisher.responses.get(i).recordsRetrieved.processRecordsInput()))); - } private Object directlyExecuteRunnable(InvocationOnMock invocation) { @@ -623,8 +616,6 @@ public class ShardConsumerSubscriberTest { /** * Test to validate the warning message from ShardConsumer is not suppressed with the default configuration of 0 - * - * @throws Exception */ @Test public void noLoggingSuppressionNeededOnHappyPathTest() { @@ -648,8 +639,6 @@ public class ShardConsumerSubscriberTest { /** * Test to validate the warning message from ShardConsumer is not suppressed with the default configuration of 0 - * - * @throws Exception */ @Test public void loggingNotSuppressedAfterTimeoutTest() { @@ -677,8 +666,6 @@ public class ShardConsumerSubscriberTest { /** * Test to validate the warning message from ShardConsumer is successfully supressed if we only have intermittant * readTimeouts. - * - * @throws Exception */ @Test public void loggingSuppressedAfterIntermittentTimeoutTest() { @@ -705,8 +692,6 @@ public class ShardConsumerSubscriberTest { /** * Test to validate the warning message from ShardConsumer is successfully logged if multiple sequential timeouts * occur. - * - * @throws Exception */ @Test public void loggingPartiallySuppressedAfterMultipleTimeoutTest() { @@ -733,8 +718,6 @@ public class ShardConsumerSubscriberTest { /** * Test to validate the warning message from ShardConsumer is successfully logged if sequential timeouts occur. - * - * @throws Exception */ @Test public void loggingPartiallySuppressedAfterConsecutiveTimeoutTest() { @@ -763,8 +746,6 @@ public class ShardConsumerSubscriberTest { /** * Test to validate the non-timeout warning message from ShardConsumer is not suppressed with the default * configuration of 0 - * - * @throws Exception */ @Test public void loggingNotSuppressedOnNonReadTimeoutExceptionNotIgnoringReadTimeoutsExceptionTest() { @@ -792,12 +773,9 @@ public class ShardConsumerSubscriberTest { /** * Test to validate the non-timeout warning message from ShardConsumer is not suppressed with 2 ReadTimeouts to * ignore - * - * @throws Exception */ @Test public void loggingNotSuppressedOnNonReadTimeoutExceptionIgnoringReadTimeoutsTest() { - // We're not throwing a ReadTimeout, so no suppression is expected. // The test expects a non-ReadTimeout exception to be thrown on requests 3 and 5, and we expect logs on // each Non-ReadTimeout Exception, no matter what the number of ReadTimeoutsToIgnore we pass in, diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutConsumerRegistrationTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutConsumerRegistrationTest.java index 245e22d5..fca6799d 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutConsumerRegistrationTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutConsumerRegistrationTest.java @@ -19,7 +19,6 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.junit.Assert.assertThat; import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -28,7 +27,6 @@ import static org.mockito.Mockito.when; import java.util.concurrent.CompletableFuture; import org.apache.commons.lang3.StringUtils; -import org.hamcrest.Matchers; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisherTest.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisherTest.java index 0f8e628e..9615794b 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisherTest.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/retrieval/fanout/FanOutRecordsPublisherTest.java @@ -8,7 +8,6 @@ import io.reactivex.rxjava3.schedulers.Schedulers; import io.reactivex.rxjava3.subscribers.SafeSubscriber; import lombok.Data; import lombok.RequiredArgsConstructor; -import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.hamcrest.Description; import org.hamcrest.Matcher; @@ -54,7 +53,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Optional; import java.util.concurrent.BlockingQueue; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; @@ -77,7 +75,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.never; @@ -172,7 +169,6 @@ public class FanOutRecordsPublisherTest { assertThat(clientRecordsList.get(i), matchers.get(i)); } }); - } @Test @@ -239,7 +235,6 @@ public class FanOutRecordsPublisherTest { assertThat(clientRecordsList.get(i), matchers.get(i)); } }); - } @Test @@ -317,11 +312,10 @@ public class FanOutRecordsPublisherTest { }); assertThat(source.getCurrentSequenceNumber(), equalTo("3000")); - } @Test - public void testIfEventsAreNotDeliveredToShardConsumerWhenPreviousEventDeliveryTaskGetsRejected() throws Exception { + public void testIfEventsAreNotDeliveredToShardConsumerWhenPreviousEventDeliveryTaskGetsRejected() { FanOutRecordsPublisher source = new FanOutRecordsPublisher(kinesisClient, SHARD_ID, CONSUMER_ARN); ArgumentCaptor captor = ArgumentCaptor @@ -395,7 +389,6 @@ public class FanOutRecordsPublisherTest { }); assertThat(source.getCurrentSequenceNumber(), equalTo("1000")); - } @Test @@ -489,12 +482,10 @@ public class FanOutRecordsPublisherTest { }); assertThat(source.getCurrentSequenceNumber(), equalTo(totalServicePublisherEvents + "")); - } @Test public void testIfStreamOfEventsAndOnCompleteAreDeliveredInOrderWithBackpressureAdheringServicePublisher() throws Exception { - CountDownLatch onS2SCallLatch = new CountDownLatch(2); doAnswer(new Answer() { @@ -601,7 +592,6 @@ public class FanOutRecordsPublisherTest { // Let's wait for sometime to allow the publisher to re-subscribe onS2SCallLatch.await(5000, TimeUnit.MILLISECONDS); verify(kinesisClient, times(2)).subscribeToShard(any(SubscribeToShardRequest.class), flowCaptor.capture()); - } @Test @@ -730,7 +720,6 @@ public class FanOutRecordsPublisherTest { // With shard end event, onComplete must be propagated to the subscriber. onCompleteLatch.await(5000, TimeUnit.MILLISECONDS); assertTrue("OnComplete should be triggered", isOnCompleteTriggered[0]); - } @Test @@ -834,7 +823,6 @@ public class FanOutRecordsPublisherTest { assertThat(source.getCurrentSequenceNumber(), equalTo(triggerErrorAtNthEvent + "")); onErrorReceiveLatch.await(5000, TimeUnit.MILLISECONDS); assertTrue("OnError should have been thrown", isOnErrorThrown[0]); - } @Test @@ -928,7 +916,6 @@ public class FanOutRecordsPublisherTest { }); assertThat(source.getCurrentSequenceNumber(), equalTo(totalServicePublisherEvents + "")); - } @Test @@ -1131,7 +1118,6 @@ public class FanOutRecordsPublisherTest { assertThat(clientRecordsList.get(i), matchers.get(i)); } }); - } @Test @@ -1247,7 +1233,6 @@ public class FanOutRecordsPublisherTest { verifyRecords(nonFailingSubscriber.received.get(0).records(), matchers); verifyRecords(nonFailingSubscriber.received.get(1).records(), nextMatchers); - } @Test @@ -1467,7 +1452,6 @@ public class FanOutRecordsPublisherTest { assertThat(onErrorEvent, equalTo(Optional.of(new OnErrorEvent(exception)))); assertThat(acquireTimeoutLogged.get(), equalTo(true)); - } private void verifyRecords(List clientRecordsList, List matchers) { diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/AWSResourceManager.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/AWSResourceManager.java index 3314f922..4a6bcfaf 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/AWSResourceManager.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/AWSResourceManager.java @@ -2,14 +2,8 @@ package software.amazon.kinesis.utils; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; -import software.amazon.awssdk.services.dynamodb.model.ListTablesRequest; -import software.amazon.awssdk.services.dynamodb.model.ListTablesResponse; -import software.amazon.kinesis.common.FutureUtils; -import java.time.Duration; -import java.util.ArrayList; import java.util.List; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @Slf4j @@ -28,7 +22,7 @@ public abstract class AWSResourceManager { /** * Get a list of all the names of resources of a specified type - * @return + * * @throws Exception */ public abstract List getAllResourceNames() throws Exception; diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/LeaseTableManager.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/LeaseTableManager.java index e8d1cb05..40d711bd 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/LeaseTableManager.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/LeaseTableManager.java @@ -12,8 +12,6 @@ import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException; import software.amazon.awssdk.services.dynamodb.model.TableStatus; import software.amazon.kinesis.common.FutureUtils; -import java.io.IOException; -import java.net.URISyntaxException; import java.time.Duration; import java.util.ArrayList; import java.util.List; diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/StreamExistenceManager.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/StreamExistenceManager.java index eeffb36b..b5f06b78 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/StreamExistenceManager.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/utils/StreamExistenceManager.java @@ -2,8 +2,6 @@ package software.amazon.kinesis.utils; import lombok.Value; import lombok.extern.slf4j.Slf4j; -import software.amazon.awssdk.services.dynamodb.model.ListTablesRequest; -import software.amazon.awssdk.services.dynamodb.model.ListTablesResponse; import software.amazon.awssdk.services.kinesis.KinesisAsyncClient; import software.amazon.awssdk.services.kinesis.model.CreateStreamRequest; import software.amazon.awssdk.services.kinesis.model.DeleteStreamRequest; diff --git a/checkstyle/checkstyle.xml b/checkstyle/checkstyle.xml index 0186a496..10031e23 100644 --- a/checkstyle/checkstyle.xml +++ b/checkstyle/checkstyle.xml @@ -36,6 +36,7 @@ +