Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept camel-case properties for producer configuration #148

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
public class KinesisProducerConfigurationTest {
@SuppressWarnings("unused")
private static final Logger log = LoggerFactory.getLogger(KinesisProducerConfigurationTest.class);

private static String writeFile(String contents) {
try {
File f = File.createTempFile(UUID.randomUUID().toString(), "");
Expand All @@ -39,7 +39,7 @@ private static String writeFile(String contents) {
throw new RuntimeException(e);
}
}

private static String writeFile(Properties p) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Expand All @@ -50,7 +50,7 @@ private static String writeFile(Properties p) {
throw new RuntimeException(e);
}
}

@Test
public void loadString() {
Properties p = new Properties();
Expand All @@ -59,7 +59,7 @@ public void loadString() {
KinesisProducerConfiguration cfg = KinesisProducerConfiguration.fromPropertiesFile(writeFile(p));
assertEquals(v, cfg.getMetricsNamespace());
}

@Test
public void loadLong() {
KinesisProducerConfiguration defaultConfig = new KinesisProducerConfiguration();
Expand All @@ -69,7 +69,7 @@ public void loadLong() {
KinesisProducerConfiguration cfg = KinesisProducerConfiguration.fromPropertiesFile(writeFile(p));
assertEquals(v, cfg.getConnectTimeout());
}

@Test
public void loadBoolean() {
KinesisProducerConfiguration defaultConfig = new KinesisProducerConfiguration();
Expand All @@ -80,6 +80,16 @@ public void loadBoolean() {
assertEquals(v, cfg.isVerifyCertificate());
}

@Test
public void loadCamelCaseProperty() {
KinesisProducerConfiguration defaultConfig = new KinesisProducerConfiguration();
Properties p = new Properties();
long v = defaultConfig.getConnectTimeout() + 1;
p.setProperty("connectTimeOut", Long.toString(v));
KinesisProducerConfiguration cfg = KinesisProducerConfiguration.fromPropertiesFile(writeFile(p));
assertEquals(v, cfg.getConnectTimeout());
}

@Test
public void unknownProperty() {
Properties p = new Properties();
Expand Down