-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Megabus Topic POJO throws Jackson deserialization exception when … (
#291) * Fix Megabus Topic POJO throws Jackson deserialization exception when reading config yaml * Add config tests for Kafka configuration and Megabus configuration
- Loading branch information
Jona Fenocchi
authored
Dec 18, 2019
1 parent
49597ce
commit 4479b62
Showing
8 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bootstrapServers: kafka:9092 | ||
producer: | ||
bufferMemory: 12356789 | ||
batchSize: 100 | ||
lingerMs: 5 | ||
ssl: | ||
trustStoreLocation: /abc/123 | ||
trustStorePassword: banana | ||
keyStoreLocation: /def/456 | ||
keyStorePassword: apple | ||
keyPassword: orange |
27 changes: 27 additions & 0 deletions
27
kafka/src/test/java/com/bazaarvoice/emodb/kafka/KafkaConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.bazaarvoice.emodb.kafka; | ||
|
||
import com.bazaarvoice.emodb.common.json.CustomJsonObjectMapperFactory; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
import io.dropwizard.configuration.ConfigurationException; | ||
import io.dropwizard.configuration.ConfigurationFactory; | ||
import org.testng.annotations.Test; | ||
|
||
import javax.validation.Validation; | ||
import javax.validation.Validator; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
|
||
public class KafkaConfigTest { | ||
@Test | ||
public void ensureKafkaDefaultConfigDeserialization() | ||
throws IOException, URISyntaxException, ConfigurationException { | ||
Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); | ||
ObjectMapper mapper = CustomJsonObjectMapperFactory.build(new YAMLFactory()); | ||
ConfigurationFactory configurationFactory = new ConfigurationFactory(KafkaConfiguration.class, validator, mapper, "dw"); | ||
// Make sure that our config files are up to date | ||
configurationFactory.build( | ||
new File(KafkaConfiguration.class.getResource("/emodb-kafka-config.yaml").toURI())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
applicationId: megabus-local | ||
refResolverConsumerGroupName: emodb.megabus.resolver | ||
delayProcessorConsumerGroupName: emodb.megabus.delay | ||
megabusRefTopic: | ||
name: emodb.internal.megabus.ref | ||
partitions: 8 | ||
replicationFactor: 1 | ||
megabusTopic: | ||
name: emodb.megabus | ||
partitions: 8 | ||
replicationFactor: 1 | ||
missingRefTopic: | ||
name: emodb.internal.megabus.missing | ||
partitions: 8 | ||
replicationFactor: 1 | ||
retryRefTopic: | ||
name: emodb.internal.megabus.retry | ||
partitions: 8 | ||
replicationFactor: 1 | ||
boot: | ||
queueServiceApiKey: local_admin | ||
scanStatusTable: __system_megabus_boot | ||
pendingScanRangeQueueName: megabus-boot-pending-scan-ranges | ||
completeScanRangeQueueName: megabus-boot-complete-scan-ranges | ||
refProducer: | ||
batchSize: 400 | ||
skipWaitThreshold: 250 | ||
pollIntervalMs: 100 |
28 changes: 28 additions & 0 deletions
28
megabus/src/test/java/com/bazaarvoice/megabus/MegabusConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.bazaarvoice.megabus; | ||
|
||
import com.bazaarvoice.emodb.common.json.CustomJsonObjectMapperFactory; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
import io.dropwizard.configuration.ConfigurationException; | ||
import io.dropwizard.configuration.ConfigurationFactory; | ||
import org.testng.annotations.Test; | ||
|
||
import javax.validation.Validation; | ||
import javax.validation.Validator; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
|
||
public class MegabusConfigTest { | ||
@Test | ||
public void ensureMegabusDefaultConfigDeserialization() | ||
throws IOException, URISyntaxException, ConfigurationException { | ||
Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); | ||
ObjectMapper mapper = CustomJsonObjectMapperFactory.build(new YAMLFactory()); | ||
ConfigurationFactory configurationFactory = new ConfigurationFactory(MegabusConfiguration.class, validator, mapper, "dw"); | ||
// Make sure that our config files are up to date | ||
configurationFactory.build( | ||
new File(MegabusConfiguration.class.getResource("/emodb-megabus-config.yaml").toURI())); | ||
} | ||
} | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.