Search in sources :

Example 16 with ConfigData

use of org.apache.kafka.common.config.ConfigData in project kafka by apache.

the class FileConfigProviderTest method testGetOneKeyAtPath.

@Test
public void testGetOneKeyAtPath() throws Exception {
    ConfigData configData = configProvider.get("dummy", Collections.singleton("testKey"));
    Map<String, String> result = new HashMap<>();
    result.put("testKey", "testResult");
    assertEquals(result, configData.data());
    assertNull(configData.ttl());
}
Also used : HashMap(java.util.HashMap) ConfigData(org.apache.kafka.common.config.ConfigData) Test(org.junit.jupiter.api.Test)

Example 17 with ConfigData

use of org.apache.kafka.common.config.ConfigData in project cruise-control by linkedin.

the class EnvConfigProviderTest method testNonExistingEnvReturnsEmpty.

@Test
public void testNonExistingEnvReturnsEmpty() {
    Set<String> set = new HashSet<>();
    set.add("NON_EXISTING_ENV");
    ConfigData actual;
    try (EnvConfigProvider configProvider = new EnvConfigProvider()) {
        actual = configProvider.get("", set);
    }
    assertEquals(0, actual.data().size());
}
Also used : ConfigData(org.apache.kafka.common.config.ConfigData) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 18 with ConfigData

use of org.apache.kafka.common.config.ConfigData in project cruise-control by linkedin.

the class EnvConfigProviderTest method testExistingEnvReturnsValue.

@Test
public void testExistingEnvReturnsValue() {
    String key = System.getenv().keySet().stream().findFirst().orElse("");
    String expected = System.getenv(key);
    Set<String> set = new HashSet<>();
    set.add(key);
    ConfigData actual;
    try (EnvConfigProvider configProvider = new EnvConfigProvider()) {
        actual = configProvider.get("", set);
    }
    assertEquals(expected, actual.data().get(key));
}
Also used : ConfigData(org.apache.kafka.common.config.ConfigData) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

ConfigData (org.apache.kafka.common.config.ConfigData)18 Test (org.junit.jupiter.api.Test)14 HashMap (java.util.HashMap)4 IOException (java.io.IOException)2 Reader (java.io.Reader)2 HashSet (java.util.HashSet)2 Properties (java.util.Properties)2 ConfigException (org.apache.kafka.common.config.ConfigException)2 Test (org.junit.Test)2