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 42fdc295..3a636c6c 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 @@ -72,29 +72,35 @@ public class KinesisClientLibConfigurator { Validate.notBlank(configuration.getApplicationName(), "Application name is required"); if (configuration.getStreamArn() != null && !configuration.getStreamArn().trim().isEmpty()) { - Arn streamArnObj = Arn.fromString(configuration.getStreamArn()); - if(!streamArnObj.resource().resourceType().get().equalsIgnoreCase("stream")){ + final Arn streamArnObj = Arn.fromString(configuration.getStreamArn()); + + final String resourceType = streamArnObj.resource().resourceType().get(); + if (!"stream".equalsIgnoreCase(resourceType)) { throw new IllegalArgumentException(String.format("StreamArn has unsupported resource type of '%s'. Expected: stream", - streamArnObj.resource().resourceType().get())); + resourceType)); } - if(!streamArnObj.service().equalsIgnoreCase("kinesis")){ + final String arnService = streamArnObj.service(); + if (!"kinesis".equalsIgnoreCase(arnService)) { throw new IllegalArgumentException(String.format("StreamArn has unsupported service type of '%s'. Expected: kinesis", - streamArnObj.service())); + arnService)); } //Parse out the stream Name from the Arn (and/or override existing value for Stream Name) - String streamNameFromArn = streamArnObj.resource().resource(); + final String streamNameFromArn = streamArnObj.resource().resource(); configuration.setStreamName(streamNameFromArn); - //Parse out the region from the Arn and set (and/or override existing value for region) - Region regionObj = Region.of(streamArnObj.region().get()); - if(Region.regions().stream().filter(x -> x.id().equalsIgnoreCase(regionObj.id())).count() == 0){ - throw new IllegalArgumentException(String.format("StreamArn has unsupported region of '%s'.", regionObj.id())); - } - configuration.setRegionName(regionObj); } else { Validate.notBlank(configuration.getStreamName(), "Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); } Validate.isTrue(configuration.getKinesisCredentialsProvider().isDirty(), "A basic set of AWS credentials must be provided"); + + //Verify Region is real + if(configuration.getKinesisClient().get("region") == null){ + throw new NullPointerException("regionName must be passed in"); + } + final String regionCode = configuration.getKinesisClient().get("region").toString(); + if (Region.regions().stream().filter(x -> x.id().equalsIgnoreCase(regionCode)).count() == 0) { + throw new IllegalArgumentException(String.format("Unsupported region: %s", regionCode)); + } return configuration; } diff --git a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangDaemonConfigTest.java b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangDaemonConfigTest.java index 188fcd30..74154599 100644 --- a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangDaemonConfigTest.java +++ b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/MultiLangDaemonConfigTest.java @@ -36,16 +36,16 @@ import software.amazon.kinesis.multilang.config.KinesisClientLibConfigurator; @RunWith(MockitoJUnitRunner.class) public class MultiLangDaemonConfigTest { - private static String FILENAME = "some.properties"; - private static String TestExe = "TestExe.exe"; - private static String TestApplicationName = "TestApp"; - private static String TestStreamName = "fakeStream"; - private static String TestStreamNameInArn = "FAKE_STREAM_NAME"; - private static String TestRegion = "us-east-1"; - private static String TestRegionInArn = "us-east-2"; + private static final String TEST_FILENAME = "some.properties"; + private static final String TEST_EXE = "TestExe.exe"; + private static final String TEST_APPLICATION_NAME = "TestApp"; + private static final String TEST_STREAM_NAME = "fakeStream"; + private static final String TEST_STREAM_NAME_IN_ARN = "FAKE_STREAM_NAME"; + private static final String TEST_REGION = "us-east-1"; + private static final String TEST_REGION_IN_ARN = "us-east-2"; private static String getTestStreamArn(){ - return String.format("arn:aws:kinesis:%s:ACCOUNT_ID:stream/%s", TestRegionInArn, TestStreamNameInArn); + return String.format("arn:aws:kinesis:%s:ACCOUNT_ID:stream/%s", TEST_REGION_IN_ARN, TEST_STREAM_NAME_IN_ARN); } @Mock @@ -55,140 +55,146 @@ public class MultiLangDaemonConfigTest { private AwsCredentialsProvider credentialsProvider; @Mock private AwsCredentials creds; - @Mock + private KinesisClientLibConfigurator configurator; + private MultiLangDaemonConfig deamonConfig; @Rule public final ExpectedException thrown = ExpectedException.none(); - public void setup(String streamName, String streamArn) { + public void setup(String streamName, String streamArn, String regionName) throws IOException { - String PROPERTIES = String.format("executableName = %s\n" + String properties = String.format("executableName = %s\n" + "applicationName = %s\n" + "AWSCredentialsProvider = DefaultAWSCredentialsProviderChain\n" + "processingLanguage = malbolge\n" + "regionName = %s\n", - TestExe, - TestApplicationName, - TestRegion); + TEST_EXE, + TEST_APPLICATION_NAME, + regionName); - if(streamName != null){ - PROPERTIES += String.format("streamName = %s\n", streamName); + if (streamName != null) { + properties += String.format("streamName = %s\n", streamName); } - if(streamArn != null){ - PROPERTIES += String.format("streamArn = %s\n", streamArn); + if (streamArn != null) { + properties += String.format("streamArn = %s\n", streamArn); } classLoader = Mockito.mock(ClassLoader.class); - Mockito.doReturn(new ByteArrayInputStream(PROPERTIES.getBytes())).when(classLoader) - .getResourceAsStream(FILENAME); + Mockito.doReturn(new ByteArrayInputStream(properties.getBytes())).when(classLoader) + .getResourceAsStream(TEST_FILENAME); when(credentialsProvider.resolveCredentials()).thenReturn(creds); when(creds.accessKeyId()).thenReturn("cool-user"); configurator = new KinesisClientLibConfigurator(); + deamonConfig = new MultiLangDaemonConfig(TEST_FILENAME, classLoader, configurator); } @Test public void testConstructorFailsBecauseStreamArnIsInvalid() throws Exception { - setup("", "this_is_not_a_valid_arn"); - assertConstructorThrowsException(IllegalArgumentException.class, "Malformed ARN - doesn't start with 'arn:"); + thrown.expect(IllegalArgumentException.class); + thrown.expectMessage("Malformed ARN - doesn't start with 'arn:"); + + setup("", "this_is_not_a_valid_arn", TEST_REGION); } @Test public void testConstructorFailsBecauseStreamArnHasInvalidRegion() throws Exception { - setup("", "arn:aws:kinesis:us-east-1000:ACCOUNT_ID:stream/streamName"); - assertConstructorThrowsException(IllegalArgumentException.class, "StreamArn has unsupported region of 'us-east-1000'."); + thrown.expect(IllegalArgumentException.class); + thrown.expectMessage("Unsupported region: us-east-1000"); + + setup("", "arn:aws:kinesis:us-east-1:ACCOUNT_ID:stream/streamName", "us-east-1000"); } @Test public void testConstructorFailsBecauseStreamArnHasInvalidResourceType() throws Exception { - setup("", "arn:aws:kinesis:us-EAST-1:ACCOUNT_ID:dynamodb/streamName"); - assertConstructorThrowsException(IllegalArgumentException.class, "StreamArn has unsupported resource type of 'dynamodb'. Expected: stream"); + thrown.expect(IllegalArgumentException.class); + thrown.expectMessage("StreamArn has unsupported resource type of 'dynamodb'. Expected: stream"); + + setup("", "arn:aws:kinesis:us-EAST-1:ACCOUNT_ID:dynamodb/streamName", TEST_REGION); } @Test public void testConstructorFailsBecauseStreamArnHasInvalidService() throws Exception { - setup("", "arn:aws:kinesisFakeService:us-east-1:ACCOUNT_ID:stream/streamName"); - assertConstructorThrowsException(IllegalArgumentException.class, "StreamArn has unsupported service type of 'kinesisFakeService'. Expected: kinesis"); + thrown.expect(IllegalArgumentException.class); + thrown.expectMessage("StreamArn has unsupported service type of 'kinesisFakeService'. Expected: kinesis"); + + setup("", "arn:aws:kinesisFakeService:us-east-1:ACCOUNT_ID:stream/streamName", TEST_REGION); } @Test public void testConstructorFailsBecauseStreamNameAndArnAreEmpty() throws Exception { - setup("", ""); - assertConstructorThrowsException(IllegalArgumentException.class, "Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + thrown.expect(IllegalArgumentException.class); + thrown.expectMessage("Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + + setup("", "", TEST_REGION); } @Test public void testConstructorFailsBecauseStreamNameAndArnAreNull() throws Exception { - setup(null, null); - assertConstructorThrowsException(NullPointerException.class, "Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + thrown.expect(NullPointerException.class); + thrown.expectMessage("Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + + setup(null, null, TEST_REGION); } @Test public void testConstructorFailsBecauseStreamNameIsNullAndArnIsEmpty() throws Exception { - setup(null, ""); - assertConstructorThrowsException(NullPointerException.class, "Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + thrown.expect(NullPointerException.class); + thrown.expectMessage("Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + + setup(null, "", TEST_REGION); } @Test public void testConstructorFailsBecauseStreamNameIsEmptyAndArnIsNull() throws Exception { - setup("", null); - assertConstructorThrowsException(IllegalArgumentException.class, "Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + thrown.expect(IllegalArgumentException.class); + thrown.expectMessage("Stream name or Stream Arn is required. Stream Arn takes precedence if both are passed in."); + + setup("", null, TEST_REGION); } @Test public void testConstructorUsingStreamName() throws IOException { - setup(TestStreamName, null); + setup(TEST_STREAM_NAME, null, TEST_REGION); - MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator); - - assertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamName, TestRegion, null); + assertConfigurationsMatch(deamonConfig, TEST_EXE, TEST_APPLICATION_NAME, TEST_STREAM_NAME, TEST_REGION, null); } @Test public void testConstructorUsingStreamNameAndStreamArnIsEmpty() throws IOException { - setup(TestStreamName, ""); + setup(TEST_STREAM_NAME, "", TEST_REGION); - MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator); - - assertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamName, TestRegion, ""); + assertConfigurationsMatch(deamonConfig, TEST_EXE, TEST_APPLICATION_NAME, TEST_STREAM_NAME, TEST_REGION, ""); } @Test public void testConstructorUsingStreamNameAndStreamArnIsWhitespace() throws IOException { - setup(TestStreamName, " "); + setup(TEST_STREAM_NAME, " ", TEST_REGION); - MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator); - - assertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamName, TestRegion, ""); + assertConfigurationsMatch(deamonConfig, TEST_EXE, TEST_APPLICATION_NAME, TEST_STREAM_NAME, TEST_REGION, ""); } @Test public void testConstructorUsingStreamArn() throws IOException { - setup(null, getTestStreamArn()); + setup(null, getTestStreamArn(), TEST_REGION); - MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator); - - assertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamNameInArn, TestRegionInArn, getTestStreamArn()); + assertConfigurationsMatch(deamonConfig, TEST_EXE, TEST_APPLICATION_NAME, TEST_STREAM_NAME_IN_ARN, TEST_REGION, getTestStreamArn()); } @Test public void testConstructorUsingStreamNameAsEmptyAndStreamArn() throws IOException { - setup("", getTestStreamArn()); + setup("", getTestStreamArn(), TEST_REGION); - MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator); - - assertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamNameInArn, TestRegionInArn, getTestStreamArn()); + assertConfigurationsMatch(deamonConfig, TEST_EXE, TEST_APPLICATION_NAME, TEST_STREAM_NAME_IN_ARN, TEST_REGION, getTestStreamArn()); } @Test public void testConstructorUsingStreamArnOverStreamName() throws IOException { - setup(TestStreamName, getTestStreamArn()); + setup(TEST_STREAM_NAME, getTestStreamArn(), TEST_REGION); - MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator); - - assertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamNameInArn, TestRegionInArn, getTestStreamArn()); + assertConfigurationsMatch(deamonConfig, TEST_EXE, TEST_APPLICATION_NAME, TEST_STREAM_NAME_IN_ARN, TEST_REGION, getTestStreamArn()); } /** @@ -215,16 +221,6 @@ public class MultiLangDaemonConfigTest { assertEquals(expectedStreamArn, deamonConfig.getMultiLangDaemonConfiguration().getStreamArn()); } - private void assertConstructorThrowsException(Class exceptionClass, String exceptionMessage) throws Exception{ - - thrown.expect(exceptionClass); - if(exceptionMessage != null) { - thrown.expectMessage(exceptionMessage); - } - - new MultiLangDaemonConfig(FILENAME, classLoader, configurator); - } - @Test public void testPropertyValidation() { String PROPERTIES_NO_EXECUTABLE_NAME = "applicationName = testApp \n" + "streamName = fakeStream \n" @@ -232,11 +228,11 @@ public class MultiLangDaemonConfigTest { ClassLoader classLoader = Mockito.mock(ClassLoader.class); Mockito.doReturn(new ByteArrayInputStream(PROPERTIES_NO_EXECUTABLE_NAME.getBytes())).when(classLoader) - .getResourceAsStream(FILENAME); + .getResourceAsStream(TEST_FILENAME); MultiLangDaemonConfig config; try { - config = new MultiLangDaemonConfig(FILENAME, classLoader, configurator); + config = new MultiLangDaemonConfig(TEST_FILENAME, classLoader, configurator); Assert.fail("Construction of the config should have failed due to property validation failing."); } catch (IllegalArgumentException e) { // Good diff --git a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfiguratorTest.java b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfiguratorTest.java index a68dd8d8..6f67ef7d 100644 --- a/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfiguratorTest.java +++ b/amazon-kinesis-client-multilang/src/test/java/software/amazon/kinesis/multilang/config/KinesisClientLibConfiguratorTest.java @@ -69,7 +69,7 @@ public class KinesisClientLibConfiguratorTest { @Test public void testWithBasicSetup() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", - "applicationName = b", "AWSCredentialsProvider = " + credentialName1, "workerId = 123" }, '\n')); + "applicationName = b", "AWSCredentialsProvider = " + credentialName1, "workerId = 123", "regionName = us-east-1" }, '\n')); assertEquals(config.getApplicationName(), "b"); assertEquals(config.getStreamName(), "a"); assertEquals(config.getWorkerIdentifier(), "123"); @@ -81,7 +81,7 @@ public class KinesisClientLibConfiguratorTest { public void testWithLongVariables() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "applicationName = app", "streamName = 123", "AWSCredentialsProvider = " + credentialName1 + ", " + credentialName2, - "workerId = 123", "failoverTimeMillis = 100", "shardSyncIntervalMillis = 500" }, '\n')); + "workerId = 123", "failoverTimeMillis = 100", "shardSyncIntervalMillis = 500", "regionName = us-east-1" }, '\n')); assertEquals(config.getApplicationName(), "app"); assertEquals(config.getStreamName(), "123"); @@ -95,7 +95,7 @@ public class KinesisClientLibConfiguratorTest { long epochTimeInSeconds = 1617406032; MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "applicationName = app", "streamName = 123", "AWSCredentialsProvider = " + credentialName1 + ", " + credentialName2, - "initialPositionInStreamExtended = " + epochTimeInSeconds}, '\n')); + "initialPositionInStreamExtended = " + epochTimeInSeconds, "regionName = us-east-1"}, '\n')); assertEquals(config.getInitialPositionInStreamExtended().getTimestamp(), new Date(epochTimeInSeconds * 1000L)); assertEquals(config.getInitialPositionInStream(), InitialPositionInStream.AT_TIMESTAMP); @@ -135,7 +135,7 @@ public class KinesisClientLibConfiguratorTest { public void testWithUnsupportedClientConfigurationVariables() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join( new String[] { "AWSCredentialsProvider = " + credentialName1 + ", " + credentialName2, "workerId = id", - "kinesisClientConfig = {}", "streamName = stream", "applicationName = b" }, + "kinesisClientConfig = {}", "streamName = stream", "applicationName = b", "regionName = us-east-1" }, '\n')); assertEquals(config.getApplicationName(), "b"); @@ -149,7 +149,7 @@ public class KinesisClientLibConfiguratorTest { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = kinesis", "AWSCredentialsProvider = " + credentialName2 + ", " + credentialName1, "workerId = w123", "maxRecords = 10", "metricsMaxQueueSize = 20", "applicationName = kinesis", - "retryGetRecordsInSeconds = 2", "maxGetRecordsThreadPool = 1" }, '\n')); + "retryGetRecordsInSeconds = 2", "maxGetRecordsThreadPool = 1", "regionName = us-east-1" }, '\n')); assertEquals(config.getApplicationName(), "kinesis"); assertEquals(config.getStreamName(), "kinesis"); @@ -164,7 +164,8 @@ public class KinesisClientLibConfiguratorTest { public void testWithBooleanVariables() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD, " + credentialName1, "workerId = 0", - "cleanupLeasesUponShardCompletion = false", "validateSequenceNumberBeforeCheckpointing = true" }, + "cleanupLeasesUponShardCompletion = false", "validateSequenceNumberBeforeCheckpointing = true", + "regionName = us-east-1"}, '\n')); assertEquals(config.getApplicationName(), "b"); @@ -178,7 +179,7 @@ public class KinesisClientLibConfiguratorTest { public void testWithStringVariables() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD," + credentialName1, "workerId = 1", - "kinesisEndpoint = https://kinesis", "metricsLevel = SUMMARY" }, '\n')); + "kinesisEndpoint = https://kinesis", "metricsLevel = SUMMARY", "regionName = us-east-1" }, '\n')); assertEquals(config.getWorkerIdentifier(), "1"); assertEquals(config.getKinesisClient().get("endpointOverride"), URI.create("https://kinesis")); @@ -189,7 +190,7 @@ public class KinesisClientLibConfiguratorTest { public void testWithSetVariables() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD," + credentialName1, "workerId = 1", - "metricsEnabledDimensions = ShardId, WorkerIdentifier" }, '\n')); + "metricsEnabledDimensions = ShardId, WorkerIdentifier", "regionName = us-east-1" }, '\n')); Set expectedMetricsEnabledDimensions = ImmutableSet. builder() .add("ShardId", "WorkerIdentifier").build(); @@ -200,7 +201,7 @@ public class KinesisClientLibConfiguratorTest { public void testWithInitialPositionInStreamTrimHorizon() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD," + credentialName1, "workerId = 123", - "initialPositionInStream = TriM_Horizon" }, '\n')); + "initialPositionInStream = TriM_Horizon", "regionName = us-east-1" }, '\n')); assertEquals(config.getInitialPositionInStream(), InitialPositionInStream.TRIM_HORIZON); } @@ -209,7 +210,7 @@ public class KinesisClientLibConfiguratorTest { public void testWithInitialPositionInStreamLatest() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD," + credentialName1, "workerId = 123", - "initialPositionInStream = LateSt" }, '\n')); + "initialPositionInStream = LateSt", "regionName = us-east-1" }, '\n')); assertEquals(config.getInitialPositionInStream(), InitialPositionInStream.LATEST); } @@ -218,7 +219,7 @@ public class KinesisClientLibConfiguratorTest { public void testSkippingNonKCLVariables() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD," + credentialName1, "workerId = 123", - "initialPositionInStream = TriM_Horizon", "abc = 1" }, '\n')); + "initialPositionInStream = TriM_Horizon", "abc = 1", "regionName = us-east-1" }, '\n')); assertEquals(config.getApplicationName(), "b"); assertEquals(config.getStreamName(), "a"); @@ -230,7 +231,7 @@ public class KinesisClientLibConfiguratorTest { public void testEmptyOptionalVariables() { MultiLangDaemonConfiguration config = getConfiguration(StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD," + credentialName1, "workerId = 123", - "initialPositionInStream = TriM_Horizon", "maxGetRecordsThreadPool = 1" }, '\n')); + "initialPositionInStream = TriM_Horizon", "maxGetRecordsThreadPool = 1", "regionName = us-east-1" }, '\n')); assertThat(config.getMaxGetRecordsThreadPool(), equalTo(1)); assertThat(config.getRetryGetRecordsInSeconds(), nullValue()); } @@ -240,7 +241,7 @@ public class KinesisClientLibConfiguratorTest { String test = StringUtils.join(new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = ABCD," + credentialName1, "workerId = 123", "initialPositionInStream = TriM_Horizon", "maxGetRecordsThreadPool = 0", - "retryGetRecordsInSeconds = 0" }, '\n'); + "retryGetRecordsInSeconds = 0", "regionName = us-east-1" }, '\n'); InputStream input = new ByteArrayInputStream(test.getBytes()); try { @@ -254,7 +255,7 @@ public class KinesisClientLibConfiguratorTest { @Test public void testWithInvalidIntValue() { String test = StringUtils.join(new String[] { "streamName = a", "applicationName = b", - "AWSCredentialsProvider = " + credentialName1, "workerId = 123", "failoverTimeMillis = 100nf" }, '\n'); + "AWSCredentialsProvider = " + credentialName1, "workerId = 123", "failoverTimeMillis = 100nf", "regionName = us-east-1" }, '\n'); InputStream input = new ByteArrayInputStream(test.getBytes()); try { @@ -267,7 +268,7 @@ public class KinesisClientLibConfiguratorTest { @Test public void testWithNegativeIntValue() { String test = StringUtils.join(new String[] { "streamName = a", "applicationName = b", - "AWSCredentialsProvider = " + credentialName1, "workerId = 123", "failoverTimeMillis = -12" }, '\n'); + "AWSCredentialsProvider = " + credentialName1, "workerId = 123", "failoverTimeMillis = -12", "regionName = us-east-1" }, '\n'); InputStream input = new ByteArrayInputStream(test.getBytes()); // separate input stream with getConfiguration to explicitly catch exception from the getConfiguration statement @@ -295,7 +296,7 @@ public class KinesisClientLibConfiguratorTest { public void testWithMissingWorkerId() { String test = StringUtils.join( new String[] { "streamName = a", "applicationName = b", "AWSCredentialsProvider = " + credentialName1, - "failoverTimeMillis = 100", "shardSyncIntervalMillis = 500" }, + "failoverTimeMillis = 100", "shardSyncIntervalMillis = 500", "regionName = us-east-1" }, '\n'); InputStream input = new ByteArrayInputStream(test.getBytes()); MultiLangDaemonConfiguration config = configurator.getConfiguration(input); @@ -374,7 +375,7 @@ public class KinesisClientLibConfiguratorTest { "AWSCredentialsProvider = " + credentialNameKinesis, "AWSCredentialsProviderDynamoDB = " + credentialNameDynamoDB, "AWSCredentialsProviderCloudWatch = " + credentialNameCloudWatch, "failoverTimeMillis = 100", - "shardSyncIntervalMillis = 500" }, '\n'); + "shardSyncIntervalMillis = 500", "regionName = us-east-1" }, '\n'); InputStream input = new ByteArrayInputStream(test.getBytes()); // separate input stream with getConfiguration to explicitly catch exception from the getConfiguration statement @@ -403,7 +404,7 @@ public class KinesisClientLibConfiguratorTest { "AWSCredentialsProvider = " + credentialNameKinesis, "AWSCredentialsProviderDynamoDB = " + credentialName2, "AWSCredentialsProviderCloudWatch = " + credentialName2, "failoverTimeMillis = 100", - "shardSyncIntervalMillis = 500" }, '\n'); + "shardSyncIntervalMillis = 500", "regionName = us-east-1" }, '\n'); InputStream input = new ByteArrayInputStream(test.getBytes()); // separate input stream with getConfiguration to explicitly catch exception from the getConfiguration statement