Search in sources :

Example 1 with MapStringDynamicConfigProvider

use of org.apache.druid.metadata.MapStringDynamicConfigProvider in project druid by druid-io.

the class KafkaRecordSupplierTest method testAddConsumerPropertiesFromConfig.

@Test
public void testAddConsumerPropertiesFromConfig() {
    DynamicConfigProvider dynamicConfigProvider = new MapStringDynamicConfigProvider(ImmutableMap.of("kafka.prop.2", "value.2", KafkaSupervisorIOConfig.TRUST_STORE_PASSWORD_KEY, "pwd2"));
    Properties properties = new Properties();
    Map<String, Object> consumerProperties = ImmutableMap.of(KafkaSupervisorIOConfig.TRUST_STORE_PASSWORD_KEY, "pwd1", "kafka.prop.1", "value.1", "druid.dynamic.config.provider", OBJECT_MAPPER.convertValue(dynamicConfigProvider, Map.class));
    KafkaRecordSupplier.addConsumerPropertiesFromConfig(properties, OBJECT_MAPPER, consumerProperties);
    Assert.assertEquals(3, properties.size());
    Assert.assertEquals("value.1", properties.getProperty("kafka.prop.1"));
    Assert.assertEquals("value.2", properties.getProperty("kafka.prop.2"));
    Assert.assertEquals("pwd2", properties.getProperty(KafkaSupervisorIOConfig.TRUST_STORE_PASSWORD_KEY));
}
Also used : MapStringDynamicConfigProvider(org.apache.druid.metadata.MapStringDynamicConfigProvider) DynamicConfigProvider(org.apache.druid.metadata.DynamicConfigProvider) MapStringDynamicConfigProvider(org.apache.druid.metadata.MapStringDynamicConfigProvider) Properties(java.util.Properties) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Test(org.junit.Test)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 DynamicConfigProvider (org.apache.druid.metadata.DynamicConfigProvider)1 MapStringDynamicConfigProvider (org.apache.druid.metadata.MapStringDynamicConfigProvider)1 Test (org.junit.Test)1