Updated multilang to use stream name over stream arn if both are passed in
This commit is contained in:
parent
3d71e0868e
commit
7ba4efb1d1
3 changed files with 9 additions and 9 deletions
|
|
@ -74,15 +74,15 @@ public class KinesisClientLibConfigurator {
|
|||
});
|
||||
|
||||
Validate.notBlank(configuration.getApplicationName(), "Application name is required");
|
||||
|
||||
try {
|
||||
Validate.notBlank(configuration.getStreamName(), "");
|
||||
}catch (Exception e) {
|
||||
Validate.notBlank(configuration.getStreamArn(), "Stream name or Stream Arn is required. (Stream Name takes precedence if both are passed in)");
|
||||
Arn streamArnObj = Arn.fromString(configuration.getStreamArn());
|
||||
String streamNameFromArn = streamArnObj.getResource().getResource();
|
||||
Validate.notBlank(streamNameFromArn, "");
|
||||
|
||||
//Stream Arn takes precedence. Override existing configuration with the stream name found in the Arn
|
||||
configuration.setStreamName(streamNameFromArn);
|
||||
}catch (Exception e) {
|
||||
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");
|
||||
return configuration;
|
||||
|
|
|
|||
|
|
@ -143,12 +143,12 @@ public class MultiLangDaemonConfigTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testConstructorUsingStreamArnOverStreamName() throws IOException {
|
||||
public void testConstructorUsingStreamNameOverStreamArn() throws IOException {
|
||||
setup(TestStreamName, TestStreamArn);
|
||||
|
||||
MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator);
|
||||
|
||||
AssertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamNameInArn);
|
||||
AssertConfigurationsMatch(deamonConfig, TestExe, TestApplicationName, TestStreamName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ public class KinesisClientLibConfiguratorTest {
|
|||
@Test
|
||||
public void testWithMissingStreamNameAndMissingStreamArn() {
|
||||
thrown.expect(NullPointerException.class);
|
||||
thrown.expectMessage("Stream name or Stream Arn is required. (Stream Arn takes precedence if both are passed in)");
|
||||
thrown.expectMessage("Stream name or Stream Arn is required. (Stream Name takes precedence if both are passed in)");
|
||||
|
||||
String test = StringUtils.join(new String[] {
|
||||
"applicationName = b",
|
||||
|
|
@ -323,7 +323,7 @@ public class KinesisClientLibConfiguratorTest {
|
|||
@Test
|
||||
public void testWithEmptyStreamNameAndMissingStreamArn() {
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
thrown.expectMessage("Stream name or Stream Arn is required. (Stream Arn takes precedence if both are passed in)");
|
||||
thrown.expectMessage("Stream name or Stream Arn is required. (Stream Name takes precedence if both are passed in)");
|
||||
|
||||
String test = StringUtils.join(new String[] {
|
||||
"applicationName = b",
|
||||
|
|
|
|||
Loading…
Reference in a new issue