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");
|
Validate.notBlank(configuration.getApplicationName(), "Application name is required");
|
||||||
|
|
||||||
try {
|
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());
|
Arn streamArnObj = Arn.fromString(configuration.getStreamArn());
|
||||||
String streamNameFromArn = streamArnObj.getResource().getResource();
|
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);
|
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");
|
Validate.isTrue(configuration.getKinesisCredentialsProvider().isDirty(), "A basic set of AWS credentials must be provided");
|
||||||
return configuration;
|
return configuration;
|
||||||
|
|
|
||||||
|
|
@ -143,12 +143,12 @@ public class MultiLangDaemonConfigTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConstructorUsingStreamArnOverStreamName() throws IOException {
|
public void testConstructorUsingStreamNameOverStreamArn() throws IOException {
|
||||||
setup(TestStreamName, TestStreamArn);
|
setup(TestStreamName, TestStreamArn);
|
||||||
|
|
||||||
MultiLangDaemonConfig deamonConfig = new MultiLangDaemonConfig(FILENAME, classLoader, configurator);
|
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
|
@Test
|
||||||
public void testWithMissingStreamNameAndMissingStreamArn() {
|
public void testWithMissingStreamNameAndMissingStreamArn() {
|
||||||
thrown.expect(NullPointerException.class);
|
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[] {
|
String test = StringUtils.join(new String[] {
|
||||||
"applicationName = b",
|
"applicationName = b",
|
||||||
|
|
@ -323,7 +323,7 @@ public class KinesisClientLibConfiguratorTest {
|
||||||
@Test
|
@Test
|
||||||
public void testWithEmptyStreamNameAndMissingStreamArn() {
|
public void testWithEmptyStreamNameAndMissingStreamArn() {
|
||||||
thrown.expect(IllegalArgumentException.class);
|
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[] {
|
String test = StringUtils.join(new String[] {
|
||||||
"applicationName = b",
|
"applicationName = b",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue